forge-terminal 0.5.9 → 0.6.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.
- package/README.md +18 -12
- package/dist/chunks/{about-credits-32BUKO4K.js → about-credits-XL2AIGQ7.js} +1 -1
- package/dist/chunks/args-PS5SVBZY.js +3 -0
- package/dist/chunks/boot-QRKC4QBA.js +3 -0
- package/dist/chunks/check-HOITNMJX.js +3 -0
- package/dist/chunks/{chunk-6RCS3KBP.js → chunk-2JU3YZQU.js} +1 -1
- package/dist/chunks/{chunk-Q6KQWJ4J.js → chunk-2L66A2X6.js} +1 -1
- package/dist/chunks/chunk-2OSM4W4D.js +3 -0
- package/dist/chunks/{chunk-GVVQP3LF.js → chunk-3HG7RXC2.js} +1 -1
- package/dist/chunks/chunk-3IX3QA76.js +3 -0
- package/dist/chunks/chunk-3SVHRKQH.js +6 -0
- package/dist/chunks/chunk-4MZV4SRU.js +4 -0
- package/dist/chunks/chunk-4NDZTK22.js +3 -0
- package/dist/chunks/{chunk-7XFLG32B.js → chunk-5FJT4BNY.js} +1 -1
- package/dist/chunks/chunk-5XJCMMCM.js +3 -0
- package/dist/chunks/chunk-65Y7YCZZ.js +3 -0
- package/dist/chunks/{chunk-WBW6G4N6.js → chunk-6HUYBVQA.js} +1 -1
- package/dist/chunks/chunk-BSFBZBAI.js +16 -0
- package/dist/chunks/chunk-BWJNZT75.js +6 -0
- package/dist/chunks/{chunk-WE6KP4FR.js → chunk-BYUOU2Q2.js} +1 -1
- package/dist/chunks/chunk-CCNRNCRU.js +3 -0
- package/dist/chunks/chunk-ECA4PW5T.js +3 -0
- package/dist/chunks/chunk-EIPMQFIF.js +3 -0
- package/dist/chunks/chunk-EJWTYDBJ.js +3 -0
- package/dist/chunks/chunk-EYOO35US.js +3 -0
- package/dist/chunks/chunk-FGR6QCG5.js +3 -0
- package/dist/chunks/chunk-FWVE3GNA.js +3 -0
- package/dist/chunks/{chunk-ILQDMVJR.js → chunk-FXA45V4B.js} +1 -1
- package/dist/chunks/chunk-G6L5NIJ5.js +19 -0
- package/dist/chunks/chunk-GIG4I2IC.js +23 -0
- package/dist/chunks/chunk-HXKLYK3M.js +7 -0
- package/dist/chunks/chunk-I2LPGKUU.js +3 -0
- package/dist/chunks/chunk-JD3RB6IV.js +66 -0
- package/dist/chunks/{chunk-W53XNVNH.js → chunk-JUA63KQK.js} +1 -1
- package/dist/chunks/{chunk-4KGC5ZBZ.js → chunk-NLM2SP3F.js} +1 -1
- package/dist/chunks/chunk-NMGQGYVM.js +3 -0
- package/dist/chunks/chunk-NUCGWLOY.js +8 -0
- package/dist/chunks/{chunk-SM735FG7.js → chunk-NUTTDNTG.js} +1 -1
- package/dist/chunks/chunk-PA7AG2NK.js +55 -0
- package/dist/chunks/{chunk-3374PCO5.js → chunk-PISCJKIG.js} +1 -1
- package/dist/chunks/chunk-PON65UTS.js +3 -0
- package/dist/chunks/chunk-QIMSNTKL.js +3 -0
- package/dist/chunks/{chunk-4MJEEEFA.js → chunk-QO4JUY6B.js} +1 -1
- package/dist/chunks/chunk-QPUKPSPZ.js +3 -0
- package/dist/chunks/{chunk-YRXJDFP3.js → chunk-S7BZPV5T.js} +1 -1
- package/dist/chunks/chunk-SFN3LBB6.js +3 -0
- package/dist/chunks/{chunk-OXDRJO4V.js → chunk-TNIPRV6K.js} +1 -1
- package/dist/chunks/{chunk-SZRSAL64.js → chunk-UEAZTRTL.js} +1 -1
- package/dist/chunks/chunk-UI4EUC3S.js +3 -0
- package/dist/chunks/chunk-UN5DSJE2.js +3 -0
- package/dist/chunks/chunk-UUTBDIFR.js +3 -0
- package/dist/chunks/chunk-WID72ZII.js +4 -0
- package/dist/chunks/chunk-X2YUHPOU.js +4 -0
- package/dist/chunks/chunk-X4QI2EYV.js +3 -0
- package/dist/chunks/chunk-YBA6DJQ4.js +3 -0
- package/dist/chunks/chunk-YJZEHJ6U.js +3 -0
- package/dist/chunks/chunk-YYZYZWF5.js +80 -0
- package/dist/chunks/clip-command-4ON3Q57W.js +3 -0
- package/dist/chunks/clipboard-W67Q22JG.js +3 -0
- package/dist/chunks/colour-2BGK2BFR.js +3 -0
- package/dist/chunks/command-ZX3L5VFO.js +3 -0
- package/dist/chunks/config-command-VEGQPXVB.js +3 -0
- package/dist/chunks/continue-editing-LTMIEFRD.js +3 -0
- package/dist/chunks/decoded-SK6W44WW.js +3 -0
- package/dist/chunks/{entry-BZYPZONY.js → entry-3R2GK3IW.js} +2 -2
- package/dist/chunks/execute-TC3QZ6GL.js +3 -0
- package/dist/chunks/extensions-3SG2LW7R.js +3 -0
- package/dist/chunks/{extensions-command-JZSOQJEV.js → extensions-command-RNAPQYWV.js} +1 -1
- package/dist/chunks/ffmpeg-G4TRWUTV.js +3 -0
- package/dist/chunks/image-67XO45NW.js +3 -0
- package/dist/chunks/install-UN3YGSJW.js +3 -0
- package/dist/chunks/{install-KGFOAQCU.js → install-X7EEH5CQ.js} +1 -1
- package/dist/chunks/launch-EGFNGHLN.js +18 -0
- package/dist/chunks/lock-5ZO5PCZP.js +3 -0
- package/dist/chunks/manager-272REVNF.js +4 -0
- package/dist/chunks/{needed-DYERJ72M.js → needed-7IUPDEJB.js} +1 -1
- package/dist/chunks/notify-UD7FQAWX.js +3 -0
- package/dist/chunks/{own-2QGMHSKL.js → own-5BD5BVE7.js} +1 -1
- package/dist/chunks/pdfium-MHPBLZY5.js +3 -0
- package/dist/chunks/preferences-E2CH2YSG.js +3 -0
- package/dist/chunks/preset-command-5I3NZ2OP.js +3 -0
- package/dist/chunks/registry-DWFV4GBG.js +3 -0
- package/dist/chunks/{run-GUFPETHF.js → run-3DX3SROY.js} +1 -1
- package/dist/chunks/{server-PIXRL5PA.js → server-TF32DQEO.js} +32 -28
- package/dist/chunks/signals-QSXY3F2A.js +3 -0
- package/dist/chunks/text-layer-PFIDCTEL.js +5 -0
- package/dist/chunks/theme-4Y66DDAO.js +3 -0
- package/dist/chunks/transcribe-HH5P3PV4.js +3 -0
- package/dist/chunks/transcribe-command-VY5HYNXV.js +3 -0
- package/dist/chunks/update-command-6VVDG75Y.js +3 -0
- package/dist/chunks/update-note-XV2T2NNG.js +3 -0
- package/dist/chunks/watch-command-BMSMGIHK.js +3 -0
- package/dist/helpers/forge-transcribe +0 -0
- package/dist/index.js +16 -15
- package/package.json +19 -3
- package/dist/chunks/args-ZVZQR23M.js +0 -3
- package/dist/chunks/boot-2YFTQOMG.js +0 -3
- package/dist/chunks/check-B6NP7BEM.js +0 -3
- package/dist/chunks/chunk-4RNVZQRC.js +0 -3
- package/dist/chunks/chunk-6KUWZQGG.js +0 -3
- package/dist/chunks/chunk-6MWJO3GB.js +0 -4
- package/dist/chunks/chunk-6PEIZZNE.js +0 -3
- package/dist/chunks/chunk-7FW7JX74.js +0 -36
- package/dist/chunks/chunk-7XDMC7FL.js +0 -72
- package/dist/chunks/chunk-AR3M2PLK.js +0 -3
- package/dist/chunks/chunk-ASLKQXZ2.js +0 -3
- package/dist/chunks/chunk-BKLPRILS.js +0 -3
- package/dist/chunks/chunk-FAUL5L2W.js +0 -3
- package/dist/chunks/chunk-FBVRKMAF.js +0 -3
- package/dist/chunks/chunk-GHYODKA3.js +0 -3
- package/dist/chunks/chunk-H3DIRJFE.js +0 -3
- package/dist/chunks/chunk-HTA25PO2.js +0 -3
- package/dist/chunks/chunk-J7FLFHQJ.js +0 -3
- package/dist/chunks/chunk-K253E723.js +0 -3
- package/dist/chunks/chunk-KH5DHZ2U.js +0 -8
- package/dist/chunks/chunk-L44NRTP4.js +0 -3
- package/dist/chunks/chunk-N32JL4UI.js +0 -3
- package/dist/chunks/chunk-N6RCLJE6.js +0 -4
- package/dist/chunks/chunk-NDYMC3HY.js +0 -66
- package/dist/chunks/chunk-NMECUMJD.js +0 -7
- package/dist/chunks/chunk-OQBIYNGK.js +0 -6
- package/dist/chunks/chunk-QQV7CCAY.js +0 -3
- package/dist/chunks/chunk-RCWFUBTG.js +0 -3
- package/dist/chunks/chunk-TFGK7IRZ.js +0 -19
- package/dist/chunks/chunk-TGC24JEW.js +0 -4
- package/dist/chunks/chunk-TLHUFIXD.js +0 -3
- package/dist/chunks/chunk-V6GWPR2A.js +0 -3
- package/dist/chunks/chunk-VJMOZPHW.js +0 -3
- package/dist/chunks/chunk-YPAFAG4W.js +0 -6
- package/dist/chunks/chunk-ZBMJTIYR.js +0 -3
- package/dist/chunks/chunk-ZX5FDZZW.js +0 -55
- package/dist/chunks/clip-command-MDSM6KJP.js +0 -3
- package/dist/chunks/clipboard-IZJTBTSW.js +0 -3
- package/dist/chunks/colour-2MYODUDY.js +0 -3
- package/dist/chunks/command-GAGAD65W.js +0 -3
- package/dist/chunks/config-command-CKPJXJEE.js +0 -3
- package/dist/chunks/continue-editing-M6WESEVB.js +0 -3
- package/dist/chunks/decoded-XWKU23RG.js +0 -3
- package/dist/chunks/execute-7M6WA4W7.js +0 -3
- package/dist/chunks/extensions-E3OUBT36.js +0 -3
- package/dist/chunks/ffmpeg-KDZEPLNA.js +0 -3
- package/dist/chunks/image-R5C3AWHT.js +0 -3
- package/dist/chunks/install-MFYGS5TG.js +0 -3
- package/dist/chunks/launch-VNW4YQ4Z.js +0 -17
- package/dist/chunks/lock-BG3CLOHA.js +0 -3
- package/dist/chunks/manager-L753MI7U.js +0 -4
- package/dist/chunks/notify-NQNNOBFC.js +0 -3
- package/dist/chunks/pdfium-77L526HZ.js +0 -3
- package/dist/chunks/preferences-3P4V2EDX.js +0 -3
- package/dist/chunks/preset-command-UNMXHW5A.js +0 -3
- package/dist/chunks/registry-RS7LQ3UA.js +0 -3
- package/dist/chunks/text-layer-LHZNDMPZ.js +0 -3
- package/dist/chunks/theme-P3ZE2ZYB.js +0 -3
- package/dist/chunks/transcribe-KXQXEVBJ.js +0 -3
- package/dist/chunks/transcribe-command-JHWN4RWU.js +0 -3
- package/dist/chunks/update-command-DWEBUFT5.js +0 -3
- package/dist/chunks/update-note-CY3LCBCJ.js +0 -3
- package/dist/chunks/watch-command-QGVXM23I.js +0 -3
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __forgeCreateRequire } from 'node:module';
|
|
2
2
|
const require = __forgeCreateRequire(import.meta.url);
|
|
3
|
-
import{a as Jd,b as fc}from"./chunk-YPAFAG4W.js";import{c as Hd}from"./chunk-6KUWZQGG.js";import{a as qd,b as Md,c as Ld}from"./chunk-GHYODKA3.js";import"./chunk-W53XNVNH.js";import{a as jd,c as Ad}from"./chunk-SM735FG7.js";import{a as Id,d as Bd}from"./chunk-6MWJO3GB.js";import{a as Td,b as Cd,f as kd}from"./chunk-ASLKQXZ2.js";import"./chunk-BKLPRILS.js";import"./chunk-Q6KQWJ4J.js";import{g as Ud,i as Fd}from"./chunk-TFGK7IRZ.js";import{i as Zd,o as Vd}from"./chunk-7XFLG32B.js";import"./chunk-6RMRWBMB.js";import"./chunk-QQV7CCAY.js";import"./chunk-VJMOZPHW.js";import"./chunk-AR3M2PLK.js";import{b as Kd}from"./chunk-FBVRKMAF.js";import{d as Pd,f as Ed}from"./chunk-3374PCO5.js";import{b as Dd}from"./chunk-HZDYZ5RD.js";import{b as Rd,j as ds}from"./chunk-N32JL4UI.js";import{f as ps,g as Od,h as xd,i as Nd}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as _t}from"./chunk-TGC24JEW.js";import"./chunk-O7DK3GJT.js";import"./chunk-K253E723.js";import"./chunk-EEQSUBBL.js";import"./chunk-OQBIYNGK.js";import"./chunk-FAUL5L2W.js";import{b as mc}from"./chunk-N6RCLJE6.js";import"./chunk-WE6KP4FR.js";import"./chunk-KH5DHZ2U.js";import"./chunk-HON4OV7M.js";import"./chunk-TLHUFIXD.js";import{m as wd}from"./chunk-4MJEEEFA.js";import"./chunk-V6GWPR2A.js";import"./chunk-WBW6G4N6.js";import{$ as $d,G as st,a as Zo}from"./chunk-ZBMJTIYR.js";import{d as pc}from"./chunk-J7FLFHQJ.js";import"./chunk-VLVNA4T3.js";import"./chunk-H3DIRJFE.js";import"./chunk-KXKQDFHX.js";import{d as dc}from"./chunk-TMUK2DD3.js";var US=Object.create,ms=Object.defineProperty,FS=Object.getOwnPropertyDescriptor,VS=Object.getOwnPropertyNames,HS=Object.getPrototypeOf,JS=Object.prototype.hasOwnProperty,U=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Gd=(e,t)=>{let r={};for(var o in e)ms(r,o,{get:e[o],enumerable:!0});return t&&ms(r,Symbol.toStringTag,{value:"Module"}),r},BS=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=VS(t),s=0,i=n.length,c;s<i;s++)c=n[s],!JS.call(e,c)&&c!==r&&ms(e,c,{get:(a=>t[a]).bind(null,c),enumerable:!(o=FS(t,c))||o.enumerable});return e},fs=(e,t,r)=>(r=e!=null?US(HS(e)):{},BS(t||!e||!e.__esModule?ms(r,"default",{value:e,enumerable:!0}):r,e));var KS=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Wd=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),GS=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),WS=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function Yd(e){return typeof e=="string"&&Wd.has(e.replace(/#$/,""))}function Xd(e,t){if(!("$schema"in e)||typeof e.$schema!="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(KS.has(r))return"2020-12";if(Wd.has(r))return"2019-09";if(GS.has(r)||WS.has(r))return"draft-7";throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var ce={};dc(ce,{BIGINT_FORMAT_RANGES:()=>Ss,CONSTANT_CATCH:()=>up,Class:()=>_c,NUMBER_FORMAT_RANGES:()=>Fo,aborted:()=>ut,allowsEval:()=>Rc,assert:()=>ty,assertEqual:()=>YS,assertIs:()=>QS,assertNever:()=>ey,assertNotEqual:()=>XS,assignProp:()=>Ye,attachSchema:()=>Vo,base64ToUint8Array:()=>ap,base64urlToUint8Array:()=>vy,cached:()=>Nr,captureStackTrace:()=>gs,cleanEnum:()=>yy,cleanRegex:()=>Uo,clone:()=>it,cloneDef:()=>ny,codePointLength:()=>Ho,constantCatch:()=>lp,createTransparentProxy:()=>ly,defineLazy:()=>vc,defineLazyInternal:()=>ge,derived:()=>$y,esc:()=>bc,escapeRegex:()=>vt,explicitlyAborted:()=>Pc,extend:()=>my,finalizeIssue:()=>lt,floatSafeRemainder:()=>yc,getElementAtPath:()=>sy,getEnumValues:()=>Or,getLengthableOrigin:()=>Jo,getParsedType:()=>uy,getSizableOrigin:()=>ip,hexToUint8Array:()=>zy,hide:()=>bs,installLazyProp:()=>Ty,isObject:()=>cr,isPlainObject:()=>Mt,issue:()=>Ar,joinValues:()=>hs,jsonStringifyReplacer:()=>xr,members:()=>Tc,merge:()=>hy,mergeDefs:()=>yt,normalizeParams:()=>re,nullish:()=>Sc,numKeys:()=>cy,objectClone:()=>ry,omit:()=>py,optionalKeys:()=>wc,own:()=>qt,parsedType:()=>Ec,partial:()=>gy,pick:()=>dy,prefixIssues:()=>bt,primitiveTypes:()=>np,promiseAllObject:()=>iy,propertyKeyTypes:()=>$c,randomString:()=>ay,rawShape:()=>jr,required:()=>_y,safeExtend:()=>fy,shallowClone:()=>op,sizeCaps:()=>vs,slugify:()=>zc,stringifyPrimitive:()=>_s,toZod:()=>ep,uint8ArrayToBase64:()=>cp,uint8ArrayToBase64url:()=>by,uint8ArrayToHex:()=>Ry,unwrapMessage:()=>Ir});function YS(e){return e}function XS(e){return e}function ep(){return e=>e}function QS(e){}function ey(e){throw new Error("Unexpected value in exhaustive check")}function ty(e){}function Or(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function hs(e,t="|"){return e.map(r=>_s(r)).join(t)}function xr(e,t){return typeof t=="bigint"?t.toString():t}var gc=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Nr(e){return new gc(e)}function Sc(e){return e==null}function Uo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function yc(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var Qd=Symbol("evaluating");function vc(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Qd)return o===void 0&&(o=Qd,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function ry(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ye(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function St(e){return jr(e._zod.def)??e._zod.def.shape}function tp(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return Ye(this,t,o),o},enumerable:!0,configurable:!0})}function rp(e,t,r){t in e?Ye(e,t,r):e[t]=r}function ar(e,t,r,o){let n=St(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(n,s);i.enumerable&&(i.get?tp(e,s,()=>{let c=t._zod.def.shape[s];return o?o(c,s):c}):rp(e,s,o?o(i.value,s):i.value))}}function oy(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);o.enumerable&&(o.get?tp(e,r,()=>t[r]):rp(e,r,o.value))}}function yt(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function ny(e){return yt(e._zod.def)}function sy(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function iy(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function ay(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function bc(e){return JSON.stringify(e)}function zc(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var gs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function cr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Rc=Nr(()=>{if(Xe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Mt(e){if(cr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(cr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function op(e){return Mt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function cy(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var uy=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},$c=new Set(["string","number","symbol"]),np=new Set(["string","number","bigint","boolean","symbol","undefined"]);function vt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function it(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function re(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ly(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function _s(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function wc(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Fo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ss={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function dy(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return ar(s,e,ys(e,t)),it(e,yt(r,{shape:s,checks:[]}))}function ys(e,t){let r=St(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&o.push(n)}return o}function py(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(ys(e,t)),i={};return ar(i,e,Reflect.ownKeys(St(e)).filter(c=>!s.has(c))),it(e,yt(r,{shape:i,checks:[]}))}function my(e,t){if(!Mt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=St(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return it(e,yt(e._zod.def,{shape:sp(e,t)}))}function sp(e,t){let r={};return ar(r,e,Reflect.ownKeys(St(e))),oy(r,t),r}function fy(e,t){if(!Mt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return it(e,yt(e._zod.def,{shape:sp(e,t)}))}function hy(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};ar(r,e,Reflect.ownKeys(St(e))),ar(r,t,Reflect.ownKeys(St(t)));let o=yt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return it(e,o)}function gy(e,t,r,o="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let c=r?new Set(ys(t,r)):void 0,a={};return ar(a,t,Reflect.ownKeys(St(t)),e&&((u,d)=>c&&!c.has(d)?u:new e({type:"optional",innerType:u}))),it(t,yt(t._zod.def,{shape:a,checks:[]}))}function _y(e,t,r){let o=r?new Set(ys(t,r)):void 0,n={};return ar(n,t,Reflect.ownKeys(St(t)),(s,i)=>o&&!o.has(i)?s:new e({type:"nonoptional",innerType:s})),it(t,yt(t._zod.def,{shape:n}))}function ut(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Pc(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function bt(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Ir(e){return typeof e=="string"?e:e?.message}function vs(e){let t=[];for(let r of e??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;n>=0&&t.push([n,r])}return t}function Vo(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function lt(e,t,r){var o;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(o=e).schema??(o.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Ir(e.inst?._zod.def?.error?.(e))??Ir(s?.(e))??Ir(t?.error?.(e))??Ir(r.customError?.(e))??Ir(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=i,t?.reportInput&&(c.input=e.input),c}function ip(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Sy=/[\uD800-\uDBFF]/;function Ho(e){let t=e.length;if(!Sy.test(e))return t;let r=t;for(let o=0;o<t-1;o++)(e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320&&(r--,o++);return r}function Jo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ec(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Ar(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function yy(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function ap(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function cp(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function vy(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return ap(t+r)}function by(e){return cp(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function zy(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function Ry(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var _c=class{constructor(...t){}};function Tc(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);o.get?Object.defineProperty(e,r,{...o,enumerable:!1}):wy(e,r,o.value)}}function qt(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function bs(e,t,r){return qt(e,t,r,!1)}function $y(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return qt(this,r,o(this))},set(n){qt(this,r,n)}})}return t}function wy(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:qt(this,t,r.bind(this))},set(o){qt(this,t,o)}})}function Py(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var hc,At=!1,Ey={configurable:!0,get(){At=!0}};function ge(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&hc!==e._zod){hc=void 0;return}hc=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,Ey);let n=At;At=!1;try{let s=r(this);return At?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),At=At||n,s}catch(s){throw delete this[t],At=At||n,s}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function Ty(e,t,r,o){let n=Py(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:s})}})}var up="~constantCatch";function lp(e){let t=()=>e;return t[up]=!0,t}var dp,kc=Object.freeze({status:"aborted"}),Cc={value:void 0,enumerable:!1},pp="captureStackTrace"in Error?Error:null;function Cy(e){let t=pp;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return pp=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function q(e,t,r,o){let n={};function s(_){this.def=_,this.constr=p,this.traits=new Set}s.prototype=n;let i=r,c=i&&new WeakSet;function a(_,y){if(_._zod){if(_._zod.traits.has(e))return}else{Cc.value=new s(y);try{Object.defineProperty(_,"_zod",Cc)}finally{Cc.value=void 0}}if(_._zod.traits.add(e),t(_,y),c){let g=Object.getPrototypeOf(_),h=_._zod.constr.prototype,f=g;for(;f&&f!==h;)f=Object.getPrototypeOf(f);let z=f??g;c.has(z)||(c.add(z),Tc(z,i))}let m=p.prototype;for(let g in m)Object.prototype.hasOwnProperty.call(m,g)&&(g in _||(_[g]=m[g].bind(_)))}let u=o?.Parent??Object;class d extends u{}Object.defineProperty(d,"name",{value:e});function p(_){let y=o?.Parent?Cy(d):this;a(y,_);let m=y._zod.deferred;if(m){for(let h of m)h();y._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;return g&&g(y),y}return Object.defineProperty(p,"init",{value:a}),Object.defineProperty(p,Symbol.hasInstance,{value:_=>o?.Parent&&_ instanceof o.Parent?!0:_?._zod?.traits?.has(e)}),Object.defineProperty(p,"name",{value:e}),p}var dt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},qr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(dp=globalThis).__zod_globalConfig??(dp.__zod_globalConfig={});var Xe=globalThis.__zod_globalConfig;function Qe(e){return e&&Object.assign(Xe,e),Xe}function ky(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,xr,2)),e.message}function Iy(e){this._zod.message=e}var Oy={get:ky,set:Iy,enumerable:!0,configurable:!0},Oc={value:void 0,enumerable:!1},mp=new WeakSet([Object.prototype,Error.prototype]),fp=(e,t)=>{e.name="$ZodError",Oc.value=t,Object.defineProperty(e,"issues",Oc),Oc.value=void 0,Object.defineProperty(e,"message",Oy);let r=Object.getPrototypeOf(e);mp.has(r)||(mp.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},hp=q("$ZodError",fp),t$=q("$ZodError",fp,void 0,{Parent:Error});function xy(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function xc(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?xy(r,n.path[0],()=>[]).push(t(n)):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Nc(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(c=>o({issues:c},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let c=[...s,...i.path];if(c.length===0)r._errors.push(t(i));else{let a=r,u=0;for(;u<c.length;){let d=c[u],p=u===c.length-1;if(d==="_errors"){p&&a._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(a,d)||Object.defineProperty(a,d,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let _=a[d];p&&_._errors.push(t(i)),a=_,u++}}}};return o(e),r}function zs(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Rs=e=>{let t=(r,o,n,s)=>{let i=n?{...n,async:!1}:{async:!1},c=r._zod.run({value:o,issues:[]},i);if(c instanceof Promise)throw new dt;if(c.issues.length){let a=new(s?.Err??e)(c.issues.map(u=>lt(u,i,Qe())));throw gs(a,s?.callee??t),a}return c.value};return t};var $s=e=>{let t=async(r,o,n,s)=>{let i=n?{...n,async:!0}:{async:!0},c=r._zod.run({value:o,issues:[]},i);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(s?.Err??e)(c.issues.map(u=>lt(u,i,Qe())));throw gs(a,s?.callee??t),a}return c.value};return t};var ws=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new dt;return s.issues.length?gp(e,s.issues,n):{success:!0,data:s.value}};function gp(e,t,r){let o;return{success:!1,get error(){return o||(o=new e(t.map(n=>lt(n,r,Qe()))),t=void 0,r=void 0),o},set error(n){o=n,t=void 0,r=void 0}}}var Ps=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?gp(e,s.issues,n):{success:!0,data:s.value}};var Ny=Symbol.for("zod.compile.invalid"),jy=Symbol.for("zod.compile.fallback"),jc=((e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==Ny)return!0;if(o.definite===!0&&r===void 0)return!1}return Ay(e,t,r)});function Ay(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,s;if(n?(o[jy]=!0,s=n({value:t,issues:[]},o)):s=e._zod.run({value:t,issues:[]},o),s instanceof Promise)throw new dt;return s.issues.length===0}var Ac=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);return n instanceof Promise&&(n=await n),n.issues.length===0},_p=e=>{let t=Rs(e),r=(o,n,s,i)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return t(o,n,c,zs(r,i))};return r};var Sp=e=>{let t=Rs(e),r=(o,n,s,i)=>t(o,n,s,zs(r,i));return r};var yp=e=>{let t=$s(e),r=async(o,n,s,i)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(o,n,c,zs(r,i))};return r};var vp=e=>{let t=$s(e),r=async(o,n,s,i)=>await t(o,n,s,zs(r,i));return r};var bp=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ws(e)(t,r,n)};var zp=e=>(t,r,o)=>ws(e)(t,r,o);var Rp=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ps(e)(t,r,n)};var $p=e=>async(t,r,o)=>Ps(e)(t,r,o);var wp=/^[cC][0-9a-z]{6,}$/,Pp=/^[0-9a-z]+$/,Ep=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Tp=/^[0-9a-vA-V]{20}$/,Cp=/^[A-Za-z0-9]{27}$/,kp=/^[a-zA-Z0-9_-]{21}$/;function Ip(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Op=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var xp=/^([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})$/,Mc=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/;var Np=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var qy="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function jp(){return new RegExp(qy,"u")}var Ap=/^(?:(?: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])$/,qp=/^(([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}|:))$/;var Mp=/^((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])$/,Lp=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Dp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zp=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Up=/^https?$/,Fp=/^\+[1-9]\d{6,14}$/;var Vp="(?:(?:\\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])))";function My(e){return new RegExp(`^${e}$`)}var Hp=My(Vp);function qc(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Jp(e){return new RegExp(`^${qc(e)}$`)}function Bp(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${qc({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${qc({precision:e.precision})}`:r;return new RegExp(`^${Vp}T(?:${o})$`)}var Kp=/^[\s\S]{0,}$/;var Gp=/^-?\d+n?$/,Lc=/^-?\d+$/,Bo=/^-?\d+(?:\.\d+)?$/,Wp=/^(?:true|false)$/i,Yp=/^null$/i;var Xp=/^[^A-Z]*$/,Qp=/^[^a-z]*$/;var De=q("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Dc=e=>{let t=e.value;return!Sc(t)&&t.length!==void 0},Es={number:"number",bigint:"bigint",object:"date"},Zc=q("$ZodCheckLessThan",(e,t)=>{De.init(e,t);let r=Es[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:Es[typeof o.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Uc=q("$ZodCheckGreaterThan",(e,t)=>{De.init(e,t);let r=Es[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:Es[typeof o.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),em=q("$ZodCheckMultipleOf",(e,t)=>{De.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):yc(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),tm=q("$ZodCheckNumberFormat",(e,t)=>{De.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Fo[t.format];e._zod.check=i=>{let c=i.value;if(r){if(!Number.isInteger(c)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?i.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}c<n&&i.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),c>s&&i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var rm=q("$ZodCheckMaxLength",(e,t)=>{var r;De.init(e,t),(r=e._zod.def).when??(r.when=Dc),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>t.maximum?Ho(n):s)<=t.maximum)return;let c=Jo(n);o.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),om=q("$ZodCheckMinLength",(e,t)=>{var r;De.init(e,t),(r=e._zod.def).when??(r.when=Dc),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>=t.minimum&&s<t.minimum*2?Ho(n):s)>=t.minimum)return;let c=Jo(n);o.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),nm=q("$ZodCheckLengthEquals",(e,t)=>{var r;De.init(e,t),(r=e._zod.def).when??(r.when=Dc),e._zod.check=o=>{let n=o.value,s=n.length,i=typeof n=="string"&&s>=t.length&&s<=t.length*2?Ho(n):s;if(i===t.length)return;let c=Jo(n),a=i>t.length;o.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ko=q("$ZodCheckStringFormat",(e,t)=>{var r,o;De.init(e,t),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),sm=q("$ZodCheckRegex",(e,t)=>{Ko.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),im=q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Xp),Ko.init(e,t)}),am=q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Qp),Ko.init(e,t)}),cm=q("$ZodCheckIncludes",(e,t)=>{De.init(e,t);let r=vt(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),um=q("$ZodCheckStartsWith",(e,t)=>{De.init(e,t);let r=new RegExp(`^${vt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),lm=q("$ZodCheckEndsWith",(e,t)=>{De.init(e,t);let r=new RegExp(`.*${vt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var dm=q("$ZodCheckOverwrite",(e,t)=>{De.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ts=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
3
|
+
import{c as Yd,d as Xd}from"./chunk-EIPMQFIF.js";import{a as Kd}from"./chunk-SFN3LBB6.js";import{c as Bd}from"./chunk-YBA6DJQ4.js";import{a as Ld,b as Dd,c as Zd}from"./chunk-YJZEHJ6U.js";import"./chunk-JUA63KQK.js";import{a as qd,c as Md}from"./chunk-NUTTDNTG.js";import{a as xd,d as Gd}from"./chunk-X2YUHPOU.js";import{c as kd,d as Id,h as Od}from"./chunk-EJWTYDBJ.js";import"./chunk-UI4EUC3S.js";import"./chunk-2L66A2X6.js";import{g as Vd,i as Hd}from"./chunk-G6L5NIJ5.js";import{i as Fd,o as Jd}from"./chunk-5FJT4BNY.js";import"./chunk-6RMRWBMB.js";import"./chunk-X4QI2EYV.js";import"./chunk-QIMSNTKL.js";import"./chunk-ECA4PW5T.js";import{b as Wd}from"./chunk-QPUKPSPZ.js";import{d as Td,f as Cd}from"./chunk-PISCJKIG.js";import{b as Ud}from"./chunk-HZDYZ5RD.js";import{b as wd,j as ms,k as Pd}from"./chunk-EYOO35US.js";import{f as fs,g as Nd,h as jd,i as Ad}from"./chunk-YJ6XLDRA.js";import"./chunk-63XCSYHM.js";import{a as _t}from"./chunk-WID72ZII.js";import"./chunk-O7DK3GJT.js";import"./chunk-65Y7YCZZ.js";import"./chunk-NMGQGYVM.js";import"./chunk-EEQSUBBL.js";import"./chunk-BSFBZBAI.js";import"./chunk-BWJNZT75.js";import"./chunk-3IX3QA76.js";import"./chunk-PON65UTS.js";import"./chunk-FWVE3GNA.js";import{m as Ed}from"./chunk-QO4JUY6B.js";import"./chunk-UN5DSJE2.js";import"./chunk-6HUYBVQA.js";import"./chunk-KXKQDFHX.js";import{b as gc}from"./chunk-4MZV4SRU.js";import"./chunk-BYUOU2Q2.js";import"./chunk-NUCGWLOY.js";import"./chunk-I2LPGKUU.js";import"./chunk-HON4OV7M.js";import{P as st,R as Rd,f as Zo,ma as $d}from"./chunk-CCNRNCRU.js";import{e as hc}from"./chunk-FGR6QCG5.js";import"./chunk-VLVNA4T3.js";import{d as fc}from"./chunk-TMUK2DD3.js";var KS=Object.create,hs=Object.defineProperty,GS=Object.getOwnPropertyDescriptor,WS=Object.getOwnPropertyNames,YS=Object.getPrototypeOf,XS=Object.prototype.hasOwnProperty,U=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Qd=(e,t)=>{let r={};for(var o in e)hs(r,o,{get:e[o],enumerable:!0});return t&&hs(r,Symbol.toStringTag,{value:"Module"}),r},QS=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=WS(t),s=0,i=n.length,c;s<i;s++)c=n[s],!XS.call(e,c)&&c!==r&&hs(e,c,{get:(a=>t[a]).bind(null,c),enumerable:!(o=GS(t,c))||o.enumerable});return e},gs=(e,t,r)=>(r=e!=null?KS(YS(e)):{},QS(t||!e||!e.__esModule?hs(r,"default",{value:e,enumerable:!0}):r,e));var ey=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),ep=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),ty=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),ry=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"]);function tp(e){return typeof e=="string"&&ep.has(e.replace(/#$/,""))}function rp(e,t){if(!("$schema"in e)||typeof e.$schema!="string")return"2020-12";let r=e.$schema.replace(/#$/,"");if(ey.has(r))return"2020-12";if(ep.has(r))return"2019-09";if(ty.has(r)||ry.has(r))return"draft-7";throw new Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var ce={};fc(ce,{BIGINT_FORMAT_RANGES:()=>vs,CONSTANT_CATCH:()=>mp,Class:()=>yc,NUMBER_FORMAT_RANGES:()=>Fo,aborted:()=>ut,allowsEval:()=>wc,assert:()=>ay,assertEqual:()=>oy,assertIs:()=>sy,assertNever:()=>iy,assertNotEqual:()=>ny,assignProp:()=>Ye,attachSchema:()=>Vo,base64ToUint8Array:()=>dp,base64urlToUint8Array:()=>Py,cached:()=>Nr,captureStackTrace:()=>Ss,cleanEnum:()=>wy,cleanRegex:()=>Uo,clone:()=>it,cloneDef:()=>ly,codePointLength:()=>Ho,constantCatch:()=>fp,createTransparentProxy:()=>gy,defineLazy:()=>zc,defineLazyInternal:()=>ge,derived:()=>ky,esc:()=>Rc,escapeRegex:()=>vt,explicitlyAborted:()=>Tc,extend:()=>yy,finalizeIssue:()=>lt,floatSafeRemainder:()=>bc,getElementAtPath:()=>dy,getEnumValues:()=>Or,getLengthableOrigin:()=>Jo,getParsedType:()=>hy,getSizableOrigin:()=>lp,hexToUint8Array:()=>Ty,hide:()=>Rs,installLazyProp:()=>Ny,isObject:()=>ur,isPlainObject:()=>Mt,issue:()=>Ar,joinValues:()=>_s,jsonStringifyReplacer:()=>xr,members:()=>kc,merge:()=>by,mergeDefs:()=>yt,normalizeParams:()=>re,nullish:()=>vc,numKeys:()=>fy,objectClone:()=>cy,omit:()=>Sy,optionalKeys:()=>Ec,own:()=>qt,parsedType:()=>Cc,partial:()=>zy,pick:()=>_y,prefixIssues:()=>bt,primitiveTypes:()=>cp,promiseAllObject:()=>py,propertyKeyTypes:()=>Pc,randomString:()=>my,rawShape:()=>jr,required:()=>Ry,safeExtend:()=>vy,shallowClone:()=>ap,sizeCaps:()=>zs,slugify:()=>$c,stringifyPrimitive:()=>ys,toZod:()=>np,uint8ArrayToBase64:()=>pp,uint8ArrayToBase64url:()=>Ey,uint8ArrayToHex:()=>Cy,unwrapMessage:()=>Ir});function oy(e){return e}function ny(e){return e}function np(){return e=>e}function sy(e){}function iy(e){throw new Error("Unexpected value in exhaustive check")}function ay(e){}function Or(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function _s(e,t="|"){return e.map(r=>ys(r)).join(t)}function xr(e,t){return typeof t=="bigint"?t.toString():t}var Sc=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Nr(e){return new Sc(e)}function vc(e){return e==null}function Uo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function bc(e,t){let r=e/t,o=Math.round(r),n=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var op=Symbol("evaluating");function zc(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==op)return o===void 0&&(o=op,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function cy(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Ye(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jr(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function St(e){return jr(e._zod.def)??e._zod.def.shape}function sp(e,t,r){Object.defineProperty(e,t,{get(){let o=r();return Ye(this,t,o),o},enumerable:!0,configurable:!0})}function ip(e,t,r){t in e?Ye(e,t,r):e[t]=r}function cr(e,t,r,o){let n=St(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(n,s);i.enumerable&&(i.get?sp(e,s,()=>{let c=t._zod.def.shape[s];return o?o(c,s):c}):ip(e,s,o?o(i.value,s):i.value))}}function uy(e,t){for(let r of Reflect.ownKeys(t)){let o=Object.getOwnPropertyDescriptor(t,r);o.enumerable&&(o.get?sp(e,r,()=>t[r]):ip(e,r,o.value))}}function yt(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function ly(e){return yt(e._zod.def)}function dy(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function py(e){let t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=o[s];return n})}function my(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function Rc(e){return JSON.stringify(e)}function $c(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ss="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var wc=Nr(()=>{if(Xe.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Mt(e){if(ur(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ur(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ap(e){return Mt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function fy(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var hy=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Pc=new Set(["string","number","symbol"]),cp=new Set(["string","number","bigint","boolean","symbol","undefined"]);function vt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function it(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function re(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function gy(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,s){return t??(t=e()),Reflect.set(t,o,n,s)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function ys(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ec(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Fo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},vs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function _y(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s={};return cr(s,e,bs(e,t)),it(e,yt(r,{shape:s,checks:[]}))}function bs(e,t){let r=St(e),o=[];for(let n of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,n)?.enumerable)throw new Error(`Unrecognized key: "${String(n)}"`);t[n]&&o.push(n)}return o}function Sy(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(bs(e,t)),i={};return cr(i,e,Reflect.ownKeys(St(e)).filter(c=>!s.has(c))),it(e,yt(r,{shape:i,checks:[]}))}function yy(e,t){if(!Mt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let n=St(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return it(e,yt(e._zod.def,{shape:up(e,t)}))}function up(e,t){let r={};return cr(r,e,Reflect.ownKeys(St(e))),uy(r,t),r}function vy(e,t){if(!Mt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return it(e,yt(e._zod.def,{shape:up(e,t)}))}function by(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};cr(r,e,Reflect.ownKeys(St(e))),cr(r,t,Reflect.ownKeys(St(t)));let o=yt(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return it(e,o)}function zy(e,t,r,o="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let c=r?new Set(bs(t,r)):void 0,a={};return cr(a,t,Reflect.ownKeys(St(t)),e&&((u,d)=>c&&!c.has(d)?u:new e({type:"optional",innerType:u}))),it(t,yt(t._zod.def,{shape:a,checks:[]}))}function Ry(e,t,r){let o=r?new Set(bs(t,r)):void 0,n={};return cr(n,t,Reflect.ownKeys(St(t)),(s,i)=>o&&!o.has(i)?s:new e({type:"nonoptional",innerType:s})),it(t,yt(t._zod.def,{shape:n}))}function ut(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Tc(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function bt(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Ir(e){return typeof e=="string"?e:e?.message}function zs(e){let t=[];for(let r of e??[]){let o=r._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let n=o.maximum??o.length??o.size;n>=0&&t.push([n,r])}return t}function Vo(e,t,r){var o;for(let n=t;n<e.length;n++)(o=e[n]).schema??(o.schema=r)}function lt(e,t,r){var o;let n=e.inst?._zod?.traits;n?.has("$ZodType")&&(n.has("$ZodCheck")?(o=e).schema??(o.schema=e.inst):e.schema=e.inst);let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Ir(e.inst?._zod.def?.error?.(e))??Ir(s?.(e))??Ir(t?.error?.(e))??Ir(r.customError?.(e))??Ir(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=i,t?.reportInput&&(c.input=e.input),c}function lp(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var $y=/[\uD800-\uDBFF]/;function Ho(e){let t=e.length;if(!$y.test(e))return t;let r=t;for(let o=0;o<t-1;o++)(e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320&&(r--,o++);return r}function Jo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Cc(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Ar(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function wy(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function dp(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function pp(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Py(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return dp(t+r)}function Ey(e){return pp(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ty(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function Cy(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var yc=class{constructor(...t){}};function kc(e,t){for(let r in t){let o=Object.getOwnPropertyDescriptor(t,r);o.get?Object.defineProperty(e,r,{...o,enumerable:!1}):Iy(e,r,o.value)}}function qt(e,t,r,o=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:o,value:r}),r}function Rs(e,t,r){return qt(e,t,r,!1)}function ky(e,t){for(let r in e){let o=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return qt(this,r,o(this))},set(n){qt(this,r,n)}})}return t}function Iy(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:qt(this,t,r.bind(this))},set(o){qt(this,t,o)}})}function Oy(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var _c,At=!1,xy={configurable:!0,get(){At=!0}};function ge(e,t,r){let o=Object.getPrototypeOf(e._zod);if(t in o&&_c!==e._zod){_c=void 0;return}_c=e._zod,Object.defineProperty(o,t,{configurable:!0,get(){Object.defineProperty(this,t,xy);let n=At;At=!1;try{let s=r(this);return At?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s}),At=At||n,s}catch(s){throw delete this[t],At=At||n,s}},set(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})}function Ny(e,t,r,o){let n=Oy(e,t);n&&Object.defineProperty(n,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:o,value:s})}})}var mp="~constantCatch";function fp(e){let t=()=>e;return t[mp]=!0,t}var hp,Oc=Object.freeze({status:"aborted"}),Ic={value:void 0,enumerable:!1},gp="captureStackTrace"in Error?Error:null;function jy(e){let t=gp;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return gp=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function q(e,t,r,o){let n={};function s(g){this.def=g,this.constr=p,this.traits=new Set}s.prototype=n;let i=r,c=i&&new WeakSet;function a(g,v){if(g._zod){if(g._zod.traits.has(e))return}else{Ic.value=new s(v);try{Object.defineProperty(g,"_zod",Ic)}finally{Ic.value=void 0}}if(g._zod.traits.add(e),t(g,v),c){let _=Object.getPrototypeOf(g),h=g._zod.constr.prototype,f=_;for(;f&&f!==h;)f=Object.getPrototypeOf(f);let z=f??_;c.has(z)||(c.add(z),kc(z,i))}let m=p.prototype;for(let _ in m)Object.prototype.hasOwnProperty.call(m,_)&&(_ in g||(g[_]=m[_].bind(g)))}let u=o?.Parent??Object;class d extends u{}Object.defineProperty(d,"name",{value:e});function p(g){let v=o?.Parent?jy(d):this;a(v,g);let m=v._zod.deferred;if(m){for(let h of m)h();v._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(v),v}return Object.defineProperty(p,"init",{value:a}),Object.defineProperty(p,Symbol.hasInstance,{value:g=>o?.Parent&&g instanceof o.Parent?!0:g?._zod?.traits?.has(e)}),Object.defineProperty(p,"name",{value:e}),p}var dt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},qr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(hp=globalThis).__zod_globalConfig??(hp.__zod_globalConfig={});var Xe=globalThis.__zod_globalConfig;function Qe(e){return e&&Object.assign(Xe,e),Xe}function Ay(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,xr,2)),e.message}function qy(e){this._zod.message=e}var My={get:Ay,set:qy,enumerable:!0,configurable:!0},Nc={value:void 0,enumerable:!1},_p=new WeakSet([Object.prototype,Error.prototype]),Sp=(e,t)=>{e.name="$ZodError",Nc.value=t,Object.defineProperty(e,"issues",Nc),Nc.value=void 0,Object.defineProperty(e,"message",My);let r=Object.getPrototypeOf(e);_p.has(r)||(_p.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},yp=q("$ZodError",Sp),l$=q("$ZodError",Sp,void 0,{Parent:Error});function Ly(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}function jc(e,t=r=>r.message){let r={},o=[];for(let n of e.issues)n.path.length>0?Ly(r,n.path[0],()=>[]).push(t(n)):o.push(t(n));return{formErrors:o,fieldErrors:r}}function Ac(e,t=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(c=>o({issues:c},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let c=[...s,...i.path];if(c.length===0)r._errors.push(t(i));else{let a=r,u=0;for(;u<c.length;){let d=c[u],p=u===c.length-1;if(d==="_errors"){p&&a._errors.push(t(i)),u++;continue}Object.prototype.hasOwnProperty.call(a,d)||Object.defineProperty(a,d,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let g=a[d];p&&g._errors.push(t(i)),a=g,u++}}}};return o(e),r}function $s(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ws=e=>{let t=(r,o,n,s)=>{let i=n?{...n,async:!1}:{async:!1},c=r._zod.run({value:o,issues:[]},i);if(c instanceof Promise)throw new dt;if(c.issues.length){let a=new(s?.Err??e)(c.issues.map(u=>lt(u,i,Qe())));throw Ss(a,s?.callee??t),a}return c.value};return t};var Ps=e=>{let t=async(r,o,n,s)=>{let i=n?{...n,async:!0}:{async:!0},c=r._zod.run({value:o,issues:[]},i);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(s?.Err??e)(c.issues.map(u=>lt(u,i,Qe())));throw Ss(a,s?.callee??t),a}return c.value};return t};var Es=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new dt;return s.issues.length?vp(e,s.issues,n):{success:!0,data:s.value}};function vp(e,t,r){let o;return{success:!1,get error(){return o||(o=new e(t.map(n=>lt(n,r,Qe()))),t=void 0,r=void 0),o},set error(n){o=n,t=void 0,r=void 0}}}var Ts=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?vp(e,s.issues,n):{success:!0,data:s.value}};var Dy=Symbol.for("zod.compile.invalid"),Zy=Symbol.for("zod.compile.fallback"),qc=((e,t,r)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(t)!==Dy)return!0;if(o.definite===!0&&r===void 0)return!1}return Uy(e,t,r)});function Uy(e,t,r){let o=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},n=e._zod.bag.fallbackRun,s;if(n?(o[Zy]=!0,s=n({value:t,issues:[]},o)):s=e._zod.run({value:t,issues:[]},o),s instanceof Promise)throw new dt;return s.issues.length===0}var Mc=async(e,t,r)=>{let o=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},n=e._zod.run({value:t,issues:[]},o);return n instanceof Promise&&(n=await n),n.issues.length===0},bp=e=>{let t=ws(e),r=(o,n,s,i)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return t(o,n,c,$s(r,i))};return r};var zp=e=>{let t=ws(e),r=(o,n,s,i)=>t(o,n,s,$s(r,i));return r};var Rp=e=>{let t=Ps(e),r=async(o,n,s,i)=>{let c=s?{...s,direction:"backward"}:{direction:"backward"};return await t(o,n,c,$s(r,i))};return r};var $p=e=>{let t=Ps(e),r=async(o,n,s,i)=>await t(o,n,s,$s(r,i));return r};var wp=e=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Es(e)(t,r,n)};var Pp=e=>(t,r,o)=>Es(e)(t,r,o);var Ep=e=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Ts(e)(t,r,n)};var Tp=e=>async(t,r,o)=>Ts(e)(t,r,o);var Cp=/^[cC][0-9a-z]{6,}$/,kp=/^[0-9a-z]+$/,Ip=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Op=/^[0-9a-vA-V]{20}$/,xp=/^[A-Za-z0-9]{27}$/,Np=/^[a-zA-Z0-9_-]{21}$/;function jp(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Ap=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var qp=/^([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})$/,Dc=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/;var Mp=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Fy="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Lp(){return new RegExp(Fy,"u")}var Dp=/^(?:(?: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])$/,Zp=/^(([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}|:))$/;var Up=/^((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])$/,Fp=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Hp=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Jp=/^https?$/,Bp=/^\+[1-9]\d{6,14}$/;var Kp="(?:(?:\\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])))";function Vy(e){return new RegExp(`^${e}$`)}var Gp=Vy(Kp);function Lc(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Wp(e){return new RegExp(`^${Lc(e)}$`)}function Yp(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Lc({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,o=e.local?`${r}|${Lc({precision:e.precision})}`:r;return new RegExp(`^${Kp}T(?:${o})$`)}var Xp=/^[\s\S]{0,}$/;var Qp=/^-?\d+n?$/,Zc=/^-?\d+$/,Bo=/^-?\d+(?:\.\d+)?$/,em=/^(?:true|false)$/i,tm=/^null$/i;var rm=/^[^A-Z]*$/,om=/^[^a-z]*$/;var De=q("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Uc=e=>{let t=e.value;return!vc(t)&&t.length!==void 0},Cs={number:"number",bigint:"bigint",object:"date"},Fc=q("$ZodCheckLessThan",(e,t)=>{De.init(e,t);let r=Cs[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:Cs[typeof o.value]??r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vc=q("$ZodCheckGreaterThan",(e,t)=>{De.init(e,t);let r=Cs[typeof t.value];e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:Cs[typeof o.value]??r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nm=q("$ZodCheckMultipleOf",(e,t)=>{De.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):bc(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),sm=q("$ZodCheckNumberFormat",(e,t)=>{De.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Fo[t.format];e._zod.check=i=>{let c=i.value;if(r){if(!Number.isInteger(c)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?i.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):i.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}c<n&&i.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),c>s&&i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var im=q("$ZodCheckMaxLength",(e,t)=>{var r;De.init(e,t),(r=e._zod.def).when??(r.when=Uc),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>t.maximum?Ho(n):s)<=t.maximum)return;let c=Jo(n);o.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),am=q("$ZodCheckMinLength",(e,t)=>{var r;De.init(e,t),(r=e._zod.def).when??(r.when=Uc),e._zod.check=o=>{let n=o.value,s=n.length;if((typeof n=="string"&&s>=t.minimum&&s<t.minimum*2?Ho(n):s)>=t.minimum)return;let c=Jo(n);o.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),cm=q("$ZodCheckLengthEquals",(e,t)=>{var r;De.init(e,t),(r=e._zod.def).when??(r.when=Uc),e._zod.check=o=>{let n=o.value,s=n.length,i=typeof n=="string"&&s>=t.length&&s<=t.length*2?Ho(n):s;if(i===t.length)return;let c=Jo(n),a=i>t.length;o.issues.push({origin:c,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ko=q("$ZodCheckStringFormat",(e,t)=>{var r,o;De.init(e,t),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),um=q("$ZodCheckRegex",(e,t)=>{Ko.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),lm=q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rm),Ko.init(e,t)}),dm=q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=om),Ko.init(e,t)}),pm=q("$ZodCheckIncludes",(e,t)=>{De.init(e,t);let r=vt(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=o,e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),mm=q("$ZodCheckStartsWith",(e,t)=>{De.init(e,t);let r=new RegExp(`^${vt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),fm=q("$ZodCheckEndsWith",(e,t)=>{De.init(e,t);let r=new RegExp(`.*${vt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var hm=q("$ZodCheckOverwrite",(e,t)=>{De.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ks=class{constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let o=t.split(`
|
|
4
4
|
`).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
5
5
|
${r.join(`
|
|
6
6
|
`)}
|
|
7
|
-
};`)(...Object.values(this.closed))}};var mm={major:4,minor:6,patch:7};var Se=q("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=mm;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let s of n)for(let i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(c,a,u)=>{if(c.memo)return c;let d=ut(c),p;for(let _ of a){if(_._zod.def.when){if(Pc(c)||!_._zod.def.when(c))continue}else if(d)continue;let y=c.issues.length,m=_._zod.check(c);if(m instanceof Promise&&u?.async===!1)throw new dt;if(p||m instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await m,c.issues.length!==y&&(Vo(c.issues,y,e),d||(d=ut(c,y)))});else{if(c.issues.length===y)continue;Vo(c.issues,y,e),d||(d=ut(c,y))}}return p?p.then(()=>c):c},i=(c,a,u)=>{if(ut(c))return c.aborted=!0,c;let d=s(a,n,u);if(d instanceof Promise){if(u.async===!1)throw new dt;return d.then(p=>e._zod.parse(p,u))}return e._zod.parse(d,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let d=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return d instanceof Promise?d.then(p=>i(p,c,a)):i(d,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new dt;return u.then(d=>s(d,n,a))}return s(u,n,a)}}},{get"~standard"(){return bs(this,"~standard",Vc(this))},set"~standard"(e){qt(this,"~standard",e)}}),$m=(e,t)=>e.issues.length?{issues:e.issues.map(r=>lt(r,t,Qe()))}:{value:e.value};async function Ly(e,t){let r={async:!0};return $m(await e._zod.run({value:t,issues:[]},r),r)}function Vc(e){return{validate:t=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return $m(o,r)}catch{}return Ly(e,t)},vendor:"zod",version:1}}var Os=q("$ZodString",(e,t)=>{Se.init(e,t),e._zod.pattern=t.pattern??Kp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Re=q("$ZodStringFormat",(e,t)=>{Ko.init(e,t),Os.init(e,t)}),wm=q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=xp),Re.init(e,t)}),Pm=q("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Mc(o))}else t.pattern??(t.pattern=Mc());Re.init(e,t)}),Em=q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Np),Re.init(e,t)}),Tm=1,ks=2;function Cm(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Dy(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Cm(e)||ks:Zy(e,t)}function Zy(e,t){if(!t.normalize&&t.protocol?.source===Up.source&&!/^https?:\/\//i.test(e))return Tm;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??ks}return new URL(e)}catch{return ks}}var Uy=/[\t\n\r]/g;function fm(e){return e.replace(Uy,"")}function Fy(e,t){return t.lastIndex=0,t.test(e.hostname)}function Vy(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var km=q("$ZodURL",(e,t)=>{Re.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),n=Dy(o,t);if(n===Tm){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===ks){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=fm(o);return}t.hostname&&!Fy(n,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Vy(n,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?n.href:fm(o);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Im=q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=jp()),Re.init(e,t)}),Om=q("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?kp:Ip(t.length)),Re.init(e,t)}),xm=q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=wp),Re.init(e,t)}),Nm=q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Pp),Re.init(e,t)}),jm=q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ep),Re.init(e,t)}),Am=q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Tp),Re.init(e,t)}),qm=q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Cp),Re.init(e,t)}),Mm=q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Bp(t)),Re.init(e,t)}),Lm=q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hp),Re.init(e,t)}),Dm=q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Jp(t)),Re.init(e,t)}),Zm=q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Op),Re.init(e,t)}),Um=q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ap),Re.init(e,t)}),Hy=/^[0-9a-fA-F:.]+$/;function Fm(e){return Hy.test(e)?Cm(`http://[${e}]`):!1}var Vm=q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=qp),Re.init(e,t),e._zod.check=r=>{Fm(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Hm=q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Mp),Re.init(e,t)});function Jy(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);return`${n}`!==o||n<0||n>128?!1:Fm(r)}var Jm=q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Lp),Re.init(e,t),e._zod.check=r=>{Jy(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Bm(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Hc=/^[0-9a-zA-Z+/]*={0,2}$/,Km=q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Hc),Re.init(e,t),e._zod.check=r=>{Bm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),xs=/^[A-Za-z0-9_-]*$/;function By(e){if(!xs.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Bm(r)}var Gm=q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=xs),Re.init(e,t),e._zod.check=r=>{By(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Wm=q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Fp),Re.init(e,t)});function Ky(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Ym=q("$ZodJWT",(e,t)=>{Re.init(e,t),e._zod.check=r=>{Ky(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Jc=q("$ZodNumber",(e,t)=>{Se.init(e,t),e._zod.pattern=Bo,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Xm=q("$ZodNumberFormat",(e,t)=>{tm.init(e,t),Jc.init(e,t)}),Qm=q("$ZodBoolean",(e,t)=>{Se.init(e,t),e._zod.pattern=Wp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),ef=q("$ZodBigInt",(e,t)=>{Se.init(e,t),e._zod.pattern=Gp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var tf=q("$ZodNull",(e,t)=>{Se.init(e,t),e._zod.pattern=Yp,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),rf=q("$ZodAny",(e,t)=>{Se.init(e,t),e._zod.parse=r=>r}),of=q("$ZodUnknown",(e,t)=>{Se.init(e,t),e._zod.parse=r=>r}),nf=q("$ZodNever",(e,t)=>{Se.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var sf=q("$ZodDate",(e,t)=>{Se.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function Gy(e,t){let r=vs(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map(s=>s[0])),n=e._zod.parse;e._zod.parse=(s,i)=>{let c=t(s.value);if(c>o&&!i?.skipChecks&&i?.direction!=="backward"){for(let[a,u]of vs(e._zod.def.checks))if(c>a&&u._zod.def.when(s)){let d=s.issues.length;return u._zod.check(s),s.issues[d].continue=!1,Vo(s.issues,d,e),s}}return n(s,i)}}var Wy=e=>Array.isArray(e)?e.length:-1;function hm(e,t,r){e.issues.length&&t.issues.push(...bt(r,e.issues)),t.value[r]=e.value}var af=q("$ZodArray",(e,t)=>{Se.init(e,t);let r=Xe.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),o;o.value=r?r.alloc(e,o,Array(s.length),n):Array(s.length);let i=[],c=n?.abortEarly;for(let a=0;a<s.length;a++){let u=s[a],d=t.element._zod.run({value:u,issues:[]},n);if(d instanceof Promise)i.push(d.then(p=>hm(p,o,a)));else if(hm(d,o,a),c&&d.issues.length!==0&&ut(d))break}return i.length?Promise.all(i).then(()=>o):o},Gy(e,Wy)});function Is(e,t,r,o,n,s){let i=r in o,c=s==="optional";if(!(!i&&c&&n==="optional")){if(e.issues.length){if(n!==void 0&&c&&!i)return;t.issues.push(...bt(r,e.issues))}if(!i&&n===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||n==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}var Yy=[];function cf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:Yy,n=o.length?[...t,...o]:t;for(let i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=wc(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function uf(e,t,r,o,n,s,i){let c=[],a=n.keySet,u=n.catchall._zod,d=u.def.type,p=u.optin,_=u.optout,y=0;for(let m in t){if(i&&r.issues.length!==y){if(ut(r,y))break;y=r.issues.length}if(a.has(m))continue;if(m==="__proto__"){d==="never"&&c.push(m);continue}if(d==="never"){c.push(m);continue}let g=u.run({value:t[m],issues:[]},o);g instanceof Promise?e.push(g.then(h=>Is(h,r,m,t,p,_))):Is(g,r,m,t,p,_)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Xy=q("$ZodObject",(e,t)=>{Se.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let d={...o};return Object.defineProperty(t,"shape",{value:d}),u.raw=d,d};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=Nr(()=>cf(t));ge(e,"propValues",u=>{let d=u.def.shape,p={};for(let _ in d){let y=d[_]._zod;if(y.values){Object.prototype.hasOwnProperty.call(p,_)||Ye(p,_,new Set);for(let m of y.values)p[_].add(m);y.optin!==void 0&&p[_].add(void 0)}}return p});let s=cr,i=t.catchall,c,a=Xe.memoizer;a?.attach(e),e._zod.parse=(u,d)=>{c??(c=n.value);let p=u.value;if(!s(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=a?a.alloc(e,u,{},d):{};let _=[],y=c.shape,m=d?.abortEarly,g=u.issues.length;for(let h of c.allKeys){if(m&&u.issues.length!==g){if(ut(u,g))break;g=u.issues.length}if(h==="__proto__")continue;let f=y[h],z=f._zod.optin,v=f._zod.optout,R=f._zod.run({value:p[h],issues:[]},d);R instanceof Promise?_.push(R.then(w=>Is(w,u,h,p,z,v))):Is(R,u,h,p,z,v)}return i?uf(_,p,u,d,n.value,e,m===!0):_.length?Promise.all(_).then(()=>u):u}}),lf=q("$ZodObjectJIT",(e,t)=>{Xy.init(e,t);let r=e._zod.parse,o=Nr(()=>cf(t)),n=Xe.memoizer,s=y=>{let m=o.value,g=m.symbolKeys,h=new Ts(["payload","ctx"],{shape:y,inst:e,memo:n,syms:g}),f=w=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,z=(w,b)=>`
|
|
7
|
+
};`)(...Object.values(this.closed))}};var _m={major:4,minor:6,patch:7};var Se=q("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_m;let o=e._zod.def.checks,n=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let s of n)for(let i of s._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(c,a,u)=>{if(c.memo)return c;let d=ut(c),p;for(let g of a){if(g._zod.def.when){if(Tc(c)||!g._zod.def.when(c))continue}else if(d)continue;let v=c.issues.length,m=g._zod.check(c);if(m instanceof Promise&&u?.async===!1)throw new dt;if(p||m instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await m,c.issues.length!==v&&(Vo(c.issues,v,e),d||(d=ut(c,v)))});else{if(c.issues.length===v)continue;Vo(c.issues,v,e),d||(d=ut(c,v))}}return p?p.then(()=>c):c},i=(c,a,u)=>{if(ut(c))return c.aborted=!0,c;let d=s(a,n,u);if(d instanceof Promise){if(u.async===!1)throw new dt;return d.then(p=>e._zod.parse(p,u))}return e._zod.parse(d,u)};e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let d=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return d instanceof Promise?d.then(p=>i(p,c,a)):i(d,c,a)}let u=e._zod.parse(c,a);if(u instanceof Promise){if(a.async===!1)throw new dt;return u.then(d=>s(d,n,a))}return s(u,n,a)}}},{get"~standard"(){return Rs(this,"~standard",Jc(this))},set"~standard"(e){qt(this,"~standard",e)}}),Tm=(e,t)=>e.issues.length?{issues:e.issues.map(r=>lt(r,t,Qe()))}:{value:e.value};async function Hy(e,t){let r={async:!0};return Tm(await e._zod.run({value:t,issues:[]},r),r)}function Jc(e){return{validate:t=>{let r={async:!1};try{let o=e._zod.run({value:t,issues:[]},r);if(!(o instanceof Promise))return Tm(o,r)}catch{}return Hy(e,t)},vendor:"zod",version:1}}var Ns=q("$ZodString",(e,t)=>{Se.init(e,t),e._zod.pattern=t.pattern??Xp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Re=q("$ZodStringFormat",(e,t)=>{Ko.init(e,t),Ns.init(e,t)}),Cm=q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=qp),Re.init(e,t)}),km=q("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Dc(o))}else t.pattern??(t.pattern=Dc());Re.init(e,t)}),Im=q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mp),Re.init(e,t)}),Om=1,Os=2;function xm(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Jy(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?xm(e)||Os:By(e,t)}function By(e,t){if(!t.normalize&&t.protocol?.source===Jp.source&&!/^https?:\/\//i.test(e))return Om;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??Os}return new URL(e)}catch{return Os}}var Ky=/[\t\n\r]/g;function Sm(e){return e.replace(Ky,"")}function Gy(e,t){return t.lastIndex=0,t.test(e.hostname)}function Wy(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Nm=q("$ZodURL",(e,t)=>{Re.init(e,t),e._zod.check=r=>{try{let o=r.value.trim(),n=Jy(o,t);if(n===Om){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(n===Os){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(n===!0){r.value=Sm(o);return}t.hostname&&!Gy(n,t.hostname)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort}),t.protocol&&!Wy(n,t.protocol)&&r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort}),r.value=t.normalize?n.href:Sm(o);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),jm=q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Lp()),Re.init(e,t)}),Am=q("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Np:jp(t.length)),Re.init(e,t)}),qm=q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Cp),Re.init(e,t)}),Mm=q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=kp),Re.init(e,t)}),Lm=q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ip),Re.init(e,t)}),Dm=q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Op),Re.init(e,t)}),Zm=q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=xp),Re.init(e,t)}),Um=q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yp(t)),Re.init(e,t)}),Fm=q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Gp),Re.init(e,t)}),Vm=q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Wp(t)),Re.init(e,t)}),Hm=q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ap),Re.init(e,t)}),Jm=q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Dp),Re.init(e,t)}),Yy=/^[0-9a-fA-F:.]+$/;function Bm(e){return Yy.test(e)?xm(`http://[${e}]`):!1}var Km=q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zp),Re.init(e,t),e._zod.check=r=>{Bm(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Gm=q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Up),Re.init(e,t)});function Xy(e){let t=e.split("/");if(t.length!==2)return!1;let[r,o]=t;if(!o)return!1;let n=Number(o);return`${n}`!==o||n<0||n>128?!1:Bm(r)}var Wm=q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Fp),Re.init(e,t),e._zod.check=r=>{Xy(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Ym(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Bc=/^[0-9a-zA-Z+/]*={0,2}$/,Xm=q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Bc),Re.init(e,t),e._zod.check=r=>{Ym(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),js=/^[A-Za-z0-9_-]*$/;function Qy(e){if(!js.test(e))return!1;let t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ym(r)}var Qm=q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=js),Re.init(e,t),e._zod.check=r=>{Qy(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ef=q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Bp),Re.init(e,t)});function ev(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var tf=q("$ZodJWT",(e,t)=>{Re.init(e,t),e._zod.check=r=>{ev(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Kc=q("$ZodNumber",(e,t)=>{Se.init(e,t),e._zod.pattern=Bo,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:String(n):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),rf=q("$ZodNumberFormat",(e,t)=>{sm.init(e,t),Kc.init(e,t)}),of=q("$ZodBoolean",(e,t)=>{Se.init(e,t),e._zod.pattern=em,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),nf=q("$ZodBigInt",(e,t)=>{Se.init(e,t),e._zod.pattern=Qp,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}});var sf=q("$ZodNull",(e,t)=>{Se.init(e,t),e._zod.pattern=tm,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),af=q("$ZodAny",(e,t)=>{Se.init(e,t),e._zod.parse=r=>r}),cf=q("$ZodUnknown",(e,t)=>{Se.init(e,t),e._zod.parse=r=>r}),uf=q("$ZodNever",(e,t)=>{Se.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});var lf=q("$ZodDate",(e,t)=>{Se.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let n=r.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),r}});function tv(e,t){let r=zs(e._zod.def.checks);if(!r.length)return;let o=Math.min(...r.map(s=>s[0])),n=e._zod.parse;e._zod.parse=(s,i)=>{let c=t(s.value);if(c>o&&!i?.skipChecks&&i?.direction!=="backward"){for(let[a,u]of zs(e._zod.def.checks))if(c>a&&u._zod.def.when(s)){let d=s.issues.length;return u._zod.check(s),s.issues[d].continue=!1,Vo(s.issues,d,e),s}}return n(s,i)}}var rv=e=>Array.isArray(e)?e.length:-1;function ym(e,t,r){e.issues.length&&t.issues.push(...bt(r,e.issues)),t.value[r]=e.value}var df=q("$ZodArray",(e,t)=>{Se.init(e,t);let r=Xe.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),o;o.value=r?r.alloc(e,o,Array(s.length),n):Array(s.length);let i=[],c=n?.abortEarly;for(let a=0;a<s.length;a++){let u=s[a],d=t.element._zod.run({value:u,issues:[]},n);if(d instanceof Promise)i.push(d.then(p=>ym(p,o,a)));else if(ym(d,o,a),c&&d.issues.length!==0&&ut(d))break}return i.length?Promise.all(i).then(()=>o):o},tv(e,rv)});function xs(e,t,r,o,n,s){let i=r in o,c=s==="optional";if(!(!i&&c&&n==="optional")){if(e.issues.length){if(n!==void 0&&c&&!i)return;t.issues.push(...bt(r,e.issues))}if(!i&&n===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(i||n==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}var ov=[];function pf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),o=r.length?r:ov,n=o.length?[...t,...o]:t;for(let i of n)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=Ec(e.shape);return{...e,allKeys:n,symbolKeys:o,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function mf(e,t,r,o,n,s,i){let c=[],a=n.keySet,u=n.catchall._zod,d=u.def.type,p=u.optin,g=u.optout,v=0;for(let m in t){if(i&&r.issues.length!==v){if(ut(r,v))break;v=r.issues.length}if(a.has(m))continue;if(m==="__proto__"){d==="never"&&c.push(m);continue}if(d==="never"){c.push(m);continue}let _=u.run({value:t[m],issues:[]},o);_ instanceof Promise?e.push(_.then(h=>xs(h,r,m,t,p,g))):xs(_,r,m,t,p,g)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:s,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var nv=q("$ZodObject",(e,t)=>{Se.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),o=r?.get?r.get.raw:t.shape??{};if(o){let u=()=>{let d={...o};return Object.defineProperty(t,"shape",{value:d}),u.raw=d,d};u.raw=o,Object.defineProperty(t,"shape",{get:u})}let n=Nr(()=>pf(t));ge(e,"propValues",u=>{let d=u.def.shape,p={};for(let g in d){let v=d[g]._zod;if(v.values){Object.prototype.hasOwnProperty.call(p,g)||Ye(p,g,new Set);for(let m of v.values)p[g].add(m);v.optin!==void 0&&p[g].add(void 0)}}return p});let s=ur,i=t.catchall,c,a=Xe.memoizer;a?.attach(e),e._zod.parse=(u,d)=>{c??(c=n.value);let p=u.value;if(!s(p))return u.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),u;u.value=a?a.alloc(e,u,{},d):{};let g=[],v=c.shape,m=d?.abortEarly,_=u.issues.length;for(let h of c.allKeys){if(m&&u.issues.length!==_){if(ut(u,_))break;_=u.issues.length}if(h==="__proto__")continue;let f=v[h],z=f._zod.optin,S=f._zod.optout,R=f._zod.run({value:p[h],issues:[]},d);R instanceof Promise?g.push(R.then(w=>xs(w,u,h,p,z,S))):xs(R,u,h,p,z,S)}return i?mf(g,p,u,d,n.value,e,m===!0):g.length?Promise.all(g).then(()=>u):u}}),ff=q("$ZodObjectJIT",(e,t)=>{nv.init(e,t);let r=e._zod.parse,o=Nr(()=>pf(t)),n=Xe.memoizer,s=v=>{let m=o.value,_=m.symbolKeys,h=new ks(["payload","ctx"],{shape:v,inst:e,memo:n,syms:_}),f=w=>`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`,z=(w,b)=>`
|
|
8
8
|
let ${w}_ab = false;
|
|
9
9
|
for (let i = 0; i < ${w}.issues.length; i++) {
|
|
10
10
|
const iss = ${w}.issues[i];
|
|
@@ -15,34 +15,34 @@ ${r.join(`
|
|
|
15
15
|
if (${w}_ab && ctx && ctx.abortEarly) {
|
|
16
16
|
payload.value = newResult;
|
|
17
17
|
return payload;
|
|
18
|
-
}`;h.write("const input = payload.value;");let
|
|
18
|
+
}`;h.write("const input = payload.value;");let S=Object.create(null),R=0;for(let w of m.allKeys)S[w]=`key_${R++}`;h.write(n?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let w of m.allKeys){if(w==="__proto__")continue;let b=S[w],y=typeof w=="symbol"?`syms[${_.indexOf(w)}]`:Rc(w),E=`${y} in input`,N=v[w],V=N?._zod?.optin,M=V!==void 0,Z=N?._zod?.optout==="optional";if(h.write(`const ${b} = ${f(y)};`),M&&Z){let W=V==="optional"?`${b}_present`:`${b}.value !== undefined || ${b}_present`;h.write(`
|
|
19
19
|
const ${b}_present = ${E};
|
|
20
20
|
if (!${b}.issues.length || ${b}_present) {
|
|
21
|
-
if (${b}.issues.length) {${z(b,
|
|
21
|
+
if (${b}.issues.length) {${z(b,y)}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (${W}) {
|
|
25
|
-
newResult[${
|
|
25
|
+
newResult[${y}] = ${b}.value;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
`)}else M?(h.write(`
|
|
30
|
-
if (${b}.issues.length) {${z(b,
|
|
30
|
+
if (${b}.issues.length) {${z(b,y)}
|
|
31
31
|
}
|
|
32
|
-
`),V==="defaulted"?h.write(`newResult[${
|
|
32
|
+
`),V==="defaulted"?h.write(`newResult[${y}] = ${b}.value;`):h.write(`
|
|
33
33
|
if (${b}.value !== undefined || ${E}) {
|
|
34
|
-
newResult[${
|
|
34
|
+
newResult[${y}] = ${b}.value;
|
|
35
35
|
}
|
|
36
36
|
`)):h.write(`
|
|
37
37
|
const ${b}_present = ${E};
|
|
38
|
-
if (${b}.issues.length) {${z(b,
|
|
38
|
+
if (${b}.issues.length) {${z(b,y)}
|
|
39
39
|
}
|
|
40
40
|
if (!${b}_present && !${b}.issues.length) {
|
|
41
41
|
payload.issues.push({
|
|
42
42
|
code: "invalid_type",
|
|
43
43
|
expected: "nonoptional",
|
|
44
44
|
input: undefined,
|
|
45
|
-
path: [${
|
|
45
|
+
path: [${y}]
|
|
46
46
|
});
|
|
47
47
|
if (ctx && ctx.abortEarly) {
|
|
48
48
|
payload.value = newResult;
|
|
@@ -51,27 +51,31 @@ ${r.join(`
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if (${b}_present) {
|
|
54
|
-
newResult[${
|
|
54
|
+
newResult[${y}] = ${b}.value;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
`)}return h.write("payload.value = newResult;"),h.write("return payload;"),h.compile()},i,c=cr,a=!Xe.jitless,d=a&&Rc.value,p=t.catchall,_;e._zod.parse=(y,m)=>{_??(_=o.value);let g=y.value;return c(g)?a&&d&&m?.async===!1&&m.jitless!==!0?(i||(i=s(t.shape)),y=i(y,m),p?uf([],g,y,m,_,e,m?.abortEarly===!0):y):r(y,m):(y.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),y)}});function gm(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!ut(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>lt(i,o,Qe())))}),t)}var Bc=q("$ZodUnion",(e,t)=>{Se.init(e,t),ge(e,"optin",o=>o.def.options.some(n=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some(n=>n._zod.optin!==void 0)?"optional":void 0),ge(e,"optout",o=>o.def.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ge(e,"values",o=>{if(o.def.options.every(n=>n._zod.values))return new Set(o.def.options.flatMap(n=>Array.from(n._zod.values)))}),ge(e,"pattern",o=>{if(o.def.options.every(n=>n._zod.pattern)){let n=o.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>Uo(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)i.push(a),s=!0;else{if(a.issues.length===0)return a;i.push(a)}}return s?Promise.all(i).then(c=>gm(c,o,e,n)):gm(i,o,e,n)}});function Qy(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw new Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var df=q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Bc.init(e,t);let r=e._zod.parse;ge(e,"propValues",n=>{let s={},i=0;for(let c of n.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${n.def.options.indexOf(c)}"`);a[n.def.discriminator]?.has(void 0)&&i++;for(let[u,d]of Object.entries(a)){Object.prototype.hasOwnProperty.call(s,u)||Ye(s,u,new Set);for(let p of d)s[u].add(p)}}return!n.def.unionFallback&&i>1&&s[n.def.discriminator]?.delete(void 0),s}),t.options.forEach((n,s)=>{let i=jr(n._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let o=Nr(()=>Qy(t));e._zod.parse=(n,s)=>{let i=n.value;if(!cr(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let c=i?.[t.discriminator],a=o.value.get(c);return a&&(c!==void 0||s.direction!=="backward")?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter(u=>o.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),n)}}),pf=q("$ZodIntersection",(e,t)=>{Se.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([a,u])=>_m(r,a,u)):_m(r,s,i)}});function Fc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Mt(e)&&Mt(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(let s of o){if(s==="__proto__")continue;let i=Fc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Fc(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function _m(e,t,r){let o=new Map,n,s=new Map,i=(u,d)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let _=String(u.path[0]);s.has(_)||s.set(_,u),p=[_]}else return!1;for(let _ of p)o.has(_)||o.set(_,{}),o.get(_)[d]=!0;return!0};for(let u of t.issues)i(u,"l")||e.issues.push(u);for(let u of r.issues)i(u,"r")||e.issues.push(u);let c=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=n?c.filter(d=>n.keys.includes(d)):[];u.length&&e.issues.push({...n,keys:u});for(let d of c)!u.includes(d)&&s.has(d)&&e.issues.push(s.get(d))}let a=Fc(t.value,r.value);if(!a.valid){if(ut(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var mf=q("$ZodRecord",(e,t)=>{Se.init(e,t);let r=Xe.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Mt(s))return o.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),o;let i=[],c=t.keyType._zod.values;if(c&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let a=new Set;for(let d of c)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){if(a.add(typeof d=="number"?d.toString():d),d==="__proto__")continue;let p=t.keyType._zod.run({value:d,issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(m=>lt(m,n,Qe())),input:d,path:[d],inst:e});continue}let _=p.value;if(_==="__proto__")continue;let y=t.valueType._zod.run({value:s[d],issues:[]},n);y instanceof Promise?i.push(y.then(m=>{m.issues.length&&o.issues.push(...bt(d,m.issues)),o.value[_]=m.value})):(y.issues.length&&o.issues.push(...bt(d,y.issues)),o.value[_]=y.value)}let u;for(let d in s)if(!a.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;o.value[d]=s[d]}else u=u??[],u.push(d);u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let a;for(let u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let d=t.keyType._zod.run({value:u,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Bo.test(u)&&d.issues.length){let m=t.keyType._zod.run({value:Number(u),issues:[]},n);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(d=m)}if(d.issues.length){t.mode==="loose"?o.value[u]=s[u]:c?(a=a??[],a.push(u)):o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(m=>lt(m,n,Qe())),input:u,path:[u],inst:e});continue}let _=d.value;if(_==="__proto__")continue;let y=t.valueType._zod.run({value:s[u],issues:[]},n);y instanceof Promise?i.push(y.then(m=>{m.issues.length&&o.issues.push(...bt(u,m.issues)),o.value[_]=m.value})):(y.issues.length&&o.issues.push(...bt(u,y.issues)),o.value[_]=y.value)}a&&a.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a,continue:!0})}return i.length?Promise.all(i).then(()=>o):o}});var ff=q("$ZodEnum",(e,t)=>{Se.init(e,t);let r=Or(t.entries),o=new Set(r);e._zod.values=o,ge(e,"pattern",n=>{let s=Or(n.def.entries).filter(i=>$c.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>vt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),hf=q("$ZodLiteral",(e,t)=>{Se.init(e,t);let r=new Set(t.values);e._zod.values=r,ge(e,"pattern",o=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map(s=>typeof s=="string"?vt(s):s?vt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var gf=q("$ZodTransform",(e,t)=>{Se.init(e,t),e._zod.optin="optional",Xe.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new qr(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new dt;return r.value=n,r}});function Sm(e,t){return e.value=t.issues.length?void 0:t.value,e}var Kc=q("$ZodOptional",(e,t)=>{Se.init(e,t),ge(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",ge(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),ge(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Uo(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>Sm(r,s)):Sm(r,n)}return t.innerType._zod.run(r,o)}}),_f=q("$ZodExactOptional",(e,t)=>{Kc.init(e,t),ge(e,"values",r=>r.def.innerType._zod.values),ge(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),Sf=q("$ZodNullable",(e,t)=>{Se.init(e,t),ge(e,"optin",r=>r.def.innerType._zod.optin),ge(e,"optout",r=>r.def.innerType._zod.optout),ge(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Uo(o.source)}|null)$`):void 0}),ge(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),yf=q("$ZodDefault",(e,t)=>{Se.init(e,t),e._zod.optin="defaulted",ge(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>ym(s,t)):ym(n,t)}});function ym(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var vf=q("$ZodPrefault",(e,t)=>{Se.init(e,t),e._zod.optin="defaulted",ge(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),bf=q("$ZodNonOptional",(e,t)=>{Se.init(e,t),ge(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>vm(s,e)):vm(n,e)}});function vm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function bm(e,t,r,o){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(n=>lt(n,o,Qe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var zf=q("$ZodCatch",(e,t)=>{Se.init(e,t),ge(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ge(e,"optout",r=>r.def.innerType._zod.optout),ge(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>bm(r,s,t,o)):bm(r,n,t,o)}});var Gc=q("$ZodPipe",(e,t)=>{Se.init(e,t),ge(e,"values",r=>r.def.in._zod.values),ge(e,"optin",r=>r.def.in._zod.optin),ge(e,"optout",r=>r.def.out._zod.optout),ge(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>Cs(i,t.in,o)):Cs(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>Cs(s,t.out,o)):Cs(n,t.out,o)}});function Cs(e,t,r){return e.issues.some(o=>o.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Rf=q("$ZodPreprocess",(e,t)=>{Gc.init(e,t)}),$f=q("$ZodReadonly",(e,t)=>{Se.init(e,t),ge(e,"propValues",r=>r.def.innerType._zod.propValues),ge(e,"values",r=>r.def.innerType._zod.values),ge(e,"optin",r=>r.def.innerType?._zod?.optin),ge(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(zm):zm(n)}});function zm(e){return e.memo||(e.value=Object.freeze(e.value)),e}var wf=q("$ZodLazy",(e,t)=>{Se.init(e,t),vc(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),ge(e,"pattern",r=>r.innerType?._zod?.pattern),ge(e,"propValues",r=>r.innerType?._zod?.propValues),ge(e,"optin",r=>r.innerType?._zod?.optin??void 0),ge(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Pf=q("$ZodCustom",(e,t)=>{De.init(e,t),Se.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Rm(s,r,o,e));Rm(n,r,o,e)}});function Rm(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Ar(n))}}var Yc=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Xc="~memo",Ef=[];function Tf(e){return e!==null&&typeof e=="object"}function Wc(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Cf=new WeakMap,Go=0,As=1,Wo=2;function qs(e,t,r){let o=Cf.get(e);if(o!==void 0)return o?Wo:Go;if(t.has(e))return Wo;t.add(e);let n=Go,s=d=>{if(n!==Wo&&d?._zod){let p=qs(d,t,r);p>n&&(n=p)}},i=(d,p)=>{let _=Go;for(let y of Reflect.ownKeys(d)){let m=Object.getOwnPropertyDescriptor(d,y);if(p&&!m.enumerable)continue;let g=m.get?As:m.value?._zod?qs(m.value,t,r):Go;g>_&&(_=g)}return _},c=d=>{d>n&&(n=d)},a=e._zod.def,u=a.type;switch(u){case"object":{let d=jr(a);c(d?i(d,!0):As),s(a.catchall);break}case"array":s(a.element);break;case"tuple":for(let d of a.items)s(d);s(a.rest);break;case"record":case"map":s(a.keyType),s(a.valueType);break;case"set":s(a.valueType);break;case"union":for(let d of a.options)s(d);break;case"intersection":s(a.left),s(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(a.innerType);break;case"pipe":s(a.in),s(a.out);break;case"function":s(a.input),s(a.output);break;case"lazy":{let d=a._cachedInner??(r?e._zod.innerType:void 0);c(d?qs(d,t,!1):As);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let d in a){let p=Object.getOwnPropertyDescriptor(a,d);if(!p||p.get)continue;let _=p.value;if(!(!_||typeof _!="object")){if(_._zod)s(_);else if(Array.isArray(_))for(let y of _)s(y)}}}return t.delete(e),ev(e,n)}function ev(e,t){return t!==As&&Cf.set(e,t===Wo),t}function tv(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var Ns,js=[],rv={alloc(e,t,r){let o=Ns;if(!o)return r;Ns=void 0;let n={value:r,issues:null};return o.set(t.value,n),js.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,s)=>{if(s.direction!=="backward"&&ov(s,n.value))throw new Yc;return r(n,s)};e._zod.parse=o,e._zod.run===r&&(e._zod.run=o)})},attach(e){var t;let r,o=!1,n,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,c=(a,u)=>{if(r===void 0){let f=qs(e,new Set,!1);if(f===Go)return e._zod.parse=i,e._zod.run===c&&(e._zod.run=i),i(a,u);f===Wo||o?r=!0:o=!0}let d=a.value;if(!Tf(d))return i(a,u);let p=u[Xc];p||(p={buckets:new WeakMap,backEdges:void 0},u[Xc]=p);let _;n===u?_=s:(_=tv(p,e),n=u,s=_);let y=_.get(d);if(y)return a.value=y.value,y.issues?y.issues.length&&a.issues.push(...Wc(y.issues)):(a.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(y.value)),a;Ns=_;let m=js.length,g=i(a,u);Ns=void 0;let h=js.length>m?js.pop():void 0;return g instanceof Promise?g.then(f=>(h&&(h.issues=f.issues.length?Wc(f.issues):Ef),f)):(h&&(h.issues=g.issues.length?Wc(g.issues):Ef),g)};e._zod.parse=c,e._zod.run===i&&(e._zod.run=c)})}};function Qc(){return rv}function ov(e,t){let r=e[Xc]?.backEdges;return r!==void 0&&Tf(t)&&r.has(t)}var nv=()=>{let e={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 t(s){return e[s]??null}let r={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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):o[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=n(s.expected),c=Ec(s.input),a=n(c,s.input);return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${_s(s.values[0])}`:`Invalid option: expected one of ${hs(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",c=t(s.origin);return c?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",c=t(s.origin);return c?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${c.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${hs(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(c=>`'${c}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function kf(){return{localeError:nv()}}var If;var eu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Of(){return new eu}(If=globalThis).__zod_globalRegistry??(If.__zod_globalRegistry=Of());var Lt=globalThis.__zod_globalRegistry;function Ms(e){return e.checks&&(e.checks=[...e.checks]),e}function xf(e,t){return new e(Ms({type:"string",...re(t)}))}function Nf(e,t){return new e(Ms({type:"string",coerce:!0,...re(t)}))}function tu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...re(t)})}function jf(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...re(t)})}function Af(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...re(t)})}function qf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...re(t)})}function Mf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...re(t)})}function Lf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...re(t)})}function ru(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...re(t)})}function Df(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...re(t)})}function Zf(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...re(t)})}function Uf(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...re(t)})}function Ff(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...re(t)})}function Vf(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...re(t)})}function Hf(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...re(t)})}function Jf(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...re(t)})}function Bf(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...re(t)})}function Kf(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...re(t)})}function Gf(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...re(t)})}function Wf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...re(t)})}function Yf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...re(t)})}function Xf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...re(t)})}function Qf(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...re(t)})}function eh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...re(t)})}function Ls(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...re(t)})}function Ds(e,t){return new e({type:"string",format:"date",check:"string_format",...re(t)})}function Zs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...re(t)})}function Us(e,t){return new e({type:"string",format:"duration",check:"string_format",...re(t)})}function th(e,t){return new e(Ms({type:"number",checks:[],...re(t)}))}function rh(e,t){return new e(Ms({type:"number",coerce:!0,checks:[],...re(t)}))}function oh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...re(t)})}function nh(e,t){return new e({type:"boolean",...re(t)})}function sh(e,t){return new e({type:"boolean",coerce:!0,...re(t)})}function ih(e,t){return new e({type:"bigint",coerce:!0,...re(t)})}function ah(e,t){return new e({type:"null",...re(t)})}function ch(e){return new e({type:"any"})}function uh(e){return new e({type:"unknown"})}function lh(e,t){return new e({type:"never",...re(t)})}function dh(e,t){return new e({type:"date",coerce:!0,...re(t)})}function Lr(e,t){return new Zc({check:"less_than",...re(t),value:e,inclusive:!1})}function zt(e,t){return new Zc({check:"less_than",...re(t),value:e,inclusive:!0})}function Dr(e,t){return new Uc({check:"greater_than",...re(t),value:e,inclusive:!1})}function Rt(e,t){return new Uc({check:"greater_than",...re(t),value:e,inclusive:!0})}function Yo(e,t){return new em({check:"multiple_of",...re(t),value:e})}function Fs(e,t){return new rm({check:"max_length",...re(t),maximum:e})}function Zr(e,t){return new om({check:"min_length",...re(t),minimum:e})}function Vs(e,t){return new nm({check:"length_equals",...re(t),length:e})}function ou(e,t){return new sm({check:"string_format",format:"regex",...re(t),pattern:e})}function nu(e){return new im({check:"string_format",format:"lowercase",...re(e)})}function su(e){return new am({check:"string_format",format:"uppercase",...re(e)})}function iu(e,t){return new cm({check:"string_format",format:"includes",...re(t),includes:e})}function au(e,t){return new um({check:"string_format",format:"starts_with",...re(t),prefix:e})}function cu(e,t){return new lm({check:"string_format",format:"ends_with",...re(t),suffix:e})}function Dt(e){return new dm({check:"overwrite",tx:e})}function uu(e){return Dt(t=>t.normalize(e))}function lu(){return Dt(e=>e.trim())}function du(){return Dt(e=>e.toLowerCase())}function pu(){return Dt(e=>e.toUpperCase())}function mu(){return Dt(e=>zc(e))}function ph(e,t,r){return new e({type:"array",element:t,...re(r)})}function mh(e,t,r){return new e({type:"custom",check:"custom",fn:t,...re(r)})}function fh(e,t){let r=sv(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Ar(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Ar(s))}},e(o.value,o)),t);return r}function sv(e,t){let r=new De({check:"custom",...re(t)});return r._zod.check=e,r}function Xo(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,o)&&Ye(e,o,r[o]);return e}function en(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Lt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function qe(e,t,r,o,n){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(n);return Object.assign(r,s),!0}function ve(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)i.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{let _=i.schema,y=t.processors[n.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);y(e,t,_,d)}let p=e._zod.parent;p&&(i.ref||(i.ref=p),ve(p,t,d),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Xo(i.schema,a),t.io==="input"&&Ke(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function hh(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function tn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let i of e.seen.entries()){let c=e.metadataRegistry.get(i[0])?.id;if(c){let a=o.get(c);if(a&&a!==i[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,i[0])}}let n=i=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,_=e.external.uri??(m=>m);if(p)return{ref:_(p)};let y=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=y,{defId:y,ref:`${_("__shared")}#/${c}/${hh(y)}`}}let a="#",u=`${a}/${c}/`;if(i[1]===r&&!i[1].schema.id)return{ref:a};let d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+hh(d)}},s=i=>{if(i[1].schema.$ref)return;let c=i[1],{ref:a,defId:u}=n(i);c.def={...c.schema},u&&(c.defId=u);let d=c.schema;for(let p in d)delete d[p];d.$ref=a};if(e.cycles==="throw")for(let i of e.seen.entries()){let c=i[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
57
|
+
`)}return h.write("payload.value = newResult;"),h.write("return payload;"),h.compile()},i,c=ur,a=!Xe.jitless,d=a&&wc.value,p=t.catchall,g;e._zod.parse=(v,m)=>{g??(g=o.value);let _=v.value;return c(_)?a&&d&&m?.async===!1&&m.jitless!==!0?(i||(i=s(t.shape)),v=i(v,m),p?mf([],_,v,m,g,e,m?.abortEarly===!0):v):r(v,m):(v.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),v)}});function vm(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!ut(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>lt(i,o,Qe())))}),t)}var Gc=q("$ZodUnion",(e,t)=>{Se.init(e,t),ge(e,"optin",o=>o.def.options.some(n=>n._zod.optin==="defaulted")?"defaulted":o.def.options.some(n=>n._zod.optin!==void 0)?"optional":void 0),ge(e,"optout",o=>o.def.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ge(e,"values",o=>{if(o.def.options.every(n=>n._zod.values))return new Set(o.def.options.flatMap(n=>Array.from(n._zod.values)))}),ge(e,"pattern",o=>{if(o.def.options.every(n=>n._zod.pattern)){let n=o.def.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>Uo(s.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let c of t.options){let a=c._zod.run({value:o.value,issues:[]},n);if(a instanceof Promise)i.push(a),s=!0;else{if(a.issues.length===0)return a;i.push(a)}}return s?Promise.all(i).then(c=>vm(c,o,e,n)):vm(i,o,e,n)}});function sv(e){let t=new Map;for(let r of e.options){let o=r._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let n of o)if(t.has(n)){if(n!==void 0)throw new Error(`Duplicate discriminator value "${String(n)}"`);t.set(n,null)}else t.set(n,r)}return t}var hf=q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Gc.init(e,t);let r=e._zod.parse;ge(e,"propValues",n=>{let s={},i=0;for(let c of n.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${n.def.options.indexOf(c)}"`);a[n.def.discriminator]?.has(void 0)&&i++;for(let[u,d]of Object.entries(a)){Object.prototype.hasOwnProperty.call(s,u)||Ye(s,u,new Set);for(let p of d)s[u].add(p)}}return!n.def.unionFallback&&i>1&&s[n.def.discriminator]?.delete(void 0),s}),t.options.forEach((n,s)=>{let i=jr(n._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw new Error(`Invalid discriminated union option at index "${s}"`)});let o=Nr(()=>sv(t));e._zod.parse=(n,s)=>{let i=n.value;if(!ur(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let c=i?.[t.discriminator],a=o.value.get(c);return a&&(c!==void 0||s.direction!=="backward")?a._zod.run(n,s):t.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()).filter(u=>o.value.get(u)!==null),input:i,path:[t.discriminator],inst:e}),n)}}),gf=q("$ZodIntersection",(e,t)=>{Se.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([a,u])=>bm(r,a,u)):bm(r,s,i)}});function Hc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Mt(e)&&Mt(t)){let r=Object.keys(t),o=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};Object.prototype.hasOwnProperty.call(n,"__proto__")&&delete n.__proto__;for(let s of o){if(s==="__proto__")continue;let i=Hc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Hc(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function bm(e,t,r){let o=new Map,n,s=new Map,i=(u,d)=>{let p;if(u.code==="unrecognized_keys"&&!u.path?.length)n??(n=u),p=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let g=String(u.path[0]);s.has(g)||s.set(g,u),p=[g]}else return!1;for(let g of p)o.has(g)||o.set(g,{}),o.get(g)[d]=!0;return!0};for(let u of t.issues)i(u,"l")||e.issues.push(u);for(let u of r.issues)i(u,"r")||e.issues.push(u);let c=[...o].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(c.length){let u=n?c.filter(d=>n.keys.includes(d)):[];u.length&&e.issues.push({...n,keys:u});for(let d of c)!u.includes(d)&&s.has(d)&&e.issues.push(s.get(d))}let a=Hc(t.value,r.value);if(!a.valid){if(ut(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}var _f=q("$ZodRecord",(e,t)=>{Se.init(e,t);let r=Xe.memoizer;r?.attach(e),e._zod.parse=(o,n)=>{let s=o.value;if(!Mt(s))return o.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),o;let i=[],c=t.keyType._zod.values;if(c&&!t.partial){o.value=r?r.alloc(e,o,{},n):{};let a=new Set;for(let d of c)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){if(a.add(typeof d=="number"?d.toString():d),d==="__proto__")continue;let p=t.keyType._zod.run({value:d,issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(m=>lt(m,n,Qe())),input:d,path:[d],inst:e});continue}let g=p.value;if(g==="__proto__")continue;let v=t.valueType._zod.run({value:s[d],issues:[]},n);v instanceof Promise?i.push(v.then(m=>{m.issues.length&&o.issues.push(...bt(d,m.issues)),o.value[g]=m.value})):(v.issues.length&&o.issues.push(...bt(d,v.issues)),o.value[g]=v.value)}let u;for(let d in s)if(!a.has(d))if(t.mode==="loose"){if(d==="__proto__")continue;o.value[d]=s[d]}else u=u??[],u.push(d);u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}else{o.value=r?r.alloc(e,o,{},n):{};let a;for(let u of Reflect.ownKeys(s)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(s,u))continue;let d=t.keyType._zod.run({value:u,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Bo.test(u)&&d.issues.length){let m=t.keyType._zod.run({value:Number(u),issues:[]},n);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(d=m)}if(d.issues.length){t.mode==="loose"?o.value[u]=s[u]:c?(a=a??[],a.push(u)):o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(m=>lt(m,n,Qe())),input:u,path:[u],inst:e});continue}let g=d.value;if(g==="__proto__")continue;let v=t.valueType._zod.run({value:s[u],issues:[]},n);v instanceof Promise?i.push(v.then(m=>{m.issues.length&&o.issues.push(...bt(u,m.issues)),o.value[g]=m.value})):(v.issues.length&&o.issues.push(...bt(u,v.issues)),o.value[g]=v.value)}a&&a.length>0&&o.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a,continue:!0})}return i.length?Promise.all(i).then(()=>o):o}});var Sf=q("$ZodEnum",(e,t)=>{Se.init(e,t);let r=Or(t.entries),o=new Set(r);e._zod.values=o,ge(e,"pattern",n=>{let s=Or(n.def.entries).filter(i=>Pc.has(typeof i));return new RegExp(s.length?`^(${s.map(i=>vt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),yf=q("$ZodLiteral",(e,t)=>{Se.init(e,t);let r=new Set(t.values);e._zod.values=r,ge(e,"pattern",o=>{let n=o.def.values;return new RegExp(n.length?`^(${n.map(s=>typeof s=="string"?vt(s):s?vt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var vf=q("$ZodTransform",(e,t)=>{Se.init(e,t),e._zod.optin="optional",Xe.memoizer?.guard(e),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new qr(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new dt;return r.value=n,r}});function zm(e,t){return e.value=t.issues.length?void 0:t.value,e}var Wc=q("$ZodOptional",(e,t)=>{Se.init(e,t),ge(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",ge(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),ge(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Uo(o.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>zm(r,s)):zm(r,n)}return t.innerType._zod.run(r,o)}}),bf=q("$ZodExactOptional",(e,t)=>{Wc.init(e,t),ge(e,"values",r=>r.def.innerType._zod.values),ge(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),zf=q("$ZodNullable",(e,t)=>{Se.init(e,t),ge(e,"optin",r=>r.def.innerType._zod.optin),ge(e,"optout",r=>r.def.innerType._zod.optout),ge(e,"pattern",r=>{let o=r.def.innerType._zod.pattern;return o?new RegExp(`^(${Uo(o.source)}|null)$`):void 0}),ge(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),Rf=q("$ZodDefault",(e,t)=>{Se.init(e,t),e._zod.optin="defaulted",ge(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Rm(s,t)):Rm(n,t)}});function Rm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var $f=q("$ZodPrefault",(e,t)=>{Se.init(e,t),e._zod.optin="defaulted",ge(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),wf=q("$ZodNonOptional",(e,t)=>{Se.init(e,t),ge(e,"values",r=>{let o=r.def.innerType._zod.values;return o?new Set([...o].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>$m(s,e)):$m(n,e)}});function $m(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function wm(e,t,r,o){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(n=>lt(n,o,Qe()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Pf=q("$ZodCatch",(e,t)=>{Se.init(e,t),ge(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),ge(e,"optout",r=>r.def.innerType._zod.optout),ge(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run({value:r.value,issues:[]},o);return n instanceof Promise?n.then(s=>wm(r,s,t,o)):wm(r,n,t,o)}});var Yc=q("$ZodPipe",(e,t)=>{Se.init(e,t),ge(e,"values",r=>r.def.in._zod.values),ge(e,"optin",r=>r.def.in._zod.optin),ge(e,"optout",r=>r.def.out._zod.optout),ge(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);return s instanceof Promise?s.then(i=>Is(i,t.in,o)):Is(s,t.in,o)}let n=t.in._zod.run(r,o);return n instanceof Promise?n.then(s=>Is(s,t.out,o)):Is(n,t.out,o)}});function Is(e,t,r){return e.issues.some(o=>o.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Ef=q("$ZodPreprocess",(e,t)=>{Yc.init(e,t)}),Tf=q("$ZodReadonly",(e,t)=>{Se.init(e,t),ge(e,"propValues",r=>r.def.innerType._zod.propValues),ge(e,"values",r=>r.def.innerType._zod.values),ge(e,"optin",r=>r.def.innerType?._zod?.optin),ge(e,"optout",r=>r.def.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Pm):Pm(n)}});function Pm(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Cf=q("$ZodLazy",(e,t)=>{Se.init(e,t),zc(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),ge(e,"pattern",r=>r.innerType?._zod?.pattern),ge(e,"propValues",r=>r.innerType?._zod?.propValues),ge(e,"optin",r=>r.innerType?._zod?.optin??void 0),ge(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),kf=q("$ZodCustom",(e,t)=>{De.init(e,t),Se.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Em(s,r,o,e));Em(n,r,o,e)}});function Em(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Ar(n))}}var Qc=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},eu="~memo",If=[];function Of(e){return e!==null&&typeof e=="object"}function Xc(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var xf=new WeakMap,Go=0,Ms=1,Wo=2;function Ls(e,t,r){let o=xf.get(e);if(o!==void 0)return o?Wo:Go;if(t.has(e))return Wo;t.add(e);let n=Go,s=d=>{if(n!==Wo&&d?._zod){let p=Ls(d,t,r);p>n&&(n=p)}},i=(d,p)=>{let g=Go;for(let v of Reflect.ownKeys(d)){let m=Object.getOwnPropertyDescriptor(d,v);if(p&&!m.enumerable)continue;let _=m.get?Ms:m.value?._zod?Ls(m.value,t,r):Go;_>g&&(g=_)}return g},c=d=>{d>n&&(n=d)},a=e._zod.def,u=a.type;switch(u){case"object":{let d=jr(a);c(d?i(d,!0):Ms),s(a.catchall);break}case"array":s(a.element);break;case"tuple":for(let d of a.items)s(d);s(a.rest);break;case"record":case"map":s(a.keyType),s(a.valueType);break;case"set":s(a.valueType);break;case"union":for(let d of a.options)s(d);break;case"intersection":s(a.left),s(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(a.innerType);break;case"pipe":s(a.in),s(a.out);break;case"function":s(a.input),s(a.output);break;case"lazy":{let d=a._cachedInner??(r?e._zod.innerType:void 0);c(d?Ls(d,t,!1):Ms);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let d in a){let p=Object.getOwnPropertyDescriptor(a,d);if(!p||p.get)continue;let g=p.value;if(!(!g||typeof g!="object")){if(g._zod)s(g);else if(Array.isArray(g))for(let v of g)s(v)}}}return t.delete(e),iv(e,n)}function iv(e,t){return t!==Ms&&xf.set(e,t===Wo),t}function av(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}var As,qs=[],cv={alloc(e,t,r){let o=As;if(!o)return r;As=void 0;let n={value:r,issues:null};return o.set(t.value,n),qs.push(n),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,o=(n,s)=>{if(s.direction!=="backward"&&uv(s,n.value))throw new Qc;return r(n,s)};e._zod.parse=o,e._zod.run===r&&(e._zod.run=o)})},attach(e){var t;let r,o=!1,n,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,c=(a,u)=>{if(r===void 0){let f=Ls(e,new Set,!1);if(f===Go)return e._zod.parse=i,e._zod.run===c&&(e._zod.run=i),i(a,u);f===Wo||o?r=!0:o=!0}let d=a.value;if(!Of(d))return i(a,u);let p=u[eu];p||(p={buckets:new WeakMap,backEdges:void 0},u[eu]=p);let g;n===u?g=s:(g=av(p,e),n=u,s=g);let v=g.get(d);if(v)return a.value=v.value,v.issues?v.issues.length&&a.issues.push(...Xc(v.issues)):(a.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(v.value)),a;As=g;let m=qs.length,_=i(a,u);As=void 0;let h=qs.length>m?qs.pop():void 0;return _ instanceof Promise?_.then(f=>(h&&(h.issues=f.issues.length?Xc(f.issues):If),f)):(h&&(h.issues=_.issues.length?Xc(_.issues):If),_)};e._zod.parse=c,e._zod.run===i&&(e._zod.run=c)})}};function tu(){return cv}function uv(e,t){let r=e[eu]?.backEdges;return r!==void 0&&Of(t)&&r.has(t)}var lv=()=>{let e={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 t(s){return e[s]??null}let r={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",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function n(s,i){return s==="number"&&typeof i=="number"&&!Number.isFinite(i)?String(i):o[s]??s}return s=>{switch(s.code){case"invalid_type":{let i=n(s.expected),c=Cc(s.input),a=n(c,s.input);return`Invalid input: expected ${i}, received ${a}`}case"invalid_value":return s.values.length===1?`Invalid input: expected ${ys(s.values[0])}`:`Invalid option: expected one of ${_s(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",c=t(s.origin);return c?`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",c=t(s.origin);return c?`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${c.unit}`:`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${_s(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":return s.options&&Array.isArray(s.options)&&s.options.length>0?`Invalid discriminator value. Expected ${s.options.map(c=>`'${c}'`).join(" | ")}`:s.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Nf(){return{localeError:lv()}}var jf;var ru=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let o=r[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Af(){return new ru}(jf=globalThis).__zod_globalRegistry??(jf.__zod_globalRegistry=Af());var Lt=globalThis.__zod_globalRegistry;function Ds(e){return e.checks&&(e.checks=[...e.checks]),e}function qf(e,t){return new e(Ds({type:"string",...re(t)}))}function Mf(e,t){return new e(Ds({type:"string",coerce:!0,...re(t)}))}function ou(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...re(t)})}function Lf(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...re(t)})}function Df(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...re(t)})}function Zf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...re(t)})}function Uf(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...re(t)})}function Ff(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...re(t)})}function nu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...re(t)})}function Vf(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...re(t)})}function Hf(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...re(t)})}function Jf(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...re(t)})}function Bf(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...re(t)})}function Kf(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...re(t)})}function Gf(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...re(t)})}function Wf(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...re(t)})}function Yf(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...re(t)})}function Xf(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...re(t)})}function Qf(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...re(t)})}function eh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...re(t)})}function th(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...re(t)})}function rh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...re(t)})}function oh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...re(t)})}function nh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...re(t)})}function Zs(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...re(t)})}function Us(e,t){return new e({type:"string",format:"date",check:"string_format",...re(t)})}function Fs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...re(t)})}function Vs(e,t){return new e({type:"string",format:"duration",check:"string_format",...re(t)})}function sh(e,t){return new e(Ds({type:"number",checks:[],...re(t)}))}function ih(e,t){return new e(Ds({type:"number",coerce:!0,checks:[],...re(t)}))}function ah(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...re(t)})}function ch(e,t){return new e({type:"boolean",...re(t)})}function uh(e,t){return new e({type:"boolean",coerce:!0,...re(t)})}function lh(e,t){return new e({type:"bigint",coerce:!0,...re(t)})}function dh(e,t){return new e({type:"null",...re(t)})}function ph(e){return new e({type:"any"})}function mh(e){return new e({type:"unknown"})}function fh(e,t){return new e({type:"never",...re(t)})}function hh(e,t){return new e({type:"date",coerce:!0,...re(t)})}function Lr(e,t){return new Fc({check:"less_than",...re(t),value:e,inclusive:!1})}function zt(e,t){return new Fc({check:"less_than",...re(t),value:e,inclusive:!0})}function Dr(e,t){return new Vc({check:"greater_than",...re(t),value:e,inclusive:!1})}function Rt(e,t){return new Vc({check:"greater_than",...re(t),value:e,inclusive:!0})}function Yo(e,t){return new nm({check:"multiple_of",...re(t),value:e})}function Hs(e,t){return new im({check:"max_length",...re(t),maximum:e})}function Zr(e,t){return new am({check:"min_length",...re(t),minimum:e})}function Js(e,t){return new cm({check:"length_equals",...re(t),length:e})}function su(e,t){return new um({check:"string_format",format:"regex",...re(t),pattern:e})}function iu(e){return new lm({check:"string_format",format:"lowercase",...re(e)})}function au(e){return new dm({check:"string_format",format:"uppercase",...re(e)})}function cu(e,t){return new pm({check:"string_format",format:"includes",...re(t),includes:e})}function uu(e,t){return new mm({check:"string_format",format:"starts_with",...re(t),prefix:e})}function lu(e,t){return new fm({check:"string_format",format:"ends_with",...re(t),suffix:e})}function Dt(e){return new hm({check:"overwrite",tx:e})}function du(e){return Dt(t=>t.normalize(e))}function pu(){return Dt(e=>e.trim())}function mu(){return Dt(e=>e.toLowerCase())}function fu(){return Dt(e=>e.toUpperCase())}function hu(){return Dt(e=>$c(e))}function gh(e,t,r){return new e({type:"array",element:t,...re(r)})}function _h(e,t,r){return new e({type:"custom",check:"custom",fn:t,...re(r)})}function Sh(e,t){let r=dv(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Ar(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Ar(s))}},e(o.value,o)),t);return r}function dv(e,t){let r=new De({check:"custom",...re(t)});return r._zod.check=e,r}function Xo(e,...t){for(let r of t)for(let o of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,o)&&Ye(e,o,r[o]);return e}function en(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Lt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function qe(e,t,r,o,n){let s=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:o.path,message:n}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw new Error(n);return Object.assign(r,s),!0}function ve(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)i.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{let g=i.schema,v=t.processors[n.type];if(!v)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);v(e,t,g,d)}let p=e._zod.parent;p&&(i.ref||(i.ref=p),ve(p,t,d),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Xo(i.schema,a),t.io==="input"&&Ke(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function yh(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function tn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let i of e.seen.entries()){let c=e.metadataRegistry.get(i[0])?.id;if(c){let a=o.get(c);if(a&&a!==i[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(c,i[0])}}let n=i=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,g=e.external.uri??(m=>m);if(p)return{ref:g(p)};let v=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=v,{defId:v,ref:`${g("__shared")}#/${c}/${yh(v)}`}}let a="#",u=`${a}/${c}/`;if(i[1]===r&&!i[1].schema.id)return{ref:a};let d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+yh(d)}},s=i=>{if(i[1].schema.$ref)return;let c=i[1],{ref:a,defId:u}=n(i);c.def={...c.schema},u&&(c.defId=u);let d=c.schema;for(let p in d)delete d[p];d.$ref=a};if(e.cycles==="throw")for(let i of e.seen.entries()){let c=i[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
58
58
|
|
|
59
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let c=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(c.cycle){s(i);continue}c.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Sh(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!="object")return;Sh(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let s=o.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var yh=new Set(["type","properties","required","additionalProperties"]),gh=["oneOf","anyOf"];function _h(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function fu(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!yh.has(i))return null;t.push(s)}let r={},o=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let c=[];for(let u of t){let d=u.properties?.[i]??_h(u);d!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(d))||c.push(d))}let a=c.length===1?c[0]:fu(c)??{allOf:c};Ye(r,i,a)}for(let i of s.required??[])o.add(i)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),t.every(s=>s.additionalProperties===!1))n.additionalProperties=!1;else{let s=[];for(let i of t){let c=_h(i);c&&!s.some(a=>JSON.stringify(a)===JSON.stringify(c))&&s.push(c)}s.length===1?n.additionalProperties=s[0]:s.length>1&&(n.additionalProperties={allOf:s})}return n}function iv(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of yh)if(n in e)return;let r=t.filter(n=>gh.some(s=>Array.isArray(n[s]))),o=null;if(!r.length)o=fu(t);else{let n=r[0],s=gh.find(a=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let i=t.filter(a=>a!==n),c=n[s].map(a=>fu([...i,a]));if(c.some(a=>!a))return;o={[s]:c}}o&&(delete e.allOf,Xo(e,o))}function rn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=c=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,d={...u},p=a.ref;if(a.ref=null,p){o(p);let y=e.seen.get(p),m=y.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Xo(u,m),Xo(u,d),c._zod.parent===p)for(let h in u)h==="$ref"||h==="allOf"||h in d||delete u[h];if(m.$ref&&y.def)for(let h in u)h==="$ref"||h==="allOf"||h in y.def&&JSON.stringify(u[h])===JSON.stringify(y.def[h])&&delete u[h]}let _=c._zod.parent;if(_&&_!==p){o(_);let y=e.seen.get(_);if(y?.schema.$ref&&(u.$ref=y.schema.$ref,y.def))for(let m in u)m==="$ref"||m==="allOf"||m in y.def&&JSON.stringify(u[m])===JSON.stringify(y.def[m])&&delete u[m]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Sh(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let d=u?.allOf;if(!Array.isArray(d))continue;let p=c.get(d);p?p.push(u):c.set(d,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])iv(u)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}Xo(n,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,Ye(i,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Qo(t,"input",e.processors),output:Qo(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Ke(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Ke(o.element,r);if(o.type==="set")return Ke(o.valueType,r);if(o.type==="lazy")return Ke(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return Ke(o.innerType,r);if(o.type==="intersection")return Ke(o.left,r)||Ke(o.right,r);if(o.type==="record"||o.type==="map")return Ke(o.keyType,r)||Ke(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ke(o.in,r)||Ke(o.out,r);if(o.type==="object"){for(let n in o.shape)if(Ke(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Ke(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Ke(n,r))return!0;return!!(o.rest&&Ke(o.rest,r))}return!1}var vh=(e,t={})=>r=>{let o=en({...r,processors:t});return ve(e,o),tn(o,e),rn(o,e)},Qo=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=en({...n??{},target:s,io:t,processors:r});return ve(e,i),tn(i,e),rn(i,e)};var Ur=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Fr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},bh=(e,t)=>{Ur(e,"minimum",t),Fr(e,"maximum",t)},Ph=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Eh=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Th=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},Ch=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},zh=(e,t)=>Ur(e,"minimum",t.minimum),Rh=(e,t)=>Fr(e,"maximum",t.maximum),$h=e=>(t,r)=>{Ch(t,r.format);let[o,n]=e[r.format];Ur(t,"minimum",o),Fr(t,"maximum",n)},av={greater_than:(e,t)=>Ur(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Fr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Ph(e,t.value),number_format:$h(Fo),bigint_format:$h(Ss),min_length:zh,max_length:Rh,length_equals:(e,t)=>bh(e,t.length),min_size:zh,max_size:Rh,size_equals:(e,t)=>bh(e,t.size),string_format:(e,t)=>{Ch(e,t.format),t.pattern&&Eh(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Th(e,t.mime)};function je(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of o)av[s._zod.def.check]?.(t,s._zod.def);let n=e._zod.bag;n.minimum!==void 0&&Ur(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&Ur(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&Fr(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&Fr(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&Ph(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&Th(t,n.mime);for(let s of n.patterns??[])Eh(t,s);return t}var cv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},uv=new Map([[Hc,Dp],[xs,Zp]]),kh=e=>uv.get(e)??e,_u=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:c,patterns:a,contentEncoding:u,laxFormat:d}=je(e);if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),c&&(n.format=cv[c]??c,n.format===""&&delete n.format,(c==="time"||d)&&delete n.format),u&&(n.contentEncoding=u),a&&a.size>0){let p=[...a].map(kh);p.length===1?n.pattern=p[0].source:p.length>1&&(n.allOf=[...p.map(_=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:_.source}))])}},Su=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:d}=je(e);n.type=d?"integer":"number";let p=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),_=typeof a=="number"&&a<=(i??Number.POSITIVE_INFINITY),y=t.target==="draft-04"||t.target==="openapi-3.0";if(p?y?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof s=="number"&&(n.minimum=s),_?y?(n.maximum=a,n.exclusiveMaximum=!0):n.exclusiveMaximum=a:typeof i=="number"&&(n.maximum=i),c){let m=new Set;for(let f of c)Number.isFinite(f)&&f!==0?m.add(Math.abs(f)):qe(e,t,n,o,`A multipleOf divisor of ${f} cannot be represented in JSON Schema`);let[g,...h]=m;g!==void 0&&(n.multipleOf=g),h.length&&(n.allOf=[...n.allOf??[],...h.map(f=>({multipleOf:f}))])}},yu=(e,t,r,o)=>{r.type="boolean"},vu=(e,t,r,o)=>{qe(e,t,r,o,"BigInt cannot be represented in JSON Schema")},Ih=(e,t,r,o)=>{qe(e,t,r,o,"Symbols cannot be represented in JSON Schema")},bu=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Oh=(e,t,r,o)=>{qe(e,t,r,o,"Undefined cannot be represented in JSON Schema")},xh=(e,t,r,o)=>{qe(e,t,r,o,"Void cannot be represented in JSON Schema")},zu=(e,t,r,o)=>{r.not={}},Ru=(e,t,r,o)=>{},$u=(e,t,r,o)=>{},wu=(e,t,r,o)=>{qe(e,t,r,o,"Date cannot be represented in JSON Schema")},Pu=(e,t,r,o)=>{let n=e._zod.def,s=Or(n.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Eu=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let s=[];for(let i of n.values)if(i===void 0){if(qe(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(qe(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s},Nh=(e,t,r,o)=>{qe(e,t,r,o,"NaN cannot be represented in JSON Schema")},jh=(e,t,r,o)=>{let n=r,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},Ah=(e,t,r,o)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:s,maximum:i,mime:c}=je(e);s!==void 0&&(n.minLength=s),i!==void 0&&(n.maxLength=i),c&&(c.length===0?n.not={}:c.length===1?n.contentMediaType=c[0]:n.anyOf=c.map(a=>({contentMediaType:a})))},qh=(e,t,r,o)=>{r.type="boolean"},Tu=(e,t,r,o)=>{qe(e,t,r,o,"Custom types cannot be represented in JSON Schema")},Mh=(e,t,r,o)=>{qe(e,t,r,o,"Function types cannot be represented in JSON Schema")},Cu=(e,t,r,o)=>{qe(e,t,r,o,"Transforms cannot be represented in JSON Schema")},Lh=(e,t,r,o)=>{qe(e,t,r,o,"Map cannot be represented in JSON Schema")},Dh=(e,t,r,o)=>{qe(e,t,r,o,"Set cannot be represented in JSON Schema")},ku=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:c}=je(e);typeof i=="number"&&(n.minItems=i),typeof c=="number"&&(n.maxItems=c),n.type="array",n.items=ve(s.element,t,{...o,path:[...o.path,"items"]})};function on(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?on(t.out):t.type==="catch"?on(t.innerType):e._zod.optin}var Iu=(e,t,r,o)=>{let n=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&qe(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in i)Ye(n.properties,u,ve(i[u],t,{...o,path:[...o.path,"properties",u]}));let a=[];for(let u of Object.keys(i)){let d=s.shape[u];(t.io==="input"?on(d)===void 0:d._zod.optout===void 0)&&a.push(u)}a.length>0&&(n.required=a),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=ve(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Ou=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((c,a)=>ve(c,t,{...o,path:[...o.path,s?"oneOf":"anyOf",a]}));s?r.oneOf=i:r.anyOf=i},xu=(e,t,r,o)=>{let n=e._zod.def,s=ve(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=ve(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(s)?s.allOf:[s],...c(i)?i.allOf:[i]];r.allOf=a,t.intersections.push(a)},Zh=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=s.items.map((g,h)=>ve(g,t,{...o,path:[...o.path,i,h]})),u=s.rest?ve(s.rest,t,{...o,path:[...o.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null,d=s.items.length;for(;d>0;){let g=s.items[d-1];if(!(t.io==="input"?on(g)!==void 0:g._zod.optout==="optional"))break;d--}let p=s.items.length,_=!s.rest;t.target==="draft-2020-12"?(n.prefixItems=a,_?n.items=!1:u&&(n.items=u),d>0&&(n.minItems=d),_&&(n.maxItems=p)):t.target==="openapi-3.0"?(n.items={anyOf:a},u&&n.items.anyOf.push(u),d>0&&(n.minItems=d),_&&(n.maxItems=p)):(n.items=a,_?n.additionalItems=!1:u&&(n.additionalItems=u),d>0&&(n.minItems=d),_&&(n.maxItems=p));let{minimum:y,maximum:m}=je(e);typeof y=="number"&&(n.minItems=y),typeof m=="number"&&(n.maxItems=m)};function hu(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let g=hu(e,m,r);return g===m?t:g}for(let m of["anyOf","oneOf"]){let g=t[m];if(!Array.isArray(g))continue;let h=g.map(f=>hu(e,f,r));h.some((f,z)=>f!==g[z])&&(t={...t,[m]:h})}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some(m=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!s?.some(m=>typeof m=="number"))return t;let{minimum:i,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:d,format:p,id:_,...y}=t;return y.enum?y.enum=y.enum.map(m=>typeof m=="number"?String(m):m):typeof y.const=="number"&&(y.const=String(y.const)),n&&(y.type="string",s||(y.pattern=(o.includes("number")?Bo:Lc).source)),y}var gu=new WeakMap;function lv(e){let t=new Map;for(let o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);let r=new Map;for(let o of gu.get(e)??[]){let n=e.seen.get(o),s=(n?.def??n?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=hu(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let o of e.seen.values())for(let n of[o.schema,o.def]){let s=n&&r.get(n.propertyNames);s&&(n.propertyNames=s)}}var Nu=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=je(i).patterns;if(s.mode==="loose"&&c&&c.size>0){let d=ve(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)Ye(n.patternProperties,kh(p).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=ve(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});let d=gu.get(t);d||(d=[],gu.set(t,d),t.deferred.push(()=>lv(t))),d.push(e)}n.additionalProperties=ve(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let a=i._zod.values,u=t.io==="input"&&on(s.valueType)!==void 0;if(a&&!s.partial&&!u){let d=[...a].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(n.required=d.map(String))}},ju=(e,t,r,o)=>{let n=e._zod.def,s=ve(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Au=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},qu=Symbol();function Uh(e,t,r,o,n){let s=!1,i=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(s=!0,null));return s?(qe(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),qu):JSON.parse(i)}var Mu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i=Uh(n.defaultValue,e,t,r,o);i!==qu&&(r.default=i)},Lu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io!=="input")return;let i=Uh(n.defaultValue,e,t,r,o);i!==qu&&(r._prefault=i)},Du=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{qe(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Zu=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;ve(i,t,o);let c=t.seen.get(e);c.ref=i},Uu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Fh=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Hs=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Fu=(e,t,r,o)=>{let n=e._zod.innerType;ve(n,t,o);let s=t.seen.get(e);s.ref=n},wh={string:_u,number:Su,boolean:yu,bigint:vu,symbol:Ih,null:bu,undefined:Oh,void:xh,never:zu,any:Ru,unknown:$u,date:wu,enum:Pu,literal:Eu,nan:Nh,template_literal:jh,file:Ah,success:qh,custom:Tu,function:Mh,transform:Cu,map:Lh,set:Dh,array:ku,object:Iu,union:Ou,intersection:xu,tuple:Zh,record:Nu,nullable:ju,nonoptional:Au,default:Mu,prefault:Lu,catch:Du,pipe:Zu,readonly:Uu,promise:Fh,optional:Hs,lazy:Fu};function Js(e,t){if("_idmap"in e){let o=e,n=en({...t,processors:wh}),s={};for(let a of o._idmap.entries()){let[u,d]=a;ve(d,n)}let i={},c={registry:o,uri:t?.uri,defs:s};n.external=c;for(let a of o._idmap.entries()){let[u,d]=a;tn(n,d),Ye(i,u,rn(n,d))}if(Object.keys(s).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:s}}return{schemas:i}}let r=en({...t,processors:wh});return ve(e,r),tn(r,e),rn(r,e)}var Vh=new WeakSet([Object.prototype,Error.prototype]);function Bs(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var yv=(e,t)=>{hp.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Vh.has(r)||(Vh.add(r),Bs(r,"format",o=>n=>Nc(o,n)),Bs(r,"flatten",o=>n=>xc(o,n)),Bs(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,xr,2)}),Bs(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,xr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var rt=q("ZodError",yv,void 0,{Parent:Error});var Hh=Rs(rt),Jh=$s(rt),Ks=ws(rt),Bh=Ps(rt),Kh=_p(rt),Gh=Sp(rt),Wh=yp(rt),Yh=vp(rt),Xh=bp(rt),Qh=zp(rt),eg=Rp(rt),tg=$p(rt);function bv(){Xe.localeError||Qe(kf())}function Ws(){Xe.memoizer||Qe({memoizer:Qc()})}var ye=q("ZodType",(e,t)=>(bv(),Se.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ce.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return it(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(cb(e,t))},superRefine(e,t){return this.check(ub(e,t))},overwrite(e){return this.check(Dt(e))},optional(){return X(this)},exactOptional(){return Kv(this)},nullable(){return ng(this)},nullish(){return X(ng(this))},nonoptional(e){return eb(this,e)},array(){return I(this)},or(e){return Y([this,e])},and(e){return $t(this,e)},transform(e){return sg(this,hg(e))},default(e){return Yv(this,e)},prefault(e){return Qv(this,e)},catch(e){return rb(this,e)},pipe(e){return sg(this,e)},readonly(){return sb(this)},describe(e){let t=this.clone();return Lt.add(t,{description:e}),t},meta(...e){if(e.length===0)return Lt.get(this);let t=this.clone();return Lt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ce.hide(this,"~standard",{...Vc(this),jsonSchema:{input:Qo(this,"input"),output:Qo(this,"output")}})},set"~standard"(e){ce.own(this,"~standard",e)},parse:function e(t,r){return Hh(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Jh(this,t,r,{callee:e})},safeParse(e,t){return Ks(this,e,t)},async safeParseAsync(e,t){return Bh(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ce.own(this,"spa",e)},validate(e,t){return jc(this,e,t)},validateAsync(e,t){return Ac(this,e,t)},encode:function e(t,r){return Kh(this,t,r,{callee:e})},decode:function e(t,r){return Gh(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Wh(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Yh(this,t,r,{callee:e})},safeEncode(e,t){return Xh(this,e,t)},safeDecode(e,t){return Qh(this,e,t)},async safeEncodeAsync(e,t){return eg(this,e,t)},async safeDecodeAsync(e,t){return tg(this,e,t)},toJSONSchema(e){return vh(this,{})(e)},get description(){return Lt.get(this)?.description},get _def(){return this._zod.def}}),ig=q("_ZodString",(e,t)=>{Os.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_u(e,r,o,n)},ce.derived({format:e=>je(e).format??null,minLength:e=>je(e).minimum??null,maxLength:e=>je(e).maximum??null},{regex(...e){return this.check(ou(...e))},includes(...e){return this.check(iu(...e))},startsWith(...e){return this.check(au(...e))},endsWith(...e){return this.check(cu(...e))},min(...e){return this.check(Zr(...e))},max(...e){return this.check(Fs(...e))},length(...e){return this.check(Vs(...e))},nonempty(...e){return this.check(Zr(1,...e))},lowercase(e){return this.check(nu(e))},uppercase(e){return this.check(su(e))},trim(){return this.check(lu())},normalize(...e){return this.check(uu(...e))},toLowerCase(){return this.check(du())},toUpperCase(){return this.check(pu())},slugify(){return this.check(mu())}})),Hu=q("ZodString",(e,t)=>{Os.init(e,t),ig.init(e,t)},{email(e){return this.check(tu(ag,e))},url(e){return this.check(ru(ug,e))},jwt(e){return this.check(eh(qv,e))},emoji(e){return this.check(Df(Rv,e))},guid(e){return this.check(jf(zv,e))},uuid(e){return this.check(Af(Gs,e))},uuidv4(e){return this.check(qf(Gs,e))},uuidv6(e){return this.check(Mf(Gs,e))},uuidv7(e){return this.check(Lf(Gs,e))},nanoid(e){return this.check(Zf($v,e))},cuid(e){return this.check(Uf(wv,e))},cuid2(e){return this.check(Ff(Pv,e))},ulid(e){return this.check(Vf(Ev,e))},base64(e){return this.check(Yf(Nv,e))},base64url(e){return this.check(Xf(jv,e))},xid(e){return this.check(Hf(Tv,e))},ksuid(e){return this.check(Jf(Cv,e))},ipv4(e){return this.check(Bf(kv,e))},ipv6(e){return this.check(Kf(Iv,e))},cidrv4(e){return this.check(Gf(Ov,e))},cidrv6(e){return this.check(Wf(xv,e))},e164(e){return this.check(Qf(Av,e))},datetime(e){return this.check(Ls(nn,e))},date(e){return this.check(Ds(sn,e))},time(e){return this.check(Zs(an,e))},duration(e){return this.check(Us(cn,e))}});function l(e){return xf(Hu,e)}var Pe=q("ZodStringFormat",(e,t)=>{Re.init(e,t),ig.init(e,t)}),nn=q("ZodISODateTime",(e,t)=>{Mm.init(e,t),Pe.init(e,t)}),sn=q("ZodISODate",(e,t)=>{Lm.init(e,t),Pe.init(e,t)}),an=q("ZodISOTime",(e,t)=>{Dm.init(e,t),Pe.init(e,t)}),cn=q("ZodISODuration",(e,t)=>{Zm.init(e,t),Pe.init(e,t)}),ag=q("ZodEmail",(e,t)=>{Em.init(e,t),Pe.init(e,t)});function cg(e){return tu(ag,e)}var zv=q("ZodGUID",(e,t)=>{wm.init(e,t),Pe.init(e,t)});var Gs=q("ZodUUID",(e,t)=>{Pm.init(e,t),Pe.init(e,t)});var ug=q("ZodURL",(e,t)=>{km.init(e,t),Pe.init(e,t)});function Ys(e){return ru(ug,e)}var Rv=q("ZodEmoji",(e,t)=>{Im.init(e,t),Pe.init(e,t)});var $v=q("ZodNanoID",(e,t)=>{Om.init(e,t),Pe.init(e,t)});var wv=q("ZodCUID",(e,t)=>{xm.init(e,t),Pe.init(e,t)});var Pv=q("ZodCUID2",(e,t)=>{Nm.init(e,t),Pe.init(e,t)});var Ev=q("ZodULID",(e,t)=>{jm.init(e,t),Pe.init(e,t)});var Tv=q("ZodXID",(e,t)=>{Am.init(e,t),Pe.init(e,t)});var Cv=q("ZodKSUID",(e,t)=>{qm.init(e,t),Pe.init(e,t)});var kv=q("ZodIPv4",(e,t)=>{Um.init(e,t),Pe.init(e,t)});var Iv=q("ZodIPv6",(e,t)=>{Vm.init(e,t),Pe.init(e,t)});var Ov=q("ZodCIDRv4",(e,t)=>{Hm.init(e,t),Pe.init(e,t)});var xv=q("ZodCIDRv6",(e,t)=>{Jm.init(e,t),Pe.init(e,t)});var Nv=q("ZodBase64",(e,t)=>{Km.init(e,t),Pe.init(e,t)});var jv=q("ZodBase64URL",(e,t)=>{Gm.init(e,t),Pe.init(e,t)});var Av=q("ZodE164",(e,t)=>{Wm.init(e,t),Pe.init(e,t)});var qv=q("ZodJWT",(e,t)=>{Ym.init(e,t),Pe.init(e,t)});var Xs=q("ZodNumber",(e,t)=>{Jc.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Su(e,r,o,n),e.isFinite=!0},ce.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=je(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=je(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=je(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>je(e).format??null},{gt(e,t){return this.check(Dr(e,t))},gte(e,t){return this.check(Rt(e,t))},min(e,t){return this.check(Rt(e,t))},lt(e,t){return this.check(Lr(e,t))},lte(e,t){return this.check(zt(e,t))},max(e,t){return this.check(zt(e,t))},int(e){return this.check(rg(e))},safe(e){return this.check(rg(e))},positive(e){return this.check(Dr(0,e))},nonnegative(e){return this.check(Rt(0,e))},negative(e){return this.check(Lr(0,e))},nonpositive(e){return this.check(zt(0,e))},multipleOf(e,t){return this.check(Yo(e,t))},step(e,t){return this.check(Yo(e,t))},finite(){return this}}));function L(e){return th(Xs,e)}var Mv=q("ZodNumberFormat",(e,t)=>{Xm.init(e,t),Xs.init(e,t)});function rg(e){return oh(Mv,e)}var Ju=q("ZodBoolean",(e,t)=>{Qm.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yu(e,r,o,n)});function H(e){return nh(Ju,e)}var lg=q("ZodBigInt",(e,t)=>{ef.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vu(e,r,o,n)},ce.derived({minValue:e=>je(e).minimum??null,maxValue:e=>je(e).maximum??null,format:e=>je(e).format??null},{gte(e,t){return this.check(Rt(e,t))},min(e,t){return this.check(Rt(e,t))},gt(e,t){return this.check(Dr(e,t))},lt(e,t){return this.check(Lr(e,t))},lte(e,t){return this.check(zt(e,t))},max(e,t){return this.check(zt(e,t))},positive(e){return this.check(Dr(BigInt(0),e))},negative(e){return this.check(Lr(BigInt(0),e))},nonpositive(e){return this.check(zt(BigInt(0),e))},nonnegative(e){return this.check(Rt(BigInt(0),e))},multipleOf(e,t){return this.check(Yo(e,t))}}));var Lv=q("ZodNull",(e,t)=>{tf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bu(e,r,o,n)});function ur(e){return ah(Lv,e)}var Dv=q("ZodAny",(e,t)=>{rf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ru(e,r,o,n)});function dg(){return ch(Dv)}var Zv=q("ZodUnknown",(e,t)=>{of.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$u(e,r,o,n)});function Q(){return uh(Zv)}var Uv=q("ZodNever",(e,t)=>{nf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zu(e,r,o,n)});function pg(e){return lh(Uv,e)}var mg=q("ZodDate",(e,t)=>{sf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wu(e,r,o,n),e.min=(r,o)=>e.check(Rt(r,o)),e.max=(r,o)=>e.check(zt(r,o))},ce.derived({minDate:e=>{let{minimum:t}=je(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=je(e);return t?new Date(t):null}},{}));var Fv=q("ZodArray",(e,t)=>{Ws(),af.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ku(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Zr(e,t))},nonempty(e){return this.check(Zr(1,e))},max(e,t){return this.check(Fs(e,t))},length(e,t){return this.check(Vs(e,t))},unwrap(){return this.element}});function I(e,t){return ph(Fv,e,t)}var Bu=q("ZodObject",(e,t)=>{Ws(),lf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Iu(e,r,o,n),ce.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return te(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ce.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ce.mergeDefs(this._zod.def,{catchall:Q()}))},loose(){return this.clone(ce.mergeDefs(this._zod.def,{catchall:Q()}))},strict(){return this.clone(ce.mergeDefs(this._zod.def,{catchall:pg()}))},strip(){return this.clone(ce.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return ce.extend(this,e)},safeExtend(e){return ce.safeExtend(this,e)},merge(e){return ce.merge(this,e)},pick(e){return ce.pick(this,e)},omit(e){return ce.omit(this,e)},partial(...e){return ce.partial(gg,this,e[0])},exactPartial(...e){return ce.partial(_g,this,e[0],"exactPartial")},required(...e){return ce.required(Sg,this,e[0])}});function P(e,t){let r={type:"object",shape:e??{},...ce.normalizeParams(t)};return new Bu(r)}function Ge(e,t){return new Bu({type:"object",shape:e,catchall:pg(),...ce.normalizeParams(t)})}function oe(e,t){return new Bu({type:"object",shape:e,catchall:Q(),...ce.normalizeParams(t)})}var fg=q("ZodUnion",(e,t)=>{Bc.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ou(e,r,o,n),e.options=t.options});function Y(e,t){return new fg({type:"union",options:e,...ce.normalizeParams(t)})}var Vv=q("ZodDiscriminatedUnion",(e,t)=>{fg.init(e,t),df.init(e,t)});function Hr(e,t,r){return new Vv({type:"union",options:t,discriminator:e,...ce.normalizeParams(r)})}var Hv=q("ZodIntersection",(e,t)=>{pf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xu(e,r,o,n)});function $t(e,t){return new Hv({type:"intersection",left:e,right:t})}var og=q("ZodRecord",(e,t)=>{Ws(),mf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Nu(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function K(e,t,r){return!t||!t._zod?new og({type:"record",keyType:l(),valueType:e,...ce.normalizeParams(t)}):new og({type:"record",keyType:e,valueType:t,...ce.normalizeParams(r)})}var Vu=q("ZodEnum",(e,t)=>{ff.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Pu(e,o,n,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Vu({...t,checks:[],...ce.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Vu({...t,checks:[],...ce.normalizeParams(n),entries:s})}});function te(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Vu({type:"enum",entries:r,...ce.normalizeParams(t)})}var Jv=q("ZodLiteral",(e,t)=>{hf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Eu(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function O(e,t){return new Jv({type:"literal",values:Array.isArray(e)?e:[e],...ce.normalizeParams(t)})}var Bv=q("ZodTransform",(e,t)=>{Ws(),gf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cu(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new qr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(ce.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ce.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function hg(e){return new Bv({type:"transform",transform:e})}var gg=q("ZodOptional",(e,t)=>{Kc.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function X(e){return new gg({type:"optional",innerType:e})}var _g=q("ZodExactOptional",(e,t)=>{_f.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Kv(e){return new _g({type:"optional",innerType:e})}var Gv=q("ZodNullable",(e,t)=>{Sf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ju(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ng(e){return new Gv({type:"nullable",innerType:e})}var Wv=q("ZodDefault",(e,t)=>{yf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Yv(e,t){return new Wv({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.shallowClone(t)}})}var Xv=q("ZodPrefault",(e,t)=>{vf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Lu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Qv(e,t){return new Xv({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.shallowClone(t)}})}var Sg=q("ZodNonOptional",(e,t)=>{bf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Au(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function eb(e,t){return new Sg({type:"nonoptional",innerType:e,...ce.normalizeParams(t)})}var tb=q("ZodCatch",(e,t)=>{zf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Du(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rb(e,t){return new tb({type:"catch",innerType:e,catchValue:typeof t=="function"?t:ce.constantCatch(t)})}var yg=q("ZodPipe",(e,t)=>{Gc.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zu(e,r,o,n),e.in=t.in,e.out=t.out});function sg(e,t){return new yg({type:"pipe",in:e,out:t})}var ob=q("ZodPreprocess",(e,t)=>{yg.init(e,t),Rf.init(e,t)}),nb=q("ZodReadonly",(e,t)=>{$f.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Uu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function sb(e){return new nb({type:"readonly",innerType:e})}var ib=q("ZodLazy",(e,t)=>{wf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fu(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function un(e){return new ib({type:"lazy",getter:e})}var ab=q("ZodCustom",(e,t)=>{Pf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tu(e,r,o,n)});function cb(e,t={}){return mh(ab,e,t)}function ub(e,t){return fh(e,t)}function lr(e,t){return new ob({type:"pipe",in:hg(e),out:t})}var bg={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"};var vg;vg||(vg={});var wt={};dc(wt,{ZodISODate:()=>sn,ZodISODateTime:()=>nn,ZodISODuration:()=>cn,ZodISOTime:()=>an,date:()=>pb,datetime:()=>db,duration:()=>fb,time:()=>mb});function db(e){return Ls(nn,e)}function pb(e){return Ds(sn,e)}function mb(e){return Zs(an,e)}function fb(e){return Us(cn,e)}var Qs={};dc(Qs,{bigint:()=>Sb,boolean:()=>_b,date:()=>yb,number:()=>gb,string:()=>hb});function hb(e){return Nf(Hu,e)}function gb(e){return rh(Xs,e)}function _b(e){return sh(Ju,e)}function Sb(e){return ih(lg,e)}function yb(e){return dh(mg,e)}var pr="2025-11-25";var ei=[pr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ti="io.modelcontextprotocol/related-task",mr="io.modelcontextprotocol/protocolVersion",Jr="io.modelcontextprotocol/clientInfo",Et="io.modelcontextprotocol/serverInfo",Tt="io.modelcontextprotocol/clientCapabilities",ln="io.modelcontextprotocol/subscriptionId",Ut="io.modelcontextprotocol/logLevel";var fr="2.0";var Zt=un(()=>Y([l(),L(),H(),ur(),K(l(),Zt),I(Zt)])),Ee=K(l(),Zt),Gu=I(Zt),dn=Y([l(),L().int()]),pn=l(),ri=P({ttl:L().optional()}),oi=P({taskId:l()}),mn=oe({progressToken:dn.optional(),[ti]:oi.optional()}),Le=P({_meta:mn.optional()}),hr=Le.extend({task:ri.optional()}),Te=P({method:l(),params:Le.loose().optional()}),Ve=P({_meta:mn.optional()}),He=P({method:l(),params:Ve.loose().optional()}),fn=oe({get[Et](){return Gr.optional().catch(void 0)}}),Ce=oe({_meta:fn.optional()}),Ft=Y([l(),L().int()]),hn=P({jsonrpc:O(fr),id:Ft,...Te.shape}).strict(),gn=P({jsonrpc:O(fr),...He.shape}).strict(),Br=P({jsonrpc:O(fr),id:Ft,result:Ce}).strict(),Kr=P({jsonrpc:O(fr),id:Ft.optional(),error:P({code:L().int(),message:l(),data:Q().optional()})}).strict(),_n=Y([hn,gn,Br,Kr]),Wu=Y([Br,Kr]),Sn=Ce.strict(),ni=Ve.extend({requestId:Ft.optional(),reason:l().optional()}),yn=He.extend({method:O("notifications/cancelled"),params:ni}),si=P({src:l(),mimeType:l().optional(),sizes:I(l()).optional(),theme:te(["light","dark"]).optional()}),Vt=P({icons:I(si).optional()}),Pt=P({name:l(),title:l().optional()}),Gr=Pt.extend({...Pt.shape,...Vt.shape,version:l(),websiteUrl:l().optional(),description:l().optional()}),bb=$t(P({applyDefaults:H().optional()}),Ee),zb=lr(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,$t(P({form:bb.optional(),url:Ee.optional()}),Ee.optional())),ii=oe({list:Ee.optional(),cancel:Ee.optional(),requests:oe({sampling:oe({createMessage:Ee.optional()}).optional(),elicitation:oe({create:Ee.optional()}).optional()}).optional()}),ai=oe({list:Ee.optional(),cancel:Ee.optional(),requests:oe({tools:oe({call:Ee.optional()}).optional()}).optional()}),ci=P({experimental:K(l(),Ee).optional(),sampling:P({context:Ee.optional(),tools:Ee.optional()}).optional(),elicitation:zb.optional(),roots:P({listChanged:H().optional()}).optional(),tasks:ii.optional(),extensions:K(l(),Ee).optional()}),ui=Le.extend({protocolVersion:l(),capabilities:ci,clientInfo:Gr}),li=Te.extend({method:O("initialize"),params:ui}),vn=P({experimental:K(l(),Ee).optional(),logging:Ee.optional(),completions:Ee.optional(),prompts:P({listChanged:H().optional()}).optional(),resources:P({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:P({listChanged:H().optional()}).optional(),tasks:ai.optional(),extensions:K(l(),Ee).optional()}),di=Ce.extend({protocolVersion:l(),capabilities:vn,serverInfo:Gr,instructions:l().optional()}),pi=He.extend({method:O("notifications/initialized"),params:Ve.optional()}),mi=Te.extend({method:O("server/discover"),params:Le.optional()}),fi=Ce.extend({supportedVersions:I(l()),capabilities:vn,instructions:l().optional()}),bn=Te.extend({method:O("ping"),params:Le.optional()}),hi=P({progress:L(),total:X(L()),message:X(l())}),gi=P({...Ve.shape,...hi.shape,progressToken:dn}),zn=He.extend({method:O("notifications/progress"),params:gi}),_i=Le.extend({cursor:pn.optional()}),Ht=Te.extend({params:_i.optional()}),Jt=Ce.extend({nextCursor:pn.optional()}),Rn=P({uri:l(),mimeType:X(l()),_meta:K(l(),Q()).optional()}),$n=Rn.extend({text:l()}),Yu=l().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),wn=Rn.extend({blob:Yu}),Bt=te(["user","assistant"]),Ct=P({audience:I(Bt).optional(),priority:L().min(0).max(1).optional(),lastModified:wt.datetime({offset:!0}).optional()}),Pn=P({...Pt.shape,...Vt.shape,uri:l(),description:X(l()),mimeType:X(l()),size:X(L()),annotations:Ct.optional(),_meta:X(oe({}))}),Si=P({...Pt.shape,...Vt.shape,uriTemplate:l(),description:X(l()),mimeType:X(l()),annotations:Ct.optional(),_meta:X(oe({}))}),yi=Ht.extend({method:O("resources/list")}),vi=Jt.extend({resources:I(Pn)}),bi=Ht.extend({method:O("resources/templates/list")}),zi=Jt.extend({resourceTemplates:I(Si)}),Wr=Le.extend({uri:l()}),Ri=Wr,$i=Te.extend({method:O("resources/read"),params:Ri}),wi=Ce.extend({contents:I(Y([$n,wn]))}),Pi=He.extend({method:O("notifications/resources/list_changed"),params:Ve.optional()}),Ei=Wr,Ti=Te.extend({method:O("resources/subscribe"),params:Ei}),Ci=Wr,ki=Te.extend({method:O("resources/unsubscribe"),params:Ci}),En=P({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:I(l()).optional()}),Ii=Le.extend({notifications:En}),Oi=Te.extend({method:O("subscriptions/listen"),params:Ii}),xi=Ve.extend({notifications:En}),Ni=He.extend({method:O("notifications/subscriptions/acknowledged"),params:xi}),ji=fn.extend({[ln]:Ft}),Ai=Ce.extend({_meta:ji}),qi=Ve.extend({uri:l()}),Mi=He.extend({method:O("notifications/resources/updated"),params:qi}),Li=P({name:l(),description:X(l()),required:X(H())}),Di=P({...Pt.shape,...Vt.shape,description:X(l()),arguments:X(I(Li)),_meta:X(oe({}))}),Zi=Ht.extend({method:O("prompts/list")}),Ui=Jt.extend({prompts:I(Di)}),Fi=Le.extend({name:l(),arguments:K(l(),l()).optional()}),Vi=Te.extend({method:O("prompts/get"),params:Fi}),Yr=P({type:O("text"),text:l(),annotations:Ct.optional(),_meta:K(l(),Q()).optional()}),Xr=P({type:O("image"),data:Yu,mimeType:l(),annotations:Ct.optional(),_meta:K(l(),Q()).optional()}),Qr=P({type:O("audio"),data:Yu,mimeType:l(),annotations:Ct.optional(),_meta:K(l(),Q()).optional()}),Hi=P({type:O("tool_use"),name:l(),id:l(),input:K(l(),Q()),_meta:K(l(),Q()).optional()}),Ji=P({type:O("resource"),resource:Y([$n,wn]),annotations:Ct.optional(),_meta:K(l(),Q()).optional()}),Bi=Pn.extend({type:O("resource_link")}),eo=Y([Yr,Xr,Qr,Bi,Ji]),Ki=P({role:Bt,content:eo}),Gi=Ce.extend({description:l().optional(),messages:I(Ki)}),Wi=He.extend({method:O("notifications/prompts/list_changed"),params:Ve.optional()}),Yi=P({title:l().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),Xi=P({taskSupport:te(["required","optional","forbidden"]).optional()}),Tn=P({...Pt.shape,...Vt.shape,description:l().optional(),inputSchema:P({type:O("object"),properties:K(l(),Zt).optional(),required:I(l()).optional()}).catchall(Q()),outputSchema:oe({$schema:l().optional()}).optional(),annotations:Yi.optional(),execution:Xi.optional(),_meta:K(l(),Q()).optional()}),Qi=Ht.extend({method:O("tools/list")}),ea=Jt.extend({tools:I(Tn)}),Cn=Ce.extend({content:I(eo).default([]),structuredContent:Q().optional(),isError:H().optional()}),Xu=Cn.or(Ce.extend({toolResult:Q()})),ta=hr.extend({name:l(),arguments:K(l(),Q()).optional()}),ra=Te.extend({method:O("tools/call"),params:ta}),oa=He.extend({method:O("notifications/tools/list_changed"),params:Ve.optional()}),Qu=P({autoRefresh:H().default(!0),debounceMs:L().int().nonnegative().default(300)}),Kt=te(["debug","info","notice","warning","error","critical","alert","emergency"]),na=Le.extend({level:Kt}),sa=Te.extend({method:O("logging/setLevel"),params:na}),ia=Ve.extend({level:Kt,logger:l().optional(),data:Q()}),aa=He.extend({method:O("notifications/message"),params:ia}),ca=P({name:l().optional()}),ua=P({hints:I(ca).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),la=P({mode:te(["auto","required","none"]).optional()}),da=P({type:O("tool_result"),toolUseId:l().describe("The unique identifier for the corresponding tool call."),content:I(eo),structuredContent:Q().optional(),isError:H().optional(),_meta:K(l(),Q()).optional()}),pa=Hr("type",[Yr,Xr,Qr]),dr=Hr("type",[Yr,Xr,Qr,Hi,da]),ma=P({role:Bt,content:Y([dr,I(dr)]),_meta:K(l(),Q()).optional()}),fa=hr.extend({messages:I(ma),modelPreferences:ua.optional(),systemPrompt:l().optional(),includeContext:te(["none","thisServer","allServers"]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:I(l()).optional(),metadata:Ee.optional(),tools:I(Tn).optional(),toolChoice:la.optional()}),ha=Te.extend({method:O("sampling/createMessage"),params:fa}),ga=Ce.extend({model:l(),stopReason:X(te(["endTurn","stopSequence","maxTokens"]).or(l())),role:Bt,content:pa}),_a=Ce.extend({model:l(),stopReason:X(te(["endTurn","stopSequence","maxTokens","toolUse"]).or(l())),role:Bt,content:Y([dr,I(dr)])}),kn=P({type:O("boolean"),title:l().optional(),description:l().optional(),default:H().optional()}),to=P({type:O("string"),title:l().optional(),description:l().optional(),minLength:L().optional(),maxLength:L().optional(),format:te(["email","uri","date","date-time"]).optional(),default:l().optional()}),ro=P({type:te(["number","integer"]),title:l().optional(),description:l().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),In=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),default:l().optional()}),On=P({type:O("string"),title:l().optional(),description:l().optional(),oneOf:I(P({const:l(),title:l()})),default:l().optional()}),xn=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),enumNames:I(l()).optional(),default:l().optional()}),Sa=Y([In,On]),Nn=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({type:O("string"),enum:I(l())}),default:I(l()).optional()}),jn=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({anyOf:I(P({const:l(),title:l()}))}),default:I(l()).optional()}),ya=Y([Nn,jn]),va=Y([xn,Sa,ya]),An=Y([va,kn,to,ro]),oo=hr.extend({mode:O("form").optional(),message:l(),requestedSchema:P({type:O("object"),properties:K(l(),An),required:I(l()).optional()}).catchall(Q())}),ba=hr.extend({mode:O("url"),message:l(),elicitationId:l(),url:l().url()}),za=Y([oo,ba]),Ra=Te.extend({method:O("elicitation/create"),params:za}),$a=Ve.extend({elicitationId:l()}),wa=He.extend({method:O("notifications/elicitation/complete"),params:$a}),Pa=Ce.extend({action:te(["accept","decline","cancel"]),content:lr(e=>e===null?void 0:e,K(l(),Y([l(),L(),H(),I(l())])).optional())}),Ea=P({type:O("ref/resource"),uri:l()}),Ta=P({type:O("ref/prompt"),name:l()}),Ca=Le.extend({ref:Y([Ta,Ea]),argument:P({name:l(),value:l()}),context:P({arguments:K(l(),l()).optional()}).optional()}),ka=Te.extend({method:O("completion/complete"),params:Ca}),Ia=Ce.extend({completion:oe({values:I(l()).max(100),total:X(L().int()),hasMore:X(H())})}),Oa=P({uri:l().startsWith("file://"),name:l().optional(),_meta:K(l(),Q()).optional()}),xa=Te.extend({method:O("roots/list"),params:Le.optional()}),Na=Ce.extend({roots:I(Oa)}),ja=He.extend({method:O("notifications/roots/list_changed"),params:Ve.optional()}),el=oe({ttl:L().optional(),pollInterval:L().optional()}),Aa=te(["working","input_required","completed","failed","cancelled"]),Gt=P({taskId:l(),status:Aa,ttl:Y([L(),ur()]),createdAt:l(),lastUpdatedAt:l(),pollInterval:X(L()),statusMessage:X(l())}),tl=Ce.extend({task:Gt}),qa=Ve.merge(Gt),rl=He.extend({method:O("notifications/tasks/status"),params:qa}),ol=Te.extend({method:O("tasks/get"),params:Le.extend({taskId:l()})}),nl=Ce.merge(Gt),sl=Te.extend({method:O("tasks/result"),params:Le.extend({taskId:l()})}),il=Ce.loose(),al=Ht.extend({method:O("tasks/list")}),cl=Jt.extend({tasks:I(Gt)}),ul=Te.extend({method:O("tasks/cancel"),params:Le.extend({taskId:l()})}),ll=Ce.merge(Gt),dl=Y([bn,li,mi,ka,sa,Vi,Zi,yi,bi,$i,Ti,ki,Oi,ra,Qi]),pl=Y([yn,zn,pi,ja]),ml=Y([Sn,ga,_a,Pa,Na]),fl=Y([bn,ha,Ra,xa]),hl=Y([yn,zn,aa,Mi,Pi,oa,Wi,Ni,wa]),gl=Y([Sn,di,fi,Ia,Gi,Ui,vi,zi,wi,Cn,ea,Ai]),Me=Ys().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:bg.custom,message:"URL must be parseable",fatal:!0}),kc}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),_l=oe({resource:l().url(),authorization_servers:I(Me).optional(),jwks_uri:l().url().optional(),scopes_supported:I(l()).optional(),bearer_methods_supported:I(l()).optional(),resource_signing_alg_values_supported:I(l()).optional(),resource_name:l().optional(),resource_documentation:l().optional(),resource_policy_uri:l().url().optional(),resource_tos_uri:l().url().optional(),tls_client_certificate_bound_access_tokens:H().optional(),authorization_details_types_supported:I(l()).optional(),dpop_signing_alg_values_supported:I(l()).optional(),dpop_bound_access_tokens_required:H().optional()}),Ma=oe({issuer:l(),authorization_endpoint:Me,token_endpoint:Me,registration_endpoint:Me.optional(),scopes_supported:I(l()).optional(),response_types_supported:I(l()),response_modes_supported:I(l()).optional(),grant_types_supported:I(l()).optional(),token_endpoint_auth_methods_supported:I(l()).optional(),token_endpoint_auth_signing_alg_values_supported:I(l()).optional(),service_documentation:Me.optional(),revocation_endpoint:Me.optional(),revocation_endpoint_auth_methods_supported:I(l()).optional(),revocation_endpoint_auth_signing_alg_values_supported:I(l()).optional(),introspection_endpoint:l().optional(),introspection_endpoint_auth_methods_supported:I(l()).optional(),introspection_endpoint_auth_signing_alg_values_supported:I(l()).optional(),code_challenge_methods_supported:I(l()).optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0),dpop_signing_alg_values_supported:I(l()).optional()}),La=oe({issuer:l(),authorization_endpoint:Me,token_endpoint:Me,userinfo_endpoint:Me.optional(),jwks_uri:Me,registration_endpoint:Me.optional(),scopes_supported:I(l()).optional(),response_types_supported:I(l()),response_modes_supported:I(l()).optional(),grant_types_supported:I(l()).optional(),acr_values_supported:I(l()).optional(),subject_types_supported:I(l()),id_token_signing_alg_values_supported:I(l()),id_token_encryption_alg_values_supported:I(l()).optional(),id_token_encryption_enc_values_supported:I(l()).optional(),userinfo_signing_alg_values_supported:I(l()).optional(),userinfo_encryption_alg_values_supported:I(l()).optional(),userinfo_encryption_enc_values_supported:I(l()).optional(),request_object_signing_alg_values_supported:I(l()).optional(),request_object_encryption_alg_values_supported:I(l()).optional(),request_object_encryption_enc_values_supported:I(l()).optional(),token_endpoint_auth_methods_supported:I(l()).optional(),token_endpoint_auth_signing_alg_values_supported:I(l()).optional(),display_values_supported:I(l()).optional(),claim_types_supported:I(l()).optional(),claims_supported:I(l()).optional(),service_documentation:l().optional(),claims_locales_supported:I(l()).optional(),ui_locales_supported:I(l()).optional(),claims_parameter_supported:H().optional(),request_parameter_supported:H().optional(),request_uri_parameter_supported:H().optional(),require_request_uri_registration:H().optional(),op_policy_uri:Me.optional(),op_tos_uri:Me.optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0)}),Sl=P({...La.shape,...Ma.pick({code_challenge_methods_supported:!0}).shape}),yl=P({access_token:l(),id_token:l().optional(),token_type:l(),expires_in:Qs.number().optional(),scope:l().optional(),refresh_token:l().optional(),issuer:l().optional().catch(void 0)}).strip(),vl=P({issued_token_type:O("urn:ietf:params:oauth:token-type:id-jag"),access_token:l(),token_type:l().optional(),expires_in:L().optional(),scope:l().optional()}).strip(),bl=P({error:l(),error_description:l().optional(),error_uri:l().optional()}),Ku=Me.optional().or(O("").transform(()=>{})),Da=P({redirect_uris:I(Me),token_endpoint_auth_method:l().optional(),grant_types:I(l()).optional(),response_types:I(l()).optional(),application_type:l().optional(),client_name:l().optional(),client_uri:Me.optional(),logo_uri:Ku,scope:l().optional(),contacts:I(l()).optional(),tos_uri:Ku,policy_uri:l().optional(),jwks_uri:Me.optional(),jwks:dg().optional(),software_id:l().optional(),software_version:l().optional(),software_statement:l().optional()}).strip(),Za=P({client_id:l(),client_secret:l().optional(),client_id_issued_at:L().optional(),client_secret_expires_at:L().optional(),issuer:l().optional().catch(void 0)}).strip(),zl=Da.merge(Za),Rl=P({error:l(),error_description:l().optional()}).strip(),$l=P({token:l(),token_type_hint:l().optional()}).strip();var Tl=Symbol.for("mcp.sdk.errorBrands");function Ol(e,t){let r=new Set,o=t;for(;typeof o=="function";){let n=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof n=="string"&&r.add(n),o=Object.getPrototypeOf(o)}r.size!==0&&Object.defineProperty(e,Tl,{value:r,enumerable:!1,configurable:!0})}function so(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,Tl)){let r=t[Tl];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Fg=class Vg extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return so(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return so(this,t)}constructor(t,r,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",Ol(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new Vg(t.error,t.error_description??t.error,t.error_uri)}},me=(function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e})({}),ue=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return so(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return so(this,e)}constructor(e,t,r,o){super(t,o),this.code=e,this.data=r,this.name="SdkError",Ol(this,new.target)}},Rb=class extends ue{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,o){super(e,t,r,o),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function Ig(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function $b(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function Hg(e){switch(e.method){case"elicitation/create":return e.params?.mode==="url"?{elicitation:{url:{}}}:{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;return t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0)?{sampling:{tools:{}}}:{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function Ga(e,t){let r={};for(let[o,n]of Object.entries(e)){if(n===void 0)continue;let s=t===void 0?void 0:t[o];if(s===void 0){r[o]=n;continue}if(Ig(n)&&Ig(s)){let i={};for(let[c,a]of Object.entries(n))a!==void 0&&s[c]===void 0&&!$b(o,c,s)&&(i[c]=a);Object.keys(i).length>0&&(r[o]=i)}}return Object.keys(r).length>0?r:void 0}var wb="2026-07-28";function Un(e){return e>=wb}function Jg(e){return e.filter(t=>!Un(t))}function xl(e){return e.filter(t=>Un(t))}function Bg(e){let t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(e.content?.some(r=>r.type==="text")??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var Kg=["task","inputRequests","requestState"];function Nl(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||Kg.some(t=>t in e)?e:{...e,content:[]}}function Pb(){let e=un(()=>Y([l(),L(),H(),ur(),K(l(),e),I(e)])),t=K(l(),e),r=Y([l(),L().int()]),o=l(),n=P({ttl:L().optional()}),s=P({taskId:l()}),i=oe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),c=P({_meta:i.optional()}),a=c.extend({task:n.optional()}),u=P({method:l(),params:c.loose().optional()}),d=P({_meta:i.optional()}),p=P({method:l(),params:d.loose().optional()}),_=oe({_meta:i.optional()}),y=Y([l(),L().int()]),m=_.strict(),g=d.extend({requestId:y.optional(),reason:l().optional()}),h=p.extend({method:O("notifications/cancelled"),params:g}),f=P({src:l(),mimeType:l().optional(),sizes:I(l()).optional(),theme:te(["light","dark"]).optional()}),z=P({icons:I(f).optional()}),v=P({name:l(),title:l().optional()}),R=v.extend({...v.shape,...z.shape,version:l(),websiteUrl:l().optional(),description:l().optional()}),w=$t(P({applyDefaults:H().optional()}),t),b=lr(Fe=>Fe&&typeof Fe=="object"&&!Array.isArray(Fe)&&Object.keys(Fe).length===0?{form:{}}:Fe,$t(P({form:w.optional(),url:t.optional()}),t.optional())),S=oe({list:t.optional(),cancel:t.optional(),requests:oe({sampling:oe({createMessage:t.optional()}).optional(),elicitation:oe({create:t.optional()}).optional()}).optional()}),E=oe({list:t.optional(),cancel:t.optional(),requests:oe({tools:oe({call:t.optional()}).optional()}).optional()}),N=P({experimental:K(l(),t).optional(),sampling:P({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:P({listChanged:H().optional()}).optional(),tasks:S.optional(),extensions:K(l(),t).optional()}),V=c.extend({protocolVersion:l(),capabilities:N,clientInfo:R}),M=u.extend({method:O("initialize"),params:V}),Z=P({experimental:K(l(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:P({listChanged:H().optional()}).optional(),resources:P({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:P({listChanged:H().optional()}).optional(),tasks:E.optional(),extensions:K(l(),t).optional()}),W=_.extend({protocolVersion:l(),capabilities:Z,serverInfo:R,instructions:l().optional()}),G=p.extend({method:O("notifications/initialized"),params:d.optional()}),fe=u.extend({method:O("ping"),params:c.optional()}),$e=P({progress:L(),total:X(L()),message:X(l())}),be=P({...d.shape,...$e.shape,progressToken:r}),Oe=p.extend({method:O("notifications/progress"),params:be}),he=c.extend({cursor:o.optional()}),k=u.extend({params:he.optional()}),j=_.extend({nextCursor:o.optional()}),F=P({uri:l(),mimeType:X(l()),_meta:K(l(),Q()).optional()}),$=F.extend({text:l()}),C=l().refine(Fe=>{try{return atob(Fe),!0}catch{return!1}},{message:"Invalid Base64 string"}),x=F.extend({blob:C}),J=te(["user","assistant"]),ee=P({audience:I(J).optional(),priority:L().min(0).max(1).optional(),lastModified:wt.datetime({offset:!0}).optional()}),pe=P({...v.shape,...z.shape,uri:l(),description:X(l()),mimeType:X(l()),size:X(L()),annotations:ee.optional(),_meta:X(oe({}))}),ae=P({...v.shape,...z.shape,uriTemplate:l(),description:X(l()),mimeType:X(l()),annotations:ee.optional(),_meta:X(oe({}))}),ze=k.extend({method:O("resources/list")}),Je=j.extend({resources:I(pe)}),T=k.extend({method:O("resources/templates/list")}),A=j.extend({resourceTemplates:I(ae)}),D=c.extend({uri:l()}),se=D,ie=u.extend({method:O("resources/read"),params:se}),de=_.extend({contents:I(Y([$,x]))}),ke=p.extend({method:O("notifications/resources/list_changed"),params:d.optional()}),Ne=D,Ze=u.extend({method:O("resources/subscribe"),params:Ne}),xe=D,we=u.extend({method:O("resources/unsubscribe"),params:xe}),ot=d.extend({uri:l()}),Ae=p.extend({method:O("notifications/resources/updated"),params:ot}),ht=P({name:l(),description:X(l()),required:X(H())}),at=P({...v.shape,...z.shape,description:X(l()),arguments:X(I(ht)),_meta:X(oe({}))}),gt=k.extend({method:O("prompts/list")}),It=j.extend({prompts:I(at)}),Ot=c.extend({name:l(),arguments:K(l(),l()).optional()}),Yt=u.extend({method:O("prompts/get"),params:Ot}),Xt=P({type:O("text"),text:l(),annotations:ee.optional(),_meta:K(l(),Q()).optional()}),Qt=P({type:O("image"),data:C,mimeType:l(),annotations:ee.optional(),_meta:K(l(),Q()).optional()}),er=P({type:O("audio"),data:C,mimeType:l(),annotations:ee.optional(),_meta:K(l(),Q()).optional()}),mo=P({type:O("tool_use"),name:l(),id:l(),input:K(l(),Q()),_meta:K(l(),Q()).optional()}),xt=P({type:O("resource"),resource:Y([$,x]),annotations:ee.optional(),_meta:K(l(),Q()).optional()}),fo=pe.extend({type:O("resource_link")}),nt=Y([Xt,Qt,er,fo,xt]),vr=P({role:J,content:nt}),br=_.extend({description:l().optional(),messages:I(vr)}),tr=p.extend({method:O("notifications/prompts/list_changed"),params:d.optional()}),ho=P({title:l().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),zr=P({taskSupport:te(["required","optional","forbidden"]).optional()}),rr=P({...v.shape,...z.shape,description:l().optional(),inputSchema:P({type:O("object"),properties:K(l(),e).optional(),required:I(l()).optional()}).catchall(Q()),outputSchema:P({type:O("object"),properties:K(l(),e).optional(),required:I(l()).optional()}).catchall(Q()).optional(),annotations:ho.optional(),execution:zr.optional(),_meta:K(l(),Q()).optional()}),Rr=k.extend({method:O("tools/list")}),$r=j.extend({tools:I(rr)}),wr=_.extend({content:I(nt),structuredContent:K(l(),Q()).optional(),isError:H().optional()}),Ue=a.extend({name:l(),arguments:K(l(),Q()).optional()}),go=u.extend({method:O("tools/call"),params:Ue}),Gn=p.extend({method:O("notifications/tools/list_changed"),params:d.optional()}),Pr=te(["debug","info","notice","warning","error","critical","alert","emergency"]),_o=c.extend({level:Pr}),So=u.extend({method:O("logging/setLevel"),params:_o}),yo=d.extend({level:Pr,logger:l().optional(),data:Q()}),vo=p.extend({method:O("notifications/message"),params:yo}),bo=P({name:l().optional()}),zo=P({hints:I(bo).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),Ro=P({mode:te(["auto","required","none"]).optional()}),Wn=P({type:O("tool_result"),toolUseId:l().describe("The unique identifier for the corresponding tool call."),content:I(nt),structuredContent:P({}).loose().optional(),isError:H().optional(),_meta:K(l(),Q()).optional()}),$o=Hr("type",[Xt,Qt,er]),Nt=Hr("type",[Xt,Qt,er,mo,Wn]),wo=P({role:J,content:Y([Nt,I(Nt)]),_meta:K(l(),Q()).optional()}),Po=a.extend({messages:I(wo),modelPreferences:zo.optional(),systemPrompt:l().optional(),includeContext:te(["none","thisServer","allServers"]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:I(l()).optional(),metadata:t.optional(),tools:I(rr).optional(),toolChoice:Ro.optional()}),Eo=u.extend({method:O("sampling/createMessage"),params:Po}),To=_.extend({model:l(),stopReason:X(te(["endTurn","stopSequence","maxTokens"]).or(l())),role:J,content:$o}),Co=_.extend({model:l(),stopReason:X(te(["endTurn","stopSequence","maxTokens","toolUse"]).or(l())),role:J,content:Y([Nt,I(Nt)])}),ko=P({type:O("boolean"),title:l().optional(),description:l().optional(),default:H().optional()}),Io=P({type:O("string"),title:l().optional(),description:l().optional(),minLength:L().optional(),maxLength:L().optional(),format:te(["email","uri","date","date-time"]).optional(),default:l().optional()}),Oo=P({type:te(["number","integer"]),title:l().optional(),description:l().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),xo=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),default:l().optional()}),No=P({type:O("string"),title:l().optional(),description:l().optional(),oneOf:I(P({const:l(),title:l()})),default:l().optional()}),jo=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),enumNames:I(l()).optional(),default:l().optional()}),Ao=Y([xo,No]),or=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({type:O("string"),enum:I(l())}),default:I(l()).optional()}),nr=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({anyOf:I(P({const:l(),title:l()}))}),default:I(l()).optional()}),Yn=Y([or,nr]),Xn=Y([jo,Ao,Yn]),et=Y([Xn,ko,Io,Oo]),tt=a.extend({mode:O("form").optional(),message:l(),requestedSchema:P({type:O("object"),properties:K(l(),et),required:I(l()).optional()}).catchall(Q())}),qo=a.extend({mode:O("url"),message:l(),elicitationId:l(),url:l().url()}),ct=Y([tt,qo]),Qn=u.extend({method:O("elicitation/create"),params:ct}),es=d.extend({elicitationId:l()}),ts=p.extend({method:O("notifications/elicitation/complete"),params:es}),rs=_.extend({action:te(["accept","decline","cancel"]),content:lr(Fe=>Fe===null?void 0:Fe,K(l(),Y([l(),L(),H(),I(l())])).optional())}),os=P({type:O("ref/resource"),uri:l()}),ns=P({type:O("ref/prompt"),name:l()}),ss=c.extend({ref:Y([ns,os]),argument:P({name:l(),value:l()}),context:P({arguments:K(l(),l()).optional()}).optional()}),Mo=u.extend({method:O("completion/complete"),params:ss}),is=_.extend({completion:oe({values:I(l()).max(100),total:X(L().int()),hasMore:X(H())})}),as=P({uri:l().startsWith("file://"),name:l().optional(),_meta:K(l(),Q()).optional()}),Er=u.extend({method:O("roots/list"),params:c.optional()}),Lo=_.extend({roots:I(as)}),cs=p.extend({method:O("notifications/roots/list_changed"),params:d.optional()}),us=oe({ttl:L().optional(),pollInterval:L().optional()}),Do=te(["working","input_required","completed","failed","cancelled"]),jt=P({taskId:l(),status:Do,ttl:Y([L(),ur()]),createdAt:l(),lastUpdatedAt:l(),pollInterval:X(L()),statusMessage:X(l())}),We=_.extend({task:jt}),ls=d.merge(jt),sr=p.extend({method:O("notifications/tasks/status"),params:ls}),Tr=u.extend({method:O("tasks/get"),params:c.extend({taskId:l()})}),Cr=_.merge(jt),kr=u.extend({method:O("tasks/result"),params:c.extend({taskId:l()})}),lc=_.loose(),Be=k.extend({method:O("tasks/list")}),Ie=j.extend({tasks:I(jt)}),ir=u.extend({method:O("tasks/cancel"),params:c.extend({taskId:l()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:a,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:_,RequestIdSchema:y,EmptyResultSchema:m,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:h,IconSchema:f,IconsSchema:z,BaseMetadataSchema:v,ImplementationSchema:R,ClientTasksCapabilitySchema:S,ServerTasksCapabilitySchema:E,ClientCapabilitiesSchema:N,InitializeRequestParamsSchema:V,InitializeRequestSchema:M,ServerCapabilitiesSchema:Z,InitializeResultSchema:W,InitializedNotificationSchema:G,PingRequestSchema:fe,ProgressSchema:$e,ProgressNotificationParamsSchema:be,ProgressNotificationSchema:Oe,PaginatedRequestParamsSchema:he,PaginatedRequestSchema:k,PaginatedResultSchema:j,ResourceContentsSchema:F,TextResourceContentsSchema:$,BlobResourceContentsSchema:x,RoleSchema:J,AnnotationsSchema:ee,ResourceSchema:pe,ResourceTemplateSchema:ae,ListResourcesRequestSchema:ze,ListResourcesResultSchema:Je,ListResourceTemplatesRequestSchema:T,ListResourceTemplatesResultSchema:A,ResourceRequestParamsSchema:D,ReadResourceRequestParamsSchema:se,ReadResourceRequestSchema:ie,ReadResourceResultSchema:de,ResourceListChangedNotificationSchema:ke,SubscribeRequestParamsSchema:Ne,SubscribeRequestSchema:Ze,UnsubscribeRequestParamsSchema:xe,UnsubscribeRequestSchema:we,ResourceUpdatedNotificationParamsSchema:ot,ResourceUpdatedNotificationSchema:Ae,PromptArgumentSchema:ht,PromptSchema:at,ListPromptsRequestSchema:gt,ListPromptsResultSchema:It,GetPromptRequestParamsSchema:Ot,GetPromptRequestSchema:Yt,TextContentSchema:Xt,ImageContentSchema:Qt,AudioContentSchema:er,ToolUseContentSchema:mo,EmbeddedResourceSchema:xt,ResourceLinkSchema:fo,ContentBlockSchema:nt,PromptMessageSchema:vr,GetPromptResultSchema:br,PromptListChangedNotificationSchema:tr,ToolAnnotationsSchema:ho,ToolExecutionSchema:zr,ToolSchema:rr,ListToolsRequestSchema:Rr,ListToolsResultSchema:$r,CallToolResultSchema:wr,CallToolRequestParamsSchema:Ue,CallToolRequestSchema:go,ToolListChangedNotificationSchema:Gn,LoggingLevelSchema:Pr,SetLevelRequestParamsSchema:_o,SetLevelRequestSchema:So,LoggingMessageNotificationParamsSchema:yo,LoggingMessageNotificationSchema:vo,ModelHintSchema:bo,ModelPreferencesSchema:zo,ToolChoiceSchema:Ro,ToolResultContentSchema:Wn,SamplingContentSchema:$o,SamplingMessageContentBlockSchema:Nt,SamplingMessageSchema:wo,CreateMessageRequestParamsSchema:Po,CreateMessageRequestSchema:Eo,CreateMessageResultSchema:To,CreateMessageResultWithToolsSchema:Co,BooleanSchemaSchema:ko,StringSchemaSchema:Io,NumberSchemaSchema:Oo,UntitledSingleSelectEnumSchemaSchema:xo,TitledSingleSelectEnumSchemaSchema:No,LegacyTitledEnumSchemaSchema:jo,SingleSelectEnumSchemaSchema:Ao,UntitledMultiSelectEnumSchemaSchema:or,TitledMultiSelectEnumSchemaSchema:nr,MultiSelectEnumSchemaSchema:Yn,EnumSchemaSchema:Xn,PrimitiveSchemaDefinitionSchema:et,ElicitRequestFormParamsSchema:tt,ElicitRequestURLParamsSchema:qo,ElicitRequestParamsSchema:ct,ElicitRequestSchema:Qn,ElicitationCompleteNotificationParamsSchema:es,ElicitationCompleteNotificationSchema:ts,ElicitResultSchema:rs,ResourceTemplateReferenceSchema:os,PromptReferenceSchema:ns,CompleteRequestParamsSchema:ss,CompleteRequestSchema:Mo,CompleteResultSchema:is,RootSchema:as,ListRootsRequestSchema:Er,ListRootsResultSchema:Lo,RootsListChangedNotificationSchema:cs,TaskCreationParamsSchema:us,TaskStatusSchema:Do,TaskSchema:jt,CreateTaskResultSchema:We,TaskStatusNotificationParamsSchema:ls,TaskStatusNotificationSchema:sr,GetTaskRequestSchema:Tr,GetTaskResultSchema:Cr,GetTaskPayloadRequestSchema:kr,GetTaskPayloadResultSchema:lc,ListTasksRequestSchema:Be,ListTasksResultSchema:Ie,CancelTaskRequestSchema:ir,CancelTaskResultSchema:_.merge(jt),ClientRequestSchema:Y([fe,M,Mo,So,Yt,gt,ze,T,ie,Ze,we,go,Rr,Tr,kr,Be,ir]),ClientNotificationSchema:Y([h,Oe,G,cs,sr]),ClientResultSchema:Y([m,To,Co,rs,Lo,Cr,Ie,We]),ServerRequestSchema:Y([fe,Eo,Qn,Er,Tr,kr,Be,ir]),ServerNotificationSchema:Y([h,Oe,vo,Ae,ke,Gn,tr,sr,ts]),ServerResultSchema:Y([m,W,is,br,It,Je,A,de,wr,$r,Cr,Ie,We]),CallToolResultWireSchema:Q().superRefine((Fe,ZS)=>{if(!(typeof Fe!="object"||Fe===null||Array.isArray(Fe)||Fe.content!==void 0)){for(let zd of Kg)if(zd in Fe){ZS.addIssue({code:"custom",message:`content is required when the body carries '${zd}' \u2014 another result family cannot default into an empty tools/call success`});return}}}).transform(Nl).pipe(wr)}}var Eb;function Gg(){return Eb??=Pb()}function Wg(e){return e.type!=="object"}var Tb=new Set(["const","enum","default","examples"]),Cb=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Og(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function kb(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(Og(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Yd(e.$schema)&&e.$recursiveAnchor!==!0,o=(n,s)=>{if(Array.isArray(n))return n.map(a=>o(a,!1));if(n===null||typeof n!="object"||!s&&Og(n.$id))return n;let i={},c=!1;for(let[a,u]of Object.entries(n))s?i[a]=o(u,!1):(a==="$ref"||a==="$dynamicRef")&&typeof u=="string"?i[a]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u:a==="$recursiveRef"&&u==="#"&&r?c=!0:Tb.has(a)?i[a]=u:Cb.has(a)?i[a]=o(u,!0):i[a]=o(u,!1);return c&&("$ref"in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}]:i.$ref="#/properties/result"),i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var Yg={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},Xg={"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},Ib={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},Ua;function jl(){if(Ua)return Ua;let e=Gg();return Ua={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ua}function Qg(e){return Object.prototype.hasOwnProperty.call(Yg,e)}function e_(e){return Object.prototype.hasOwnProperty.call(Xg,e)}function Ob(e){return Object.prototype.hasOwnProperty.call(Ib,e)}function xb(e){return Ob(e)?jl().resultSchemas[e]:void 0}function Nb(e){return Qg(e)?jl().requestSchemas[e]:void 0}function jb(e){return e_(e)?jl().notificationSchemas[e]:void 0}var yP=Object.keys(Yg),vP=Object.keys(Xg);function Cl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Fa(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var xg={ok:!1,reason:"not-in-era"};function Ng(e){return Cl(e)&&Cl(e.outputSchema)&&Wg(e.outputSchema)}var Al={era:"2025-11-25",hasRequestMethod:Qg,hasNotificationMethod:e_,validateRequest:(e,t)=>Fa(Nb(e),t),validateResult:(e,t)=>Fa(xb(e),t),validateNotification:(e,t)=>Fa(jb(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>xg,validateInputResponse:()=>xg,samplingResultVariant:((e,t)=>{let r=Gg();return Fa(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=Bg(e),o=r.structuredContent;if(o===void 0)return r;let n=typeof o!="object"||o===null||Array.isArray(o),s=t!==void 0&&Wg(t);return!n&&!s?r:{...r,structuredContent:{result:o}}},decodeResult(e,t){if(Cl(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:r}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;return!Array.isArray(r)||!r.some(o=>Ng(o))?t:{...t,tools:r.map(o=>Ng(o)?{...o,outputSchema:kb(o.outputSchema)}:o)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function Ab(){let e=un(()=>Y([l(),L(),H(),ur(),K(l(),e),I(e)])),t=K(l(),e),r=Y([l(),L().int()]),o=l(),n=Y([l(),L().int()]),s=te(["user","assistant"]),i=te(["debug","info","notice","warning","error","critical","alert","emergency"]),c=l().refine(Ie=>{try{return atob(Ie),!0}catch{return!1}},{message:"Invalid Base64 string"}),a=P({ttl:L().optional()}),u=P({taskId:l()}),d=oe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=P({_meta:d.optional()}),_=p.extend({task:a.optional()}),y=P({_meta:d.optional()}),m=P({method:l(),params:y.loose().optional()}),g=P({src:l(),mimeType:l().optional(),sizes:I(l()).optional(),theme:te(["light","dark"]).optional()}),h=P({icons:I(g).optional()}),f=P({name:l(),title:l().optional()}),z=f.extend({...f.shape,...h.shape,version:l(),websiteUrl:l().optional(),description:l().optional()}),v=$t(P({applyDefaults:H().optional()}),t),R=lr(Ie=>Ie&&typeof Ie=="object"&&!Array.isArray(Ie)&&Object.keys(Ie).length===0?{form:{}}:Ie,$t(P({form:v.optional(),url:t.optional()}),t.optional())),w=oe({list:t.optional(),cancel:t.optional(),requests:oe({sampling:oe({createMessage:t.optional()}).optional(),elicitation:oe({create:t.optional()}).optional()}).optional()}),b=oe({list:t.optional(),cancel:t.optional(),requests:oe({tools:oe({call:t.optional()}).optional()}).optional()}),S=P({experimental:K(l(),t).optional(),sampling:P({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:P({listChanged:H().optional()}).optional(),tasks:w.optional(),extensions:K(l(),t).optional()}),E=P({experimental:K(l(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:P({listChanged:H().optional()}).optional(),resources:P({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:P({listChanged:H().optional()}).optional(),tasks:b.optional(),extensions:K(l(),t).optional()}),N=P({progress:L(),total:X(L()),message:X(l())}),V=P({...y.shape,...N.shape,progressToken:r}),M=m.extend({method:O("notifications/progress"),params:V}),Z=y.extend({level:i,logger:l().optional(),data:Q()}),W=m.extend({method:O("notifications/message"),params:Z}),G=P({uri:l(),mimeType:X(l()),_meta:K(l(),Q()).optional()}),fe=G.extend({text:l()}),$e=G.extend({blob:c}),be=P({audience:I(s).optional(),priority:L().min(0).max(1).optional(),lastModified:wt.datetime({offset:!0}).optional()}),Oe=P({...f.shape,...h.shape,uri:l(),description:X(l()),mimeType:X(l()),size:X(L()),annotations:be.optional(),_meta:X(oe({}))}),he=P({...f.shape,...h.shape,uriTemplate:l(),description:X(l()),mimeType:X(l()),annotations:be.optional(),_meta:X(oe({}))}),k=m.extend({method:O("notifications/resources/list_changed"),params:y.optional()}),j=y.extend({uri:l()}),F=m.extend({method:O("notifications/resources/updated"),params:j}),$=P({name:l(),description:X(l()),required:X(H())}),C=P({...f.shape,...h.shape,description:X(l()),arguments:X(I($)),_meta:X(oe({}))}),x=m.extend({method:O("notifications/prompts/list_changed"),params:y.optional()}),J=P({type:O("text"),text:l(),annotations:be.optional(),_meta:K(l(),Q()).optional()}),ee=P({type:O("image"),data:c,mimeType:l(),annotations:be.optional(),_meta:K(l(),Q()).optional()}),pe=P({type:O("audio"),data:c,mimeType:l(),annotations:be.optional(),_meta:K(l(),Q()).optional()}),ae=P({type:O("tool_use"),name:l(),id:l(),input:K(l(),Q()),_meta:K(l(),Q()).optional()}),ze=P({type:O("resource"),resource:Y([fe,$e]),annotations:be.optional(),_meta:K(l(),Q()).optional()}),Je=Oe.extend({type:O("resource_link")}),T=Y([J,ee,pe,Je,ze]),A=P({role:s,content:T}),D=P({title:l().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),se=m.extend({method:O("notifications/tools/list_changed"),params:y.optional()}),ie=P({name:l().optional()}),de=P({hints:I(ie).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),ke=P({mode:te(["auto","required","none"]).optional()}),Ne=P({type:O("boolean"),title:l().optional(),description:l().optional(),default:H().optional()}),Ze=P({type:O("string"),title:l().optional(),description:l().optional(),minLength:L().optional(),maxLength:L().optional(),format:te(["email","uri","date","date-time"]).optional(),default:l().optional()}),xe=P({type:te(["number","integer"]),title:l().optional(),description:l().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),we=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),default:l().optional()}),ot=P({type:O("string"),title:l().optional(),description:l().optional(),oneOf:I(P({const:l(),title:l()})),default:l().optional()}),Ae=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),enumNames:I(l()).optional(),default:l().optional()}),ht=Y([we,ot]),at=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({type:O("string"),enum:I(l())}),default:I(l()).optional()}),gt=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({anyOf:I(P({const:l(),title:l()}))}),default:I(l()).optional()}),It=Y([at,gt]),Ot=Y([Ae,ht,It]),Yt=Y([Ot,Ne,Ze,xe]),Xt=_.extend({mode:O("form").optional(),message:l(),requestedSchema:P({type:O("object"),properties:K(l(),Yt),required:I(l()).optional()}).catchall(Q())}),Qt=P({type:O("ref/resource"),uri:l()}),er=P({type:O("ref/prompt"),name:l()}),mo=P({uri:l().startsWith("file://"),name:l().optional(),_meta:K(l(),Q()).optional()}),xt=S.shape,fo=P({experimental:xt.experimental,sampling:xt.sampling,elicitation:xt.elicitation,roots:xt.roots,extensions:xt.extensions}),nt=E.shape,vr=P({experimental:nt.experimental,logging:nt.logging,completions:nt.completions,prompts:nt.prompts,resources:nt.resources,tools:nt.tools,extensions:nt.extensions}),br=oe({progressToken:r.optional(),[mr]:l(),[Jr]:z.optional(),[Tt]:fo,[Ut]:i.optional()}),tr=P({...f.shape,...h.shape,description:l().optional(),inputSchema:oe({$schema:l().optional(),type:O("object")}),outputSchema:oe({$schema:l().optional()}).optional(),annotations:D.optional(),_meta:K(l(),Q()).optional()}),ho=P({type:O("tool_result"),toolUseId:l(),content:I(T),structuredContent:Q().optional(),isError:H().optional(),_meta:K(l(),Q()).optional()}),zr=Y([J,ee,pe,ae,ho]),rr=P({role:s,content:Y([zr,I(zr)]),_meta:K(l(),Q()).optional()}),Rr=l(),$r=oe({[Et]:z.optional().catch(void 0)}),wr=$r.optional();function Ue(Ie){return oe({_meta:wr,resultType:Rr.default("complete"),...Ie})}let go=Ue({}),Gn=Ue({nextCursor:o.optional()}),Pr=Ue({content:I(T),structuredContent:Q().optional(),isError:H().optional()}),_o=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),tools:I(tr),nextCursor:o.optional()}),So=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),prompts:I(C),nextCursor:o.optional()}),yo=Ue({description:l().optional(),messages:I(A)}),vo=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),resources:I(Oe),nextCursor:o.optional()}),bo=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),resourceTemplates:I(he),nextCursor:o.optional()}),zo=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),contents:I(Y([fe,$e]))}),Ro=Ue({completion:P({values:I(l()).max(100),total:L().int().optional(),hasMore:H().optional()}).loose()}),Wn=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"])}),$o=Ue({ttlMs:L().int().min(0).catch(0),cacheScope:te(["public","private"]).catch("private"),supportedVersions:I(l()),capabilities:vr,instructions:l().optional()}),Nt=P({messages:I(rr),modelPreferences:de.optional(),systemPrompt:l().optional(),includeContext:te(["none","thisServer","allServers"]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:I(l()).optional(),metadata:t.optional(),tools:I(tr).optional(),toolChoice:ke.optional()}),wo=P({method:O("sampling/createMessage"),params:Nt}),Po=P({method:O("roots/list"),params:P({_meta:K(l(),Q()).optional()}).optional()}),Eo=P({...rr.shape,model:l(),stopReason:l().optional()}),To=P({roots:I(mo)}),Co=P({action:te(["accept","decline","cancel"]),content:K(l(),Y([l(),L(),H(),I(l())])).optional()}),ko=P({mode:O("url"),message:l(),url:l().url()}),Io=Y([Xt,ko]),Oo=P({method:O("elicitation/create"),params:Io}),xo=Y([wo,Po,Oo]),No=Y([Eo,To,Co]),jo=K(l(),xo),Ao=K(l(),No),or=Ue({inputRequests:jo.optional(),requestState:l().optional()}),nr={inputResponses:Ao.optional(),requestState:l().optional()},Yn=P({_meta:br,...nr}),Xn=oe({progressToken:r.optional()});function et(Ie,ir){return P({method:O(Ie),params:P({_meta:br,...ir})})}function tt(Ie,ir){return P({method:O(Ie),params:P({_meta:Xn.optional(),...ir}).optional()})}let qo={name:l(),arguments:K(l(),Q()).optional(),...nr},ct={cursor:o.optional()},Qn=et("tools/call",qo),es=et("tools/list",ct),ts=et("prompts/list",ct),rs=et("prompts/get",{name:l(),arguments:K(l(),l()).optional(),...nr}),os=et("resources/list",ct),ns=et("resources/templates/list",ct),ss=et("resources/read",{uri:l(),...nr}),Mo={ref:Y([er,Qt]),argument:P({name:l(),value:l()}),context:P({arguments:K(l(),l()).optional()}).optional()},is=et("completion/complete",Mo),as=et("server/discover",{}),Er=P({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:I(l()).optional()}),Lo={notifications:Er},cs=et("subscriptions/listen",Lo),us=$r.extend({"io.modelcontextprotocol/subscriptionId":n}),Do=oe({_meta:us,resultType:Rr.default("complete")}),jt={"tools/call":tt("tools/call",qo),"tools/list":tt("tools/list",ct),"prompts/get":tt("prompts/get",{name:l(),arguments:K(l(),l()).optional()}),"prompts/list":tt("prompts/list",ct),"resources/list":tt("resources/list",ct),"resources/templates/list":tt("resources/templates/list",ct),"resources/read":tt("resources/read",{uri:l()}),"completion/complete":tt("completion/complete",Mo),"server/discover":tt("server/discover",{}),"subscriptions/listen":tt("subscriptions/listen",Lo)};function We(Ie){return oe({_meta:wr,...Ie})}let ls={"tools/call":We({content:I(T),structuredContent:Q().optional(),isError:H().optional()}),"tools/list":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),tools:I(tr),nextCursor:o.optional()}),"prompts/get":We({description:l().optional(),messages:I(A)}),"prompts/list":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),prompts:I(C),nextCursor:o.optional()}),"resources/list":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),resources:I(Oe),nextCursor:o.optional()}),"resources/templates/list":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),resourceTemplates:I(he),nextCursor:o.optional()}),"resources/read":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),contents:I(Y([fe,$e]))}),"completion/complete":We({completion:P({values:I(l()).max(100),total:L().int().optional(),hasMore:H().optional()}).loose()}),"server/discover":We({ttlMs:L().int().min(0).catch(0),cacheScope:te(["public","private"]).catch("private"),supportedVersions:I(l()),capabilities:vr,instructions:l().optional()}),"subscriptions/listen":We({})},sr=oe({"io.modelcontextprotocol/subscriptionId":n.optional()}),Tr=P({method:O("notifications/subscriptions/acknowledged"),params:P({_meta:sr.optional(),notifications:Er})}),Cr=P({_meta:sr.optional(),requestId:n,reason:l().optional()}),kr=P({method:O("notifications/cancelled"),params:Cr}),lc={"notifications/cancelled":kr,"notifications/progress":M,"notifications/message":W,"notifications/resources/updated":F,"notifications/resources/list_changed":k,"notifications/tools/list_changed":se,"notifications/prompts/list_changed":x,"notifications/subscriptions/acknowledged":Tr},Be=Ie=>P({jsonrpc:O("2.0"),id:Y([l(),L().int()]),result:Ie}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:a,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:_,NotificationsParamsSchema:y,NotificationSchema:m,IconSchema:g,IconsSchema:h,BaseMetadataSchema:f,ImplementationSchema:z,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:b,ClientCapabilitiesSchema:S,ServerCapabilitiesSchema:E,ProgressSchema:N,ProgressNotificationParamsSchema:V,ProgressNotificationSchema:M,LoggingMessageNotificationParamsSchema:Z,LoggingMessageNotificationSchema:W,ResourceContentsSchema:G,TextResourceContentsSchema:fe,BlobResourceContentsSchema:$e,AnnotationsSchema:be,ResourceSchema:Oe,ResourceTemplateSchema:he,ResourceListChangedNotificationSchema:k,ResourceUpdatedNotificationParamsSchema:j,ResourceUpdatedNotificationSchema:F,PromptArgumentSchema:$,PromptSchema:C,PromptListChangedNotificationSchema:x,TextContentSchema:J,ImageContentSchema:ee,AudioContentSchema:pe,ToolUseContentSchema:ae,EmbeddedResourceSchema:ze,ResourceLinkSchema:Je,ContentBlockSchema:T,PromptMessageSchema:A,ToolAnnotationsSchema:D,ToolListChangedNotificationSchema:se,ModelHintSchema:ie,ModelPreferencesSchema:de,ToolChoiceSchema:ke,BooleanSchemaSchema:Ne,StringSchemaSchema:Ze,NumberSchemaSchema:xe,UntitledSingleSelectEnumSchemaSchema:we,TitledSingleSelectEnumSchemaSchema:ot,LegacyTitledEnumSchemaSchema:Ae,SingleSelectEnumSchemaSchema:ht,UntitledMultiSelectEnumSchemaSchema:at,TitledMultiSelectEnumSchemaSchema:gt,MultiSelectEnumSchemaSchema:It,EnumSchemaSchema:Ot,PrimitiveSchemaDefinitionSchema:Yt,ElicitRequestFormParamsSchema:Xt,ResourceTemplateReferenceSchema:Qt,PromptReferenceSchema:er,RootSchema:mo,ClientCapabilities2026Schema:fo,ServerCapabilities2026Schema:vr,RequestMetaEnvelopeSchema:br,ToolSchema:tr,ToolResultContentSchema:ho,SamplingMessageContentBlockSchema:zr,SamplingMessageSchema:rr,ResultTypeSchema:Rr,ResultMetaSchema:$r,ResultSchema:go,PaginatedResultSchema:Gn,CallToolResultSchema:Pr,ListToolsResultSchema:_o,ListPromptsResultSchema:So,GetPromptResultSchema:yo,ListResourcesResultSchema:vo,ListResourceTemplatesResultSchema:bo,ReadResourceResultSchema:zo,CompleteResultSchema:Ro,CacheableResultSchema:Wn,DiscoverResultSchema:$o,CreateMessageRequestParamsSchema:Nt,CreateMessageRequestSchema:wo,ListRootsRequestSchema:Po,CreateMessageResultSchema:Eo,ListRootsResultSchema:To,ElicitResultSchema:Co,ElicitRequestURLParamsSchema:ko,ElicitRequestParamsSchema:Io,ElicitRequestSchema:Oo,InputRequestSchema:xo,InputResponseSchema:No,InputRequestsSchema:jo,InputResponsesSchema:Ao,InputRequiredResultSchema:or,InputResponseRequestParamsSchema:Yn,CallToolRequestSchema:Qn,ListToolsRequestSchema:es,ListPromptsRequestSchema:ts,GetPromptRequestSchema:rs,ListResourcesRequestSchema:os,ListResourceTemplatesRequestSchema:ns,ReadResourceRequestSchema:ss,CompleteRequestSchema:is,DiscoverRequestSchema:as,SubscriptionFilterSchema:Er,SubscriptionsListenRequestSchema:cs,SubscriptionsListenResultMetaSchema:us,SubscriptionsListenResultSchema:Do,dispatchRequestSchemas:jt,dispatchResultSchemas:ls,NotificationMetaSchema:sr,SubscriptionsAcknowledgedNotificationSchema:Tr,CancelledNotificationParamsSchema:Cr,CancelledNotificationSchema:kr,notificationSchemas2026:lc,JSONRPCResultResponseSchema:Be(go),CallToolResultResponseSchema:Be(Y([Pr,or])),ListToolsResultResponseSchema:Be(_o),ListPromptsResultResponseSchema:Be(So),GetPromptResultResponseSchema:Be(Y([yo,or])),ListResourcesResultResponseSchema:Be(vo),ListResourceTemplatesResultResponseSchema:Be(bo),ReadResourceResultResponseSchema:Be(Y([zo,or])),CompleteResultResponseSchema:Be(Ro),DiscoverResultResponseSchema:Be($o),SubscriptionsListenResultResponseSchema:Be(Do)}}var qb;function Wt(){return qb??=Ab()}var Mb=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function Lb(e){return Mb.includes(e)}var no=Symbol("modelcontextprotocol.resultCacheHintFallback");function Wa(e,t){if(t===void 0)return e;let r=e[no];if(r===void 0)return{...e,[no]:t};let o={},n=r.ttlMs??t.ttlMs;n!==void 0&&(o.ttlMs=n);let s=r.cacheScope??t.cacheScope;return s!==void 0&&(o.cacheScope=s),{...e,[no]:o}}function Db(e){return e[no]}function ql(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Ml(e){return e==="public"||e==="private"}function Ll(e,t){if(e.ttlMs!==void 0&&!ql(e.ttlMs))throw new RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!Ml(e.cacheScope))throw new RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var B=(function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e})({}),ne=class t_ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return so(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return so(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",Ol(this,new.target)}static fromError(t,r,o){if(t===B.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new r_(n.elicitations,r)}if(t===B.UnsupportedProtocolVersion&&o){let n=o;if(Array.isArray(n.supported)&&typeof n.requested=="string")return new Dl({supported:n.supported,requested:n.requested},r)}if(t===B.InvalidParams||t===B.ResourceNotFound){let n=o;if(typeof n?.uri=="string"&&(t===B.ResourceNotFound||Object.keys(n).length===1))return new Ya(n.uri,r)}if(t===B.MissingRequiredClientCapability&&o){let n=o;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities=="object"&&!Array.isArray(n.requiredCapabilities))return new Xa({requiredCapabilities:n.requiredCapabilities},r)}return new t_(t,r,o)}},Ya=class extends ne{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(B.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},r_=class extends ne{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(B.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Dl=class extends ne{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(B.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Xa=class extends ne{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(B.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Zb=0,Ub="private",Fb=["tools/call","prompts/get","resources/read"];function Vb(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete"||Fb.includes(e))return t;throw new ne(B.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Hb(e,t){let r=Db(t);if(t.resultType!=="complete"||!Lb(e))return r===void 0?t:Wb(t);let o=t,n=ql(o.ttlMs)?o.ttlMs:Kb(r),s=Ml(o.cacheScope)?o.cacheScope:Gb(r),i={...o,ttlMs:n,cacheScope:s};return delete i[no],i}function Jb(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Bb(e,t){if(t===void 0)return e;let r=e._meta;return r===void 0?{...e,_meta:{[Et]:t}}:!Jb(r)||r[Et]!==void 0?e:{...e,_meta:{...r,[Et]:t}}}function Kb(e){return e!==void 0&&ql(e.ttlMs)?e.ttlMs:Zb}function Gb(e){return e!==void 0&&Ml(e.cacheScope)?e.cacheScope:Ub}function Wb(e){let t={...e};return delete t[no],t}var Yb=["elicitation/create","sampling/createMessage","roots/list"],Va;function o_(){if(Va)return Va;let e=Wt();return Va={request:{"elicitation/create":P({method:O("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":P({method:O("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":P({method:O("roots/list"),params:oe({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Va}function n_(e){return Yb.includes(e)}function wl(e){return n_(e)?o_().request[e]:void 0}function Xb(e){return n_(e)?o_().response[e]:void 0}var Zl={"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},s_={"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};function i_(e){return Object.prototype.hasOwnProperty.call(Zl,e)}function a_(e){return Object.prototype.hasOwnProperty.call(s_,e)}function Qb(e){return Object.prototype.hasOwnProperty.call(Zl,e)}function ez(e){return i_(e)?Wt().dispatchRequestSchemas[e]:void 0}function tz(e){return Qb(e)?Wt().dispatchResultSchemas[e]:void 0}function rz(e){return a_(e)?Wt().notificationSchemas2026[e]:void 0}var bP=Object.keys(Zl),zP=Object.keys(s_);function Ln(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function qn(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var oz={ok:!1,reason:"not-in-era"},nz=[mr,Tt];function sz(e,t){let r=t,o=!1,n=()=>(o||(r={...r},o=!0),r),s=t.tools;e==="tools/list"&&Array.isArray(s)&&s.some(c=>Ln(c)&&"execution"in c)&&(n().tools=s.map(c=>{if(!Ln(c)||!("execution"in c))return c;let a={...c};return delete a.execution,a}));let i=t.capabilities;if(Ln(i)&&"tasks"in i){let c={...i};delete c.tasks,n().capabilities=c}return r}var Ul={era:"2026-07-28",hasRequestMethod:i_,hasNotificationMethod:a_,hasInputRequestMethod:e=>wl(e)!==void 0,validateRequest:(e,t)=>qn(ez(e),t),validateResult:(e,t)=>qn(tz(e),t),validateNotification:(e,t)=>qn(rz(e),t),validateInputRequest:(e,t)=>qn(wl(e),t),validateInputResponse:(e,t)=>qn(Xb(e),t),samplingResultVariant:()=>oz,outboundEnvelope(e){return{[mr]:e.protocolVersion,[Jr]:e.clientInfo,[Tt]:e.clientCapabilities,...e.logLevel!==void 0&&{[Ut]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of nz)o in e||t.push({key:o,problem:"missing"});let r=Wt().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let n=o.path.map(String),s=n.length>0?n.join("."):"_meta";n.length===1&&t.some(i=>i.key===s&&i.problem==="missing")||t.push({key:s,problem:o.message})}return t},projectCallToolResult:e=>Bg(e),inputRequestSchema:wl,decodeResult(e,t){if(!Ln(t))return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: 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:e,violation:"missing-resultType"})};if(typeof r!="string")return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,c=Ln(i)?i:{},a=t.requestState,u=t._meta===void 0?void 0:Wt().ResultMetaSchema.safeParse(t._meta),d=u?.success?u.data:void 0;return Object.keys(c).length===0&&typeof a!="string"?{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:c,...typeof a=="string"&&{requestState:a},...d!==void 0&&{_meta:d}}}if(r!=="complete")return{kind:"invalid",error:new ue(me.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=iz(),n=Object.hasOwn(o,e)?o[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return Bb(Hb(e,Vb(e,sz(e,t))),r)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=Wt().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(r=>r.message).join("; ")}`}},Ha;function iz(){if(Ha)return Ha;let e=Wt();return Ha={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Ha}var Fl="2026-07-28";function io(e){return e!==void 0&&Un(e)?Ul:Al}function jg(e){return e.revision!==void 0?io(e.revision).era:e.era==="modern"?Ul.era:Al.era}function Pl(e){return c_.some(t=>t.hasRequestMethod(e))}function El(e){return c_.some(t=>t.hasNotificationMethod(e))}function Ag(e){return e==="tasks/get"||e==="tasks/cancel"}var c_=[Al,Ul];var az=Gd({AnnotationsSchema:()=>Ct,AudioContentSchema:()=>Qr,BaseMetadataSchema:()=>Pt,BaseRequestParamsSchema:()=>Le,BlobResourceContentsSchema:()=>wn,BooleanSchemaSchema:()=>kn,CallToolRequestParamsSchema:()=>ta,CallToolRequestSchema:()=>ra,CallToolResultSchema:()=>Cn,CancelTaskRequestSchema:()=>ul,CancelTaskResultSchema:()=>ll,CancelledNotificationParamsSchema:()=>ni,CancelledNotificationSchema:()=>yn,ClientCapabilitiesSchema:()=>ci,ClientNotificationSchema:()=>pl,ClientRequestSchema:()=>dl,ClientResultSchema:()=>ml,ClientTasksCapabilitySchema:()=>ii,CompatibilityCallToolResultSchema:()=>Xu,CompleteRequestParamsSchema:()=>Ca,CompleteRequestSchema:()=>ka,CompleteResultSchema:()=>Ia,ContentBlockSchema:()=>eo,CreateMessageRequestParamsSchema:()=>fa,CreateMessageRequestSchema:()=>ha,CreateMessageResultSchema:()=>ga,CreateMessageResultWithToolsSchema:()=>_a,CreateTaskResultSchema:()=>tl,CursorSchema:()=>pn,DiscoverRequestSchema:()=>mi,DiscoverResultSchema:()=>fi,ElicitRequestFormParamsSchema:()=>oo,ElicitRequestParamsSchema:()=>za,ElicitRequestSchema:()=>Ra,ElicitRequestURLParamsSchema:()=>ba,ElicitResultSchema:()=>Pa,ElicitationCompleteNotificationParamsSchema:()=>$a,ElicitationCompleteNotificationSchema:()=>wa,EmbeddedResourceSchema:()=>Ji,EmptyResultSchema:()=>Sn,EnumSchemaSchema:()=>va,GetPromptRequestParamsSchema:()=>Fi,GetPromptRequestSchema:()=>Vi,GetPromptResultSchema:()=>Gi,GetTaskPayloadRequestSchema:()=>sl,GetTaskPayloadResultSchema:()=>il,GetTaskRequestSchema:()=>ol,GetTaskResultSchema:()=>nl,IconSchema:()=>si,IconsSchema:()=>Vt,ImageContentSchema:()=>Xr,ImplementationSchema:()=>Gr,InitializeRequestParamsSchema:()=>ui,InitializeRequestSchema:()=>li,InitializeResultSchema:()=>di,InitializedNotificationSchema:()=>pi,JSONArraySchema:()=>Gu,JSONObjectSchema:()=>Ee,JSONRPCErrorResponseSchema:()=>Kr,JSONRPCMessageSchema:()=>_n,JSONRPCNotificationSchema:()=>gn,JSONRPCRequestSchema:()=>hn,JSONRPCResponseSchema:()=>Wu,JSONRPCResultResponseSchema:()=>Br,JSONValueSchema:()=>Zt,LegacyTitledEnumSchemaSchema:()=>xn,ListChangedOptionsBaseSchema:()=>Qu,ListPromptsRequestSchema:()=>Zi,ListPromptsResultSchema:()=>Ui,ListResourceTemplatesRequestSchema:()=>bi,ListResourceTemplatesResultSchema:()=>zi,ListResourcesRequestSchema:()=>yi,ListResourcesResultSchema:()=>vi,ListRootsRequestSchema:()=>xa,ListRootsResultSchema:()=>Na,ListTasksRequestSchema:()=>al,ListTasksResultSchema:()=>cl,ListToolsRequestSchema:()=>Qi,ListToolsResultSchema:()=>ea,LoggingLevelSchema:()=>Kt,LoggingMessageNotificationParamsSchema:()=>ia,LoggingMessageNotificationSchema:()=>aa,ModelHintSchema:()=>ca,ModelPreferencesSchema:()=>ua,MultiSelectEnumSchemaSchema:()=>ya,NotificationSchema:()=>He,NotificationsParamsSchema:()=>Ve,NumberSchemaSchema:()=>ro,PaginatedRequestParamsSchema:()=>_i,PaginatedRequestSchema:()=>Ht,PaginatedResultSchema:()=>Jt,PingRequestSchema:()=>bn,PrimitiveSchemaDefinitionSchema:()=>An,ProgressNotificationParamsSchema:()=>gi,ProgressNotificationSchema:()=>zn,ProgressSchema:()=>hi,ProgressTokenSchema:()=>dn,PromptArgumentSchema:()=>Li,PromptListChangedNotificationSchema:()=>Wi,PromptMessageSchema:()=>Ki,PromptReferenceSchema:()=>Ta,PromptSchema:()=>Di,ReadResourceRequestParamsSchema:()=>Ri,ReadResourceRequestSchema:()=>$i,ReadResourceResultSchema:()=>wi,RelatedTaskMetadataSchema:()=>oi,RequestIdSchema:()=>Ft,RequestMetaSchema:()=>mn,RequestSchema:()=>Te,ResourceContentsSchema:()=>Rn,ResourceLinkSchema:()=>Bi,ResourceListChangedNotificationSchema:()=>Pi,ResourceRequestParamsSchema:()=>Wr,ResourceSchema:()=>Pn,ResourceTemplateReferenceSchema:()=>Ea,ResourceTemplateSchema:()=>Si,ResourceUpdatedNotificationParamsSchema:()=>qi,ResourceUpdatedNotificationSchema:()=>Mi,ResultMetaObjectSchema:()=>fn,ResultSchema:()=>Ce,RoleSchema:()=>Bt,RootSchema:()=>Oa,RootsListChangedNotificationSchema:()=>ja,SamplingContentSchema:()=>pa,SamplingMessageContentBlockSchema:()=>dr,SamplingMessageSchema:()=>ma,ServerCapabilitiesSchema:()=>vn,ServerNotificationSchema:()=>hl,ServerRequestSchema:()=>fl,ServerResultSchema:()=>gl,ServerTasksCapabilitySchema:()=>ai,SetLevelRequestParamsSchema:()=>na,SetLevelRequestSchema:()=>sa,SingleSelectEnumSchemaSchema:()=>Sa,StringSchemaSchema:()=>to,SubscribeRequestParamsSchema:()=>Ei,SubscribeRequestSchema:()=>Ti,SubscriptionFilterSchema:()=>En,SubscriptionsAcknowledgedNotificationParamsSchema:()=>xi,SubscriptionsAcknowledgedNotificationSchema:()=>Ni,SubscriptionsListenRequestParamsSchema:()=>Ii,SubscriptionsListenRequestSchema:()=>Oi,SubscriptionsListenResultMetaSchema:()=>ji,SubscriptionsListenResultSchema:()=>Ai,TaskAugmentedRequestParamsSchema:()=>hr,TaskCreationParamsSchema:()=>el,TaskMetadataSchema:()=>ri,TaskSchema:()=>Gt,TaskStatusNotificationParamsSchema:()=>qa,TaskStatusNotificationSchema:()=>rl,TaskStatusSchema:()=>Aa,TextContentSchema:()=>Yr,TextResourceContentsSchema:()=>$n,TitledMultiSelectEnumSchemaSchema:()=>jn,TitledSingleSelectEnumSchemaSchema:()=>On,ToolAnnotationsSchema:()=>Yi,ToolChoiceSchema:()=>la,ToolExecutionSchema:()=>Xi,ToolListChangedNotificationSchema:()=>oa,ToolResultContentSchema:()=>da,ToolSchema:()=>Tn,ToolUseContentSchema:()=>Hi,UnsubscribeRequestParamsSchema:()=>Ci,UnsubscribeRequestSchema:()=>ki,UntitledMultiSelectEnumSchemaSchema:()=>Nn,UntitledSingleSelectEnumSchemaSchema:()=>In});var Vl=e=>hn.safeParse(e).success,Hl=e=>gn.safeParse(e).success,Ka=e=>Br.safeParse(e).success,Jl=e=>Kr.safeParse(e).success;var kt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";function Bl(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Kl(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var qg="x-mcp-header",cz=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,uz=new Set(["string","integer","boolean","number"]);function Gl(e){let t=[],r=new Map,o=(s,i,c)=>{if(s===null||typeof s!="object")return;let a=s;if(qg in a){if(!c||i.length===0)return`${Ja(i)}: 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 d=a[qg];if(typeof d!="string"||d.length===0)return`${Ja(i)}: x-mcp-header MUST be a non-empty string`;if(!cz.test(d))return`${Ja(i)}: x-mcp-header '${d}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let p=typeof a.type=="string"?a.type:void 0;if(p===void 0||!uz.has(p))return`${Ja(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${p??"<none>"}`;let _=d.toLowerCase(),y=r.get(_);if(y!==void 0)return`x-mcp-header '${d}' is not case-insensitively unique (also declared as '${y}')`;r.set(_,d),t.push({path:i,headerName:d,type:p})}let u=a.properties;if(u!==null&&typeof u=="object")for(let[d,p]of Object.entries(u)){let _=o(p,[...i,d],c);if(_!==void 0)return _}for(let d of lz){let p=a[d];if(p===void 0)continue;let _=Array.isArray(p)?p:p!==null&&typeof p=="object"&&dz.has(d)?Object.values(p):[p];for(let y of _){let m=o(y,[...i,`<${d}>`],!1);if(m!==void 0)return m}}},n=o(e,[],!0);return n===void 0?{valid:!0,declarations:t}:{valid:!1,reason:n}}var lz=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],dz=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Ja(e){return e.length===0?"<root>":e.join(".")}var Ba=-32020,RP=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32e3],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:[B.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:[Ba,B.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:[B.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:[B.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:[B.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:[Ba],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `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 spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. 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 \u2014 including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. 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:[B.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:[Ba],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."}],pz={[B.ParseError]:400,[B.InvalidRequest]:400,[B.MethodNotFound]:404,[B.UnsupportedProtocolVersion]:400,[B.MissingRequiredClientCapability]:400,[Ba]:400};function Qa(e,t){return Ks(e,t)}function Mn(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function ao(e){if(e==null)return!1;let t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof e["~standard"]?.validate=="function"}var Mg=!1,kl="draft-2020-12";function _r(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:kl});else if(r.vendor==="zod"){if(!("_zod"in e))throw new 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().");Mg||(Mg=!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.")),o=Js(e,{target:kl,io:t})}else throw new Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return o.type!==void 0?o:u_(o)?{type:"object",...o}:o;if(o.type!==void 0&&o.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}function u_(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every(o=>o!==null&&typeof o=="object"&&(o.type==="object"||u_(o)))}return!1}function mz(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function gr(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(o=>mz(o)).join(", ")}:{success:!0,data:r.value}}function fz(e){let t=Js(e,{target:kl,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var hz=/\\\.\\d\{(\d+)\}/;function gz(e){let t=hz.exec(e),r=[void 0,-1,0];return t&&r.push(Number(t[1])),[!1,!0].flatMap(o=>[!1,!0].flatMap(n=>r.map(s=>wt.datetime({local:o,offset:n,precision:s}))))}function _z(e,t){let r;switch(e){case"email":r=[cg()];break;case"uri":r=[Ys()];break;case"date":r=[wt.date()];break;case"date-time":r=gz(t);break}return new Set(r.map(o=>fz(o)).filter(o=>o!==void 0))}function Sz(e,t,r){return r!=="zod"?!0:_z(e,t).has(t)}function l_(e){let t=_r(e,"input"),r=t.properties||{},o=t.required||[];return Object.entries(r).map(([n,s])=>({name:n,description:s?.description,required:o.includes(n)}))}function Zn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function yz(e){try{return _r(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new ne(B.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var vz=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Wl(e){return vz.has(e)||e.startsWith("x-")}var bz=new Set(["$schema",...Object.keys(oo.shape.requestedSchema.shape)]),Lg={string:Mn([to,In,On,xn]),number:Mn([ro]),integer:Mn([ro]),boolean:Mn([kn]),array:Mn([Nn,jn])},zz=new Set(to.shape.format.unwrap().options);function Rz(e,t,r,o){if(!Zn(e))return e;let n=typeof e.type=="string"&&Object.hasOwn(Lg,e.type)?Lg[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,c]of Object.entries(e))n.has(i)||Wl(i)?s[i]=c:i==="pattern"&&e.type==="string"&&typeof e.format=="string"?zz.has(e.format)?(typeof c!="string"||!Sz(e.format,c,r))&&o.push(`${t}.${i}`):s[i]=c:o.push(`${t}.${i}`);return s}function $z(e,t){let r={},o=[];for(let[n,s]of Object.entries(e))n==="properties"&&Zn(s)?r[n]=Object.fromEntries(Object.entries(s).map(([i,c])=>[i,Rz(c,`properties.${i}`,t,o)])):bz.has(n)?r[n]=s:Wl(n)||o.push(n);if(o.length>0)throw new ne(B.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function wz(e,t){if(!Zn(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!Qa(An,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function Il(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((o,n)=>Il(o,t[n],`${r}[${n}]`)):!Zn(e)||!Zn(t)?[]:Object.entries(e).flatMap(([o,n])=>{let s=r?`${r}.${o}`:o;return Object.prototype.hasOwnProperty.call(t,o)?Il(n,t[o],s):Wl(o)?[]:[s]})}function Pz(e){if(!ao(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=$z(yz(e.requestedSchema),t),o=Qa(oo.shape.requestedSchema,r);if(!o.success)throw new ne(B.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${wz(r,o.error.message)}`);let n=Il(r,o.data);if(n.length>0)throw new ne(B.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(o.data.required??[]).filter(i=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(s.length>0)throw new ne(B.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function Ez(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState=="string";if(!t&&!r)throw new 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",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var Tz=Object.assign(Ez,{elicit(e){try{return{method:"elicitation/create",params:Pz(e)}}catch(t){throw t instanceof ne?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var d_=250;function p_(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function m_(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof ue?t.reason:new ue(me.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(n),o(t?.reason instanceof ue?t.reason:new ue(me.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function f_(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:o=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}var Cz=["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"],kz={IdJagTokenExchangeResponseSchema:vl,OAuthClientInformationFullSchema:zl,OAuthClientInformationSchema:Za,OAuthClientMetadataSchema:Da,OAuthClientRegistrationErrorSchema:Rl,OAuthErrorResponseSchema:bl,OAuthMetadataSchema:Ma,OAuthProtectedResourceMetadataSchema:_l,OAuthTokenRevocationRequestSchema:$l,OAuthTokensSchema:yl,OpenIdProviderDiscoveryMetadataSchema:Sl,OpenIdProviderMetadataSchema:La},h_={},g_={};function __(e,t){let r=e.slice(0,-6);h_[r]=t,g_[r]=o=>t.safeParse(o).success}for(let e of Cz)__(e,az[e]);for(let[e,t]of Object.entries(kz))__(e,t);var Iz=Object.freeze(h_),Oz=Object.freeze(g_);function xz(e){switch(e){case"initialize":case"notifications/initialized":return io(void 0);case"server/discover":return io(Fl);default:return}}var S_=6e4,Nz=[mr,Jr,Tt,Ut],jz=["inputResponses","requestState"];function Dg(e,t){let r=e.params;if(!Dn(r))return{message:e,lifted:{}};let o=r._meta,n=Dn(o)?Nz.filter(a=>a in o):[],s=t==="request"?jz.filter(a=>a in r):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},c={...r};if(n.length>0&&Dn(o)){let a={},u={...o};for(let d of n)a[d]=o[d],delete u[d];i.envelope=a,Object.keys(u).length>0?c._meta=u:delete c._meta}for(let a of s)a==="inputResponses"&&(i.inputResponses=c[a]),a==="requestState"&&(i.requestState=c[a]),delete c[a];return{message:{...e,params:c},lifted:i}}function Zg(e,t){let r=e.validateResult(t,void 0);if(!(!r.ok&&r.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let n=e.validateResult(t,o);return n.ok?{value:n.value}:{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function Fn(e){return()=>e}var Az=Fn(void 0);function Yl(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:Fn(t)}}}var qz;var Xl=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{qz=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??ei,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new ue(me.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ue(me.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=n=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{o?.(n,s),Ka(n)||Jl(n)?this._onresponse(n):Vl(n)?this._onrequest(n,s):Hl(n)?this._onnotification(n,s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new ue(me.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=Dg(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=jg(t.classification);if(i!==o.era){this._onerror(new Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(El(r.method)&&!o.hasNotificationMethod(r.method))return;let n=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;n===void 0&&s===void 0||Promise.resolve().then(()=>n===void 0?s(r):n(r,o)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=Dg(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(g,h,f)=>{let z={jsonrpc:"2.0",id:r.id,error:{code:g,message:h,...f!==void 0&&{data:f}}};s?.send(z).catch(v=>this._onerror(new Error(`Failed to send an error response: ${v}`)))};if(t?.classification!==void 0){let g=jg(t.classification);if(g!==n.era){this._onerror(new Error(`Era mismatch on inbound request '${r.method}': classified as ${g} but this instance serves ${n.era}`));let h=t.classification.revision??g;i(B.UnsupportedProtocolVersion,`Unsupported protocol version: ${h}`,{supported:this._supportedProtocolVersions,requested:h});return}}if(Pl(r.method)&&!n.hasRequestMethod(r.method)&&!(Ag(r.method)&&this._customSchemaRequestMethods.has(r.method))){i(B.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(c===void 0){i(B.MethodNotFound,"Method not found");return}let a=n.checkInboundEnvelope(o);if(a!==void 0){i(B.InvalidParams,a);return}let u=(g,h)=>this._notificationViaCodec(this._resolveOutboundCodec(g.method),g,{...h,relatedRequestId:r.id}),d=(g,h,f)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(g.method),g,h,{...f,relatedRequestId:r.id}),p=new AbortController;this._requestHandlerAbortControllers.set(r.id,p);let _=o.inputResponses===void 0?void 0:Mz(o.inputResponses),y={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},..._!==void 0&&{inputResponses:_.accepted},..._!==void 0&&_.droppedKeys.length>0&&{droppedInputResponseKeys:_.droppedKeys},requestState:o.requestState===void 0?Az:Fn(o.requestState),signal:p.signal,send:((g,h,f)=>{let z=this._resolveOutboundCodec(g.method);if(this._assertOutboundRequestInEra(z,g.method),ao(h))return d(g,h,f);let v=Zg(z,g.method);if(v===void 0)throw new TypeError(`'${g.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(g,v,h)}),notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(y,t);Promise.resolve().then(()=>c(r,m)).then(async g=>{if(p.signal.aborted)return;let h;try{h=n.encodeResult(r.method,g,this._outboundServerInfo())}catch(z){this._onerror(new Error(`Failed to encode result for ${r.method}: ${z}`)),i(B.InternalError,"Internal error");return}let f={result:h,jsonrpc:"2.0",id:r.id};await s?.send(f)},async g=>{if(p.signal.aborted)return;let h=Number.isSafeInteger(g.code)?g.code:B.InternalError,f={jsonrpc:"2.0",id:r.id,error:{code:n.encodeErrorCode(h),message:g.message??"Internal error",...g.data!==void 0&&{data:g.data}}};await s?.send(f)}).catch(g=>this._onerror(new Error(`Failed to send response: ${g}`))).finally(()=>{this._requestHandlerAbortControllers.get(r.id)===p&&this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ka(e)?r(e):r(ne.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(ao(t))return Ag(e.method)||this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r);this._assertOutboundRequestInEra(o,e.method);let n=Zg(o,e.method);if(n===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,n,t)}_negotiatedWireCodec(){return io(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=xz(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Pl(t)&&!e.hasRequestMethod(t))throw new ue(me.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c}=o??{},a=Date.now(),u,d;return new Promise((p,_)=>{let y=b=>{_(b)};if(!this._transport){y(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(b){y(b);return}if(o?.signal?.aborted){let b=o.signal.reason;throw b instanceof ue?b:new ue(me.RequestTimeout,String(b))}let m=e.era===Fl&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,g=this._requestMessageId++;d=g;let h={...t,jsonrpc:"2.0",id:g};o?.onprogress&&(this._progressHandlers.set(g,o.onprogress),h.params={...t.params,_meta:{...t.params?._meta,progressToken:g}});let f=this._envelopeOutbound(h),z=!1,v=b=>{z||(this._progressHandlers.delete(g),m===void 0?t.method!=="initialize"&&this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(b)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`))):m.abort(),_(b instanceof ue?b:new ue(me.RequestTimeout,String(b))))};this._responseHandlers.set(g,b=>{if(o?.signal?.aborted)return;if(z=!0,b instanceof Error)return _(b);let S;try{S=e.decodeResult(t.method,b.result)}catch(N){return _(N instanceof Error?N:new Error(String(N)))}if(S.kind==="invalid")return _(S.error);if(S.kind==="input_required"){if(o?.allowInputRequired===!0)return p(Lz(S));let N={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:a,retry:(V,M)=>this._requestWithSchemaViaCodec(e,V===void 0?{method:t.method}:{method:t.method,params:V},r,M)};return p(this._resolveNonCompleteResult(S,N))}let E=S.result;gr(r,E).then(N=>{N.success?p(N.data):_(new ue(me.InvalidResult,`Invalid result for ${t.method}: ${N.error}`))},_)}),u=()=>v(o?.signal?.reason),o?.signal?.addEventListener("abort",u,{once:!0});let R=o?.timeout??S_,w=()=>v(new ue(me.RequestTimeout,"Request timed out",{timeout:R}));this._setupTimeout(g,R,o?.maxTotalTimeout,w,o?.resetTimeoutOnProgress??!1),this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c,requestSignal:m?.signal}).catch(b=>{this._progressHandlers.delete(g),_(b)})}).finally(()=>{u&&o?.signal?.removeEventListener("abort",u),d!==void 0&&(this._responseHandlers.delete(d),this._cleanupTimeout(d))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new ue(me.NotConnected,"Not connected");if(El(t.method)&&!e.hasNotificationMethod(t.method))throw new ue(me.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(o,r).catch(n=>this._onerror(n))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t=="function"){if(!Pl(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(n,s)=>{let i=this._negotiatedWireCodec(),c=i.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era"&&(c=i.validateInputRequest(e,n)),!c.ok)throw c.reason==="not-in-era"?new ne(B.InternalError,`No wire schema for ${e} in the resolved era`):new Error(c.message);return Promise.resolve(t(c.value,s))}}else if(r)o=async(n,s)=>{let i=await gr(t.params,{...n.params});if(!i.success)throw new ne(B.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};else throw new TypeError("setRequestHandler: handler is required");typeof t=="function"?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t=="function"){if(!El(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,n)=>{let s=n.validateNotification(e,o);if(!s.ok)throw s.reason==="not-in-era"?new ne(B.InternalError,`No wire schema for ${e} in the resolved era`):new Error(s.message);return Promise.resolve(t(s.value))});return}if(!r)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async o=>{let n=await gr(t.params,{...o.params});if(!n.success)throw new ne(B.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await r(n.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Dn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ql(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];r[n]=Dn(i)&&Dn(s)?{...i,...s}:s}return r}function Ug(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Mz(e){let t={},r=[];if(!Ug(e))return{accepted:t,droppedKeys:r};for(let[o,n]of Object.entries(e)){if(!Ug(n)||"method"in n||"result"in n){r.push(o);continue}t[o]=n}return{accepted:t,droppedKeys:r}}function Lz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var Dz=U((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(c){if(!c)throw new TypeError("argument string is required");var a=typeof c=="object"?s(c):c;if(typeof a!="string")throw new TypeError("argument string is required to be a string");var u=a.indexOf(";"),d=u!==-1?a.slice(0,u).trim():a.trim();if(!o.test(d))throw new TypeError("invalid media type");var p=new i(d.toLowerCase());if(u!==-1){var _,y,m;for(t.lastIndex=u;y=t.exec(a);){if(y.index!==u)throw new TypeError("invalid parameter format");u+=y[0].length,_=y[1].toLowerCase(),m=y[2],m.charCodeAt(0)===34&&(m=m.slice(1,-1),m.indexOf("\\")!==-1&&(m=m.replace(r,"$1"))),p.parameters[_]=m}if(u!==a.length)throw new TypeError("invalid parameter format")}return p}function s(c){var a;if(typeof c.getHeader=="function"?a=c.getHeader("content-type"):typeof c.headers=="object"&&(a=c.headers&&c.headers["content-type"]),typeof a!="string")throw new TypeError("content-type header is missing from object");return a}function i(c){this.parameters=Object.create(null),this.type=c}})),$P=fs(Dz(),1);var y_=10*1024*1024,ed=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??y_}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf(`
|
|
60
|
-
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return
|
|
61
|
-
`}var Zz=/^[A-Za-z0-9._-]{1,128}$/;function Uz(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Zz.test(e)){let r=[...e].filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,s)=>s.indexOf(o)===n);return t.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function Fz(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);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 rd(e){let t=Uz(e);return Fz(e,t.warnings),t.isValid}function Vz(e){return typeof e=="object"&&e!==null&&"_zod"in e}function Hz(e){return typeof e=="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName=="string"}function Jz(e){if(typeof e!="object"||e===null||ao(e))return!1;let t=Object.getPrototypeOf(e);return t!==Object.prototype&&t!==null?!1:Object.values(e).every(r=>Vz(r))}function ec(e){if(e!==void 0){if(Jz(e))return P(e);if(typeof e=="object"&&e!==null&&!ao(e)&&Object.values(e).some(t=>Hz(t)))throw new 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(!ao(e))throw new TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}}var rc=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(f){if(super(),!e.IDENTIFIER.test(f))throw new Error("CodeGen: name must be a valid identifier");this.str=f}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(f){super(),this._items=typeof f=="string"?[f]:f}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let f=this._items[0];return f===""||f==='""'}get str(){var f;return(f=this._str)!==null&&f!==void 0?f:this._str=this._items.reduce((z,v)=>`${z}${v}`,"")}get names(){var f;return(f=this._names)!==null&&f!==void 0?f:this._names=this._items.reduce((z,v)=>(v instanceof r&&(z[v.str]=(z[v.str]||0)+1),z),{})}};e._Code=o,e.nil=new o("");function n(f,...z){let v=[f[0]],R=0;for(;R<z.length;)c(v,z[R]),v.push(f[++R]);return new o(v)}e._=n;let s=new o("+");function i(f,...z){let v=[y(f[0])],R=0;for(;R<z.length;)v.push(s),c(v,z[R]),v.push(s,y(f[++R]));return a(v),new o(v)}e.str=i;function c(f,z){z instanceof o?f.push(...z._items):z instanceof r?f.push(z):f.push(p(z))}e.addCodeArg=c;function a(f){let z=1;for(;z<f.length-1;){if(f[z]===s){let v=u(f[z-1],f[z+1]);if(v!==void 0){f.splice(z-1,3,v);continue}f[z++]="+"}z++}}function u(f,z){if(z==='""')return f;if(f==='""')return z;if(typeof f=="string")return z instanceof r||f[f.length-1]!=='"'?void 0:typeof z!="string"?`${f.slice(0,-1)}${z}"`:z[0]==='"'?f.slice(0,-1)+z.slice(1):void 0;if(typeof z=="string"&&z[0]==='"'&&!(f instanceof r))return`"${f}${z.slice(1)}`}function d(f,z){return z.emptyStr()?f:f.emptyStr()?z:i`${f}${z}`}e.strConcat=d;function p(f){return typeof f=="number"||typeof f=="boolean"||f===null?f:y(Array.isArray(f)?f.join(","):f)}function _(f){return new o(y(f))}e.stringify=_;function y(f){return JSON.stringify(f).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=y;function m(f){return typeof f=="string"&&e.IDENTIFIER.test(f)?new o(`.${f}`):n`[${f}]`}e.getProperty=m;function g(f){if(typeof f=="string"&&e.IDENTIFIER.test(f))return new o(`${f}`);throw new Error(`CodeGen: invalid export name: ${f}, use explicit $id name mapping`)}e.getEsmExportName=g;function h(f){return new o(f.toString())}e.regexpCode=h})),b_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=rc();var r=class extends Error{constructor(a){super(`CodeGen: "code" for ${a} not defined`),this.value=a.value}},o;(function(a){a[a.Started=0]="Started",a[a.Completed=1]="Completed"})(o||(e.UsedValueState=o={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var n=class{constructor({prefixes:a,parent:u}={}){this._names={},this._prefixes=a,this._parent=u}toName(a){return a instanceof t.Name?a:this.name(a)}name(a){return new t.Name(this._newName(a))}_newName(a){let u=this._names[a]||this._nameGroup(a);return`${a}${u.index++}`}_nameGroup(a){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(a)||this._prefixes&&!this._prefixes.has(a))throw new Error(`CodeGen: prefix "${a}" is not allowed in this scope`);return this._names[a]={prefix:a,index:0}}};e.Scope=n;var s=class extends t.Name{constructor(a,u){super(u),this.prefix=a}setValue(a,{property:u,itemIndex:d}){this.value=a,this.scopePath=(0,t._)`.${new t.Name(u)}[${d}]`}};e.ValueScopeName=s;let i=(0,t._)`\n`;var c=class extends n{constructor(a){super(a),this._values={},this._scope=a.scope,this.opts={...a,_n:a.lines?i:t.nil}}get(){return this._scope}name(a){return new s(a,this._newName(a))}value(a,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let p=this.toName(a),{prefix:_}=p,y=(d=u.key)!==null&&d!==void 0?d:u.ref,m=this._values[_];if(m){let f=m.get(y);if(f)return f}else m=this._values[_]=new Map;m.set(y,p);let g=this._scope[_]||(this._scope[_]=[]),h=g.length;return g[h]=u.ref,p.setValue(u,{property:_,itemIndex:h}),p}getValue(a,u){let d=this._values[a];if(d)return d.get(u)}scopeRefs(a,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,t._)`${a}${d.scopePath}`})}scopeCode(a=this._values,u,d){return this._reduceValues(a,p=>{if(p.value===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return p.value.code},u,d)}_reduceValues(a,u,d={},p){let _=t.nil;for(let y in a){let m=a[y];if(!m)continue;let g=d[y]=d[y]||new Map;m.forEach(h=>{if(g.has(h))return;g.set(h,o.Started);let f=u(h);if(f){let z=this.opts.es5?e.varKinds.var:e.varKinds.const;_=(0,t._)`${_}${z} ${h} = ${f};${this.opts._n}`}else if(f=p?.(h))_=(0,t._)`${_}${f}${this.opts._n}`;else throw new r(h);g.set(h,o.Completed)})}return _}};e.ValueScope=c})),le=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=rc(),r=b_();var o=rc();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var n=b_();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var s=class{optimizeNodes(){return this}optimizeNames($,C){return this}},i=class extends s{constructor($,C,x){super(),this.varKind=$,this.name=C,this.rhs=x}render({es5:$,_n:C}){let x=$?r.varKinds.var:this.varKind,J=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${J};`+C}optimizeNames($,C){if($[this.name.str])return this.rhs&&(this.rhs=G(this.rhs,$,C)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},c=class extends s{constructor($,C,x){super(),this.lhs=$,this.rhs=C,this.sideEffects=x}render({_n:$}){return`${this.lhs} = ${this.rhs};`+$}optimizeNames($,C){if(!(this.lhs instanceof t.Name&&!$[this.lhs.str]&&!this.sideEffects))return this.rhs=G(this.rhs,$,C),this}get names(){return W(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},a=class extends c{constructor($,C,x,J){super($,x,J),this.op=C}render({_n:$}){return`${this.lhs} ${this.op}= ${this.rhs};`+$}},u=class extends s{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`${this.label}:`+$}},d=class extends s{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`break${this.label?` ${this.label}`:""};`+$}},p=class extends s{constructor($){super(),this.error=$}render({_n:$}){return`throw ${this.error};`+$}get names(){return this.error.names}},_=class extends s{constructor($){super(),this.code=$}render({_n:$}){return`${this.code};`+$}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames($,C){return this.code=G(this.code,$,C),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},y=class extends s{constructor($=[]){super(),this.nodes=$}render($){return this.nodes.reduce((C,x)=>C+x.render($),"")}optimizeNodes(){let{nodes:$}=this,C=$.length;for(;C--;){let x=$[C].optimizeNodes();Array.isArray(x)?$.splice(C,1,...x):x?$[C]=x:$.splice(C,1)}return $.length>0?this:void 0}optimizeNames($,C){let{nodes:x}=this,J=x.length;for(;J--;){let ee=x[J];ee.optimizeNames($,C)||(fe($,ee.names),x.splice(J,1))}return x.length>0?this:void 0}get names(){return this.nodes.reduce(($,C)=>Z($,C.names),{})}},m=class extends y{render($){return"{"+$._n+super.render($)+"}"+$._n}},g=class extends y{},h=class extends m{};h.kind="else";var f=class tc extends m{constructor(C,x){super(x),this.condition=C}render(C){let x=`if(${this.condition})`+super.render(C);return this.else&&(x+="else "+this.else.render(C)),x}optimizeNodes(){super.optimizeNodes();let C=this.condition;if(C===!0)return this.nodes;let x=this.else;if(x){let J=x.optimizeNodes();x=this.else=Array.isArray(J)?new h(J):J}if(x)return C===!1?x instanceof tc?x:x.nodes:this.nodes.length?this:new tc($e(C),x instanceof tc?[x]:x.nodes);if(!(C===!1||!this.nodes.length))return this}optimizeNames(C,x){var J;if(this.else=(J=this.else)===null||J===void 0?void 0:J.optimizeNames(C,x),!!(super.optimizeNames(C,x)||this.else))return this.condition=G(this.condition,C,x),this}get names(){let C=super.names;return W(C,this.condition),this.else&&Z(C,this.else.names),C}};f.kind="if";var z=class extends m{};z.kind="for";var v=class extends z{constructor($){super(),this.iteration=$}render($){return`for(${this.iteration})`+super.render($)}optimizeNames($,C){if(super.optimizeNames($,C))return this.iteration=G(this.iteration,$,C),this}get names(){return Z(super.names,this.iteration.names)}},R=class extends z{constructor($,C,x,J){super(),this.varKind=$,this.name=C,this.from=x,this.to=J}render($){let C=$.es5?r.varKinds.var:this.varKind,{name:x,from:J,to:ee}=this;return`for(${C} ${x}=${J}; ${x}<${ee}; ${x}++)`+super.render($)}get names(){return W(W(super.names,this.from),this.to)}},w=class extends z{constructor($,C,x,J){super(),this.loop=$,this.varKind=C,this.name=x,this.iterable=J}render($){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render($)}optimizeNames($,C){if(super.optimizeNames($,C))return this.iterable=G(this.iterable,$,C),this}get names(){return Z(super.names,this.iterable.names)}},b=class extends m{constructor($,C,x){super(),this.name=$,this.args=C,this.async=x}render($){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render($)}};b.kind="func";var S=class extends y{render($){return"return "+super.render($)}};S.kind="return";var E=class extends m{render($){let C="try"+super.render($);return this.catch&&(C+=this.catch.render($)),this.finally&&(C+=this.finally.render($)),C}optimizeNodes(){var $,C;return super.optimizeNodes(),($=this.catch)===null||$===void 0||$.optimizeNodes(),(C=this.finally)===null||C===void 0||C.optimizeNodes(),this}optimizeNames($,C){var x,J;return super.optimizeNames($,C),(x=this.catch)===null||x===void 0||x.optimizeNames($,C),(J=this.finally)===null||J===void 0||J.optimizeNames($,C),this}get names(){let $=super.names;return this.catch&&Z($,this.catch.names),this.finally&&Z($,this.finally.names),$}},N=class extends m{constructor($){super(),this.error=$}render($){return`catch(${this.error})`+super.render($)}};N.kind="catch";var V=class extends m{render($){return"finally"+super.render($)}};V.kind="finally";var M=class{constructor($,C={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...C,_n:C.lines?`
|
|
62
|
-
`:""},this._extScope=$,this._scope=new r.Scope({parent:$}),this._nodes=[new g]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,C){let x=this._extScope.value($,C);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue($,C){return this._extScope.getValue($,C)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,C,x,J){let ee=this._scope.toName(C);return x!==void 0&&J&&(this._constants[ee.str]=x),this._leafNode(new i($,ee,x)),ee}const($,C,x){return this._def(r.varKinds.const,$,C,x)}let($,C,x){return this._def(r.varKinds.let,$,C,x)}var($,C,x){return this._def(r.varKinds.var,$,C,x)}assign($,C,x){return this._leafNode(new c($,C,x))}add($,C){return this._leafNode(new a($,e.operators.ADD,C))}code($){return typeof $=="function"?$():$!==t.nil&&this._leafNode(new _($)),this}object(...$){let C=["{"];for(let[x,J]of $)C.length>1&&C.push(","),C.push(x),(x!==J||this.opts.es5)&&(C.push(":"),(0,t.addCodeArg)(C,J));return C.push("}"),new t._Code(C)}if($,C,x){if(this._blockNode(new f($)),C&&x)this.code(C).else().code(x).endIf();else if(C)this.code(C).endIf();else if(x)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new f($))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(f,h)}_for($,C){return this._blockNode($),C&&this.code(C).endFor(),this}for($,C){return this._for(new v($),C)}forRange($,C,x,J,ee=this.opts.es5?r.varKinds.var:r.varKinds.let){let pe=this._scope.toName($);return this._for(new R(ee,pe,C,x),()=>J(pe))}forOf($,C,x,J=r.varKinds.const){let ee=this._scope.toName($);if(this.opts.es5){let pe=C instanceof t.Name?C:this.var("_arr",C);return this.forRange("_i",0,(0,t._)`${pe}.length`,ae=>{this.var(ee,(0,t._)`${pe}[${ae}]`),x(ee)})}return this._for(new w("of",J,ee,C),()=>x(ee))}forIn($,C,x,J=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf($,(0,t._)`Object.keys(${C})`,x);let ee=this._scope.toName($);return this._for(new w("in",J,ee,C),()=>x(ee))}endFor(){return this._endBlockNode(z)}label($){return this._leafNode(new u($))}break($){return this._leafNode(new d($))}return($){let C=new S;if(this._blockNode(C),this.code($),C.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try($,C,x){if(!C&&!x)throw new Error('CodeGen: "try" without "catch" and "finally"');let J=new E;if(this._blockNode(J),this.code($),C){let ee=this.name("e");this._currNode=J.catch=new N(ee),C(ee)}return x&&(this._currNode=J.finally=new V,this.code(x)),this._endBlockNode(N,V)}throw($){return this._leafNode(new p($))}block($,C){return this._blockStarts.push(this._nodes.length),$&&this.code($).endBlock(C),this}endBlock($){let C=this._blockStarts.pop();if(C===void 0)throw new Error("CodeGen: not in self-balancing block");let x=this._nodes.length-C;if(x<0||$!==void 0&&x!==$)throw new Error(`CodeGen: wrong number of nodes: ${x} vs ${$} expected`);return this._nodes.length=C,this}func($,C=t.nil,x,J){return this._blockNode(new b($,C,x)),J&&this.code(J).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize($=1){for(;$-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,C){let x=this._currNode;if(x instanceof $||C&&x instanceof C)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${C?`${$.kind}/${C.kind}`:$.kind}"`)}_elseNode($){let C=this._currNode;if(!(C instanceof f))throw new Error('CodeGen: "else" without "if"');return this._currNode=C.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let C=this._nodes;C[C.length-1]=$}};e.CodeGen=M;function Z($,C){for(let x in C)$[x]=($[x]||0)+(C[x]||0);return $}function W($,C){return C instanceof t._CodeOrName?Z($,C.names):$}function G($,C,x){if($ instanceof t.Name)return J($);if(!ee($))return $;return new t._Code($._items.reduce((pe,ae)=>(ae instanceof t.Name&&(ae=J(ae)),ae instanceof t._Code?pe.push(...ae._items):pe.push(ae),pe),[]));function J(pe){let ae=x[pe.str];return ae===void 0||C[pe.str]!==1?pe:(delete C[pe.str],ae)}function ee(pe){return pe instanceof t._Code&&pe._items.some(ae=>ae instanceof t.Name&&C[ae.str]===1&&x[ae.str]!==void 0)}}function fe($,C){for(let x in C)$[x]=($[x]||0)-(C[x]||0)}function $e($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:(0,t._)`!${F($)}`}e.not=$e;let be=j(e.operators.AND);function Oe(...$){return $.reduce(be)}e.and=Oe;let he=j(e.operators.OR);function k(...$){return $.reduce(he)}e.or=k;function j($){return(C,x)=>C===t.nil?x:x===t.nil?C:(0,t._)`${F(C)} ${$} ${F(x)}`}function F($){return $ instanceof t.Name?$:(0,t._)`(${$})`}})),_e=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=le(),r=rc();function o(b){let S={};for(let E of b)S[E]=!0;return S}e.toHash=o;function n(b,S){return typeof S=="boolean"?S:Object.keys(S).length===0?!0:(s(b,S),!i(S,b.self.RULES.all))}e.alwaysValidSchema=n;function s(b,S=b.schema){let{opts:E,self:N}=b;if(!E.strictSchema||typeof S=="boolean")return;let V=N.RULES.keywords;for(let M in S)V[M]||w(b,`unknown keyword: "${M}"`)}e.checkUnknownRules=s;function i(b,S){if(typeof b=="boolean")return!b;for(let E in b)if(S[E])return!0;return!1}e.schemaHasRules=i;function c(b,S){if(typeof b=="boolean")return!b;for(let E in b)if(E!=="$ref"&&S.all[E])return!0;return!1}e.schemaHasRulesButRef=c;function a({topSchemaRef:b,schemaPath:S},E,N,V){if(!V){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return(0,t._)`${E}`}return(0,t._)`${b}${S}${(0,t.getProperty)(N)}`}e.schemaRefOrVal=a;function u(b){return _(decodeURIComponent(b))}e.unescapeFragment=u;function d(b){return encodeURIComponent(p(b))}e.escapeFragment=d;function p(b){return typeof b=="number"?`${b}`:b.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=p;function _(b){return b.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=_;function y(b,S){if(Array.isArray(b))for(let E of b)S(E);else S(b)}e.eachItem=y;function m({mergeNames:b,mergeToName:S,mergeValues:E,resultToName:N}){return(V,M,Z,W)=>{let G=Z===void 0?M:Z instanceof t.Name?(M instanceof t.Name?b(V,M,Z):S(V,M,Z),Z):M instanceof t.Name?(S(V,Z,M),M):E(M,Z);return W===t.Name&&!(G instanceof t.Name)?N(V,G):G}}e.mergeEvaluated={props:m({mergeNames:(b,S,E)=>b.if((0,t._)`${E} !== true && ${S} !== undefined`,()=>{b.if((0,t._)`${S} === true`,()=>b.assign(E,!0),()=>b.assign(E,(0,t._)`${E} || {}`).code((0,t._)`Object.assign(${E}, ${S})`))}),mergeToName:(b,S,E)=>b.if((0,t._)`${E} !== true`,()=>{S===!0?b.assign(E,!0):(b.assign(E,(0,t._)`${E} || {}`),h(b,E,S))}),mergeValues:(b,S)=>b===!0?!0:{...b,...S},resultToName:g}),items:m({mergeNames:(b,S,E)=>b.if((0,t._)`${E} !== true && ${S} !== undefined`,()=>b.assign(E,(0,t._)`${S} === true ? true : ${E} > ${S} ? ${E} : ${S}`)),mergeToName:(b,S,E)=>b.if((0,t._)`${E} !== true`,()=>b.assign(E,S===!0?!0:(0,t._)`${E} > ${S} ? ${E} : ${S}`)),mergeValues:(b,S)=>b===!0?!0:Math.max(b,S),resultToName:(b,S)=>b.var("items",S)})};function g(b,S){if(S===!0)return b.var("props",!0);let E=b.var("props",(0,t._)`{}`);return S!==void 0&&h(b,E,S),E}e.evaluatedPropsToName=g;function h(b,S,E){Object.keys(E).forEach(N=>b.assign((0,t._)`${S}${(0,t.getProperty)(N)}`,!0))}e.setEvaluated=h;let f={};function z(b,S){return b.scopeValue("func",{ref:S,code:f[S.code]||(f[S.code]=new r._Code(S.code))})}e.useFunc=z;var v;(function(b){b[b.Num=0]="Num",b[b.Str=1]="Str"})(v||(e.Type=v={}));function R(b,S,E){if(b instanceof t.Name){let N=S===v.Num;return E?N?(0,t._)`"[" + ${b} + "]"`:(0,t._)`"['" + ${b} + "']"`:N?(0,t._)`"/" + ${b}`:(0,t._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,t.getProperty)(b).toString():"/"+p(b)}e.getErrorPath=R;function w(b,S,E=b.opts.strictSchema){if(E){if(S=`strict mode: ${S}`,E===!0)throw new Error(S);b.self.logger.warn(S)}}e.checkStrictMode=w})),pt=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r})),nc=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=le(),r=_e(),o=pt();e.keywordError={message:({keyword:h})=>(0,t.str)`must pass "${h}" keyword validation`},e.keyword$DataError={message:({keyword:h,schemaType:f})=>f?(0,t.str)`"${h}" keyword must be ${f} ($data)`:(0,t.str)`"${h}" keyword is invalid ($data)`};function n(h,f=e.keywordError,z,v){let{it:R}=h,{gen:w,compositeRule:b,allErrors:S}=R,E=p(h,f,z);v??(b||S)?a(w,E):u(R,(0,t._)`[${E}]`)}e.reportError=n;function s(h,f=e.keywordError,z){let{it:v}=h,{gen:R,compositeRule:w,allErrors:b}=v;a(R,p(h,f,z)),w||b||u(v,o.default.vErrors)}e.reportExtraError=s;function i(h,f){h.assign(o.default.errors,f),h.if((0,t._)`${o.default.vErrors} !== null`,()=>h.if(f,()=>h.assign((0,t._)`${o.default.vErrors}.length`,f),()=>h.assign(o.default.vErrors,null)))}e.resetErrorsCount=i;function c({gen:h,keyword:f,schemaValue:z,data:v,errsCount:R,it:w}){if(R===void 0)throw new Error("ajv implementation error");let b=h.name("err");h.forRange("i",R,o.default.errors,S=>{h.const(b,(0,t._)`${o.default.vErrors}[${S}]`),h.if((0,t._)`${b}.instancePath === undefined`,()=>h.assign((0,t._)`${b}.instancePath`,(0,t.strConcat)(o.default.instancePath,w.errorPath))),h.assign((0,t._)`${b}.schemaPath`,(0,t.str)`${w.errSchemaPath}/${f}`),w.opts.verbose&&(h.assign((0,t._)`${b}.schema`,z),h.assign((0,t._)`${b}.data`,v))})}e.extendErrors=c;function a(h,f){let z=h.const("err",f);h.if((0,t._)`${o.default.vErrors} === null`,()=>h.assign(o.default.vErrors,(0,t._)`[${z}]`),(0,t._)`${o.default.vErrors}.push(${z})`),h.code((0,t._)`${o.default.errors}++`)}function u(h,f){let{gen:z,validateName:v,schemaEnv:R}=h;R.$async?z.throw((0,t._)`new ${h.ValidationError}(${f})`):(z.assign((0,t._)`${v}.errors`,f),z.return(!1))}let d={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function p(h,f,z){let{createErrors:v}=h.it;return v===!1?(0,t._)`{}`:_(h,f,z)}function _(h,f,z={}){let{gen:v,it:R}=h,w=[y(R,z),m(h,z)];return g(h,f,w),v.object(...w)}function y({errorPath:h},{instancePath:f}){let z=f?(0,t.str)`${h}${(0,r.getErrorPath)(f,r.Type.Str)}`:h;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,z)]}function m({keyword:h,it:{errSchemaPath:f}},{schemaPath:z,parentSchema:v}){let R=v?f:(0,t.str)`${f}/${h}`;return z&&(R=(0,t.str)`${R}${(0,r.getErrorPath)(z,r.Type.Str)}`),[d.schemaPath,R]}function g(h,{params:f,message:z},v){let{keyword:R,data:w,schemaValue:b,it:S}=h,{opts:E,propertyName:N,topSchemaRef:V,schemaPath:M}=S;v.push([d.keyword,R],[d.params,typeof f=="function"?f(h):f||(0,t._)`{}`]),E.messages&&v.push([d.message,typeof z=="function"?z(h):z]),E.verbose&&v.push([d.schema,b],[d.parentSchema,(0,t._)`${V}${M}`],[o.default.data,w]),N&&v.push([d.propertyName,N])}})),Bz=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=nc(),r=le(),o=pt(),n={message:"boolean schema is false"};function s(a){let{gen:u,schema:d,validateName:p}=a;d===!1?c(a,!1):typeof d=="object"&&d.$async===!0?u.return(o.default.data):(u.assign((0,r._)`${p}.errors`,null),u.return(!0))}e.topBoolOrEmptySchema=s;function i(a,u){let{gen:d,schema:p}=a;p===!1?(d.var(u,!1),c(a)):d.var(u,!0)}e.boolOrEmptySchema=i;function c(a,u){let{gen:d,data:p}=a,_={gen:d,keyword:"false schema",data:p,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,t.reportError)(_,n,void 0,u)}})),z_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(n){return typeof n=="string"&&t.has(n)}e.isJSONType=r;function o(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=o})),R_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:n,self:s},i){let c=s.RULES.types[i];return c&&c!==!0&&r(n,c)}e.schemaHasRulesForType=t;function r(n,s){return s.rules.some(i=>o(n,i))}e.shouldUseGroup=r;function o(n,s){var i;return n[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some(c=>n[c]!==void 0))}e.shouldUseRule=o})),oc=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=z_(),r=R_(),o=nc(),n=le(),s=_e();var i;(function(v){v[v.Correct=0]="Correct",v[v.Wrong=1]="Wrong"})(i||(e.DataType=i={}));function c(v){let R=a(v.type);if(R.includes("null")){if(v.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!R.length&&v.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');v.nullable===!0&&R.push("null")}return R}e.getSchemaTypes=c;function a(v){let R=Array.isArray(v)?v:v?[v]:[];if(R.every(t.isJSONType))return R;throw new Error("type must be JSONType or JSONType[]: "+R.join(","))}e.getJSONTypes=a;function u(v,R){let{gen:w,data:b,opts:S}=v,E=p(R,S.coerceTypes),N=R.length>0&&!(E.length===0&&R.length===1&&(0,r.schemaHasRulesForType)(v,R[0]));if(N){let V=g(R,b,S.strictNumbers,i.Wrong);w.if(V,()=>{E.length?_(v,R,E):f(v)})}return N}e.coerceAndCheckDataType=u;let d=new Set(["string","number","integer","boolean","null"]);function p(v,R){return R?v.filter(w=>d.has(w)||R==="array"&&w==="array"):[]}function _(v,R,w){let{gen:b,data:S,opts:E}=v,N=b.let("dataType",(0,n._)`typeof ${S}`),V=b.let("coerced",(0,n._)`undefined`);E.coerceTypes==="array"&&b.if((0,n._)`${N} == 'object' && Array.isArray(${S}) && ${S}.length == 1`,()=>b.assign(S,(0,n._)`${S}[0]`).assign(N,(0,n._)`typeof ${S}`).if(g(R,S,E.strictNumbers),()=>b.assign(V,S))),b.if((0,n._)`${V} !== undefined`);for(let Z of w)(d.has(Z)||Z==="array"&&E.coerceTypes==="array")&&M(Z);b.else(),f(v),b.endIf(),b.if((0,n._)`${V} !== undefined`,()=>{b.assign(S,V),y(v,V)});function M(Z){switch(Z){case"string":b.elseIf((0,n._)`${N} == "number" || ${N} == "boolean"`).assign(V,(0,n._)`"" + ${S}`).elseIf((0,n._)`${S} === null`).assign(V,(0,n._)`""`);return;case"number":b.elseIf((0,n._)`${N} == "boolean" || ${S} === null
|
|
63
|
-
|| (${N} == "string" && ${
|
|
64
|
-
|| (${N} === "string" && ${
|
|
65
|
-
|| ${N} === "boolean" || ${S} === null`).assign(V,(0,n._)`[${S}]`)}}}function y({gen:v,parentData:R,parentDataProperty:w},b){v.if((0,n._)`${R} !== undefined`,()=>v.assign((0,n._)`${R}[${w}]`,b))}function m(v,R,w,b=i.Correct){let S=b===i.Correct?n.operators.EQ:n.operators.NEQ,E;switch(v){case"null":return(0,n._)`${R} ${S} null`;case"array":E=(0,n._)`Array.isArray(${R})`;break;case"object":E=(0,n._)`${R} && typeof ${R} == "object" && !Array.isArray(${R})`;break;case"integer":E=N((0,n._)`!(${R} % 1) && !isNaN(${R})`);break;case"number":E=N();break;default:return(0,n._)`typeof ${R} ${S} ${v}`}return b===i.Correct?E:(0,n.not)(E);function N(V=n.nil){return(0,n.and)((0,n._)`typeof ${R} == "number"`,V,w?(0,n._)`isFinite(${R})`:n.nil)}}e.checkDataType=m;function g(v,R,w,b){if(v.length===1)return m(v[0],R,w,b);let S,E=(0,s.toHash)(v);if(E.array&&E.object){let N=(0,n._)`typeof ${R} != "object"`;S=E.null?N:(0,n._)`!${R} || ${N}`,delete E.null,delete E.array,delete E.object}else S=n.nil;E.number&&delete E.integer;for(let N in E)S=(0,n.and)(S,m(N,R,w,b));return S}e.checkDataTypes=g;let h={message:({schema:v})=>`must be ${v}`,params:({schema:v,schemaValue:R})=>typeof v=="string"?(0,n._)`{type: ${v}}`:(0,n._)`{type: ${R}}`};function f(v){let R=z(v);(0,o.reportError)(R,h)}e.reportTypeError=f;function z(v){let{gen:R,data:w,schema:b}=v,S=(0,s.schemaRefOrVal)(v,b,"type");return{gen:R,keyword:"type",data:w,schema:b.type,schemaCode:S,schemaValue:S,parentSchema:b,params:{},it:v}}})),Kz=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=le(),r=_e();function o(s,i){let{properties:c,items:a}=s.schema;if(i==="object"&&c)for(let u in c)n(s,u,c[u].default);else i==="array"&&Array.isArray(a)&&a.forEach((u,d)=>n(s,d,u.default))}e.assignDefaults=o;function n(s,i,c){let{gen:a,compositeRule:u,data:d,opts:p}=s;if(c===void 0)return;let _=(0,t._)`${d}${(0,t.getProperty)(i)}`;if(u){(0,r.checkStrictMode)(s,`default is ignored for: ${_}`);return}let y=(0,t._)`${_} === undefined`;p.useDefaults==="empty"&&(y=(0,t._)`${y} || ${_} === null || ${_} === ""`),a.if(y,(0,t._)`${_} = ${(0,t.stringify)(c)}`)}})),mt=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=le(),r=_e(),o=pt(),n=_e();function s(v,R){let{gen:w,data:b,it:S}=v;w.if(p(w,b,R,S.opts.ownProperties),()=>{v.setParams({missingProperty:(0,t._)`${R}`},!0),v.error()})}e.checkReportMissingProp=s;function i({gen:v,data:R,it:{opts:w}},b,S){return(0,t.or)(...b.map(E=>(0,t.and)(p(v,R,E,w.ownProperties),(0,t._)`${S} = ${E}`)))}e.checkMissingProp=i;function c(v,R){v.setParams({missingProperty:R},!0),v.error()}e.reportMissingProp=c;function a(v){return v.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=a;function u(v,R,w){return(0,t._)`${a(v)}.call(${R}, ${w})`}e.isOwnProperty=u;function d(v,R,w,b){let S=(0,t._)`${R}${(0,t.getProperty)(w)} !== undefined`;return b?(0,t._)`${S} && ${u(v,R,w)}`:S}e.propertyInData=d;function p(v,R,w,b){let S=(0,t._)`${R}${(0,t.getProperty)(w)} === undefined`;return b?(0,t.or)(S,(0,t.not)(u(v,R,w))):S}e.noPropertyInData=p;function _(v){return v?Object.keys(v).filter(R=>R!=="__proto__"):[]}e.allSchemaProperties=_;function y(v,R){return _(R).filter(w=>!(0,r.alwaysValidSchema)(v,R[w]))}e.schemaProperties=y;function m({schemaCode:v,data:R,it:{gen:w,topSchemaRef:b,schemaPath:S,errorPath:E},it:N},V,M,Z){let W=Z?(0,t._)`${v}, ${R}, ${b}${S}`:R,G=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,E)],[o.default.parentData,N.parentData],[o.default.parentDataProperty,N.parentDataProperty],[o.default.rootData,o.default.rootData]];N.opts.dynamicRef&&G.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let fe=(0,t._)`${W}, ${w.object(...G)}`;return M!==t.nil?(0,t._)`${V}.call(${M}, ${fe})`:(0,t._)`${V}(${fe})`}e.callValidateCode=m;let g=(0,t._)`new RegExp`;function h({gen:v,it:{opts:R}},w){let b=R.unicodeRegExp?"u":"",{regExp:S}=R.code,E=S(w,b);return v.scopeValue("pattern",{key:E.toString(),ref:E,code:(0,t._)`${S.code==="new RegExp"?g:(0,n.useFunc)(v,S)}(${w}, ${b})`})}e.usePattern=h;function f(v){let{gen:R,data:w,keyword:b,it:S}=v,E=R.name("valid");if(S.allErrors){let V=R.let("valid",!0);return N(()=>R.assign(V,!1)),V}return R.var(E,!0),N(()=>R.break()),E;function N(V){let M=R.const("len",(0,t._)`${w}.length`);R.forRange("i",0,M,Z=>{v.subschema({keyword:b,dataProp:Z,dataPropType:r.Type.Num},E),R.if((0,t.not)(E),V)})}}e.validateArray=f;function z(v){let{gen:R,schema:w,keyword:b,it:S}=v;if(!Array.isArray(w))throw new Error("ajv implementation error");if(w.some(V=>(0,r.alwaysValidSchema)(S,V))&&!S.opts.unevaluated)return;let E=R.let("valid",!1),N=R.name("_valid");R.block(()=>w.forEach((V,M)=>{let Z=v.subschema({keyword:b,schemaProp:M,compositeRule:!0},N);R.assign(E,(0,t._)`${E} || ${N}`),v.mergeValidEvaluated(Z,N)||R.if((0,t.not)(E))})),v.result(E,()=>v.reset(),()=>v.error(!0))}e.validateUnion=z})),Gz=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=le(),r=pt(),o=mt(),n=nc();function s(y,m){let{gen:g,keyword:h,schema:f,parentSchema:z,it:v}=y,R=m.macro.call(v.self,f,z,v),w=d(g,h,R);v.opts.validateSchema!==!1&&v.self.validateSchema(R,!0);let b=g.name("valid");y.subschema({schema:R,schemaPath:t.nil,errSchemaPath:`${v.errSchemaPath}/${h}`,topSchemaRef:w,compositeRule:!0},b),y.pass(b,()=>y.error(!0))}e.macroKeywordCode=s;function i(y,m){var g;let{gen:h,keyword:f,schema:z,parentSchema:v,$data:R,it:w}=y;u(w,m);let b=d(h,f,!R&&m.compile?m.compile.call(w.self,z,v,w):m.validate),S=h.let("valid");y.block$data(S,E),y.ok((g=m.valid)!==null&&g!==void 0?g:S);function E(){if(m.errors===!1)M(),m.modifying&&c(y),Z(()=>y.error());else{let W=m.async?N():V();m.modifying&&c(y),Z(()=>a(y,W))}}function N(){let W=h.let("ruleErrs",null);return h.try(()=>M((0,t._)`await `),G=>h.assign(S,!1).if((0,t._)`${G} instanceof ${w.ValidationError}`,()=>h.assign(W,(0,t._)`${G}.errors`),()=>h.throw(G))),W}function V(){let W=(0,t._)`${b}.errors`;return h.assign(W,null),M(t.nil),W}function M(W=m.async?(0,t._)`await `:t.nil){let G=w.opts.passContext?r.default.this:r.default.self,fe=!("compile"in m&&!R||m.schema===!1);h.assign(S,(0,t._)`${W}${(0,o.callValidateCode)(y,b,G,fe)}`,m.modifying)}function Z(W){var G;h.if((0,t.not)((G=m.valid)!==null&&G!==void 0?G:S),W)}}e.funcKeywordCode=i;function c(y){let{gen:m,data:g,it:h}=y;m.if(h.parentData,()=>m.assign(g,(0,t._)`${h.parentData}[${h.parentDataProperty}]`))}function a(y,m){let{gen:g}=y;g.if((0,t._)`Array.isArray(${m})`,()=>{g.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${m} : ${r.default.vErrors}.concat(${m})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,n.extendErrors)(y)},()=>y.error())}function u({schemaEnv:y},m){if(m.async&&!y.$async)throw new Error("async keyword in sync schema")}function d(y,m,g){if(g===void 0)throw new Error(`keyword "${m}" failed to compile`);return y.scopeValue("keyword",typeof g=="function"?{ref:g}:{ref:g,code:(0,t.stringify)(g)})}function p(y,m,g=!1){return!m.length||m.some(h=>h==="array"?Array.isArray(y):h==="object"?y&&typeof y=="object"&&!Array.isArray(y):typeof y==h||g&&typeof y>"u")}e.validSchemaType=p;function _({schema:y,opts:m,self:g,errSchemaPath:h},f,z){if(Array.isArray(f.keyword)?!f.keyword.includes(z):f.keyword!==z)throw new Error("ajv implementation error");let v=f.dependencies;if(v?.some(R=>!Object.prototype.hasOwnProperty.call(y,R)))throw new Error(`parent schema must have dependencies of ${z}: ${v.join(",")}`);if(f.validateSchema&&!f.validateSchema(y[z])){let R=`keyword "${z}" value is invalid at path "${h}": `+g.errorsText(f.validateSchema.errors);if(m.validateSchema==="log")g.logger.error(R);else throw new Error(R)}}e.validateKeywordUsage=_})),Wz=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=le(),r=_e();function o(i,{keyword:c,schemaProp:a,schema:u,schemaPath:d,errSchemaPath:p,topSchemaRef:_}){if(c!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(c!==void 0){let y=i.schema[c];return a===void 0?{schema:y,schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${c}`}:{schema:y[a],schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(c)}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${c}/${(0,r.escapeFragment)(a)}`}}if(u!==void 0){if(d===void 0||p===void 0||_===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:d,topSchemaRef:_,errSchemaPath:p}}throw new Error('either "keyword" or "schema" must be passed')}e.getSubschema=o;function n(i,c,{dataProp:a,dataPropType:u,data:d,dataTypes:p,propertyName:_}){if(d!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:y}=c;if(a!==void 0){let{errorPath:g,dataPathArr:h,opts:f}=c;m(y.let("data",(0,t._)`${c.data}${(0,t.getProperty)(a)}`,!0)),i.errorPath=(0,t.str)`${g}${(0,r.getErrorPath)(a,u,f.jsPropertySyntax)}`,i.parentDataProperty=(0,t._)`${a}`,i.dataPathArr=[...h,i.parentDataProperty]}d!==void 0&&(m(d instanceof t.Name?d:y.let("data",d,!0)),_!==void 0&&(i.propertyName=_)),p&&(i.dataTypes=p);function m(g){i.data=g,i.dataLevel=c.dataLevel+1,i.dataTypes=[],c.definedProperties=new Set,i.parentData=c.data,i.dataNames=[...c.dataNames,g]}}e.extendSubschemaData=n;function s(i,{jtdDiscriminator:c,jtdMetadata:a,compositeRule:u,createErrors:d,allErrors:p}){u!==void 0&&(i.compositeRule=u),d!==void 0&&(i.createErrors=d),p!==void 0&&(i.allErrors=p),i.jtdDiscriminator=c,i.jtdMetadata=a}e.extendSubschemaMode=s})),$_=U(((e,t)=>{t.exports=function r(o,n){if(o===n)return!0;if(o&&n&&typeof o=="object"&&typeof n=="object"){if(o.constructor!==n.constructor)return!1;var s,i,c;if(Array.isArray(o)){if(s=o.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!r(o[i],n[i]))return!1;return!0}if(o.constructor===RegExp)return o.source===n.source&&o.flags===n.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===n.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===n.toString();if(c=Object.keys(o),s=c.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,c[i]))return!1;for(i=s;i--!==0;){var a=c[i];if(!r(o[a],n[a]))return!1}return!0}return o!==o&&n!==n}})),Yz=U(((e,t)=>{var r=t.exports=function(s,i,c){typeof i=="function"&&(c=i,i={}),c=i.cb||c;var a=typeof c=="function"?c:c.pre||function(){},u=c.post||function(){};o(i,a,u,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 o(s,i,c,a,u,d,p,_,y,m){if(a&&typeof a=="object"&&!Array.isArray(a)){i(a,u,d,p,_,y,m);for(var g in a){var h=a[g];if(Array.isArray(h)){if(g in r.arrayKeywords)for(var f=0;f<h.length;f++)o(s,i,c,h[f],u+"/"+g+"/"+f,d,u,g,a,f)}else if(g in r.propsKeywords){if(h&&typeof h=="object")for(var z in h)o(s,i,c,h[z],u+"/"+g+"/"+n(z),d,u,g,a,z)}else(g in r.keywords||s.allKeys&&!(g in r.skipKeywords))&&o(s,i,c,h,u+"/"+g,d,u,g,a)}c(a,u,d,p,_,y,m)}}function n(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}})),sc=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=_e(),r=$_(),o=Yz(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(h,f=!0){return typeof h=="boolean"?!0:f===!0?!c(h):f?a(h)<=f:!1}e.inlineRef=s;let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(h){for(let f in h){if(i.has(f))return!0;let z=h[f];if(Array.isArray(z)&&z.some(c)||typeof z=="object"&&c(z))return!0}return!1}function a(h){let f=0;for(let z in h){if(z==="$ref")return 1/0;if(f++,!n.has(z)&&(typeof h[z]=="object"&&(0,t.eachItem)(h[z],v=>f+=a(v)),f===1/0))return 1/0}return f}function u(h,f="",z){return z!==!1&&(f=_(f)),d(h,h.parse(f))}e.getFullPath=u;function d(h,f){return h.serialize(f).split("#")[0]+"#"}e._getFullPath=d;let p=/#\/?$/;function _(h){return h?h.replace(p,""):""}e.normalizeId=_;function y(h,f,z){return z=_(z),h.resolve(f,z)}e.resolveUrl=y;let m=/^[a-z_][-a-z0-9._]*$/i;function g(h,f){if(typeof h=="boolean")return{};let{schemaId:z,uriResolver:v}=this.opts,R=_(h[z]||f),w={"":R},b=u(v,R,!1),S={},E=new Set;return o(h,{allKeys:!0},(M,Z,W,G)=>{if(G===void 0)return;let fe=b+Z,$e=w[G];typeof M[z]=="string"&&($e=be.call(this,M[z])),Oe.call(this,M.$anchor),Oe.call(this,M.$dynamicAnchor),w[Z]=$e;function be(he){let k=this.opts.uriResolver.resolve;if(he=_($e?k($e,he):he),E.has(he))throw V(he);E.add(he);let j=this.refs[he];return typeof j=="string"&&(j=this.refs[j]),typeof j=="object"?N(M,j.schema,he):he!==_(fe)&&(he[0]==="#"?(N(M,S[he],he),S[he]=M):this.refs[he]=fe),he}function Oe(he){if(typeof he=="string"){if(!m.test(he))throw new Error(`invalid anchor "${he}"`);be.call(this,`#${he}`)}}}),S;function N(M,Z,W){if(Z!==void 0&&!r(M,Z))throw V(W)}function V(M){return new Error(`reference "${M}" resolves to more than one schema`)}}e.getSchemaRefs=g})),co=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=Bz(),r=oc(),o=R_(),n=oc(),s=Kz(),i=Gz(),c=Wz(),a=le(),u=pt(),d=sc(),p=_e(),_=nc();function y(T){if(b(T)&&(E(T),w(T))){f(T);return}m(T,()=>(0,t.topBoolOrEmptySchema)(T))}e.validateFunctionCode=y;function m({gen:T,validateName:A,schema:D,schemaEnv:se,opts:ie},de){ie.code.es5?T.func(A,(0,a._)`${u.default.data}, ${u.default.valCxt}`,se.$async,()=>{T.code((0,a._)`"use strict"; ${v(D,ie)}`),h(T,ie),T.code(de)}):T.func(A,(0,a._)`${u.default.data}, ${g(ie)}`,se.$async,()=>T.code(v(D,ie)).code(de))}function g(T){return(0,a._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${T.dynamicRef?(0,a._)`, ${u.default.dynamicAnchors}={}`:a.nil}}={}`}function h(T,A){T.if(u.default.valCxt,()=>{T.var(u.default.instancePath,(0,a._)`${u.default.valCxt}.${u.default.instancePath}`),T.var(u.default.parentData,(0,a._)`${u.default.valCxt}.${u.default.parentData}`),T.var(u.default.parentDataProperty,(0,a._)`${u.default.valCxt}.${u.default.parentDataProperty}`),T.var(u.default.rootData,(0,a._)`${u.default.valCxt}.${u.default.rootData}`),A.dynamicRef&&T.var(u.default.dynamicAnchors,(0,a._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{T.var(u.default.instancePath,(0,a._)`""`),T.var(u.default.parentData,(0,a._)`undefined`),T.var(u.default.parentDataProperty,(0,a._)`undefined`),T.var(u.default.rootData,u.default.data),A.dynamicRef&&T.var(u.default.dynamicAnchors,(0,a._)`{}`)})}function f(T){let{schema:A,opts:D,gen:se}=T;m(T,()=>{D.$comment&&A.$comment&&G(T),M(T),se.let(u.default.vErrors,null),se.let(u.default.errors,0),D.unevaluated&&z(T),N(T),fe(T)})}function z(T){let{gen:A,validateName:D}=T;T.evaluated=A.const("evaluated",(0,a._)`${D}.evaluated`),A.if((0,a._)`${T.evaluated}.dynamicProps`,()=>A.assign((0,a._)`${T.evaluated}.props`,(0,a._)`undefined`)),A.if((0,a._)`${T.evaluated}.dynamicItems`,()=>A.assign((0,a._)`${T.evaluated}.items`,(0,a._)`undefined`))}function v(T,A){let D=typeof T=="object"&&T[A.schemaId];return D&&(A.code.source||A.code.process)?(0,a._)`/*# sourceURL=${D} */`:a.nil}function R(T,A){if(b(T)&&(E(T),w(T))){S(T,A);return}(0,t.boolOrEmptySchema)(T,A)}function w({schema:T,self:A}){if(typeof T=="boolean")return!T;for(let D in T)if(A.RULES.all[D])return!0;return!1}function b(T){return typeof T.schema!="boolean"}function S(T,A){let{schema:D,gen:se,opts:ie}=T;ie.$comment&&D.$comment&&G(T),Z(T),W(T);let de=se.const("_errs",u.default.errors);N(T,de),se.var(A,(0,a._)`${de} === ${u.default.errors}`)}function E(T){(0,p.checkUnknownRules)(T),V(T)}function N(T,A){if(T.opts.jtd)return be(T,[],!1,A);let D=(0,r.getSchemaTypes)(T.schema);be(T,D,!(0,r.coerceAndCheckDataType)(T,D),A)}function V(T){let{schema:A,errSchemaPath:D,opts:se,self:ie}=T;A.$ref&&se.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(A,ie.RULES)&&ie.logger.warn(`$ref: keywords ignored in schema at path "${D}"`)}function M(T){let{schema:A,opts:D}=T;A.default!==void 0&&D.useDefaults&&D.strictSchema&&(0,p.checkStrictMode)(T,"default is ignored in the schema root")}function Z(T){let A=T.schema[T.opts.schemaId];A&&(T.baseId=(0,d.resolveUrl)(T.opts.uriResolver,T.baseId,A))}function W(T){if(T.schema.$async&&!T.schemaEnv.$async)throw new Error("async schema in sync schema")}function G({gen:T,schemaEnv:A,schema:D,errSchemaPath:se,opts:ie}){let de=D.$comment;if(ie.$comment===!0)T.code((0,a._)`${u.default.self}.logger.log(${de})`);else if(typeof ie.$comment=="function"){let ke=(0,a.str)`${se}/$comment`,Ne=T.scopeValue("root",{ref:A.root});T.code((0,a._)`${u.default.self}.opts.$comment(${de}, ${ke}, ${Ne}.schema)`)}}function fe(T){let{gen:A,schemaEnv:D,validateName:se,ValidationError:ie,opts:de}=T;D.$async?A.if((0,a._)`${u.default.errors} === 0`,()=>A.return(u.default.data),()=>A.throw((0,a._)`new ${ie}(${u.default.vErrors})`)):(A.assign((0,a._)`${se}.errors`,u.default.vErrors),de.unevaluated&&$e(T),A.return((0,a._)`${u.default.errors} === 0`))}function $e({gen:T,evaluated:A,props:D,items:se}){D instanceof a.Name&&T.assign((0,a._)`${A}.props`,D),se instanceof a.Name&&T.assign((0,a._)`${A}.items`,se)}function be(T,A,D,se){let{gen:ie,schema:de,data:ke,allErrors:Ne,opts:Ze,self:xe}=T,{RULES:we}=xe;if(de.$ref&&(Ze.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(de,we))){ie.block(()=>pe(T,"$ref",we.all.$ref.definition));return}Ze.jtd||he(T,A),ie.block(()=>{for(let Ae of we.rules)ot(Ae);ot(we.post)});function ot(Ae){(0,o.shouldUseGroup)(de,Ae)&&(Ae.type?(ie.if((0,n.checkDataType)(Ae.type,ke,Ze.strictNumbers)),Oe(T,Ae),A.length===1&&A[0]===Ae.type&&D&&(ie.else(),(0,n.reportTypeError)(T)),ie.endIf()):Oe(T,Ae),Ne||ie.if((0,a._)`${u.default.errors} === ${se||0}`))}}function Oe(T,A){let{gen:D,schema:se,opts:{useDefaults:ie}}=T;ie&&(0,s.assignDefaults)(T,A.type),D.block(()=>{for(let de of A.rules)(0,o.shouldUseRule)(se,de)&&pe(T,de.keyword,de.definition,A.type)})}function he(T,A){T.schemaEnv.meta||!T.opts.strictTypes||(k(T,A),T.opts.allowUnionTypes||j(T,A),F(T,T.dataTypes))}function k(T,A){if(A.length){if(!T.dataTypes.length){T.dataTypes=A;return}A.forEach(D=>{C(T.dataTypes,D)||J(T,`type "${D}" not allowed by context "${T.dataTypes.join(",")}"`)}),x(T,A)}}function j(T,A){A.length>1&&!(A.length===2&&A.includes("null"))&&J(T,"use allowUnionTypes to allow union type keyword")}function F(T,A){let D=T.self.RULES.all;for(let se in D){let ie=D[se];if(typeof ie=="object"&&(0,o.shouldUseRule)(T.schema,ie)){let{type:de}=ie.definition;de.length&&!de.some(ke=>$(A,ke))&&J(T,`missing type "${de.join(",")}" for keyword "${se}"`)}}}function $(T,A){return T.includes(A)||A==="number"&&T.includes("integer")}function C(T,A){return T.includes(A)||A==="integer"&&T.includes("number")}function x(T,A){let D=[];for(let se of T.dataTypes)C(A,se)?D.push(se):A.includes("integer")&&se==="number"&&D.push("integer");T.dataTypes=D}function J(T,A){let D=T.schemaEnv.baseId+T.errSchemaPath;A+=` at "${D}" (strictTypes)`,(0,p.checkStrictMode)(T,A,T.opts.strictTypes)}var ee=class{constructor(T,A,D){if((0,i.validateKeywordUsage)(T,A,D),this.gen=T.gen,this.allErrors=T.allErrors,this.keyword=D,this.data=T.data,this.schema=T.schema[D],this.$data=A.$data&&T.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(T,this.schema,D,this.$data),this.schemaType=A.schemaType,this.parentSchema=T.schema,this.params={},this.it=T,this.def=A,this.$data)this.schemaCode=T.gen.const("vSchema",Je(this.$data,T));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,A.schemaType,A.allowUndefined))throw new Error(`${D} value must be ${JSON.stringify(A.schemaType)}`);("code"in A?A.trackErrors:A.errors!==!1)&&(this.errsCount=T.gen.const("_errs",u.default.errors))}result(T,A,D){this.failResult((0,a.not)(T),A,D)}failResult(T,A,D){this.gen.if(T),D?D():this.error(),A?(this.gen.else(),A(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(T,A){this.failResult((0,a.not)(T),void 0,A)}fail(T){if(T===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(T),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(T){if(!this.$data)return this.fail(T);let{schemaCode:A}=this;this.fail((0,a._)`${A} !== undefined && (${(0,a.or)(this.invalid$data(),T)})`)}error(T,A,D){if(A){this.setParams(A),this._error(T,D),this.setParams({});return}this._error(T,D)}_error(T,A){(T?_.reportExtraError:_.reportError)(this,this.def.error,A)}$dataError(){(0,_.reportError)(this,this.def.$dataError||_.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,_.resetErrorsCount)(this.gen,this.errsCount)}ok(T){this.allErrors||this.gen.if(T)}setParams(T,A){A?Object.assign(this.params,T):this.params=T}block$data(T,A,D=a.nil){this.gen.block(()=>{this.check$data(T,D),A()})}check$data(T=a.nil,A=a.nil){if(!this.$data)return;let{gen:D,schemaCode:se,schemaType:ie,def:de}=this;D.if((0,a.or)((0,a._)`${se} === undefined`,A)),T!==a.nil&&D.assign(T,!0),(ie.length||de.validateSchema)&&(D.elseIf(this.invalid$data()),this.$dataError(),T!==a.nil&&D.assign(T,!1)),D.else()}invalid$data(){let{gen:T,schemaCode:A,schemaType:D,def:se,it:ie}=this;return(0,a.or)(de(),ke());function de(){if(D.length){if(!(A instanceof a.Name))throw new Error("ajv implementation error");let Ne=Array.isArray(D)?D:[D];return(0,a._)`${(0,n.checkDataTypes)(Ne,A,ie.opts.strictNumbers,n.DataType.Wrong)}`}return a.nil}function ke(){if(se.validateSchema){let Ne=T.scopeValue("validate$data",{ref:se.validateSchema});return(0,a._)`!${Ne}(${A})`}return a.nil}}subschema(T,A){let D=(0,c.getSubschema)(this.it,T);(0,c.extendSubschemaData)(D,this.it,T),(0,c.extendSubschemaMode)(D,T);let se={...this.it,...D,items:void 0,props:void 0};return R(se,A),se}mergeEvaluated(T,A){let{it:D,gen:se}=this;D.opts.unevaluated&&(D.props!==!0&&T.props!==void 0&&(D.props=p.mergeEvaluated.props(se,T.props,D.props,A)),D.items!==!0&&T.items!==void 0&&(D.items=p.mergeEvaluated.items(se,T.items,D.items,A)))}mergeValidEvaluated(T,A){let{it:D,gen:se}=this;if(D.opts.unevaluated&&(D.props!==!0||D.items!==!0))return se.if(A,()=>this.mergeEvaluated(T,a.Name)),!0}};e.KeywordCxt=ee;function pe(T,A,D,se){let ie=new ee(T,D,A);"code"in D?D.code(ie,se):ie.$data&&D.validate?(0,i.funcKeywordCode)(ie,D):"macro"in D?(0,i.macroKeywordCode)(ie,D):(D.compile||D.validate)&&(0,i.funcKeywordCode)(ie,D)}let ae=/^\/(?:[^~]|~0|~1)*$/,ze=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Je(T,{dataLevel:A,dataNames:D,dataPathArr:se}){let ie,de;if(T==="")return u.default.rootData;if(T[0]==="/"){if(!ae.test(T))throw new Error(`Invalid JSON-pointer: ${T}`);ie=T,de=u.default.rootData}else{let xe=ze.exec(T);if(!xe)throw new Error(`Invalid JSON-pointer: ${T}`);let we=+xe[1];if(ie=xe[2],ie==="#"){if(we>=A)throw new Error(Ze("property/index",we));return se[A-we]}if(we>A)throw new Error(Ze("data",we));if(de=D[A-we],!ie)return de}let ke=de,Ne=ie.split("/");for(let xe of Ne)xe&&(de=(0,a._)`${de}${(0,a.getProperty)((0,p.unescapeJsonPointer)(xe))}`,ke=(0,a._)`${ke} && ${de}`);return ke;function Ze(xe,we){return`Cannot access ${xe} ${we} levels up, current level is ${A}`}}e.getData=Je})),Vn=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}};e.default=t})),uo=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=sc();var r=class extends Error{constructor(o,n,s,i){super(i||`can't resolve reference ${s} from id ${n}`),this.missingRef=(0,t.resolveUrl)(o,n,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(o,this.missingRef))}};e.default=r})),ic=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=le(),r=Vn(),o=pt(),n=sc(),s=_e(),i=co();var c=class{constructor(f){var z;this.refs={},this.dynamicAnchors={};let v;typeof f.schema=="object"&&(v=f.schema),this.schema=f.schema,this.schemaId=f.schemaId,this.root=f.root||this,this.baseId=(z=f.baseId)!==null&&z!==void 0?z:(0,n.normalizeId)(v?.[f.schemaId||"$id"]),this.schemaPath=f.schemaPath,this.localRefs=f.localRefs,this.meta=f.meta,this.$async=v?.$async,this.refs={}}};e.SchemaEnv=c;function a(f){let z=p.call(this,f);if(z)return z;let v=(0,n.getFullPath)(this.opts.uriResolver,f.root.baseId),{es5:R,lines:w}=this.opts.code,{ownProperties:b}=this.opts,S=new t.CodeGen(this.scope,{es5:R,lines:w,ownProperties:b}),E;f.$async&&(E=S.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let N=S.scopeName("validate");f.validateName=N;let V={gen:S,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:S.scopeValue("schema",this.opts.code.source===!0?{ref:f.schema,code:(0,t.stringify)(f.schema)}:{ref:f.schema}),validateName:N,ValidationError:E,schema:f.schema,schemaEnv:f,rootId:v,baseId:f.baseId||v,schemaPath:t.nil,errSchemaPath:f.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this},M;try{this._compilations.add(f),(0,i.validateFunctionCode)(V),S.optimize(this.opts.code.optimize);let Z=S.toString();M=`${S.scopeRefs(o.default.scope)}return ${Z}`,this.opts.code.process&&(M=this.opts.code.process(M,f));let W=new Function(`${o.default.self}`,`${o.default.scope}`,M)(this,this.scope.get());if(this.scope.value(N,{ref:W}),W.errors=null,W.schema=f.schema,W.schemaEnv=f,f.$async&&(W.$async=!0),this.opts.code.source===!0&&(W.source={validateName:N,validateCode:Z,scopeValues:S._values}),this.opts.unevaluated){let{props:G,items:fe}=V;W.evaluated={props:G instanceof t.Name?void 0:G,items:fe instanceof t.Name?void 0:fe,dynamicProps:G instanceof t.Name,dynamicItems:fe instanceof t.Name},W.source&&(W.source.evaluated=(0,t.stringify)(W.evaluated))}return f.validate=W,f}catch(Z){throw delete f.validate,delete f.validateName,M&&this.logger.error("Error compiling schema, function code:",M),Z}finally{this._compilations.delete(f)}}e.compileSchema=a;function u(f,z,v){var R;v=(0,n.resolveUrl)(this.opts.uriResolver,z,v);let w=f.refs[v];if(w)return w;let b=y.call(this,f,v);if(b===void 0){let S=(R=f.localRefs)===null||R===void 0?void 0:R[v],{schemaId:E}=this.opts;S&&(b=new c({schema:S,schemaId:E,root:f,baseId:z}))}if(b!==void 0)return f.refs[v]=d.call(this,b)}e.resolveRef=u;function d(f){return(0,n.inlineRef)(f.schema,this.opts.inlineRefs)?f.schema:f.validate?f:a.call(this,f)}function p(f){for(let z of this._compilations)if(_(z,f))return z}e.getCompilingSchema=p;function _(f,z){return f.schema===z.schema&&f.root===z.root&&f.baseId===z.baseId}function y(f,z){let v;for(;typeof(v=this.refs[z])=="string";)z=v;return v||this.schemas[z]||m.call(this,f,z)}function m(f,z){let v=this.opts.uriResolver.parse(z),R=(0,n._getFullPath)(this.opts.uriResolver,v),w=(0,n.getFullPath)(this.opts.uriResolver,f.baseId,void 0);if(Object.keys(f.schema).length>0&&R===w)return h.call(this,v,f);let b=(0,n.normalizeId)(R),S=this.refs[b]||this.schemas[b];if(typeof S=="string"){let E=m.call(this,f,S);return typeof E?.schema!="object"?void 0:h.call(this,v,E)}if(typeof S?.schema=="object"){if(S.validate||a.call(this,S),b===(0,n.normalizeId)(z)){let{schema:E}=S,{schemaId:N}=this.opts,V=E[N];return V&&(w=(0,n.resolveUrl)(this.opts.uriResolver,w,V)),new c({schema:E,schemaId:N,root:f,baseId:w})}return h.call(this,v,S)}}e.resolveSchema=m;let g=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function h(f,{baseId:z,schema:v,root:R}){var w;if(((w=f.fragment)===null||w===void 0?void 0:w[0])!=="/")return;for(let E of f.fragment.slice(1).split("/")){if(typeof v=="boolean")return;let N=v[(0,s.unescapeFragment)(E)];if(N===void 0)return;v=N;let V=typeof v=="object"&&v[this.opts.schemaId];!g.has(E)&&V&&(z=(0,n.resolveUrl)(this.opts.uriResolver,z,V))}let b;if(typeof v!="boolean"&&v.$ref&&!(0,s.schemaHasRulesButRef)(v,this.RULES)){let E=(0,n.resolveUrl)(this.opts.uriResolver,z,v.$ref);b=m.call(this,R,E)}let{schemaId:S}=this.opts;if(b=b||new c({schema:v,schemaId:S,root:R,baseId:z}),b.schema!==b.root.schema)return b}})),Xz=U(((e,t)=>{t.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}})),w_=U(((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=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 n(m){let g="",h=0,f=0;for(f=0;f<m.length;f++)if(h=m[f].charCodeAt(0),h!==48){if(!(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102))return"";g+=m[f];break}for(f+=1;f<m.length;f++){if(h=m[f].charCodeAt(0),!(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102))return"";g+=m[f]}return g}let s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(m){return m.length=0,!0}function c(m,g,h){if(m.length){let f=n(m);if(f!=="")g.push(f);else return h.error=!0,!1;m.length=0}return!0}function a(m){let g=0,h={error:!1,address:"",zone:""},f=[],z=[],v=!1,R=!1,w=c;for(let b=0;b<m.length;b++){let S=m[b];if(!(S==="["||S==="]"))if(S===":"){if(v===!0&&(R=!0),!w(z,f,h))break;if(++g>7){h.error=!0;break}b>0&&m[b-1]===":"&&(v=!0),f.push(":");continue}else if(S==="%"){if(!w(z,f,h))break;w=i}else{z.push(S);continue}}return z.length&&(w===i?h.zone=z.join(""):R?f.push(z.join("")):f.push(n(z))),h.address=f.join(""),h}function u(m){if(d(m,":")<2)return{host:m,isIPV6:!1};let g=a(m);if(g.error)return{host:m,isIPV6:!1};{let h=g.address,f=g.address;return g.zone&&(h+="%"+g.zone,f+="%25"+g.zone),{host:h,isIPV6:!0,escapedHost:f}}}function d(m,g){let h=0;for(let f=0;f<m.length;f++)m[f]===g&&h++;return h}function p(m){let g=m,h=[],f=-1,z=0;for(;z=g.length;){if(z===1){if(g===".")break;if(g==="/"){h.push("/");break}else{h.push(g);break}}else if(z===2){if(g[0]==="."){if(g[1]===".")break;if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&(g[1]==="."||g[1]==="/")){h.push("/");break}}else if(z===3&&g==="/.."){h.length!==0&&h.pop(),h.push("/");break}if(g[0]==="."){if(g[1]==="."){if(g[2]==="/"){g=g.slice(3);continue}}else if(g[1]==="/"){g=g.slice(2);continue}}else if(g[0]==="/"&&g[1]==="."){if(g[2]==="/"){g=g.slice(2);continue}else if(g[2]==="."&&g[3]==="/"){g=g.slice(3),h.length!==0&&h.pop();continue}}if((f=g.indexOf("/",1))===-1){h.push(g);break}else h.push(g.slice(0,f)),g=g.slice(f)}return h.join("")}function _(m,g){let h=g!==!0?escape:unescape;return m.scheme!==void 0&&(m.scheme=h(m.scheme)),m.userinfo!==void 0&&(m.userinfo=h(m.userinfo)),m.host!==void 0&&(m.host=h(m.host)),m.path!==void 0&&(m.path=h(m.path)),m.query!==void 0&&(m.query=h(m.query)),m.fragment!==void 0&&(m.fragment=h(m.fragment)),m}function y(m){let g=[];if(m.userinfo!==void 0&&(g.push(m.userinfo),g.push("@")),m.host!==void 0){let h=unescape(m.host);if(!o(h)){let f=u(h);f.isIPV6===!0?h=`[${f.escapedHost}]`:h=m.host}g.push(h)}return(typeof m.port=="number"||typeof m.port=="string")&&(g.push(":"),g.push(String(m.port))),g.length?g.join(""):void 0}t.exports={nonSimpleDomain:s,recomposeAuthority:y,normalizeComponentEncoding:_,removeDotSegments:p,isIPv4:o,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:n}})),Qz=U(((e,t)=>{let{isUUID:r}=w_(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function s(S){return n.indexOf(S)!==-1}function i(S){return S.secure===!0?!0:S.secure===!1?!1:S.scheme?S.scheme.length===3&&(S.scheme[0]==="w"||S.scheme[0]==="W")&&(S.scheme[1]==="s"||S.scheme[1]==="S")&&(S.scheme[2]==="s"||S.scheme[2]==="S"):!1}function c(S){return S.host||(S.error=S.error||"HTTP URIs must have a host."),S}function a(S){let E=String(S.scheme).toLowerCase()==="https";return(S.port===(E?443:80)||S.port==="")&&(S.port=void 0),S.path||(S.path="/"),S}function u(S){return S.secure=i(S),S.resourceName=(S.path||"/")+(S.query?"?"+S.query:""),S.path=void 0,S.query=void 0,S}function d(S){if((S.port===(i(S)?443:80)||S.port==="")&&(S.port=void 0),typeof S.secure=="boolean"&&(S.scheme=S.secure?"wss":"ws",S.secure=void 0),S.resourceName){let[E,N]=S.resourceName.split("?");S.path=E&&E!=="/"?E:void 0,S.query=N,S.resourceName=void 0}return S.fragment=void 0,S}function p(S,E){if(!S.path)return S.error="URN can not be parsed",S;let N=S.path.match(o);if(N){let V=E.scheme||S.scheme||"urn";S.nid=N[1].toLowerCase(),S.nss=N[2];let M=b(`${V}:${E.nid||S.nid}`);S.path=void 0,M&&(S=M.parse(S,E))}else S.error=S.error||"URN can not be parsed.";return S}function _(S,E){if(S.nid===void 0)throw new Error("URN without nid cannot be serialized");let N=E.scheme||S.scheme||"urn",V=S.nid.toLowerCase(),M=b(`${N}:${E.nid||V}`);M&&(S=M.serialize(S,E));let Z=S,W=S.nss;return Z.path=`${V||E.nid}:${W}`,E.skipEscape=!0,Z}function y(S,E){let N=S;return N.uuid=N.nss,N.nss=void 0,!E.tolerant&&(!N.uuid||!r(N.uuid))&&(N.error=N.error||"UUID is not valid."),N}function m(S){let E=S;return E.nss=(S.uuid||"").toLowerCase(),E}let g={scheme:"http",domainHost:!0,parse:c,serialize:a},h={scheme:"https",domainHost:g.domainHost,parse:c,serialize:a},f={scheme:"ws",domainHost:!0,parse:u,serialize:d},z={scheme:"wss",domainHost:f.domainHost,parse:f.parse,serialize:f.serialize},w={http:g,https:h,ws:f,wss:z,urn:{scheme:"urn",parse:p,serialize:_,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:y,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(w,null);function b(S){return S&&(w[S]||w[S.toLowerCase()])||void 0}t.exports={wsIsSecure:i,SCHEMES:w,isValidSchemeName:s,getSchemeHandler:b}})),e0=U(((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:n,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:c}=w_(),{SCHEMES:a,getSchemeHandler:u}=Qz();function d(z,v){return typeof z=="string"?z=m(h(z,v),v):typeof z=="object"&&(z=h(m(z,v),v)),z}function p(z,v,R){let w=R?Object.assign({scheme:"null"},R):{scheme:"null"},b=_(h(z,w),h(v,w),w,!0);return w.skipEscape=!0,m(b,w)}function _(z,v,R,w){let b={};return w||(z=h(m(z,R),R),v=h(m(v,R),R)),R=R||{},!R.tolerant&&v.scheme?(b.scheme=v.scheme,b.userinfo=v.userinfo,b.host=v.host,b.port=v.port,b.path=o(v.path||""),b.query=v.query):(v.userinfo!==void 0||v.host!==void 0||v.port!==void 0?(b.userinfo=v.userinfo,b.host=v.host,b.port=v.port,b.path=o(v.path||""),b.query=v.query):(v.path?(v.path[0]==="/"?b.path=o(v.path):((z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)&&!z.path?b.path="/"+v.path:z.path?b.path=z.path.slice(0,z.path.lastIndexOf("/")+1)+v.path:b.path=v.path,b.path=o(b.path)),b.query=v.query):(b.path=z.path,v.query!==void 0?b.query=v.query:b.query=z.query),b.userinfo=z.userinfo,b.host=z.host,b.port=z.port),b.scheme=z.scheme),b.fragment=v.fragment,b}function y(z,v,R){return typeof z=="string"?(z=unescape(z),z=m(s(h(z,R),!0),{...R,skipEscape:!0})):typeof z=="object"&&(z=m(s(z,!0),{...R,skipEscape:!0})),typeof v=="string"?(v=unescape(v),v=m(s(h(v,R),!0),{...R,skipEscape:!0})):typeof v=="object"&&(v=m(s(v,!0),{...R,skipEscape:!0})),z.toLowerCase()===v.toLowerCase()}function m(z,v){let R={host:z.host,scheme:z.scheme,userinfo:z.userinfo,port:z.port,path:z.path,query:z.query,nid:z.nid,nss:z.nss,uuid:z.uuid,fragment:z.fragment,reference:z.reference,resourceName:z.resourceName,secure:z.secure,error:""},w=Object.assign({},v),b=[],S=u(w.scheme||R.scheme);S&&S.serialize&&S.serialize(R,w),R.path!==void 0&&(w.skipEscape?R.path=unescape(R.path):(R.path=escape(R.path),R.scheme!==void 0&&(R.path=R.path.split("%3A").join(":")))),w.reference!=="suffix"&&R.scheme&&b.push(R.scheme,":");let E=n(R);if(E!==void 0&&(w.reference!=="suffix"&&b.push("//"),b.push(E),R.path&&R.path[0]!=="/"&&b.push("/")),R.path!==void 0){let N=R.path;!w.absolutePath&&(!S||!S.absolutePath)&&(N=o(N)),E===void 0&&N[0]==="/"&&N[1]==="/"&&(N="/%2F"+N.slice(2)),b.push(N)}return R.query!==void 0&&b.push("?",R.query),R.fragment!==void 0&&b.push("#",R.fragment),b.join("")}let g=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(z,v){let R=Object.assign({},v),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},b=!1;R.reference==="suffix"&&(R.scheme?z=R.scheme+":"+z:z="//"+z);let S=z.match(g);if(S){if(w.scheme=S[1],w.userinfo=S[3],w.host=S[4],w.port=parseInt(S[5],10),w.path=S[6]||"",w.query=S[7],w.fragment=S[8],isNaN(w.port)&&(w.port=S[5]),w.host)if(i(w.host)===!1){let N=r(w.host);w.host=N.host.toLowerCase(),b=N.isIPV6}else b=!0;w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path?w.reference="same-document":w.scheme===void 0?w.reference="relative":w.fragment===void 0?w.reference="absolute":w.reference="uri",R.reference&&R.reference!=="suffix"&&R.reference!==w.reference&&(w.error=w.error||"URI is not a "+R.reference+" reference.");let E=u(R.scheme||w.scheme);if(!R.unicodeSupport&&(!E||!E.unicodeSupport)&&w.host&&(R.domainHost||E&&E.domainHost)&&b===!1&&c(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(N){w.error=w.error||"Host's domain name can not be converted to ASCII: "+N}(!E||E&&!E.skipNormalize)&&(z.indexOf("%")!==-1&&(w.scheme!==void 0&&(w.scheme=unescape(w.scheme)),w.host!==void 0&&(w.host=unescape(w.host))),w.path&&(w.path=escape(unescape(w.path))),w.fragment&&(w.fragment=encodeURI(decodeURIComponent(w.fragment)))),E&&E.parse&&E.parse(w,R)}else w.error=w.error||"URI can not be parsed.";return w}let f={SCHEMES:a,normalize:d,resolve:p,resolveComponent:_,equal:y,serialize:m,parse:h};t.exports=f,t.exports.default=f,t.exports.fastUri=f})),t0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=e0();t.code='require("ajv/dist/runtime/uri").default',e.default=t})),nd=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=co();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=le();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=Vn(),n=uo(),s=z_(),i=ic(),c=le(),a=sc(),u=oc(),d=_e(),p=Xz(),_=t0(),y=(k,j)=>new RegExp(k,j);y.code="new RegExp";let m=["removeAdditional","useDefaults","coerceTypes"],g=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),h={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."},f={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},z=200;function v(k){var j,F,$,C,x,J,ee,pe,ae,ze,Je,T,A,D,se,ie,de,ke,Ne,Ze,xe,we,ot,Ae,ht;let at=k.strict,gt=(j=k.code)===null||j===void 0?void 0:j.optimize,It=gt===!0||gt===void 0?1:gt||0,Ot=($=(F=k.code)===null||F===void 0?void 0:F.regExp)!==null&&$!==void 0?$:y,Yt=(C=k.uriResolver)!==null&&C!==void 0?C:_.default;return{strictSchema:(J=(x=k.strictSchema)!==null&&x!==void 0?x:at)!==null&&J!==void 0?J:!0,strictNumbers:(pe=(ee=k.strictNumbers)!==null&&ee!==void 0?ee:at)!==null&&pe!==void 0?pe:!0,strictTypes:(ze=(ae=k.strictTypes)!==null&&ae!==void 0?ae:at)!==null&&ze!==void 0?ze:"log",strictTuples:(T=(Je=k.strictTuples)!==null&&Je!==void 0?Je:at)!==null&&T!==void 0?T:"log",strictRequired:(D=(A=k.strictRequired)!==null&&A!==void 0?A:at)!==null&&D!==void 0?D:!1,code:k.code?{...k.code,optimize:It,regExp:Ot}:{optimize:It,regExp:Ot},loopRequired:(se=k.loopRequired)!==null&&se!==void 0?se:z,loopEnum:(ie=k.loopEnum)!==null&&ie!==void 0?ie:z,meta:(de=k.meta)!==null&&de!==void 0?de:!0,messages:(ke=k.messages)!==null&&ke!==void 0?ke:!0,inlineRefs:(Ne=k.inlineRefs)!==null&&Ne!==void 0?Ne:!0,schemaId:(Ze=k.schemaId)!==null&&Ze!==void 0?Ze:"$id",addUsedSchema:(xe=k.addUsedSchema)!==null&&xe!==void 0?xe:!0,validateSchema:(we=k.validateSchema)!==null&&we!==void 0?we:!0,validateFormats:(ot=k.validateFormats)!==null&&ot!==void 0?ot:!0,unicodeRegExp:(Ae=k.unicodeRegExp)!==null&&Ae!==void 0?Ae:!0,int32range:(ht=k.int32range)!==null&&ht!==void 0?ht:!0,uriResolver:Yt}}var R=class{constructor(k={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,...v(k)};let{es5:j,lines:F}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:g,es5:j,lines:F}),this.logger=Z(k.logger);let $=k.validateFormats;k.validateFormats=!1,this.RULES=(0,s.getRules)(),w.call(this,h,k,"NOT SUPPORTED"),w.call(this,f,k,"DEPRECATED","warn"),this._metaOpts=V.call(this),k.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords&&N.call(this,k.keywords),typeof k.meta=="object"&&this.addMetaSchema(k.meta),S.call(this),k.validateFormats=$}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:k,meta:j,schemaId:F}=this.opts,$=p;F==="id"&&($={...p},$.id=$.$id,delete $.$id),j&&k&&this.addMetaSchema($,$[F],!1)}defaultMeta(){let{meta:k,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[j]||k:void 0}validate(k,j){let F;if(typeof k=="string"){if(F=this.getSchema(k),!F)throw new Error(`no schema with key or ref "${k}"`)}else F=this.compile(k);let $=F(j);return"$async"in F||(this.errors=F.errors),$}compile(k,j){let F=this._addSchema(k,j);return F.validate||this._compileSchemaEnv(F)}compileAsync(k,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:F}=this.opts;return $.call(this,k,j);async function $(ae,ze){await C.call(this,ae.$schema);let Je=this._addSchema(ae,ze);return Je.validate||x.call(this,Je)}async function C(ae){ae&&!this.getSchema(ae)&&await $.call(this,{$ref:ae},!0)}async function x(ae){try{return this._compileSchemaEnv(ae)}catch(ze){if(!(ze instanceof n.default))throw ze;return J.call(this,ze),await ee.call(this,ze.missingSchema),x.call(this,ae)}}function J({missingSchema:ae,missingRef:ze}){if(this.refs[ae])throw new Error(`AnySchema ${ae} is loaded but ${ze} cannot be resolved`)}async function ee(ae){let ze=await pe.call(this,ae);this.refs[ae]||await C.call(this,ze.$schema),this.refs[ae]||this.addSchema(ze,ae,j)}async function pe(ae){let ze=this._loading[ae];if(ze)return ze;try{return await(this._loading[ae]=F(ae))}finally{delete this._loading[ae]}}}addSchema(k,j,F,$=this.opts.validateSchema){if(Array.isArray(k)){for(let x of k)this.addSchema(x,void 0,F,$);return this}let C;if(typeof k=="object"){let{schemaId:x}=this.opts;if(C=k[x],C!==void 0&&typeof C!="string")throw new Error(`schema ${x} must be string`)}return j=(0,a.normalizeId)(j||C),this._checkUnique(j),this.schemas[j]=this._addSchema(k,F,j,$,!0),this}addMetaSchema(k,j,F=this.opts.validateSchema){return this.addSchema(k,j,!0,F),this}validateSchema(k,j){if(typeof k=="boolean")return!0;let F;if(F=k.$schema,F!==void 0&&typeof F!="string")throw new Error("$schema must be a string");if(F=F||this.opts.defaultMeta||this.defaultMeta(),!F)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let $=this.validate(F,k);if(!$&&j){let C="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(C);else throw new Error(C)}return $}getSchema(k){let j;for(;typeof(j=b.call(this,k))=="string";)k=j;if(j===void 0){let{schemaId:F}=this.opts,$=new i.SchemaEnv({schema:{},schemaId:F});if(j=i.resolveSchema.call(this,$,k),!j)return;this.refs[k]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(k){if(k instanceof RegExp)return this._removeAllSchemas(this.schemas,k),this._removeAllSchemas(this.refs,k),this;switch(typeof k){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let j=b.call(this,k);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[k],delete this.refs[k],this}case"object":{let j=k;this._cache.delete(j);let F=k[this.opts.schemaId];return F&&(F=(0,a.normalizeId)(F),delete this.schemas[F],delete this.refs[F]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(k){for(let j of k)this.addKeyword(j);return this}addKeyword(k,j){let F;if(typeof k=="string")F=k,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=F);else if(typeof k=="object"&&j===void 0){if(j=k,F=j.keyword,Array.isArray(F)&&!F.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(G.call(this,F,j),!j)return(0,d.eachItem)(F,C=>fe.call(this,C)),this;be.call(this,j);let $={...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)};return(0,d.eachItem)(F,$.type.length===0?C=>fe.call(this,C,$):C=>$.type.forEach(x=>fe.call(this,C,$,x))),this}getKeyword(k){let j=this.RULES.all[k];return typeof j=="object"?j.definition:!!j}removeKeyword(k){let{RULES:j}=this;delete j.keywords[k],delete j.all[k];for(let F of j.rules){let $=F.rules.findIndex(C=>C.keyword===k);$>=0&&F.rules.splice($,1)}return this}addFormat(k,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[k]=j,this}errorsText(k=this.errors,{separator:j=", ",dataVar:F="data"}={}){return!k||k.length===0?"No errors":k.map($=>`${F}${$.instancePath} ${$.message}`).reduce(($,C)=>$+j+C)}$dataMetaSchema(k,j){let F=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(let $ of j){let C=$.split("/").slice(1),x=k;for(let J of C)x=x[J];for(let J in F){let ee=F[J];if(typeof ee!="object")continue;let{$data:pe}=ee.definition,ae=x[J];pe&&ae&&(x[J]=he(ae))}}return k}_removeAllSchemas(k,j){for(let F in k){let $=k[F];(!j||j.test(F))&&(typeof $=="string"?delete k[F]:$&&!$.meta&&(this._cache.delete($.schema),delete k[F]))}}_addSchema(k,j,F,$=this.opts.validateSchema,C=this.opts.addUsedSchema){let x,{schemaId:J}=this.opts;if(typeof k=="object")x=k[J];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof k!="boolean")throw new Error("schema must be object or boolean")}let ee=this._cache.get(k);if(ee!==void 0)return ee;F=(0,a.normalizeId)(x||F);let pe=a.getSchemaRefs.call(this,k,F);return ee=new i.SchemaEnv({schema:k,schemaId:J,meta:j,baseId:F,localRefs:pe}),this._cache.set(ee.schema,ee),C&&!F.startsWith("#")&&(F&&this._checkUnique(F),this.refs[F]=ee),$&&this.validateSchema(k,!0),ee}_checkUnique(k){if(this.schemas[k]||this.refs[k])throw new Error(`schema with key or id "${k}" already exists`)}_compileSchemaEnv(k){if(k.meta?this._compileMetaSchema(k):i.compileSchema.call(this,k),!k.validate)throw new Error("ajv implementation error");return k.validate}_compileMetaSchema(k){let j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,k)}finally{this.opts=j}}};R.ValidationError=o.default,R.MissingRefError=n.default,e.default=R;function w(k,j,F,$="error"){for(let C in k){let x=C;x in j&&this.logger[$](`${F}: option ${C}. ${k[x]}`)}}function b(k){return k=(0,a.normalizeId)(k),this.schemas[k]||this.refs[k]}function S(){let k=this.opts.schemas;if(k)if(Array.isArray(k))this.addSchema(k);else for(let j in k)this.addSchema(k[j],j)}function E(){for(let k in this.opts.formats){let j=this.opts.formats[k];j&&this.addFormat(k,j)}}function N(k){if(Array.isArray(k)){this.addVocabulary(k);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let j in k){let F=k[j];F.keyword||(F.keyword=j),this.addKeyword(F)}}function V(){let k={...this.opts};for(let j of m)delete k[j];return k}let M={log(){},warn(){},error(){}};function Z(k){if(k===!1)return M;if(k===void 0)return console;if(k.log&&k.warn&&k.error)return k;throw new Error("logger must implement log, warn and error methods")}let W=/^[a-z_$][a-z0-9_$:-]*$/i;function G(k,j){let{RULES:F}=this;if((0,d.eachItem)(k,$=>{if(F.keywords[$])throw new Error(`Keyword ${$} is already defined`);if(!W.test($))throw new Error(`Keyword ${$} has invalid name`)}),!!j&&j.$data&&!("code"in j||"validate"in j))throw new Error('$data keyword must have "code" or "validate" function')}function fe(k,j,F){var $;let C=j?.post;if(F&&C)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:x}=this,J=C?x.post:x.rules.find(({type:pe})=>pe===F);if(J||(J={type:F,rules:[]},x.rules.push(J)),x.keywords[k]=!0,!j)return;let ee={keyword:k,definition:{...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)}};j.before?$e.call(this,J,ee,j.before):J.rules.push(ee),x.all[k]=ee,($=j.implements)===null||$===void 0||$.forEach(pe=>this.addKeyword(pe))}function $e(k,j,F){let $=k.rules.findIndex(C=>C.keyword===F);$>=0?k.rules.splice($,0,j):(k.rules.push(j),this.logger.warn(`rule ${F} is not defined`))}function be(k){let{metaSchema:j}=k;j!==void 0&&(k.$data&&this.opts.$data&&(j=he(j)),k.validateSchema=this.compile(j,!0))}let Oe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function he(k){return{anyOf:[k,Oe]}}})),r0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t})),sd=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=uo(),r=mt(),o=le(),n=pt(),s=ic(),i=_e(),c={keyword:"$ref",schemaType:"string",code(d){let{gen:p,schema:_,it:y}=d,{baseId:m,schemaEnv:g,validateName:h,opts:f,self:z}=y,{root:v}=g;if((_==="#"||_==="#/")&&m===v.baseId)return w();let R=s.resolveRef.call(z,v,m,_);if(R===void 0)throw new t.default(y.opts.uriResolver,m,_);if(R instanceof s.SchemaEnv)return b(R);return S(R);function w(){if(g===v)return u(d,h,g,g.$async);let E=p.scopeValue("root",{ref:v});return u(d,(0,o._)`${E}.validate`,v,v.$async)}function b(E){u(d,a(d,E),E,E.$async)}function S(E){let N=p.scopeValue("schema",f.code.source===!0?{ref:E,code:(0,o.stringify)(E)}:{ref:E}),V=p.name("valid"),M=d.subschema({schema:E,dataTypes:[],schemaPath:o.nil,topSchemaRef:N,errSchemaPath:_},V);d.mergeEvaluated(M),d.ok(V)}}};function a(d,p){let{gen:_}=d;return p.validate?_.scopeValue("validate",{ref:p.validate}):(0,o._)`${_.scopeValue("wrapper",{ref:p})}.validate`}e.getValidate=a;function u(d,p,_,y){let{gen:m,it:g}=d,{allErrors:h,schemaEnv:f,opts:z}=g,v=z.passContext?n.default.this:o.nil;y?R():w();function R(){if(!f.$async)throw new Error("async schema referenced by sync schema");let E=m.let("valid");m.try(()=>{m.code((0,o._)`await ${(0,r.callValidateCode)(d,p,v)}`),S(p),h||m.assign(E,!0)},N=>{m.if((0,o._)`!(${N} instanceof ${g.ValidationError})`,()=>m.throw(N)),b(N),h||m.assign(E,!1)}),d.ok(E)}function w(){d.result((0,r.callValidateCode)(d,p,v),()=>S(p),()=>b(p))}function b(E){let N=(0,o._)`${E}.errors`;m.assign(n.default.vErrors,(0,o._)`${n.default.vErrors} === null ? ${N} : ${n.default.vErrors}.concat(${N})`),m.assign(n.default.errors,(0,o._)`${n.default.vErrors}.length`)}function S(E){var N;if(!g.opts.unevaluated)return;let V=(N=_?.validate)===null||N===void 0?void 0:N.evaluated;if(g.props!==!0)if(V&&!V.dynamicProps)V.props!==void 0&&(g.props=i.mergeEvaluated.props(m,V.props,g.props));else{let M=m.var("props",(0,o._)`${E}.evaluated.props`);g.props=i.mergeEvaluated.props(m,M,g.props,o.Name)}if(g.items!==!0)if(V&&!V.dynamicItems)V.items!==void 0&&(g.items=i.mergeEvaluated.items(m,V.items,g.items));else{let M=m.var("items",(0,o._)`${E}.evaluated.items`);g.items=i.mergeEvaluated.items(m,M,g.items,o.Name)}}}e.callRef=u,e.default=c})),P_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=r0(),r=sd(),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=o})),o0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:s,schemaCode:i})=>(0,t.str)`must be ${o[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>(0,t._)`{comparison: ${o[s].okStr}, limit: ${i}}`},code(s){let{keyword:i,data:c,schemaCode:a}=s;s.fail$data((0,t._)`${c} ${o[i].fail} ${a} || isNaN(${c})`)}};e.default=n})),n0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must be multiple of ${o}`,params:({schemaCode:o})=>(0,t._)`{multipleOf: ${o}}`},code(o){let{gen:n,data:s,schemaCode:i,it:c}=o,a=c.opts.multipleOfPrecision,u=n.let("res"),d=a?(0,t._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${a}`:(0,t._)`${u} !== parseInt(${u})`;o.fail$data((0,t._)`(${i} === 0 || (${u} = ${s}/${i}, ${d}))`)}};e.default=r})),s0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let o=r.length,n=0,s=0,i;for(;s<o;)n++,i=r.charCodeAt(s++),i>=55296&&i<=56319&&s<o&&(i=r.charCodeAt(s),(i&64512)===56320&&s++);return n}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'})),i0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=s0(),n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){let c=s==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${c} than ${i} characters`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){let{keyword:i,data:c,schemaCode:a,it:u}=s,d=i==="maxLength"?t.operators.GT:t.operators.LT,p=u.opts.unicode===!1?(0,t._)`${c}.length`:(0,t._)`${(0,r.useFunc)(s.gen,o.default)}(${c})`;s.fail$data((0,t._)`${p} ${d} ${a}`)}};e.default=n})),a0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=_e(),o=le(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,o.str)`must match pattern "${s}"`,params:({schemaCode:s})=>(0,o._)`{pattern: ${s}}`},code(s){let{gen:i,data:c,$data:a,schema:u,schemaCode:d,it:p}=s,_=p.opts.unicodeRegExp?"u":"";if(a){let{regExp:y}=p.opts.code,m=y.code==="new RegExp"?(0,o._)`new RegExp`:(0,r.useFunc)(i,y),g=i.let("valid");i.try(()=>i.assign(g,(0,o._)`${m}(${d}, ${_}).test(${c})`),()=>i.assign(g,!1)),s.fail$data((0,o._)`!${g}`)}else{let y=(0,t.usePattern)(s,u);s.fail$data((0,o._)`!${y}.test(${c})`)}}};e.default=n})),c0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} properties`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,c=n==="maxProperties"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`Object.keys(${s}).length ${c} ${i}`)}};e.default=r})),u0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=le(),o=_e(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,r.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,r._)`{missingProperty: ${s}}`},code(s){let{gen:i,schema:c,schemaCode:a,data:u,$data:d,it:p}=s,{opts:_}=p;if(!d&&c.length===0)return;let y=c.length>=_.loopRequired;if(p.allErrors?m():g(),_.strictRequired){let z=s.parentSchema.properties,{definedProperties:v}=s.it;for(let R of c)if(z?.[R]===void 0&&!v.has(R)){let w=`required property "${R}" is not defined at "${p.schemaEnv.baseId+p.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(p,w,p.opts.strictRequired)}}function m(){if(y||d)s.block$data(r.nil,h);else for(let z of c)(0,t.checkReportMissingProp)(s,z)}function g(){let z=i.let("missing");if(y||d){let v=i.let("valid",!0);s.block$data(v,()=>f(z,v)),s.ok(v)}else i.if((0,t.checkMissingProp)(s,c,z)),(0,t.reportMissingProp)(s,z),i.else()}function h(){i.forOf("prop",a,z=>{s.setParams({missingProperty:z}),i.if((0,t.noPropertyInData)(i,u,z,_.ownProperties),()=>s.error())})}function f(z,v){s.setParams({missingProperty:z}),i.forOf(z,a,()=>{i.assign(v,(0,t.propertyInData)(i,u,z,_.ownProperties)),i.if((0,r.not)(v),()=>{s.error(),i.break()})},r.nil)}}};e.default=n})),l0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} items`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,c=n==="maxItems"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`${s}.length ${c} ${i}`)}};e.default=r})),id=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=$_();t.code='require("ajv/dist/runtime/equal").default',e.default=t})),d0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=oc(),r=le(),o=_e(),n=id(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:c}})=>(0,r.str)`must NOT have duplicate items (items ## ${c} and ${i} are identical)`,params:({params:{i,j:c}})=>(0,r._)`{i: ${i}, j: ${c}}`},code(i){let{gen:c,data:a,$data:u,schema:d,parentSchema:p,schemaCode:_,it:y}=i;if(!u&&!d)return;let m=c.let("valid"),g=p.items?(0,t.getSchemaTypes)(p.items):[];i.block$data(m,h,(0,r._)`${_} === false`),i.ok(m);function h(){let R=c.let("i",(0,r._)`${a}.length`),w=c.let("j");i.setParams({i:R,j:w}),c.assign(m,!0),c.if((0,r._)`${R} > 1`,()=>(f()?z:v)(R,w))}function f(){return g.length>0&&!g.some(R=>R==="object"||R==="array")}function z(R,w){let b=c.name("item"),S=(0,t.checkDataTypes)(g,b,y.opts.strictNumbers,t.DataType.Wrong),E=c.const("indices",(0,r._)`{}`);c.for((0,r._)`;${R}--;`,()=>{c.let(b,(0,r._)`${a}[${R}]`),c.if(S,(0,r._)`continue`),g.length>1&&c.if((0,r._)`typeof ${b} == "string"`,(0,r._)`${b} += "_"`),c.if((0,r._)`typeof ${E}[${b}] == "number"`,()=>{c.assign(w,(0,r._)`${E}[${b}]`),i.error(),c.assign(m,!1).break()}).code((0,r._)`${E}[${b}] = ${R}`)})}function v(R,w){let b=(0,o.useFunc)(c,n.default),S=c.name("outer");c.label(S).for((0,r._)`;${R}--;`,()=>c.for((0,r._)`${w} = ${R}; ${w}--;`,()=>c.if((0,r._)`${b}(${a}[${R}], ${a}[${w}])`,()=>{i.error(),c.assign(m,!1).break(S)})))}}};e.default=s})),p0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=id(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,t._)`{allowedValue: ${s}}`},code(s){let{gen:i,data:c,$data:a,schemaCode:u,schema:d}=s;a||d&&typeof d=="object"?s.fail$data((0,t._)`!${(0,r.useFunc)(i,o.default)}(${c}, ${u})`):s.fail((0,t._)`${d} !== ${c}`)}};e.default=n})),m0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=id(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,t._)`{allowedValues: ${s}}`},code(s){let{gen:i,data:c,$data:a,schema:u,schemaCode:d,it:p}=s;if(!a&&u.length===0)throw new Error("enum must have non-empty array");let _=u.length>=p.opts.loopEnum,y,m=()=>y??(y=(0,r.useFunc)(i,o.default)),g;if(_||a)g=i.let("valid"),s.block$data(g,h);else{if(!Array.isArray(u))throw new Error("ajv implementation error");let z=i.const("vSchema",d);g=(0,t.or)(...u.map((v,R)=>f(z,R)))}s.pass(g);function h(){i.assign(g,!1),i.forOf("v",d,z=>i.if((0,t._)`${m()}(${c}, ${z})`,()=>i.assign(g,!0).break()))}function f(z,v){let R=u[v];return typeof R=="object"&&R!==null?(0,t._)`${m()}(${c}, ${z}[${v}])`:(0,t._)`${c} === ${R}`}}};e.default=n})),E_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=o0(),r=n0(),o=i0(),n=a0(),s=c0(),i=u0(),c=l0(),a=d0(),u=p0(),d=m0(),p=[t.default,r.default,o.default,n.default,s.default,i.default,c.default,a.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default];e.default=p})),T_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=le(),r=_e(),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,t.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,t._)`{limit: ${s}}`},code(s){let{parentSchema:i,it:c}=s,{items:a}=i;if(!Array.isArray(a)){(0,r.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}n(s,a)}};function n(s,i){let{gen:c,schema:a,data:u,keyword:d,it:p}=s;p.items=!0;let _=c.const("len",(0,t._)`${u}.length`);if(a===!1)s.setParams({len:i.length}),s.pass((0,t._)`${_} <= ${i.length}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(p,a)){let m=c.var("valid",(0,t._)`${_} <= ${i.length}`);c.if((0,t.not)(m),()=>y(m)),s.ok(m)}function y(m){c.forRange("i",i.length,_,g=>{s.subschema({keyword:d,dataProp:g,dataPropType:r.Type.Num},m),p.allErrors||c.if((0,t.not)(m),()=>c.break())})}}e.validateAdditionalItems=n,e.default=o})),C_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=le(),r=_e(),o=mt(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){let{schema:c,it:a}=i;if(Array.isArray(c))return s(i,"additionalItems",c);a.items=!0,!(0,r.alwaysValidSchema)(a,c)&&i.ok((0,o.validateArray)(i))}};function s(i,c,a=i.schema){let{gen:u,parentSchema:d,data:p,keyword:_,it:y}=i;h(d),y.opts.unevaluated&&a.length&&y.items!==!0&&(y.items=r.mergeEvaluated.items(u,a.length,y.items));let m=u.name("valid"),g=u.const("len",(0,t._)`${p}.length`);a.forEach((f,z)=>{(0,r.alwaysValidSchema)(y,f)||(u.if((0,t._)`${g} > ${z}`,()=>i.subschema({keyword:_,schemaProp:z,dataProp:z},m)),i.ok(m))});function h(f){let{opts:z,errSchemaPath:v}=y,R=a.length,w=R===f.minItems&&(R===f.maxItems||f[c]===!1);if(z.strictTuples&&!w){let b=`"${_}" is ${R}-tuple, but minItems or maxItems/${c} are not specified or different at path "${v}"`;(0,r.checkStrictMode)(y,b,z.strictTuples)}}}e.validateTuple=s,e.default=n})),f0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=C_(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:o=>(0,t.validateTuple)(o,"items")};e.default=r})),h0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=mt(),n=T_(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){let{schema:c,parentSchema:a,it:u}=i,{prefixItems:d}=a;u.items=!0,!(0,r.alwaysValidSchema)(u,c)&&(d?(0,n.validateAdditionalItems)(i,d):i.ok((0,o.validateArray)(i)))}};e.default=s})),g0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:n,max:s}})=>s===void 0?(0,t.str)`must contain at least ${n} valid item(s)`:(0,t.str)`must contain at least ${n} and no more than ${s} valid item(s)`,params:({params:{min:n,max:s}})=>s===void 0?(0,t._)`{minContains: ${n}}`:(0,t._)`{minContains: ${n}, maxContains: ${s}}`},code(n){let{gen:s,schema:i,parentSchema:c,data:a,it:u}=n,d,p,{minContains:_,maxContains:y}=c;u.opts.next?(d=_===void 0?1:_,p=y):d=1;let m=s.const("len",(0,t._)`${a}.length`);if(n.setParams({min:d,max:p}),p===void 0&&d===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&d>p){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),n.fail();return}if((0,r.alwaysValidSchema)(u,i)){let v=(0,t._)`${m} >= ${d}`;p!==void 0&&(v=(0,t._)`${v} && ${m} <= ${p}`),n.pass(v);return}u.items=!0;let g=s.name("valid");p===void 0&&d===1?f(g,()=>s.if(g,()=>s.break())):d===0?(s.let(g,!0),p!==void 0&&s.if((0,t._)`${a}.length > 0`,h)):(s.let(g,!1),h()),n.result(g,()=>n.reset());function h(){let v=s.name("_valid"),R=s.let("count",0);f(v,()=>s.if(v,()=>z(R)))}function f(v,R){s.forRange("i",0,m,w=>{n.subschema({keyword:"contains",dataProp:w,dataPropType:r.Type.Num,compositeRule:!0},v),R()})}function z(v){s.code((0,t._)`${v}++`),p===void 0?s.if((0,t._)`${v} >= ${d}`,()=>s.assign(g,!0).break()):(s.if((0,t._)`${v} > ${p}`,()=>s.assign(g,!1).break()),d===1?s.assign(g,!0):s.if((0,t._)`${v} >= ${d}`,()=>s.assign(g,!0)))}}};e.default=o})),ad=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=le(),r=_e(),o=mt();e.error={message:({params:{property:a,depsCount:u,deps:d}})=>{let p=u===1?"property":"properties";return(0,t.str)`must have ${p} ${d} when property ${a} is present`},params:({params:{property:a,depsCount:u,deps:d,missingProperty:p}})=>(0,t._)`{property: ${a},
|
|
59
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let c=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(c.cycle){s(i);continue}c.count>1&&e.reused==="ref"&&s(i)}e.external&&(e.sharedDefsExtractedFor=e.external)}function zh(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let o of t){if(!o||typeof o!="object")return;zh(o);let n=Object.keys(o);if(n.length!==1||n[0]!=="type")return;let s=o.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!="string")return;r.includes(i)||r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var Rh=new Set(["type","properties","required","additionalProperties"]),vh=["oneOf","anyOf"];function bh(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function gu(e){let t=[];for(let s of e){if(typeof s!="object"||s.type!=="object")return null;for(let i in s)if(!Rh.has(i))return null;t.push(s)}let r={},o=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let c=[];for(let u of t){let d=u.properties?.[i]??bh(u);d!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(d))||c.push(d))}let a=c.length===1?c[0]:gu(c)??{allOf:c};Ye(r,i,a)}for(let i of s.required??[])o.add(i)}let n={type:"object",properties:r};if(o.size&&(n.required=[...o]),t.every(s=>s.additionalProperties===!1))n.additionalProperties=!1;else{let s=[];for(let i of t){let c=bh(i);c&&!s.some(a=>JSON.stringify(a)===JSON.stringify(c))&&s.push(c)}s.length===1?n.additionalProperties=s[0]:s.length>1&&(n.additionalProperties={allOf:s})}return n}function pv(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let n of Rh)if(n in e)return;let r=t.filter(n=>vh.some(s=>Array.isArray(n[s]))),o=null;if(!r.length)o=gu(t);else{let n=r[0],s=vh.find(a=>Array.isArray(n[a]));if(Object.keys(n).length!==1)return;let i=t.filter(a=>a!==n),c=n[s].map(a=>gu([...i,a]));if(c.some(a=>!a))return;o={[s]:c}}o&&(delete e.allOf,Xo(e,o))}function rn(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=c=>{let a=e.seen.get(c);if(a.ref===null)return;let u=a.def??a.schema,d={...u},p=a.ref;if(a.ref=null,p){o(p);let v=e.seen.get(p),m=v.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Xo(u,m),Xo(u,d),c._zod.parent===p)for(let h in u)h==="$ref"||h==="allOf"||h in d||delete u[h];if(m.$ref&&v.def)for(let h in u)h==="$ref"||h==="allOf"||h in v.def&&JSON.stringify(u[h])===JSON.stringify(v.def[h])&&delete u[h]}let g=c._zod.parent;if(g&&g!==p){o(g);let v=e.seen.get(g);if(v?.schema.$ref&&(u.$ref=v.schema.$ref,v.def))for(let m in u)m==="$ref"||m==="allOf"||m in v.def&&JSON.stringify(u[m])===JSON.stringify(v.def[m])&&delete u[m]}e.override({zodSchema:c,jsonSchema:u,path:a.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())o(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())zh(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let a of e.seen.values())for(let u of[a.schema,a.def]){let d=u?.allOf;if(!Array.isArray(d))continue;let p=c.get(d);p?p.push(u):c.set(d,[u])}for(let a of e.intersections)for(let u of c.get(a)??[])pv(u)}}let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}Xo(n,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,Ye(i,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Qo(t,"input",e.processors),output:Qo(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Ke(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return Ke(o.element,r);if(o.type==="set")return Ke(o.valueType,r);if(o.type==="lazy")return Ke(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return Ke(o.innerType,r);if(o.type==="intersection")return Ke(o.left,r)||Ke(o.right,r);if(o.type==="record"||o.type==="map")return Ke(o.keyType,r)||Ke(o.valueType,r);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ke(o.in,r)||Ke(o.out,r);if(o.type==="object"){for(let n in o.shape)if(Ke(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(Ke(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(Ke(n,r))return!0;return!!(o.rest&&Ke(o.rest,r))}return!1}var $h=(e,t={})=>r=>{let o=en({...r,processors:t});return ve(e,o),tn(o,e),rn(o,e)},Qo=(e,t,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=en({...n??{},target:s,io:t,processors:r});return ve(e,i),tn(i,e),rn(i,e)};var Ur=(e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},Fr=(e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},wh=(e,t)=>{Ur(e,"minimum",t),Fr(e,"maximum",t)},kh=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Ih=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Oh=(e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},xh=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Ph=(e,t)=>Ur(e,"minimum",t.minimum),Eh=(e,t)=>Fr(e,"maximum",t.maximum),Th=e=>(t,r)=>{xh(t,r.format);let[o,n]=e[r.format];Ur(t,"minimum",o),Fr(t,"maximum",n)},mv={greater_than:(e,t)=>Ur(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Fr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>kh(e,t.value),number_format:Th(Fo),bigint_format:Th(vs),min_length:Ph,max_length:Eh,length_equals:(e,t)=>wh(e,t.length),min_size:Ph,max_size:Eh,size_equals:(e,t)=>wh(e,t.size),string_format:(e,t)=>{xh(e,t.format),t.pattern&&Ih(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Oh(e,t.mime)};function je(e){let t={},r=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of o)mv[s._zod.def.check]?.(t,s._zod.def);let n=e._zod.bag;n.minimum!==void 0&&Ur(t,"minimum",n.minimum),n.exclusiveMinimum!==void 0&&Ur(t,"exclusiveMinimum",n.exclusiveMinimum),n.maximum!==void 0&&Fr(t,"maximum",n.maximum),n.exclusiveMaximum!==void 0&&Fr(t,"exclusiveMaximum",n.exclusiveMaximum),n.multipleOf!==void 0&&kh(t,n.multipleOf),n.format!==void 0&&(t.format??(t.format=n.format),n.format.includes("int")&&(t.isInt=!0)),n.mime&&Oh(t,n.mime);for(let s of n.patterns??[])Ih(t,s);return t}var fv={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hv=new Map([[Bc,Vp],[js,Hp]]),Nh=e=>hv.get(e)??e,yu=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:c,patterns:a,contentEncoding:u,laxFormat:d}=je(e);if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),c&&(n.format=fv[c]??c,n.format===""&&delete n.format,(c==="time"||d)&&delete n.format),u&&(n.contentEncoding=u),a&&a.size>0){let p=[...a].map(Nh);p.length===1?n.pattern=p[0].source:p.length>1&&(n.allOf=[...p.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},vu=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,multipleOf:c,exclusiveMaximum:a,exclusiveMinimum:u,isInt:d}=je(e);n.type=d?"integer":"number";let p=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),g=typeof a=="number"&&a<=(i??Number.POSITIVE_INFINITY),v=t.target==="draft-04"||t.target==="openapi-3.0";if(p?v?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:typeof s=="number"&&(n.minimum=s),g?v?(n.maximum=a,n.exclusiveMaximum=!0):n.exclusiveMaximum=a:typeof i=="number"&&(n.maximum=i),c){let m=new Set;for(let f of c)Number.isFinite(f)&&f!==0?m.add(Math.abs(f)):qe(e,t,n,o,`A multipleOf divisor of ${f} cannot be represented in JSON Schema`);let[_,...h]=m;_!==void 0&&(n.multipleOf=_),h.length&&(n.allOf=[...n.allOf??[],...h.map(f=>({multipleOf:f}))])}},bu=(e,t,r,o)=>{r.type="boolean"},zu=(e,t,r,o)=>{qe(e,t,r,o,"BigInt cannot be represented in JSON Schema")},jh=(e,t,r,o)=>{qe(e,t,r,o,"Symbols cannot be represented in JSON Schema")},Ru=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Ah=(e,t,r,o)=>{qe(e,t,r,o,"Undefined cannot be represented in JSON Schema")},qh=(e,t,r,o)=>{qe(e,t,r,o,"Void cannot be represented in JSON Schema")},$u=(e,t,r,o)=>{r.not={}},wu=(e,t,r,o)=>{},Pu=(e,t,r,o)=>{},Eu=(e,t,r,o)=>{qe(e,t,r,o,"Date cannot be represented in JSON Schema")},Tu=(e,t,r,o)=>{let n=e._zod.def,s=Or(n.entries);if(s.length===0){r.not={};return}s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Cu=(e,t,r,o)=>{let n=e._zod.def;if(n.values.length===0){r.not={};return}let s=[];for(let i of n.values)if(i===void 0){if(qe(e,t,r,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i=="bigint"){if(qe(e,t,r,o,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s},Mh=(e,t,r,o)=>{qe(e,t,r,o,"NaN cannot be represented in JSON Schema")},Lh=(e,t,r,o)=>{let n=r,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},Dh=(e,t,r,o)=>{let n=r;n.type="string",n.format="binary",n.contentEncoding="binary";let{minimum:s,maximum:i,mime:c}=je(e);s!==void 0&&(n.minLength=s),i!==void 0&&(n.maxLength=i),c&&(c.length===0?n.not={}:c.length===1?n.contentMediaType=c[0]:n.anyOf=c.map(a=>({contentMediaType:a})))},Zh=(e,t,r,o)=>{r.type="boolean"},ku=(e,t,r,o)=>{qe(e,t,r,o,"Custom types cannot be represented in JSON Schema")},Uh=(e,t,r,o)=>{qe(e,t,r,o,"Function types cannot be represented in JSON Schema")},Iu=(e,t,r,o)=>{qe(e,t,r,o,"Transforms cannot be represented in JSON Schema")},Fh=(e,t,r,o)=>{qe(e,t,r,o,"Map cannot be represented in JSON Schema")},Vh=(e,t,r,o)=>{qe(e,t,r,o,"Set cannot be represented in JSON Schema")},Ou=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:c}=je(e);typeof i=="number"&&(n.minItems=i),typeof c=="number"&&(n.maxItems=c),n.type="array",n.items=ve(s.element,t,{...o,path:[...o.path,"items"]})};function on(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?on(t.out):t.type==="catch"?on(t.innerType):e._zod.optin}var xu=(e,t,r,o)=>{let n=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&qe(e,t,n,o,"Symbol keys cannot be represented in JSON Schema"))return;n.type="object",n.properties={};for(let u in i)Ye(n.properties,u,ve(i[u],t,{...o,path:[...o.path,"properties",u]}));let a=[];for(let u of Object.keys(i)){let d=s.shape[u];(t.io==="input"?on(d)===void 0:d._zod.optout===void 0)&&a.push(u)}a.length>0&&(n.required=a),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=ve(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Nu=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((c,a)=>ve(c,t,{...o,path:[...o.path,s?"oneOf":"anyOf",a]}));s?r.oneOf=i:r.anyOf=i},ju=(e,t,r,o)=>{let n=e._zod.def,s=ve(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=ve(n.right,t,{...o,path:[...o.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,a=[...c(s)?s.allOf:[s],...c(i)?i.allOf:[i]];r.allOf=a,t.intersections.push(a)},Hh=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=s.items.map((_,h)=>ve(_,t,{...o,path:[...o.path,i,h]})),u=s.rest?ve(s.rest,t,{...o,path:[...o.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null,d=s.items.length;for(;d>0;){let _=s.items[d-1];if(!(t.io==="input"?on(_)!==void 0:_._zod.optout==="optional"))break;d--}let p=s.items.length,g=!s.rest;t.target==="draft-2020-12"?(n.prefixItems=a,g?n.items=!1:u&&(n.items=u),d>0&&(n.minItems=d),g&&(n.maxItems=p)):t.target==="openapi-3.0"?(n.items={anyOf:a},u&&n.items.anyOf.push(u),d>0&&(n.minItems=d),g&&(n.maxItems=p)):(n.items=a,g?n.additionalItems=!1:u&&(n.additionalItems=u),d>0&&(n.minItems=d),g&&(n.maxItems=p));let{minimum:v,maximum:m}=je(e);typeof v=="number"&&(n.minItems=v),typeof m=="number"&&(n.maxItems=m)};function _u(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let _=_u(e,m,r);return _===m?t:_}for(let m of["anyOf","oneOf"]){let _=t[m];if(!Array.isArray(_))continue;let h=_.map(f=>_u(e,f,r));h.some((f,z)=>f!==_[z])&&(t={...t,[m]:h})}let o=Array.isArray(t.type)?t.type:[t.type],n=!o.includes("string")&&o.some(m=>m==="number"||m==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!n&&!s?.some(m=>typeof m=="number"))return t;let{minimum:i,maximum:c,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:d,format:p,id:g,...v}=t;return v.enum?v.enum=v.enum.map(m=>typeof m=="number"?String(m):m):typeof v.const=="number"&&(v.const=String(v.const)),n&&(v.type="string",s||(v.pattern=(o.includes("number")?Bo:Zc).source)),v}var Su=new WeakMap;function gv(e){let t=new Map;for(let o of e.seen.values())o.def&&!t.has(o.schema)&&t.set(o.schema,o);let r=new Map;for(let o of Su.get(e)??[]){let n=e.seen.get(o),s=(n?.def??n?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=_u(t,s,new Set);i!==s&&r.set(s,i)}if(r.size)for(let o of e.seen.values())for(let n of[o.schema,o.def]){let s=n&&r.get(n.propertyNames);s&&(n.propertyNames=s)}}var Au=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,c=je(i).patterns;if(s.mode==="loose"&&c&&c.size>0){let d=ve(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)Ye(n.patternProperties,Nh(p).source,d)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){n.propertyNames=ve(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});let d=Su.get(t);d||(d=[],Su.set(t,d),t.deferred.push(()=>gv(t))),d.push(e)}n.additionalProperties=ve(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let a=i._zod.values,u=t.io==="input"&&on(s.valueType)!==void 0;if(a&&!s.partial&&!u){let d=[...a].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(n.required=d.map(String))}},qu=(e,t,r,o)=>{let n=e._zod.def,s=ve(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Mu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Lu=Symbol();function Jh(e,t,r,o,n){let s=!1,i=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(s=!0,null));return s?(qe(t,r,o,n,"BigInt defaults cannot be represented in JSON Schema"),Lu):JSON.parse(i)}var Du=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i=Jh(n.defaultValue,e,t,r,o);i!==Lu&&(r.default=i)},Zu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io!=="input")return;let i=Jh(n.defaultValue,e,t,r,o);i!==Lu&&(r._prefault=i)},Uu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{qe(e,t,r,o,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Fu=(e,t,r,o)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;ve(i,t,o);let c=t.seen.get(e);c.ref=i},Vu=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Bh=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Bs=(e,t,r,o)=>{let n=e._zod.def;ve(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Hu=(e,t,r,o)=>{let n=e._zod.innerType;ve(n,t,o);let s=t.seen.get(e);s.ref=n},Ch={string:yu,number:vu,boolean:bu,bigint:zu,symbol:jh,null:Ru,undefined:Ah,void:qh,never:$u,any:wu,unknown:Pu,date:Eu,enum:Tu,literal:Cu,nan:Mh,template_literal:Lh,file:Dh,success:Zh,custom:ku,function:Uh,transform:Iu,map:Fh,set:Vh,array:Ou,object:xu,union:Nu,intersection:ju,tuple:Hh,record:Au,nullable:qu,nonoptional:Mu,default:Du,prefault:Zu,catch:Uu,pipe:Fu,readonly:Vu,promise:Bh,optional:Bs,lazy:Hu};function Ks(e,t){if("_idmap"in e){let o=e,n=en({...t,processors:Ch}),s={};for(let a of o._idmap.entries()){let[u,d]=a;ve(d,n)}let i={},c={registry:o,uri:t?.uri,defs:s};n.external=c;for(let a of o._idmap.entries()){let[u,d]=a;tn(n,d),Ye(i,u,rn(n,d))}if(Object.keys(s).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:s}}return{schemas:i}}let r=en({...t,processors:Ch});return ve(e,r),tn(r,e),rn(r,e)}var Kh=new WeakSet([Object.prototype,Error.prototype]);function Gs(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let o=r(this);return Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,t,{value:o,configurable:!0,writable:!0})}})}var wv=(e,t)=>{yp.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Kh.has(r)||(Kh.add(r),Gs(r,"format",o=>n=>Ac(o,n)),Gs(r,"flatten",o=>n=>jc(o,n)),Gs(r,"addIssue",o=>n=>{o.issues.push(n),o.message=JSON.stringify(o.issues,xr,2)}),Gs(r,"addIssues",o=>n=>{o.issues.push(...n),o.message=JSON.stringify(o.issues,xr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))};var rt=q("ZodError",wv,void 0,{Parent:Error});var Gh=ws(rt),Wh=Ps(rt),Ws=Es(rt),Yh=Ts(rt),Xh=bp(rt),Qh=zp(rt),eg=Rp(rt),tg=$p(rt),rg=wp(rt),og=Pp(rt),ng=Ep(rt),sg=Tp(rt);function Ev(){Xe.localeError||Qe(Nf())}function Xs(){Xe.memoizer||Qe({memoizer:tu()})}var ye=q("ZodType",(e,t)=>(Ev(),Se.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ce.mergeDefs(t,{checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return it(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(fb(e,t))},superRefine(e,t){return this.check(hb(e,t))},overwrite(e){return this.check(Dt(e))},optional(){return X(this)},exactOptional(){return eb(this)},nullable(){return cg(this)},nullish(){return X(cg(this))},nonoptional(e){return ib(this,e)},array(){return I(this)},or(e){return Y([this,e])},and(e){return $t(this,e)},transform(e){return ug(this,yg(e))},default(e){return ob(this,e)},prefault(e){return sb(this,e)},catch(e){return cb(this,e)},pipe(e){return ug(this,e)},readonly(){return db(this)},describe(e){let t=this.clone();return Lt.add(t,{description:e}),t},meta(...e){if(e.length===0)return Lt.get(this);let t=this.clone();return Lt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ce.hide(this,"~standard",{...Jc(this),jsonSchema:{input:Qo(this,"input"),output:Qo(this,"output")}})},set"~standard"(e){ce.own(this,"~standard",e)},parse:function e(t,r){return Gh(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Wh(this,t,r,{callee:e})},safeParse(e,t){return Ws(this,e,t)},async safeParseAsync(e,t){return Yh(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){ce.own(this,"spa",e)},validate(e,t){return qc(this,e,t)},validateAsync(e,t){return Mc(this,e,t)},encode:function e(t,r){return Xh(this,t,r,{callee:e})},decode:function e(t,r){return Qh(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await eg(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await tg(this,t,r,{callee:e})},safeEncode(e,t){return rg(this,e,t)},safeDecode(e,t){return og(this,e,t)},async safeEncodeAsync(e,t){return ng(this,e,t)},async safeDecodeAsync(e,t){return sg(this,e,t)},toJSONSchema(e){return $h(this,{})(e)},get description(){return Lt.get(this)?.description},get _def(){return this._zod.def}}),lg=q("_ZodString",(e,t)=>{Ns.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yu(e,r,o,n)},ce.derived({format:e=>je(e).format??null,minLength:e=>je(e).minimum??null,maxLength:e=>je(e).maximum??null},{regex(...e){return this.check(su(...e))},includes(...e){return this.check(cu(...e))},startsWith(...e){return this.check(uu(...e))},endsWith(...e){return this.check(lu(...e))},min(...e){return this.check(Zr(...e))},max(...e){return this.check(Hs(...e))},length(...e){return this.check(Js(...e))},nonempty(...e){return this.check(Zr(1,...e))},lowercase(e){return this.check(iu(e))},uppercase(e){return this.check(au(e))},trim(){return this.check(pu())},normalize(...e){return this.check(du(...e))},toLowerCase(){return this.check(mu())},toUpperCase(){return this.check(fu())},slugify(){return this.check(hu())}})),Bu=q("ZodString",(e,t)=>{Ns.init(e,t),lg.init(e,t)},{email(e){return this.check(ou(dg,e))},url(e){return this.check(nu(mg,e))},jwt(e){return this.check(nh(Fv,e))},emoji(e){return this.check(Vf(Cv,e))},guid(e){return this.check(Lf(Tv,e))},uuid(e){return this.check(Df(Ys,e))},uuidv4(e){return this.check(Zf(Ys,e))},uuidv6(e){return this.check(Uf(Ys,e))},uuidv7(e){return this.check(Ff(Ys,e))},nanoid(e){return this.check(Hf(kv,e))},cuid(e){return this.check(Jf(Iv,e))},cuid2(e){return this.check(Bf(Ov,e))},ulid(e){return this.check(Kf(xv,e))},base64(e){return this.check(th(Dv,e))},base64url(e){return this.check(rh(Zv,e))},xid(e){return this.check(Gf(Nv,e))},ksuid(e){return this.check(Wf(jv,e))},ipv4(e){return this.check(Yf(Av,e))},ipv6(e){return this.check(Xf(qv,e))},cidrv4(e){return this.check(Qf(Mv,e))},cidrv6(e){return this.check(eh(Lv,e))},e164(e){return this.check(oh(Uv,e))},datetime(e){return this.check(Zs(nn,e))},date(e){return this.check(Us(sn,e))},time(e){return this.check(Fs(an,e))},duration(e){return this.check(Vs(cn,e))}});function l(e){return qf(Bu,e)}var Pe=q("ZodStringFormat",(e,t)=>{Re.init(e,t),lg.init(e,t)}),nn=q("ZodISODateTime",(e,t)=>{Um.init(e,t),Pe.init(e,t)}),sn=q("ZodISODate",(e,t)=>{Fm.init(e,t),Pe.init(e,t)}),an=q("ZodISOTime",(e,t)=>{Vm.init(e,t),Pe.init(e,t)}),cn=q("ZodISODuration",(e,t)=>{Hm.init(e,t),Pe.init(e,t)}),dg=q("ZodEmail",(e,t)=>{Im.init(e,t),Pe.init(e,t)});function pg(e){return ou(dg,e)}var Tv=q("ZodGUID",(e,t)=>{Cm.init(e,t),Pe.init(e,t)});var Ys=q("ZodUUID",(e,t)=>{km.init(e,t),Pe.init(e,t)});var mg=q("ZodURL",(e,t)=>{Nm.init(e,t),Pe.init(e,t)});function Qs(e){return nu(mg,e)}var Cv=q("ZodEmoji",(e,t)=>{jm.init(e,t),Pe.init(e,t)});var kv=q("ZodNanoID",(e,t)=>{Am.init(e,t),Pe.init(e,t)});var Iv=q("ZodCUID",(e,t)=>{qm.init(e,t),Pe.init(e,t)});var Ov=q("ZodCUID2",(e,t)=>{Mm.init(e,t),Pe.init(e,t)});var xv=q("ZodULID",(e,t)=>{Lm.init(e,t),Pe.init(e,t)});var Nv=q("ZodXID",(e,t)=>{Dm.init(e,t),Pe.init(e,t)});var jv=q("ZodKSUID",(e,t)=>{Zm.init(e,t),Pe.init(e,t)});var Av=q("ZodIPv4",(e,t)=>{Jm.init(e,t),Pe.init(e,t)});var qv=q("ZodIPv6",(e,t)=>{Km.init(e,t),Pe.init(e,t)});var Mv=q("ZodCIDRv4",(e,t)=>{Gm.init(e,t),Pe.init(e,t)});var Lv=q("ZodCIDRv6",(e,t)=>{Wm.init(e,t),Pe.init(e,t)});var Dv=q("ZodBase64",(e,t)=>{Xm.init(e,t),Pe.init(e,t)});var Zv=q("ZodBase64URL",(e,t)=>{Qm.init(e,t),Pe.init(e,t)});var Uv=q("ZodE164",(e,t)=>{ef.init(e,t),Pe.init(e,t)});var Fv=q("ZodJWT",(e,t)=>{tf.init(e,t),Pe.init(e,t)});var ei=q("ZodNumber",(e,t)=>{Kc.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vu(e,r,o,n),e.isFinite=!0},ce.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:r}=je(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:r}=je(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:r}=je(e);return!!t||!!r?.some(Number.isSafeInteger)},format:e=>je(e).format??null},{gt(e,t){return this.check(Dr(e,t))},gte(e,t){return this.check(Rt(e,t))},min(e,t){return this.check(Rt(e,t))},lt(e,t){return this.check(Lr(e,t))},lte(e,t){return this.check(zt(e,t))},max(e,t){return this.check(zt(e,t))},int(e){return this.check(ig(e))},safe(e){return this.check(ig(e))},positive(e){return this.check(Dr(0,e))},nonnegative(e){return this.check(Rt(0,e))},negative(e){return this.check(Lr(0,e))},nonpositive(e){return this.check(zt(0,e))},multipleOf(e,t){return this.check(Yo(e,t))},step(e,t){return this.check(Yo(e,t))},finite(){return this}}));function L(e){return sh(ei,e)}var Vv=q("ZodNumberFormat",(e,t)=>{rf.init(e,t),ei.init(e,t)});function ig(e){return ah(Vv,e)}var Ku=q("ZodBoolean",(e,t)=>{of.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bu(e,r,o,n)});function H(e){return ch(Ku,e)}var fg=q("ZodBigInt",(e,t)=>{nf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zu(e,r,o,n)},ce.derived({minValue:e=>je(e).minimum??null,maxValue:e=>je(e).maximum??null,format:e=>je(e).format??null},{gte(e,t){return this.check(Rt(e,t))},min(e,t){return this.check(Rt(e,t))},gt(e,t){return this.check(Dr(e,t))},lt(e,t){return this.check(Lr(e,t))},lte(e,t){return this.check(zt(e,t))},max(e,t){return this.check(zt(e,t))},positive(e){return this.check(Dr(BigInt(0),e))},negative(e){return this.check(Lr(BigInt(0),e))},nonpositive(e){return this.check(zt(BigInt(0),e))},nonnegative(e){return this.check(Rt(BigInt(0),e))},multipleOf(e,t){return this.check(Yo(e,t))}}));var Hv=q("ZodNull",(e,t)=>{sf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ru(e,r,o,n)});function lr(e){return dh(Hv,e)}var Jv=q("ZodAny",(e,t)=>{af.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wu(e,r,o,n)});function hg(){return ph(Jv)}var Bv=q("ZodUnknown",(e,t)=>{cf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pu(e,r,o,n)});function Q(){return mh(Bv)}var Kv=q("ZodNever",(e,t)=>{uf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$u(e,r,o,n)});function gg(e){return fh(Kv,e)}var _g=q("ZodDate",(e,t)=>{lf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Eu(e,r,o,n),e.min=(r,o)=>e.check(Rt(r,o)),e.max=(r,o)=>e.check(zt(r,o))},ce.derived({minDate:e=>{let{minimum:t}=je(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=je(e);return t?new Date(t):null}},{}));var Gv=q("ZodArray",(e,t)=>{Xs(),df.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ou(e,r,o,n),e.element=t.element},{min(e,t){return this.check(Zr(e,t))},nonempty(e){return this.check(Zr(1,e))},max(e,t){return this.check(Hs(e,t))},length(e,t){return this.check(Js(e,t))},unwrap(){return this.element}});function I(e,t){return gh(Gv,e,t)}var Gu=q("ZodObject",(e,t)=>{Xs(),ff.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xu(e,r,o,n),ce.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return te(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ce.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ce.mergeDefs(this._zod.def,{catchall:Q()}))},loose(){return this.clone(ce.mergeDefs(this._zod.def,{catchall:Q()}))},strict(){return this.clone(ce.mergeDefs(this._zod.def,{catchall:gg()}))},strip(){return this.clone(ce.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return ce.extend(this,e)},safeExtend(e){return ce.safeExtend(this,e)},merge(e){return ce.merge(this,e)},pick(e){return ce.pick(this,e)},omit(e){return ce.omit(this,e)},partial(...e){return ce.partial(vg,this,e[0])},exactPartial(...e){return ce.partial(bg,this,e[0],"exactPartial")},required(...e){return ce.required(zg,this,e[0])}});function P(e,t){let r={type:"object",shape:e??{},...ce.normalizeParams(t)};return new Gu(r)}function Ge(e,t){return new Gu({type:"object",shape:e,catchall:gg(),...ce.normalizeParams(t)})}function oe(e,t){return new Gu({type:"object",shape:e,catchall:Q(),...ce.normalizeParams(t)})}var Sg=q("ZodUnion",(e,t)=>{Gc.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Nu(e,r,o,n),e.options=t.options});function Y(e,t){return new Sg({type:"union",options:e,...ce.normalizeParams(t)})}var Wv=q("ZodDiscriminatedUnion",(e,t)=>{Sg.init(e,t),hf.init(e,t)});function Hr(e,t,r){return new Wv({type:"union",options:t,discriminator:e,...ce.normalizeParams(r)})}var Yv=q("ZodIntersection",(e,t)=>{gf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ju(e,r,o,n)});function $t(e,t){return new Yv({type:"intersection",left:e,right:t})}var ag=q("ZodRecord",(e,t)=>{Xs(),_f.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Au(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function K(e,t,r){return!t||!t._zod?new ag({type:"record",keyType:l(),valueType:e,...ce.normalizeParams(t)}):new ag({type:"record",keyType:e,valueType:t,...ce.normalizeParams(r)})}var Ju=q("ZodEnum",(e,t)=>{Sf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Tu(e,o,n,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ju({...t,checks:[],...ce.normalizeParams(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ju({...t,checks:[],...ce.normalizeParams(n),entries:s})}});function te(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Ju({type:"enum",entries:r,...ce.normalizeParams(t)})}var Xv=q("ZodLiteral",(e,t)=>{yf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cu(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function O(e,t){return new Xv({type:"literal",values:Array.isArray(e)?e:[e],...ce.normalizeParams(t)})}var Qv=q("ZodTransform",(e,t)=>{Xs(),vf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Iu(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new qr(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(ce.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ce.issue(i))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function yg(e){return new Qv({type:"transform",transform:e})}var vg=q("ZodOptional",(e,t)=>{Wc.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function X(e){return new vg({type:"optional",innerType:e})}var bg=q("ZodExactOptional",(e,t)=>{bf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bs(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function eb(e){return new bg({type:"optional",innerType:e})}var tb=q("ZodNullable",(e,t)=>{zf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>qu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function cg(e){return new tb({type:"nullable",innerType:e})}var rb=q("ZodDefault",(e,t)=>{Rf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Du(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ob(e,t){return new rb({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.shallowClone(t)}})}var nb=q("ZodPrefault",(e,t)=>{$f.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Zu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function sb(e,t){return new nb({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ce.shallowClone(t)}})}var zg=q("ZodNonOptional",(e,t)=>{wf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Mu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ib(e,t){return new zg({type:"nonoptional",innerType:e,...ce.normalizeParams(t)})}var ab=q("ZodCatch",(e,t)=>{Pf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Uu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cb(e,t){return new ab({type:"catch",innerType:e,catchValue:typeof t=="function"?t:ce.constantCatch(t)})}var Rg=q("ZodPipe",(e,t)=>{Yc.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fu(e,r,o,n),e.in=t.in,e.out=t.out});function ug(e,t){return new Rg({type:"pipe",in:e,out:t})}var ub=q("ZodPreprocess",(e,t)=>{Rg.init(e,t),Ef.init(e,t)}),lb=q("ZodReadonly",(e,t)=>{Tf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vu(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function db(e){return new lb({type:"readonly",innerType:e})}var pb=q("ZodLazy",(e,t)=>{Cf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hu(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function un(e){return new pb({type:"lazy",getter:e})}var mb=q("ZodCustom",(e,t)=>{kf.init(e,t),ye.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ku(e,r,o,n)});function fb(e,t={}){return _h(mb,e,t)}function hb(e,t){return Sh(e,t)}function dr(e,t){return new ub({type:"pipe",in:yg(e),out:t})}var wg={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"};var $g;$g||($g={});var wt={};fc(wt,{ZodISODate:()=>sn,ZodISODateTime:()=>nn,ZodISODuration:()=>cn,ZodISOTime:()=>an,date:()=>Sb,datetime:()=>_b,duration:()=>vb,time:()=>yb});function _b(e){return Zs(nn,e)}function Sb(e){return Us(sn,e)}function yb(e){return Fs(an,e)}function vb(e){return Vs(cn,e)}var ti={};fc(ti,{bigint:()=>$b,boolean:()=>Rb,date:()=>wb,number:()=>zb,string:()=>bb});function bb(e){return Mf(Bu,e)}function zb(e){return ih(ei,e)}function Rb(e){return uh(Ku,e)}function $b(e){return lh(fg,e)}function wb(e){return hh(_g,e)}var mr="2025-11-25";var ri=[mr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],oi="io.modelcontextprotocol/related-task",fr="io.modelcontextprotocol/protocolVersion",Jr="io.modelcontextprotocol/clientInfo",Et="io.modelcontextprotocol/serverInfo",Tt="io.modelcontextprotocol/clientCapabilities",ln="io.modelcontextprotocol/subscriptionId",Ut="io.modelcontextprotocol/logLevel";var hr="2.0";var Zt=un(()=>Y([l(),L(),H(),lr(),K(l(),Zt),I(Zt)])),Ee=K(l(),Zt),Yu=I(Zt),dn=Y([l(),L().int()]),pn=l(),ni=P({ttl:L().optional()}),si=P({taskId:l()}),mn=oe({progressToken:dn.optional(),[oi]:si.optional()}),Le=P({_meta:mn.optional()}),gr=Le.extend({task:ni.optional()}),Te=P({method:l(),params:Le.loose().optional()}),Ve=P({_meta:mn.optional()}),He=P({method:l(),params:Ve.loose().optional()}),fn=oe({get[Et](){return Gr.optional().catch(void 0)}}),Ce=oe({_meta:fn.optional()}),Ft=Y([l(),L().int()]),hn=P({jsonrpc:O(hr),id:Ft,...Te.shape}).strict(),gn=P({jsonrpc:O(hr),...He.shape}).strict(),Br=P({jsonrpc:O(hr),id:Ft,result:Ce}).strict(),Kr=P({jsonrpc:O(hr),id:Ft.optional(),error:P({code:L().int(),message:l(),data:Q().optional()})}).strict(),_n=Y([hn,gn,Br,Kr]),ii=Y([Br,Kr]),Sn=Ce.strict(),ai=Ve.extend({requestId:Ft.optional(),reason:l().optional()}),yn=He.extend({method:O("notifications/cancelled"),params:ai}),ci=P({src:l(),mimeType:l().optional(),sizes:I(l()).optional(),theme:te(["light","dark"]).optional()}),Vt=P({icons:I(ci).optional()}),Pt=P({name:l(),title:l().optional()}),Gr=Pt.extend({...Pt.shape,...Vt.shape,version:l(),websiteUrl:l().optional(),description:l().optional()}),Eb=$t(P({applyDefaults:H().optional()}),Ee),Tb=dr(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,$t(P({form:Eb.optional(),url:Ee.optional()}),Ee.optional())),ui=oe({list:Ee.optional(),cancel:Ee.optional(),requests:oe({sampling:oe({createMessage:Ee.optional()}).optional(),elicitation:oe({create:Ee.optional()}).optional()}).optional()}),li=oe({list:Ee.optional(),cancel:Ee.optional(),requests:oe({tools:oe({call:Ee.optional()}).optional()}).optional()}),di=P({experimental:K(l(),Ee).optional(),sampling:P({context:Ee.optional(),tools:Ee.optional()}).optional(),elicitation:Tb.optional(),roots:P({listChanged:H().optional()}).optional(),tasks:ui.optional(),extensions:K(l(),Ee).optional()}),pi=Le.extend({protocolVersion:l(),capabilities:di,clientInfo:Gr}),mi=Te.extend({method:O("initialize"),params:pi}),vn=P({experimental:K(l(),Ee).optional(),logging:Ee.optional(),completions:Ee.optional(),prompts:P({listChanged:H().optional()}).optional(),resources:P({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:P({listChanged:H().optional()}).optional(),tasks:li.optional(),extensions:K(l(),Ee).optional()}),fi=Ce.extend({protocolVersion:l(),capabilities:vn,serverInfo:Gr,instructions:l().optional()}),hi=He.extend({method:O("notifications/initialized"),params:Ve.optional()}),gi=Te.extend({method:O("server/discover"),params:Le.optional()}),_i=Ce.extend({supportedVersions:I(l()),capabilities:vn,instructions:l().optional()}),bn=Te.extend({method:O("ping"),params:Le.optional()}),Si=P({progress:L(),total:X(L()),message:X(l())}),yi=P({...Ve.shape,...Si.shape,progressToken:dn}),zn=He.extend({method:O("notifications/progress"),params:yi}),vi=Le.extend({cursor:pn.optional()}),Ht=Te.extend({params:vi.optional()}),Jt=Ce.extend({nextCursor:pn.optional()}),Rn=P({uri:l(),mimeType:X(l()),_meta:K(l(),Q()).optional()}),$n=Rn.extend({text:l()}),Xu=l().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),wn=Rn.extend({blob:Xu}),Bt=te(["user","assistant"]),Ct=P({audience:I(Bt).optional(),priority:L().min(0).max(1).optional(),lastModified:wt.datetime({offset:!0}).optional()}),Pn=P({...Pt.shape,...Vt.shape,uri:l(),description:X(l()),mimeType:X(l()),size:X(L()),annotations:Ct.optional(),_meta:X(oe({}))}),bi=P({...Pt.shape,...Vt.shape,uriTemplate:l(),description:X(l()),mimeType:X(l()),annotations:Ct.optional(),_meta:X(oe({}))}),zi=Ht.extend({method:O("resources/list")}),Ri=Jt.extend({resources:I(Pn)}),$i=Ht.extend({method:O("resources/templates/list")}),wi=Jt.extend({resourceTemplates:I(bi)}),Wr=Le.extend({uri:l()}),Pi=Wr,Ei=Te.extend({method:O("resources/read"),params:Pi}),Ti=Ce.extend({contents:I(Y([$n,wn]))}),Ci=He.extend({method:O("notifications/resources/list_changed"),params:Ve.optional()}),ki=Wr,Ii=Te.extend({method:O("resources/subscribe"),params:ki}),Oi=Wr,xi=Te.extend({method:O("resources/unsubscribe"),params:Oi}),En=P({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:I(l()).optional()}),Ni=Le.extend({notifications:En}),ji=Te.extend({method:O("subscriptions/listen"),params:Ni}),Ai=Ve.extend({notifications:En}),qi=He.extend({method:O("notifications/subscriptions/acknowledged"),params:Ai}),Mi=fn.extend({[ln]:Ft}),Li=Ce.extend({_meta:Mi}),Di=Ve.extend({uri:l()}),Zi=He.extend({method:O("notifications/resources/updated"),params:Di}),Ui=P({name:l(),description:X(l()),required:X(H())}),Fi=P({...Pt.shape,...Vt.shape,description:X(l()),arguments:X(I(Ui)),_meta:X(oe({}))}),Vi=Ht.extend({method:O("prompts/list")}),Hi=Jt.extend({prompts:I(Fi)}),Ji=Le.extend({name:l(),arguments:K(l(),l()).optional()}),Bi=Te.extend({method:O("prompts/get"),params:Ji}),Yr=P({type:O("text"),text:l(),annotations:Ct.optional(),_meta:K(l(),Q()).optional()}),Xr=P({type:O("image"),data:Xu,mimeType:l(),annotations:Ct.optional(),_meta:K(l(),Q()).optional()}),Qr=P({type:O("audio"),data:Xu,mimeType:l(),annotations:Ct.optional(),_meta:K(l(),Q()).optional()}),Ki=P({type:O("tool_use"),name:l(),id:l(),input:K(l(),Q()),_meta:K(l(),Q()).optional()}),Gi=P({type:O("resource"),resource:Y([$n,wn]),annotations:Ct.optional(),_meta:K(l(),Q()).optional()}),Wi=Pn.extend({type:O("resource_link")}),eo=Y([Yr,Xr,Qr,Wi,Gi]),Yi=P({role:Bt,content:eo}),Xi=Ce.extend({description:l().optional(),messages:I(Yi)}),Qi=He.extend({method:O("notifications/prompts/list_changed"),params:Ve.optional()}),ea=P({title:l().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),ta=P({taskSupport:te(["required","optional","forbidden"]).optional()}),Tn=P({...Pt.shape,...Vt.shape,description:l().optional(),inputSchema:P({type:O("object"),properties:K(l(),Zt).optional(),required:I(l()).optional()}).catchall(Q()),outputSchema:oe({$schema:l().optional()}).optional(),annotations:ea.optional(),execution:ta.optional(),_meta:K(l(),Q()).optional()}),ra=Ht.extend({method:O("tools/list")}),oa=Jt.extend({tools:I(Tn)}),Cn=Ce.extend({content:I(eo).default([]),structuredContent:Q().optional(),isError:H().optional()}),Qu=Cn.or(Ce.extend({toolResult:Q()})),na=gr.extend({name:l(),arguments:K(l(),Q()).optional()}),sa=Te.extend({method:O("tools/call"),params:na}),ia=He.extend({method:O("notifications/tools/list_changed"),params:Ve.optional()}),el=P({autoRefresh:H().default(!0),debounceMs:L().int().nonnegative().default(300)}),Kt=te(["debug","info","notice","warning","error","critical","alert","emergency"]),aa=Le.extend({level:Kt}),ca=Te.extend({method:O("logging/setLevel"),params:aa}),ua=Ve.extend({level:Kt,logger:l().optional(),data:Q()}),la=He.extend({method:O("notifications/message"),params:ua}),da=P({name:l().optional()}),pa=P({hints:I(da).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),ma=P({mode:te(["auto","required","none"]).optional()}),fa=P({type:O("tool_result"),toolUseId:l().describe("The unique identifier for the corresponding tool call."),content:I(eo),structuredContent:Q().optional(),isError:H().optional(),_meta:K(l(),Q()).optional()}),ha=Hr("type",[Yr,Xr,Qr]),pr=Hr("type",[Yr,Xr,Qr,Ki,fa]),ga=P({role:Bt,content:Y([pr,I(pr)]),_meta:K(l(),Q()).optional()}),_a=gr.extend({messages:I(ga),modelPreferences:pa.optional(),systemPrompt:l().optional(),includeContext:te(["none","thisServer","allServers"]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:I(l()).optional(),metadata:Ee.optional(),tools:I(Tn).optional(),toolChoice:ma.optional()}),Sa=Te.extend({method:O("sampling/createMessage"),params:_a}),ya=Ce.extend({model:l(),stopReason:X(te(["endTurn","stopSequence","maxTokens"]).or(l())),role:Bt,content:ha}),va=Ce.extend({model:l(),stopReason:X(te(["endTurn","stopSequence","maxTokens","toolUse"]).or(l())),role:Bt,content:Y([pr,I(pr)])}),kn=P({type:O("boolean"),title:l().optional(),description:l().optional(),default:H().optional()}),to=P({type:O("string"),title:l().optional(),description:l().optional(),minLength:L().optional(),maxLength:L().optional(),format:te(["email","uri","date","date-time"]).optional(),default:l().optional()}),ro=P({type:te(["number","integer"]),title:l().optional(),description:l().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),In=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),default:l().optional()}),On=P({type:O("string"),title:l().optional(),description:l().optional(),oneOf:I(P({const:l(),title:l()})),default:l().optional()}),xn=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),enumNames:I(l()).optional(),default:l().optional()}),ba=Y([In,On]),Nn=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({type:O("string"),enum:I(l())}),default:I(l()).optional()}),jn=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({anyOf:I(P({const:l(),title:l()}))}),default:I(l()).optional()}),za=Y([Nn,jn]),Ra=Y([xn,ba,za]),An=Y([Ra,kn,to,ro]),oo=gr.extend({mode:O("form").optional(),message:l(),requestedSchema:P({type:O("object"),properties:K(l(),An),required:I(l()).optional()}).catchall(Q())}),$a=gr.extend({mode:O("url"),message:l(),elicitationId:l(),url:l().url()}),wa=Y([oo,$a]),Pa=Te.extend({method:O("elicitation/create"),params:wa}),Ea=Ve.extend({elicitationId:l()}),Ta=He.extend({method:O("notifications/elicitation/complete"),params:Ea}),Ca=Ce.extend({action:te(["accept","decline","cancel"]),content:dr(e=>e===null?void 0:e,K(l(),Y([l(),L(),H(),I(l())])).optional())}),ka=P({type:O("ref/resource"),uri:l()}),Ia=P({type:O("ref/prompt"),name:l()}),Oa=Le.extend({ref:Y([Ia,ka]),argument:P({name:l(),value:l()}),context:P({arguments:K(l(),l()).optional()}).optional()}),xa=Te.extend({method:O("completion/complete"),params:Oa}),Na=Ce.extend({completion:oe({values:I(l()).max(100),total:X(L().int()),hasMore:X(H())})}),ja=P({uri:l().startsWith("file://"),name:l().optional(),_meta:K(l(),Q()).optional()}),Aa=Te.extend({method:O("roots/list"),params:Le.optional()}),qa=Ce.extend({roots:I(ja)}),Ma=He.extend({method:O("notifications/roots/list_changed"),params:Ve.optional()}),tl=oe({ttl:L().optional(),pollInterval:L().optional()}),La=te(["working","input_required","completed","failed","cancelled"]),Gt=P({taskId:l(),status:La,ttl:Y([L(),lr()]),createdAt:l(),lastUpdatedAt:l(),pollInterval:X(L()),statusMessage:X(l())}),rl=Ce.extend({task:Gt}),Da=Ve.merge(Gt),ol=He.extend({method:O("notifications/tasks/status"),params:Da}),nl=Te.extend({method:O("tasks/get"),params:Le.extend({taskId:l()})}),sl=Ce.merge(Gt),il=Te.extend({method:O("tasks/result"),params:Le.extend({taskId:l()})}),al=Ce.loose(),cl=Ht.extend({method:O("tasks/list")}),ul=Jt.extend({tasks:I(Gt)}),ll=Te.extend({method:O("tasks/cancel"),params:Le.extend({taskId:l()})}),dl=Ce.merge(Gt),pl=Y([bn,mi,gi,xa,ca,Bi,Vi,zi,$i,Ei,Ii,xi,ji,sa,ra]),ml=Y([yn,zn,hi,Ma]),fl=Y([Sn,ya,va,Ca,qa]),hl=Y([bn,Sa,Pa,Aa]),gl=Y([yn,zn,la,Zi,Ci,ia,Qi,qi,Ta]),_l=Y([Sn,fi,_i,Na,Xi,Hi,Ri,wi,Ti,Cn,oa,Li]),Me=Qs().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:wg.custom,message:"URL must be parseable",fatal:!0}),Oc}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Sl=oe({resource:l().url(),authorization_servers:I(Me).optional(),jwks_uri:l().url().optional(),scopes_supported:I(l()).optional(),bearer_methods_supported:I(l()).optional(),resource_signing_alg_values_supported:I(l()).optional(),resource_name:l().optional(),resource_documentation:l().optional(),resource_policy_uri:l().url().optional(),resource_tos_uri:l().url().optional(),tls_client_certificate_bound_access_tokens:H().optional(),authorization_details_types_supported:I(l()).optional(),dpop_signing_alg_values_supported:I(l()).optional(),dpop_bound_access_tokens_required:H().optional()}),Za=oe({issuer:l(),authorization_endpoint:Me,token_endpoint:Me,registration_endpoint:Me.optional(),scopes_supported:I(l()).optional(),response_types_supported:I(l()),response_modes_supported:I(l()).optional(),grant_types_supported:I(l()).optional(),token_endpoint_auth_methods_supported:I(l()).optional(),token_endpoint_auth_signing_alg_values_supported:I(l()).optional(),service_documentation:Me.optional(),revocation_endpoint:Me.optional(),revocation_endpoint_auth_methods_supported:I(l()).optional(),revocation_endpoint_auth_signing_alg_values_supported:I(l()).optional(),introspection_endpoint:l().optional(),introspection_endpoint_auth_methods_supported:I(l()).optional(),introspection_endpoint_auth_signing_alg_values_supported:I(l()).optional(),code_challenge_methods_supported:I(l()).optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0),dpop_signing_alg_values_supported:I(l()).optional()}),Ua=oe({issuer:l(),authorization_endpoint:Me,token_endpoint:Me,userinfo_endpoint:Me.optional(),jwks_uri:Me,registration_endpoint:Me.optional(),scopes_supported:I(l()).optional(),response_types_supported:I(l()),response_modes_supported:I(l()).optional(),grant_types_supported:I(l()).optional(),acr_values_supported:I(l()).optional(),subject_types_supported:I(l()),id_token_signing_alg_values_supported:I(l()),id_token_encryption_alg_values_supported:I(l()).optional(),id_token_encryption_enc_values_supported:I(l()).optional(),userinfo_signing_alg_values_supported:I(l()).optional(),userinfo_encryption_alg_values_supported:I(l()).optional(),userinfo_encryption_enc_values_supported:I(l()).optional(),request_object_signing_alg_values_supported:I(l()).optional(),request_object_encryption_alg_values_supported:I(l()).optional(),request_object_encryption_enc_values_supported:I(l()).optional(),token_endpoint_auth_methods_supported:I(l()).optional(),token_endpoint_auth_signing_alg_values_supported:I(l()).optional(),display_values_supported:I(l()).optional(),claim_types_supported:I(l()).optional(),claims_supported:I(l()).optional(),service_documentation:l().optional(),claims_locales_supported:I(l()).optional(),ui_locales_supported:I(l()).optional(),claims_parameter_supported:H().optional(),request_parameter_supported:H().optional(),request_uri_parameter_supported:H().optional(),require_request_uri_registration:H().optional(),op_policy_uri:Me.optional(),op_tos_uri:Me.optional(),client_id_metadata_document_supported:H().optional(),authorization_response_iss_parameter_supported:H().optional().catch(void 0)}),yl=P({...Ua.shape,...Za.pick({code_challenge_methods_supported:!0}).shape}),vl=P({access_token:l(),id_token:l().optional(),token_type:l(),expires_in:ti.number().optional(),scope:l().optional(),refresh_token:l().optional(),issuer:l().optional().catch(void 0)}).strip(),bl=P({issued_token_type:O("urn:ietf:params:oauth:token-type:id-jag"),access_token:l(),token_type:l().optional(),expires_in:L().optional(),scope:l().optional()}).strip(),zl=P({error:l(),error_description:l().optional(),error_uri:l().optional()}),Wu=Me.optional().or(O("").transform(()=>{})),Fa=P({redirect_uris:I(Me),token_endpoint_auth_method:l().optional(),grant_types:I(l()).optional(),response_types:I(l()).optional(),application_type:l().optional(),client_name:l().optional(),client_uri:Me.optional(),logo_uri:Wu,scope:l().optional(),contacts:I(l()).optional(),tos_uri:Wu,policy_uri:l().optional(),jwks_uri:Me.optional(),jwks:hg().optional(),software_id:l().optional(),software_version:l().optional(),software_statement:l().optional()}).strip(),Va=P({client_id:l(),client_secret:l().optional(),client_id_issued_at:L().optional(),client_secret_expires_at:L().optional(),issuer:l().optional().catch(void 0)}).strip(),Rl=Fa.merge(Va),$l=P({error:l(),error_description:l().optional()}).strip(),wl=P({token:l(),token_type_hint:l().optional()}).strip();var Cl=Symbol.for("mcp.sdk.errorBrands");function xl(e,t){let r=new Set,o=t;for(;typeof o=="function";){let n=o.mcpBrand;Object.prototype.hasOwnProperty.call(o,"mcpBrand")&&typeof n=="string"&&r.add(n),o=Object.getPrototypeOf(o)}r.size!==0&&Object.defineProperty(e,Cl,{value:r,enumerable:!1,configurable:!0})}function so(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,Cl)){let r=t[Cl];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Bg=class Kg extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return so(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return so(this,t)}constructor(t,r,o){super(r),this.code=t,this.errorUri=o,this.name="OAuthError",xl(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new Kg(t.error,t.error_description??t.error,t.error_uri)}},me=(function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e})({}),ue=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return so(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return so(this,e)}constructor(e,t,r,o){super(t,o),this.code=e,this.data=r,this.name="SdkError",xl(this,new.target)}},Cb=class extends ue{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r,o){super(e,t,r,o),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function jg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function kb(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function Gg(e){switch(e.method){case"elicitation/create":return e.params?.mode==="url"?{elicitation:{url:{}}}:{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;return t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0)?{sampling:{tools:{}}}:{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function Xa(e,t){let r={};for(let[o,n]of Object.entries(e)){if(n===void 0)continue;let s=t===void 0?void 0:t[o];if(s===void 0){r[o]=n;continue}if(jg(n)&&jg(s)){let i={};for(let[c,a]of Object.entries(n))a!==void 0&&s[c]===void 0&&!kb(o,c,s)&&(i[c]=a);Object.keys(i).length>0&&(r[o]=i)}}return Object.keys(r).length>0?r:void 0}var Ib="2026-07-28";function Un(e){return e>=Ib}function Wg(e){return e.filter(t=>!Un(t))}function Nl(e){return e.filter(t=>Un(t))}function Yg(e){let t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(e.content?.some(r=>r.type==="text")??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var Xg=["task","inputRequests","requestState"];function jl(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||Xg.some(t=>t in e)?e:{...e,content:[]}}function Ob(){let e=un(()=>Y([l(),L(),H(),lr(),K(l(),e),I(e)])),t=K(l(),e),r=Y([l(),L().int()]),o=l(),n=P({ttl:L().optional()}),s=P({taskId:l()}),i=oe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":s.optional()}),c=P({_meta:i.optional()}),a=c.extend({task:n.optional()}),u=P({method:l(),params:c.loose().optional()}),d=P({_meta:i.optional()}),p=P({method:l(),params:d.loose().optional()}),g=oe({_meta:i.optional()}),v=Y([l(),L().int()]),m=g.strict(),_=d.extend({requestId:v.optional(),reason:l().optional()}),h=p.extend({method:O("notifications/cancelled"),params:_}),f=P({src:l(),mimeType:l().optional(),sizes:I(l()).optional(),theme:te(["light","dark"]).optional()}),z=P({icons:I(f).optional()}),S=P({name:l(),title:l().optional()}),R=S.extend({...S.shape,...z.shape,version:l(),websiteUrl:l().optional(),description:l().optional()}),w=$t(P({applyDefaults:H().optional()}),t),b=dr(Fe=>Fe&&typeof Fe=="object"&&!Array.isArray(Fe)&&Object.keys(Fe).length===0?{form:{}}:Fe,$t(P({form:w.optional(),url:t.optional()}),t.optional())),y=oe({list:t.optional(),cancel:t.optional(),requests:oe({sampling:oe({createMessage:t.optional()}).optional(),elicitation:oe({create:t.optional()}).optional()}).optional()}),E=oe({list:t.optional(),cancel:t.optional(),requests:oe({tools:oe({call:t.optional()}).optional()}).optional()}),N=P({experimental:K(l(),t).optional(),sampling:P({context:t.optional(),tools:t.optional()}).optional(),elicitation:b.optional(),roots:P({listChanged:H().optional()}).optional(),tasks:y.optional(),extensions:K(l(),t).optional()}),V=c.extend({protocolVersion:l(),capabilities:N,clientInfo:R}),M=u.extend({method:O("initialize"),params:V}),Z=P({experimental:K(l(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:P({listChanged:H().optional()}).optional(),resources:P({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:P({listChanged:H().optional()}).optional(),tasks:E.optional(),extensions:K(l(),t).optional()}),W=g.extend({protocolVersion:l(),capabilities:Z,serverInfo:R,instructions:l().optional()}),G=p.extend({method:O("notifications/initialized"),params:d.optional()}),fe=u.extend({method:O("ping"),params:c.optional()}),$e=P({progress:L(),total:X(L()),message:X(l())}),be=P({...d.shape,...$e.shape,progressToken:r}),Oe=p.extend({method:O("notifications/progress"),params:be}),he=c.extend({cursor:o.optional()}),k=u.extend({params:he.optional()}),j=g.extend({nextCursor:o.optional()}),F=P({uri:l(),mimeType:X(l()),_meta:K(l(),Q()).optional()}),$=F.extend({text:l()}),C=l().refine(Fe=>{try{return atob(Fe),!0}catch{return!1}},{message:"Invalid Base64 string"}),x=F.extend({blob:C}),J=te(["user","assistant"]),ee=P({audience:I(J).optional(),priority:L().min(0).max(1).optional(),lastModified:wt.datetime({offset:!0}).optional()}),pe=P({...S.shape,...z.shape,uri:l(),description:X(l()),mimeType:X(l()),size:X(L()),annotations:ee.optional(),_meta:X(oe({}))}),ae=P({...S.shape,...z.shape,uriTemplate:l(),description:X(l()),mimeType:X(l()),annotations:ee.optional(),_meta:X(oe({}))}),ze=k.extend({method:O("resources/list")}),Je=j.extend({resources:I(pe)}),T=k.extend({method:O("resources/templates/list")}),A=j.extend({resourceTemplates:I(ae)}),D=c.extend({uri:l()}),se=D,ie=u.extend({method:O("resources/read"),params:se}),de=g.extend({contents:I(Y([$,x]))}),ke=p.extend({method:O("notifications/resources/list_changed"),params:d.optional()}),Ne=D,Ze=u.extend({method:O("resources/subscribe"),params:Ne}),xe=D,we=u.extend({method:O("resources/unsubscribe"),params:xe}),ot=d.extend({uri:l()}),Ae=p.extend({method:O("notifications/resources/updated"),params:ot}),ht=P({name:l(),description:X(l()),required:X(H())}),at=P({...S.shape,...z.shape,description:X(l()),arguments:X(I(ht)),_meta:X(oe({}))}),gt=k.extend({method:O("prompts/list")}),It=j.extend({prompts:I(at)}),Ot=c.extend({name:l(),arguments:K(l(),l()).optional()}),Xt=u.extend({method:O("prompts/get"),params:Ot}),Qt=P({type:O("text"),text:l(),annotations:ee.optional(),_meta:K(l(),Q()).optional()}),er=P({type:O("image"),data:C,mimeType:l(),annotations:ee.optional(),_meta:K(l(),Q()).optional()}),tr=P({type:O("audio"),data:C,mimeType:l(),annotations:ee.optional(),_meta:K(l(),Q()).optional()}),mo=P({type:O("tool_use"),name:l(),id:l(),input:K(l(),Q()),_meta:K(l(),Q()).optional()}),xt=P({type:O("resource"),resource:Y([$,x]),annotations:ee.optional(),_meta:K(l(),Q()).optional()}),fo=pe.extend({type:O("resource_link")}),nt=Y([Qt,er,tr,fo,xt]),vr=P({role:J,content:nt}),br=g.extend({description:l().optional(),messages:I(vr)}),rr=p.extend({method:O("notifications/prompts/list_changed"),params:d.optional()}),ho=P({title:l().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),zr=P({taskSupport:te(["required","optional","forbidden"]).optional()}),or=P({...S.shape,...z.shape,description:l().optional(),inputSchema:P({type:O("object"),properties:K(l(),e).optional(),required:I(l()).optional()}).catchall(Q()),outputSchema:P({type:O("object"),properties:K(l(),e).optional(),required:I(l()).optional()}).catchall(Q()).optional(),annotations:ho.optional(),execution:zr.optional(),_meta:K(l(),Q()).optional()}),Rr=k.extend({method:O("tools/list")}),$r=j.extend({tools:I(or)}),wr=g.extend({content:I(nt),structuredContent:K(l(),Q()).optional(),isError:H().optional()}),Ue=a.extend({name:l(),arguments:K(l(),Q()).optional()}),go=u.extend({method:O("tools/call"),params:Ue}),Yn=p.extend({method:O("notifications/tools/list_changed"),params:d.optional()}),Pr=te(["debug","info","notice","warning","error","critical","alert","emergency"]),_o=c.extend({level:Pr}),So=u.extend({method:O("logging/setLevel"),params:_o}),yo=d.extend({level:Pr,logger:l().optional(),data:Q()}),vo=p.extend({method:O("notifications/message"),params:yo}),bo=P({name:l().optional()}),zo=P({hints:I(bo).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),Ro=P({mode:te(["auto","required","none"]).optional()}),Xn=P({type:O("tool_result"),toolUseId:l().describe("The unique identifier for the corresponding tool call."),content:I(nt),structuredContent:P({}).loose().optional(),isError:H().optional(),_meta:K(l(),Q()).optional()}),$o=Hr("type",[Qt,er,tr]),Nt=Hr("type",[Qt,er,tr,mo,Xn]),wo=P({role:J,content:Y([Nt,I(Nt)]),_meta:K(l(),Q()).optional()}),Po=a.extend({messages:I(wo),modelPreferences:zo.optional(),systemPrompt:l().optional(),includeContext:te(["none","thisServer","allServers"]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:I(l()).optional(),metadata:t.optional(),tools:I(or).optional(),toolChoice:Ro.optional()}),Eo=u.extend({method:O("sampling/createMessage"),params:Po}),To=g.extend({model:l(),stopReason:X(te(["endTurn","stopSequence","maxTokens"]).or(l())),role:J,content:$o}),Co=g.extend({model:l(),stopReason:X(te(["endTurn","stopSequence","maxTokens","toolUse"]).or(l())),role:J,content:Y([Nt,I(Nt)])}),ko=P({type:O("boolean"),title:l().optional(),description:l().optional(),default:H().optional()}),Io=P({type:O("string"),title:l().optional(),description:l().optional(),minLength:L().optional(),maxLength:L().optional(),format:te(["email","uri","date","date-time"]).optional(),default:l().optional()}),Oo=P({type:te(["number","integer"]),title:l().optional(),description:l().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),xo=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),default:l().optional()}),No=P({type:O("string"),title:l().optional(),description:l().optional(),oneOf:I(P({const:l(),title:l()})),default:l().optional()}),jo=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),enumNames:I(l()).optional(),default:l().optional()}),Ao=Y([xo,No]),nr=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({type:O("string"),enum:I(l())}),default:I(l()).optional()}),sr=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({anyOf:I(P({const:l(),title:l()}))}),default:I(l()).optional()}),Qn=Y([nr,sr]),es=Y([jo,Ao,Qn]),et=Y([es,ko,Io,Oo]),tt=a.extend({mode:O("form").optional(),message:l(),requestedSchema:P({type:O("object"),properties:K(l(),et),required:I(l()).optional()}).catchall(Q())}),qo=a.extend({mode:O("url"),message:l(),elicitationId:l(),url:l().url()}),ct=Y([tt,qo]),ts=u.extend({method:O("elicitation/create"),params:ct}),rs=d.extend({elicitationId:l()}),os=p.extend({method:O("notifications/elicitation/complete"),params:rs}),ns=g.extend({action:te(["accept","decline","cancel"]),content:dr(Fe=>Fe===null?void 0:Fe,K(l(),Y([l(),L(),H(),I(l())])).optional())}),ss=P({type:O("ref/resource"),uri:l()}),is=P({type:O("ref/prompt"),name:l()}),as=c.extend({ref:Y([is,ss]),argument:P({name:l(),value:l()}),context:P({arguments:K(l(),l()).optional()}).optional()}),Mo=u.extend({method:O("completion/complete"),params:as}),cs=g.extend({completion:oe({values:I(l()).max(100),total:X(L().int()),hasMore:X(H())})}),us=P({uri:l().startsWith("file://"),name:l().optional(),_meta:K(l(),Q()).optional()}),Er=u.extend({method:O("roots/list"),params:c.optional()}),Lo=g.extend({roots:I(us)}),ls=p.extend({method:O("notifications/roots/list_changed"),params:d.optional()}),ds=oe({ttl:L().optional(),pollInterval:L().optional()}),Do=te(["working","input_required","completed","failed","cancelled"]),jt=P({taskId:l(),status:Do,ttl:Y([L(),lr()]),createdAt:l(),lastUpdatedAt:l(),pollInterval:X(L()),statusMessage:X(l())}),We=g.extend({task:jt}),ps=d.merge(jt),ir=p.extend({method:O("notifications/tasks/status"),params:ps}),Tr=u.extend({method:O("tasks/get"),params:c.extend({taskId:l()})}),Cr=g.merge(jt),kr=u.extend({method:O("tasks/result"),params:c.extend({taskId:l()})}),mc=g.loose(),Be=k.extend({method:O("tasks/list")}),Ie=j.extend({tasks:I(jt)}),ar=u.extend({method:O("tasks/cancel"),params:c.extend({taskId:l()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:a,RequestSchema:u,NotificationsParamsSchema:d,NotificationSchema:p,ResultSchema:g,RequestIdSchema:v,EmptyResultSchema:m,CancelledNotificationParamsSchema:_,CancelledNotificationSchema:h,IconSchema:f,IconsSchema:z,BaseMetadataSchema:S,ImplementationSchema:R,ClientTasksCapabilitySchema:y,ServerTasksCapabilitySchema:E,ClientCapabilitiesSchema:N,InitializeRequestParamsSchema:V,InitializeRequestSchema:M,ServerCapabilitiesSchema:Z,InitializeResultSchema:W,InitializedNotificationSchema:G,PingRequestSchema:fe,ProgressSchema:$e,ProgressNotificationParamsSchema:be,ProgressNotificationSchema:Oe,PaginatedRequestParamsSchema:he,PaginatedRequestSchema:k,PaginatedResultSchema:j,ResourceContentsSchema:F,TextResourceContentsSchema:$,BlobResourceContentsSchema:x,RoleSchema:J,AnnotationsSchema:ee,ResourceSchema:pe,ResourceTemplateSchema:ae,ListResourcesRequestSchema:ze,ListResourcesResultSchema:Je,ListResourceTemplatesRequestSchema:T,ListResourceTemplatesResultSchema:A,ResourceRequestParamsSchema:D,ReadResourceRequestParamsSchema:se,ReadResourceRequestSchema:ie,ReadResourceResultSchema:de,ResourceListChangedNotificationSchema:ke,SubscribeRequestParamsSchema:Ne,SubscribeRequestSchema:Ze,UnsubscribeRequestParamsSchema:xe,UnsubscribeRequestSchema:we,ResourceUpdatedNotificationParamsSchema:ot,ResourceUpdatedNotificationSchema:Ae,PromptArgumentSchema:ht,PromptSchema:at,ListPromptsRequestSchema:gt,ListPromptsResultSchema:It,GetPromptRequestParamsSchema:Ot,GetPromptRequestSchema:Xt,TextContentSchema:Qt,ImageContentSchema:er,AudioContentSchema:tr,ToolUseContentSchema:mo,EmbeddedResourceSchema:xt,ResourceLinkSchema:fo,ContentBlockSchema:nt,PromptMessageSchema:vr,GetPromptResultSchema:br,PromptListChangedNotificationSchema:rr,ToolAnnotationsSchema:ho,ToolExecutionSchema:zr,ToolSchema:or,ListToolsRequestSchema:Rr,ListToolsResultSchema:$r,CallToolResultSchema:wr,CallToolRequestParamsSchema:Ue,CallToolRequestSchema:go,ToolListChangedNotificationSchema:Yn,LoggingLevelSchema:Pr,SetLevelRequestParamsSchema:_o,SetLevelRequestSchema:So,LoggingMessageNotificationParamsSchema:yo,LoggingMessageNotificationSchema:vo,ModelHintSchema:bo,ModelPreferencesSchema:zo,ToolChoiceSchema:Ro,ToolResultContentSchema:Xn,SamplingContentSchema:$o,SamplingMessageContentBlockSchema:Nt,SamplingMessageSchema:wo,CreateMessageRequestParamsSchema:Po,CreateMessageRequestSchema:Eo,CreateMessageResultSchema:To,CreateMessageResultWithToolsSchema:Co,BooleanSchemaSchema:ko,StringSchemaSchema:Io,NumberSchemaSchema:Oo,UntitledSingleSelectEnumSchemaSchema:xo,TitledSingleSelectEnumSchemaSchema:No,LegacyTitledEnumSchemaSchema:jo,SingleSelectEnumSchemaSchema:Ao,UntitledMultiSelectEnumSchemaSchema:nr,TitledMultiSelectEnumSchemaSchema:sr,MultiSelectEnumSchemaSchema:Qn,EnumSchemaSchema:es,PrimitiveSchemaDefinitionSchema:et,ElicitRequestFormParamsSchema:tt,ElicitRequestURLParamsSchema:qo,ElicitRequestParamsSchema:ct,ElicitRequestSchema:ts,ElicitationCompleteNotificationParamsSchema:rs,ElicitationCompleteNotificationSchema:os,ElicitResultSchema:ns,ResourceTemplateReferenceSchema:ss,PromptReferenceSchema:is,CompleteRequestParamsSchema:as,CompleteRequestSchema:Mo,CompleteResultSchema:cs,RootSchema:us,ListRootsRequestSchema:Er,ListRootsResultSchema:Lo,RootsListChangedNotificationSchema:ls,TaskCreationParamsSchema:ds,TaskStatusSchema:Do,TaskSchema:jt,CreateTaskResultSchema:We,TaskStatusNotificationParamsSchema:ps,TaskStatusNotificationSchema:ir,GetTaskRequestSchema:Tr,GetTaskResultSchema:Cr,GetTaskPayloadRequestSchema:kr,GetTaskPayloadResultSchema:mc,ListTasksRequestSchema:Be,ListTasksResultSchema:Ie,CancelTaskRequestSchema:ar,CancelTaskResultSchema:g.merge(jt),ClientRequestSchema:Y([fe,M,Mo,So,Xt,gt,ze,T,ie,Ze,we,go,Rr,Tr,kr,Be,ar]),ClientNotificationSchema:Y([h,Oe,G,ls,ir]),ClientResultSchema:Y([m,To,Co,ns,Lo,Cr,Ie,We]),ServerRequestSchema:Y([fe,Eo,ts,Er,Tr,kr,Be,ar]),ServerNotificationSchema:Y([h,Oe,vo,Ae,ke,Yn,rr,ir,os]),ServerResultSchema:Y([m,W,cs,br,It,Je,A,de,wr,$r,Cr,Ie,We]),CallToolResultWireSchema:Q().superRefine((Fe,BS)=>{if(!(typeof Fe!="object"||Fe===null||Array.isArray(Fe)||Fe.content!==void 0)){for(let zd of Xg)if(zd in Fe){BS.addIssue({code:"custom",message:`content is required when the body carries '${zd}' \u2014 another result family cannot default into an empty tools/call success`});return}}}).transform(jl).pipe(wr)}}var xb;function Qg(){return xb??=Ob()}function e_(e){return e.type!=="object"}var Nb=new Set(["const","enum","default","examples"]),jb=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function Ag(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function Ab(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(Ag(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=tp(e.$schema)&&e.$recursiveAnchor!==!0,o=(n,s)=>{if(Array.isArray(n))return n.map(a=>o(a,!1));if(n===null||typeof n!="object"||!s&&Ag(n.$id))return n;let i={},c=!1;for(let[a,u]of Object.entries(n))s?i[a]=o(u,!1):(a==="$ref"||a==="$dynamicRef")&&typeof u=="string"?i[a]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u:a==="$recursiveRef"&&u==="#"&&r?c=!0:Nb.has(a)?i[a]=u:jb.has(a)?i[a]=o(u,!0):i[a]=o(u,!1);return c&&("$ref"in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}]:i.$ref="#/properties/result"),i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:o(e,!1)},required:["result"]}}var t_={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},r_={"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},qb={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},Ha;function Al(){if(Ha)return Ha;let e=Qg();return Ha={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ha}function o_(e){return Object.prototype.hasOwnProperty.call(t_,e)}function n_(e){return Object.prototype.hasOwnProperty.call(r_,e)}function Mb(e){return Object.prototype.hasOwnProperty.call(qb,e)}function Lb(e){return Mb(e)?Al().resultSchemas[e]:void 0}function Db(e){return o_(e)?Al().requestSchemas[e]:void 0}function Zb(e){return n_(e)?Al().notificationSchemas[e]:void 0}var TP=Object.keys(t_),CP=Object.keys(r_);function kl(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ja(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var qg={ok:!1,reason:"not-in-era"};function Mg(e){return kl(e)&&kl(e.outputSchema)&&e_(e.outputSchema)}var ql={era:"2025-11-25",hasRequestMethod:o_,hasNotificationMethod:n_,validateRequest:(e,t)=>Ja(Db(e),t),validateResult:(e,t)=>Ja(Lb(e),t),validateNotification:(e,t)=>Ja(Zb(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>qg,validateInputResponse:()=>qg,samplingResultVariant:((e,t)=>{let r=Qg();return Ja(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=Yg(e),o=r.structuredContent;if(o===void 0)return r;let n=typeof o!="object"||o===null||Array.isArray(o),s=t!==void 0&&e_(t);return!n&&!s?r:{...r,structuredContent:{result:o}}},decodeResult(e,t){if(kl(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:r}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;return!Array.isArray(r)||!r.some(o=>Mg(o))?t:{...t,tools:r.map(o=>Mg(o)?{...o,outputSchema:Ab(o.outputSchema)}:o)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function Ub(){let e=un(()=>Y([l(),L(),H(),lr(),K(l(),e),I(e)])),t=K(l(),e),r=Y([l(),L().int()]),o=l(),n=Y([l(),L().int()]),s=te(["user","assistant"]),i=te(["debug","info","notice","warning","error","critical","alert","emergency"]),c=l().refine(Ie=>{try{return atob(Ie),!0}catch{return!1}},{message:"Invalid Base64 string"}),a=P({ttl:L().optional()}),u=P({taskId:l()}),d=oe({progressToken:r.optional(),"io.modelcontextprotocol/related-task":u.optional()}),p=P({_meta:d.optional()}),g=p.extend({task:a.optional()}),v=P({_meta:d.optional()}),m=P({method:l(),params:v.loose().optional()}),_=P({src:l(),mimeType:l().optional(),sizes:I(l()).optional(),theme:te(["light","dark"]).optional()}),h=P({icons:I(_).optional()}),f=P({name:l(),title:l().optional()}),z=f.extend({...f.shape,...h.shape,version:l(),websiteUrl:l().optional(),description:l().optional()}),S=$t(P({applyDefaults:H().optional()}),t),R=dr(Ie=>Ie&&typeof Ie=="object"&&!Array.isArray(Ie)&&Object.keys(Ie).length===0?{form:{}}:Ie,$t(P({form:S.optional(),url:t.optional()}),t.optional())),w=oe({list:t.optional(),cancel:t.optional(),requests:oe({sampling:oe({createMessage:t.optional()}).optional(),elicitation:oe({create:t.optional()}).optional()}).optional()}),b=oe({list:t.optional(),cancel:t.optional(),requests:oe({tools:oe({call:t.optional()}).optional()}).optional()}),y=P({experimental:K(l(),t).optional(),sampling:P({context:t.optional(),tools:t.optional()}).optional(),elicitation:R.optional(),roots:P({listChanged:H().optional()}).optional(),tasks:w.optional(),extensions:K(l(),t).optional()}),E=P({experimental:K(l(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:P({listChanged:H().optional()}).optional(),resources:P({subscribe:H().optional(),listChanged:H().optional()}).optional(),tools:P({listChanged:H().optional()}).optional(),tasks:b.optional(),extensions:K(l(),t).optional()}),N=P({progress:L(),total:X(L()),message:X(l())}),V=P({...v.shape,...N.shape,progressToken:r}),M=m.extend({method:O("notifications/progress"),params:V}),Z=v.extend({level:i,logger:l().optional(),data:Q()}),W=m.extend({method:O("notifications/message"),params:Z}),G=P({uri:l(),mimeType:X(l()),_meta:K(l(),Q()).optional()}),fe=G.extend({text:l()}),$e=G.extend({blob:c}),be=P({audience:I(s).optional(),priority:L().min(0).max(1).optional(),lastModified:wt.datetime({offset:!0}).optional()}),Oe=P({...f.shape,...h.shape,uri:l(),description:X(l()),mimeType:X(l()),size:X(L()),annotations:be.optional(),_meta:X(oe({}))}),he=P({...f.shape,...h.shape,uriTemplate:l(),description:X(l()),mimeType:X(l()),annotations:be.optional(),_meta:X(oe({}))}),k=m.extend({method:O("notifications/resources/list_changed"),params:v.optional()}),j=v.extend({uri:l()}),F=m.extend({method:O("notifications/resources/updated"),params:j}),$=P({name:l(),description:X(l()),required:X(H())}),C=P({...f.shape,...h.shape,description:X(l()),arguments:X(I($)),_meta:X(oe({}))}),x=m.extend({method:O("notifications/prompts/list_changed"),params:v.optional()}),J=P({type:O("text"),text:l(),annotations:be.optional(),_meta:K(l(),Q()).optional()}),ee=P({type:O("image"),data:c,mimeType:l(),annotations:be.optional(),_meta:K(l(),Q()).optional()}),pe=P({type:O("audio"),data:c,mimeType:l(),annotations:be.optional(),_meta:K(l(),Q()).optional()}),ae=P({type:O("tool_use"),name:l(),id:l(),input:K(l(),Q()),_meta:K(l(),Q()).optional()}),ze=P({type:O("resource"),resource:Y([fe,$e]),annotations:be.optional(),_meta:K(l(),Q()).optional()}),Je=Oe.extend({type:O("resource_link")}),T=Y([J,ee,pe,Je,ze]),A=P({role:s,content:T}),D=P({title:l().optional(),readOnlyHint:H().optional(),destructiveHint:H().optional(),idempotentHint:H().optional(),openWorldHint:H().optional()}),se=m.extend({method:O("notifications/tools/list_changed"),params:v.optional()}),ie=P({name:l().optional()}),de=P({hints:I(ie).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),ke=P({mode:te(["auto","required","none"]).optional()}),Ne=P({type:O("boolean"),title:l().optional(),description:l().optional(),default:H().optional()}),Ze=P({type:O("string"),title:l().optional(),description:l().optional(),minLength:L().optional(),maxLength:L().optional(),format:te(["email","uri","date","date-time"]).optional(),default:l().optional()}),xe=P({type:te(["number","integer"]),title:l().optional(),description:l().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),we=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),default:l().optional()}),ot=P({type:O("string"),title:l().optional(),description:l().optional(),oneOf:I(P({const:l(),title:l()})),default:l().optional()}),Ae=P({type:O("string"),title:l().optional(),description:l().optional(),enum:I(l()),enumNames:I(l()).optional(),default:l().optional()}),ht=Y([we,ot]),at=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({type:O("string"),enum:I(l())}),default:I(l()).optional()}),gt=P({type:O("array"),title:l().optional(),description:l().optional(),minItems:L().optional(),maxItems:L().optional(),items:P({anyOf:I(P({const:l(),title:l()}))}),default:I(l()).optional()}),It=Y([at,gt]),Ot=Y([Ae,ht,It]),Xt=Y([Ot,Ne,Ze,xe]),Qt=g.extend({mode:O("form").optional(),message:l(),requestedSchema:P({type:O("object"),properties:K(l(),Xt),required:I(l()).optional()}).catchall(Q())}),er=P({type:O("ref/resource"),uri:l()}),tr=P({type:O("ref/prompt"),name:l()}),mo=P({uri:l().startsWith("file://"),name:l().optional(),_meta:K(l(),Q()).optional()}),xt=y.shape,fo=P({experimental:xt.experimental,sampling:xt.sampling,elicitation:xt.elicitation,roots:xt.roots,extensions:xt.extensions}),nt=E.shape,vr=P({experimental:nt.experimental,logging:nt.logging,completions:nt.completions,prompts:nt.prompts,resources:nt.resources,tools:nt.tools,extensions:nt.extensions}),br=oe({progressToken:r.optional(),[fr]:l(),[Jr]:z.optional(),[Tt]:fo,[Ut]:i.optional()}),rr=P({...f.shape,...h.shape,description:l().optional(),inputSchema:oe({$schema:l().optional(),type:O("object")}),outputSchema:oe({$schema:l().optional()}).optional(),annotations:D.optional(),_meta:K(l(),Q()).optional()}),ho=P({type:O("tool_result"),toolUseId:l(),content:I(T),structuredContent:Q().optional(),isError:H().optional(),_meta:K(l(),Q()).optional()}),zr=Y([J,ee,pe,ae,ho]),or=P({role:s,content:Y([zr,I(zr)]),_meta:K(l(),Q()).optional()}),Rr=l(),$r=oe({[Et]:z.optional().catch(void 0)}),wr=$r.optional();function Ue(Ie){return oe({_meta:wr,resultType:Rr.default("complete"),...Ie})}let go=Ue({}),Yn=Ue({nextCursor:o.optional()}),Pr=Ue({content:I(T),structuredContent:Q().optional(),isError:H().optional()}),_o=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),tools:I(rr),nextCursor:o.optional()}),So=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),prompts:I(C),nextCursor:o.optional()}),yo=Ue({description:l().optional(),messages:I(A)}),vo=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),resources:I(Oe),nextCursor:o.optional()}),bo=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),resourceTemplates:I(he),nextCursor:o.optional()}),zo=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),contents:I(Y([fe,$e]))}),Ro=Ue({completion:P({values:I(l()).max(100),total:L().int().optional(),hasMore:H().optional()}).loose()}),Xn=Ue({ttlMs:L().int().min(0),cacheScope:te(["public","private"])}),$o=Ue({ttlMs:L().int().min(0).catch(0),cacheScope:te(["public","private"]).catch("private"),supportedVersions:I(l()),capabilities:vr,instructions:l().optional()}),Nt=P({messages:I(or),modelPreferences:de.optional(),systemPrompt:l().optional(),includeContext:te(["none","thisServer","allServers"]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:I(l()).optional(),metadata:t.optional(),tools:I(rr).optional(),toolChoice:ke.optional()}),wo=P({method:O("sampling/createMessage"),params:Nt}),Po=P({method:O("roots/list"),params:P({_meta:K(l(),Q()).optional()}).optional()}),Eo=P({...or.shape,model:l(),stopReason:l().optional()}),To=P({roots:I(mo)}),Co=P({action:te(["accept","decline","cancel"]),content:K(l(),Y([l(),L(),H(),I(l())])).optional()}),ko=P({mode:O("url"),message:l(),url:l().url()}),Io=Y([Qt,ko]),Oo=P({method:O("elicitation/create"),params:Io}),xo=Y([wo,Po,Oo]),No=Y([Eo,To,Co]),jo=K(l(),xo),Ao=K(l(),No),nr=Ue({inputRequests:jo.optional(),requestState:l().optional()}),sr={inputResponses:Ao.optional(),requestState:l().optional()},Qn=P({_meta:br,...sr}),es=oe({progressToken:r.optional()});function et(Ie,ar){return P({method:O(Ie),params:P({_meta:br,...ar})})}function tt(Ie,ar){return P({method:O(Ie),params:P({_meta:es.optional(),...ar}).optional()})}let qo={name:l(),arguments:K(l(),Q()).optional(),...sr},ct={cursor:o.optional()},ts=et("tools/call",qo),rs=et("tools/list",ct),os=et("prompts/list",ct),ns=et("prompts/get",{name:l(),arguments:K(l(),l()).optional(),...sr}),ss=et("resources/list",ct),is=et("resources/templates/list",ct),as=et("resources/read",{uri:l(),...sr}),Mo={ref:Y([tr,er]),argument:P({name:l(),value:l()}),context:P({arguments:K(l(),l()).optional()}).optional()},cs=et("completion/complete",Mo),us=et("server/discover",{}),Er=P({toolsListChanged:H().optional(),promptsListChanged:H().optional(),resourcesListChanged:H().optional(),resourceSubscriptions:I(l()).optional()}),Lo={notifications:Er},ls=et("subscriptions/listen",Lo),ds=$r.extend({"io.modelcontextprotocol/subscriptionId":n}),Do=oe({_meta:ds,resultType:Rr.default("complete")}),jt={"tools/call":tt("tools/call",qo),"tools/list":tt("tools/list",ct),"prompts/get":tt("prompts/get",{name:l(),arguments:K(l(),l()).optional()}),"prompts/list":tt("prompts/list",ct),"resources/list":tt("resources/list",ct),"resources/templates/list":tt("resources/templates/list",ct),"resources/read":tt("resources/read",{uri:l()}),"completion/complete":tt("completion/complete",Mo),"server/discover":tt("server/discover",{}),"subscriptions/listen":tt("subscriptions/listen",Lo)};function We(Ie){return oe({_meta:wr,...Ie})}let ps={"tools/call":We({content:I(T),structuredContent:Q().optional(),isError:H().optional()}),"tools/list":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),tools:I(rr),nextCursor:o.optional()}),"prompts/get":We({description:l().optional(),messages:I(A)}),"prompts/list":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),prompts:I(C),nextCursor:o.optional()}),"resources/list":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),resources:I(Oe),nextCursor:o.optional()}),"resources/templates/list":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),resourceTemplates:I(he),nextCursor:o.optional()}),"resources/read":We({ttlMs:L().int().min(0),cacheScope:te(["public","private"]),contents:I(Y([fe,$e]))}),"completion/complete":We({completion:P({values:I(l()).max(100),total:L().int().optional(),hasMore:H().optional()}).loose()}),"server/discover":We({ttlMs:L().int().min(0).catch(0),cacheScope:te(["public","private"]).catch("private"),supportedVersions:I(l()),capabilities:vr,instructions:l().optional()}),"subscriptions/listen":We({})},ir=oe({"io.modelcontextprotocol/subscriptionId":n.optional()}),Tr=P({method:O("notifications/subscriptions/acknowledged"),params:P({_meta:ir.optional(),notifications:Er})}),Cr=P({_meta:ir.optional(),requestId:n,reason:l().optional()}),kr=P({method:O("notifications/cancelled"),params:Cr}),mc={"notifications/cancelled":kr,"notifications/progress":M,"notifications/message":W,"notifications/resources/updated":F,"notifications/resources/list_changed":k,"notifications/tools/list_changed":se,"notifications/prompts/list_changed":x,"notifications/subscriptions/acknowledged":Tr},Be=Ie=>P({jsonrpc:O("2.0"),id:Y([l(),L().int()]),result:Ie}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:o,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:a,RelatedTaskMetadataSchema:u,RequestMetaSchema:d,BaseRequestParamsSchema:p,TaskAugmentedRequestParamsSchema:g,NotificationsParamsSchema:v,NotificationSchema:m,IconSchema:_,IconsSchema:h,BaseMetadataSchema:f,ImplementationSchema:z,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:b,ClientCapabilitiesSchema:y,ServerCapabilitiesSchema:E,ProgressSchema:N,ProgressNotificationParamsSchema:V,ProgressNotificationSchema:M,LoggingMessageNotificationParamsSchema:Z,LoggingMessageNotificationSchema:W,ResourceContentsSchema:G,TextResourceContentsSchema:fe,BlobResourceContentsSchema:$e,AnnotationsSchema:be,ResourceSchema:Oe,ResourceTemplateSchema:he,ResourceListChangedNotificationSchema:k,ResourceUpdatedNotificationParamsSchema:j,ResourceUpdatedNotificationSchema:F,PromptArgumentSchema:$,PromptSchema:C,PromptListChangedNotificationSchema:x,TextContentSchema:J,ImageContentSchema:ee,AudioContentSchema:pe,ToolUseContentSchema:ae,EmbeddedResourceSchema:ze,ResourceLinkSchema:Je,ContentBlockSchema:T,PromptMessageSchema:A,ToolAnnotationsSchema:D,ToolListChangedNotificationSchema:se,ModelHintSchema:ie,ModelPreferencesSchema:de,ToolChoiceSchema:ke,BooleanSchemaSchema:Ne,StringSchemaSchema:Ze,NumberSchemaSchema:xe,UntitledSingleSelectEnumSchemaSchema:we,TitledSingleSelectEnumSchemaSchema:ot,LegacyTitledEnumSchemaSchema:Ae,SingleSelectEnumSchemaSchema:ht,UntitledMultiSelectEnumSchemaSchema:at,TitledMultiSelectEnumSchemaSchema:gt,MultiSelectEnumSchemaSchema:It,EnumSchemaSchema:Ot,PrimitiveSchemaDefinitionSchema:Xt,ElicitRequestFormParamsSchema:Qt,ResourceTemplateReferenceSchema:er,PromptReferenceSchema:tr,RootSchema:mo,ClientCapabilities2026Schema:fo,ServerCapabilities2026Schema:vr,RequestMetaEnvelopeSchema:br,ToolSchema:rr,ToolResultContentSchema:ho,SamplingMessageContentBlockSchema:zr,SamplingMessageSchema:or,ResultTypeSchema:Rr,ResultMetaSchema:$r,ResultSchema:go,PaginatedResultSchema:Yn,CallToolResultSchema:Pr,ListToolsResultSchema:_o,ListPromptsResultSchema:So,GetPromptResultSchema:yo,ListResourcesResultSchema:vo,ListResourceTemplatesResultSchema:bo,ReadResourceResultSchema:zo,CompleteResultSchema:Ro,CacheableResultSchema:Xn,DiscoverResultSchema:$o,CreateMessageRequestParamsSchema:Nt,CreateMessageRequestSchema:wo,ListRootsRequestSchema:Po,CreateMessageResultSchema:Eo,ListRootsResultSchema:To,ElicitResultSchema:Co,ElicitRequestURLParamsSchema:ko,ElicitRequestParamsSchema:Io,ElicitRequestSchema:Oo,InputRequestSchema:xo,InputResponseSchema:No,InputRequestsSchema:jo,InputResponsesSchema:Ao,InputRequiredResultSchema:nr,InputResponseRequestParamsSchema:Qn,CallToolRequestSchema:ts,ListToolsRequestSchema:rs,ListPromptsRequestSchema:os,GetPromptRequestSchema:ns,ListResourcesRequestSchema:ss,ListResourceTemplatesRequestSchema:is,ReadResourceRequestSchema:as,CompleteRequestSchema:cs,DiscoverRequestSchema:us,SubscriptionFilterSchema:Er,SubscriptionsListenRequestSchema:ls,SubscriptionsListenResultMetaSchema:ds,SubscriptionsListenResultSchema:Do,dispatchRequestSchemas:jt,dispatchResultSchemas:ps,NotificationMetaSchema:ir,SubscriptionsAcknowledgedNotificationSchema:Tr,CancelledNotificationParamsSchema:Cr,CancelledNotificationSchema:kr,notificationSchemas2026:mc,JSONRPCResultResponseSchema:Be(go),CallToolResultResponseSchema:Be(Y([Pr,nr])),ListToolsResultResponseSchema:Be(_o),ListPromptsResultResponseSchema:Be(So),GetPromptResultResponseSchema:Be(Y([yo,nr])),ListResourcesResultResponseSchema:Be(vo),ListResourceTemplatesResultResponseSchema:Be(bo),ReadResourceResultResponseSchema:Be(Y([zo,nr])),CompleteResultResponseSchema:Be(Ro),DiscoverResultResponseSchema:Be($o),SubscriptionsListenResultResponseSchema:Be(Do)}}var Fb;function Wt(){return Fb??=Ub()}var Vb=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function Hb(e){return Vb.includes(e)}var no=Symbol("modelcontextprotocol.resultCacheHintFallback");function Qa(e,t){if(t===void 0)return e;let r=e[no];if(r===void 0)return{...e,[no]:t};let o={},n=r.ttlMs??t.ttlMs;n!==void 0&&(o.ttlMs=n);let s=r.cacheScope??t.cacheScope;return s!==void 0&&(o.cacheScope=s),{...e,[no]:o}}function Jb(e){return e[no]}function Ml(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Ll(e){return e==="public"||e==="private"}function Dl(e,t){if(e.ttlMs!==void 0&&!Ml(e.ttlMs))throw new RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!Ll(e.cacheScope))throw new RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var B=(function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e})({}),ne=class s_ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return so(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return so(this,t)}constructor(t,r,o){super(r),this.code=t,this.data=o,this.name="ProtocolError",xl(this,new.target)}static fromError(t,r,o){if(t===B.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new i_(n.elicitations,r)}if(t===B.UnsupportedProtocolVersion&&o){let n=o;if(Array.isArray(n.supported)&&typeof n.requested=="string")return new Zl({supported:n.supported,requested:n.requested},r)}if(t===B.InvalidParams||t===B.ResourceNotFound){let n=o;if(typeof n?.uri=="string"&&(t===B.ResourceNotFound||Object.keys(n).length===1))return new ec(n.uri,r)}if(t===B.MissingRequiredClientCapability&&o){let n=o;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities=="object"&&!Array.isArray(n.requiredCapabilities))return new tc({requiredCapabilities:n.requiredCapabilities},r)}return new s_(t,r,o)}},ec=class extends ne{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(B.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},i_=class extends ne{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(B.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Zl=class extends ne{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(B.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},tc=class extends ne{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(B.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Bb=0,Kb="private",Gb=["tools/call","prompts/get","resources/read"];function Wb(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete"||Gb.includes(e))return t;throw new ne(B.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Yb(e,t){let r=Jb(t);if(t.resultType!=="complete"||!Hb(e))return r===void 0?t:rz(t);let o=t,n=Ml(o.ttlMs)?o.ttlMs:ez(r),s=Ll(o.cacheScope)?o.cacheScope:tz(r),i={...o,ttlMs:n,cacheScope:s};return delete i[no],i}function Xb(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qb(e,t){if(t===void 0)return e;let r=e._meta;return r===void 0?{...e,_meta:{[Et]:t}}:!Xb(r)||r[Et]!==void 0?e:{...e,_meta:{...r,[Et]:t}}}function ez(e){return e!==void 0&&Ml(e.ttlMs)?e.ttlMs:Bb}function tz(e){return e!==void 0&&Ll(e.cacheScope)?e.cacheScope:Kb}function rz(e){let t={...e};return delete t[no],t}var oz=["elicitation/create","sampling/createMessage","roots/list"],Ba;function a_(){if(Ba)return Ba;let e=Wt();return Ba={request:{"elicitation/create":P({method:O("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":P({method:O("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":P({method:O("roots/list"),params:oe({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Ba}function c_(e){return oz.includes(e)}function Pl(e){return c_(e)?a_().request[e]:void 0}function nz(e){return c_(e)?a_().response[e]:void 0}var Ul={"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},u_={"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};function l_(e){return Object.prototype.hasOwnProperty.call(Ul,e)}function d_(e){return Object.prototype.hasOwnProperty.call(u_,e)}function sz(e){return Object.prototype.hasOwnProperty.call(Ul,e)}function iz(e){return l_(e)?Wt().dispatchRequestSchemas[e]:void 0}function az(e){return sz(e)?Wt().dispatchResultSchemas[e]:void 0}function cz(e){return d_(e)?Wt().notificationSchemas2026[e]:void 0}var kP=Object.keys(Ul),IP=Object.keys(u_);function Ln(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function qn(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var uz={ok:!1,reason:"not-in-era"},lz=[fr,Tt];function dz(e,t){let r=t,o=!1,n=()=>(o||(r={...r},o=!0),r),s=t.tools;e==="tools/list"&&Array.isArray(s)&&s.some(c=>Ln(c)&&"execution"in c)&&(n().tools=s.map(c=>{if(!Ln(c)||!("execution"in c))return c;let a={...c};return delete a.execution,a}));let i=t.capabilities;if(Ln(i)&&"tasks"in i){let c={...i};delete c.tasks,n().capabilities=c}return r}var Fl={era:"2026-07-28",hasRequestMethod:l_,hasNotificationMethod:d_,hasInputRequestMethod:e=>Pl(e)!==void 0,validateRequest:(e,t)=>qn(iz(e),t),validateResult:(e,t)=>qn(az(e),t),validateNotification:(e,t)=>qn(cz(e),t),validateInputRequest:(e,t)=>qn(Pl(e),t),validateInputResponse:(e,t)=>qn(nz(e),t),samplingResultVariant:()=>uz,outboundEnvelope(e){return{[fr]:e.protocolVersion,[Jr]:e.clientInfo,[Tt]:e.clientCapabilities,...e.logLevel!==void 0&&{[Ut]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let o of lz)o in e||t.push({key:o,problem:"missing"});let r=Wt().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let o of r.error.issues){let n=o.path.map(String),s=n.length>0?n.join("."):"_meta";n.length===1&&t.some(i=>i.key===s&&i.problem==="missing")||t.push({key:s,problem:o.message})}return t},projectCallToolResult:e=>Yg(e),inputRequestSchema:Pl,decodeResult(e,t){if(!Ln(t))return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: 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:e,violation:"missing-resultType"})};if(typeof r!="string")return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let i=t.inputRequests,c=Ln(i)?i:{},a=t.requestState,u=t._meta===void 0?void 0:Wt().ResultMetaSchema.safeParse(t._meta),d=u?.success?u.data:void 0;return Object.keys(c).length===0&&typeof a!="string"?{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:c,...typeof a=="string"&&{requestState:a},...d!==void 0&&{_meta:d}}}if(r!=="complete")return{kind:"invalid",error:new ue(me.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let o=pz(),n=Object.hasOwn(o,e)?o[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new ue(me.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,r){return Qb(Yb(e,Wb(e,dz(e,t))),r)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=Wt().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(r=>r.message).join("; ")}`}},Ka;function pz(){if(Ka)return Ka;let e=Wt();return Ka={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Ka}var Vl="2026-07-28";function io(e){return e!==void 0&&Un(e)?Fl:ql}function Lg(e){return e.revision!==void 0?io(e.revision).era:e.era==="modern"?Fl.era:ql.era}function El(e){return p_.some(t=>t.hasRequestMethod(e))}function Tl(e){return p_.some(t=>t.hasNotificationMethod(e))}function Dg(e){return e==="tasks/get"||e==="tasks/cancel"}var p_=[ql,Fl];var mz=Qd({AnnotationsSchema:()=>Ct,AudioContentSchema:()=>Qr,BaseMetadataSchema:()=>Pt,BaseRequestParamsSchema:()=>Le,BlobResourceContentsSchema:()=>wn,BooleanSchemaSchema:()=>kn,CallToolRequestParamsSchema:()=>na,CallToolRequestSchema:()=>sa,CallToolResultSchema:()=>Cn,CancelTaskRequestSchema:()=>ll,CancelTaskResultSchema:()=>dl,CancelledNotificationParamsSchema:()=>ai,CancelledNotificationSchema:()=>yn,ClientCapabilitiesSchema:()=>di,ClientNotificationSchema:()=>ml,ClientRequestSchema:()=>pl,ClientResultSchema:()=>fl,ClientTasksCapabilitySchema:()=>ui,CompatibilityCallToolResultSchema:()=>Qu,CompleteRequestParamsSchema:()=>Oa,CompleteRequestSchema:()=>xa,CompleteResultSchema:()=>Na,ContentBlockSchema:()=>eo,CreateMessageRequestParamsSchema:()=>_a,CreateMessageRequestSchema:()=>Sa,CreateMessageResultSchema:()=>ya,CreateMessageResultWithToolsSchema:()=>va,CreateTaskResultSchema:()=>rl,CursorSchema:()=>pn,DiscoverRequestSchema:()=>gi,DiscoverResultSchema:()=>_i,ElicitRequestFormParamsSchema:()=>oo,ElicitRequestParamsSchema:()=>wa,ElicitRequestSchema:()=>Pa,ElicitRequestURLParamsSchema:()=>$a,ElicitResultSchema:()=>Ca,ElicitationCompleteNotificationParamsSchema:()=>Ea,ElicitationCompleteNotificationSchema:()=>Ta,EmbeddedResourceSchema:()=>Gi,EmptyResultSchema:()=>Sn,EnumSchemaSchema:()=>Ra,GetPromptRequestParamsSchema:()=>Ji,GetPromptRequestSchema:()=>Bi,GetPromptResultSchema:()=>Xi,GetTaskPayloadRequestSchema:()=>il,GetTaskPayloadResultSchema:()=>al,GetTaskRequestSchema:()=>nl,GetTaskResultSchema:()=>sl,IconSchema:()=>ci,IconsSchema:()=>Vt,ImageContentSchema:()=>Xr,ImplementationSchema:()=>Gr,InitializeRequestParamsSchema:()=>pi,InitializeRequestSchema:()=>mi,InitializeResultSchema:()=>fi,InitializedNotificationSchema:()=>hi,JSONArraySchema:()=>Yu,JSONObjectSchema:()=>Ee,JSONRPCErrorResponseSchema:()=>Kr,JSONRPCMessageSchema:()=>_n,JSONRPCNotificationSchema:()=>gn,JSONRPCRequestSchema:()=>hn,JSONRPCResponseSchema:()=>ii,JSONRPCResultResponseSchema:()=>Br,JSONValueSchema:()=>Zt,LegacyTitledEnumSchemaSchema:()=>xn,ListChangedOptionsBaseSchema:()=>el,ListPromptsRequestSchema:()=>Vi,ListPromptsResultSchema:()=>Hi,ListResourceTemplatesRequestSchema:()=>$i,ListResourceTemplatesResultSchema:()=>wi,ListResourcesRequestSchema:()=>zi,ListResourcesResultSchema:()=>Ri,ListRootsRequestSchema:()=>Aa,ListRootsResultSchema:()=>qa,ListTasksRequestSchema:()=>cl,ListTasksResultSchema:()=>ul,ListToolsRequestSchema:()=>ra,ListToolsResultSchema:()=>oa,LoggingLevelSchema:()=>Kt,LoggingMessageNotificationParamsSchema:()=>ua,LoggingMessageNotificationSchema:()=>la,ModelHintSchema:()=>da,ModelPreferencesSchema:()=>pa,MultiSelectEnumSchemaSchema:()=>za,NotificationSchema:()=>He,NotificationsParamsSchema:()=>Ve,NumberSchemaSchema:()=>ro,PaginatedRequestParamsSchema:()=>vi,PaginatedRequestSchema:()=>Ht,PaginatedResultSchema:()=>Jt,PingRequestSchema:()=>bn,PrimitiveSchemaDefinitionSchema:()=>An,ProgressNotificationParamsSchema:()=>yi,ProgressNotificationSchema:()=>zn,ProgressSchema:()=>Si,ProgressTokenSchema:()=>dn,PromptArgumentSchema:()=>Ui,PromptListChangedNotificationSchema:()=>Qi,PromptMessageSchema:()=>Yi,PromptReferenceSchema:()=>Ia,PromptSchema:()=>Fi,ReadResourceRequestParamsSchema:()=>Pi,ReadResourceRequestSchema:()=>Ei,ReadResourceResultSchema:()=>Ti,RelatedTaskMetadataSchema:()=>si,RequestIdSchema:()=>Ft,RequestMetaSchema:()=>mn,RequestSchema:()=>Te,ResourceContentsSchema:()=>Rn,ResourceLinkSchema:()=>Wi,ResourceListChangedNotificationSchema:()=>Ci,ResourceRequestParamsSchema:()=>Wr,ResourceSchema:()=>Pn,ResourceTemplateReferenceSchema:()=>ka,ResourceTemplateSchema:()=>bi,ResourceUpdatedNotificationParamsSchema:()=>Di,ResourceUpdatedNotificationSchema:()=>Zi,ResultMetaObjectSchema:()=>fn,ResultSchema:()=>Ce,RoleSchema:()=>Bt,RootSchema:()=>ja,RootsListChangedNotificationSchema:()=>Ma,SamplingContentSchema:()=>ha,SamplingMessageContentBlockSchema:()=>pr,SamplingMessageSchema:()=>ga,ServerCapabilitiesSchema:()=>vn,ServerNotificationSchema:()=>gl,ServerRequestSchema:()=>hl,ServerResultSchema:()=>_l,ServerTasksCapabilitySchema:()=>li,SetLevelRequestParamsSchema:()=>aa,SetLevelRequestSchema:()=>ca,SingleSelectEnumSchemaSchema:()=>ba,StringSchemaSchema:()=>to,SubscribeRequestParamsSchema:()=>ki,SubscribeRequestSchema:()=>Ii,SubscriptionFilterSchema:()=>En,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Ai,SubscriptionsAcknowledgedNotificationSchema:()=>qi,SubscriptionsListenRequestParamsSchema:()=>Ni,SubscriptionsListenRequestSchema:()=>ji,SubscriptionsListenResultMetaSchema:()=>Mi,SubscriptionsListenResultSchema:()=>Li,TaskAugmentedRequestParamsSchema:()=>gr,TaskCreationParamsSchema:()=>tl,TaskMetadataSchema:()=>ni,TaskSchema:()=>Gt,TaskStatusNotificationParamsSchema:()=>Da,TaskStatusNotificationSchema:()=>ol,TaskStatusSchema:()=>La,TextContentSchema:()=>Yr,TextResourceContentsSchema:()=>$n,TitledMultiSelectEnumSchemaSchema:()=>jn,TitledSingleSelectEnumSchemaSchema:()=>On,ToolAnnotationsSchema:()=>ea,ToolChoiceSchema:()=>ma,ToolExecutionSchema:()=>ta,ToolListChangedNotificationSchema:()=>ia,ToolResultContentSchema:()=>fa,ToolSchema:()=>Tn,ToolUseContentSchema:()=>Ki,UnsubscribeRequestParamsSchema:()=>Oi,UnsubscribeRequestSchema:()=>xi,UntitledMultiSelectEnumSchemaSchema:()=>Nn,UntitledSingleSelectEnumSchemaSchema:()=>In});var Fn=e=>hn.safeParse(e).success,Vn=e=>gn.safeParse(e).success,Ya=e=>Br.safeParse(e).success,Hl=e=>Kr.safeParse(e).success,Jl=e=>ii.safeParse(e).success;var kt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";function Bl(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function Kl(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var Zg="x-mcp-header",fz=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,hz=new Set(["string","integer","boolean","number"]);function Gl(e){let t=[],r=new Map,o=(s,i,c)=>{if(s===null||typeof s!="object")return;let a=s;if(Zg in a){if(!c||i.length===0)return`${Ga(i)}: 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 d=a[Zg];if(typeof d!="string"||d.length===0)return`${Ga(i)}: x-mcp-header MUST be a non-empty string`;if(!fz.test(d))return`${Ga(i)}: x-mcp-header '${d}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let p=typeof a.type=="string"?a.type:void 0;if(p===void 0||!hz.has(p))return`${Ga(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${p??"<none>"}`;let g=d.toLowerCase(),v=r.get(g);if(v!==void 0)return`x-mcp-header '${d}' is not case-insensitively unique (also declared as '${v}')`;r.set(g,d),t.push({path:i,headerName:d,type:p})}let u=a.properties;if(u!==null&&typeof u=="object")for(let[d,p]of Object.entries(u)){let g=o(p,[...i,d],c);if(g!==void 0)return g}for(let d of gz){let p=a[d];if(p===void 0)continue;let g=Array.isArray(p)?p:p!==null&&typeof p=="object"&&_z.has(d)?Object.values(p):[p];for(let v of g){let m=o(v,[...i,`<${d}>`],!1);if(m!==void 0)return m}}},n=o(e,[],!0);return n===void 0?{valid:!0,declarations:t}:{valid:!1,reason:n}}var gz=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],_z=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function Ga(e){return e.length===0?"<root>":e.join(".")}var Wa=-32020,OP=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32e3],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:[B.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:[Wa,B.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:[B.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:[B.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:[B.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:[Wa],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `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 spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. 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 \u2014 including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. 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:[B.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:[Wa],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."}],Sz={[B.ParseError]:400,[B.InvalidRequest]:400,[B.MethodNotFound]:404,[B.UnsupportedProtocolVersion]:400,[B.MissingRequiredClientCapability]:400,[Wa]:400};function rc(e,t){return Ws(e,t)}function Mn(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function ao(e){if(e==null)return!1;let t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof e["~standard"]?.validate=="function"}var Ug=!1,Il="draft-2020-12";function Sr(e,t="input"){let r=e["~standard"],o;if(r.jsonSchema)o=r.jsonSchema[t]({target:Il});else if(r.vendor==="zod"){if(!("_zod"in e))throw new 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().");Ug||(Ug=!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.")),o=Ks(e,{target:Il,io:t})}else throw new Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return o.type!==void 0?o:m_(o)?{type:"object",...o}:o;if(o.type!==void 0&&o.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(o.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...o}}function m_(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every(o=>o!==null&&typeof o=="object"&&(o.type==="object"||m_(o)))}return!1}function yz(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function _r(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(o=>yz(o)).join(", ")}:{success:!0,data:r.value}}function vz(e){let t=Ks(e,{target:Il,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var bz=/\\\.\\d\{(\d+)\}/;function zz(e){let t=bz.exec(e),r=[void 0,-1,0];return t&&r.push(Number(t[1])),[!1,!0].flatMap(o=>[!1,!0].flatMap(n=>r.map(s=>wt.datetime({local:o,offset:n,precision:s}))))}function Rz(e,t){let r;switch(e){case"email":r=[pg()];break;case"uri":r=[Qs()];break;case"date":r=[wt.date()];break;case"date-time":r=zz(t);break}return new Set(r.map(o=>vz(o)).filter(o=>o!==void 0))}function $z(e,t,r){return r!=="zod"?!0:Rz(e,t).has(t)}function f_(e){let t=Sr(e,"input"),r=t.properties||{},o=t.required||[];return Object.entries(r).map(([n,s])=>({name:n,description:s?.description,required:o.includes(n)}))}function Zn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function wz(e){try{return Sr(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new ne(B.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var Pz=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Wl(e){return Pz.has(e)||e.startsWith("x-")}var Ez=new Set(["$schema",...Object.keys(oo.shape.requestedSchema.shape)]),Fg={string:Mn([to,In,On,xn]),number:Mn([ro]),integer:Mn([ro]),boolean:Mn([kn]),array:Mn([Nn,jn])},Tz=new Set(to.shape.format.unwrap().options);function Cz(e,t,r,o){if(!Zn(e))return e;let n=typeof e.type=="string"&&Object.hasOwn(Fg,e.type)?Fg[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,c]of Object.entries(e))n.has(i)||Wl(i)?s[i]=c:i==="pattern"&&e.type==="string"&&typeof e.format=="string"?Tz.has(e.format)?(typeof c!="string"||!$z(e.format,c,r))&&o.push(`${t}.${i}`):s[i]=c:o.push(`${t}.${i}`);return s}function kz(e,t){let r={},o=[];for(let[n,s]of Object.entries(e))n==="properties"&&Zn(s)?r[n]=Object.fromEntries(Object.entries(s).map(([i,c])=>[i,Cz(c,`properties.${i}`,t,o)])):Ez.has(n)?r[n]=s:Wl(n)||o.push(n);if(o.length>0)throw new ne(B.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);return r}function Iz(e,t){if(!Zn(e.properties))return t;let r=Object.entries(e.properties).filter(([,o])=>!rc(An,o).success).map(([o])=>`properties.${o}`);return r.length>0?r.join(", "):t}function Ol(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((o,n)=>Ol(o,t[n],`${r}[${n}]`)):!Zn(e)||!Zn(t)?[]:Object.entries(e).flatMap(([o,n])=>{let s=r?`${r}.${o}`:o;return Object.prototype.hasOwnProperty.call(t,o)?Ol(n,t[o],s):Wl(o)?[]:[s]})}function Oz(e){if(!ao(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=kz(wz(e.requestedSchema),t),o=rc(oo.shape.requestedSchema,r);if(!o.success)throw new ne(B.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Iz(r,o.error.message)}`);let n=Ol(r,o.data);if(n.length>0)throw new ne(B.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(o.data.required??[]).filter(i=>!Object.prototype.hasOwnProperty.call(o.data.properties,i));if(s.length>0)throw new ne(B.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:o.data}}function xz(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState=="string";if(!t&&!r)throw new 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",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var Nz=Object.assign(xz,{elicit(e){try{return{method:"elicitation/create",params:Oz(e)}}catch(t){throw t instanceof ne?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var h_=250;function g_(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function __(e,t){return new Promise((r,o)=>{if(t?.aborted){o(t.reason instanceof ue?t.reason:new ue(me.RequestTimeout,String(t.reason)));return}let n=setTimeout(()=>{t?.removeEventListener("abort",s),r()},e),s=()=>{clearTimeout(n),o(t?.reason instanceof ue?t.reason:new ue(me.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",s,{once:!0})})}function S_(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:o=>t.abort(o),dispose:()=>e?.removeEventListener("abort",r)}}var jz=["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"],Az={IdJagTokenExchangeResponseSchema:bl,OAuthClientInformationFullSchema:Rl,OAuthClientInformationSchema:Va,OAuthClientMetadataSchema:Fa,OAuthClientRegistrationErrorSchema:$l,OAuthErrorResponseSchema:zl,OAuthMetadataSchema:Za,OAuthProtectedResourceMetadataSchema:Sl,OAuthTokenRevocationRequestSchema:wl,OAuthTokensSchema:vl,OpenIdProviderDiscoveryMetadataSchema:yl,OpenIdProviderMetadataSchema:Ua},y_={},v_={};function b_(e,t){let r=e.slice(0,-6);y_[r]=t,v_[r]=o=>t.safeParse(o).success}for(let e of jz)b_(e,mz[e]);for(let[e,t]of Object.entries(Az))b_(e,t);var qz=Object.freeze(y_),Mz=Object.freeze(v_);function Lz(e){switch(e){case"initialize":case"notifications/initialized":return io(void 0);case"server/discover":return io(Vl);default:return}}var z_=6e4,Dz=[fr,Jr,Tt,Ut],Zz=["inputResponses","requestState"];function Vg(e,t){let r=e.params;if(!Dn(r))return{message:e,lifted:{}};let o=r._meta,n=Dn(o)?Dz.filter(a=>a in o):[],s=t==="request"?Zz.filter(a=>a in r):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},c={...r};if(n.length>0&&Dn(o)){let a={},u={...o};for(let d of n)a[d]=o[d],delete u[d];i.envelope=a,Object.keys(u).length>0?c._meta=u:delete c._meta}for(let a of s)a==="inputResponses"&&(i.inputResponses=c[a]),a==="requestState"&&(i.requestState=c[a]),delete c[a];return{message:{...e,params:c},lifted:i}}function Hg(e,t){let r=e.validateResult(t,void 0);if(!(!r.ok&&r.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(o){let n=e.validateResult(t,o);return n.ok?{value:n.value}:{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function Hn(e){return()=>e}var Uz=Hn(void 0);function Yl(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:Hn(t)}}}var Fz;var Xl=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{Fz=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??ri,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new ue(me.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ue(me.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let r=this.transport?.onerror;this._transport.onerror=n=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{o?.(n,s),Ya(n)||Hl(n)?this._onresponse(n):Fn(n)?this._onrequest(n,s):Vn(n)?this._onnotification(n,s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new ue(me.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let o of e.values())o(r);for(let o of t.values())o.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=Vg(e,"notification"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=Lg(t.classification);if(i!==o.era){this._onerror(new Error(`Era mismatch on inbound notification '${r.method}': classified as ${i} but this instance serves ${o.era}`));return}}if(Tl(r.method)&&!o.hasNotificationMethod(r.method))return;let n=this._notificationHandlers.get(r.method),s=this.fallbackNotificationHandler;n===void 0&&s===void 0||Promise.resolve().then(()=>n===void 0?s(r):n(r,o)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:r,lifted:o}=Vg(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(_,h,f)=>{let z={jsonrpc:"2.0",id:r.id,error:{code:_,message:h,...f!==void 0&&{data:f}}};s?.send(z).catch(S=>this._onerror(new Error(`Failed to send an error response: ${S}`)))};if(t?.classification!==void 0){let _=Lg(t.classification);if(_!==n.era){this._onerror(new Error(`Era mismatch on inbound request '${r.method}': classified as ${_} but this instance serves ${n.era}`));let h=t.classification.revision??_;i(B.UnsupportedProtocolVersion,`Unsupported protocol version: ${h}`,{supported:this._supportedProtocolVersions,requested:h});return}}if(El(r.method)&&!n.hasRequestMethod(r.method)&&!(Dg(r.method)&&this._customSchemaRequestMethods.has(r.method))){i(B.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(c===void 0){i(B.MethodNotFound,"Method not found");return}let a=n.checkInboundEnvelope(o);if(a!==void 0){i(B.InvalidParams,a);return}let u=(_,h)=>this._notificationViaCodec(this._resolveOutboundCodec(_.method),_,{...h,relatedRequestId:r.id}),d=(_,h,f)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(_.method),_,h,{...f,relatedRequestId:r.id}),p=new AbortController;this._requestHandlerAbortControllers.set(r.id,p);let g=o.inputResponses===void 0?void 0:Vz(o.inputResponses),v={sessionId:s?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...o.envelope!==void 0&&{envelope:o.envelope},...g!==void 0&&{inputResponses:g.accepted},...g!==void 0&&g.droppedKeys.length>0&&{droppedInputResponseKeys:g.droppedKeys},requestState:o.requestState===void 0?Uz:Hn(o.requestState),signal:p.signal,send:((_,h,f)=>{let z=this._resolveOutboundCodec(_.method);if(this._assertOutboundRequestInEra(z,_.method),ao(h))return d(_,h,f);let S=Hg(z,_.method);if(S===void 0)throw new TypeError(`'${_.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return d(_,S,h)}),notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(v,t);Promise.resolve().then(()=>c(r,m)).then(async _=>{if(p.signal.aborted)return;let h;try{h=n.encodeResult(r.method,_,this._outboundServerInfo())}catch(z){this._onerror(new Error(`Failed to encode result for ${r.method}: ${z}`)),i(B.InternalError,"Internal error");return}let f={result:h,jsonrpc:"2.0",id:r.id};await s?.send(f)},async _=>{if(p.signal.aborted)return;let h=Number.isSafeInteger(_.code)?_.code:B.InternalError,f={jsonrpc:"2.0",id:r.id,error:{code:n.encodeErrorCode(h),message:_.message??"Internal error",..._.data!==void 0&&{data:_.data}}};await s?.send(f)}).catch(_=>this._onerror(new Error(`Failed to send response: ${_}`))).finally(()=>{this._requestHandlerAbortControllers.get(r.id)===p&&this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(c);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ya(e)?r(e):r(ne.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let o=this._resolveOutboundCodec(e.method);if(ao(t))return Dg(e.method)||this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r);this._assertOutboundRequestInEra(o,e.method);let n=Hg(o,e.method);if(n===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(o,e,n,t)}_negotiatedWireCodec(){return io(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Lz(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(El(t)&&!e.hasRequestMethod(t))throw new ue(me.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let o=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(o,e.method),this._requestWithSchemaViaCodec(o,e,t,r)}_requestWithSchemaViaCodec(e,t,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c}=o??{},a=Date.now(),u,d;return new Promise((p,g)=>{let v=b=>{g(b)};if(!this._transport){v(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(b){v(b);return}if(o?.signal?.aborted){let b=o.signal.reason;throw b instanceof ue?b:new ue(me.RequestTimeout,String(b))}let m=e.era===Vl&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,_=this._requestMessageId++;d=_;let h={...t,jsonrpc:"2.0",id:_};o?.onprogress&&(this._progressHandlers.set(_,o.onprogress),h.params={...t.params,_meta:{...t.params?._meta,progressToken:_}});let f=this._envelopeOutbound(h),z=!1,S=b=>{z||(this._progressHandlers.delete(_),m===void 0?t.method!=="initialize"&&this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(b)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(y=>this._onerror(new Error(`Failed to send cancellation: ${y}`))):m.abort(),g(b instanceof ue?b:new ue(me.RequestTimeout,String(b))))};this._responseHandlers.set(_,b=>{if(o?.signal?.aborted)return;if(z=!0,b instanceof Error)return g(b);let y;try{y=e.decodeResult(t.method,b.result)}catch(N){return g(N instanceof Error?N:new Error(String(N)))}if(y.kind==="invalid")return g(y.error);if(y.kind==="input_required"){if(o?.allowInputRequired===!0)return p(Hz(y));let N={codec:e,request:t,resultSchema:r,options:o,flowStartedAt:a,retry:(V,M)=>this._requestWithSchemaViaCodec(e,V===void 0?{method:t.method}:{method:t.method,params:V},r,M)};return p(this._resolveNonCompleteResult(y,N))}let E=y.result;_r(r,E).then(N=>{N.success?p(N.data):g(new ue(me.InvalidResult,`Invalid result for ${t.method}: ${N.error}`))},g)}),u=()=>S(o?.signal?.reason),o?.signal?.addEventListener("abort",u,{once:!0});let R=o?.timeout??z_,w=()=>S(new ue(me.RequestTimeout,"Request timed out",{timeout:R}));this._setupTimeout(_,R,o?.maxTotalTimeout,w,o?.resetTimeoutOnProgress??!1),this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c,requestSignal:m?.signal}).catch(b=>{this._progressHandlers.delete(_),g(b)})}).finally(()=>{u&&o?.signal?.removeEventListener("abort",u),d!==void 0&&(this._responseHandlers.delete(d),this._cleanupTimeout(d))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new ue(me.NotConnected,"Not connected");if(Tl(t.method)&&!e.hasNotificationMethod(t.method))throw new ue(me.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let o=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&r?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(o,r).catch(n=>this._onerror(n))});return}await this._transport.send(o,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let o;if(typeof t=="function"){if(!El(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);o=(n,s)=>{let i=this._negotiatedWireCodec(),c=i.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era"&&(c=i.validateInputRequest(e,n)),!c.ok)throw c.reason==="not-in-era"?new ne(B.InternalError,`No wire schema for ${e} in the resolved era`):new Error(c.message);return Promise.resolve(t(c.value,s))}}else if(r)o=async(n,s)=>{let i=await _r(t.params,{...n.params});if(!i.success)throw new ne(B.InvalidParams,`Invalid params for ${e}: ${i.error}`);return r(i.data,s)};else throw new TypeError("setRequestHandler: handler is required");typeof t=="function"?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,o))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t=="function"){if(!Tl(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(o,n)=>{let s=n.validateNotification(e,o);if(!s.ok)throw s.reason==="not-in-era"?new ne(B.InternalError,`No wire schema for ${e} in the resolved era`):new Error(s.message);return Promise.resolve(t(s.value))});return}if(!r)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async o=>{let n=await _r(t.params,{...o.params});if(!n.success)throw new ne(B.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await r(n.data,o)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Dn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ql(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];r[n]=Dn(i)&&Dn(s)?{...i,...s}:s}return r}function Jg(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Vz(e){let t={},r=[];if(!Jg(e))return{accepted:t,droppedKeys:r};for(let[o,n]of Object.entries(e)){if(!Jg(n)||"method"in n||"result"in n){r.push(o);continue}t[o]=n}return{accepted:t,droppedKeys:r}}function Hz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var Jz=U((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,o=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(c){if(!c)throw new TypeError("argument string is required");var a=typeof c=="object"?s(c):c;if(typeof a!="string")throw new TypeError("argument string is required to be a string");var u=a.indexOf(";"),d=u!==-1?a.slice(0,u).trim():a.trim();if(!o.test(d))throw new TypeError("invalid media type");var p=new i(d.toLowerCase());if(u!==-1){var g,v,m;for(t.lastIndex=u;v=t.exec(a);){if(v.index!==u)throw new TypeError("invalid parameter format");u+=v[0].length,g=v[1].toLowerCase(),m=v[2],m.charCodeAt(0)===34&&(m=m.slice(1,-1),m.indexOf("\\")!==-1&&(m=m.replace(r,"$1"))),p.parameters[g]=m}if(u!==a.length)throw new TypeError("invalid parameter format")}return p}function s(c){var a;if(typeof c.getHeader=="function"?a=c.getHeader("content-type"):typeof c.headers=="object"&&(a=c.headers&&c.headers["content-type"]),typeof a!="string")throw new TypeError("content-type header is missing from object");return a}function i(c){this.parameters=Object.create(null),this.type=c}})),xP=gs(Jz(),1);var R_=10*1024*1024,ed=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??R_}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf(`
|
|
60
|
+
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return $_(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function $_(e){return _n.parse(JSON.parse(e))}function td(e){return JSON.stringify(e)+`
|
|
61
|
+
`}var Bz=/^[A-Za-z0-9._-]{1,128}$/;function Kz(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Bz.test(e)){let r=[...e].filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,s)=>s.indexOf(o)===n);return t.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function Gz(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);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 rd(e){let t=Kz(e);return Gz(e,t.warnings),t.isValid}function Wz(e){return typeof e=="object"&&e!==null&&"_zod"in e}function Yz(e){return typeof e=="object"&&e!==null&&!("_zod"in e)&&"_def"in e&&typeof e._def?.typeName=="string"}function Xz(e){if(typeof e!="object"||e===null||ao(e))return!1;let t=Object.getPrototypeOf(e);return t!==Object.prototype&&t!==null?!1:Object.values(e).every(r=>Wz(r))}function oc(e){if(e!==void 0){if(Xz(e))return P(e);if(typeof e=="object"&&e!==null&&!ao(e)&&Object.values(e).some(t=>Yz(t)))throw new 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(!ao(e))throw new TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return e}}var sc=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(f){if(super(),!e.IDENTIFIER.test(f))throw new Error("CodeGen: name must be a valid identifier");this.str=f}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var o=class extends t{constructor(f){super(),this._items=typeof f=="string"?[f]:f}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let f=this._items[0];return f===""||f==='""'}get str(){var f;return(f=this._str)!==null&&f!==void 0?f:this._str=this._items.reduce((z,S)=>`${z}${S}`,"")}get names(){var f;return(f=this._names)!==null&&f!==void 0?f:this._names=this._items.reduce((z,S)=>(S instanceof r&&(z[S.str]=(z[S.str]||0)+1),z),{})}};e._Code=o,e.nil=new o("");function n(f,...z){let S=[f[0]],R=0;for(;R<z.length;)c(S,z[R]),S.push(f[++R]);return new o(S)}e._=n;let s=new o("+");function i(f,...z){let S=[v(f[0])],R=0;for(;R<z.length;)S.push(s),c(S,z[R]),S.push(s,v(f[++R]));return a(S),new o(S)}e.str=i;function c(f,z){z instanceof o?f.push(...z._items):z instanceof r?f.push(z):f.push(p(z))}e.addCodeArg=c;function a(f){let z=1;for(;z<f.length-1;){if(f[z]===s){let S=u(f[z-1],f[z+1]);if(S!==void 0){f.splice(z-1,3,S);continue}f[z++]="+"}z++}}function u(f,z){if(z==='""')return f;if(f==='""')return z;if(typeof f=="string")return z instanceof r||f[f.length-1]!=='"'?void 0:typeof z!="string"?`${f.slice(0,-1)}${z}"`:z[0]==='"'?f.slice(0,-1)+z.slice(1):void 0;if(typeof z=="string"&&z[0]==='"'&&!(f instanceof r))return`"${f}${z.slice(1)}`}function d(f,z){return z.emptyStr()?f:f.emptyStr()?z:i`${f}${z}`}e.strConcat=d;function p(f){return typeof f=="number"||typeof f=="boolean"||f===null?f:v(Array.isArray(f)?f.join(","):f)}function g(f){return new o(v(f))}e.stringify=g;function v(f){return JSON.stringify(f).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.safeStringify=v;function m(f){return typeof f=="string"&&e.IDENTIFIER.test(f)?new o(`.${f}`):n`[${f}]`}e.getProperty=m;function _(f){if(typeof f=="string"&&e.IDENTIFIER.test(f))return new o(`${f}`);throw new Error(`CodeGen: invalid export name: ${f}, use explicit $id name mapping`)}e.getEsmExportName=_;function h(f){return new o(f.toString())}e.regexpCode=h})),w_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=sc();var r=class extends Error{constructor(a){super(`CodeGen: "code" for ${a} not defined`),this.value=a.value}},o;(function(a){a[a.Started=0]="Started",a[a.Completed=1]="Completed"})(o||(e.UsedValueState=o={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var n=class{constructor({prefixes:a,parent:u}={}){this._names={},this._prefixes=a,this._parent=u}toName(a){return a instanceof t.Name?a:this.name(a)}name(a){return new t.Name(this._newName(a))}_newName(a){let u=this._names[a]||this._nameGroup(a);return`${a}${u.index++}`}_nameGroup(a){var u,d;if(!((d=(u=this._parent)===null||u===void 0?void 0:u._prefixes)===null||d===void 0)&&d.has(a)||this._prefixes&&!this._prefixes.has(a))throw new Error(`CodeGen: prefix "${a}" is not allowed in this scope`);return this._names[a]={prefix:a,index:0}}};e.Scope=n;var s=class extends t.Name{constructor(a,u){super(u),this.prefix=a}setValue(a,{property:u,itemIndex:d}){this.value=a,this.scopePath=(0,t._)`.${new t.Name(u)}[${d}]`}};e.ValueScopeName=s;let i=(0,t._)`\n`;var c=class extends n{constructor(a){super(a),this._values={},this._scope=a.scope,this.opts={...a,_n:a.lines?i:t.nil}}get(){return this._scope}name(a){return new s(a,this._newName(a))}value(a,u){var d;if(u.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let p=this.toName(a),{prefix:g}=p,v=(d=u.key)!==null&&d!==void 0?d:u.ref,m=this._values[g];if(m){let f=m.get(v);if(f)return f}else m=this._values[g]=new Map;m.set(v,p);let _=this._scope[g]||(this._scope[g]=[]),h=_.length;return _[h]=u.ref,p.setValue(u,{property:g,itemIndex:h}),p}getValue(a,u){let d=this._values[a];if(d)return d.get(u)}scopeRefs(a,u=this._values){return this._reduceValues(u,d=>{if(d.scopePath===void 0)throw new Error(`CodeGen: name "${d}" has no value`);return(0,t._)`${a}${d.scopePath}`})}scopeCode(a=this._values,u,d){return this._reduceValues(a,p=>{if(p.value===void 0)throw new Error(`CodeGen: name "${p}" has no value`);return p.value.code},u,d)}_reduceValues(a,u,d={},p){let g=t.nil;for(let v in a){let m=a[v];if(!m)continue;let _=d[v]=d[v]||new Map;m.forEach(h=>{if(_.has(h))return;_.set(h,o.Started);let f=u(h);if(f){let z=this.opts.es5?e.varKinds.var:e.varKinds.const;g=(0,t._)`${g}${z} ${h} = ${f};${this.opts._n}`}else if(f=p?.(h))g=(0,t._)`${g}${f}${this.opts._n}`;else throw new r(h);_.set(h,o.Completed)})}return g}};e.ValueScope=c})),le=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=sc(),r=w_();var o=sc();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var n=w_();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var s=class{optimizeNodes(){return this}optimizeNames($,C){return this}},i=class extends s{constructor($,C,x){super(),this.varKind=$,this.name=C,this.rhs=x}render({es5:$,_n:C}){let x=$?r.varKinds.var:this.varKind,J=this.rhs===void 0?"":` = ${this.rhs}`;return`${x} ${this.name}${J};`+C}optimizeNames($,C){if($[this.name.str])return this.rhs&&(this.rhs=G(this.rhs,$,C)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},c=class extends s{constructor($,C,x){super(),this.lhs=$,this.rhs=C,this.sideEffects=x}render({_n:$}){return`${this.lhs} = ${this.rhs};`+$}optimizeNames($,C){if(!(this.lhs instanceof t.Name&&!$[this.lhs.str]&&!this.sideEffects))return this.rhs=G(this.rhs,$,C),this}get names(){return W(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},a=class extends c{constructor($,C,x,J){super($,x,J),this.op=C}render({_n:$}){return`${this.lhs} ${this.op}= ${this.rhs};`+$}},u=class extends s{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`${this.label}:`+$}},d=class extends s{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`break${this.label?` ${this.label}`:""};`+$}},p=class extends s{constructor($){super(),this.error=$}render({_n:$}){return`throw ${this.error};`+$}get names(){return this.error.names}},g=class extends s{constructor($){super(),this.code=$}render({_n:$}){return`${this.code};`+$}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames($,C){return this.code=G(this.code,$,C),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},v=class extends s{constructor($=[]){super(),this.nodes=$}render($){return this.nodes.reduce((C,x)=>C+x.render($),"")}optimizeNodes(){let{nodes:$}=this,C=$.length;for(;C--;){let x=$[C].optimizeNodes();Array.isArray(x)?$.splice(C,1,...x):x?$[C]=x:$.splice(C,1)}return $.length>0?this:void 0}optimizeNames($,C){let{nodes:x}=this,J=x.length;for(;J--;){let ee=x[J];ee.optimizeNames($,C)||(fe($,ee.names),x.splice(J,1))}return x.length>0?this:void 0}get names(){return this.nodes.reduce(($,C)=>Z($,C.names),{})}},m=class extends v{render($){return"{"+$._n+super.render($)+"}"+$._n}},_=class extends v{},h=class extends m{};h.kind="else";var f=class nc extends m{constructor(C,x){super(x),this.condition=C}render(C){let x=`if(${this.condition})`+super.render(C);return this.else&&(x+="else "+this.else.render(C)),x}optimizeNodes(){super.optimizeNodes();let C=this.condition;if(C===!0)return this.nodes;let x=this.else;if(x){let J=x.optimizeNodes();x=this.else=Array.isArray(J)?new h(J):J}if(x)return C===!1?x instanceof nc?x:x.nodes:this.nodes.length?this:new nc($e(C),x instanceof nc?[x]:x.nodes);if(!(C===!1||!this.nodes.length))return this}optimizeNames(C,x){var J;if(this.else=(J=this.else)===null||J===void 0?void 0:J.optimizeNames(C,x),!!(super.optimizeNames(C,x)||this.else))return this.condition=G(this.condition,C,x),this}get names(){let C=super.names;return W(C,this.condition),this.else&&Z(C,this.else.names),C}};f.kind="if";var z=class extends m{};z.kind="for";var S=class extends z{constructor($){super(),this.iteration=$}render($){return`for(${this.iteration})`+super.render($)}optimizeNames($,C){if(super.optimizeNames($,C))return this.iteration=G(this.iteration,$,C),this}get names(){return Z(super.names,this.iteration.names)}},R=class extends z{constructor($,C,x,J){super(),this.varKind=$,this.name=C,this.from=x,this.to=J}render($){let C=$.es5?r.varKinds.var:this.varKind,{name:x,from:J,to:ee}=this;return`for(${C} ${x}=${J}; ${x}<${ee}; ${x}++)`+super.render($)}get names(){return W(W(super.names,this.from),this.to)}},w=class extends z{constructor($,C,x,J){super(),this.loop=$,this.varKind=C,this.name=x,this.iterable=J}render($){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render($)}optimizeNames($,C){if(super.optimizeNames($,C))return this.iterable=G(this.iterable,$,C),this}get names(){return Z(super.names,this.iterable.names)}},b=class extends m{constructor($,C,x){super(),this.name=$,this.args=C,this.async=x}render($){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render($)}};b.kind="func";var y=class extends v{render($){return"return "+super.render($)}};y.kind="return";var E=class extends m{render($){let C="try"+super.render($);return this.catch&&(C+=this.catch.render($)),this.finally&&(C+=this.finally.render($)),C}optimizeNodes(){var $,C;return super.optimizeNodes(),($=this.catch)===null||$===void 0||$.optimizeNodes(),(C=this.finally)===null||C===void 0||C.optimizeNodes(),this}optimizeNames($,C){var x,J;return super.optimizeNames($,C),(x=this.catch)===null||x===void 0||x.optimizeNames($,C),(J=this.finally)===null||J===void 0||J.optimizeNames($,C),this}get names(){let $=super.names;return this.catch&&Z($,this.catch.names),this.finally&&Z($,this.finally.names),$}},N=class extends m{constructor($){super(),this.error=$}render($){return`catch(${this.error})`+super.render($)}};N.kind="catch";var V=class extends m{render($){return"finally"+super.render($)}};V.kind="finally";var M=class{constructor($,C={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...C,_n:C.lines?`
|
|
62
|
+
`:""},this._extScope=$,this._scope=new r.Scope({parent:$}),this._nodes=[new _]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,C){let x=this._extScope.value($,C);return(this._values[x.prefix]||(this._values[x.prefix]=new Set)).add(x),x}getScopeValue($,C){return this._extScope.getValue($,C)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,C,x,J){let ee=this._scope.toName(C);return x!==void 0&&J&&(this._constants[ee.str]=x),this._leafNode(new i($,ee,x)),ee}const($,C,x){return this._def(r.varKinds.const,$,C,x)}let($,C,x){return this._def(r.varKinds.let,$,C,x)}var($,C,x){return this._def(r.varKinds.var,$,C,x)}assign($,C,x){return this._leafNode(new c($,C,x))}add($,C){return this._leafNode(new a($,e.operators.ADD,C))}code($){return typeof $=="function"?$():$!==t.nil&&this._leafNode(new g($)),this}object(...$){let C=["{"];for(let[x,J]of $)C.length>1&&C.push(","),C.push(x),(x!==J||this.opts.es5)&&(C.push(":"),(0,t.addCodeArg)(C,J));return C.push("}"),new t._Code(C)}if($,C,x){if(this._blockNode(new f($)),C&&x)this.code(C).else().code(x).endIf();else if(C)this.code(C).endIf();else if(x)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new f($))}else(){return this._elseNode(new h)}endIf(){return this._endBlockNode(f,h)}_for($,C){return this._blockNode($),C&&this.code(C).endFor(),this}for($,C){return this._for(new S($),C)}forRange($,C,x,J,ee=this.opts.es5?r.varKinds.var:r.varKinds.let){let pe=this._scope.toName($);return this._for(new R(ee,pe,C,x),()=>J(pe))}forOf($,C,x,J=r.varKinds.const){let ee=this._scope.toName($);if(this.opts.es5){let pe=C instanceof t.Name?C:this.var("_arr",C);return this.forRange("_i",0,(0,t._)`${pe}.length`,ae=>{this.var(ee,(0,t._)`${pe}[${ae}]`),x(ee)})}return this._for(new w("of",J,ee,C),()=>x(ee))}forIn($,C,x,J=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf($,(0,t._)`Object.keys(${C})`,x);let ee=this._scope.toName($);return this._for(new w("in",J,ee,C),()=>x(ee))}endFor(){return this._endBlockNode(z)}label($){return this._leafNode(new u($))}break($){return this._leafNode(new d($))}return($){let C=new y;if(this._blockNode(C),this.code($),C.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(y)}try($,C,x){if(!C&&!x)throw new Error('CodeGen: "try" without "catch" and "finally"');let J=new E;if(this._blockNode(J),this.code($),C){let ee=this.name("e");this._currNode=J.catch=new N(ee),C(ee)}return x&&(this._currNode=J.finally=new V,this.code(x)),this._endBlockNode(N,V)}throw($){return this._leafNode(new p($))}block($,C){return this._blockStarts.push(this._nodes.length),$&&this.code($).endBlock(C),this}endBlock($){let C=this._blockStarts.pop();if(C===void 0)throw new Error("CodeGen: not in self-balancing block");let x=this._nodes.length-C;if(x<0||$!==void 0&&x!==$)throw new Error(`CodeGen: wrong number of nodes: ${x} vs ${$} expected`);return this._nodes.length=C,this}func($,C=t.nil,x,J){return this._blockNode(new b($,C,x)),J&&this.code(J).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize($=1){for(;$-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,C){let x=this._currNode;if(x instanceof $||C&&x instanceof C)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${C?`${$.kind}/${C.kind}`:$.kind}"`)}_elseNode($){let C=this._currNode;if(!(C instanceof f))throw new Error('CodeGen: "else" without "if"');return this._currNode=C.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let C=this._nodes;C[C.length-1]=$}};e.CodeGen=M;function Z($,C){for(let x in C)$[x]=($[x]||0)+(C[x]||0);return $}function W($,C){return C instanceof t._CodeOrName?Z($,C.names):$}function G($,C,x){if($ instanceof t.Name)return J($);if(!ee($))return $;return new t._Code($._items.reduce((pe,ae)=>(ae instanceof t.Name&&(ae=J(ae)),ae instanceof t._Code?pe.push(...ae._items):pe.push(ae),pe),[]));function J(pe){let ae=x[pe.str];return ae===void 0||C[pe.str]!==1?pe:(delete C[pe.str],ae)}function ee(pe){return pe instanceof t._Code&&pe._items.some(ae=>ae instanceof t.Name&&C[ae.str]===1&&x[ae.str]!==void 0)}}function fe($,C){for(let x in C)$[x]=($[x]||0)-(C[x]||0)}function $e($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:(0,t._)`!${F($)}`}e.not=$e;let be=j(e.operators.AND);function Oe(...$){return $.reduce(be)}e.and=Oe;let he=j(e.operators.OR);function k(...$){return $.reduce(he)}e.or=k;function j($){return(C,x)=>C===t.nil?x:x===t.nil?C:(0,t._)`${F(C)} ${$} ${F(x)}`}function F($){return $ instanceof t.Name?$:(0,t._)`(${$})`}})),_e=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=le(),r=sc();function o(b){let y={};for(let E of b)y[E]=!0;return y}e.toHash=o;function n(b,y){return typeof y=="boolean"?y:Object.keys(y).length===0?!0:(s(b,y),!i(y,b.self.RULES.all))}e.alwaysValidSchema=n;function s(b,y=b.schema){let{opts:E,self:N}=b;if(!E.strictSchema||typeof y=="boolean")return;let V=N.RULES.keywords;for(let M in y)V[M]||w(b,`unknown keyword: "${M}"`)}e.checkUnknownRules=s;function i(b,y){if(typeof b=="boolean")return!b;for(let E in b)if(y[E])return!0;return!1}e.schemaHasRules=i;function c(b,y){if(typeof b=="boolean")return!b;for(let E in b)if(E!=="$ref"&&y.all[E])return!0;return!1}e.schemaHasRulesButRef=c;function a({topSchemaRef:b,schemaPath:y},E,N,V){if(!V){if(typeof E=="number"||typeof E=="boolean")return E;if(typeof E=="string")return(0,t._)`${E}`}return(0,t._)`${b}${y}${(0,t.getProperty)(N)}`}e.schemaRefOrVal=a;function u(b){return g(decodeURIComponent(b))}e.unescapeFragment=u;function d(b){return encodeURIComponent(p(b))}e.escapeFragment=d;function p(b){return typeof b=="number"?`${b}`:b.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=p;function g(b){return b.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=g;function v(b,y){if(Array.isArray(b))for(let E of b)y(E);else y(b)}e.eachItem=v;function m({mergeNames:b,mergeToName:y,mergeValues:E,resultToName:N}){return(V,M,Z,W)=>{let G=Z===void 0?M:Z instanceof t.Name?(M instanceof t.Name?b(V,M,Z):y(V,M,Z),Z):M instanceof t.Name?(y(V,Z,M),M):E(M,Z);return W===t.Name&&!(G instanceof t.Name)?N(V,G):G}}e.mergeEvaluated={props:m({mergeNames:(b,y,E)=>b.if((0,t._)`${E} !== true && ${y} !== undefined`,()=>{b.if((0,t._)`${y} === true`,()=>b.assign(E,!0),()=>b.assign(E,(0,t._)`${E} || {}`).code((0,t._)`Object.assign(${E}, ${y})`))}),mergeToName:(b,y,E)=>b.if((0,t._)`${E} !== true`,()=>{y===!0?b.assign(E,!0):(b.assign(E,(0,t._)`${E} || {}`),h(b,E,y))}),mergeValues:(b,y)=>b===!0?!0:{...b,...y},resultToName:_}),items:m({mergeNames:(b,y,E)=>b.if((0,t._)`${E} !== true && ${y} !== undefined`,()=>b.assign(E,(0,t._)`${y} === true ? true : ${E} > ${y} ? ${E} : ${y}`)),mergeToName:(b,y,E)=>b.if((0,t._)`${E} !== true`,()=>b.assign(E,y===!0?!0:(0,t._)`${E} > ${y} ? ${E} : ${y}`)),mergeValues:(b,y)=>b===!0?!0:Math.max(b,y),resultToName:(b,y)=>b.var("items",y)})};function _(b,y){if(y===!0)return b.var("props",!0);let E=b.var("props",(0,t._)`{}`);return y!==void 0&&h(b,E,y),E}e.evaluatedPropsToName=_;function h(b,y,E){Object.keys(E).forEach(N=>b.assign((0,t._)`${y}${(0,t.getProperty)(N)}`,!0))}e.setEvaluated=h;let f={};function z(b,y){return b.scopeValue("func",{ref:y,code:f[y.code]||(f[y.code]=new r._Code(y.code))})}e.useFunc=z;var S;(function(b){b[b.Num=0]="Num",b[b.Str=1]="Str"})(S||(e.Type=S={}));function R(b,y,E){if(b instanceof t.Name){let N=y===S.Num;return E?N?(0,t._)`"[" + ${b} + "]"`:(0,t._)`"['" + ${b} + "']"`:N?(0,t._)`"/" + ${b}`:(0,t._)`"/" + ${b}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return E?(0,t.getProperty)(b).toString():"/"+p(b)}e.getErrorPath=R;function w(b,y,E=b.opts.strictSchema){if(E){if(y=`strict mode: ${y}`,E===!0)throw new Error(y);b.self.logger.warn(y)}}e.checkStrictMode=w})),pt=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r})),ac=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=le(),r=_e(),o=pt();e.keywordError={message:({keyword:h})=>(0,t.str)`must pass "${h}" keyword validation`},e.keyword$DataError={message:({keyword:h,schemaType:f})=>f?(0,t.str)`"${h}" keyword must be ${f} ($data)`:(0,t.str)`"${h}" keyword is invalid ($data)`};function n(h,f=e.keywordError,z,S){let{it:R}=h,{gen:w,compositeRule:b,allErrors:y}=R,E=p(h,f,z);S??(b||y)?a(w,E):u(R,(0,t._)`[${E}]`)}e.reportError=n;function s(h,f=e.keywordError,z){let{it:S}=h,{gen:R,compositeRule:w,allErrors:b}=S;a(R,p(h,f,z)),w||b||u(S,o.default.vErrors)}e.reportExtraError=s;function i(h,f){h.assign(o.default.errors,f),h.if((0,t._)`${o.default.vErrors} !== null`,()=>h.if(f,()=>h.assign((0,t._)`${o.default.vErrors}.length`,f),()=>h.assign(o.default.vErrors,null)))}e.resetErrorsCount=i;function c({gen:h,keyword:f,schemaValue:z,data:S,errsCount:R,it:w}){if(R===void 0)throw new Error("ajv implementation error");let b=h.name("err");h.forRange("i",R,o.default.errors,y=>{h.const(b,(0,t._)`${o.default.vErrors}[${y}]`),h.if((0,t._)`${b}.instancePath === undefined`,()=>h.assign((0,t._)`${b}.instancePath`,(0,t.strConcat)(o.default.instancePath,w.errorPath))),h.assign((0,t._)`${b}.schemaPath`,(0,t.str)`${w.errSchemaPath}/${f}`),w.opts.verbose&&(h.assign((0,t._)`${b}.schema`,z),h.assign((0,t._)`${b}.data`,S))})}e.extendErrors=c;function a(h,f){let z=h.const("err",f);h.if((0,t._)`${o.default.vErrors} === null`,()=>h.assign(o.default.vErrors,(0,t._)`[${z}]`),(0,t._)`${o.default.vErrors}.push(${z})`),h.code((0,t._)`${o.default.errors}++`)}function u(h,f){let{gen:z,validateName:S,schemaEnv:R}=h;R.$async?z.throw((0,t._)`new ${h.ValidationError}(${f})`):(z.assign((0,t._)`${S}.errors`,f),z.return(!1))}let d={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function p(h,f,z){let{createErrors:S}=h.it;return S===!1?(0,t._)`{}`:g(h,f,z)}function g(h,f,z={}){let{gen:S,it:R}=h,w=[v(R,z),m(h,z)];return _(h,f,w),S.object(...w)}function v({errorPath:h},{instancePath:f}){let z=f?(0,t.str)`${h}${(0,r.getErrorPath)(f,r.Type.Str)}`:h;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,z)]}function m({keyword:h,it:{errSchemaPath:f}},{schemaPath:z,parentSchema:S}){let R=S?f:(0,t.str)`${f}/${h}`;return z&&(R=(0,t.str)`${R}${(0,r.getErrorPath)(z,r.Type.Str)}`),[d.schemaPath,R]}function _(h,{params:f,message:z},S){let{keyword:R,data:w,schemaValue:b,it:y}=h,{opts:E,propertyName:N,topSchemaRef:V,schemaPath:M}=y;S.push([d.keyword,R],[d.params,typeof f=="function"?f(h):f||(0,t._)`{}`]),E.messages&&S.push([d.message,typeof z=="function"?z(h):z]),E.verbose&&S.push([d.schema,b],[d.parentSchema,(0,t._)`${V}${M}`],[o.default.data,w]),N&&S.push([d.propertyName,N])}})),Qz=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=ac(),r=le(),o=pt(),n={message:"boolean schema is false"};function s(a){let{gen:u,schema:d,validateName:p}=a;d===!1?c(a,!1):typeof d=="object"&&d.$async===!0?u.return(o.default.data):(u.assign((0,r._)`${p}.errors`,null),u.return(!0))}e.topBoolOrEmptySchema=s;function i(a,u){let{gen:d,schema:p}=a;p===!1?(d.var(u,!1),c(a)):d.var(u,!0)}e.boolOrEmptySchema=i;function c(a,u){let{gen:d,data:p}=a,g={gen:d,keyword:"false schema",data:p,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:a};(0,t.reportError)(g,n,void 0,u)}})),P_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(n){return typeof n=="string"&&t.has(n)}e.isJSONType=r;function o(){let n={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...n,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},n.number,n.string,n.array,n.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=o})),E_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:n,self:s},i){let c=s.RULES.types[i];return c&&c!==!0&&r(n,c)}e.schemaHasRulesForType=t;function r(n,s){return s.rules.some(i=>o(n,i))}e.shouldUseGroup=r;function o(n,s){var i;return n[s.keyword]!==void 0||((i=s.definition.implements)===null||i===void 0?void 0:i.some(c=>n[c]!==void 0))}e.shouldUseRule=o})),ic=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=P_(),r=E_(),o=ac(),n=le(),s=_e();var i;(function(S){S[S.Correct=0]="Correct",S[S.Wrong=1]="Wrong"})(i||(e.DataType=i={}));function c(S){let R=a(S.type);if(R.includes("null")){if(S.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!R.length&&S.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');S.nullable===!0&&R.push("null")}return R}e.getSchemaTypes=c;function a(S){let R=Array.isArray(S)?S:S?[S]:[];if(R.every(t.isJSONType))return R;throw new Error("type must be JSONType or JSONType[]: "+R.join(","))}e.getJSONTypes=a;function u(S,R){let{gen:w,data:b,opts:y}=S,E=p(R,y.coerceTypes),N=R.length>0&&!(E.length===0&&R.length===1&&(0,r.schemaHasRulesForType)(S,R[0]));if(N){let V=_(R,b,y.strictNumbers,i.Wrong);w.if(V,()=>{E.length?g(S,R,E):f(S)})}return N}e.coerceAndCheckDataType=u;let d=new Set(["string","number","integer","boolean","null"]);function p(S,R){return R?S.filter(w=>d.has(w)||R==="array"&&w==="array"):[]}function g(S,R,w){let{gen:b,data:y,opts:E}=S,N=b.let("dataType",(0,n._)`typeof ${y}`),V=b.let("coerced",(0,n._)`undefined`);E.coerceTypes==="array"&&b.if((0,n._)`${N} == 'object' && Array.isArray(${y}) && ${y}.length == 1`,()=>b.assign(y,(0,n._)`${y}[0]`).assign(N,(0,n._)`typeof ${y}`).if(_(R,y,E.strictNumbers),()=>b.assign(V,y))),b.if((0,n._)`${V} !== undefined`);for(let Z of w)(d.has(Z)||Z==="array"&&E.coerceTypes==="array")&&M(Z);b.else(),f(S),b.endIf(),b.if((0,n._)`${V} !== undefined`,()=>{b.assign(y,V),v(S,V)});function M(Z){switch(Z){case"string":b.elseIf((0,n._)`${N} == "number" || ${N} == "boolean"`).assign(V,(0,n._)`"" + ${y}`).elseIf((0,n._)`${y} === null`).assign(V,(0,n._)`""`);return;case"number":b.elseIf((0,n._)`${N} == "boolean" || ${y} === null
|
|
63
|
+
|| (${N} == "string" && ${y} && ${y} == +${y})`).assign(V,(0,n._)`+${y}`);return;case"integer":b.elseIf((0,n._)`${N} === "boolean" || ${y} === null
|
|
64
|
+
|| (${N} === "string" && ${y} && ${y} == +${y} && !(${y} % 1))`).assign(V,(0,n._)`+${y}`);return;case"boolean":b.elseIf((0,n._)`${y} === "false" || ${y} === 0 || ${y} === null`).assign(V,!1).elseIf((0,n._)`${y} === "true" || ${y} === 1`).assign(V,!0);return;case"null":b.elseIf((0,n._)`${y} === "" || ${y} === 0 || ${y} === false`),b.assign(V,null);return;case"array":b.elseIf((0,n._)`${N} === "string" || ${N} === "number"
|
|
65
|
+
|| ${N} === "boolean" || ${y} === null`).assign(V,(0,n._)`[${y}]`)}}}function v({gen:S,parentData:R,parentDataProperty:w},b){S.if((0,n._)`${R} !== undefined`,()=>S.assign((0,n._)`${R}[${w}]`,b))}function m(S,R,w,b=i.Correct){let y=b===i.Correct?n.operators.EQ:n.operators.NEQ,E;switch(S){case"null":return(0,n._)`${R} ${y} null`;case"array":E=(0,n._)`Array.isArray(${R})`;break;case"object":E=(0,n._)`${R} && typeof ${R} == "object" && !Array.isArray(${R})`;break;case"integer":E=N((0,n._)`!(${R} % 1) && !isNaN(${R})`);break;case"number":E=N();break;default:return(0,n._)`typeof ${R} ${y} ${S}`}return b===i.Correct?E:(0,n.not)(E);function N(V=n.nil){return(0,n.and)((0,n._)`typeof ${R} == "number"`,V,w?(0,n._)`isFinite(${R})`:n.nil)}}e.checkDataType=m;function _(S,R,w,b){if(S.length===1)return m(S[0],R,w,b);let y,E=(0,s.toHash)(S);if(E.array&&E.object){let N=(0,n._)`typeof ${R} != "object"`;y=E.null?N:(0,n._)`!${R} || ${N}`,delete E.null,delete E.array,delete E.object}else y=n.nil;E.number&&delete E.integer;for(let N in E)y=(0,n.and)(y,m(N,R,w,b));return y}e.checkDataTypes=_;let h={message:({schema:S})=>`must be ${S}`,params:({schema:S,schemaValue:R})=>typeof S=="string"?(0,n._)`{type: ${S}}`:(0,n._)`{type: ${R}}`};function f(S){let R=z(S);(0,o.reportError)(R,h)}e.reportTypeError=f;function z(S){let{gen:R,data:w,schema:b}=S,y=(0,s.schemaRefOrVal)(S,b,"type");return{gen:R,keyword:"type",data:w,schema:b.type,schemaCode:y,schemaValue:y,parentSchema:b,params:{},it:S}}})),e0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=le(),r=_e();function o(s,i){let{properties:c,items:a}=s.schema;if(i==="object"&&c)for(let u in c)n(s,u,c[u].default);else i==="array"&&Array.isArray(a)&&a.forEach((u,d)=>n(s,d,u.default))}e.assignDefaults=o;function n(s,i,c){let{gen:a,compositeRule:u,data:d,opts:p}=s;if(c===void 0)return;let g=(0,t._)`${d}${(0,t.getProperty)(i)}`;if(u){(0,r.checkStrictMode)(s,`default is ignored for: ${g}`);return}let v=(0,t._)`${g} === undefined`;p.useDefaults==="empty"&&(v=(0,t._)`${v} || ${g} === null || ${g} === ""`),a.if(v,(0,t._)`${g} = ${(0,t.stringify)(c)}`)}})),mt=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=le(),r=_e(),o=pt(),n=_e();function s(S,R){let{gen:w,data:b,it:y}=S;w.if(p(w,b,R,y.opts.ownProperties),()=>{S.setParams({missingProperty:(0,t._)`${R}`},!0),S.error()})}e.checkReportMissingProp=s;function i({gen:S,data:R,it:{opts:w}},b,y){return(0,t.or)(...b.map(E=>(0,t.and)(p(S,R,E,w.ownProperties),(0,t._)`${y} = ${E}`)))}e.checkMissingProp=i;function c(S,R){S.setParams({missingProperty:R},!0),S.error()}e.reportMissingProp=c;function a(S){return S.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=a;function u(S,R,w){return(0,t._)`${a(S)}.call(${R}, ${w})`}e.isOwnProperty=u;function d(S,R,w,b){let y=(0,t._)`${R}${(0,t.getProperty)(w)} !== undefined`;return b?(0,t._)`${y} && ${u(S,R,w)}`:y}e.propertyInData=d;function p(S,R,w,b){let y=(0,t._)`${R}${(0,t.getProperty)(w)} === undefined`;return b?(0,t.or)(y,(0,t.not)(u(S,R,w))):y}e.noPropertyInData=p;function g(S){return S?Object.keys(S).filter(R=>R!=="__proto__"):[]}e.allSchemaProperties=g;function v(S,R){return g(R).filter(w=>!(0,r.alwaysValidSchema)(S,R[w]))}e.schemaProperties=v;function m({schemaCode:S,data:R,it:{gen:w,topSchemaRef:b,schemaPath:y,errorPath:E},it:N},V,M,Z){let W=Z?(0,t._)`${S}, ${R}, ${b}${y}`:R,G=[[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,E)],[o.default.parentData,N.parentData],[o.default.parentDataProperty,N.parentDataProperty],[o.default.rootData,o.default.rootData]];N.opts.dynamicRef&&G.push([o.default.dynamicAnchors,o.default.dynamicAnchors]);let fe=(0,t._)`${W}, ${w.object(...G)}`;return M!==t.nil?(0,t._)`${V}.call(${M}, ${fe})`:(0,t._)`${V}(${fe})`}e.callValidateCode=m;let _=(0,t._)`new RegExp`;function h({gen:S,it:{opts:R}},w){let b=R.unicodeRegExp?"u":"",{regExp:y}=R.code,E=y(w,b);return S.scopeValue("pattern",{key:E.toString(),ref:E,code:(0,t._)`${y.code==="new RegExp"?_:(0,n.useFunc)(S,y)}(${w}, ${b})`})}e.usePattern=h;function f(S){let{gen:R,data:w,keyword:b,it:y}=S,E=R.name("valid");if(y.allErrors){let V=R.let("valid",!0);return N(()=>R.assign(V,!1)),V}return R.var(E,!0),N(()=>R.break()),E;function N(V){let M=R.const("len",(0,t._)`${w}.length`);R.forRange("i",0,M,Z=>{S.subschema({keyword:b,dataProp:Z,dataPropType:r.Type.Num},E),R.if((0,t.not)(E),V)})}}e.validateArray=f;function z(S){let{gen:R,schema:w,keyword:b,it:y}=S;if(!Array.isArray(w))throw new Error("ajv implementation error");if(w.some(V=>(0,r.alwaysValidSchema)(y,V))&&!y.opts.unevaluated)return;let E=R.let("valid",!1),N=R.name("_valid");R.block(()=>w.forEach((V,M)=>{let Z=S.subschema({keyword:b,schemaProp:M,compositeRule:!0},N);R.assign(E,(0,t._)`${E} || ${N}`),S.mergeValidEvaluated(Z,N)||R.if((0,t.not)(E))})),S.result(E,()=>S.reset(),()=>S.error(!0))}e.validateUnion=z})),t0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=le(),r=pt(),o=mt(),n=ac();function s(v,m){let{gen:_,keyword:h,schema:f,parentSchema:z,it:S}=v,R=m.macro.call(S.self,f,z,S),w=d(_,h,R);S.opts.validateSchema!==!1&&S.self.validateSchema(R,!0);let b=_.name("valid");v.subschema({schema:R,schemaPath:t.nil,errSchemaPath:`${S.errSchemaPath}/${h}`,topSchemaRef:w,compositeRule:!0},b),v.pass(b,()=>v.error(!0))}e.macroKeywordCode=s;function i(v,m){var _;let{gen:h,keyword:f,schema:z,parentSchema:S,$data:R,it:w}=v;u(w,m);let b=d(h,f,!R&&m.compile?m.compile.call(w.self,z,S,w):m.validate),y=h.let("valid");v.block$data(y,E),v.ok((_=m.valid)!==null&&_!==void 0?_:y);function E(){if(m.errors===!1)M(),m.modifying&&c(v),Z(()=>v.error());else{let W=m.async?N():V();m.modifying&&c(v),Z(()=>a(v,W))}}function N(){let W=h.let("ruleErrs",null);return h.try(()=>M((0,t._)`await `),G=>h.assign(y,!1).if((0,t._)`${G} instanceof ${w.ValidationError}`,()=>h.assign(W,(0,t._)`${G}.errors`),()=>h.throw(G))),W}function V(){let W=(0,t._)`${b}.errors`;return h.assign(W,null),M(t.nil),W}function M(W=m.async?(0,t._)`await `:t.nil){let G=w.opts.passContext?r.default.this:r.default.self,fe=!("compile"in m&&!R||m.schema===!1);h.assign(y,(0,t._)`${W}${(0,o.callValidateCode)(v,b,G,fe)}`,m.modifying)}function Z(W){var G;h.if((0,t.not)((G=m.valid)!==null&&G!==void 0?G:y),W)}}e.funcKeywordCode=i;function c(v){let{gen:m,data:_,it:h}=v;m.if(h.parentData,()=>m.assign(_,(0,t._)`${h.parentData}[${h.parentDataProperty}]`))}function a(v,m){let{gen:_}=v;_.if((0,t._)`Array.isArray(${m})`,()=>{_.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${m} : ${r.default.vErrors}.concat(${m})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,n.extendErrors)(v)},()=>v.error())}function u({schemaEnv:v},m){if(m.async&&!v.$async)throw new Error("async keyword in sync schema")}function d(v,m,_){if(_===void 0)throw new Error(`keyword "${m}" failed to compile`);return v.scopeValue("keyword",typeof _=="function"?{ref:_}:{ref:_,code:(0,t.stringify)(_)})}function p(v,m,_=!1){return!m.length||m.some(h=>h==="array"?Array.isArray(v):h==="object"?v&&typeof v=="object"&&!Array.isArray(v):typeof v==h||_&&typeof v>"u")}e.validSchemaType=p;function g({schema:v,opts:m,self:_,errSchemaPath:h},f,z){if(Array.isArray(f.keyword)?!f.keyword.includes(z):f.keyword!==z)throw new Error("ajv implementation error");let S=f.dependencies;if(S?.some(R=>!Object.prototype.hasOwnProperty.call(v,R)))throw new Error(`parent schema must have dependencies of ${z}: ${S.join(",")}`);if(f.validateSchema&&!f.validateSchema(v[z])){let R=`keyword "${z}" value is invalid at path "${h}": `+_.errorsText(f.validateSchema.errors);if(m.validateSchema==="log")_.logger.error(R);else throw new Error(R)}}e.validateKeywordUsage=g})),r0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=le(),r=_e();function o(i,{keyword:c,schemaProp:a,schema:u,schemaPath:d,errSchemaPath:p,topSchemaRef:g}){if(c!==void 0&&u!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(c!==void 0){let v=i.schema[c];return a===void 0?{schema:v,schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(c)}`,errSchemaPath:`${i.errSchemaPath}/${c}`}:{schema:v[a],schemaPath:(0,t._)`${i.schemaPath}${(0,t.getProperty)(c)}${(0,t.getProperty)(a)}`,errSchemaPath:`${i.errSchemaPath}/${c}/${(0,r.escapeFragment)(a)}`}}if(u!==void 0){if(d===void 0||p===void 0||g===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:u,schemaPath:d,topSchemaRef:g,errSchemaPath:p}}throw new Error('either "keyword" or "schema" must be passed')}e.getSubschema=o;function n(i,c,{dataProp:a,dataPropType:u,data:d,dataTypes:p,propertyName:g}){if(d!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:v}=c;if(a!==void 0){let{errorPath:_,dataPathArr:h,opts:f}=c;m(v.let("data",(0,t._)`${c.data}${(0,t.getProperty)(a)}`,!0)),i.errorPath=(0,t.str)`${_}${(0,r.getErrorPath)(a,u,f.jsPropertySyntax)}`,i.parentDataProperty=(0,t._)`${a}`,i.dataPathArr=[...h,i.parentDataProperty]}d!==void 0&&(m(d instanceof t.Name?d:v.let("data",d,!0)),g!==void 0&&(i.propertyName=g)),p&&(i.dataTypes=p);function m(_){i.data=_,i.dataLevel=c.dataLevel+1,i.dataTypes=[],c.definedProperties=new Set,i.parentData=c.data,i.dataNames=[...c.dataNames,_]}}e.extendSubschemaData=n;function s(i,{jtdDiscriminator:c,jtdMetadata:a,compositeRule:u,createErrors:d,allErrors:p}){u!==void 0&&(i.compositeRule=u),d!==void 0&&(i.createErrors=d),p!==void 0&&(i.allErrors=p),i.jtdDiscriminator=c,i.jtdMetadata=a}e.extendSubschemaMode=s})),T_=U(((e,t)=>{t.exports=function r(o,n){if(o===n)return!0;if(o&&n&&typeof o=="object"&&typeof n=="object"){if(o.constructor!==n.constructor)return!1;var s,i,c;if(Array.isArray(o)){if(s=o.length,s!=n.length)return!1;for(i=s;i--!==0;)if(!r(o[i],n[i]))return!1;return!0}if(o.constructor===RegExp)return o.source===n.source&&o.flags===n.flags;if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===n.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===n.toString();if(c=Object.keys(o),s=c.length,s!==Object.keys(n).length)return!1;for(i=s;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,c[i]))return!1;for(i=s;i--!==0;){var a=c[i];if(!r(o[a],n[a]))return!1}return!0}return o!==o&&n!==n}})),o0=U(((e,t)=>{var r=t.exports=function(s,i,c){typeof i=="function"&&(c=i,i={}),c=i.cb||c;var a=typeof c=="function"?c:c.pre||function(){},u=c.post||function(){};o(i,a,u,s,"",s)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.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 o(s,i,c,a,u,d,p,g,v,m){if(a&&typeof a=="object"&&!Array.isArray(a)){i(a,u,d,p,g,v,m);for(var _ in a){var h=a[_];if(Array.isArray(h)){if(_ in r.arrayKeywords)for(var f=0;f<h.length;f++)o(s,i,c,h[f],u+"/"+_+"/"+f,d,u,_,a,f)}else if(_ in r.propsKeywords){if(h&&typeof h=="object")for(var z in h)o(s,i,c,h[z],u+"/"+_+"/"+n(z),d,u,_,a,z)}else(_ in r.keywords||s.allKeys&&!(_ in r.skipKeywords))&&o(s,i,c,h,u+"/"+_,d,u,_,a)}c(a,u,d,p,g,v,m)}}function n(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}})),cc=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=_e(),r=T_(),o=o0(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function s(h,f=!0){return typeof h=="boolean"?!0:f===!0?!c(h):f?a(h)<=f:!1}e.inlineRef=s;let i=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(h){for(let f in h){if(i.has(f))return!0;let z=h[f];if(Array.isArray(z)&&z.some(c)||typeof z=="object"&&c(z))return!0}return!1}function a(h){let f=0;for(let z in h){if(z==="$ref")return 1/0;if(f++,!n.has(z)&&(typeof h[z]=="object"&&(0,t.eachItem)(h[z],S=>f+=a(S)),f===1/0))return 1/0}return f}function u(h,f="",z){return z!==!1&&(f=g(f)),d(h,h.parse(f))}e.getFullPath=u;function d(h,f){return h.serialize(f).split("#")[0]+"#"}e._getFullPath=d;let p=/#\/?$/;function g(h){return h?h.replace(p,""):""}e.normalizeId=g;function v(h,f,z){return z=g(z),h.resolve(f,z)}e.resolveUrl=v;let m=/^[a-z_][-a-z0-9._]*$/i;function _(h,f){if(typeof h=="boolean")return{};let{schemaId:z,uriResolver:S}=this.opts,R=g(h[z]||f),w={"":R},b=u(S,R,!1),y={},E=new Set;return o(h,{allKeys:!0},(M,Z,W,G)=>{if(G===void 0)return;let fe=b+Z,$e=w[G];typeof M[z]=="string"&&($e=be.call(this,M[z])),Oe.call(this,M.$anchor),Oe.call(this,M.$dynamicAnchor),w[Z]=$e;function be(he){let k=this.opts.uriResolver.resolve;if(he=g($e?k($e,he):he),E.has(he))throw V(he);E.add(he);let j=this.refs[he];return typeof j=="string"&&(j=this.refs[j]),typeof j=="object"?N(M,j.schema,he):he!==g(fe)&&(he[0]==="#"?(N(M,y[he],he),y[he]=M):this.refs[he]=fe),he}function Oe(he){if(typeof he=="string"){if(!m.test(he))throw new Error(`invalid anchor "${he}"`);be.call(this,`#${he}`)}}}),y;function N(M,Z,W){if(Z!==void 0&&!r(M,Z))throw V(W)}function V(M){return new Error(`reference "${M}" resolves to more than one schema`)}}e.getSchemaRefs=_})),co=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=Qz(),r=ic(),o=E_(),n=ic(),s=e0(),i=t0(),c=r0(),a=le(),u=pt(),d=cc(),p=_e(),g=ac();function v(T){if(b(T)&&(E(T),w(T))){f(T);return}m(T,()=>(0,t.topBoolOrEmptySchema)(T))}e.validateFunctionCode=v;function m({gen:T,validateName:A,schema:D,schemaEnv:se,opts:ie},de){ie.code.es5?T.func(A,(0,a._)`${u.default.data}, ${u.default.valCxt}`,se.$async,()=>{T.code((0,a._)`"use strict"; ${S(D,ie)}`),h(T,ie),T.code(de)}):T.func(A,(0,a._)`${u.default.data}, ${_(ie)}`,se.$async,()=>T.code(S(D,ie)).code(de))}function _(T){return(0,a._)`{${u.default.instancePath}="", ${u.default.parentData}, ${u.default.parentDataProperty}, ${u.default.rootData}=${u.default.data}${T.dynamicRef?(0,a._)`, ${u.default.dynamicAnchors}={}`:a.nil}}={}`}function h(T,A){T.if(u.default.valCxt,()=>{T.var(u.default.instancePath,(0,a._)`${u.default.valCxt}.${u.default.instancePath}`),T.var(u.default.parentData,(0,a._)`${u.default.valCxt}.${u.default.parentData}`),T.var(u.default.parentDataProperty,(0,a._)`${u.default.valCxt}.${u.default.parentDataProperty}`),T.var(u.default.rootData,(0,a._)`${u.default.valCxt}.${u.default.rootData}`),A.dynamicRef&&T.var(u.default.dynamicAnchors,(0,a._)`${u.default.valCxt}.${u.default.dynamicAnchors}`)},()=>{T.var(u.default.instancePath,(0,a._)`""`),T.var(u.default.parentData,(0,a._)`undefined`),T.var(u.default.parentDataProperty,(0,a._)`undefined`),T.var(u.default.rootData,u.default.data),A.dynamicRef&&T.var(u.default.dynamicAnchors,(0,a._)`{}`)})}function f(T){let{schema:A,opts:D,gen:se}=T;m(T,()=>{D.$comment&&A.$comment&&G(T),M(T),se.let(u.default.vErrors,null),se.let(u.default.errors,0),D.unevaluated&&z(T),N(T),fe(T)})}function z(T){let{gen:A,validateName:D}=T;T.evaluated=A.const("evaluated",(0,a._)`${D}.evaluated`),A.if((0,a._)`${T.evaluated}.dynamicProps`,()=>A.assign((0,a._)`${T.evaluated}.props`,(0,a._)`undefined`)),A.if((0,a._)`${T.evaluated}.dynamicItems`,()=>A.assign((0,a._)`${T.evaluated}.items`,(0,a._)`undefined`))}function S(T,A){let D=typeof T=="object"&&T[A.schemaId];return D&&(A.code.source||A.code.process)?(0,a._)`/*# sourceURL=${D} */`:a.nil}function R(T,A){if(b(T)&&(E(T),w(T))){y(T,A);return}(0,t.boolOrEmptySchema)(T,A)}function w({schema:T,self:A}){if(typeof T=="boolean")return!T;for(let D in T)if(A.RULES.all[D])return!0;return!1}function b(T){return typeof T.schema!="boolean"}function y(T,A){let{schema:D,gen:se,opts:ie}=T;ie.$comment&&D.$comment&&G(T),Z(T),W(T);let de=se.const("_errs",u.default.errors);N(T,de),se.var(A,(0,a._)`${de} === ${u.default.errors}`)}function E(T){(0,p.checkUnknownRules)(T),V(T)}function N(T,A){if(T.opts.jtd)return be(T,[],!1,A);let D=(0,r.getSchemaTypes)(T.schema);be(T,D,!(0,r.coerceAndCheckDataType)(T,D),A)}function V(T){let{schema:A,errSchemaPath:D,opts:se,self:ie}=T;A.$ref&&se.ignoreKeywordsWithRef&&(0,p.schemaHasRulesButRef)(A,ie.RULES)&&ie.logger.warn(`$ref: keywords ignored in schema at path "${D}"`)}function M(T){let{schema:A,opts:D}=T;A.default!==void 0&&D.useDefaults&&D.strictSchema&&(0,p.checkStrictMode)(T,"default is ignored in the schema root")}function Z(T){let A=T.schema[T.opts.schemaId];A&&(T.baseId=(0,d.resolveUrl)(T.opts.uriResolver,T.baseId,A))}function W(T){if(T.schema.$async&&!T.schemaEnv.$async)throw new Error("async schema in sync schema")}function G({gen:T,schemaEnv:A,schema:D,errSchemaPath:se,opts:ie}){let de=D.$comment;if(ie.$comment===!0)T.code((0,a._)`${u.default.self}.logger.log(${de})`);else if(typeof ie.$comment=="function"){let ke=(0,a.str)`${se}/$comment`,Ne=T.scopeValue("root",{ref:A.root});T.code((0,a._)`${u.default.self}.opts.$comment(${de}, ${ke}, ${Ne}.schema)`)}}function fe(T){let{gen:A,schemaEnv:D,validateName:se,ValidationError:ie,opts:de}=T;D.$async?A.if((0,a._)`${u.default.errors} === 0`,()=>A.return(u.default.data),()=>A.throw((0,a._)`new ${ie}(${u.default.vErrors})`)):(A.assign((0,a._)`${se}.errors`,u.default.vErrors),de.unevaluated&&$e(T),A.return((0,a._)`${u.default.errors} === 0`))}function $e({gen:T,evaluated:A,props:D,items:se}){D instanceof a.Name&&T.assign((0,a._)`${A}.props`,D),se instanceof a.Name&&T.assign((0,a._)`${A}.items`,se)}function be(T,A,D,se){let{gen:ie,schema:de,data:ke,allErrors:Ne,opts:Ze,self:xe}=T,{RULES:we}=xe;if(de.$ref&&(Ze.ignoreKeywordsWithRef||!(0,p.schemaHasRulesButRef)(de,we))){ie.block(()=>pe(T,"$ref",we.all.$ref.definition));return}Ze.jtd||he(T,A),ie.block(()=>{for(let Ae of we.rules)ot(Ae);ot(we.post)});function ot(Ae){(0,o.shouldUseGroup)(de,Ae)&&(Ae.type?(ie.if((0,n.checkDataType)(Ae.type,ke,Ze.strictNumbers)),Oe(T,Ae),A.length===1&&A[0]===Ae.type&&D&&(ie.else(),(0,n.reportTypeError)(T)),ie.endIf()):Oe(T,Ae),Ne||ie.if((0,a._)`${u.default.errors} === ${se||0}`))}}function Oe(T,A){let{gen:D,schema:se,opts:{useDefaults:ie}}=T;ie&&(0,s.assignDefaults)(T,A.type),D.block(()=>{for(let de of A.rules)(0,o.shouldUseRule)(se,de)&&pe(T,de.keyword,de.definition,A.type)})}function he(T,A){T.schemaEnv.meta||!T.opts.strictTypes||(k(T,A),T.opts.allowUnionTypes||j(T,A),F(T,T.dataTypes))}function k(T,A){if(A.length){if(!T.dataTypes.length){T.dataTypes=A;return}A.forEach(D=>{C(T.dataTypes,D)||J(T,`type "${D}" not allowed by context "${T.dataTypes.join(",")}"`)}),x(T,A)}}function j(T,A){A.length>1&&!(A.length===2&&A.includes("null"))&&J(T,"use allowUnionTypes to allow union type keyword")}function F(T,A){let D=T.self.RULES.all;for(let se in D){let ie=D[se];if(typeof ie=="object"&&(0,o.shouldUseRule)(T.schema,ie)){let{type:de}=ie.definition;de.length&&!de.some(ke=>$(A,ke))&&J(T,`missing type "${de.join(",")}" for keyword "${se}"`)}}}function $(T,A){return T.includes(A)||A==="number"&&T.includes("integer")}function C(T,A){return T.includes(A)||A==="integer"&&T.includes("number")}function x(T,A){let D=[];for(let se of T.dataTypes)C(A,se)?D.push(se):A.includes("integer")&&se==="number"&&D.push("integer");T.dataTypes=D}function J(T,A){let D=T.schemaEnv.baseId+T.errSchemaPath;A+=` at "${D}" (strictTypes)`,(0,p.checkStrictMode)(T,A,T.opts.strictTypes)}var ee=class{constructor(T,A,D){if((0,i.validateKeywordUsage)(T,A,D),this.gen=T.gen,this.allErrors=T.allErrors,this.keyword=D,this.data=T.data,this.schema=T.schema[D],this.$data=A.$data&&T.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,p.schemaRefOrVal)(T,this.schema,D,this.$data),this.schemaType=A.schemaType,this.parentSchema=T.schema,this.params={},this.it=T,this.def=A,this.$data)this.schemaCode=T.gen.const("vSchema",Je(this.$data,T));else if(this.schemaCode=this.schemaValue,!(0,i.validSchemaType)(this.schema,A.schemaType,A.allowUndefined))throw new Error(`${D} value must be ${JSON.stringify(A.schemaType)}`);("code"in A?A.trackErrors:A.errors!==!1)&&(this.errsCount=T.gen.const("_errs",u.default.errors))}result(T,A,D){this.failResult((0,a.not)(T),A,D)}failResult(T,A,D){this.gen.if(T),D?D():this.error(),A?(this.gen.else(),A(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(T,A){this.failResult((0,a.not)(T),void 0,A)}fail(T){if(T===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(T),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(T){if(!this.$data)return this.fail(T);let{schemaCode:A}=this;this.fail((0,a._)`${A} !== undefined && (${(0,a.or)(this.invalid$data(),T)})`)}error(T,A,D){if(A){this.setParams(A),this._error(T,D),this.setParams({});return}this._error(T,D)}_error(T,A){(T?g.reportExtraError:g.reportError)(this,this.def.error,A)}$dataError(){(0,g.reportError)(this,this.def.$dataError||g.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,g.resetErrorsCount)(this.gen,this.errsCount)}ok(T){this.allErrors||this.gen.if(T)}setParams(T,A){A?Object.assign(this.params,T):this.params=T}block$data(T,A,D=a.nil){this.gen.block(()=>{this.check$data(T,D),A()})}check$data(T=a.nil,A=a.nil){if(!this.$data)return;let{gen:D,schemaCode:se,schemaType:ie,def:de}=this;D.if((0,a.or)((0,a._)`${se} === undefined`,A)),T!==a.nil&&D.assign(T,!0),(ie.length||de.validateSchema)&&(D.elseIf(this.invalid$data()),this.$dataError(),T!==a.nil&&D.assign(T,!1)),D.else()}invalid$data(){let{gen:T,schemaCode:A,schemaType:D,def:se,it:ie}=this;return(0,a.or)(de(),ke());function de(){if(D.length){if(!(A instanceof a.Name))throw new Error("ajv implementation error");let Ne=Array.isArray(D)?D:[D];return(0,a._)`${(0,n.checkDataTypes)(Ne,A,ie.opts.strictNumbers,n.DataType.Wrong)}`}return a.nil}function ke(){if(se.validateSchema){let Ne=T.scopeValue("validate$data",{ref:se.validateSchema});return(0,a._)`!${Ne}(${A})`}return a.nil}}subschema(T,A){let D=(0,c.getSubschema)(this.it,T);(0,c.extendSubschemaData)(D,this.it,T),(0,c.extendSubschemaMode)(D,T);let se={...this.it,...D,items:void 0,props:void 0};return R(se,A),se}mergeEvaluated(T,A){let{it:D,gen:se}=this;D.opts.unevaluated&&(D.props!==!0&&T.props!==void 0&&(D.props=p.mergeEvaluated.props(se,T.props,D.props,A)),D.items!==!0&&T.items!==void 0&&(D.items=p.mergeEvaluated.items(se,T.items,D.items,A)))}mergeValidEvaluated(T,A){let{it:D,gen:se}=this;if(D.opts.unevaluated&&(D.props!==!0||D.items!==!0))return se.if(A,()=>this.mergeEvaluated(T,a.Name)),!0}};e.KeywordCxt=ee;function pe(T,A,D,se){let ie=new ee(T,D,A);"code"in D?D.code(ie,se):ie.$data&&D.validate?(0,i.funcKeywordCode)(ie,D):"macro"in D?(0,i.macroKeywordCode)(ie,D):(D.compile||D.validate)&&(0,i.funcKeywordCode)(ie,D)}let ae=/^\/(?:[^~]|~0|~1)*$/,ze=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Je(T,{dataLevel:A,dataNames:D,dataPathArr:se}){let ie,de;if(T==="")return u.default.rootData;if(T[0]==="/"){if(!ae.test(T))throw new Error(`Invalid JSON-pointer: ${T}`);ie=T,de=u.default.rootData}else{let xe=ze.exec(T);if(!xe)throw new Error(`Invalid JSON-pointer: ${T}`);let we=+xe[1];if(ie=xe[2],ie==="#"){if(we>=A)throw new Error(Ze("property/index",we));return se[A-we]}if(we>A)throw new Error(Ze("data",we));if(de=D[A-we],!ie)return de}let ke=de,Ne=ie.split("/");for(let xe of Ne)xe&&(de=(0,a._)`${de}${(0,a.getProperty)((0,p.unescapeJsonPointer)(xe))}`,ke=(0,a._)`${ke} && ${de}`);return ke;function Ze(xe,we){return`Cannot access ${xe} ${we} levels up, current level is ${A}`}}e.getData=Je})),Jn=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}};e.default=t})),uo=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cc();var r=class extends Error{constructor(o,n,s,i){super(i||`can't resolve reference ${s} from id ${n}`),this.missingRef=(0,t.resolveUrl)(o,n,s),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(o,this.missingRef))}};e.default=r})),uc=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=le(),r=Jn(),o=pt(),n=cc(),s=_e(),i=co();var c=class{constructor(f){var z;this.refs={},this.dynamicAnchors={};let S;typeof f.schema=="object"&&(S=f.schema),this.schema=f.schema,this.schemaId=f.schemaId,this.root=f.root||this,this.baseId=(z=f.baseId)!==null&&z!==void 0?z:(0,n.normalizeId)(S?.[f.schemaId||"$id"]),this.schemaPath=f.schemaPath,this.localRefs=f.localRefs,this.meta=f.meta,this.$async=S?.$async,this.refs={}}};e.SchemaEnv=c;function a(f){let z=p.call(this,f);if(z)return z;let S=(0,n.getFullPath)(this.opts.uriResolver,f.root.baseId),{es5:R,lines:w}=this.opts.code,{ownProperties:b}=this.opts,y=new t.CodeGen(this.scope,{es5:R,lines:w,ownProperties:b}),E;f.$async&&(E=y.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let N=y.scopeName("validate");f.validateName=N;let V={gen:y,allErrors:this.opts.allErrors,data:o.default.data,parentData:o.default.parentData,parentDataProperty:o.default.parentDataProperty,dataNames:[o.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:y.scopeValue("schema",this.opts.code.source===!0?{ref:f.schema,code:(0,t.stringify)(f.schema)}:{ref:f.schema}),validateName:N,ValidationError:E,schema:f.schema,schemaEnv:f,rootId:S,baseId:f.baseId||S,schemaPath:t.nil,errSchemaPath:f.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this},M;try{this._compilations.add(f),(0,i.validateFunctionCode)(V),y.optimize(this.opts.code.optimize);let Z=y.toString();M=`${y.scopeRefs(o.default.scope)}return ${Z}`,this.opts.code.process&&(M=this.opts.code.process(M,f));let W=new Function(`${o.default.self}`,`${o.default.scope}`,M)(this,this.scope.get());if(this.scope.value(N,{ref:W}),W.errors=null,W.schema=f.schema,W.schemaEnv=f,f.$async&&(W.$async=!0),this.opts.code.source===!0&&(W.source={validateName:N,validateCode:Z,scopeValues:y._values}),this.opts.unevaluated){let{props:G,items:fe}=V;W.evaluated={props:G instanceof t.Name?void 0:G,items:fe instanceof t.Name?void 0:fe,dynamicProps:G instanceof t.Name,dynamicItems:fe instanceof t.Name},W.source&&(W.source.evaluated=(0,t.stringify)(W.evaluated))}return f.validate=W,f}catch(Z){throw delete f.validate,delete f.validateName,M&&this.logger.error("Error compiling schema, function code:",M),Z}finally{this._compilations.delete(f)}}e.compileSchema=a;function u(f,z,S){var R;S=(0,n.resolveUrl)(this.opts.uriResolver,z,S);let w=f.refs[S];if(w)return w;let b=v.call(this,f,S);if(b===void 0){let y=(R=f.localRefs)===null||R===void 0?void 0:R[S],{schemaId:E}=this.opts;y&&(b=new c({schema:y,schemaId:E,root:f,baseId:z}))}if(b!==void 0)return f.refs[S]=d.call(this,b)}e.resolveRef=u;function d(f){return(0,n.inlineRef)(f.schema,this.opts.inlineRefs)?f.schema:f.validate?f:a.call(this,f)}function p(f){for(let z of this._compilations)if(g(z,f))return z}e.getCompilingSchema=p;function g(f,z){return f.schema===z.schema&&f.root===z.root&&f.baseId===z.baseId}function v(f,z){let S;for(;typeof(S=this.refs[z])=="string";)z=S;return S||this.schemas[z]||m.call(this,f,z)}function m(f,z){let S=this.opts.uriResolver.parse(z),R=(0,n._getFullPath)(this.opts.uriResolver,S),w=(0,n.getFullPath)(this.opts.uriResolver,f.baseId,void 0);if(Object.keys(f.schema).length>0&&R===w)return h.call(this,S,f);let b=(0,n.normalizeId)(R),y=this.refs[b]||this.schemas[b];if(typeof y=="string"){let E=m.call(this,f,y);return typeof E?.schema!="object"?void 0:h.call(this,S,E)}if(typeof y?.schema=="object"){if(y.validate||a.call(this,y),b===(0,n.normalizeId)(z)){let{schema:E}=y,{schemaId:N}=this.opts,V=E[N];return V&&(w=(0,n.resolveUrl)(this.opts.uriResolver,w,V)),new c({schema:E,schemaId:N,root:f,baseId:w})}return h.call(this,S,y)}}e.resolveSchema=m;let _=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function h(f,{baseId:z,schema:S,root:R}){var w;if(((w=f.fragment)===null||w===void 0?void 0:w[0])!=="/")return;for(let E of f.fragment.slice(1).split("/")){if(typeof S=="boolean")return;let N=S[(0,s.unescapeFragment)(E)];if(N===void 0)return;S=N;let V=typeof S=="object"&&S[this.opts.schemaId];!_.has(E)&&V&&(z=(0,n.resolveUrl)(this.opts.uriResolver,z,V))}let b;if(typeof S!="boolean"&&S.$ref&&!(0,s.schemaHasRulesButRef)(S,this.RULES)){let E=(0,n.resolveUrl)(this.opts.uriResolver,z,S.$ref);b=m.call(this,R,E)}let{schemaId:y}=this.opts;if(b=b||new c({schema:S,schemaId:y,root:R,baseId:z}),b.schema!==b.root.schema)return b}})),n0=U(((e,t)=>{t.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}})),C_=U(((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),o=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 n(m){let _="",h=0,f=0;for(f=0;f<m.length;f++)if(h=m[f].charCodeAt(0),h!==48){if(!(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102))return"";_+=m[f];break}for(f+=1;f<m.length;f++){if(h=m[f].charCodeAt(0),!(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102))return"";_+=m[f]}return _}let s=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(m){return m.length=0,!0}function c(m,_,h){if(m.length){let f=n(m);if(f!=="")_.push(f);else return h.error=!0,!1;m.length=0}return!0}function a(m){let _=0,h={error:!1,address:"",zone:""},f=[],z=[],S=!1,R=!1,w=c;for(let b=0;b<m.length;b++){let y=m[b];if(!(y==="["||y==="]"))if(y===":"){if(S===!0&&(R=!0),!w(z,f,h))break;if(++_>7){h.error=!0;break}b>0&&m[b-1]===":"&&(S=!0),f.push(":");continue}else if(y==="%"){if(!w(z,f,h))break;w=i}else{z.push(y);continue}}return z.length&&(w===i?h.zone=z.join(""):R?f.push(z.join("")):f.push(n(z))),h.address=f.join(""),h}function u(m){if(d(m,":")<2)return{host:m,isIPV6:!1};let _=a(m);if(_.error)return{host:m,isIPV6:!1};{let h=_.address,f=_.address;return _.zone&&(h+="%"+_.zone,f+="%25"+_.zone),{host:h,isIPV6:!0,escapedHost:f}}}function d(m,_){let h=0;for(let f=0;f<m.length;f++)m[f]===_&&h++;return h}function p(m){let _=m,h=[],f=-1,z=0;for(;z=_.length;){if(z===1){if(_===".")break;if(_==="/"){h.push("/");break}else{h.push(_);break}}else if(z===2){if(_[0]==="."){if(_[1]===".")break;if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"&&(_[1]==="."||_[1]==="/")){h.push("/");break}}else if(z===3&&_==="/.."){h.length!==0&&h.pop(),h.push("/");break}if(_[0]==="."){if(_[1]==="."){if(_[2]==="/"){_=_.slice(3);continue}}else if(_[1]==="/"){_=_.slice(2);continue}}else if(_[0]==="/"&&_[1]==="."){if(_[2]==="/"){_=_.slice(2);continue}else if(_[2]==="."&&_[3]==="/"){_=_.slice(3),h.length!==0&&h.pop();continue}}if((f=_.indexOf("/",1))===-1){h.push(_);break}else h.push(_.slice(0,f)),_=_.slice(f)}return h.join("")}function g(m,_){let h=_!==!0?escape:unescape;return m.scheme!==void 0&&(m.scheme=h(m.scheme)),m.userinfo!==void 0&&(m.userinfo=h(m.userinfo)),m.host!==void 0&&(m.host=h(m.host)),m.path!==void 0&&(m.path=h(m.path)),m.query!==void 0&&(m.query=h(m.query)),m.fragment!==void 0&&(m.fragment=h(m.fragment)),m}function v(m){let _=[];if(m.userinfo!==void 0&&(_.push(m.userinfo),_.push("@")),m.host!==void 0){let h=unescape(m.host);if(!o(h)){let f=u(h);f.isIPV6===!0?h=`[${f.escapedHost}]`:h=m.host}_.push(h)}return(typeof m.port=="number"||typeof m.port=="string")&&(_.push(":"),_.push(String(m.port))),_.length?_.join(""):void 0}t.exports={nonSimpleDomain:s,recomposeAuthority:v,normalizeComponentEncoding:g,removeDotSegments:p,isIPv4:o,isUUID:r,normalizeIPv6:u,stringArrayToHexStripped:n}})),s0=U(((e,t)=>{let{isUUID:r}=C_(),o=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,n=["http","https","ws","wss","urn","urn:uuid"];function s(y){return n.indexOf(y)!==-1}function i(y){return y.secure===!0?!0:y.secure===!1?!1:y.scheme?y.scheme.length===3&&(y.scheme[0]==="w"||y.scheme[0]==="W")&&(y.scheme[1]==="s"||y.scheme[1]==="S")&&(y.scheme[2]==="s"||y.scheme[2]==="S"):!1}function c(y){return y.host||(y.error=y.error||"HTTP URIs must have a host."),y}function a(y){let E=String(y.scheme).toLowerCase()==="https";return(y.port===(E?443:80)||y.port==="")&&(y.port=void 0),y.path||(y.path="/"),y}function u(y){return y.secure=i(y),y.resourceName=(y.path||"/")+(y.query?"?"+y.query:""),y.path=void 0,y.query=void 0,y}function d(y){if((y.port===(i(y)?443:80)||y.port==="")&&(y.port=void 0),typeof y.secure=="boolean"&&(y.scheme=y.secure?"wss":"ws",y.secure=void 0),y.resourceName){let[E,N]=y.resourceName.split("?");y.path=E&&E!=="/"?E:void 0,y.query=N,y.resourceName=void 0}return y.fragment=void 0,y}function p(y,E){if(!y.path)return y.error="URN can not be parsed",y;let N=y.path.match(o);if(N){let V=E.scheme||y.scheme||"urn";y.nid=N[1].toLowerCase(),y.nss=N[2];let M=b(`${V}:${E.nid||y.nid}`);y.path=void 0,M&&(y=M.parse(y,E))}else y.error=y.error||"URN can not be parsed.";return y}function g(y,E){if(y.nid===void 0)throw new Error("URN without nid cannot be serialized");let N=E.scheme||y.scheme||"urn",V=y.nid.toLowerCase(),M=b(`${N}:${E.nid||V}`);M&&(y=M.serialize(y,E));let Z=y,W=y.nss;return Z.path=`${V||E.nid}:${W}`,E.skipEscape=!0,Z}function v(y,E){let N=y;return N.uuid=N.nss,N.nss=void 0,!E.tolerant&&(!N.uuid||!r(N.uuid))&&(N.error=N.error||"UUID is not valid."),N}function m(y){let E=y;return E.nss=(y.uuid||"").toLowerCase(),E}let _={scheme:"http",domainHost:!0,parse:c,serialize:a},h={scheme:"https",domainHost:_.domainHost,parse:c,serialize:a},f={scheme:"ws",domainHost:!0,parse:u,serialize:d},z={scheme:"wss",domainHost:f.domainHost,parse:f.parse,serialize:f.serialize},w={http:_,https:h,ws:f,wss:z,urn:{scheme:"urn",parse:p,serialize:g,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:v,serialize:m,skipNormalize:!0}};Object.setPrototypeOf(w,null);function b(y){return y&&(w[y]||w[y.toLowerCase()])||void 0}t.exports={wsIsSecure:i,SCHEMES:w,isValidSchemeName:s,getSchemeHandler:b}})),i0=U(((e,t)=>{let{normalizeIPv6:r,removeDotSegments:o,recomposeAuthority:n,normalizeComponentEncoding:s,isIPv4:i,nonSimpleDomain:c}=C_(),{SCHEMES:a,getSchemeHandler:u}=s0();function d(z,S){return typeof z=="string"?z=m(h(z,S),S):typeof z=="object"&&(z=h(m(z,S),S)),z}function p(z,S,R){let w=R?Object.assign({scheme:"null"},R):{scheme:"null"},b=g(h(z,w),h(S,w),w,!0);return w.skipEscape=!0,m(b,w)}function g(z,S,R,w){let b={};return w||(z=h(m(z,R),R),S=h(m(S,R),R)),R=R||{},!R.tolerant&&S.scheme?(b.scheme=S.scheme,b.userinfo=S.userinfo,b.host=S.host,b.port=S.port,b.path=o(S.path||""),b.query=S.query):(S.userinfo!==void 0||S.host!==void 0||S.port!==void 0?(b.userinfo=S.userinfo,b.host=S.host,b.port=S.port,b.path=o(S.path||""),b.query=S.query):(S.path?(S.path[0]==="/"?b.path=o(S.path):((z.userinfo!==void 0||z.host!==void 0||z.port!==void 0)&&!z.path?b.path="/"+S.path:z.path?b.path=z.path.slice(0,z.path.lastIndexOf("/")+1)+S.path:b.path=S.path,b.path=o(b.path)),b.query=S.query):(b.path=z.path,S.query!==void 0?b.query=S.query:b.query=z.query),b.userinfo=z.userinfo,b.host=z.host,b.port=z.port),b.scheme=z.scheme),b.fragment=S.fragment,b}function v(z,S,R){return typeof z=="string"?(z=unescape(z),z=m(s(h(z,R),!0),{...R,skipEscape:!0})):typeof z=="object"&&(z=m(s(z,!0),{...R,skipEscape:!0})),typeof S=="string"?(S=unescape(S),S=m(s(h(S,R),!0),{...R,skipEscape:!0})):typeof S=="object"&&(S=m(s(S,!0),{...R,skipEscape:!0})),z.toLowerCase()===S.toLowerCase()}function m(z,S){let R={host:z.host,scheme:z.scheme,userinfo:z.userinfo,port:z.port,path:z.path,query:z.query,nid:z.nid,nss:z.nss,uuid:z.uuid,fragment:z.fragment,reference:z.reference,resourceName:z.resourceName,secure:z.secure,error:""},w=Object.assign({},S),b=[],y=u(w.scheme||R.scheme);y&&y.serialize&&y.serialize(R,w),R.path!==void 0&&(w.skipEscape?R.path=unescape(R.path):(R.path=escape(R.path),R.scheme!==void 0&&(R.path=R.path.split("%3A").join(":")))),w.reference!=="suffix"&&R.scheme&&b.push(R.scheme,":");let E=n(R);if(E!==void 0&&(w.reference!=="suffix"&&b.push("//"),b.push(E),R.path&&R.path[0]!=="/"&&b.push("/")),R.path!==void 0){let N=R.path;!w.absolutePath&&(!y||!y.absolutePath)&&(N=o(N)),E===void 0&&N[0]==="/"&&N[1]==="/"&&(N="/%2F"+N.slice(2)),b.push(N)}return R.query!==void 0&&b.push("?",R.query),R.fragment!==void 0&&b.push("#",R.fragment),b.join("")}let _=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(z,S){let R=Object.assign({},S),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},b=!1;R.reference==="suffix"&&(R.scheme?z=R.scheme+":"+z:z="//"+z);let y=z.match(_);if(y){if(w.scheme=y[1],w.userinfo=y[3],w.host=y[4],w.port=parseInt(y[5],10),w.path=y[6]||"",w.query=y[7],w.fragment=y[8],isNaN(w.port)&&(w.port=y[5]),w.host)if(i(w.host)===!1){let N=r(w.host);w.host=N.host.toLowerCase(),b=N.isIPV6}else b=!0;w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path?w.reference="same-document":w.scheme===void 0?w.reference="relative":w.fragment===void 0?w.reference="absolute":w.reference="uri",R.reference&&R.reference!=="suffix"&&R.reference!==w.reference&&(w.error=w.error||"URI is not a "+R.reference+" reference.");let E=u(R.scheme||w.scheme);if(!R.unicodeSupport&&(!E||!E.unicodeSupport)&&w.host&&(R.domainHost||E&&E.domainHost)&&b===!1&&c(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(N){w.error=w.error||"Host's domain name can not be converted to ASCII: "+N}(!E||E&&!E.skipNormalize)&&(z.indexOf("%")!==-1&&(w.scheme!==void 0&&(w.scheme=unescape(w.scheme)),w.host!==void 0&&(w.host=unescape(w.host))),w.path&&(w.path=escape(unescape(w.path))),w.fragment&&(w.fragment=encodeURI(decodeURIComponent(w.fragment)))),E&&E.parse&&E.parse(w,R)}else w.error=w.error||"URI can not be parsed.";return w}let f={SCHEMES:a,normalize:d,resolve:p,resolveComponent:g,equal:v,serialize:m,parse:h};t.exports=f,t.exports.default=f,t.exports.fastUri=f})),a0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=i0();t.code='require("ajv/dist/runtime/uri").default',e.default=t})),nd=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=co();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=le();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let o=Jn(),n=uo(),s=P_(),i=uc(),c=le(),a=cc(),u=ic(),d=_e(),p=n0(),g=a0(),v=(k,j)=>new RegExp(k,j);v.code="new RegExp";let m=["removeAdditional","useDefaults","coerceTypes"],_=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),h={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."},f={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},z=200;function S(k){var j,F,$,C,x,J,ee,pe,ae,ze,Je,T,A,D,se,ie,de,ke,Ne,Ze,xe,we,ot,Ae,ht;let at=k.strict,gt=(j=k.code)===null||j===void 0?void 0:j.optimize,It=gt===!0||gt===void 0?1:gt||0,Ot=($=(F=k.code)===null||F===void 0?void 0:F.regExp)!==null&&$!==void 0?$:v,Xt=(C=k.uriResolver)!==null&&C!==void 0?C:g.default;return{strictSchema:(J=(x=k.strictSchema)!==null&&x!==void 0?x:at)!==null&&J!==void 0?J:!0,strictNumbers:(pe=(ee=k.strictNumbers)!==null&&ee!==void 0?ee:at)!==null&&pe!==void 0?pe:!0,strictTypes:(ze=(ae=k.strictTypes)!==null&&ae!==void 0?ae:at)!==null&&ze!==void 0?ze:"log",strictTuples:(T=(Je=k.strictTuples)!==null&&Je!==void 0?Je:at)!==null&&T!==void 0?T:"log",strictRequired:(D=(A=k.strictRequired)!==null&&A!==void 0?A:at)!==null&&D!==void 0?D:!1,code:k.code?{...k.code,optimize:It,regExp:Ot}:{optimize:It,regExp:Ot},loopRequired:(se=k.loopRequired)!==null&&se!==void 0?se:z,loopEnum:(ie=k.loopEnum)!==null&&ie!==void 0?ie:z,meta:(de=k.meta)!==null&&de!==void 0?de:!0,messages:(ke=k.messages)!==null&&ke!==void 0?ke:!0,inlineRefs:(Ne=k.inlineRefs)!==null&&Ne!==void 0?Ne:!0,schemaId:(Ze=k.schemaId)!==null&&Ze!==void 0?Ze:"$id",addUsedSchema:(xe=k.addUsedSchema)!==null&&xe!==void 0?xe:!0,validateSchema:(we=k.validateSchema)!==null&&we!==void 0?we:!0,validateFormats:(ot=k.validateFormats)!==null&&ot!==void 0?ot:!0,unicodeRegExp:(Ae=k.unicodeRegExp)!==null&&Ae!==void 0?Ae:!0,int32range:(ht=k.int32range)!==null&&ht!==void 0?ht:!0,uriResolver:Xt}}var R=class{constructor(k={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,...S(k)};let{es5:j,lines:F}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:_,es5:j,lines:F}),this.logger=Z(k.logger);let $=k.validateFormats;k.validateFormats=!1,this.RULES=(0,s.getRules)(),w.call(this,h,k,"NOT SUPPORTED"),w.call(this,f,k,"DEPRECATED","warn"),this._metaOpts=V.call(this),k.formats&&E.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords&&N.call(this,k.keywords),typeof k.meta=="object"&&this.addMetaSchema(k.meta),y.call(this),k.validateFormats=$}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:k,meta:j,schemaId:F}=this.opts,$=p;F==="id"&&($={...p},$.id=$.$id,delete $.$id),j&&k&&this.addMetaSchema($,$[F],!1)}defaultMeta(){let{meta:k,schemaId:j}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[j]||k:void 0}validate(k,j){let F;if(typeof k=="string"){if(F=this.getSchema(k),!F)throw new Error(`no schema with key or ref "${k}"`)}else F=this.compile(k);let $=F(j);return"$async"in F||(this.errors=F.errors),$}compile(k,j){let F=this._addSchema(k,j);return F.validate||this._compileSchemaEnv(F)}compileAsync(k,j){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:F}=this.opts;return $.call(this,k,j);async function $(ae,ze){await C.call(this,ae.$schema);let Je=this._addSchema(ae,ze);return Je.validate||x.call(this,Je)}async function C(ae){ae&&!this.getSchema(ae)&&await $.call(this,{$ref:ae},!0)}async function x(ae){try{return this._compileSchemaEnv(ae)}catch(ze){if(!(ze instanceof n.default))throw ze;return J.call(this,ze),await ee.call(this,ze.missingSchema),x.call(this,ae)}}function J({missingSchema:ae,missingRef:ze}){if(this.refs[ae])throw new Error(`AnySchema ${ae} is loaded but ${ze} cannot be resolved`)}async function ee(ae){let ze=await pe.call(this,ae);this.refs[ae]||await C.call(this,ze.$schema),this.refs[ae]||this.addSchema(ze,ae,j)}async function pe(ae){let ze=this._loading[ae];if(ze)return ze;try{return await(this._loading[ae]=F(ae))}finally{delete this._loading[ae]}}}addSchema(k,j,F,$=this.opts.validateSchema){if(Array.isArray(k)){for(let x of k)this.addSchema(x,void 0,F,$);return this}let C;if(typeof k=="object"){let{schemaId:x}=this.opts;if(C=k[x],C!==void 0&&typeof C!="string")throw new Error(`schema ${x} must be string`)}return j=(0,a.normalizeId)(j||C),this._checkUnique(j),this.schemas[j]=this._addSchema(k,F,j,$,!0),this}addMetaSchema(k,j,F=this.opts.validateSchema){return this.addSchema(k,j,!0,F),this}validateSchema(k,j){if(typeof k=="boolean")return!0;let F;if(F=k.$schema,F!==void 0&&typeof F!="string")throw new Error("$schema must be a string");if(F=F||this.opts.defaultMeta||this.defaultMeta(),!F)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let $=this.validate(F,k);if(!$&&j){let C="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(C);else throw new Error(C)}return $}getSchema(k){let j;for(;typeof(j=b.call(this,k))=="string";)k=j;if(j===void 0){let{schemaId:F}=this.opts,$=new i.SchemaEnv({schema:{},schemaId:F});if(j=i.resolveSchema.call(this,$,k),!j)return;this.refs[k]=j}return j.validate||this._compileSchemaEnv(j)}removeSchema(k){if(k instanceof RegExp)return this._removeAllSchemas(this.schemas,k),this._removeAllSchemas(this.refs,k),this;switch(typeof k){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let j=b.call(this,k);return typeof j=="object"&&this._cache.delete(j.schema),delete this.schemas[k],delete this.refs[k],this}case"object":{let j=k;this._cache.delete(j);let F=k[this.opts.schemaId];return F&&(F=(0,a.normalizeId)(F),delete this.schemas[F],delete this.refs[F]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(k){for(let j of k)this.addKeyword(j);return this}addKeyword(k,j){let F;if(typeof k=="string")F=k,typeof j=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),j.keyword=F);else if(typeof k=="object"&&j===void 0){if(j=k,F=j.keyword,Array.isArray(F)&&!F.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(G.call(this,F,j),!j)return(0,d.eachItem)(F,C=>fe.call(this,C)),this;be.call(this,j);let $={...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)};return(0,d.eachItem)(F,$.type.length===0?C=>fe.call(this,C,$):C=>$.type.forEach(x=>fe.call(this,C,$,x))),this}getKeyword(k){let j=this.RULES.all[k];return typeof j=="object"?j.definition:!!j}removeKeyword(k){let{RULES:j}=this;delete j.keywords[k],delete j.all[k];for(let F of j.rules){let $=F.rules.findIndex(C=>C.keyword===k);$>=0&&F.rules.splice($,1)}return this}addFormat(k,j){return typeof j=="string"&&(j=new RegExp(j)),this.formats[k]=j,this}errorsText(k=this.errors,{separator:j=", ",dataVar:F="data"}={}){return!k||k.length===0?"No errors":k.map($=>`${F}${$.instancePath} ${$.message}`).reduce(($,C)=>$+j+C)}$dataMetaSchema(k,j){let F=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(let $ of j){let C=$.split("/").slice(1),x=k;for(let J of C)x=x[J];for(let J in F){let ee=F[J];if(typeof ee!="object")continue;let{$data:pe}=ee.definition,ae=x[J];pe&&ae&&(x[J]=he(ae))}}return k}_removeAllSchemas(k,j){for(let F in k){let $=k[F];(!j||j.test(F))&&(typeof $=="string"?delete k[F]:$&&!$.meta&&(this._cache.delete($.schema),delete k[F]))}}_addSchema(k,j,F,$=this.opts.validateSchema,C=this.opts.addUsedSchema){let x,{schemaId:J}=this.opts;if(typeof k=="object")x=k[J];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof k!="boolean")throw new Error("schema must be object or boolean")}let ee=this._cache.get(k);if(ee!==void 0)return ee;F=(0,a.normalizeId)(x||F);let pe=a.getSchemaRefs.call(this,k,F);return ee=new i.SchemaEnv({schema:k,schemaId:J,meta:j,baseId:F,localRefs:pe}),this._cache.set(ee.schema,ee),C&&!F.startsWith("#")&&(F&&this._checkUnique(F),this.refs[F]=ee),$&&this.validateSchema(k,!0),ee}_checkUnique(k){if(this.schemas[k]||this.refs[k])throw new Error(`schema with key or id "${k}" already exists`)}_compileSchemaEnv(k){if(k.meta?this._compileMetaSchema(k):i.compileSchema.call(this,k),!k.validate)throw new Error("ajv implementation error");return k.validate}_compileMetaSchema(k){let j=this.opts;this.opts=this._metaOpts;try{i.compileSchema.call(this,k)}finally{this.opts=j}}};R.ValidationError=o.default,R.MissingRefError=n.default,e.default=R;function w(k,j,F,$="error"){for(let C in k){let x=C;x in j&&this.logger[$](`${F}: option ${C}. ${k[x]}`)}}function b(k){return k=(0,a.normalizeId)(k),this.schemas[k]||this.refs[k]}function y(){let k=this.opts.schemas;if(k)if(Array.isArray(k))this.addSchema(k);else for(let j in k)this.addSchema(k[j],j)}function E(){for(let k in this.opts.formats){let j=this.opts.formats[k];j&&this.addFormat(k,j)}}function N(k){if(Array.isArray(k)){this.addVocabulary(k);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let j in k){let F=k[j];F.keyword||(F.keyword=j),this.addKeyword(F)}}function V(){let k={...this.opts};for(let j of m)delete k[j];return k}let M={log(){},warn(){},error(){}};function Z(k){if(k===!1)return M;if(k===void 0)return console;if(k.log&&k.warn&&k.error)return k;throw new Error("logger must implement log, warn and error methods")}let W=/^[a-z_$][a-z0-9_$:-]*$/i;function G(k,j){let{RULES:F}=this;if((0,d.eachItem)(k,$=>{if(F.keywords[$])throw new Error(`Keyword ${$} is already defined`);if(!W.test($))throw new Error(`Keyword ${$} has invalid name`)}),!!j&&j.$data&&!("code"in j||"validate"in j))throw new Error('$data keyword must have "code" or "validate" function')}function fe(k,j,F){var $;let C=j?.post;if(F&&C)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:x}=this,J=C?x.post:x.rules.find(({type:pe})=>pe===F);if(J||(J={type:F,rules:[]},x.rules.push(J)),x.keywords[k]=!0,!j)return;let ee={keyword:k,definition:{...j,type:(0,u.getJSONTypes)(j.type),schemaType:(0,u.getJSONTypes)(j.schemaType)}};j.before?$e.call(this,J,ee,j.before):J.rules.push(ee),x.all[k]=ee,($=j.implements)===null||$===void 0||$.forEach(pe=>this.addKeyword(pe))}function $e(k,j,F){let $=k.rules.findIndex(C=>C.keyword===F);$>=0?k.rules.splice($,0,j):(k.rules.push(j),this.logger.warn(`rule ${F} is not defined`))}function be(k){let{metaSchema:j}=k;j!==void 0&&(k.$data&&this.opts.$data&&(j=he(j)),k.validateSchema=this.compile(j,!0))}let Oe={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function he(k){return{anyOf:[k,Oe]}}})),c0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t})),sd=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=uo(),r=mt(),o=le(),n=pt(),s=uc(),i=_e(),c={keyword:"$ref",schemaType:"string",code(d){let{gen:p,schema:g,it:v}=d,{baseId:m,schemaEnv:_,validateName:h,opts:f,self:z}=v,{root:S}=_;if((g==="#"||g==="#/")&&m===S.baseId)return w();let R=s.resolveRef.call(z,S,m,g);if(R===void 0)throw new t.default(v.opts.uriResolver,m,g);if(R instanceof s.SchemaEnv)return b(R);return y(R);function w(){if(_===S)return u(d,h,_,_.$async);let E=p.scopeValue("root",{ref:S});return u(d,(0,o._)`${E}.validate`,S,S.$async)}function b(E){u(d,a(d,E),E,E.$async)}function y(E){let N=p.scopeValue("schema",f.code.source===!0?{ref:E,code:(0,o.stringify)(E)}:{ref:E}),V=p.name("valid"),M=d.subschema({schema:E,dataTypes:[],schemaPath:o.nil,topSchemaRef:N,errSchemaPath:g},V);d.mergeEvaluated(M),d.ok(V)}}};function a(d,p){let{gen:g}=d;return p.validate?g.scopeValue("validate",{ref:p.validate}):(0,o._)`${g.scopeValue("wrapper",{ref:p})}.validate`}e.getValidate=a;function u(d,p,g,v){let{gen:m,it:_}=d,{allErrors:h,schemaEnv:f,opts:z}=_,S=z.passContext?n.default.this:o.nil;v?R():w();function R(){if(!f.$async)throw new Error("async schema referenced by sync schema");let E=m.let("valid");m.try(()=>{m.code((0,o._)`await ${(0,r.callValidateCode)(d,p,S)}`),y(p),h||m.assign(E,!0)},N=>{m.if((0,o._)`!(${N} instanceof ${_.ValidationError})`,()=>m.throw(N)),b(N),h||m.assign(E,!1)}),d.ok(E)}function w(){d.result((0,r.callValidateCode)(d,p,S),()=>y(p),()=>b(p))}function b(E){let N=(0,o._)`${E}.errors`;m.assign(n.default.vErrors,(0,o._)`${n.default.vErrors} === null ? ${N} : ${n.default.vErrors}.concat(${N})`),m.assign(n.default.errors,(0,o._)`${n.default.vErrors}.length`)}function y(E){var N;if(!_.opts.unevaluated)return;let V=(N=g?.validate)===null||N===void 0?void 0:N.evaluated;if(_.props!==!0)if(V&&!V.dynamicProps)V.props!==void 0&&(_.props=i.mergeEvaluated.props(m,V.props,_.props));else{let M=m.var("props",(0,o._)`${E}.evaluated.props`);_.props=i.mergeEvaluated.props(m,M,_.props,o.Name)}if(_.items!==!0)if(V&&!V.dynamicItems)V.items!==void 0&&(_.items=i.mergeEvaluated.items(m,V.items,_.items));else{let M=m.var("items",(0,o._)`${E}.evaluated.items`);_.items=i.mergeEvaluated.items(m,M,_.items,o.Name)}}}e.callRef=u,e.default=c})),k_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=c0(),r=sd(),o=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=o})),u0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=t.operators,o={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},n={keyword:Object.keys(o),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:s,schemaCode:i})=>(0,t.str)`must be ${o[s].okStr} ${i}`,params:({keyword:s,schemaCode:i})=>(0,t._)`{comparison: ${o[s].okStr}, limit: ${i}}`},code(s){let{keyword:i,data:c,schemaCode:a}=s;s.fail$data((0,t._)`${c} ${o[i].fail} ${a} || isNaN(${c})`)}};e.default=n})),l0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must be multiple of ${o}`,params:({schemaCode:o})=>(0,t._)`{multipleOf: ${o}}`},code(o){let{gen:n,data:s,schemaCode:i,it:c}=o,a=c.opts.multipleOfPrecision,u=n.let("res"),d=a?(0,t._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${a}`:(0,t._)`${u} !== parseInt(${u})`;o.fail$data((0,t._)`(${i} === 0 || (${u} = ${s}/${i}, ${d}))`)}};e.default=r})),d0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let o=r.length,n=0,s=0,i;for(;s<o;)n++,i=r.charCodeAt(s++),i>=55296&&i<=56319&&s<o&&(i=r.charCodeAt(s),(i&64512)===56320&&s++);return n}e.default=t,t.code='require("ajv/dist/runtime/ucs2length").default'})),p0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=d0(),n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:s,schemaCode:i}){let c=s==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${c} than ${i} characters`},params:({schemaCode:s})=>(0,t._)`{limit: ${s}}`},code(s){let{keyword:i,data:c,schemaCode:a,it:u}=s,d=i==="maxLength"?t.operators.GT:t.operators.LT,p=u.opts.unicode===!1?(0,t._)`${c}.length`:(0,t._)`${(0,r.useFunc)(s.gen,o.default)}(${c})`;s.fail$data((0,t._)`${p} ${d} ${a}`)}};e.default=n})),m0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=_e(),o=le(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:s})=>(0,o.str)`must match pattern "${s}"`,params:({schemaCode:s})=>(0,o._)`{pattern: ${s}}`},code(s){let{gen:i,data:c,$data:a,schema:u,schemaCode:d,it:p}=s,g=p.opts.unicodeRegExp?"u":"";if(a){let{regExp:v}=p.opts.code,m=v.code==="new RegExp"?(0,o._)`new RegExp`:(0,r.useFunc)(i,v),_=i.let("valid");i.try(()=>i.assign(_,(0,o._)`${m}(${d}, ${g}).test(${c})`),()=>i.assign(_,!1)),s.fail$data((0,o._)`!${_}`)}else{let v=(0,t.usePattern)(s,u);s.fail$data((0,o._)`!${v}.test(${c})`)}}};e.default=n})),f0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} properties`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,c=n==="maxProperties"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`Object.keys(${s}).length ${c} ${i}`)}};e.default=r})),h0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=le(),o=_e(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:s}})=>(0,r.str)`must have required property '${s}'`,params:({params:{missingProperty:s}})=>(0,r._)`{missingProperty: ${s}}`},code(s){let{gen:i,schema:c,schemaCode:a,data:u,$data:d,it:p}=s,{opts:g}=p;if(!d&&c.length===0)return;let v=c.length>=g.loopRequired;if(p.allErrors?m():_(),g.strictRequired){let z=s.parentSchema.properties,{definedProperties:S}=s.it;for(let R of c)if(z?.[R]===void 0&&!S.has(R)){let w=`required property "${R}" is not defined at "${p.schemaEnv.baseId+p.errSchemaPath}" (strictRequired)`;(0,o.checkStrictMode)(p,w,p.opts.strictRequired)}}function m(){if(v||d)s.block$data(r.nil,h);else for(let z of c)(0,t.checkReportMissingProp)(s,z)}function _(){let z=i.let("missing");if(v||d){let S=i.let("valid",!0);s.block$data(S,()=>f(z,S)),s.ok(S)}else i.if((0,t.checkMissingProp)(s,c,z)),(0,t.reportMissingProp)(s,z),i.else()}function h(){i.forOf("prop",a,z=>{s.setParams({missingProperty:z}),i.if((0,t.noPropertyInData)(i,u,z,g.ownProperties),()=>s.error())})}function f(z,S){s.setParams({missingProperty:z}),i.forOf(z,a,()=>{i.assign(S,(0,t.propertyInData)(i,u,z,g.ownProperties)),i.if((0,r.not)(S),()=>{s.error(),i.break()})},r.nil)}}};e.default=n})),g0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:o,schemaCode:n}){let s=o==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${s} than ${n} items`},params:({schemaCode:o})=>(0,t._)`{limit: ${o}}`},code(o){let{keyword:n,data:s,schemaCode:i}=o,c=n==="maxItems"?t.operators.GT:t.operators.LT;o.fail$data((0,t._)`${s}.length ${c} ${i}`)}};e.default=r})),id=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=T_();t.code='require("ajv/dist/runtime/equal").default',e.default=t})),_0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ic(),r=le(),o=_e(),n=id(),s={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i,j:c}})=>(0,r.str)`must NOT have duplicate items (items ## ${c} and ${i} are identical)`,params:({params:{i,j:c}})=>(0,r._)`{i: ${i}, j: ${c}}`},code(i){let{gen:c,data:a,$data:u,schema:d,parentSchema:p,schemaCode:g,it:v}=i;if(!u&&!d)return;let m=c.let("valid"),_=p.items?(0,t.getSchemaTypes)(p.items):[];i.block$data(m,h,(0,r._)`${g} === false`),i.ok(m);function h(){let R=c.let("i",(0,r._)`${a}.length`),w=c.let("j");i.setParams({i:R,j:w}),c.assign(m,!0),c.if((0,r._)`${R} > 1`,()=>(f()?z:S)(R,w))}function f(){return _.length>0&&!_.some(R=>R==="object"||R==="array")}function z(R,w){let b=c.name("item"),y=(0,t.checkDataTypes)(_,b,v.opts.strictNumbers,t.DataType.Wrong),E=c.const("indices",(0,r._)`{}`);c.for((0,r._)`;${R}--;`,()=>{c.let(b,(0,r._)`${a}[${R}]`),c.if(y,(0,r._)`continue`),_.length>1&&c.if((0,r._)`typeof ${b} == "string"`,(0,r._)`${b} += "_"`),c.if((0,r._)`typeof ${E}[${b}] == "number"`,()=>{c.assign(w,(0,r._)`${E}[${b}]`),i.error(),c.assign(m,!1).break()}).code((0,r._)`${E}[${b}] = ${R}`)})}function S(R,w){let b=(0,o.useFunc)(c,n.default),y=c.name("outer");c.label(y).for((0,r._)`;${R}--;`,()=>c.for((0,r._)`${w} = ${R}; ${w}--;`,()=>c.if((0,r._)`${b}(${a}[${R}], ${a}[${w}])`,()=>{i.error(),c.assign(m,!1).break(y)})))}}};e.default=s})),S0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=id(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:s})=>(0,t._)`{allowedValue: ${s}}`},code(s){let{gen:i,data:c,$data:a,schemaCode:u,schema:d}=s;a||d&&typeof d=="object"?s.fail$data((0,t._)`!${(0,r.useFunc)(i,o.default)}(${c}, ${u})`):s.fail((0,t._)`${d} !== ${c}`)}};e.default=n})),y0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=id(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:s})=>(0,t._)`{allowedValues: ${s}}`},code(s){let{gen:i,data:c,$data:a,schema:u,schemaCode:d,it:p}=s;if(!a&&u.length===0)throw new Error("enum must have non-empty array");let g=u.length>=p.opts.loopEnum,v,m=()=>v??(v=(0,r.useFunc)(i,o.default)),_;if(g||a)_=i.let("valid"),s.block$data(_,h);else{if(!Array.isArray(u))throw new Error("ajv implementation error");let z=i.const("vSchema",d);_=(0,t.or)(...u.map((S,R)=>f(z,R)))}s.pass(_);function h(){i.assign(_,!1),i.forOf("v",d,z=>i.if((0,t._)`${m()}(${c}, ${z})`,()=>i.assign(_,!0).break()))}function f(z,S){let R=u[S];return typeof R=="object"&&R!==null?(0,t._)`${m()}(${c}, ${z}[${S}])`:(0,t._)`${c} === ${R}`}}};e.default=n})),I_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=u0(),r=l0(),o=p0(),n=m0(),s=f0(),i=h0(),c=g0(),a=_0(),u=S0(),d=y0(),p=[t.default,r.default,o.default,n.default,s.default,i.default,c.default,a.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},u.default,d.default];e.default=p})),O_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=le(),r=_e(),o={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:s}})=>(0,t.str)`must NOT have more than ${s} items`,params:({params:{len:s}})=>(0,t._)`{limit: ${s}}`},code(s){let{parentSchema:i,it:c}=s,{items:a}=i;if(!Array.isArray(a)){(0,r.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}n(s,a)}};function n(s,i){let{gen:c,schema:a,data:u,keyword:d,it:p}=s;p.items=!0;let g=c.const("len",(0,t._)`${u}.length`);if(a===!1)s.setParams({len:i.length}),s.pass((0,t._)`${g} <= ${i.length}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(p,a)){let m=c.var("valid",(0,t._)`${g} <= ${i.length}`);c.if((0,t.not)(m),()=>v(m)),s.ok(m)}function v(m){c.forRange("i",i.length,g,_=>{s.subschema({keyword:d,dataProp:_,dataPropType:r.Type.Num},m),p.allErrors||c.if((0,t.not)(m),()=>c.break())})}}e.validateAdditionalItems=n,e.default=o})),x_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=le(),r=_e(),o=mt(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(i){let{schema:c,it:a}=i;if(Array.isArray(c))return s(i,"additionalItems",c);a.items=!0,!(0,r.alwaysValidSchema)(a,c)&&i.ok((0,o.validateArray)(i))}};function s(i,c,a=i.schema){let{gen:u,parentSchema:d,data:p,keyword:g,it:v}=i;h(d),v.opts.unevaluated&&a.length&&v.items!==!0&&(v.items=r.mergeEvaluated.items(u,a.length,v.items));let m=u.name("valid"),_=u.const("len",(0,t._)`${p}.length`);a.forEach((f,z)=>{(0,r.alwaysValidSchema)(v,f)||(u.if((0,t._)`${_} > ${z}`,()=>i.subschema({keyword:g,schemaProp:z,dataProp:z},m)),i.ok(m))});function h(f){let{opts:z,errSchemaPath:S}=v,R=a.length,w=R===f.minItems&&(R===f.maxItems||f[c]===!1);if(z.strictTuples&&!w){let b=`"${g}" is ${R}-tuple, but minItems or maxItems/${c} are not specified or different at path "${S}"`;(0,r.checkStrictMode)(v,b,z.strictTuples)}}}e.validateTuple=s,e.default=n})),v0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=x_(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:o=>(0,t.validateTuple)(o,"items")};e.default=r})),b0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=mt(),n=O_(),s={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){let{schema:c,parentSchema:a,it:u}=i,{prefixItems:d}=a;u.items=!0,!(0,r.alwaysValidSchema)(u,c)&&(d?(0,n.validateAdditionalItems)(i,d):i.ok((0,o.validateArray)(i)))}};e.default=s})),z0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:n,max:s}})=>s===void 0?(0,t.str)`must contain at least ${n} valid item(s)`:(0,t.str)`must contain at least ${n} and no more than ${s} valid item(s)`,params:({params:{min:n,max:s}})=>s===void 0?(0,t._)`{minContains: ${n}}`:(0,t._)`{minContains: ${n}, maxContains: ${s}}`},code(n){let{gen:s,schema:i,parentSchema:c,data:a,it:u}=n,d,p,{minContains:g,maxContains:v}=c;u.opts.next?(d=g===void 0?1:g,p=v):d=1;let m=s.const("len",(0,t._)`${a}.length`);if(n.setParams({min:d,max:p}),p===void 0&&d===0){(0,r.checkStrictMode)(u,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(p!==void 0&&d>p){(0,r.checkStrictMode)(u,'"minContains" > "maxContains" is always invalid'),n.fail();return}if((0,r.alwaysValidSchema)(u,i)){let S=(0,t._)`${m} >= ${d}`;p!==void 0&&(S=(0,t._)`${S} && ${m} <= ${p}`),n.pass(S);return}u.items=!0;let _=s.name("valid");p===void 0&&d===1?f(_,()=>s.if(_,()=>s.break())):d===0?(s.let(_,!0),p!==void 0&&s.if((0,t._)`${a}.length > 0`,h)):(s.let(_,!1),h()),n.result(_,()=>n.reset());function h(){let S=s.name("_valid"),R=s.let("count",0);f(S,()=>s.if(S,()=>z(R)))}function f(S,R){s.forRange("i",0,m,w=>{n.subschema({keyword:"contains",dataProp:w,dataPropType:r.Type.Num,compositeRule:!0},S),R()})}function z(S){s.code((0,t._)`${S}++`),p===void 0?s.if((0,t._)`${S} >= ${d}`,()=>s.assign(_,!0).break()):(s.if((0,t._)`${S} > ${p}`,()=>s.assign(_,!1).break()),d===1?s.assign(_,!0):s.if((0,t._)`${S} >= ${d}`,()=>s.assign(_,!0)))}}};e.default=o})),ad=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=le(),r=_e(),o=mt();e.error={message:({params:{property:a,depsCount:u,deps:d}})=>{let p=u===1?"property":"properties";return(0,t.str)`must have ${p} ${d} when property ${a} is present`},params:({params:{property:a,depsCount:u,deps:d,missingProperty:p}})=>(0,t._)`{property: ${a},
|
|
66
66
|
missingProperty: ${p},
|
|
67
67
|
depsCount: ${u},
|
|
68
|
-
deps: ${d}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(a){let[u,d]=s(a);i(a,u),c(a,d)}};function s({schema:a}){let u={},d={};for(let p in a){if(p==="__proto__")continue;let _=Array.isArray(a[p])?u:d;_[p]=a[p]}return[u,d]}function i(a,u=a.schema){let{gen:d,data:p,it:_}=a;if(Object.keys(u).length===0)return;let y=d.let("missing");for(let m in u){let g=u[m];if(g.length===0)continue;let h=(0,o.propertyInData)(d,p,m,_.opts.ownProperties);a.setParams({property:m,depsCount:g.length,deps:g.join(", ")}),_.allErrors?d.if(h,()=>{for(let f of g)(0,o.checkReportMissingProp)(a,f)}):(d.if((0,t._)`${h} && (${(0,o.checkMissingProp)(a,g,y)})`),(0,o.reportMissingProp)(a,y),d.else())}}e.validatePropertyDeps=i;function c(a,u=a.schema){let{gen:d,data:p,keyword:_,it:y}=a,m=d.name("valid");for(let g in u)(0,r.alwaysValidSchema)(y,u[g])||(d.if((0,o.propertyInData)(d,p,g,y.opts.ownProperties),()=>{let h=a.subschema({keyword:_,schemaProp:g},m);a.mergeValidEvaluated(h,m)},()=>d.var(m,!0)),a.ok(m))}e.validateSchemaDeps=c,e.default=n})),_0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:n})=>(0,t._)`{propertyName: ${n.propertyName}}`},code(n){let{gen:s,schema:i,data:c,it:a}=n;if((0,r.alwaysValidSchema)(a,i))return;let u=s.name("valid");s.forIn("key",c,d=>{n.setParams({propertyName:d}),n.subschema({keyword:"propertyNames",data:d,dataTypes:["string"],propertyName:d,compositeRule:!0},u),s.if((0,t.not)(u),()=>{n.error(!0),a.allErrors||s.break()})}),n.ok(u)}};e.default=o})),k_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=le(),o=pt(),n=_e(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,r._)`{additionalProperty: ${i.additionalProperty}}`},code(i){let{gen:c,schema:a,parentSchema:u,data:d,errsCount:p,it:_}=i;if(!p)throw new Error("ajv implementation error");let{allErrors:y,opts:m}=_;if(_.props=!0,m.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(_,a))return;let g=(0,t.allSchemaProperties)(u.properties),h=(0,t.allSchemaProperties)(u.patternProperties);f(),i.ok((0,r._)`${p} === ${o.default.errors}`);function f(){c.forIn("key",d,b=>{!g.length&&!h.length?R(b):c.if(z(b),()=>R(b))})}function z(b){let S;if(g.length>8){let E=(0,n.schemaRefOrVal)(_,u.properties,"properties");S=(0,t.isOwnProperty)(c,E,b)}else g.length?S=(0,r.or)(...g.map(E=>(0,r._)`${b} === ${E}`)):S=r.nil;return h.length&&(S=(0,r.or)(S,...h.map(E=>(0,r._)`${(0,t.usePattern)(i,E)}.test(${b})`))),(0,r.not)(S)}function v(b){c.code((0,r._)`delete ${d}[${b}]`)}function R(b){if(m.removeAdditional==="all"||m.removeAdditional&&a===!1){v(b);return}if(a===!1){i.setParams({additionalProperty:b}),i.error(),y||c.break();return}if(typeof a=="object"&&!(0,n.alwaysValidSchema)(_,a)){let S=c.name("valid");m.removeAdditional==="failing"?(w(b,S,!1),c.if((0,r.not)(S),()=>{i.reset(),v(b)})):(w(b,S),y||c.if((0,r.not)(S),()=>c.break()))}}function w(b,S,E){let N={keyword:"additionalProperties",dataProp:b,dataPropType:n.Type.Str};E===!1&&Object.assign(N,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(N,S)}}};e.default=s})),S0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=co(),r=mt(),o=_e(),n=k_(),s={keyword:"properties",type:"object",schemaType:"object",code(i){let{gen:c,schema:a,parentSchema:u,data:d,it:p}=i;p.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(p,n.default,"additionalProperties"));let _=(0,r.allSchemaProperties)(a);for(let f of _)p.definedProperties.add(f);p.opts.unevaluated&&_.length&&p.props!==!0&&(p.props=o.mergeEvaluated.props(c,(0,o.toHash)(_),p.props));let y=_.filter(f=>!(0,o.alwaysValidSchema)(p,a[f]));if(y.length===0)return;let m=c.name("valid");for(let f of y)g(f)?h(f):(c.if((0,r.propertyInData)(c,d,f,p.opts.ownProperties)),h(f),p.allErrors||c.else().var(m,!0),c.endIf()),i.it.definedProperties.add(f),i.ok(m);function g(f){return p.opts.useDefaults&&!p.compositeRule&&a[f].default!==void 0}function h(f){i.subschema({keyword:"properties",schemaProp:f,dataProp:f},m)}}};e.default=s})),y0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=le(),o=_e(),n=_e(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:c,schema:a,data:u,parentSchema:d,it:p}=i,{opts:_}=p,y=(0,t.allSchemaProperties)(a),m=y.filter(w=>(0,o.alwaysValidSchema)(p,a[w]));if(y.length===0||m.length===y.length&&(!p.opts.unevaluated||p.props===!0))return;let g=_.strictSchema&&!_.allowMatchingProperties&&d.properties,h=c.name("valid");p.props!==!0&&!(p.props instanceof r.Name)&&(p.props=(0,n.evaluatedPropsToName)(c,p.props));let{props:f}=p;z();function z(){for(let w of y)g&&v(w),p.allErrors?R(w):(c.var(h,!0),R(w),c.if(h))}function v(w){for(let b in g)new RegExp(w).test(b)&&(0,o.checkStrictMode)(p,`property ${b} matches pattern ${w} (use allowMatchingProperties)`)}function R(w){c.forIn("key",u,b=>{c.if((0,r._)`${(0,t.usePattern)(i,w)}.test(${b})`,()=>{let S=m.includes(w);S||i.subschema({keyword:"patternProperties",schemaProp:w,dataProp:b,dataPropType:n.Type.Str},h),p.opts.unevaluated&&f!==!0?c.assign((0,r._)`${f}[${b}]`,!0):!S&&!p.allErrors&&c.if((0,r.not)(h),()=>c.break())})})}}};e.default=s})),v0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){let{gen:n,schema:s,it:i}=o;if((0,t.alwaysValidSchema)(i,s)){o.fail();return}let c=n.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},c),o.failResult(c,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};e.default=r})),b0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:mt().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t})),z0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:n})=>(0,t._)`{passingSchemas: ${n.passing}}`},code(n){let{gen:s,schema:i,parentSchema:c,it:a}=n;if(!Array.isArray(i))throw new Error("ajv implementation error");if(a.opts.discriminator&&c.discriminator)return;let u=i,d=s.let("valid",!1),p=s.let("passing",null),_=s.name("_valid");n.setParams({passing:p}),s.block(y),n.result(d,()=>n.reset(),()=>n.error(!0));function y(){u.forEach((m,g)=>{let h;(0,r.alwaysValidSchema)(a,m)?s.var(_,!0):h=n.subschema({keyword:"oneOf",schemaProp:g,compositeRule:!0},_),g>0&&s.if((0,t._)`${_} && ${d}`).assign(d,!1).assign(p,(0,t._)`[${p}, ${g}]`).else(),s.if(_,()=>{s.assign(d,!0),s.assign(p,g),h&&n.mergeEvaluated(h,t.Name)})})}}};e.default=o})),R0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:"allOf",schemaType:"array",code(o){let{gen:n,schema:s,it:i}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");let c=n.name("valid");s.forEach((a,u)=>{if((0,t.alwaysValidSchema)(i,a))return;let d=o.subschema({keyword:"allOf",schemaProp:u},c);o.ok(c),o.mergeEvaluated(d)})}};e.default=r})),$0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,t.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,t._)`{failingKeyword: ${s.ifClause}}`},code(s){let{gen:i,parentSchema:c,it:a}=s;c.then===void 0&&c.else===void 0&&(0,r.checkStrictMode)(a,'"if" without "then" and "else" is ignored');let u=n(a,"then"),d=n(a,"else");if(!u&&!d)return;let p=i.let("valid",!0),_=i.name("_valid");if(y(),s.reset(),u&&d){let g=i.let("ifClause");s.setParams({ifClause:g}),i.if(_,m("then",g),m("else",g))}else u?i.if(_,m("then")):i.if((0,t.not)(_),m("else"));s.pass(p,()=>s.error(!0));function y(){let g=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},_);s.mergeEvaluated(g)}function m(g,h){return()=>{let f=s.subschema({keyword:g},_);i.assign(p,_),s.mergeValidEvaluated(f,p),h?i.assign(h,(0,t._)`${g}`):s.setParams({ifClause:g})}}}};function n(s,i){let c=s.schema[i];return c!==void 0&&!(0,r.alwaysValidSchema)(s,c)}e.default=o})),w0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:n,it:s}){n.if===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "if" is ignored`)}};e.default=r})),I_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=T_(),r=f0(),o=C_(),n=h0(),s=g0(),i=ad(),c=_0(),a=k_(),u=S0(),d=y0(),p=v0(),_=b0(),y=z0(),m=R0(),g=$0(),h=w0();function f(z=!1){let v=[p.default,_.default,y.default,m.default,g.default,h.default,c.default,a.default,i.default,u.default,d.default];return z?v.push(r.default,n.default):v.push(t.default,o.default),v.push(s.default),v}e.default=f})),P0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,t._)`{format: ${o}}`},code(o,n){let{gen:s,data:i,$data:c,schema:a,schemaCode:u,it:d}=o,{opts:p,errSchemaPath:_,schemaEnv:y,self:m}=d;if(!p.validateFormats)return;c?g():h();function g(){let f=s.scopeValue("formats",{ref:m.formats,code:p.code.formats}),z=s.const("fDef",(0,t._)`${f}[${u}]`),v=s.let("fType"),R=s.let("format");s.if((0,t._)`typeof ${z} == "object" && !(${z} instanceof RegExp)`,()=>s.assign(v,(0,t._)`${z}.type || "string"`).assign(R,(0,t._)`${z}.validate`),()=>s.assign(v,(0,t._)`"string"`).assign(R,z)),o.fail$data((0,t.or)(w(),b()));function w(){return p.strictSchema===!1?t.nil:(0,t._)`${u} && !${R}`}function b(){let S=y.$async?(0,t._)`(${z}.async ? await ${R}(${i}) : ${R}(${i}))`:(0,t._)`${R}(${i})`,E=(0,t._)`(typeof ${R} == "function" ? ${S} : ${R}.test(${i}))`;return(0,t._)`${R} && ${R} !== true && ${v} === ${n} && !${E}`}}function h(){let f=m.formats[a];if(!f){w();return}if(f===!0)return;let[z,v,R]=b(f);z===n&&o.pass(S());function w(){if(p.strictSchema===!1){m.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${a}" ignored in schema at path "${_}"`}}function b(E){let N=E instanceof RegExp?(0,t.regexpCode)(E):p.code.formats?(0,t._)`${p.code.formats}${(0,t.getProperty)(a)}`:void 0,V=s.scopeValue("formats",{key:a,ref:E,code:N});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,t._)`${V}.validate`]:["string",E,V]}function S(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!y.$async)throw new Error("async format in sync schema");return(0,t._)`await ${R}(${i})`}return typeof v=="function"?(0,t._)`${R}(${i})`:(0,t._)`${R}.test(${i})`}}}};e.default=r})),O_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[P0().default];e.default=t})),x_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]})),N_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=P_(),r=E_(),o=I_(),n=O_(),s=x_(),i=[t.default,r.default,(0,o.default)(),n.default,s.metadataVocabulary,s.contentVocabulary];e.default=i})),E0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))})),cd=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=E0(),o=ic(),n=uo(),s=_e(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:a}})=>c===r.DiscrError.Tag?`tag "${a}" must be string`:`value of tag "${a}" must be in oneOf`,params:({params:{discrError:c,tag:a,tagName:u}})=>(0,t._)`{error: ${c}, tag: ${u}, tagValue: ${a}}`},code(c){let{gen:a,data:u,schema:d,parentSchema:p,it:_}=c,{oneOf:y}=p;if(!_.opts.discriminator)throw new Error("discriminator: requires discriminator option");let m=d.propertyName;if(typeof m!="string")throw new Error("discriminator: requires propertyName");if(d.mapping)throw new Error("discriminator: mapping is not supported");if(!y)throw new Error("discriminator: requires oneOf keyword");let g=a.let("valid",!1),h=a.const("tag",(0,t._)`${u}${(0,t.getProperty)(m)}`);a.if((0,t._)`typeof ${h} == "string"`,()=>f(),()=>c.error(!1,{discrError:r.DiscrError.Tag,tag:h,tagName:m})),c.ok(g);function f(){let R=v();a.if(!1);for(let w in R)a.elseIf((0,t._)`${h} === ${w}`),a.assign(g,z(R[w]));a.else(),c.error(!1,{discrError:r.DiscrError.Mapping,tag:h,tagName:m}),a.endIf()}function z(R){let w=a.name("valid"),b=c.subschema({keyword:"oneOf",schemaProp:R},w);return c.mergeEvaluated(b,t.Name),w}function v(){var R;let w={},b=E(p),S=!0;for(let M=0;M<y.length;M++){let Z=y[M];if(Z?.$ref&&!(0,s.schemaHasRulesButRef)(Z,_.self.RULES)){let G=Z.$ref;if(Z=o.resolveRef.call(_.self,_.schemaEnv.root,_.baseId,G),Z instanceof o.SchemaEnv&&(Z=Z.schema),Z===void 0)throw new n.default(_.opts.uriResolver,_.baseId,G)}let W=(R=Z?.properties)===null||R===void 0?void 0:R[m];if(typeof W!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${m}"`);S=S&&(b||E(Z)),N(W,M)}if(!S)throw new Error(`discriminator: "${m}" must be required`);return w;function E({required:M}){return Array.isArray(M)&&M.includes(m)}function N(M,Z){if(M.const)V(M.const,Z);else if(M.enum)for(let W of M.enum)V(W,Z);else throw new Error(`discriminator: "properties/${m}" must have "const" or "enum"`)}function V(M,Z){if(typeof M!="string"||M in w)throw new Error(`discriminator: "${m}" values must be unique strings`);w[M]=Z}}}};e.default=i})),T0=U(((e,t)=>{t.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}})),j_=U(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=nd(),o=N_(),n=cd(),s=T0(),i=["/properties"],c="http://json-schema.org/draft-07/schema";var a=class extends r.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(y=>this.addVocabulary(y)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let y=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(y,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=a,t.exports=e=a,t.exports.Ajv=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var u=co();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=le();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=Vn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var _=uo();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return _.default}})})),A_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=le(),r=pt(),o=ic(),n=sd(),s={keyword:"$dynamicAnchor",schemaType:"string",code:a=>i(a,a.schema)};function i(a,u){let{gen:d,it:p}=a;p.schemaEnv.root.dynamicAnchors[u]=!0;let _=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,y=p.errSchemaPath==="#"?p.validateName:c(a);d.if((0,t._)`!${_}`,()=>d.assign(_,y))}e.dynamicAnchor=i;function c(a){let{schemaEnv:u,schema:d,self:p}=a.it,{root:_,baseId:y,localRefs:m,meta:g}=u.root,{schemaId:h}=p.opts,f=new o.SchemaEnv({schema:d,schemaId:h,root:_,baseId:y,localRefs:m,meta:g});return o.compileSchema.call(p,f),(0,n.getValidate)(a,f)}e.default=s})),q_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=le(),r=pt(),o=sd(),n={keyword:"$dynamicRef",schemaType:"string",code:i=>s(i,i.schema)};function s(i,c){let{gen:a,keyword:u,it:d}=i;if(c[0]!=="#")throw new Error(`"${u}" only supports hash fragment reference`);let p=c.slice(1);if(d.allErrors)_();else{let m=a.let("valid",!1);_(m),i.ok(m)}function _(m){if(d.schemaEnv.root.dynamicAnchors[p]){let g=a.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(p)}`);a.if(g,y(g,m),y(d.validateName,m))}else y(d.validateName,m)()}function y(m,g){return g?()=>a.block(()=>{(0,o.callRef)(i,m),a.let(g,!0)}):()=>(0,o.callRef)(i,m)}}e.dynamicRef=s,e.default=n})),C0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=A_(),r=_e(),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){n.schema?(0,t.dynamicAnchor)(n,""):(0,r.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};e.default=o})),k0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=q_(),r={keyword:"$recursiveRef",schemaType:"string",code:o=>(0,t.dynamicRef)(o,o.schema)};e.default=r})),M_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=A_(),r=q_(),o=C0(),n=k0(),s=[t.default,r.default,o.default,n.default];e.default=s})),I0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ad(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:o=>(0,t.validatePropertyDeps)(o)};e.default=r})),O0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ad(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:o=>(0,t.validateSchemaDeps)(o)};e.default=r})),x0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:o,parentSchema:n,it:s}){n.contains===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "contains" is ignored`)}};e.default=r})),L_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=I0(),r=O0(),o=x0(),n=[t.default,r.default,o.default];e.default=n})),N0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=pt(),n={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>(0,t._)`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){let{gen:i,schema:c,data:a,errsCount:u,it:d}=s;if(!u)throw new Error("ajv implementation error");let{allErrors:p,props:_}=d;_ instanceof t.Name?i.if((0,t._)`${_} !== true`,()=>i.forIn("key",a,h=>i.if(m(_,h),()=>y(h)))):_!==!0&&i.forIn("key",a,h=>_===void 0?y(h):i.if(g(_,h),()=>y(h))),d.props=!0,s.ok((0,t._)`${u} === ${o.default.errors}`);function y(h){if(c===!1){s.setParams({unevaluatedProperty:h}),s.error(),p||i.break();return}if(!(0,r.alwaysValidSchema)(d,c)){let f=i.name("valid");s.subschema({keyword:"unevaluatedProperties",dataProp:h,dataPropType:r.Type.Str},f),p||i.if((0,t.not)(f),()=>i.break())}}function m(h,f){return(0,t._)`!${h} || !${h}[${f}]`}function g(h,f){let z=[];for(let v in h)h[v]===!0&&z.push((0,t._)`${f} !== ${v}`);return(0,t.and)(...z)}}};e.default=n})),j0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:n}})=>(0,t.str)`must NOT have more than ${n} items`,params:({params:{len:n}})=>(0,t._)`{limit: ${n}}`},code(n){let{gen:s,schema:i,data:c,it:a}=n,u=a.items||0;if(u===!0)return;let d=s.const("len",(0,t._)`${c}.length`);if(i===!1)n.setParams({len:u}),n.fail((0,t._)`${d} > ${u}`);else if(typeof i=="object"&&!(0,r.alwaysValidSchema)(a,i)){let _=s.var("valid",(0,t._)`${d} <= ${u}`);s.if((0,t.not)(_),()=>p(_,u)),n.ok(_)}a.items=!0;function p(_,y){s.forRange("i",y,d,m=>{n.subschema({keyword:"unevaluatedItems",dataProp:m,dataPropType:r.Type.Num},_),a.allErrors||s.if((0,t.not)(_),()=>s.break())})}}};e.default=o})),D_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=N0(),r=j0(),o=[t.default,r.default];e.default=o})),A0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}})),q0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}})),M0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}})),L0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}})),D0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}})),Z0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,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}}}})),U0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{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"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$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:[]}}}})),F0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=A0(),r=q0(),o=M0(),n=L0(),s=D0(),i=Z0(),c=U0(),a=["/properties"];function u(d){return[t,r,o,n,p(this,s),i,p(this,c)].forEach(_=>this.addMetaSchema(_,void 0,!1)),this;function p(_,y){return d?_.$dataMetaSchema(y,a):y}}e.default=u})),V0=U(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=nd(),o=N_(),n=M_(),s=L_(),i=D_(),c=cd(),a=F0(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends r.default{constructor(g={}){super({...g,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(n.default),o.default.forEach(g=>this.addVocabulary(g)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator&&this.addKeyword(c.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:g,meta:h}=this.opts;h&&(a.default.call(this,g),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=d,t.exports=e=d,t.exports.Ajv2019=d,Object.defineProperty(e,"__esModule",{value:!0}),e.default=d;var p=co();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var _=le();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return _._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return _.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return _.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return _.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return _.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return _.CodeGen}});var y=Vn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return y.default}});var m=uo();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})})),H0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=P_(),r=E_(),o=I_(),n=M_(),s=L_(),i=D_(),c=O_(),a=x_(),u=[n.default,t.default,r.default,(0,o.default)(!0),c.default,a.metadataVocabulary,a.contentVocabulary,s.default,i.default];e.default=u})),J0=U(((e,t)=>{t.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}}}})),B0=U(((e,t)=>{t.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"}}}}})),K0=U(((e,t)=>{t.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"}}}})),G0=U(((e,t)=>{t.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"}}}})),W0=U(((e,t)=>{t.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"}}}})),Y0=U(((e,t)=>{t.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"}}}})),X0=U(((e,t)=>{t.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}}}})),Q0=U(((e,t)=>{t.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:[]}}}})),eR=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=J0(),r=B0(),o=K0(),n=G0(),s=W0(),i=Y0(),c=X0(),a=Q0(),u=["/properties"];function d(p){return[t,r,o,n,s,_(this,i),c,_(this,a)].forEach(y=>this.addMetaSchema(y,void 0,!1)),this;function _(y,m){return p?y.$dataMetaSchema(m,u):m}}e.default=d})),tR=U(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=nd(),o=H0(),n=cd(),s=eR(),i="https://json-schema.org/draft/2020-12/schema";var c=class extends r.default{constructor(_={}){super({..._,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(_=>this.addVocabulary(_)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:_,meta:y}=this.opts;y&&(s.default.call(this,_),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=c,t.exports=e=c,t.exports.Ajv2020=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var a=co();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var u=le();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=Vn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=uo();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),rR=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(M,Z){return{validate:M,compare:Z}}e.fullFormats={date:t(s,i),time:t(a(!0),u),"date-time":t(_(!0),y),"iso-time":t(a(),d),"iso-date-time":t(_(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:f,"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:V,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:v,int32:{type:"number",validate:b},int64:{type:"number",validate:S},float:{type:"number",validate:E},double:{type:"number",validate:E},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\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,y),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d),"iso-date-time":t(/^\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,m),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},e.formatNames=Object.keys(e.fullFormats);function r(M){return M%4===0&&(M%100!==0||M%400===0)}let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(M){let Z=o.exec(M);if(!Z)return!1;let W=+Z[1],G=+Z[2],fe=+Z[3];return G>=1&&G<=12&&fe>=1&&fe<=(G===2&&r(W)?29:n[G])}function i(M,Z){if(M&&Z)return M>Z?1:M<Z?-1:0}let c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function a(M){return function(W){let G=c.exec(W);if(!G)return!1;let fe=+G[1],$e=+G[2],be=+G[3],Oe=G[4],he=G[5]==="-"?-1:1,k=+(G[6]||0),j=+(G[7]||0);if(k>23||j>59||M&&!Oe)return!1;if(fe<=23&&$e<=59&&be<60)return!0;let F=$e-j*he,$=fe-k*he-(F<0?1:0);return($===23||$===-1)&&(F===59||F===-1)&&be<61}}function u(M,Z){if(!(M&&Z))return;let W=new Date("2020-01-01T"+M).valueOf(),G=new Date("2020-01-01T"+Z).valueOf();if(W&&G)return W-G}function d(M,Z){if(!(M&&Z))return;let W=c.exec(M),G=c.exec(Z);if(W&&G)return M=W[1]+W[2]+W[3],Z=G[1]+G[2]+G[3],M>Z?1:M<Z?-1:0}let p=/t|\s/i;function _(M){let Z=a(M);return function(G){let fe=G.split(p);return fe.length===2&&s(fe[0])&&Z(fe[1])}}function y(M,Z){if(!(M&&Z))return;let W=new Date(M).valueOf(),G=new Date(Z).valueOf();if(W&&G)return W-G}function m(M,Z){if(!(M&&Z))return;let[W,G]=M.split(p),[fe,$e]=Z.split(p),be=i(W,fe);if(be!==void 0)return be||u(G,$e)}let g=/\/|:/,h=/^(?:[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 f(M){return g.test(M)&&h.test(M)}let z=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function v(M){return z.lastIndex=0,z.test(M)}let R=-(2**31),w=2**31-1;function b(M){return Number.isInteger(M)&&M<=w&&M>=R}function S(M){return Number.isInteger(M)}function E(){return!0}let N=/[^\\]\\Z/;function V(M){if(N.test(M))return!1;try{return new RegExp(M),!0}catch{return!1}}})),oR=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=j_(),r=le(),o=r.operators,n={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},s={message:({keyword:c,schemaCode:a})=>(0,r.str)`should be ${n[c].okStr} ${a}`,params:({keyword:c,schemaCode:a})=>(0,r._)`{comparison: ${n[c].okStr}, limit: ${a}}`};e.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:s,code(c){let{gen:a,data:u,schemaCode:d,keyword:p,it:_}=c,{opts:y,self:m}=_;if(!y.validateFormats)return;let g=new t.KeywordCxt(_,m.RULES.all.format.definition,"format");g.$data?h():f();function h(){let v=a.scopeValue("formats",{ref:m.formats,code:y.code.formats}),R=a.const("fmt",(0,r._)`${v}[${g.schemaCode}]`);c.fail$data((0,r.or)((0,r._)`typeof ${R} != "object"`,(0,r._)`${R} instanceof RegExp`,(0,r._)`typeof ${R}.compare != "function"`,z(R)))}function f(){let v=g.schema,R=m.formats[v];if(!R||R===!0)return;if(typeof R!="object"||R instanceof RegExp||typeof R.compare!="function")throw new Error(`"${p}": format "${v}" does not define "compare" function`);let w=a.scopeValue("formats",{key:v,ref:R,code:y.code.formats?(0,r._)`${y.code.formats}${(0,r.getProperty)(v)}`:void 0});c.fail$data(z(w))}function z(v){return(0,r._)`${v}.compare(${u}, ${d}) ${n[p].fail} 0`}},dependencies:["format"]};let i=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=i})),nR=U(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=rR(),o=oR(),n=le(),s=new n.Name("fullFormats"),i=new n.Name("fastFormats"),c=(u,d={keywords:!0})=>{if(Array.isArray(d))return a(u,d,r.fullFormats,s),u;let[p,_]=d.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,s];return a(u,d.formats||r.formatNames,p,_),d.keywords&&(0,o.default)(u),u};c.get=(u,d="full")=>{let p=(d==="fast"?r.fastFormats:r.fullFormats)[u];if(!p)throw new Error(`Unknown format "${u}"`);return p};function a(u,d,p,_){var y,m;(y=(m=u.opts.code).formats)!==null&&y!==void 0||(m.formats=(0,n._)`require("ajv-formats/dist/formats").${_}`);for(let g of d)u.addFormat(g,p[g])}t.exports=e=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c})),Z_=j_(),sR=V0(),iR=tR(),aR=fs(nR(),1),cR=aR.default;function od(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return cR(t),t}var ac=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=od(iR.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=Xd(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return t==="2020-12"?this.ajv:t==="2019-09"?this._ajv2019??=od(sR.Ajv2019):this._ajvDraft7??=od(Z_.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},AP=Z_.Ajv;import ud from"node:process";var G_=Symbol.for("mcp.completable");function dd(e){return!!e&&typeof e=="object"&&G_ in e}function dR(e){return e[G_]?.complete}var EE=2**31-1;function pR(e){return typeof e=="object"&&e!==null&&"setScopeChallengeResolver"in e&&typeof e.setScopeChallengeResolver=="function"}var mR=8,fR=6e5;function hR(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw new RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw new RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??mR,roundTimeoutMs:e?.roundTimeoutMs??fR,legacyShim:e?.legacyShim??!0}}function W_(e,t,r){if(r===null||typeof r!="object"||typeof r.method!="string")throw new ne(B.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let o=r,n=Hg(o);if(n===void 0)throw new ne(B.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${o.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:o,required:n}}function gR(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map(o=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function ld(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new ne(B.InternalError,t)}var _R=class{constructor(e){this._host=e}async fulfill(e,t,r,o,n){let{maxRounds:s,roundTimeoutMs:i}=this._host,c=o.mcpReq.signal,a=n,u=0;for(;;){if(u+=1,u>s)return ld(e,p_(e,s));let d=a.inputRequests,p=d!=null&&Object.keys(d).length>0,_=typeof a.requestState=="string"?a.requestState:void 0;if(!p&&_===void 0)throw new ne(B.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let y;if(p){let h=this._host.resolvedClientCapabilities(o),f=[];for(let[v,R]of Object.entries(d)){let{embedded:w,required:b}=W_(e,v,R);if(w.method!=="roots/list"&&w.params===void 0)throw new ne(B.InternalError,`Handler for ${e} returned an input request '${v}' of kind '${w.method}' without params`);if(Ga(b,h)!==void 0)return ld(e,`Cannot request input '${v}' (${w.method}): the client on this 2025-era connection did not declare the required capability${h===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);f.push([v,w])}let z=f_(c);try{let v={relatedRequestId:o.mcpReq.id,timeout:i,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:z.signal},R=await Promise.all(f.map(async([w,b])=>{try{return[w,await this._dispatchLeg(b,v)]}catch(S){throw z.abort(S),S}}));y=Object.fromEntries(R)}catch(v){if(c.aborted)throw v;return ld(e,`Fulfilling input required by '${e}' failed: ${v instanceof Error?v.message:String(v)}`)}finally{z.dispose()}}else await m_(d_,c);let m={...o,mcpReq:{...o.mcpReq,inputResponses:y,droppedInputResponseKeys:void 0,requestState:Fn(_)}};if(_!==void 0){let h=await this._host.verifyRequestState(_,m,e);h!==void 0&&(m=Yl(m,h))}let g=await t(r,m);if(!kt(g))return g;a=g}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return r.mode==="url"&&r.elicitationId===void 0&&(r={...r,elicitationId:gR()}),await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},SR=new Set(["tools/call","prompts/get","resources/read"]),yR,vR,bR;var Y_=class extends Xl{_clientCapabilities;_clientVersion;static{yR=(e,t)=>{t.clientCapabilities!==void 0&&(e._clientCapabilities=t.clientCapabilities),t.clientInfo!==void 0&&(e._clientVersion=t.clientInfo)},vR=(e,t)=>{let r=t.filter(o=>!e._supportedProtocolVersions.includes(o));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},bR=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new _R({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new ac,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=hR(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,o]of Object.entries(t.cacheHints))o!==void 0&&Ll(o,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",r=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),xl(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}async connect(e){if(this.transport!==void 0)throw new ue(me.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");await super.connect(e)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:o}=e.params,n=Qa(Kt,o);return n.success&&this._loggingLevels.set(r,n.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(o,n,s)=>{if(!this._capabilities.logging)return Promise.resolve();let i;if(this._servedModernEra()){if(i=e.mcpReq.envelope?.[Ut],i===void 0)return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return i!==void 0&&this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:o,data:n,logger:s}})},elicitInput:(o,n)=>this.elicitInput(o,n),requestSampling:(o,n)=>this.createMessage(o,n)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Kt.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r):!1};registerCapabilities(e){if(this.transport)throw new ue(me.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=Ql(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],o=SR.has(e);return r===void 0&&!o?async(n,s)=>{let i=await t(n,s);if(kt(i))throw new ne(B.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}:async(n,s)=>{let i=o?await this._invokeInputRequiredCapableHandler(e,t,n,s):await t(n,s);if(kt(i)){if(!o)throw new ne(B.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}return r===void 0?i:Wa(i,r)}}return async(r,o)=>{let n=io(this._negotiatedProtocolVersion),s=n.validateRequest("tools/call",r);if(!s.ok)throw new ne(s.reason==="not-in-era"?B.InternalError:B.InvalidParams,s.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${s.message}`);let i=await this._invokeInputRequiredCapableHandler("tools/call",t,r,o);if(kt(i))return i;let c=Nl(i),a=n.validateResult("tools/call",c);if(!a.ok)throw new ne(a.reason==="not-in-era"?B.InternalError:B.InvalidParams,a.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${a.message}`);return a.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&Un(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,o){let n=this._servedModernEra(),s=o.mcpReq.requestState();if(s!==void 0&&typeof s!="string")throw new ne(B.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let i=o;if(typeof s=="string"){let p=await this._verifyRequestState(s,o,e);p!==void 0&&(i=Yl(o,p))}let c;try{c=await t(r,i)}catch(p){throw p instanceof ne&&p.code===B.UrlElicitationRequired&&n?new ne(B.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.`):p}if(!kt(c))return c;if(!n){if(!this._inputRequiredServing.legacyShim)throw new ne(B.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??pr}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,i,c)}let a=c.inputRequests,u=a!=null&&Object.keys(a).length>0,d=typeof c.requestState=="string";if(!u&&!d)throw new ne(B.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let p=this._inputRequestCapabilityView(o);for(let[_,y]of Object.entries(a)){let{embedded:m,required:g}=W_(e,_,y),h=Ga(g,p);if(h!==void 0)throw new Xa({requiredCapabilities:h},`Cannot request input '${_}' (${m.method}): the request's client capabilities do not declare the required capability`)}}return c}async _verifyRequestState(e,t,r){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(o){throw this.onerror?.(new Error(`requestState verification rejected ${r}: ${o instanceof Error?o.message:String(o)}`)),new ne(B.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Tt]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new ue(me.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' 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:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new ue(me.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new ue(me.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new ue(me.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new ue(me.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new ue(me.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new ue(me.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new ue(me.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new ue(me.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new ue(me.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new ue(me.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new ue(me.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new ue(me.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=Jg(this._supportedProtocolVersions),o=r.includes(t)?t:r[0]??pr;return this._negotiatedProtocolVersion=o,this.transport?.setProtocolVersion?.(o),{protocolVersion:o,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:xl(this._supportedProtocolVersions),capabilities:zR(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new ue(me.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages.at(-1),i=Array.isArray(s.content)?s.content:[s.content],c=i.some(p=>p.type==="tool_result"),a=e.messages.length>1?e.messages.at(-2):void 0,u=a?Array.isArray(a.content)?a.content:[a.content]:[],d=u.some(p=>p.type==="tool_use");if(c){if(i.some(p=>p.type!=="tool_result"))throw new ne(B.InvalidParams,"The last message must contain only tool_result content if any is present");if(!d)throw new ne(B.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(d){let p=new Set(u.filter(y=>y.type==="tool_use").map(y=>y.id)),_=new Set(i.filter(y=>y.type==="tool_result").map(y=>y.toolUseId));if(p.size!==_.size||![...p].every(y=>_.has(y)))throw new ne(B.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),o=await this.request({method:"sampling/createMessage",params:e},t),n=this._wireCodec().samplingResultVariant(r,o);if(!n.ok)throw new ue(me.InvalidResult,`Invalid sampling/createMessage result: ${n.reason==="invalid"?n.message:n.reason}`);return n.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new ue(me.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let o=e.mode??"form",n=r?.validateAcceptedContent??!0;switch(o){case"url":{let s=e;return this.request({method:"elicitation/create",params:s},t)}case"form":{let s=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:s},t);if(n&&i.action==="accept"&&i.content&&s.requestedSchema)try{let c=this._jsonSchemaValidator.getValidator(s.requestedSchema)(i.content);if(!c.valid)throw new ne(B.InvalidParams,`Elicitation response content does not match requested schema: ${c.errorMessage}`)}catch(c){throw c instanceof ne?c:new ne(B.InternalError,`Error validating elicitation response: ${c instanceof Error?c.message:String(c)}`)}return i}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}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"})}};function zR(e){return{...e}}function RR(e,t){let r=0,o=[e];for(;o.length>0;){let n=o.pop();if(!(n===null||typeof n!="object"))if(Array.isArray(n))for(let s of n){if(++r>t)return r;s!==null&&typeof s=="object"&&o.push(s)}else for(let s in n){if(!Object.prototype.hasOwnProperty.call(n,s))continue;if(++r>t)return r;let i=n[s];i!==null&&typeof i=="object"&&o.push(i)}}return r}function $R(e){if(!(e===void 0||e===1/0)){if(typeof e!="number"||Number.isNaN(e)||e<1)throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(e)}`);return e}}var cc=class{server;_maxToolInputElements;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(!(t===void 0||!t.enabled)){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return F_;try{let r=_r(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}}constructor(e,t){this.server=new Y_(e,t),this._maxToolInputElements=$R(t?.maxToolInputElements),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return pR(e)&&e.setScopeChallengeResolver(t=>this.resolveScopeChallenge(t)),await this.server.connect(e)}async close(){await this.server.close()}resolveScopeChallenge=e=>{switch(e.request.method){case"tools/call":{let t=e.request.params?.name;if(typeof t!="string")return;let r=this._registeredTools[t];return r===void 0||!r.enabled?void 0:r.scopeChallenge?.(e)}case"resources/read":{let t=e.request.params?.uri;if(typeof t!="string")return;let r;try{r=new URL(t)}catch{return}let o=this._registeredResources[r.toString()];if(o!==void 0)return o.enabled?o.scopeChallenge?.(e):void 0;for(let n of Object.values(this._registeredResourceTemplates))if(n.resourceTemplate.uriTemplate.match(r.toString()))return n.enabled?n.scopeChallenge?.(e):void 0;return}case"prompts/get":{let t=e.request.params?.name;if(typeof t!="string")return;let r=this._registeredPrompts[t];return r===void 0||!r.enabled?void 0:r.scopeChallenge?.(e)}default:return}};_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(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(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?wR(e,t.inputSchema):F_,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(r.outputSchema=_r(t.outputSchema,"output")),r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new ne(B.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new ne(B.InvalidParams,`Tool ${e.params.name} disabled`);try{let o=await this.validateToolInput(r,e.params.arguments,e.params.name),n=await this.executeToolHandler(r,o,t);return await this.validateToolOutput(r,n,e.params.name),kt(n)?n:this.server.projectCallToolResult(n,r.outputSchemaJson)}catch(o){if(o instanceof ne&&o.code===B.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(this._maxToolInputElements!==void 0&&RR(t,this._maxToolInputElements)>this._maxToolInputElements)throw new ne(B.InvalidParams,`Invalid arguments for tool ${r}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!e.inputSchema)return;let o=await gr(e.inputSchema,t??{});if(!o.success)throw new ne(B.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${o.error}`);return o.data}async validateToolOutput(e,t,r){if(!e.outputSchema||kt(t)||t.isError)return;if(t.structuredContent===void 0)throw new ne(B.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=await gr(e.outputSchema,t.structuredContent);if(!o.success)throw new ne(B.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${o.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async e=>{switch(e.params.ref.type){case"ref/prompt":return Bl(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Kl(e),this.handleResourceCompletion(e,e.params.ref);default:throw new ne(B.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new ne(B.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new ne(B.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Hn;let o=K_(B_(r.argsSchema)?.[e.params.argument.name]);if(!dd(o))return Hn;let n=dR(o);return n?J_(await n(e.params.argument.value,e.params.context)):Hn}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(n=>n.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Hn;throw new ne(B.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);return o?J_(await o(e.params.argument.value,e.params.context)):Hn}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(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(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,s])=>s.enabled).map(([n,s])=>({uri:n,name:s.name,...s.metadata})),o=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let s=await n.resourceTemplate.listCallback(t);for(let i of s.resources)o.push({...n.metadata,...i})}return{resources:[...r,...o]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new ne(B.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new ne(B.InvalidParams,`Resource ${r} disabled`);return Wa(await o.readCallback(r,t),o.cacheHint)}for(let n of Object.values(this._registeredResourceTemplates)){let s=n.resourceTemplate.uriTemplate.match(r.toString());if(s){if(!n.enabled)throw new ne(B.InvalidParams,`Resource template ${n.resourceTemplate.uriTemplate} disabled`);return Wa(await n.readCallback(r,s,t),n.cacheHint)}}throw new Ya(e.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(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(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?l_(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new ne(B.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new ne(B.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,r,o){let{cacheHint:n,scopeChallenge:s,...i}=r,c=i;if(n!==void 0&&Ll(n,`resource ${e}`),typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let a=this._createRegisteredResource(e,r.title,t,c,s,o);return n!==void 0&&(a.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let a=this._createRegisteredResourceTemplate(e,r.title,t,c,s,o);return n!==void 0&&(a.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}_createRegisteredResource(e,t,r,o,n,s){let i={name:e,title:t,metadata:o,readCallback:s,scopeChallenge:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:c=>{c.uri!==void 0&&c.uri!==r&&(delete this._registeredResources[r],c.uri&&(this._registeredResources[c.uri]=i)),c.name!==void 0&&(i.name=c.name),c.title!==void 0&&(i.title=c.title),c.metadata!==void 0&&(i.metadata=c.metadata),c.callback!==void 0&&(i.readCallback=c.callback),c.scopeChallenge!==void 0&&(i.scopeChallenge=c.scopeChallenge===null?void 0:c.scopeChallenge),c.enabled!==void 0&&(i.enabled=c.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,o,n,s){let i={resourceTemplate:r,title:t,metadata:o,readCallback:s,scopeChallenge:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{a.name!==void 0&&a.name!==e&&(delete this._registeredResourceTemplates[e],a.name&&(this._registeredResourceTemplates[a.name]=i)),a.title!==void 0&&(i.title=a.title),a.template!==void 0&&(i.resourceTemplate=a.template),a.metadata!==void 0&&(i.metadata=a.metadata),a.callback!==void 0&&(i.readCallback=a.callback),a.scopeChallenge!==void 0&&(i.scopeChallenge=a.scopeChallenge===null?void 0:a.scopeChallenge),a.enabled!==void 0&&(i.enabled=a.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let c=r.uriTemplate.variableNames;return Array.isArray(c)&&c.some(a=>!!r.completeCallback(a))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,t,r,o,n,s,i,c){let a=o,u=n,d={title:t,description:r,argsSchema:o,icons:s,scopeChallenge:i,_meta:c,handler:H_(e,o,n),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:p=>{p.name!==void 0&&p.name!==e&&(delete this._registeredPrompts[e],p.name&&(this._registeredPrompts[p.name]=d)),p.title!==void 0&&(d.title=p.title),p.description!==void 0&&(d.description=p.description),p.icons!==void 0&&(d.icons=p.icons),p.scopeChallenge!==void 0&&(d.scopeChallenge=p.scopeChallenge===null?void 0:p.scopeChallenge),p._meta!==void 0&&(d._meta=p._meta);let _=!1;p.argsSchema!==void 0&&(d.argsSchema=p.argsSchema,a=p.argsSchema,_=!0),p.callback!==void 0&&(u=p.callback,_=!0),_&&(d.handler=H_(e,a,u)),p.enabled!==void 0&&(d.enabled=p.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=d,o){let p=B_(o);p&&Object.values(p).some(_=>dd(K_(_)))&&this.setCompletionRequestHandler()}return d}_createRegisteredTool(e,t,r,o,n,s,i,c,a,u,d){rd(e);let p=d,_,y={title:t,description:r,inputSchema:o,outputSchema:n,get outputSchemaJson(){return _??=V_(y.outputSchema)},set outputSchemaJson(m){_=m},annotations:s,icons:i,execution:c,scopeChallenge:a,_meta:u,handler:d,executor:U_(o,d),enabled:!0,disable:()=>y.update({enabled:!1}),enable:()=>y.update({enabled:!0}),remove:()=>y.update({name:null}),update:m=>{m.name!==void 0&&m.name!==e&&(typeof m.name=="string"&&rd(m.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],m.name&&(delete this._toolInputSchemaJson[m.name],this._registeredTools[m.name]=y,e=m.name)),m.title!==void 0&&(y.title=m.title),m.description!==void 0&&(y.description=m.description);let g=!1;m.paramsSchema!==void 0&&(y.inputSchema=m.paramsSchema,delete this._toolInputSchemaJson[e],g=!0),m.callback!==void 0&&(y.handler=m.callback,p=m.callback,g=!0),g&&(y.executor=U_(y.inputSchema,p)),m.outputSchema!==void 0&&(y.outputSchema=m.outputSchema,y.outputSchemaJson=V_(m.outputSchema)),m.annotations!==void 0&&(y.annotations=m.annotations),m.icons!==void 0&&(y.icons=m.icons),m.scopeChallenge!==void 0&&(y.scopeChallenge=m.scopeChallenge===null?void 0:m.scopeChallenge),m._meta!==void 0&&(y._meta=m._meta),m.enabled!==void 0&&(y.enabled=m.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=y,this.setToolRequestHandlers(),this.sendToolListChanged(),y}registerTool(e,t,r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:n,inputSchema:s,outputSchema:i,annotations:c,icons:a,scopeChallenge:u,_meta:d}=t;return this._createRegisteredTool(e,o,n,ec(s),ec(i),c,a,void 0,u,d,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:n,argsSchema:s,icons:i,scopeChallenge:c,_meta:a}=t,u=this._createRegisteredPrompt(e,o,n,ec(s),r,i,c,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),u}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};function U_(e,t){if(e){let o=t;return async(n,s)=>o(n,s)}let r=t;return async(o,n)=>r(n)}var F_={type:"object",properties:{}};function wR(e,t){let r=_r(t,"input"),o=Gl(r);return o.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${o.reason}`),r}function V_(e){if(e!==void 0)try{return _r(e,"output")}catch{return}}function H_(e,t,r){if(t){let o=r;return async(n,s)=>{let i=await gr(t,n??{});if(!i.success)throw new ne(B.InvalidParams,`Invalid arguments for prompt ${e}: ${i.error}`);return o(i.data,s)}}else{let o=r;return async(n,s)=>o(s)}}function J_(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var Hn={completion:{values:[],hasMore:!1}};function B_(e){let t=e;if(t.shape&&typeof t.shape=="object")return t.shape}function PR(e){return e?.type==="optional"}function K_(e){return PR(e)?e.def?.innerType??e:e}var bT=4*1024*1024;var X_=Symbol("swallowsErrorsAfterClose"),Q_=class{_readBuffer;_started=!1;_closed=!1;constructor(e=ud.stdin,t=ud.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new ed({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this._closed||(this.onerror?.(e),this.close().catch(()=>{}))};_onstdinclose=()=>{this.close().catch(()=>{})};async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0;for(let e of this._stdout.listeners("error"))e[X_]&&this._stdout.off("error",e);(this._stdin.readableEnded||this._stdin.destroyed)&&setImmediate(this._onstdinclose),this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdin.on("end",this._onstdinclose),this._stdin.on("close",this._onstdinclose),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.off("end",this._onstdinclose),this._stdin.off("close",this._onstdinclose),this._onstdouterror[X_]=!0,this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(new Error("StdioServerTransport is closed")):new Promise((t,r)=>{let o=td(e),n=!1,s=c=>{n||(n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),r(c))},i=()=>{n||(n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),t())};if(this._stdout.once("error",s),this._stdout.write(o)){if(n)return;n=!0,this._stdout.off("error",s),t()}else n||this._stdout.once("drain",i)})}};import{isAbsolute as eS}from"node:path";function tS(e,t){let r=e.find(o=>o.id===t);if(r?.kind!=="select")throw new Error(`no select option "${t}"`);return r.choices.map(o=>o.value)}var rS={kind:"document",path:"/forge.pdf",format:"pdf",bytes:0,pages:2,encrypted:!1},oS=Pd(),NR=kd.map(e=>e.id),pd=tS(Td.options([rS],{},mc),"degrees").map(Number),LT=tS(Cd.options([rS],{},mc),"mode"),jR=["every-page","every-n","points"],Sr=l().refine(eS,"must be an absolute path").describe("An absolute path."),uc=I(Sr).min(1),AR=P({mode:te(jR).describe("every-page, every-n or points."),n:L().int().min(1).optional().describe("every-n only: pages per file."),after:I(L().int().min(1)).min(1).optional().describe("points only: cut after these pages (1-based).")}).superRefine((e,t)=>{let r={"every-page":[],"every-n":["n"],points:["after"]}[e.mode];for(let o of["n","after"]){let n=e[o]!==void 0;n!==r.includes(o)&&t.addIssue({code:"custom",path:[o],message:n?`${o} does not go with mode ${e.mode}.`:`mode ${e.mode} needs ${o}.`})}}).describe('How to split: { mode: "every-page" }, { mode: "every-n", n } or { mode: "points", after: [pages] }.');function nS(e){return e.mode==="every-n"?{mode:"every-n",n:e.n??1}:e.mode==="points"?{mode:"points",after:e.after??[]}:{mode:"every-page"}}var qR=P({percent:L().min(1).max(Kd).optional(),width:L().int().min(1).optional(),height:L().int().min(1).optional()}).refine(e=>[e.percent,e.width,e.height].filter(t=>t!==void 0).length===1,{message:"Give exactly one of percent, width or height."});function sS(e){return e.percent!==void 0?{percent:e.percent}:e.width!==void 0?{width:e.width}:{height:e.height??1}}var iS=P({paths:uc.describe("Absolute paths of files (or folders) to inspect.")}),aS=P({}),cS=P({paths:uc.describe("Absolute paths of files, folders or globs to convert."),to:te(oS).optional().describe(`Target format id. Use "jpeg" for JPG. Required, except with trim, crop or resize, which keep each image's own format when it is omitted.`),output:Sr.optional().describe("A folder (or, for one input, a file) to write to. Default: beside each source."),quality:L().int().min(1).max(100).optional().describe("For lossy targets, 1-100."),dpi:L().int().min(36).max(600).optional().describe("PDF \u2192 image resolution. Default 150."),pages:l().optional().describe('PDF \u2192 image page selection, e.g. "3-7,12". Default all.'),background:l().optional().describe("Fill colour when transparency must be flattened. Default #ffffff."),keepMetadata:H().optional().describe("Keep EXIF and GPS data. Default false."),password:l().optional().describe("Password for an encrypted PDF. Never echoed back."),overwrite:H().optional().describe("Replace existing outputs. Default false \u2014 only when the user asked."),recursive:H().optional().describe("Descend into subfolders of a folder input."),trim:H().optional().describe("Images only: cut transparent or solid-colour edges, writing name-trimmed. Keeps the format unless `to` is given. Refused for animated images and when nothing would be trimmed (unless also resizing)."),crop:l().optional().describe('Images only: cut to a shape W:H (e.g. "1:1", "4:5", "16:9", "9:16"; whole numbers 1-100), the largest box that fits, placed to keep the subject; writes name-cropped-1x1, or name-cropped-1x1-<W>x<H> with resize, which then applies to the cropped image. Keeps the format unless `to` is given. Refused for animated images and when the image already has that shape (unless also resizing). Not with trim.'),resize:qR.optional().describe("Images only: resize to { percent } of the size (1-200), or an exact { width } or { height } with the other side following; exactly one of the three. Writes name-<W>x<H>; with trim, name-trimmed-<50pct|1200w|900h>. Keeps the format unless `to` is given. No side over 16384 px, no more than 100 MP."),sharpen:H().optional().describe("Images only: sharpen at the same size with the optional boost extension, writing name-sharp. `to` is then the output format. Fails with extension-missing when it is not installed; the fix is `forge extensions add boost`."),boost:L().int().min(2).max(4).optional().describe("Images only: enlarge 2, 3 or 4 times with the optional boost extension, writing name-2x / name-3x / name-4x. `to` is then the output format (png keeps transparency). Fails with extension-missing when it is not installed; the fix is `forge extensions add boost`. 3 needs boost 1.1.0 or later: an older install fails with extension-outdated, fixed by the same command; while no released boost makes 3 it fails with invalid-arguments naming the factors that work."),removeBackground:H().optional().describe("Images only: cut out the subject with the optional remove-background extension, writing name-cutout. `to` must carry transparency (png, webp, avif, tiff). Fails with extension-missing when it is not installed; the fix is `forge extensions add remove-background`.")}),uS=P({paths:uc.describe("Absolute paths of files to compress."),quality:L().int().min(1).max(100).optional().describe("Compress to this quality."),maxSize:l().optional().describe('Compress until it fits, e.g. "500kb" or "2mb".'),dpi:L().int().min(36).max(600).optional().describe("For a PDF: image resolution."),output:Sr.optional().describe("A folder or file to write to."),overwrite:H().optional().describe("Replace existing outputs. Default false.")}).refine(e=>e.quality===void 0!=(e.maxSize===void 0),{message:"Give exactly one of quality or maxSize."}),lS=P({to:te(oS).optional().describe("Convert to this format id. Default: compress, keeping the image's own format."),quality:L().int().min(1).max(100).optional().describe("Compress to this quality."),maxSize:l().optional().describe('Compress until it fits, e.g. "500kb".'),save:Sr.optional().describe("Also write the result into this folder."),undo:H().optional().describe("Put the last original back instead. Takes no other argument.")}).refine(e=>!(e.quality!==void 0&&e.maxSize!==void 0),{message:"Give at most one of quality or maxSize."}).refine(e=>!e.undo||Object.keys(e).every(t=>t==="undo"),{message:"undo takes no other argument."}),dS=P({op:te(NR).describe("The page operation."),paths:uc.describe("Absolute PDF paths. merge takes two or more, in order; the others take one."),pages:l().optional().describe('extract / delete: which pages, e.g. "3-7,12".'),separate:H().optional().describe("extract: one file per page."),degrees:L().int().refine(e=>pd.includes(e),{message:`degrees must be ${pd.join(", ")}.`}).optional().describe(`rotate: degrees clockwise, one of ${pd.join(", ")}.`),split:AR.optional(),overwrite:H().optional().describe("Replace existing outputs. Default false.")}),Jn=Ge({path:l().optional(),code:l(),title:l(),detail:l(),hint:l().optional()}),MR=Ge({op:l(),source:l(),sources:I(l()),outputs:I(l()),inputBytes:L(),outputBytes:L(),warnings:I(Ge({code:l(),message:l()}))}),Bn=Ge({forge:l(),ok:H(),results:I(MR),failures:I(Jn)}),pS=Bn.extend({clipboard:te(["placed","changed","restored"]).optional(),saved:l().optional()}),mS=Ge({forge:l(),ok:H(),probes:I(Ge({path:l(),kind:te(["image","document"]),format:l(),bytes:L(),width:L().optional(),height:L().optional(),pages:L().optional(),encrypted:H().optional(),targets:I(l()),actions:I(l())})),failures:I(Jn)}),fS=Ge({forge:l(),ok:H(),formats:I(Ge({id:l(),label:l(),extensions:I(l()),read:H(),write:H(),lossy:H()})),failures:I(Jn)}),md=l().describe("A colour: #RRGGBB, #RGB (or without the #), rgb(), hsl(), oklch(), or a CSS or common colour name"),fd={svg:H().optional().describe("Also return the SVG card of swatches as text, which Figma pastes as layers"),copy:H().optional().describe("Put the SVG card on the user's clipboard, replacing what is there, ready to paste into Figma. Only when the user wants it copied")},hS=P({path:Sr.describe("An image file (absolute path): a photo, a screenshot or artwork"),inside:md.optional().describe("Show the shades of the palette colour nearest this one"),...fd}),gS=P({colour:md,...fd}),_S=P({title:l().min(1).describe("The card's heading, e.g. the palette's name"),subtitle:l().optional().describe('The grey line under the title. Default: "N colours"'),colours:I(P({name:l().min(1).describe("Shown under the swatch and used as its layer name, e.g. blue-600 or blue/600"),colour:md})).min(1).describe("The colours, in the order they should appear"),theme:te(["light","dark"]).optional().describe("The card's background. Default: light"),copy:fd.copy}),SS=Ge({forge:l(),ok:H(),palette:Ge({source:l(),inside:l().optional(),colours:I(Ge({hex:l(),rgb:l(),oklch:l(),share:L()}))}),failures:I(Jn)}),yS=Ge({forge:l(),ok:H(),scale:Ge({reference:l(),steps:I(Ge({step:L(),hex:l(),oklch:l(),white:L(),black:L()}))}),failures:I(Jn)}),LR=l().refine(e=>eS(e)||/^https?:\/\//i.test(e),"must be an absolute path or a link"),vS={language:l().optional().describe("The language, when it is not this computer's own: hi, fr-FR"),format:te(["md","docx","pdf","txt"]).optional().describe("The file written: Markdown (default), Word, PDF or text. The reply is Markdown either way"),output:Sr.optional().describe("A folder (ending in /) or a file to write. Default: beside the source; for a link, Forge's default folder"),overwrite:H().optional().describe("Replace a file of that name. Default: refuse")},bS=P({source:LR.describe("A video or sound file (absolute path) or a YouTube link. A picture or PDF is read for its text instead"),to:te(["all","notes","transcript"]).optional().describe("all (default): summary, notes and transcript; notes: no transcript; transcript: no notes. Notes need Apple Intelligence"),detail:te(["brief","standard","detailed"]).optional().describe("How much the notes say. Default: standard"),...vS}),zS=P({path:Sr.describe("A picture, screenshot, scan or PDF (absolute path)"),...vS});import{Writable as DR}from"node:stream";function RS(e=process.stdout,t=process.stderr){let r=e.write.bind(e);return e.write=t.write.bind(t),new DR({write(o,n,s){r(o,n,s)}})}import{basename as _d,sep as ZR}from"node:path";import{pathToFileURL as ES}from"node:url";var hd={interactive:!1},$S=Promise.resolve();function gd(e){let t=$S.then(e,e);return $S=t.catch(()=>{}),t}var Kn=(e,t)=>gd(()=>Bd(e,t===void 0?hd:{...hd,signal:t}));function TS(e){let t=e.path===void 0?"":` (${e.path})`,r=e.hint===void 0?"":` ${e.hint}`;return`\u2715 ${e.title}${t}: ${e.detail}${r}`}function Sd(e){let t=e.results.map(o=>`\u2713 ${o.source} \u2192 ${o.outputs.join(", ")}`);t.push(...e.failures.map(TS));let r=e.results.flatMap(o=>o.outputs).map(o=>({type:"resource_link",uri:ES(o).href,name:_d(o)}));return{content:[{type:"text",text:t.join(`
|
|
69
|
-
`
|
|
70
|
-
`)
|
|
71
|
-
`)
|
|
72
|
-
`)},...(s.content??[]).slice(1)],structuredContent:{...n,clipboard:o.status,...o.saved===void 0?{}:{saved:o.saved}}}}catch(r){if(!Zo(r))throw r;return ft(r)}}async function NS(e){let t={kind:"pageop",action:e.op,inputs:e.paths,force:e.overwrite??!1,debug:!1};if(e.op==="extract"||e.op==="delete"){if(e.pages===void 0)return ft(st(`${e.op} needs pages, for example "3-7,12".`));t.pages=e.pages,e.op==="extract"&&e.separate===!0&&(t.separate=!0)}if(e.op==="rotate"){if(e.degrees===void 0)return ft(st("rotate needs degrees: 90, 180 or 270."));t.rotate=e.degrees}if(e.op==="split"){if(e.split===void 0)return ft(st("split needs a split mode: every-page, every-n or points."));t.split=nS(e.split)}return lo(await Kn(t))}function yr(e){return{content:[{type:"text",text:e}],isError:!0}}function UR(e){if(e.pasteboard)return e.pasteboard;if(!jd())throw $d();return Ad()}var FR=process.platform==="darwin"?"\u2318V":"Ctrl+V";async function yd(e,t,r,o){if(!r.svg&&!r.copy)return e;let n=t(),s=[...e.content];if(r.copy){try{await UR(o).writeText(n,"")}catch(c){let a=Zo(c)?c.detail:c instanceof Error?c.message:String(c);return yr(`The card could not be put on the clipboard: ${a}`)}let i=r.swatches;s.push({type:"text",text:`Copied a card of ${i} swatch${i===1?"":"es"} to the clipboard. Paste it into Figma with ${FR}: one layer per colour.`})}return r.svg&&s.push({type:"text",text:n}),{...e,content:s}}async function jS(e,t={}){let r=e.inside===void 0?void 0:ds(e.inside)?.rgb;if(e.inside!==void 0&&!r)return yr(`${e.inside} is not a colour. Try #RRGGBB.`);try{let{readPalette:o}=await import("./colour-2MYODUDY.js"),n=await o({kind:"palette",input:e.path,svg:!1,...r?{inside:r}:{}}),s=n.doc,i=Vd(s.palette.colours.map(u=>u.share)),a={content:[{type:"text",text:s.palette.colours.map((u,d)=>`${u.hex} ${i[d]}%`).join(`
|
|
73
|
-
`)}],structuredContent:{...
|
|
74
|
-
`)}],structuredContent:{...
|
|
68
|
+
deps: ${d}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(a){let[u,d]=s(a);i(a,u),c(a,d)}};function s({schema:a}){let u={},d={};for(let p in a){if(p==="__proto__")continue;let g=Array.isArray(a[p])?u:d;g[p]=a[p]}return[u,d]}function i(a,u=a.schema){let{gen:d,data:p,it:g}=a;if(Object.keys(u).length===0)return;let v=d.let("missing");for(let m in u){let _=u[m];if(_.length===0)continue;let h=(0,o.propertyInData)(d,p,m,g.opts.ownProperties);a.setParams({property:m,depsCount:_.length,deps:_.join(", ")}),g.allErrors?d.if(h,()=>{for(let f of _)(0,o.checkReportMissingProp)(a,f)}):(d.if((0,t._)`${h} && (${(0,o.checkMissingProp)(a,_,v)})`),(0,o.reportMissingProp)(a,v),d.else())}}e.validatePropertyDeps=i;function c(a,u=a.schema){let{gen:d,data:p,keyword:g,it:v}=a,m=d.name("valid");for(let _ in u)(0,r.alwaysValidSchema)(v,u[_])||(d.if((0,o.propertyInData)(d,p,_,v.opts.ownProperties),()=>{let h=a.subschema({keyword:g,schemaProp:_},m);a.mergeValidEvaluated(h,m)},()=>d.var(m,!0)),a.ok(m))}e.validateSchemaDeps=c,e.default=n})),R0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:n})=>(0,t._)`{propertyName: ${n.propertyName}}`},code(n){let{gen:s,schema:i,data:c,it:a}=n;if((0,r.alwaysValidSchema)(a,i))return;let u=s.name("valid");s.forIn("key",c,d=>{n.setParams({propertyName:d}),n.subschema({keyword:"propertyNames",data:d,dataTypes:["string"],propertyName:d,compositeRule:!0},u),s.if((0,t.not)(u),()=>{n.error(!0),a.allErrors||s.break()})}),n.ok(u)}};e.default=o})),N_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=le(),o=pt(),n=_e(),s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:i})=>(0,r._)`{additionalProperty: ${i.additionalProperty}}`},code(i){let{gen:c,schema:a,parentSchema:u,data:d,errsCount:p,it:g}=i;if(!p)throw new Error("ajv implementation error");let{allErrors:v,opts:m}=g;if(g.props=!0,m.removeAdditional!=="all"&&(0,n.alwaysValidSchema)(g,a))return;let _=(0,t.allSchemaProperties)(u.properties),h=(0,t.allSchemaProperties)(u.patternProperties);f(),i.ok((0,r._)`${p} === ${o.default.errors}`);function f(){c.forIn("key",d,b=>{!_.length&&!h.length?R(b):c.if(z(b),()=>R(b))})}function z(b){let y;if(_.length>8){let E=(0,n.schemaRefOrVal)(g,u.properties,"properties");y=(0,t.isOwnProperty)(c,E,b)}else _.length?y=(0,r.or)(..._.map(E=>(0,r._)`${b} === ${E}`)):y=r.nil;return h.length&&(y=(0,r.or)(y,...h.map(E=>(0,r._)`${(0,t.usePattern)(i,E)}.test(${b})`))),(0,r.not)(y)}function S(b){c.code((0,r._)`delete ${d}[${b}]`)}function R(b){if(m.removeAdditional==="all"||m.removeAdditional&&a===!1){S(b);return}if(a===!1){i.setParams({additionalProperty:b}),i.error(),v||c.break();return}if(typeof a=="object"&&!(0,n.alwaysValidSchema)(g,a)){let y=c.name("valid");m.removeAdditional==="failing"?(w(b,y,!1),c.if((0,r.not)(y),()=>{i.reset(),S(b)})):(w(b,y),v||c.if((0,r.not)(y),()=>c.break()))}}function w(b,y,E){let N={keyword:"additionalProperties",dataProp:b,dataPropType:n.Type.Str};E===!1&&Object.assign(N,{compositeRule:!0,createErrors:!1,allErrors:!1}),i.subschema(N,y)}}};e.default=s})),$0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=co(),r=mt(),o=_e(),n=N_(),s={keyword:"properties",type:"object",schemaType:"object",code(i){let{gen:c,schema:a,parentSchema:u,data:d,it:p}=i;p.opts.removeAdditional==="all"&&u.additionalProperties===void 0&&n.default.code(new t.KeywordCxt(p,n.default,"additionalProperties"));let g=(0,r.allSchemaProperties)(a);for(let f of g)p.definedProperties.add(f);p.opts.unevaluated&&g.length&&p.props!==!0&&(p.props=o.mergeEvaluated.props(c,(0,o.toHash)(g),p.props));let v=g.filter(f=>!(0,o.alwaysValidSchema)(p,a[f]));if(v.length===0)return;let m=c.name("valid");for(let f of v)_(f)?h(f):(c.if((0,r.propertyInData)(c,d,f,p.opts.ownProperties)),h(f),p.allErrors||c.else().var(m,!0),c.endIf()),i.it.definedProperties.add(f),i.ok(m);function _(f){return p.opts.useDefaults&&!p.compositeRule&&a[f].default!==void 0}function h(f){i.subschema({keyword:"properties",schemaProp:f,dataProp:f},m)}}};e.default=s})),w0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=le(),o=_e(),n=_e(),s={keyword:"patternProperties",type:"object",schemaType:"object",code(i){let{gen:c,schema:a,data:u,parentSchema:d,it:p}=i,{opts:g}=p,v=(0,t.allSchemaProperties)(a),m=v.filter(w=>(0,o.alwaysValidSchema)(p,a[w]));if(v.length===0||m.length===v.length&&(!p.opts.unevaluated||p.props===!0))return;let _=g.strictSchema&&!g.allowMatchingProperties&&d.properties,h=c.name("valid");p.props!==!0&&!(p.props instanceof r.Name)&&(p.props=(0,n.evaluatedPropsToName)(c,p.props));let{props:f}=p;z();function z(){for(let w of v)_&&S(w),p.allErrors?R(w):(c.var(h,!0),R(w),c.if(h))}function S(w){for(let b in _)new RegExp(w).test(b)&&(0,o.checkStrictMode)(p,`property ${b} matches pattern ${w} (use allowMatchingProperties)`)}function R(w){c.forIn("key",u,b=>{c.if((0,r._)`${(0,t.usePattern)(i,w)}.test(${b})`,()=>{let y=m.includes(w);y||i.subschema({keyword:"patternProperties",schemaProp:w,dataProp:b,dataPropType:n.Type.Str},h),p.opts.unevaluated&&f!==!0?c.assign((0,r._)`${f}[${b}]`,!0):!y&&!p.allErrors&&c.if((0,r.not)(h),()=>c.break())})})}}};e.default=s})),P0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){let{gen:n,schema:s,it:i}=o;if((0,t.alwaysValidSchema)(i,s)){o.fail();return}let c=n.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},c),o.failResult(c,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};e.default=r})),E0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:mt().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t})),T0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:n})=>(0,t._)`{passingSchemas: ${n.passing}}`},code(n){let{gen:s,schema:i,parentSchema:c,it:a}=n;if(!Array.isArray(i))throw new Error("ajv implementation error");if(a.opts.discriminator&&c.discriminator)return;let u=i,d=s.let("valid",!1),p=s.let("passing",null),g=s.name("_valid");n.setParams({passing:p}),s.block(v),n.result(d,()=>n.reset(),()=>n.error(!0));function v(){u.forEach((m,_)=>{let h;(0,r.alwaysValidSchema)(a,m)?s.var(g,!0):h=n.subschema({keyword:"oneOf",schemaProp:_,compositeRule:!0},g),_>0&&s.if((0,t._)`${g} && ${d}`).assign(d,!1).assign(p,(0,t._)`[${p}, ${_}]`).else(),s.if(g,()=>{s.assign(d,!0),s.assign(p,_),h&&n.mergeEvaluated(h,t.Name)})})}}};e.default=o})),C0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:"allOf",schemaType:"array",code(o){let{gen:n,schema:s,it:i}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");let c=n.name("valid");s.forEach((a,u)=>{if((0,t.alwaysValidSchema)(i,a))return;let d=o.subschema({keyword:"allOf",schemaProp:u},c);o.ok(c),o.mergeEvaluated(d)})}};e.default=r})),k0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:s})=>(0,t.str)`must match "${s.ifClause}" schema`,params:({params:s})=>(0,t._)`{failingKeyword: ${s.ifClause}}`},code(s){let{gen:i,parentSchema:c,it:a}=s;c.then===void 0&&c.else===void 0&&(0,r.checkStrictMode)(a,'"if" without "then" and "else" is ignored');let u=n(a,"then"),d=n(a,"else");if(!u&&!d)return;let p=i.let("valid",!0),g=i.name("_valid");if(v(),s.reset(),u&&d){let _=i.let("ifClause");s.setParams({ifClause:_}),i.if(g,m("then",_),m("else",_))}else u?i.if(g,m("then")):i.if((0,t.not)(g),m("else"));s.pass(p,()=>s.error(!0));function v(){let _=s.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},g);s.mergeEvaluated(_)}function m(_,h){return()=>{let f=s.subschema({keyword:_},g);i.assign(p,g),s.mergeValidEvaluated(f,p),h?i.assign(h,(0,t._)`${_}`):s.setParams({ifClause:_})}}}};function n(s,i){let c=s.schema[i];return c!==void 0&&!(0,r.alwaysValidSchema)(s,c)}e.default=o})),I0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:n,it:s}){n.if===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "if" is ignored`)}};e.default=r})),j_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=O_(),r=v0(),o=x_(),n=b0(),s=z0(),i=ad(),c=R0(),a=N_(),u=$0(),d=w0(),p=P0(),g=E0(),v=T0(),m=C0(),_=k0(),h=I0();function f(z=!1){let S=[p.default,g.default,v.default,m.default,_.default,h.default,c.default,a.default,i.default,u.default,d.default];return z?S.push(r.default,n.default):S.push(t.default,o.default),S.push(s.default),S}e.default=f})),O0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:o})=>(0,t.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,t._)`{format: ${o}}`},code(o,n){let{gen:s,data:i,$data:c,schema:a,schemaCode:u,it:d}=o,{opts:p,errSchemaPath:g,schemaEnv:v,self:m}=d;if(!p.validateFormats)return;c?_():h();function _(){let f=s.scopeValue("formats",{ref:m.formats,code:p.code.formats}),z=s.const("fDef",(0,t._)`${f}[${u}]`),S=s.let("fType"),R=s.let("format");s.if((0,t._)`typeof ${z} == "object" && !(${z} instanceof RegExp)`,()=>s.assign(S,(0,t._)`${z}.type || "string"`).assign(R,(0,t._)`${z}.validate`),()=>s.assign(S,(0,t._)`"string"`).assign(R,z)),o.fail$data((0,t.or)(w(),b()));function w(){return p.strictSchema===!1?t.nil:(0,t._)`${u} && !${R}`}function b(){let y=v.$async?(0,t._)`(${z}.async ? await ${R}(${i}) : ${R}(${i}))`:(0,t._)`${R}(${i})`,E=(0,t._)`(typeof ${R} == "function" ? ${y} : ${R}.test(${i}))`;return(0,t._)`${R} && ${R} !== true && ${S} === ${n} && !${E}`}}function h(){let f=m.formats[a];if(!f){w();return}if(f===!0)return;let[z,S,R]=b(f);z===n&&o.pass(y());function w(){if(p.strictSchema===!1){m.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${a}" ignored in schema at path "${g}"`}}function b(E){let N=E instanceof RegExp?(0,t.regexpCode)(E):p.code.formats?(0,t._)`${p.code.formats}${(0,t.getProperty)(a)}`:void 0,V=s.scopeValue("formats",{key:a,ref:E,code:N});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,t._)`${V}.validate`]:["string",E,V]}function y(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!v.$async)throw new Error("async format in sync schema");return(0,t._)`await ${R}(${i})`}return typeof S=="function"?(0,t._)`${R}(${i})`:(0,t._)`${R}.test(${i})`}}}};e.default=r})),A_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[O0().default];e.default=t})),q_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]})),M_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=k_(),r=I_(),o=j_(),n=A_(),s=q_(),i=[t.default,r.default,(0,o.default)(),n.default,s.metadataVocabulary,s.contentVocabulary];e.default=i})),x0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))})),cd=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=x0(),o=uc(),n=uo(),s=_e(),i={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:a}})=>c===r.DiscrError.Tag?`tag "${a}" must be string`:`value of tag "${a}" must be in oneOf`,params:({params:{discrError:c,tag:a,tagName:u}})=>(0,t._)`{error: ${c}, tag: ${u}, tagValue: ${a}}`},code(c){let{gen:a,data:u,schema:d,parentSchema:p,it:g}=c,{oneOf:v}=p;if(!g.opts.discriminator)throw new Error("discriminator: requires discriminator option");let m=d.propertyName;if(typeof m!="string")throw new Error("discriminator: requires propertyName");if(d.mapping)throw new Error("discriminator: mapping is not supported");if(!v)throw new Error("discriminator: requires oneOf keyword");let _=a.let("valid",!1),h=a.const("tag",(0,t._)`${u}${(0,t.getProperty)(m)}`);a.if((0,t._)`typeof ${h} == "string"`,()=>f(),()=>c.error(!1,{discrError:r.DiscrError.Tag,tag:h,tagName:m})),c.ok(_);function f(){let R=S();a.if(!1);for(let w in R)a.elseIf((0,t._)`${h} === ${w}`),a.assign(_,z(R[w]));a.else(),c.error(!1,{discrError:r.DiscrError.Mapping,tag:h,tagName:m}),a.endIf()}function z(R){let w=a.name("valid"),b=c.subschema({keyword:"oneOf",schemaProp:R},w);return c.mergeEvaluated(b,t.Name),w}function S(){var R;let w={},b=E(p),y=!0;for(let M=0;M<v.length;M++){let Z=v[M];if(Z?.$ref&&!(0,s.schemaHasRulesButRef)(Z,g.self.RULES)){let G=Z.$ref;if(Z=o.resolveRef.call(g.self,g.schemaEnv.root,g.baseId,G),Z instanceof o.SchemaEnv&&(Z=Z.schema),Z===void 0)throw new n.default(g.opts.uriResolver,g.baseId,G)}let W=(R=Z?.properties)===null||R===void 0?void 0:R[m];if(typeof W!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${m}"`);y=y&&(b||E(Z)),N(W,M)}if(!y)throw new Error(`discriminator: "${m}" must be required`);return w;function E({required:M}){return Array.isArray(M)&&M.includes(m)}function N(M,Z){if(M.const)V(M.const,Z);else if(M.enum)for(let W of M.enum)V(W,Z);else throw new Error(`discriminator: "properties/${m}" must have "const" or "enum"`)}function V(M,Z){if(typeof M!="string"||M in w)throw new Error(`discriminator: "${m}" values must be unique strings`);w[M]=Z}}}};e.default=i})),N0=U(((e,t)=>{t.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}})),L_=U(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=nd(),o=M_(),n=cd(),s=N0(),i=["/properties"],c="http://json-schema.org/draft-07/schema";var a=class extends r.default{_addVocabularies(){super._addVocabularies(),o.default.forEach(v=>this.addVocabulary(v)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let v=this.opts.$data?this.$dataMetaSchema(s,i):s;this.addMetaSchema(v,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=a,t.exports=e=a,t.exports.Ajv=a,Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var u=co();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=le();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var p=Jn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return p.default}});var g=uo();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return g.default}})})),D_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=le(),r=pt(),o=uc(),n=sd(),s={keyword:"$dynamicAnchor",schemaType:"string",code:a=>i(a,a.schema)};function i(a,u){let{gen:d,it:p}=a;p.schemaEnv.root.dynamicAnchors[u]=!0;let g=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(u)}`,v=p.errSchemaPath==="#"?p.validateName:c(a);d.if((0,t._)`!${g}`,()=>d.assign(g,v))}e.dynamicAnchor=i;function c(a){let{schemaEnv:u,schema:d,self:p}=a.it,{root:g,baseId:v,localRefs:m,meta:_}=u.root,{schemaId:h}=p.opts,f=new o.SchemaEnv({schema:d,schemaId:h,root:g,baseId:v,localRefs:m,meta:_});return o.compileSchema.call(p,f),(0,n.getValidate)(a,f)}e.default=s})),Z_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=le(),r=pt(),o=sd(),n={keyword:"$dynamicRef",schemaType:"string",code:i=>s(i,i.schema)};function s(i,c){let{gen:a,keyword:u,it:d}=i;if(c[0]!=="#")throw new Error(`"${u}" only supports hash fragment reference`);let p=c.slice(1);if(d.allErrors)g();else{let m=a.let("valid",!1);g(m),i.ok(m)}function g(m){if(d.schemaEnv.root.dynamicAnchors[p]){let _=a.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(p)}`);a.if(_,v(_,m),v(d.validateName,m))}else v(d.validateName,m)()}function v(m,_){return _?()=>a.block(()=>{(0,o.callRef)(i,m),a.let(_,!0)}):()=>(0,o.callRef)(i,m)}}e.dynamicRef=s,e.default=n})),j0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=D_(),r=_e(),o={keyword:"$recursiveAnchor",schemaType:"boolean",code(n){n.schema?(0,t.dynamicAnchor)(n,""):(0,r.checkStrictMode)(n.it,"$recursiveAnchor: false is ignored")}};e.default=o})),A0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Z_(),r={keyword:"$recursiveRef",schemaType:"string",code:o=>(0,t.dynamicRef)(o,o.schema)};e.default=r})),U_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=D_(),r=Z_(),o=j0(),n=A0(),s=[t.default,r.default,o.default,n.default];e.default=s})),q0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ad(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:o=>(0,t.validatePropertyDeps)(o)};e.default=r})),M0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ad(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:o=>(0,t.validateSchemaDeps)(o)};e.default=r})),L0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:o,parentSchema:n,it:s}){n.contains===void 0&&(0,t.checkStrictMode)(s,`"${o}" without "contains" is ignored`)}};e.default=r})),F_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=q0(),r=M0(),o=L0(),n=[t.default,r.default,o.default];e.default=n})),D0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o=pt(),n={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:s})=>(0,t._)`{unevaluatedProperty: ${s.unevaluatedProperty}}`},code(s){let{gen:i,schema:c,data:a,errsCount:u,it:d}=s;if(!u)throw new Error("ajv implementation error");let{allErrors:p,props:g}=d;g instanceof t.Name?i.if((0,t._)`${g} !== true`,()=>i.forIn("key",a,h=>i.if(m(g,h),()=>v(h)))):g!==!0&&i.forIn("key",a,h=>g===void 0?v(h):i.if(_(g,h),()=>v(h))),d.props=!0,s.ok((0,t._)`${u} === ${o.default.errors}`);function v(h){if(c===!1){s.setParams({unevaluatedProperty:h}),s.error(),p||i.break();return}if(!(0,r.alwaysValidSchema)(d,c)){let f=i.name("valid");s.subschema({keyword:"unevaluatedProperties",dataProp:h,dataPropType:r.Type.Str},f),p||i.if((0,t.not)(f),()=>i.break())}}function m(h,f){return(0,t._)`!${h} || !${h}[${f}]`}function _(h,f){let z=[];for(let S in h)h[S]===!0&&z.push((0,t._)`${f} !== ${S}`);return(0,t.and)(...z)}}};e.default=n})),Z0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=le(),r=_e(),o={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:n}})=>(0,t.str)`must NOT have more than ${n} items`,params:({params:{len:n}})=>(0,t._)`{limit: ${n}}`},code(n){let{gen:s,schema:i,data:c,it:a}=n,u=a.items||0;if(u===!0)return;let d=s.const("len",(0,t._)`${c}.length`);if(i===!1)n.setParams({len:u}),n.fail((0,t._)`${d} > ${u}`);else if(typeof i=="object"&&!(0,r.alwaysValidSchema)(a,i)){let g=s.var("valid",(0,t._)`${d} <= ${u}`);s.if((0,t.not)(g),()=>p(g,u)),n.ok(g)}a.items=!0;function p(g,v){s.forRange("i",v,d,m=>{n.subschema({keyword:"unevaluatedItems",dataProp:m,dataPropType:r.Type.Num},g),a.allErrors||s.if((0,t.not)(g),()=>s.break())})}}};e.default=o})),V_=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=D0(),r=Z0(),o=[t.default,r.default];e.default=o})),U0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}})),F0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}})),V0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}})),H0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}})),J0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}})),B0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,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}}}})),K0=U(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{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"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$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:[]}}}})),G0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=U0(),r=F0(),o=V0(),n=H0(),s=J0(),i=B0(),c=K0(),a=["/properties"];function u(d){return[t,r,o,n,p(this,s),i,p(this,c)].forEach(g=>this.addMetaSchema(g,void 0,!1)),this;function p(g,v){return d?g.$dataMetaSchema(v,a):v}}e.default=u})),W0=U(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=nd(),o=M_(),n=U_(),s=F_(),i=V_(),c=cd(),a=G0(),u="https://json-schema.org/draft/2019-09/schema";var d=class extends r.default{constructor(_={}){super({..._,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(n.default),o.default.forEach(_=>this.addVocabulary(_)),this.addVocabulary(s.default),this.addVocabulary(i.default),this.opts.discriminator&&this.addKeyword(c.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:_,meta:h}=this.opts;h&&(a.default.call(this,_),this.refs["http://json-schema.org/schema"]=u)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(u)?u:void 0)}};e.Ajv2019=d,t.exports=e=d,t.exports.Ajv2019=d,Object.defineProperty(e,"__esModule",{value:!0}),e.default=d;var p=co();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return p.KeywordCxt}});var g=le();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return g._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return g.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return g.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return g.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return g.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return g.CodeGen}});var v=Jn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return v.default}});var m=uo();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return m.default}})})),Y0=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=k_(),r=I_(),o=j_(),n=U_(),s=F_(),i=V_(),c=A_(),a=q_(),u=[n.default,t.default,r.default,(0,o.default)(!0),c.default,a.metadataVocabulary,a.contentVocabulary,s.default,i.default];e.default=u})),X0=U(((e,t)=>{t.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}}}})),Q0=U(((e,t)=>{t.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"}}}}})),eR=U(((e,t)=>{t.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"}}}})),tR=U(((e,t)=>{t.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"}}}})),rR=U(((e,t)=>{t.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"}}}})),oR=U(((e,t)=>{t.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"}}}})),nR=U(((e,t)=>{t.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}}}})),sR=U(((e,t)=>{t.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:[]}}}})),iR=U((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=X0(),r=Q0(),o=eR(),n=tR(),s=rR(),i=oR(),c=nR(),a=sR(),u=["/properties"];function d(p){return[t,r,o,n,s,g(this,i),c,g(this,a)].forEach(v=>this.addMetaSchema(v,void 0,!1)),this;function g(v,m){return p?v.$dataMetaSchema(m,u):m}}e.default=d})),aR=U(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=nd(),o=Y0(),n=cd(),s=iR(),i="https://json-schema.org/draft/2020-12/schema";var c=class extends r.default{constructor(g={}){super({...g,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(g=>this.addVocabulary(g)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:g,meta:v}=this.opts;v&&(s.default.call(this,g),this.refs["http://json-schema.org/schema"]=i)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}};e.Ajv2020=c,t.exports=e=c,t.exports.Ajv2020=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var a=co();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var u=le();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return u._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return u.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return u.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return u.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return u.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return u.CodeGen}});var d=Jn();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return d.default}});var p=uo();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return p.default}})})),cR=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(M,Z){return{validate:M,compare:Z}}e.fullFormats={date:t(s,i),time:t(a(!0),u),"date-time":t(g(!0),v),"iso-time":t(a(),d),"iso-date-time":t(g(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:f,"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:V,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:S,int32:{type:"number",validate:b},int64:{type:"number",validate:y},float:{type:"number",validate:E},double:{type:"number",validate:E},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,i),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,u),"date-time":t(/^\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,v),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d),"iso-date-time":t(/^\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,m),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},e.formatNames=Object.keys(e.fullFormats);function r(M){return M%4===0&&(M%100!==0||M%400===0)}let o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function s(M){let Z=o.exec(M);if(!Z)return!1;let W=+Z[1],G=+Z[2],fe=+Z[3];return G>=1&&G<=12&&fe>=1&&fe<=(G===2&&r(W)?29:n[G])}function i(M,Z){if(M&&Z)return M>Z?1:M<Z?-1:0}let c=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function a(M){return function(W){let G=c.exec(W);if(!G)return!1;let fe=+G[1],$e=+G[2],be=+G[3],Oe=G[4],he=G[5]==="-"?-1:1,k=+(G[6]||0),j=+(G[7]||0);if(k>23||j>59||M&&!Oe)return!1;if(fe<=23&&$e<=59&&be<60)return!0;let F=$e-j*he,$=fe-k*he-(F<0?1:0);return($===23||$===-1)&&(F===59||F===-1)&&be<61}}function u(M,Z){if(!(M&&Z))return;let W=new Date("2020-01-01T"+M).valueOf(),G=new Date("2020-01-01T"+Z).valueOf();if(W&&G)return W-G}function d(M,Z){if(!(M&&Z))return;let W=c.exec(M),G=c.exec(Z);if(W&&G)return M=W[1]+W[2]+W[3],Z=G[1]+G[2]+G[3],M>Z?1:M<Z?-1:0}let p=/t|\s/i;function g(M){let Z=a(M);return function(G){let fe=G.split(p);return fe.length===2&&s(fe[0])&&Z(fe[1])}}function v(M,Z){if(!(M&&Z))return;let W=new Date(M).valueOf(),G=new Date(Z).valueOf();if(W&&G)return W-G}function m(M,Z){if(!(M&&Z))return;let[W,G]=M.split(p),[fe,$e]=Z.split(p),be=i(W,fe);if(be!==void 0)return be||u(G,$e)}let _=/\/|:/,h=/^(?:[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 f(M){return _.test(M)&&h.test(M)}let z=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function S(M){return z.lastIndex=0,z.test(M)}let R=-(2**31),w=2**31-1;function b(M){return Number.isInteger(M)&&M<=w&&M>=R}function y(M){return Number.isInteger(M)}function E(){return!0}let N=/[^\\]\\Z/;function V(M){if(N.test(M))return!1;try{return new RegExp(M),!0}catch{return!1}}})),uR=U((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=L_(),r=le(),o=r.operators,n={formatMaximum:{okStr:"<=",ok:o.LTE,fail:o.GT},formatMinimum:{okStr:">=",ok:o.GTE,fail:o.LT},formatExclusiveMaximum:{okStr:"<",ok:o.LT,fail:o.GTE},formatExclusiveMinimum:{okStr:">",ok:o.GT,fail:o.LTE}},s={message:({keyword:c,schemaCode:a})=>(0,r.str)`should be ${n[c].okStr} ${a}`,params:({keyword:c,schemaCode:a})=>(0,r._)`{comparison: ${n[c].okStr}, limit: ${a}}`};e.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:s,code(c){let{gen:a,data:u,schemaCode:d,keyword:p,it:g}=c,{opts:v,self:m}=g;if(!v.validateFormats)return;let _=new t.KeywordCxt(g,m.RULES.all.format.definition,"format");_.$data?h():f();function h(){let S=a.scopeValue("formats",{ref:m.formats,code:v.code.formats}),R=a.const("fmt",(0,r._)`${S}[${_.schemaCode}]`);c.fail$data((0,r.or)((0,r._)`typeof ${R} != "object"`,(0,r._)`${R} instanceof RegExp`,(0,r._)`typeof ${R}.compare != "function"`,z(R)))}function f(){let S=_.schema,R=m.formats[S];if(!R||R===!0)return;if(typeof R!="object"||R instanceof RegExp||typeof R.compare!="function")throw new Error(`"${p}": format "${S}" does not define "compare" function`);let w=a.scopeValue("formats",{key:S,ref:R,code:v.code.formats?(0,r._)`${v.code.formats}${(0,r.getProperty)(S)}`:void 0});c.fail$data(z(w))}function z(S){return(0,r._)`${S}.compare(${u}, ${d}) ${n[p].fail} 0`}},dependencies:["format"]};let i=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=i})),lR=U(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=cR(),o=uR(),n=le(),s=new n.Name("fullFormats"),i=new n.Name("fastFormats"),c=(u,d={keywords:!0})=>{if(Array.isArray(d))return a(u,d,r.fullFormats,s),u;let[p,g]=d.mode==="fast"?[r.fastFormats,i]:[r.fullFormats,s];return a(u,d.formats||r.formatNames,p,g),d.keywords&&(0,o.default)(u),u};c.get=(u,d="full")=>{let p=(d==="fast"?r.fastFormats:r.fullFormats)[u];if(!p)throw new Error(`Unknown format "${u}"`);return p};function a(u,d,p,g){var v,m;(v=(m=u.opts.code).formats)!==null&&v!==void 0||(m.formats=(0,n._)`require("ajv-formats/dist/formats").${g}`);for(let _ of d)u.addFormat(_,p[_])}t.exports=e=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c})),H_=L_(),dR=W0(),pR=aR(),mR=gs(lR(),1),fR=mR.default;function od(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return fR(t),t}var lc=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=od(pR.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=rp(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return t==="2020-12"?this.ajv:t==="2019-09"?this._ajv2019??=od(dR.Ajv2019):this._ajvDraft7??=od(H_.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},HP=H_.Ajv;import ud from"node:process";var Q_=Symbol.for("mcp.completable");function dd(e){return!!e&&typeof e=="object"&&Q_ in e}function _R(e){return e[Q_]?.complete}var AE=2**31-1;function SR(e){return typeof e=="object"&&e!==null&&"setScopeChallengeResolver"in e&&typeof e.setScopeChallengeResolver=="function"}var yR=8,vR=6e5;function bR(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw new RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw new RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??yR,roundTimeoutMs:e?.roundTimeoutMs??vR,legacyShim:e?.legacyShim??!0}}function eS(e,t,r){if(r===null||typeof r!="object"||typeof r.method!="string")throw new ne(B.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let o=r,n=Gg(o);if(n===void 0)throw new ne(B.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${o.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:o,required:n}}function zR(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map(o=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function ld(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new ne(B.InternalError,t)}var RR=class{constructor(e){this._host=e}async fulfill(e,t,r,o,n){let{maxRounds:s,roundTimeoutMs:i}=this._host,c=o.mcpReq.signal,a=n,u=0;for(;;){if(u+=1,u>s)return ld(e,g_(e,s));let d=a.inputRequests,p=d!=null&&Object.keys(d).length>0,g=typeof a.requestState=="string"?a.requestState:void 0;if(!p&&g===void 0)throw new ne(B.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let v;if(p){let h=this._host.resolvedClientCapabilities(o),f=[];for(let[S,R]of Object.entries(d)){let{embedded:w,required:b}=eS(e,S,R);if(w.method!=="roots/list"&&w.params===void 0)throw new ne(B.InternalError,`Handler for ${e} returned an input request '${S}' of kind '${w.method}' without params`);if(Xa(b,h)!==void 0)return ld(e,`Cannot request input '${S}' (${w.method}): the client on this 2025-era connection did not declare the required capability${h===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);f.push([S,w])}let z=S_(c);try{let S={relatedRequestId:o.mcpReq.id,timeout:i,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:z.signal},R=await Promise.all(f.map(async([w,b])=>{try{return[w,await this._dispatchLeg(b,S)]}catch(y){throw z.abort(y),y}}));v=Object.fromEntries(R)}catch(S){if(c.aborted)throw S;return ld(e,`Fulfilling input required by '${e}' failed: ${S instanceof Error?S.message:String(S)}`)}finally{z.dispose()}}else await __(h_,c);let m={...o,mcpReq:{...o.mcpReq,inputResponses:v,droppedInputResponseKeys:void 0,requestState:Hn(g)}};if(g!==void 0){let h=await this._host.verifyRequestState(g,m,e);h!==void 0&&(m=Yl(m,h))}let _=await t(r,m);if(!kt(_))return _;a=_}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return r.mode==="url"&&r.elicitationId===void 0&&(r={...r,elicitationId:zR()}),await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},$R=new Set(["tools/call","prompts/get","resources/read"]),wR,PR,ER;var tS=class extends Xl{_clientCapabilities;_clientVersion;static{wR=(e,t)=>{t.clientCapabilities!==void 0&&(e._clientCapabilities=t.clientCapabilities),t.clientInfo!==void 0&&(e._clientVersion=t.clientInfo)},PR=(e,t)=>{let r=t.filter(o=>!e._supportedProtocolVersions.includes(o));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},ER=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new RR({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new lc,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=bR(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,o]of Object.entries(t.cacheHints))o!==void 0&&Dl(o,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",r=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Nl(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}async connect(e){if(this.transport!==void 0)throw new ue(me.AlreadyConnected,"Use a separate Server instance per connection: this instance is already connected to a transport. To connect it to a new transport, call close() first.");await super.connect(e)}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:o}=e.params,n=rc(Kt,o);return n.success&&this._loggingLevels.set(r,n.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(o,n,s)=>{if(!this._capabilities.logging)return Promise.resolve();let i;if(this._servedModernEra()){if(i=e.mcpReq.envelope?.[Ut],i===void 0)return Promise.resolve()}else i=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return i!==void 0&&this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(i)?Promise.resolve():e.mcpReq.notify({method:"notifications/message",params:{level:o,data:n,logger:s}})},elicitInput:(o,n)=>this.elicitInput(o,n),requestSampling:(o,n)=>this.createMessage(o,n)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Kt.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r):!1};registerCapabilities(e){if(this.transport)throw new ue(me.AlreadyConnected,"Cannot register capabilities after connecting to transport");let t=!!this._capabilities.logging;this._capabilities=Ql(this._capabilities,e),!t&&this._capabilities.logging&&this._registerLoggingHandler()}_wrapHandler(e,t){if(e!=="tools/call"){let r=this._cacheHints?.[e],o=$R.has(e);return r===void 0&&!o?async(n,s)=>{let i=await t(n,s);if(kt(i))throw new ne(B.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}:async(n,s)=>{let i=o?await this._invokeInputRequiredCapableHandler(e,t,n,s):await t(n,s);if(kt(i)){if(!o)throw new ne(B.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return i}return r===void 0?i:Qa(i,r)}}return async(r,o)=>{let n=io(this._negotiatedProtocolVersion),s=n.validateRequest("tools/call",r);if(!s.ok)throw new ne(s.reason==="not-in-era"?B.InternalError:B.InvalidParams,s.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${s.message}`);let i=await this._invokeInputRequiredCapableHandler("tools/call",t,r,o);if(kt(i))return i;let c=jl(i),a=n.validateResult("tools/call",c);if(!a.ok)throw new ne(a.reason==="not-in-era"?B.InternalError:B.InvalidParams,a.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${a.message}`);return a.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&Un(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,o){let n=this._servedModernEra(),s=o.mcpReq.requestState();if(s!==void 0&&typeof s!="string")throw new ne(B.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let i=o;if(typeof s=="string"){let p=await this._verifyRequestState(s,o,e);p!==void 0&&(i=Yl(o,p))}let c;try{c=await t(r,i)}catch(p){throw p instanceof ne&&p.code===B.UrlElicitationRequired&&n?new ne(B.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.`):p}if(!kt(c))return c;if(!n){if(!this._inputRequiredServing.legacyShim)throw new ne(B.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??mr}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,i,c)}let a=c.inputRequests,u=a!=null&&Object.keys(a).length>0,d=typeof c.requestState=="string";if(!u&&!d)throw new ne(B.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(u){let p=this._inputRequestCapabilityView(o);for(let[g,v]of Object.entries(a)){let{embedded:m,required:_}=eS(e,g,v),h=Xa(_,p);if(h!==void 0)throw new tc({requiredCapabilities:h},`Cannot request input '${g}' (${m.method}): the request's client capabilities do not declare the required capability`)}}return c}async _verifyRequestState(e,t,r){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(o){throw this.onerror?.(new Error(`requestState verification rejected ${r}: ${o instanceof Error?o.message:String(o)}`)),new ne(B.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[Tt]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new ue(me.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' 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:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new ue(me.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new ue(me.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new ue(me.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new ue(me.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new ue(me.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new ue(me.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new ue(me.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new ue(me.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new ue(me.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new ue(me.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new ue(me.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new ue(me.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=Wg(this._supportedProtocolVersions),o=r.includes(t)?t:r[0]??mr;return this._negotiatedProtocolVersion=o,this.transport?.setProtocolVersion?.(o),{protocolVersion:o,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Nl(this._supportedProtocolVersions),capabilities:TR(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new ue(me.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages.at(-1),i=Array.isArray(s.content)?s.content:[s.content],c=i.some(p=>p.type==="tool_result"),a=e.messages.length>1?e.messages.at(-2):void 0,u=a?Array.isArray(a.content)?a.content:[a.content]:[],d=u.some(p=>p.type==="tool_use");if(c){if(i.some(p=>p.type!=="tool_result"))throw new ne(B.InvalidParams,"The last message must contain only tool_result content if any is present");if(!d)throw new ne(B.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(d){let p=new Set(u.filter(v=>v.type==="tool_use").map(v=>v.id)),g=new Set(i.filter(v=>v.type==="tool_result").map(v=>v.toolUseId));if(p.size!==g.size||![...p].every(v=>g.has(v)))throw new ne(B.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),o=await this.request({method:"sampling/createMessage",params:e},t),n=this._wireCodec().samplingResultVariant(r,o);if(!n.ok)throw new ue(me.InvalidResult,`Invalid sampling/createMessage result: ${n.reason==="invalid"?n.message:n.reason}`);return n.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new ue(me.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let o=e.mode??"form",n=r?.validateAcceptedContent??!0;switch(o){case"url":{let s=e;return this.request({method:"elicitation/create",params:s},t)}case"form":{let s=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:s},t);if(n&&i.action==="accept"&&i.content&&s.requestedSchema)try{let c=this._jsonSchemaValidator.getValidator(s.requestedSchema)(i.content);if(!c.valid)throw new ne(B.InvalidParams,`Elicitation response content does not match requested schema: ${c.errorMessage}`)}catch(c){throw c instanceof ne?c:new ne(B.InternalError,`Error validating elicitation response: ${c instanceof Error?c.message:String(c)}`)}return i}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new ue(me.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}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"})}};function TR(e){return{...e}}function CR(e,t){let r=0,o=[e];for(;o.length>0;){let n=o.pop();if(!(n===null||typeof n!="object"))if(Array.isArray(n))for(let s of n){if(++r>t)return r;s!==null&&typeof s=="object"&&o.push(s)}else for(let s in n){if(!Object.prototype.hasOwnProperty.call(n,s))continue;if(++r>t)return r;let i=n[s];i!==null&&typeof i=="object"&&o.push(i)}}return r}function kR(e){if(!(e===void 0||e===1/0)){if(typeof e!="number"||Number.isNaN(e)||e<1)throw new RangeError(`maxToolInputElements must be a number of at least 1, or Infinity, got ${String(e)}`);return e}}var dc=class{server;_maxToolInputElements;_registeredResources={};_registeredResourceTemplates={};_registeredTools={};_registeredPrompts={};_toolInputSchemaJson={};toolInputSchemaJson(e){let t=this._registeredTools[e];if(!(t===void 0||!t.enabled)){if(Object.hasOwn(this._toolInputSchemaJson,e))return this._toolInputSchemaJson[e];if(t.inputSchema===void 0)return B_;try{let r=Sr(t.inputSchema,"input");return this._toolInputSchemaJson[e]=r,r}catch{return}}}constructor(e,t){this.server=new tS(e,t),this._maxToolInputElements=kR(t?.maxToolInputElements),t?.capabilities?.tools&&this.setToolRequestHandlers(),t?.capabilities?.resources&&this.setResourceRequestHandlers(),t?.capabilities?.prompts&&this.setPromptRequestHandlers()}async connect(e){return SR(e)&&e.setScopeChallengeResolver(t=>this.resolveScopeChallenge(t)),await this.server.connect(e)}async close(){await this.server.close()}resolveScopeChallenge=e=>{switch(e.request.method){case"tools/call":{let t=e.request.params?.name;if(typeof t!="string")return;let r=this._registeredTools[t];return r===void 0||!r.enabled?void 0:r.scopeChallenge?.(e)}case"resources/read":{let t=e.request.params?.uri;if(typeof t!="string")return;let r;try{r=new URL(t)}catch{return}let o=this._registeredResources[r.toString()];if(o!==void 0)return o.enabled?o.scopeChallenge?.(e):void 0;for(let n of Object.values(this._registeredResourceTemplates))if(n.resourceTemplate.uriTemplate.match(r.toString()))return n.enabled?n.scopeChallenge?.(e):void 0;return}case"prompts/get":{let t=e.request.params?.name;if(typeof t!="string")return;let r=this._registeredPrompts[t];return r===void 0||!r.enabled?void 0:r.scopeChallenge?.(e)}default:return}};_toolHandlersInitialized=!1;setToolRequestHandlers(){this._toolHandlersInitialized||(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(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?IR(e,t.inputSchema):B_,annotations:t.annotations,icons:t.icons,execution:t.execution,_meta:t._meta};return t.outputSchema&&(r.outputSchema=Sr(t.outputSchema,"output")),r})})),this.server.setRequestHandler("tools/call",async(e,t)=>{let r=this._registeredTools[e.params.name];if(!r)throw new ne(B.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new ne(B.InvalidParams,`Tool ${e.params.name} disabled`);try{let o=await this.validateToolInput(r,e.params.arguments,e.params.name),n=await this.executeToolHandler(r,o,t);return await this.validateToolOutput(r,n,e.params.name),kt(n)?n:this.server.projectCallToolResult(n,r.outputSchemaJson)}catch(o){if(o instanceof ne&&o.code===B.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(this._maxToolInputElements!==void 0&&CR(t,this._maxToolInputElements)>this._maxToolInputElements)throw new ne(B.InvalidParams,`Invalid arguments for tool ${r}: arguments contain more than the maximum of ${this._maxToolInputElements} elements`);if(!e.inputSchema)return;let o=await _r(e.inputSchema,t??{});if(!o.success)throw new ne(B.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${o.error}`);return o.data}async validateToolOutput(e,t,r){if(!e.outputSchema||kt(t)||t.isError)return;if(t.structuredContent===void 0)throw new ne(B.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=await _r(e.outputSchema,t.structuredContent);if(!o.success)throw new ne(B.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${o.error}`)}async executeToolHandler(e,t,r){return e.executor(t,r)}_completionHandlerInitialized=!1;setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler("completion/complete"),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler("completion/complete",async e=>{switch(e.params.ref.type){case"ref/prompt":return Bl(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Kl(e),this.handleResourceCompletion(e,e.params.ref);default:throw new ne(B.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new ne(B.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new ne(B.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return Bn;let o=X_(Y_(r.argsSchema)?.[e.params.argument.name]);if(!dd(o))return Bn;let n=_R(o);return n?W_(await n(e.params.argument.value,e.params.context)):Bn}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(n=>n.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return Bn;throw new ne(B.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);return o?W_(await o(e.params.argument.value,e.params.context)):Bn}_resourceHandlersInitialized=!1;setResourceRequestHandlers(){this._resourceHandlersInitialized||(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(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,s])=>s.enabled).map(([n,s])=>({uri:n,name:s.name,...s.metadata})),o=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let s=await n.resourceTemplate.listCallback(t);for(let i of s.resources)o.push({...n.metadata,...i})}return{resources:[...r,...o]}}),this.server.setRequestHandler("resources/templates/list",async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler("resources/read",async(e,t)=>{let r;try{r=new URL(e.params.uri)}catch{throw new ne(B.InvalidParams,`Resource URI ${e.params.uri} is invalid`,{uri:e.params.uri,reason:"invalid_uri"})}let o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new ne(B.InvalidParams,`Resource ${r} disabled`);return Qa(await o.readCallback(r,t),o.cacheHint)}for(let n of Object.values(this._registeredResourceTemplates)){let s=n.resourceTemplate.uriTemplate.match(r.toString());if(s){if(!n.enabled)throw new ne(B.InvalidParams,`Resource template ${n.resourceTemplate.uriTemplate} disabled`);return Qa(await n.readCallback(r,s,t),n.cacheHint)}}throw new ec(e.params.uri)}),this._resourceHandlersInitialized=!0)}_promptHandlersInitialized=!1;setPromptRequestHandlers(){this._promptHandlersInitialized||(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(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?f_(t.argsSchema):void 0,icons:t.icons,_meta:t._meta}))})),this.server.setRequestHandler("prompts/get",async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new ne(B.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new ne(B.InvalidParams,`Prompt ${e.params.name} disabled`);return r.handler(e.params.arguments,t)}),this._promptHandlersInitialized=!0)}registerResource(e,t,r,o){let{cacheHint:n,scopeChallenge:s,...i}=r,c=i;if(n!==void 0&&Dl(n,`resource ${e}`),typeof t=="string"){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);let a=this._createRegisteredResource(e,r.title,t,c,s,o);return n!==void 0&&(a.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let a=this._createRegisteredResourceTemplate(e,r.title,t,c,s,o);return n!==void 0&&(a.cacheHint=n),this.setResourceRequestHandlers(),this.sendResourceListChanged(),a}}_createRegisteredResource(e,t,r,o,n,s){let i={name:e,title:t,metadata:o,readCallback:s,scopeChallenge:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:c=>{c.uri!==void 0&&c.uri!==r&&(delete this._registeredResources[r],c.uri&&(this._registeredResources[c.uri]=i)),c.name!==void 0&&(i.name=c.name),c.title!==void 0&&(i.title=c.title),c.metadata!==void 0&&(i.metadata=c.metadata),c.callback!==void 0&&(i.readCallback=c.callback),c.scopeChallenge!==void 0&&(i.scopeChallenge=c.scopeChallenge===null?void 0:c.scopeChallenge),c.enabled!==void 0&&(i.enabled=c.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,o,n,s){let i={resourceTemplate:r,title:t,metadata:o,readCallback:s,scopeChallenge:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{a.name!==void 0&&a.name!==e&&(delete this._registeredResourceTemplates[e],a.name&&(this._registeredResourceTemplates[a.name]=i)),a.title!==void 0&&(i.title=a.title),a.template!==void 0&&(i.resourceTemplate=a.template),a.metadata!==void 0&&(i.metadata=a.metadata),a.callback!==void 0&&(i.readCallback=a.callback),a.scopeChallenge!==void 0&&(i.scopeChallenge=a.scopeChallenge===null?void 0:a.scopeChallenge),a.enabled!==void 0&&(i.enabled=a.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let c=r.uriTemplate.variableNames;return Array.isArray(c)&&c.some(a=>!!r.completeCallback(a))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,t,r,o,n,s,i,c){let a=o,u=n,d={title:t,description:r,argsSchema:o,icons:s,scopeChallenge:i,_meta:c,handler:G_(e,o,n),enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:p=>{p.name!==void 0&&p.name!==e&&(delete this._registeredPrompts[e],p.name&&(this._registeredPrompts[p.name]=d)),p.title!==void 0&&(d.title=p.title),p.description!==void 0&&(d.description=p.description),p.icons!==void 0&&(d.icons=p.icons),p.scopeChallenge!==void 0&&(d.scopeChallenge=p.scopeChallenge===null?void 0:p.scopeChallenge),p._meta!==void 0&&(d._meta=p._meta);let g=!1;p.argsSchema!==void 0&&(d.argsSchema=p.argsSchema,a=p.argsSchema,g=!0),p.callback!==void 0&&(u=p.callback,g=!0),g&&(d.handler=G_(e,a,u)),p.enabled!==void 0&&(d.enabled=p.enabled),this.sendPromptListChanged()}};if(this._registeredPrompts[e]=d,o){let p=Y_(o);p&&Object.values(p).some(g=>dd(X_(g)))&&this.setCompletionRequestHandler()}return d}_createRegisteredTool(e,t,r,o,n,s,i,c,a,u,d){rd(e);let p=d,g,v={title:t,description:r,inputSchema:o,outputSchema:n,get outputSchemaJson(){return g??=K_(v.outputSchema)},set outputSchemaJson(m){g=m},annotations:s,icons:i,execution:c,scopeChallenge:a,_meta:u,handler:d,executor:J_(o,d),enabled:!0,disable:()=>v.update({enabled:!1}),enable:()=>v.update({enabled:!0}),remove:()=>v.update({name:null}),update:m=>{m.name!==void 0&&m.name!==e&&(typeof m.name=="string"&&rd(m.name),delete this._registeredTools[e],delete this._toolInputSchemaJson[e],m.name&&(delete this._toolInputSchemaJson[m.name],this._registeredTools[m.name]=v,e=m.name)),m.title!==void 0&&(v.title=m.title),m.description!==void 0&&(v.description=m.description);let _=!1;m.paramsSchema!==void 0&&(v.inputSchema=m.paramsSchema,delete this._toolInputSchemaJson[e],_=!0),m.callback!==void 0&&(v.handler=m.callback,p=m.callback,_=!0),_&&(v.executor=J_(v.inputSchema,p)),m.outputSchema!==void 0&&(v.outputSchema=m.outputSchema,v.outputSchemaJson=K_(m.outputSchema)),m.annotations!==void 0&&(v.annotations=m.annotations),m.icons!==void 0&&(v.icons=m.icons),m.scopeChallenge!==void 0&&(v.scopeChallenge=m.scopeChallenge===null?void 0:m.scopeChallenge),m._meta!==void 0&&(v._meta=m._meta),m.enabled!==void 0&&(v.enabled=m.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=v,this.setToolRequestHandlers(),this.sendToolListChanged(),v}registerTool(e,t,r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:n,inputSchema:s,outputSchema:i,annotations:c,icons:a,scopeChallenge:u,_meta:d}=t;return this._createRegisteredTool(e,o,n,oc(s),oc(i),c,a,void 0,u,d,r)}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:n,argsSchema:s,icons:i,scopeChallenge:c,_meta:a}=t,u=this._createRegisteredPrompt(e,o,n,oc(s),r,i,c,a);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),u}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};function J_(e,t){if(e){let o=t;return async(n,s)=>o(n,s)}let r=t;return async(o,n)=>r(n)}var B_={type:"object",properties:{}};function IR(e,t){let r=Sr(t,"input"),o=Gl(r);return o.valid||console.warn(`[mcp-sdk] tool '${e}' carries an invalid x-mcp-header declaration and will be excluded by conforming Streamable HTTP clients: ${o.reason}`),r}function K_(e){if(e!==void 0)try{return Sr(e,"output")}catch{return}}function G_(e,t,r){if(t){let o=r;return async(n,s)=>{let i=await _r(t,n??{});if(!i.success)throw new ne(B.InvalidParams,`Invalid arguments for prompt ${e}: ${i.error}`);return o(i.data,s)}}else{let o=r;return async(n,s)=>o(s)}}function W_(e){return{completion:{values:e.map(String).slice(0,100),total:e.length,hasMore:e.length>100}}}var Bn={completion:{values:[],hasMore:!1}};function Y_(e){let t=e;if(t.shape&&typeof t.shape=="object")return t.shape}function OR(e){return e?.type==="optional"}function X_(e){return OR(e)?e.def?.innerType??e:e}var CT=4*1024*1024;var rS=Symbol("swallowsErrorsAfterClose"),oS=class{_readBuffer;_started=!1;_closed=!1;constructor(e=ud.stdin,t=ud.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new ed({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this._closed||(this.onerror?.(e),this.close().catch(()=>{}))};_onstdinclose=()=>{this.close().catch(()=>{})};async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0;for(let e of this._stdout.listeners("error"))e[rS]&&this._stdout.off("error",e);(this._stdin.readableEnded||this._stdin.destroyed)&&setImmediate(this._onstdinclose),this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdin.on("end",this._onstdinclose),this._stdin.on("close",this._onstdinclose),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.off("end",this._onstdinclose),this._stdin.off("close",this._onstdinclose),this._onstdouterror[rS]=!0,this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(new Error("StdioServerTransport is closed")):new Promise((t,r)=>{let o=td(e),n=!1,s=c=>{n||(n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),r(c))},i=()=>{n||(n=!0,this._stdout.off("error",s),this._stdout.off("drain",i),t())};if(this._stdout.once("error",s),this._stdout.write(o)){if(n)return;n=!0,this._stdout.off("error",s),t()}else n||this._stdout.once("drain",i)})}};import{Transform as DR}from"node:stream";import{StringDecoder as ZR}from"node:string_decoder";function UR(e){let t;try{t=JSON.parse(e)}catch{return nS(null,B.ParseError,"Parse error")}if(Fn(t)||Vn(t)||Jl(t))return null;let r=t?.id;return nS(typeof r=="string"||typeof r=="number"?r:null,B.InvalidRequest,"Invalid Request")}function nS(e,t,r){return`${JSON.stringify({jsonrpc:"2.0",id:e,error:{code:t,message:r}})}
|
|
69
|
+
`}function sS(e){let t=new ZR("utf8"),r="",o=(n,s)=>{if(n.trim()==="")return;let i=UR(n);i===null?s(`${n}
|
|
70
|
+
`):e(i)};return new DR({transform(n,s,i){r+=typeof n=="string"?n:t.write(n);let c=r.indexOf(`
|
|
71
|
+
`);for(;c!==-1;)o(r.slice(0,c).replace(/\r$/,""),a=>this.push(a)),r=r.slice(c+1),c=r.indexOf(`
|
|
72
|
+
`);i()},flush(n){n()}})}import{isAbsolute as iS}from"node:path";function aS(e,t){let r=e.find(o=>o.id===t);if(r?.kind!=="select")throw new Error(`no select option "${t}"`);return r.choices.map(o=>o.value)}var cS={kind:"document",path:"/forge.pdf",format:"pdf",bytes:0,pages:2,encrypted:!1},uS=Td(),FR=Od.map(e=>e.id),pd=aS(kd.options([cS],{},gc),"degrees").map(Number),YT=aS(Id.options([cS],{},gc),"mode"),VR=["every-page","every-n","points"],yr=l().refine(iS,"must be an absolute path").describe("An absolute path."),pc=I(yr).min(1),HR=P({mode:te(VR).describe("every-page, every-n or points."),n:L().int().min(1).optional().describe("every-n only: pages per file."),after:I(L().int().min(1)).min(1).optional().describe("points only: cut after these pages (1-based).")}).superRefine((e,t)=>{let r={"every-page":[],"every-n":["n"],points:["after"]}[e.mode];for(let o of["n","after"]){let n=e[o]!==void 0;n!==r.includes(o)&&t.addIssue({code:"custom",path:[o],message:n?`${o} does not go with mode ${e.mode}.`:`mode ${e.mode} needs ${o}.`})}}).describe('How to split: { mode: "every-page" }, { mode: "every-n", n } or { mode: "points", after: [pages] }.');function lS(e){return e.mode==="every-n"?{mode:"every-n",n:e.n??1}:e.mode==="points"?{mode:"points",after:e.after??[]}:{mode:"every-page"}}var JR=P({percent:L().min(1).max(Wd).optional(),width:L().int().min(1).optional(),height:L().int().min(1).optional()}).refine(e=>[e.percent,e.width,e.height].filter(t=>t!==void 0).length===1,{message:"Give exactly one of percent, width or height."});function dS(e){return e.percent!==void 0?{percent:e.percent}:e.width!==void 0?{width:e.width}:{height:e.height??1}}var pS=P({paths:pc.describe("Absolute paths of files (or folders) to inspect.")}),mS=P({}),fS=P({paths:pc.describe("Absolute paths of files, folders or globs to convert."),to:te(uS).optional().describe(`Target format id. Use "jpeg" for JPG. Required, except with trim, crop or resize, which keep each image's own format when it is omitted.`),output:yr.optional().describe("A folder (or, for one input, a file) to write to. Default: beside each source."),quality:L().int().min(1).max(100).optional().describe("For lossy targets, 1-100."),dpi:L().int().min(36).max(600).optional().describe("PDF \u2192 image resolution. Default 150."),pages:l().optional().describe('PDF \u2192 image page selection, e.g. "3-7,12". Default all.'),background:l().optional().describe("Fill colour when transparency must be flattened. Default #ffffff."),keepMetadata:H().optional().describe("Keep EXIF and GPS data. Default false."),password:l().optional().describe("Password for an encrypted PDF. Never echoed back."),overwrite:H().optional().describe("Replace existing outputs. Default false \u2014 only when the user asked."),recursive:H().optional().describe("Descend into subfolders of a folder input."),trim:H().optional().describe("Images only: cut transparent or solid-colour edges, writing name-trimmed. Keeps the format unless `to` is given. Refused for animated images and when nothing would be trimmed (unless also resizing)."),crop:l().optional().describe('Images only: cut to a shape W:H (e.g. "1:1", "4:5", "16:9", "9:16"; whole numbers 1-100), the largest box that fits, placed to keep the subject; writes name-cropped-1x1, or name-cropped-1x1-<W>x<H> with resize, which then applies to the cropped image. Keeps the format unless `to` is given. Refused for animated images and when the image already has that shape (unless also resizing). Not with trim.'),resize:JR.optional().describe("Images only: resize to { percent } of the size (1-200), or an exact { width } or { height } with the other side following; exactly one of the three. Writes name-<W>x<H>; with trim, name-trimmed-<50pct|1200w|900h>. Keeps the format unless `to` is given. No side over 16384 px, no more than 100 MP."),sharpen:H().optional().describe("Images only: sharpen at the same size with the optional boost extension, writing name-sharp. `to` is then the output format. Fails with extension-missing when it is not installed; the fix is `forge extensions add boost`."),boost:L().int().min(2).max(4).optional().describe("Images only: enlarge 2, 3 or 4 times with the optional boost extension, writing name-2x / name-3x / name-4x. `to` is then the output format (png keeps transparency). Fails with extension-missing when it is not installed; the fix is `forge extensions add boost`. 3 needs boost 1.1.0 or later: an older install fails with extension-outdated, fixed by the same command; while no released boost makes 3 it fails with invalid-arguments naming the factors that work."),removeBackground:H().optional().describe("Images only: cut out the subject with the optional remove-background extension, writing name-cutout. `to` must carry transparency (png, webp, avif, tiff). Fails with extension-missing when it is not installed; the fix is `forge extensions add remove-background`.")}),hS=P({paths:pc.describe("Absolute paths of files to compress."),quality:L().int().min(1).max(100).optional().describe("Compress to this quality."),maxSize:l().optional().describe('Compress until it fits, e.g. "500kb" or "2mb".'),dpi:L().int().min(36).max(600).optional().describe("For a PDF: image resolution."),output:yr.optional().describe("A folder or file to write to."),overwrite:H().optional().describe("Replace existing outputs. Default false.")}).refine(e=>e.quality===void 0!=(e.maxSize===void 0),{message:"Give exactly one of quality or maxSize."}),gS=P({to:te(uS).optional().describe("Convert to this format id. Default: compress, keeping the image's own format."),quality:L().int().min(1).max(100).optional().describe("Compress to this quality."),maxSize:l().optional().describe('Compress until it fits, e.g. "500kb".'),save:yr.optional().describe("Also write the result into this folder."),undo:H().optional().describe("Put the last original back instead. Takes no other argument.")}).refine(e=>!(e.quality!==void 0&&e.maxSize!==void 0),{message:"Give at most one of quality or maxSize."}).refine(e=>!e.undo||Object.keys(e).every(t=>t==="undo"),{message:"undo takes no other argument."}),_S=P({op:te(FR).describe("The page operation."),paths:pc.describe("Absolute PDF paths. merge takes two or more, in order; the others take one."),pages:l().optional().describe('extract / delete: which pages, e.g. "3-7,12".'),separate:H().optional().describe("extract: one file per page."),degrees:L().int().refine(e=>pd.includes(e),{message:`degrees must be ${pd.join(", ")}.`}).optional().describe(`rotate: degrees clockwise, one of ${pd.join(", ")}.`),split:HR.optional(),overwrite:H().optional().describe("Replace existing outputs. Default false.")}),Kn=Ge({path:l().optional(),code:l(),title:l(),detail:l(),hint:l().optional()}),BR=Ge({op:l(),source:l(),sources:I(l()),outputs:I(l()),inputBytes:L(),outputBytes:L(),warnings:I(Ge({code:l(),message:l()}))}),Gn=Ge({forge:l(),ok:H(),results:I(BR),failures:I(Kn)}),SS=Gn.extend({clipboard:te(["placed","changed","restored"]).optional(),saved:l().optional()}),yS=Ge({forge:l(),ok:H(),probes:I(Ge({path:l(),kind:te(["image","document","media"]),format:l(),bytes:L(),width:L().optional(),height:L().optional(),pages:L().optional(),encrypted:H().optional(),duration:L().optional(),fps:L().optional(),targets:I(l()),actions:I(l())})),failures:I(Kn)}),vS=Ge({forge:l(),ok:H(),formats:I(Ge({id:l(),label:l(),extensions:I(l()),read:H(),write:H(),lossy:H()})),failures:I(Kn)}),md=l().describe("A colour: #RRGGBB, #RGB (or without the #), rgb(), hsl(), oklch(), or a CSS or common colour name"),fd={svg:H().optional().describe("Also return the SVG card of swatches as text, which Figma pastes as layers"),copy:H().optional().describe("Put the SVG card on the user's clipboard, replacing what is there, ready to paste into Figma. Only when the user wants it copied")},bS=P({path:yr.describe("An image file (absolute path): a photo, a screenshot or artwork"),inside:md.optional().describe("Show the shades of the palette colour nearest this one"),...fd}),zS=P({colour:md,...fd}),RS=P({title:l().min(1).describe("The card's heading, e.g. the palette's name"),subtitle:l().optional().describe('The grey line under the title. Default: "N colours"'),colours:I(P({name:l().min(1).describe("Shown under the swatch and used as its layer name, e.g. blue-600 or blue/600"),colour:md})).min(1).describe("The colours, in the order they should appear"),theme:te(["light","dark"]).optional().describe("The card's background. Default: light"),copy:fd.copy}),$S=Ge({forge:l(),ok:H(),palette:Ge({source:l(),inside:l().optional(),colours:I(Ge({hex:l(),rgb:l(),oklch:l(),share:L()}))}),failures:I(Kn)}),wS=Ge({forge:l(),ok:H(),scale:Ge({reference:l(),steps:I(Ge({step:L(),hex:l(),oklch:l(),white:L(),black:L()}))}),failures:I(Kn)}),KR=l().refine(e=>iS(e)||/^https?:\/\//i.test(e),"must be an absolute path or a link"),PS={language:l().optional().describe("The language, when it is not this computer's own: hi, fr-FR"),format:te(["md","docx","pdf","txt"]).optional().describe("The file written: Markdown (default), Word, PDF or text. The reply is Markdown either way"),output:yr.optional().describe("A folder (ending in /) or a file to write. Default: beside the source; for a link, Forge's default folder"),overwrite:H().optional().describe("Replace a file of that name. Default: refuse")},ES=P({source:KR.describe("A video or sound file (absolute path) or a YouTube link. A picture or PDF is read for its text instead"),to:te(["all","notes","transcript"]).optional().describe("all (default): summary, notes and transcript; notes: no transcript; transcript: no notes. Notes need Apple Intelligence"),detail:te(["brief","standard","detailed"]).optional().describe("How much the notes say. Default: standard"),...PS}),TS=P({path:yr.describe("A picture, screenshot, scan or PDF (absolute path)"),...PS});import{Writable as GR}from"node:stream";function CS(e=process.stdout,t=process.stderr){let r=e.write.bind(e);return e.write=t.write.bind(t),new GR({write(o,n,s){r(o,n,s)}})}import{basename as _d,sep as WR}from"node:path";import{pathToFileURL as xS}from"node:url";var hd={interactive:!1},kS=Promise.resolve();function gd(e){let t=kS.then(e,e);return kS=t.catch(()=>{}),t}var Wn=(e,t)=>gd(()=>Gd(e,t===void 0?hd:{...hd,signal:t}));function NS(e){let t=e.path===void 0?"":` (${e.path})`,r=e.hint===void 0?"":` ${e.hint}`;return`\u2715 ${e.title}${t}: ${e.detail}${r}`}function Sd(e){let t=e.results.map(o=>`\u2713 ${o.source} \u2192 ${o.outputs.join(", ")}`);t.push(...e.failures.map(NS));let r=e.results.flatMap(o=>o.outputs).map(o=>({type:"resource_link",uri:xS(o).href,name:_d(o)}));return{content:[{type:"text",text:t.join(`
|
|
73
|
+
`)||"Nothing to do."},...r],structuredContent:{...e},isError:!e.ok}}var lo=e=>Sd(fs(_t,e)),ft=e=>Sd(Nd(_t,e));async function jS(e){let t=Ad(_t,await xd(e.paths)),r=t.probes.map(o=>{let n=o.pages!==void 0?`, ${o.pages} pages`:o.width!==void 0?`, ${o.width}\xD7${o.height}`:"";return`${o.path}: ${o.format}, ${o.bytes} bytes${n}${o.encrypted?", password-protected":""}. Can become: ${o.targets.join(", ")}. Actions: ${o.actions.join(", ")}.`});return r.push(...t.failures.map(NS)),{content:[{type:"text",text:r.join(`
|
|
74
|
+
`)}],structuredContent:{...t},isError:!t.ok}}function AS(){let e=jd(_t,Cd());return{content:[{type:"text",text:e.formats.map(r=>{let o=r.read&&r.write?"read and write":r.read?"read only":"write only";return`${r.id} (${r.extensions.join(" ")}): ${o}`}).join(`
|
|
75
|
+
`)}],structuredContent:{...e}}}async function qS(e,t){let r=Pd(e.background??"#ffffff");if(r===void 0)return ft(Rd(e.background??"","background"));let o=[...e.sharpen===!0?["sharpen"]:[],...e.boost!==void 0?["boost"]:[],...e.removeBackground===!0?["removeBackground"]:[]];if(e.trim===!0||e.crop!==void 0||e.resize!==void 0){let c=e.crop!==void 0?"crop":e.trim===!0?"trim":"resize",a=[...e.crop!==void 0&&e.trim===!0?["trim"]:[],...o,...e.pages!==void 0?["pages"]:[]][0];if(a!==void 0)return ft(st(`${c} cannot be combined with ${a}.`,"Run them one after the other."));let u;if(e.crop!==void 0)try{u={aspect:Ed(e.crop)}}catch(p){if(!Zo(p))throw p;return ft(st(p.detail,'Try crop "1:1" or "16:9".'))}let d={kind:"edit",inputs:e.paths,trim:e.trim===!0,options:{background:r,keepMetadata:e.keepMetadata??!1,...e.quality===void 0?{}:{quality:e.quality}},force:e.overwrite??!1,recursive:e.recursive??!1,debug:!1,...u===void 0?{}:{crop:u},...e.resize===void 0?{}:{resize:dS(e.resize)},...e.to===void 0?{}:{target:e.to},...e.output===void 0?{}:{output:e.output}};return lo(await Wn(d))}if(e.to===void 0)return ft(st("forge_convert needs `to`, the target format.","Only trim, crop and resize may leave it out, to keep each image's own format."));let s=e.to;if(o.length>0){if(o.length>1)return ft(st(`Use one operation at a time \u2014 got ${o.join(" and ")}.`));let c=e.sharpen===!0?1:e.boost,a={kind:"extension-op",op:c!==void 0?"boost":"remove-background",inputs:e.paths,target:s,options:{background:r,keepMetadata:e.keepMetadata??!1,...e.quality===void 0?{}:{quality:e.quality}},force:e.overwrite??!1,recursive:e.recursive??!1,debug:!1,...c===void 0?{}:{scale:c},...e.output===void 0?{}:{output:e.output}};return lo(await Wn(a,t))}let i={kind:"convert",inputs:e.paths,target:s,options:{background:r,keepMetadata:e.keepMetadata??!1,...e.quality===void 0?{}:{quality:e.quality}},force:e.overwrite??!1,recursive:e.recursive??!1,debug:!1,dpi:e.dpi??150,passwordStdin:!1,...e.output===void 0?{}:{output:e.output},...e.pages===void 0?{}:{pages:e.pages},...e.password===void 0?{}:{password:e.password}};return lo(await Wn(i))}async function MS(e){let t={kind:"compress",inputs:e.paths,options:{background:"#ffffff",keepMetadata:!1},force:e.overwrite??!1,recursive:!1,debug:!1};if(e.quality!==void 0&&(t.quality=e.quality),e.maxSize!==void 0){let r=hc(e.maxSize);if(r===void 0)return ft(st(`${e.maxSize} is not a size.`,"Try a number with a unit, for example 500kb, 2mb or 1.5mb."));t.maxBytes=r}return e.dpi!==void 0&&(t.dpi=e.dpi),e.output!==void 0&&(t.output=e.output),lo(await Wn(t))}async function LS(e,t={}){try{if(e.undo)return await gd(()=>Zd(t)),{content:[{type:"text",text:"\u2713 The original is back on the clipboard"}],structuredContent:{...fs(_t,{results:[],failures:[]}),clipboard:"restored"},isError:!1};let r={kind:"clip",undo:!1,debug:!1};if(e.to!==void 0&&(r.target=e.to),e.quality!==void 0&&(r.quality=e.quality),e.save!==void 0&&(r.save=e.save),e.maxSize!==void 0){let i=hc(e.maxSize);if(i===void 0)return ft(st(`${e.maxSize} is not a size.`,"Try a number with a unit, for example 500kb, 2mb or 1.5mb."));r.maxBytes=i}let o=await gd(()=>Ld(r,{...hd,clip:t}));if(o.status==="failed")return lo(o.report);let n=fs(_t,o.report),s=Sd(n);return{...s,content:[{type:"text",text:Dd(o).join(`
|
|
76
|
+
`)},...(s.content??[]).slice(1)],structuredContent:{...n,clipboard:o.status,...o.saved===void 0?{}:{saved:o.saved}}}}catch(r){if(!Zo(r))throw r;return ft(r)}}async function DS(e){let t={kind:"pageop",action:e.op,inputs:e.paths,force:e.overwrite??!1,debug:!1};if(e.op==="extract"||e.op==="delete"){if(e.pages===void 0)return ft(st(`${e.op} needs pages, for example "3-7,12".`));t.pages=e.pages,e.op==="extract"&&e.separate===!0&&(t.separate=!0)}if(e.op==="rotate"){if(e.degrees===void 0)return ft(st("rotate needs degrees: 90, 180 or 270."));t.rotate=e.degrees}if(e.op==="split"){if(e.split===void 0)return ft(st("split needs a split mode: every-page, every-n or points."));t.split=lS(e.split)}return lo(await Wn(t))}function Yt(e){return{content:[{type:"text",text:e}],isError:!0}}function YR(e){if(e.pasteboard)return e.pasteboard;if(!qd())throw $d();return Md()}var XR=process.platform==="darwin"?"\u2318V":"Ctrl+V";async function yd(e,t,r,o){if(!r.svg&&!r.copy)return e;let n=t(),s=[...e.content];if(r.copy){try{await YR(o).writeText(n,"")}catch(c){let a=Zo(c)?c.detail:c instanceof Error?c.message:String(c);return Yt(`The card could not be put on the clipboard: ${a}`)}let i=r.swatches;s.push({type:"text",text:`Copied a card of ${i} swatch${i===1?"":"es"} to the clipboard. Paste it into Figma with ${XR}: one layer per colour.`})}return r.svg&&s.push({type:"text",text:n}),{...e,content:s}}async function ZS(e,t={}){let r=e.inside===void 0?void 0:ms(e.inside)?.rgb;if(e.inside!==void 0&&!r)return Yt(`${e.inside} is not a colour. Try #RRGGBB.`);try{let{readPalette:o}=await import("./colour-2BGK2BFR.js"),n=await o({kind:"palette",input:e.path,svg:!1,...r?{inside:r}:{}}),s=n.doc,i=Jd(s.palette.colours.map(u=>u.share)),a={content:[{type:"text",text:s.palette.colours.map((u,d)=>`${u.hex} ${i[d]}%`).join(`
|
|
77
|
+
`)}],structuredContent:{...s}};return await yd(a,n.svg,{svg:e.svg,copy:e.copy,swatches:s.palette.colours.length},t)}catch(o){if(Zo(o))return Yt(`${o.title}: ${o.detail}${o.hint?` ${o.hint}`:""}`);throw o}}async function US(e,t={}){let r=ms(e.colour)?.rgb;if(!r)return Yt(`${e.colour} is not a colour. Try #RRGGBB, rgb(), hsl(), oklch() or a colour name.`);let{runScale:o}=await import("./colour-2BGK2BFR.js"),n=await o({kind:"scale",colour:r,svg:!1},{json:!0,colour:!1}),s=JSON.parse(n.stdout[0]??"{}"),c={content:[{type:"text",text:s.scale.steps.map(u=>`${u.step} ${u.hex} white ${u.white} black ${u.black}`).join(`
|
|
78
|
+
`)}],structuredContent:{...s}};return yd(c,()=>Hd(r,Fd(r)),{svg:e.svg,copy:e.copy,swatches:s.scale.steps.length},t)}async function FS(e,t={}){let r=[],o=[];for(let{name:c,colour:a}of e.colours){let u=ms(a);if(!u){o.push(`${c}: ${a}`);continue}let d=wd(u.rgb),p=u.alpha!==void 0&&u.alpha<1?u.alpha:void 0;r.push({id:c,name:c,value:p===void 0?d:`${d} ${Math.round(p*100)}%`,hex:d,...p===void 0?{}:{alpha:p}})}if(o.length>0)return Yt(`Not ${o.length===1?"a colour":"colours"}: ${o.join(", ")}. Try #RRGGBB, rgb(), hsl(), oklch() or a colour name.`);let n=r.length,s=e.subtitle??`${n} colour${n===1?"":"s"}`,i=()=>Vd(e.title,s,r,e.theme,{perRow:8});return e.copy?yd({content:[]},i,{copy:!0,swatches:n},t):{content:[{type:"text",text:i()}]}}var IS=Promise.resolve();function QR(e){let t=IS.then(e,e);return IS=t.catch(()=>{}),t}var OS=2e5;async function e$(e){if(e.folder!==void 0)return e.folder;let{loadPreferences:t,expandTilde:r}=await import("./preferences-E2CH2YSG.js");return r((await t()).prefs.defaultOutput)}var t$=600*1e3;async function vd(e,t={},r={}){let n=Kd(e.source)?.kind==="video"&&e.output===void 0?await e$(r):void 0,s={kind:"transcribe",input:e.source,notes:e.to!=="transcript",transcript:e.to!=="notes",...e.to===void 0?{}:{to:e.to},detail:e.detail??Ud,...e.language===void 0?{}:{language:e.language},...e.format===void 0?{}:{format:e.format},...n!==void 0?{output:`${n}${WR}`}:e.output===void 0?{}:{output:e.output},force:e.overwrite===!0,debug:!1},i=[],c=[],a,u=new AbortController,d=()=>u.abort(t.signal?.reason);t.signal?.aborted?d():t.signal?.addEventListener("abort",d,{once:!0});let p,g=!1,{runTranscribeCommand:v,transcribeFact:m}=await import("./transcribe-command-VY5HYNXV.js"),_=await QR(()=>v(s,{out:w=>i.push(w),err:w=>c.push(w),signal:u.signal,onStart:w=>{w==="read"&&(p=setTimeout(()=>{g=!0,u.abort()},r.readLimitMs??t$))},...t.report?{onProgress:w=>t.report?.(w.kind==="page"?`reading ${m(w)}`:m(w))}:{},document:w=>{a=w}})).finally(()=>{clearTimeout(p),t.signal?.removeEventListener("abort",d)});if(g)return Yt("Reading text stopped after 10 minutes.");let h=w=>w.map(b=>b.trim()).filter(Boolean).join(" ");if(_!==0||a===void 0)return Yt(h(c)||"Transcribe failed.");let{path:f,markdown:z,notesSkipped:S}=a,R=z.length>OS?`${z.slice(0,OS)}
|
|
75
79
|
|
|
76
|
-
[The rest is in ${
|
|
77
|
-
`)},{type:"resource_link",uri:
|
|
80
|
+
[The rest is in ${f}]`:z;return{content:[{type:"text",text:[...i,...c].join(`
|
|
81
|
+
`)},{type:"resource_link",uri:xS(f).href,name:_d(f)},{type:"text",text:R}],...S?{structuredContent:{path:f,notes:null,notesSkipped:S}}:{}}}async function VS(e,t={},r={}){let o=await Bd(e.path).catch(()=>{});if(o==="video"||o==="audio")return Yt(`${_d(e.path)} is a recording, not a picture or PDF. Use forge_transcribe for what is said in it.`);let{path:n,...s}=e;return vd({source:n,...s},t,r)}function HS(e){let t=e.mcpReq._meta?.progressToken;if(t===void 0)return{signal:e.mcpReq.signal};let r=0;return{signal:e.mcpReq.signal,report:o=>{r+=1,e.mcpReq.notify({method:"notifications/progress",params:{progressToken:t,progress:r,message:o}}).catch(()=>{})}}}function r$(e=process.platform){return[`Forge converts, compresses and edits files on this ${e==="win32"?"PC":e==="darwin"?"Mac":"computer"}, locally.`,"Every path must be absolute.","Call forge_probe first: it says what a file is, every format it can become, and every action that applies.","Reach for Forge when a file must fit a limit (an upload under 5 MB: forge_compress with maxSize; a set width: forge_convert with resize);","when a file is in a format you cannot open (HEIC, camera RAW, Word): forge_convert it to PNG, JPEG or PDF and read that;","when you need what a recording, meeting or YouTube video says: forge_transcribe;","when you need the text in a picture, screenshot, scan or PDF: forge_read_text;","and when the user wants colours in Figma: forge_card, forge_scale or forge_palette with copy: true put a card of swatches on their clipboard to paste.","Nothing is overwritten unless you pass overwrite: true \u2014 only do that when the user asked to replace a file.","A failure hint that mentions --force means overwrite: true here; --output means the output argument; --password-stdin means the password argument."].join(" ")}var o$=r$(),JS={readOnlyHint:!0,openWorldHint:!1},bd={readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1},po={readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1};function n$(e={}){let t=new dc({name:"forge",version:_t},{instructions:o$});return t.registerTool("forge_probe",{title:"Inspect files",description:"What each file is and what Forge can do with it: format (read from content, not the extension), size, pages or dimensions, whether it is password-protected, every format it can become, and every action that applies. Writes nothing.",inputSchema:pS,outputSchema:yS,annotations:JS},r=>jS(r)),t.registerTool("forge_formats",{title:"List formats",description:"Every format Forge reads and writes. Writes nothing.",inputSchema:mS,outputSchema:vS,annotations:JS},()=>AS()),t.registerTool("forge_convert",{title:"Convert files",description:"Convert files to another format, beside each source unless output is given. A PDF becomes one image per page (choose pages and dpi); Word documents become PDF; images convert between formats; with trim, crop (to a shape such as 1:1, keeping the subject) or resize they keep their format unless `to` is given. Use it to open a format you cannot read (HEIC, camera RAW, Word): convert to PNG, JPEG or PDF. Returns every output path and a file:// link to each.",inputSchema:fS,outputSchema:Gn,annotations:po},(r,o)=>qS(r,o.mcpReq.signal)),t.registerTool("forge_compress",{title:"Compress files",description:'Make files smaller without changing their format: by quality (1-100) or to fit a size such as "500kb" \u2014 use maxSize when an upload, email or form has a size limit. Writes <name>-small.<ext> beside the source unless output is given. PNG and GIF are cut to fewer colours. A result no smaller than the source is never written (error code cannot-compress-more).',inputSchema:hS,outputSchema:Gn,annotations:po},r=>MS(r)),t.registerTool("forge_clip",{title:"Compress the copied image",description:"The image on the clipboard, made smaller (quality or maxSize) or converted (to), and put back on the clipboard, so the next paste is the result. The result is also kept as a file, linked. A newer copy is never overwritten: if something else was copied meanwhile, the result goes to the default folder instead. A compression that would come out larger is refused. undo: true puts the last original back.",inputSchema:gS,outputSchema:SS,annotations:{...po,destructiveHint:!0}},r=>LS(r,e.clip)),t.registerTool("forge_pdf",{title:"PDF page operations",description:"merge (two or more PDFs, in order), split, extract, delete or rotate pages. Writes new files beside the source and never edits the original. Password-protected PDFs are refused.",inputSchema:_S,outputSchema:Gn,annotations:po},r=>DS(r)),t.registerTool("forge_palette",{title:"Colours of an image",description:"An image's main colours, most of the image first, each as hex, rgb and OKLCH with its share. With inside, the shades that one colour is made of. svg: true also returns them as an SVG card of swatches; copy: true puts that card on the user's clipboard to paste into Figma. Writes no file.",inputSchema:bS,outputSchema:$S,annotations:bd},r=>ZS(r,e.clip)),t.registerTool("forge_scale",{title:"Tonal scale",description:"A 50\u2013950 tonal scale built in OKLCH with the given colour at 500, each step with its contrast against white and black text. svg: true also returns it as an SVG card of swatches; copy: true puts that card on the user's clipboard to paste into Figma. Writes no file.",inputSchema:zS,outputSchema:wS,annotations:bd},r=>US(r,e.clip)),t.registerTool("forge_card",{title:"Colour card for Figma",description:"Named colours drawn as an SVG card of swatches, returned as text. Paste into Figma, it is one layer per colour, named as given, with its exact fill. copy: true puts it on the user's clipboard instead of returning it, so they can press \u2318V (Ctrl+V) in Figma straight away. Use it to turn a colour system written in words into something the user can paste. Writes no file.",inputSchema:RS,annotations:bd},r=>FS(r,e.clip)),t.registerTool("forge_transcribe",{title:"Transcribe a recording",description:"What is said in a video or sound file, or a YouTube link, on this computer: a summary and notes (where Apple Intelligence is on) and the transcript. Use it whenever you need to know what a recording, meeting, lecture or video says, since you cannot listen to it. Writes a Markdown file beside the source (Word, PDF or text with format) and returns its text. A long recording takes minutes; progress says how far it has heard. Nothing is overwritten unless overwrite: true.",inputSchema:ES,annotations:{...po,openWorldHint:!0}},(r,o)=>vd(r,HS(o),{...e.folder?{folder:e.folder}:{},...e.readLimitMs?{readLimitMs:e.readLimitMs}:{}})),t.registerTool("forge_read_text",{title:"Read the text in a picture or PDF",description:"The text in a picture, screenshot, scan, photo of a page or whiteboard, or PDF, read on this computer, with headings, lists and tables kept, in Latin, Cyrillic, Chinese, Japanese, Korean, Arabic, Devanagari or Thai script. Use it when you cannot read an image's text yourself or a PDF is scanned. Writes a Markdown file beside it (Word, PDF or text with format) and returns its text. Nothing is overwritten unless overwrite: true.",inputSchema:TS,annotations:po},(r,o)=>VS(r,HS(o),{...e.readLimitMs?{readLimitMs:e.readLimitMs}:{}})),t}async function OC(e){if(e.length>0)throw st(`forge mcp takes no arguments, got: ${e.join(" ")}.`,"Register it with your agent, for example: claude mcp add forge -- forge mcp");let t=CS();Yd(()=>{},{graceful:[]}),process.stdin.once("end",()=>{Xd()});let r=process.stdin.pipe(sS(o=>t.write(o)));await n$().connect(new oS(r,t))}export{o$ as INSTRUCTIONS,n$ as createForgeServer,r$ as instructionsFor,OC as runMcpServer};
|