flowpad-mcp-local 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +30 -0
  2. package/dist/index.js +116 -0
  3. package/package.json +31 -0
package/dist/index.js ADDED
@@ -0,0 +1,116 @@
1
+ #!/usr/bin/env node
2
+ var Ew=Object.create;var cc=Object.defineProperty;var Iw=Object.getOwnPropertyDescriptor;var Zw=Object.getOwnPropertyNames;var Rw=Object.getPrototypeOf,Ow=Object.prototype.hasOwnProperty;var Bs=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vo=(e,t)=>{for(var r in t)cc(e,r,{get:t[r],enumerable:!0})},Nw=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Zw(t))!Ow.call(e,o)&&o!==r&&cc(e,o,{get:()=>t[o],enumerable:!(n=Iw(t,o))||n.enumerable});return e};var Bf=(e,t,r)=>(r=e!=null?Ew(Rw(e)):{},Nw(t||!e||!e.__esModule?cc(r,"default",{value:e,enumerable:!0}):r,e));var Yf=E((NA,rr)=>{var uc=Bs("fs"),Js=Bs("path"),jw=Bs("os"),Cw=Bs("crypto"),Jf=["\u25C8 encrypted .env [www.dotenvx.com]","\u25C8 secrets for agents [www.dotenvx.com]","\u2301 auth for agents [www.vestauth.com]","\u2318 custom filepath { path: '/custom/path/.env' }","\u2318 enable debugging { debug: true }","\u2318 override existing { override: true }","\u2318 suppress logs { quiet: true }","\u2318 multiple files { path: ['.env.local', '.env'] }"];function Aw(){return Jf[Math.floor(Math.random()*Jf.length)]}function Sn(e){return typeof e=="string"?!["false","0","no","off",""].includes(e.toLowerCase()):!!e}function Mw(){return process.stdout.isTTY}function Dw(e){return Mw()?`\x1B[2m${e}\x1B[0m`:e}var Lw=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function qw(e){let t={},r=e.toString();r=r.replace(/\r\n?/mg,`
3
+ `);let n;for(;(n=Lw.exec(r))!=null;){let o=n[1],s=n[2]||"";s=s.trim();let i=s[0];s=s.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(s=s.replace(/\\n/g,`
4
+ `),s=s.replace(/\\r/g,"\r")),t[o]=s}return t}function Uw(e){e=e||{};let t=Wf(e);e.path=t;let r=je.configDotenv(e);if(!r.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw i.code="MISSING_DATA",i}let n=Gf(e).split(","),o=n.length,s;for(let i=0;i<o;i++)try{let a=n[i].trim(),c=Vw(r,a);s=je.decrypt(c.ciphertext,c.key);break}catch(a){if(i+1>=o)throw a}return je.parse(s)}function Fw(e){console.error(`\u26A0 ${e}`)}function xo(e){console.log(`\u2506 ${e}`)}function Kf(e){console.log(`\u25C7 ${e}`)}function Gf(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Vw(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let o=r.searchParams.get("environment");if(!o){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let s=`DOTENV_VAULT_${o.toUpperCase()}`,i=e.parsed[s];if(!i){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${s} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:i,key:n}}function Wf(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)uc.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=Js.resolve(process.cwd(),".env.vault");return uc.existsSync(t)?t:null}function Hf(e){return e[0]==="~"?Js.join(jw.homedir(),e.slice(1)):e}function Bw(e){let t=Sn(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),r=Sn(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!r)&&Kf("loading env from encrypted .env.vault");let n=je._parseVault(e),o=process.env;return e&&e.processEnv!=null&&(o=e.processEnv),je.populate(o,n,e),{parsed:n}}function Jw(e){let t=Js.resolve(process.cwd(),".env"),r="utf8",n=process.env;e&&e.processEnv!=null&&(n=e.processEnv);let o=Sn(n.DOTENV_CONFIG_DEBUG||e&&e.debug),s=Sn(n.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?r=e.encoding:o&&xo("no encoding is specified (UTF-8 is used by default)");let i=[t];if(e&&e.path)if(!Array.isArray(e.path))i=[Hf(e.path)];else{i=[];for(let l of e.path)i.push(Hf(l))}let a,c={};for(let l of i)try{let d=je.parse(uc.readFileSync(l,{encoding:r}));je.populate(c,d,e)}catch(d){o&&xo(`failed to load ${l} ${d.message}`),a=d}let u=je.populate(n,c,e);if(o=Sn(n.DOTENV_CONFIG_DEBUG||o),s=Sn(n.DOTENV_CONFIG_QUIET||s),o||!s){let l=Object.keys(u).length,d=[];for(let m of i)try{let f=Js.relative(process.cwd(),m);d.push(f)}catch(f){o&&xo(`failed to load ${m} ${f.message}`),a=f}Kf(`injected env (${l}) from ${d.join(",")} ${Dw(`// tip: ${Aw()}`)}`)}return a?{parsed:c,error:a}:{parsed:c}}function Hw(e){if(Gf(e).length===0)return je.configDotenv(e);let t=Wf(e);return t?je._configVault(e):(Fw(`you set DOTENV_KEY but you are missing a .env.vault file at ${t}`),je.configDotenv(e))}function Kw(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),o=n.subarray(0,12),s=n.subarray(-16);n=n.subarray(12,-16);try{let i=Cw.createDecipheriv("aes-256-gcm",r,o);return i.setAuthTag(s),`${i.update(n)}${i.final()}`}catch(i){let a=i instanceof RangeError,c=i.message==="Invalid key length",u=i.message==="Unsupported state or unable to authenticate data";if(a||c){let l=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw l.code="INVALID_DOTENV_KEY",l}else if(u){let l=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw l.code="DECRYPTION_FAILED",l}else throw i}}function Gw(e,t,r={}){let n=!!(r&&r.debug),o=!!(r&&r.override),s={};if(typeof t!="object"){let i=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw i.code="OBJECT_REQUIRED",i}for(let i of Object.keys(t))Object.prototype.hasOwnProperty.call(e,i)?(o===!0&&(e[i]=t[i],s[i]=t[i]),n&&xo(o===!0?`"${i}" is already defined and WAS overwritten`:`"${i}" is already defined and was NOT overwritten`)):(e[i]=t[i],s[i]=t[i]);return s}var je={configDotenv:Jw,_configVault:Bw,_parseVault:Uw,config:Hw,decrypt:Kw,parse:qw,populate:Gw};rr.exports.configDotenv=je.configDotenv;rr.exports._configVault=je._configVault;rr.exports._parseVault=je._parseVault;rr.exports.config=je.config;rr.exports.decrypt=je.decrypt;rr.exports.parse=je.parse;rr.exports.populate=je.populate;rr.exports=je});var Qf=E((jA,Xf)=>{var qr={};process.env.DOTENV_CONFIG_ENCODING!=null&&(qr.encoding=process.env.DOTENV_CONFIG_ENCODING);process.env.DOTENV_CONFIG_PATH!=null&&(qr.path=process.env.DOTENV_CONFIG_PATH);process.env.DOTENV_CONFIG_QUIET!=null&&(qr.quiet=process.env.DOTENV_CONFIG_QUIET);process.env.DOTENV_CONFIG_DEBUG!=null&&(qr.debug=process.env.DOTENV_CONFIG_DEBUG);process.env.DOTENV_CONFIG_OVERRIDE!=null&&(qr.override=process.env.DOTENV_CONFIG_OVERRIDE);process.env.DOTENV_CONFIG_DOTENV_KEY!=null&&(qr.DOTENV_KEY=process.env.DOTENV_CONFIG_DOTENV_KEY);Xf.exports=qr});var tm=E((CA,em)=>{var Ww=/^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;em.exports=function(t){let r=t.reduce(function(n,o){let s=o.match(Ww);return s&&(n[s[1]]=s[2]),n},{});return"quiet"in r||(r.quiet="true"),r}});var gs=E(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.regexpCode=ie.getEsmExportName=ie.getProperty=ie.safeStringify=ie.stringify=ie.strConcat=ie.addCodeArg=ie.str=ie._=ie.nil=ie._Code=ie.Name=ie.IDENTIFIER=ie._CodeOrName=void 0;var ms=class{};ie._CodeOrName=ms;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var mn=class extends ms{constructor(t){if(super(),!ie.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ie.Name=mn;var Rt=class extends ms{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof mn&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=Rt;ie.nil=new Rt("");function $b(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Fd(r,t[n]),r.push(e[++n]);return new Rt(r)}ie._=$b;var Ud=new Rt("+");function zb(e,...t){let r=[hs(e[0])],n=0;for(;n<t.length;)r.push(Ud),Fd(r,t[n]),r.push(Ud,hs(e[++n]));return bR(r),new Rt(r)}ie.str=zb;function Fd(e,t){t instanceof Rt?e.push(...t._items):t instanceof mn?e.push(t):e.push(wR(t))}ie.addCodeArg=Fd;function bR(e){let t=1;for(;t<e.length-1;){if(e[t]===Ud){let r=$R(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function $R(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof mn||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof mn))return`"${e}${t.slice(1)}`}function zR(e,t){return t.emptyStr()?e:e.emptyStr()?t:zb`${e}${t}`}ie.strConcat=zR;function wR(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:hs(Array.isArray(e)?e.join(","):e)}function kR(e){return new Rt(hs(e))}ie.stringify=kR;function hs(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=hs;function SR(e){return typeof e=="string"&&ie.IDENTIFIER.test(e)?new Rt(`.${e}`):$b`[${e}]`}ie.getProperty=SR;function PR(e){if(typeof e=="string"&&ie.IDENTIFIER.test(e))return new Rt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ie.getEsmExportName=PR;function TR(e){return new Rt(e.toString())}ie.regexpCode=TR});var Jd=E(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.ValueScope=ht.ValueScopeName=ht.Scope=ht.varKinds=ht.UsedValueState=void 0;var mt=gs(),Vd=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},ya;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ya||(ht.UsedValueState=ya={}));ht.varKinds={const:new mt.Name("const"),let:new mt.Name("let"),var:new mt.Name("var")};var va=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof mt.Name?t:this.name(t)}name(t){return new mt.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};ht.Scope=va;var xa=class extends mt.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,mt._)`.${new mt.Name(r)}[${n}]`}};ht.ValueScopeName=xa;var ER=(0,mt._)`\n`,Bd=class extends va{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?ER:mt.nil}}get(){return this._scope}name(t){return new xa(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,mt._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let s=mt.nil;for(let i in t){let a=t[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,ya.Started);let l=r(u);if(l){let d=this.opts.es5?ht.varKinds.var:ht.varKinds.const;s=(0,mt._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,mt._)`${s}${l}${this.opts._n}`;else throw new Vd(u);c.set(u,ya.Completed)})}return s}};ht.ValueScope=Bd});var K=E(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.or=G.and=G.not=G.CodeGen=G.operators=G.varKinds=G.ValueScopeName=G.ValueScope=G.Scope=G.Name=G.regexpCode=G.stringify=G.getProperty=G.nil=G.strConcat=G.str=G._=void 0;var re=gs(),qt=Jd(),Zr=gs();Object.defineProperty(G,"_",{enumerable:!0,get:function(){return Zr._}});Object.defineProperty(G,"str",{enumerable:!0,get:function(){return Zr.str}});Object.defineProperty(G,"strConcat",{enumerable:!0,get:function(){return Zr.strConcat}});Object.defineProperty(G,"nil",{enumerable:!0,get:function(){return Zr.nil}});Object.defineProperty(G,"getProperty",{enumerable:!0,get:function(){return Zr.getProperty}});Object.defineProperty(G,"stringify",{enumerable:!0,get:function(){return Zr.stringify}});Object.defineProperty(G,"regexpCode",{enumerable:!0,get:function(){return Zr.regexpCode}});Object.defineProperty(G,"Name",{enumerable:!0,get:function(){return Zr.Name}});var wa=Jd();Object.defineProperty(G,"Scope",{enumerable:!0,get:function(){return wa.Scope}});Object.defineProperty(G,"ValueScope",{enumerable:!0,get:function(){return wa.ValueScope}});Object.defineProperty(G,"ValueScopeName",{enumerable:!0,get:function(){return wa.ValueScopeName}});Object.defineProperty(G,"varKinds",{enumerable:!0,get:function(){return wa.varKinds}});G.operators={GT:new re._Code(">"),GTE:new re._Code(">="),LT:new re._Code("<"),LTE:new re._Code("<="),EQ:new re._Code("==="),NEQ:new re._Code("!=="),NOT:new re._Code("!"),OR:new re._Code("||"),AND:new re._Code("&&"),ADD:new re._Code("+")};var dr=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Hd=class extends dr{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?qt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=Qn(this.rhs,t,r)),this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}},ba=class extends dr{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof re.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=Qn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof re.Name?{}:{...this.lhs.names};return za(t,this.rhs)}},Kd=class extends ba{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Gd=class extends dr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Wd=class extends dr{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Yd=class extends dr{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Xd=class extends dr{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=Qn(this.code,t,r),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}},_s=class extends dr{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(t,r)||(IR(t,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>_n(t,r.names),{})}},pr=class extends _s{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Qd=class extends _s{},Xn=class extends pr{};Xn.kind="else";var hn=class e extends pr{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Xn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(wb(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=Qn(this.condition,t,r),this}get names(){let t=super.names;return za(t,this.condition),this.else&&_n(t,this.else.names),t}};hn.kind="if";var gn=class extends pr{};gn.kind="for";var ep=class extends gn{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=Qn(this.iteration,t,r),this}get names(){return _n(super.names,this.iteration.names)}},tp=class extends gn{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?qt.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){let t=za(super.names,this.from);return za(t,this.to)}},$a=class extends gn{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=Qn(this.iterable,t,r),this}get names(){return _n(super.names,this.iterable.names)}},ys=class extends pr{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};ys.kind="func";var vs=class extends _s{render(t){return"return "+super.render(t)}};vs.kind="return";var rp=class extends pr{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&_n(t,this.catch.names),this.finally&&_n(t,this.finally.names),t}},xs=class extends pr{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};xs.kind="catch";var bs=class extends pr{render(t){return"finally"+super.render(t)}};bs.kind="finally";var np=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
5
+ `:""},this._extScope=t,this._scope=new qt.Scope({parent:t}),this._nodes=[new Qd]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Hd(t,s,n)),s}const(t,r,n){return this._def(qt.varKinds.const,t,r,n)}let(t,r,n){return this._def(qt.varKinds.let,t,r,n)}var(t,r,n){return this._def(qt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new ba(t,r,n))}add(t,r){return this._leafNode(new Kd(t,G.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==re.nil&&this._leafNode(new Xd(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,re.addCodeArg)(r,o));return r.push("}"),new re._Code(r)}if(t,r,n){if(this._blockNode(new hn(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new hn(t))}else(){return this._elseNode(new Xn)}endIf(){return this._endBlockNode(hn,Xn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new ep(t),r)}forRange(t,r,n,o,s=this.opts.es5?qt.varKinds.var:qt.varKinds.let){let i=this._scope.toName(t);return this._for(new tp(s,i,r,n),()=>o(i))}forOf(t,r,n,o=qt.varKinds.const){let s=this._scope.toName(t);if(this.opts.es5){let i=r instanceof re.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,re._)`${i}.length`,a=>{this.var(s,(0,re._)`${i}[${a}]`),n(s)})}return this._for(new $a("of",o,s,r),()=>n(s))}forIn(t,r,n,o=this.opts.es5?qt.varKinds.var:qt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,re._)`Object.keys(${r})`,n);let s=this._scope.toName(t);return this._for(new $a("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(gn)}label(t){return this._leafNode(new Gd(t))}break(t){return this._leafNode(new Wd(t))}return(t){let r=new vs;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(vs)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new rp;if(this._blockNode(o),this.code(t),r){let s=this.name("e");this._currNode=o.catch=new xs(s),r(s)}return n&&(this._currNode=o.finally=new bs,this.code(n)),this._endBlockNode(xs,bs)}throw(t){return this._leafNode(new Yd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=re.nil,n,o){return this._blockNode(new ys(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(ys)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof hn))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};G.CodeGen=np;function _n(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function za(e,t){return t instanceof re._CodeOrName?_n(e,t.names):e}function Qn(e,t,r){if(e instanceof re.Name)return n(e);if(!o(e))return e;return new re._Code(e._items.reduce((s,i)=>(i instanceof re.Name&&(i=n(i)),i instanceof re._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||t[s.str]!==1?s:(delete t[s.str],i)}function o(s){return s instanceof re._Code&&s._items.some(i=>i instanceof re.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function IR(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function wb(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,re._)`!${op(e)}`}G.not=wb;var ZR=kb(G.operators.AND);function RR(...e){return e.reduce(ZR)}G.and=RR;var OR=kb(G.operators.OR);function NR(...e){return e.reduce(OR)}G.or=NR;function kb(e){return(t,r)=>t===re.nil?r:r===re.nil?t:(0,re._)`${op(t)} ${e} ${op(r)}`}function op(e){return e instanceof re.Name?e:(0,re._)`(${e})`}});var oe=E(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.checkStrictMode=W.getErrorPath=W.Type=W.useFunc=W.setEvaluated=W.evaluatedPropsToName=W.mergeEvaluated=W.eachItem=W.unescapeJsonPointer=W.escapeJsonPointer=W.escapeFragment=W.unescapeFragment=W.schemaRefOrVal=W.schemaHasRulesButRef=W.schemaHasRules=W.checkUnknownRules=W.alwaysValidSchema=W.toHash=void 0;var pe=K(),jR=gs();function CR(e){let t={};for(let r of e)t[r]=!0;return t}W.toHash=CR;function AR(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Tb(e,t),!Eb(t,e.self.RULES.all))}W.alwaysValidSchema=AR;function Tb(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let s in t)o[s]||Rb(e,`unknown keyword: "${s}"`)}W.checkUnknownRules=Tb;function Eb(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}W.schemaHasRules=Eb;function MR(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}W.schemaHasRulesButRef=MR;function DR({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${e}${t}${(0,pe.getProperty)(n)}`}W.schemaRefOrVal=DR;function LR(e){return Ib(decodeURIComponent(e))}W.unescapeFragment=LR;function qR(e){return encodeURIComponent(ip(e))}W.escapeFragment=qR;function ip(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}W.escapeJsonPointer=ip;function Ib(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}W.unescapeJsonPointer=Ib;function UR(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}W.eachItem=UR;function Sb({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof pe.Name?(s instanceof pe.Name?e(o,s,i):t(o,s,i),i):s instanceof pe.Name?(t(o,i,s),s):r(s,i);return a===pe.Name&&!(c instanceof pe.Name)?n(o,c):c}}W.mergeEvaluated={props:Sb({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,pe._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,pe._)`${r} || {}`),ap(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Zb}),items:Sb({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,pe._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,pe._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Zb(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,pe._)`{}`);return t!==void 0&&ap(e,r,t),r}W.evaluatedPropsToName=Zb;function ap(e,t,r){Object.keys(r).forEach(n=>e.assign((0,pe._)`${t}${(0,pe.getProperty)(n)}`,!0))}W.setEvaluated=ap;var Pb={};function FR(e,t){return e.scopeValue("func",{ref:t,code:Pb[t.code]||(Pb[t.code]=new jR._Code(t.code))})}W.useFunc=FR;var sp;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(sp||(W.Type=sp={}));function VR(e,t,r){if(e instanceof pe.Name){let n=t===sp.Num;return r?n?(0,pe._)`"[" + ${e} + "]"`:(0,pe._)`"['" + ${e} + "']"`:n?(0,pe._)`"/" + ${e}`:(0,pe._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(e).toString():"/"+ip(e)}W.getErrorPath=VR;function Rb(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}W.checkStrictMode=Rb});var fr=E(cp=>{"use strict";Object.defineProperty(cp,"__esModule",{value:!0});var Qe=K(),BR={data:new Qe.Name("data"),valCxt:new Qe.Name("valCxt"),instancePath:new Qe.Name("instancePath"),parentData:new Qe.Name("parentData"),parentDataProperty:new Qe.Name("parentDataProperty"),rootData:new Qe.Name("rootData"),dynamicAnchors:new Qe.Name("dynamicAnchors"),vErrors:new Qe.Name("vErrors"),errors:new Qe.Name("errors"),this:new Qe.Name("this"),self:new Qe.Name("self"),scope:new Qe.Name("scope"),json:new Qe.Name("json"),jsonPos:new Qe.Name("jsonPos"),jsonLen:new Qe.Name("jsonLen"),jsonPart:new Qe.Name("jsonPart")};cp.default=BR});var $s=E(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.extendErrors=et.resetErrorsCount=et.reportExtraError=et.reportError=et.keyword$DataError=et.keywordError=void 0;var se=K(),ka=oe(),at=fr();et.keywordError={message:({keyword:e})=>(0,se.str)`must pass "${e}" keyword validation`};et.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,se.str)`"${e}" keyword must be ${t} ($data)`:(0,se.str)`"${e}" keyword is invalid ($data)`};function JR(e,t=et.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,c=jb(e,t,r);n??(i||a)?Ob(s,c):Nb(o,(0,se._)`[${c}]`)}et.reportError=JR;function HR(e,t=et.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=jb(e,t,r);Ob(o,a),s||i||Nb(n,at.default.vErrors)}et.reportExtraError=HR;function KR(e,t){e.assign(at.default.errors,t),e.if((0,se._)`${at.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,se._)`${at.default.vErrors}.length`,t),()=>e.assign(at.default.vErrors,null)))}et.resetErrorsCount=KR;function GR({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,at.default.errors,a=>{e.const(i,(0,se._)`${at.default.vErrors}[${a}]`),e.if((0,se._)`${i}.instancePath === undefined`,()=>e.assign((0,se._)`${i}.instancePath`,(0,se.strConcat)(at.default.instancePath,s.errorPath))),e.assign((0,se._)`${i}.schemaPath`,(0,se.str)`${s.errSchemaPath}/${t}`),s.opts.verbose&&(e.assign((0,se._)`${i}.schema`,r),e.assign((0,se._)`${i}.data`,n))})}et.extendErrors=GR;function Ob(e,t){let r=e.const("err",t);e.if((0,se._)`${at.default.vErrors} === null`,()=>e.assign(at.default.vErrors,(0,se._)`[${r}]`),(0,se._)`${at.default.vErrors}.push(${r})`),e.code((0,se._)`${at.default.errors}++`)}function Nb(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,se._)`new ${e.ValidationError}(${t})`):(r.assign((0,se._)`${n}.errors`,t),r.return(!1))}var yn={keyword:new se.Name("keyword"),schemaPath:new se.Name("schemaPath"),params:new se.Name("params"),propertyName:new se.Name("propertyName"),message:new se.Name("message"),schema:new se.Name("schema"),parentSchema:new se.Name("parentSchema")};function jb(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,se._)`{}`:WR(e,t,r)}function WR(e,t,r={}){let{gen:n,it:o}=e,s=[YR(o,r),XR(e,r)];return QR(e,t,s),n.object(...s)}function YR({errorPath:e},{instancePath:t}){let r=t?(0,se.str)`${e}${(0,ka.getErrorPath)(t,ka.Type.Str)}`:e;return[at.default.instancePath,(0,se.strConcat)(at.default.instancePath,r)]}function XR({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,se.str)`${t}/${e}`;return r&&(o=(0,se.str)`${o}${(0,ka.getErrorPath)(r,ka.Type.Str)}`),[yn.schemaPath,o]}function QR(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([yn.keyword,o],[yn.params,typeof t=="function"?t(e):t||(0,se._)`{}`]),c.messages&&n.push([yn.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([yn.schema,i],[yn.parentSchema,(0,se._)`${l}${d}`],[at.default.data,s]),u&&n.push([yn.propertyName,u])}});var Ab=E(eo=>{"use strict";Object.defineProperty(eo,"__esModule",{value:!0});eo.boolOrEmptySchema=eo.topBoolOrEmptySchema=void 0;var eO=$s(),tO=K(),rO=fr(),nO={message:"boolean schema is false"};function oO(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Cb(e,!1):typeof r=="object"&&r.$async===!0?t.return(rO.default.data):(t.assign((0,tO._)`${n}.errors`,null),t.return(!0))}eo.topBoolOrEmptySchema=oO;function sO(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Cb(e)):r.var(t,!0)}eo.boolOrEmptySchema=sO;function Cb(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,eO.reportError)(o,nO,void 0,t)}});var up=E(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.getRules=to.isJSONType=void 0;var iO=["string","number","integer","boolean","null","object","array"],aO=new Set(iO);function cO(e){return typeof e=="string"&&aO.has(e)}to.isJSONType=cO;function uO(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}to.getRules=uO});var lp=E(Rr=>{"use strict";Object.defineProperty(Rr,"__esModule",{value:!0});Rr.shouldUseRule=Rr.shouldUseGroup=Rr.schemaHasRulesForType=void 0;function lO({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Mb(e,n)}Rr.schemaHasRulesForType=lO;function Mb(e,t){return t.rules.some(r=>Db(e,r))}Rr.shouldUseGroup=Mb;function Db(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}Rr.shouldUseRule=Db});var zs=E(tt=>{"use strict";Object.defineProperty(tt,"__esModule",{value:!0});tt.reportTypeError=tt.checkDataTypes=tt.checkDataType=tt.coerceAndCheckDataType=tt.getJSONTypes=tt.getSchemaTypes=tt.DataType=void 0;var dO=up(),pO=lp(),fO=$s(),J=K(),Lb=oe(),ro;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ro||(tt.DataType=ro={}));function mO(e){let t=qb(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}tt.getSchemaTypes=mO;function qb(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(dO.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}tt.getJSONTypes=qb;function hO(e,t){let{gen:r,data:n,opts:o}=e,s=gO(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&(0,pO.schemaHasRulesForType)(e,t[0]));if(i){let a=pp(t,n,o.strictNumbers,ro.Wrong);r.if(a,()=>{s.length?_O(e,t,s):fp(e)})}return i}tt.coerceAndCheckDataType=hO;var Ub=new Set(["string","number","integer","boolean","null"]);function gO(e,t){return t?e.filter(r=>Ub.has(r)||t==="array"&&r==="array"):[]}function _O(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",(0,J._)`typeof ${o}`),a=n.let("coerced",(0,J._)`undefined`);s.coerceTypes==="array"&&n.if((0,J._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,J._)`${o}[0]`).assign(i,(0,J._)`typeof ${o}`).if(pp(t,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,J._)`${a} !== undefined`);for(let u of r)(Ub.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),fp(e),n.endIf(),n.if((0,J._)`${a} !== undefined`,()=>{n.assign(o,a),yO(e,a)});function c(u){switch(u){case"string":n.elseIf((0,J._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,J._)`"" + ${o}`).elseIf((0,J._)`${o} === null`).assign(a,(0,J._)`""`);return;case"number":n.elseIf((0,J._)`${i} == "boolean" || ${o} === null
6
+ || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,J._)`+${o}`);return;case"integer":n.elseIf((0,J._)`${i} === "boolean" || ${o} === null
7
+ || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,J._)`+${o}`);return;case"boolean":n.elseIf((0,J._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,J._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,J._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,J._)`${i} === "string" || ${i} === "number"
8
+ || ${i} === "boolean" || ${o} === null`).assign(a,(0,J._)`[${o}]`)}}}function yO({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,J._)`${t} !== undefined`,()=>e.assign((0,J._)`${t}[${r}]`,n))}function dp(e,t,r,n=ro.Correct){let o=n===ro.Correct?J.operators.EQ:J.operators.NEQ,s;switch(e){case"null":return(0,J._)`${t} ${o} null`;case"array":s=(0,J._)`Array.isArray(${t})`;break;case"object":s=(0,J._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i((0,J._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return(0,J._)`typeof ${t} ${o} ${e}`}return n===ro.Correct?s:(0,J.not)(s);function i(a=J.nil){return(0,J.and)((0,J._)`typeof ${t} == "number"`,a,r?(0,J._)`isFinite(${t})`:J.nil)}}tt.checkDataType=dp;function pp(e,t,r,n){if(e.length===1)return dp(e[0],t,r,n);let o,s=(0,Lb.toHash)(e);if(s.array&&s.object){let i=(0,J._)`typeof ${t} != "object"`;o=s.null?i:(0,J._)`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=J.nil;s.number&&delete s.integer;for(let i in s)o=(0,J.and)(o,dp(i,t,r,n));return o}tt.checkDataTypes=pp;var vO={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,J._)`{type: ${e}}`:(0,J._)`{type: ${t}}`};function fp(e){let t=xO(e);(0,fO.reportError)(t,vO)}tt.reportTypeError=fp;function xO(e){let{gen:t,data:r,schema:n}=e,o=(0,Lb.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Vb=E(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.assignDefaults=void 0;var no=K(),bO=oe();function $O(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Fb(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Fb(e,s,o.default))}Sa.assignDefaults=$O;function Fb(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=(0,no._)`${s}${(0,no.getProperty)(t)}`;if(o){(0,bO.checkStrictMode)(e,`default is ignored for: ${a}`);return}let c=(0,no._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,no._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,no._)`${a} = ${(0,no.stringify)(r)}`)}});var Ot=E(de=>{"use strict";Object.defineProperty(de,"__esModule",{value:!0});de.validateUnion=de.validateArray=de.usePattern=de.callValidateCode=de.schemaProperties=de.allSchemaProperties=de.noPropertyInData=de.propertyInData=de.isOwnProperty=de.hasPropFunc=de.reportMissingProp=de.checkMissingProp=de.checkReportMissingProp=void 0;var be=K(),mp=oe(),Or=fr(),zO=oe();function wO(e,t){let{gen:r,data:n,it:o}=e;r.if(gp(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,be._)`${t}`},!0),e.error()})}de.checkReportMissingProp=wO;function kO({gen:e,data:t,it:{opts:r}},n,o){return(0,be.or)(...n.map(s=>(0,be.and)(gp(e,t,s,r.ownProperties),(0,be._)`${o} = ${s}`)))}de.checkMissingProp=kO;function SO(e,t){e.setParams({missingProperty:t},!0),e.error()}de.reportMissingProp=SO;function Bb(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,be._)`Object.prototype.hasOwnProperty`})}de.hasPropFunc=Bb;function hp(e,t,r){return(0,be._)`${Bb(e)}.call(${t}, ${r})`}de.isOwnProperty=hp;function PO(e,t,r,n){let o=(0,be._)`${t}${(0,be.getProperty)(r)} !== undefined`;return n?(0,be._)`${o} && ${hp(e,t,r)}`:o}de.propertyInData=PO;function gp(e,t,r,n){let o=(0,be._)`${t}${(0,be.getProperty)(r)} === undefined`;return n?(0,be.or)(o,(0,be.not)(hp(e,t,r))):o}de.noPropertyInData=gp;function Jb(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}de.allSchemaProperties=Jb;function TO(e,t){return Jb(t).filter(r=>!(0,mp.alwaysValidSchema)(e,t[r]))}de.schemaProperties=TO;function EO({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,be._)`${e}, ${t}, ${n}${o}`:t,d=[[Or.default.instancePath,(0,be.strConcat)(Or.default.instancePath,s)],[Or.default.parentData,i.parentData],[Or.default.parentDataProperty,i.parentDataProperty],[Or.default.rootData,Or.default.rootData]];i.opts.dynamicRef&&d.push([Or.default.dynamicAnchors,Or.default.dynamicAnchors]);let m=(0,be._)`${l}, ${r.object(...d)}`;return c!==be.nil?(0,be._)`${a}.call(${c}, ${m})`:(0,be._)`${a}(${m})`}de.callValidateCode=EO;var IO=(0,be._)`new RegExp`;function ZO({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,be._)`${o.code==="new RegExp"?IO:(0,zO.useFunc)(e,o)}(${r}, ${n})`})}de.usePattern=ZO;function RO(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let c=t.const("len",(0,be._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:mp.Type.Num},s),t.if((0,be.not)(s),a)})}}de.validateArray=RO;function OO(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,mp.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);t.assign(i,(0,be._)`${i} || ${a}`),e.mergeValidEvaluated(l,a)||t.if((0,be.not)(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}de.validateUnion=OO});var Gb=E(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.validateKeywordUsage=Yt.validSchemaType=Yt.funcKeywordCode=Yt.macroKeywordCode=void 0;var ct=K(),vn=fr(),NO=Ot(),jO=$s();function CO(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),c=Kb(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");e.subschema({schema:a,schemaPath:ct.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}Yt.macroKeywordCode=CO;function AO(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=e;DO(c,t);let u=!a&&t.compile?t.compile.call(c.self,s,i,c):t.validate,l=Kb(n,o,u),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1)h(),t.modifying&&Hb(e),_(()=>e.error());else{let z=t.async?f():p();t.modifying&&Hb(e),_(()=>MO(e,z))}}function f(){let z=n.let("ruleErrs",null);return n.try(()=>h((0,ct._)`await `),g=>n.assign(d,!1).if((0,ct._)`${g} instanceof ${c.ValidationError}`,()=>n.assign(z,(0,ct._)`${g}.errors`),()=>n.throw(g))),z}function p(){let z=(0,ct._)`${l}.errors`;return n.assign(z,null),h(ct.nil),z}function h(z=t.async?(0,ct._)`await `:ct.nil){let g=c.opts.passContext?vn.default.this:vn.default.self,w=!("compile"in t&&!a||t.schema===!1);n.assign(d,(0,ct._)`${z}${(0,NO.callValidateCode)(e,l,g,w)}`,t.modifying)}function _(z){var g;n.if((0,ct.not)((g=t.valid)!==null&&g!==void 0?g:d),z)}}Yt.funcKeywordCode=AO;function Hb(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,ct._)`${n.parentData}[${n.parentDataProperty}]`))}function MO(e,t){let{gen:r}=e;r.if((0,ct._)`Array.isArray(${t})`,()=>{r.assign(vn.default.vErrors,(0,ct._)`${vn.default.vErrors} === null ? ${t} : ${vn.default.vErrors}.concat(${t})`).assign(vn.default.errors,(0,ct._)`${vn.default.vErrors}.length`),(0,jO.extendErrors)(e)},()=>e.error())}function DO({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Kb(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ct.stringify)(r)})}function LO(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}Yt.validSchemaType=LO;function qO({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(e,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Yt.validateKeywordUsage=qO});var Yb=E(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.extendSubschemaMode=Nr.extendSubschemaData=Nr.getSubschema=void 0;var Xt=K(),Wb=oe();function UO(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:(0,Xt._)`${e.schemaPath}${(0,Xt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:(0,Xt._)`${e.schemaPath}${(0,Xt.getProperty)(t)}${(0,Xt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Wb.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Nr.getSubschema=UO;function FO(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=a.let("data",(0,Xt._)`${t.data}${(0,Xt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,Xt.str)`${u}${(0,Wb.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,Xt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof Xt.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(e.propertyName=i)}s&&(e.dataTypes=s);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}Nr.extendSubschemaData=FO;function VO(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),s!==void 0&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r}Nr.extendSubschemaMode=VO});var _p=E((PU,Xb)=>{"use strict";Xb.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var e$=E((TU,Qb)=>{"use strict";var jr=Qb.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Pa(t,n,o,e,"",e)};jr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};jr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};jr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};jr.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 Pa(e,t,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in jr.arrayKeywords)for(var m=0;m<d.length;m++)Pa(e,t,r,d[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in jr.propsKeywords){if(d&&typeof d=="object")for(var f in d)Pa(e,t,r,d[f],o+"/"+l+"/"+BO(f),s,o,l,n,f)}else(l in jr.keywords||e.allKeys&&!(l in jr.skipKeywords))&&Pa(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function BO(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var ws=E(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.getSchemaRefs=gt.resolveUrl=gt.normalizeId=gt._getFullPath=gt.getFullPath=gt.inlineRef=void 0;var JO=oe(),HO=_p(),KO=e$(),GO=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function WO(e,t=!0){return typeof e=="boolean"?!0:t===!0?!yp(e):t?t$(e)<=t:!1}gt.inlineRef=WO;var YO=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function yp(e){for(let t in e){if(YO.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(yp)||typeof r=="object"&&yp(r))return!0}return!1}function t$(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!GO.has(r)&&(typeof e[r]=="object"&&(0,JO.eachItem)(e[r],n=>t+=t$(n)),t===1/0))return 1/0}return t}function r$(e,t="",r){r!==!1&&(t=oo(t));let n=e.parse(t);return n$(e,n)}gt.getFullPath=r$;function n$(e,t){return e.serialize(t).split("#")[0]+"#"}gt._getFullPath=n$;var XO=/#\/?$/;function oo(e){return e?e.replace(XO,""):""}gt.normalizeId=oo;function QO(e,t,r){return r=oo(r),e.resolve(t,r)}gt.resolveUrl=QO;var eN=/^[a-z_][-a-z0-9._]*$/i;function tN(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=oo(e[r]||t),s={"":o},i=r$(n,o,!1),a={},c=new Set;return KO(e,{allKeys:!0},(d,m,f,p)=>{if(p===void 0)return;let h=i+m,_=s[p];typeof d[r]=="string"&&(_=z.call(this,d[r])),g.call(this,d.$anchor),g.call(this,d.$dynamicAnchor),s[m]=_;function z(w){let k=this.opts.uriResolver.resolve;if(w=oo(_?k(_,w):w),c.has(w))throw l(w);c.add(w);let I=this.refs[w];return typeof I=="string"&&(I=this.refs[I]),typeof I=="object"?u(d,I.schema,w):w!==oo(h)&&(w[0]==="#"?(u(d,a[w],w),a[w]=d):this.refs[w]=h),w}function g(w){if(typeof w=="string"){if(!eN.test(w))throw new Error(`invalid anchor "${w}"`);z.call(this,`#${w}`)}}}),a;function u(d,m,f){if(m!==void 0&&!HO(d,m))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}gt.getSchemaRefs=tN});var Ps=E(Cr=>{"use strict";Object.defineProperty(Cr,"__esModule",{value:!0});Cr.getData=Cr.KeywordCxt=Cr.validateFunctionCode=void 0;var c$=Ab(),o$=zs(),xp=lp(),Ta=zs(),rN=Vb(),Ss=Gb(),vp=Yb(),M=K(),V=fr(),nN=ws(),mr=oe(),ks=$s();function oN(e){if(d$(e)&&(p$(e),l$(e))){aN(e);return}u$(e,()=>(0,c$.topBoolOrEmptySchema)(e))}Cr.validateFunctionCode=oN;function u$({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,(0,M._)`${V.default.data}, ${V.default.valCxt}`,n.$async,()=>{e.code((0,M._)`"use strict"; ${s$(r,o)}`),iN(e,o),e.code(s)}):e.func(t,(0,M._)`${V.default.data}, ${sN(o)}`,n.$async,()=>e.code(s$(r,o)).code(s))}function sN(e){return(0,M._)`{${V.default.instancePath}="", ${V.default.parentData}, ${V.default.parentDataProperty}, ${V.default.rootData}=${V.default.data}${e.dynamicRef?(0,M._)`, ${V.default.dynamicAnchors}={}`:M.nil}}={}`}function iN(e,t){e.if(V.default.valCxt,()=>{e.var(V.default.instancePath,(0,M._)`${V.default.valCxt}.${V.default.instancePath}`),e.var(V.default.parentData,(0,M._)`${V.default.valCxt}.${V.default.parentData}`),e.var(V.default.parentDataProperty,(0,M._)`${V.default.valCxt}.${V.default.parentDataProperty}`),e.var(V.default.rootData,(0,M._)`${V.default.valCxt}.${V.default.rootData}`),t.dynamicRef&&e.var(V.default.dynamicAnchors,(0,M._)`${V.default.valCxt}.${V.default.dynamicAnchors}`)},()=>{e.var(V.default.instancePath,(0,M._)`""`),e.var(V.default.parentData,(0,M._)`undefined`),e.var(V.default.parentDataProperty,(0,M._)`undefined`),e.var(V.default.rootData,V.default.data),t.dynamicRef&&e.var(V.default.dynamicAnchors,(0,M._)`{}`)})}function aN(e){let{schema:t,opts:r,gen:n}=e;u$(e,()=>{r.$comment&&t.$comment&&m$(e),pN(e),n.let(V.default.vErrors,null),n.let(V.default.errors,0),r.unevaluated&&cN(e),f$(e),hN(e)})}function cN(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,M._)`${r}.evaluated`),t.if((0,M._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,M._)`${e.evaluated}.props`,(0,M._)`undefined`)),t.if((0,M._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,M._)`${e.evaluated}.items`,(0,M._)`undefined`))}function s$(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,M._)`/*# sourceURL=${r} */`:M.nil}function uN(e,t){if(d$(e)&&(p$(e),l$(e))){lN(e,t);return}(0,c$.boolOrEmptySchema)(e,t)}function l$({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function d$(e){return typeof e.schema!="boolean"}function lN(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&m$(e),fN(e),mN(e);let s=n.const("_errs",V.default.errors);f$(e,s),n.var(t,(0,M._)`${s} === ${V.default.errors}`)}function p$(e){(0,mr.checkUnknownRules)(e),dN(e)}function f$(e,t){if(e.opts.jtd)return i$(e,[],!1,t);let r=(0,o$.getSchemaTypes)(e.schema),n=(0,o$.coerceAndCheckDataType)(e,r);i$(e,r,!n,t)}function dN(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,mr.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function pN(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,mr.checkStrictMode)(e,"default is ignored in the schema root")}function fN(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,nN.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function mN(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function m$({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code((0,M._)`${V.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,M.str)`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code((0,M._)`${V.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function hN(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if((0,M._)`${V.default.errors} === 0`,()=>t.return(V.default.data),()=>t.throw((0,M._)`new ${o}(${V.default.vErrors})`)):(t.assign((0,M._)`${n}.errors`,V.default.vErrors),s.unevaluated&&gN(e),t.return((0,M._)`${V.default.errors} === 0`))}function gN({gen:e,evaluated:t,props:r,items:n}){r instanceof M.Name&&e.assign((0,M._)`${t}.props`,r),n instanceof M.Name&&e.assign((0,M._)`${t}.items`,n)}function i$(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=e,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,mr.schemaHasRulesButRef)(s,l))){o.block(()=>g$(e,"$ref",l.all.$ref.definition));return}c.jtd||_N(e,t),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,xp.shouldUseGroup)(s,m)&&(m.type?(o.if((0,Ta.checkDataType)(m.type,i,c.strictNumbers)),a$(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,Ta.reportTypeError)(e)),o.endIf()):a$(e,m),a||o.if((0,M._)`${V.default.errors} === ${n||0}`))}}function a$(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,rN.assignDefaults)(e,t.type),r.block(()=>{for(let s of t.rules)(0,xp.shouldUseRule)(n,s)&&g$(e,s.keyword,s.definition,t.type)})}function _N(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(yN(e,t),e.opts.allowUnionTypes||vN(e,t),xN(e,e.dataTypes))}function yN(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{h$(e.dataTypes,r)||bp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),$N(e,t)}}function vN(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&bp(e,"use allowUnionTypes to allow union type keyword")}function xN(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,xp.shouldUseRule)(e.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>bN(t,i))&&bp(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function bN(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function h$(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function $N(e,t){let r=[];for(let n of e.dataTypes)h$(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function bp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,mr.checkStrictMode)(e,t,e.opts.strictTypes)}var Ea=class{constructor(t,r,n){if((0,Ss.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,mr.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",_$(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Ss.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=t.gen.const("_errs",V.default.errors))}result(t,r,n){this.failResult((0,M.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,M.not)(t),void 0,r)}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:r}=this;this.fail((0,M._)`${r} !== undefined && (${(0,M.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?ks.reportExtraError:ks.reportError)(this,this.def.error,r)}$dataError(){(0,ks.reportError)(this,this.def.$dataError||ks.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ks.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=M.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=M.nil,r=M.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,M.or)((0,M._)`${o} === undefined`,r)),t!==M.nil&&n.assign(t,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==M.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,M.or)(i(),a());function i(){if(n.length){if(!(r instanceof M.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,M._)`${(0,Ta.checkDataTypes)(c,r,s.opts.strictNumbers,Ta.DataType.Wrong)}`}return M.nil}function a(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,M._)`!${c}(${r})`}return M.nil}}subschema(t,r){let n=(0,vp.getSubschema)(this.it,t);(0,vp.extendSubschemaData)(n,this.it,t),(0,vp.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return uN(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=mr.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=mr.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,M.Name)),!0}};Cr.KeywordCxt=Ea;function g$(e,t,r,n){let o=new Ea(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Ss.funcKeywordCode)(o,r):"macro"in r?(0,Ss.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Ss.funcKeywordCode)(o,r)}var zN=/^\/(?:[^~]|~0|~1)*$/,wN=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function _$(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return V.default.rootData;if(e[0]==="/"){if(!zN.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=V.default.rootData}else{let u=wN.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,M._)`${s}${(0,M.getProperty)((0,mr.unescapeJsonPointer)(u))}`,i=(0,M._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}Cr.getData=_$});var Ia=E(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var $p=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};zp.default=$p});var Ts=E(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});var wp=ws(),kp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,wp.resolveUrl)(t,r,n),this.missingSchema=(0,wp.normalizeId)((0,wp.getFullPath)(t,this.missingRef))}};Sp.default=kp});var Ra=E(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.resolveSchema=Nt.getCompilingSchema=Nt.resolveRef=Nt.compileSchema=Nt.SchemaEnv=void 0;var Ut=K(),kN=Ia(),xn=fr(),Ft=ws(),y$=oe(),SN=Ps(),so=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,Ft.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};Nt.SchemaEnv=so;function Tp(e){let t=v$.call(this,e);if(t)return t;let r=(0,Ft.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new Ut.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;e.$async&&(a=i.scopeValue("Error",{ref:kN.default,code:(0,Ut._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");e.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:xn.default.data,parentData:xn.default.parentData,parentDataProperty:xn.default.parentDataProperty,dataNames:[xn.default.data],dataPathArr:[Ut.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Ut.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Ut.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Ut._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,SN.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(xn.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${xn.default.self}`,`${xn.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:p,items:h}=u;f.evaluated={props:p instanceof Ut.Name?void 0:p,items:h instanceof Ut.Name?void 0:h,dynamicProps:p instanceof Ut.Name,dynamicItems:h instanceof Ut.Name},f.source&&(f.source.evaluated=(0,Ut.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}Nt.compileSchema=Tp;function PN(e,t,r){var n;r=(0,Ft.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=IN.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new so({schema:i,schemaId:a,root:e,baseId:t}))}if(s!==void 0)return e.refs[r]=TN.call(this,s)}Nt.resolveRef=PN;function TN(e){return(0,Ft.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:Tp.call(this,e)}function v$(e){for(let t of this._compilations)if(EN(t,e))return t}Nt.getCompilingSchema=v$;function EN(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function IN(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Za.call(this,e,t)}function Za(e,t){let r=this.opts.uriResolver.parse(t),n=(0,Ft._getFullPath)(this.opts.uriResolver,r),o=(0,Ft.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return Pp.call(this,r,e);let s=(0,Ft.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Za.call(this,e,i);return typeof a?.schema!="object"?void 0:Pp.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Tp.call(this,i),s===(0,Ft.normalizeId)(t)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,Ft.resolveUrl)(this.opts.uriResolver,o,u)),new so({schema:a,schemaId:c,root:e,baseId:o})}return Pp.call(this,r,i)}}Nt.resolveSchema=Za;var ZN=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Pp(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,y$.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!ZN.has(a)&&u&&(t=(0,Ft.resolveUrl)(this.opts.uriResolver,t,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,y$.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Ft.resolveUrl)(this.opts.uriResolver,t,r.$ref);s=Za.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new so({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s}});var x$=E((NU,RN)=>{RN.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}});var Zp=E((jU,S$)=>{"use strict";var ON=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),$$=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),Ep=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),z$=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),NN=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Ip(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var jN=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function b$(e){return e.length=0,!0}function CN(e,t,r){if(e.length){let n=Ip(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function AN(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=CN;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(s=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=b$}else{o.push(u);continue}}return o.length&&(a===b$?r.zone=o.join(""):i?n.push(o.join("")):n.push(Ip(o))),r.address=n.join(""),r}function w$(e){if(MN(e,":")<2)return{host:e,isIPV6:!1};let t=AN(e);if(t.error)return{host:e,isIPV6:!1};{let r=t.address,n=t.address;return t.zone&&(r+="%"+t.zone,n+="%25"+t.zone),{host:r,isIPV6:!0,escapedHost:n}}}function MN(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function DN(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&(t[1]==="."||t[1]==="/")){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var LN={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},qN=/[@/?#:]/g,UN=/[@/?#]/g;function k$(e,t){let r=t?UN:qN;return r.lastIndex=0,e.replace(r,n=>LN[n])}function FN(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Ep(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));t&&z$(i)?r+=i:r+="%"+s,n+=2;continue}}r+=e[n]}return r}function VN(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Ep(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));s!=="."&&z$(s)?t+=s:t+="%"+o,r+=2;continue}}NN(e[r])?t+=e[r]:t+=escape(e[r])}return t}function BN(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(Ep(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function JN(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!$$(r)){let n=w$(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=k$(r,!1)}t.push(r)}return(typeof e.port=="number"||typeof e.port=="string")&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0}S$.exports={nonSimpleDomain:jN,recomposeAuthority:JN,reescapeHostDelimiters:k$,normalizePercentEncoding:FN,normalizePathEncoding:VN,escapePreservingEscapes:BN,removeDotSegments:DN,isIPv4:$$,isUUID:ON,normalizeIPv6:w$,stringArrayToHexStripped:Ip}});var Z$=E((CU,I$)=>{"use strict";var{isUUID:HN}=Zp(),KN=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,GN=["http","https","ws","wss","urn","urn:uuid"];function WN(e){return GN.indexOf(e)!==-1}function Rp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function P$(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function T$(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function YN(e){return e.secure=Rp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function XN(e){if((e.port===(Rp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function QN(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(KN);if(r){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=Op(o);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function ej(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=Op(o);s&&(e=s.serialize(e,t));let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function tj(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!HN(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function rj(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var E$={scheme:"http",domainHost:!0,parse:P$,serialize:T$},nj={scheme:"https",domainHost:E$.domainHost,parse:P$,serialize:T$},Oa={scheme:"ws",domainHost:!0,parse:YN,serialize:XN},oj={scheme:"wss",domainHost:Oa.domainHost,parse:Oa.parse,serialize:Oa.serialize},sj={scheme:"urn",parse:QN,serialize:ej,skipNormalize:!0},ij={scheme:"urn:uuid",parse:tj,serialize:rj,skipNormalize:!0},Na={http:E$,https:nj,ws:Oa,wss:oj,urn:sj,"urn:uuid":ij};Object.setPrototypeOf(Na,null);function Op(e){return e&&(Na[e]||Na[e.toLowerCase()])||void 0}I$.exports={wsIsSecure:Rp,SCHEMES:Na,isValidSchemeName:WN,getSchemeHandler:Op}});var A$=E((AU,ja)=>{"use strict";var{normalizeIPv6:aj,removeDotSegments:Es,recomposeAuthority:cj,normalizePercentEncoding:uj,normalizePathEncoding:lj,escapePreservingEscapes:dj,reescapeHostDelimiters:pj,isIPv4:fj,nonSimpleDomain:mj}=Zp(),{SCHEMES:hj,getSchemeHandler:O$}=Z$();function gj(e,t){return typeof e=="string"?e=bj(e,t):typeof e=="object"&&(e=io(bn(e,t),t)),e}function _j(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=N$(io(e,n),io(t,n),n,!0);return n.skipEscape=!0,bn(o,n)}function N$(e,t,r,n){let o={};return n||(e=io(bn(e,r),r),t=io(bn(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Es(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Es(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Es(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=Es(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function yj(e,t,r){let n=R$(e,r),o=R$(t,r);return n!==void 0&&o!==void 0&&n.toLowerCase()===o.toLowerCase()}function bn(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[],s=O$(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=uj(r.path):(r.path=dj(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let i=cj(r);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=Es(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var vj=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function xj(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function j$(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let i=e.match(vj);if(i){n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]);let a=xj(n,i);if(a!==void 0&&(n.error=n.error||a,o=!0),n.host)if(fj(n.host)===!1){let l=aj(n.host);n.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let c=O$(r.scheme||n.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&n.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&mj(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(u){n.error=n.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=pj(unescape(n.host),s))),n.path&&(n.path=lj(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}c&&c.parse&&c.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o}}function io(e,t){return j$(e,t).parsed}function bj(e,t){return C$(e,t).normalized}function C$(e,t){let{parsed:r,malformedAuthorityOrPort:n}=j$(e,t);return{normalized:n?e:bn(r,t),malformedAuthorityOrPort:n}}function R$(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:n}=C$(e,t);return n?void 0:r}if(typeof e=="object")return bn(e,t)}var Np={SCHEMES:hj,normalize:gj,resolve:_j,resolveComponent:N$,equal:yj,serialize:bn,parse:io};ja.exports=Np;ja.exports.default=Np;ja.exports.fastUri=Np});var D$=E(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var M$=A$();M$.code='require("ajv/dist/runtime/uri").default';jp.default=M$});var H$=E(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.CodeGen=We.Name=We.nil=We.stringify=We.str=We._=We.KeywordCxt=void 0;var $j=Ps();Object.defineProperty(We,"KeywordCxt",{enumerable:!0,get:function(){return $j.KeywordCxt}});var ao=K();Object.defineProperty(We,"_",{enumerable:!0,get:function(){return ao._}});Object.defineProperty(We,"str",{enumerable:!0,get:function(){return ao.str}});Object.defineProperty(We,"stringify",{enumerable:!0,get:function(){return ao.stringify}});Object.defineProperty(We,"nil",{enumerable:!0,get:function(){return ao.nil}});Object.defineProperty(We,"Name",{enumerable:!0,get:function(){return ao.Name}});Object.defineProperty(We,"CodeGen",{enumerable:!0,get:function(){return ao.CodeGen}});var zj=Ia(),V$=Ts(),wj=up(),Is=Ra(),kj=K(),Zs=ws(),Ca=zs(),Ap=oe(),L$=x$(),Sj=D$(),B$=(e,t)=>new RegExp(e,t);B$.code="new RegExp";var Pj=["removeAdditional","useDefaults","coerceTypes"],Tj=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Ej={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."},Ij={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},q$=200;function Zj(e){var t,r,n,o,s,i,a,c,u,l,d,m,f,p,h,_,z,g,w,k,I,Le,rt,gr,ic;let yo=e.strict,ac=(t=e.code)===null||t===void 0?void 0:t.optimize,Ff=ac===!0||ac===void 0?1:ac||0,Vf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:B$,Tw=(o=e.uriResolver)!==null&&o!==void 0?o:Sj.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:yo)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=e.strictNumbers)!==null&&a!==void 0?a:yo)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:yo)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:yo)!==null&&m!==void 0?m:"log",strictRequired:(p=(f=e.strictRequired)!==null&&f!==void 0?f:yo)!==null&&p!==void 0?p:!1,code:e.code?{...e.code,optimize:Ff,regExp:Vf}:{optimize:Ff,regExp:Vf},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:q$,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:q$,meta:(z=e.meta)!==null&&z!==void 0?z:!0,messages:(g=e.messages)!==null&&g!==void 0?g:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(k=e.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(I=e.addUsedSchema)!==null&&I!==void 0?I:!0,validateSchema:(Le=e.validateSchema)!==null&&Le!==void 0?Le:!0,validateFormats:(rt=e.validateFormats)!==null&&rt!==void 0?rt:!0,unicodeRegExp:(gr=e.unicodeRegExp)!==null&&gr!==void 0?gr:!0,int32range:(ic=e.int32range)!==null&&ic!==void 0?ic:!0,uriResolver:Tw}}var Rs=class{constructor(t={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...Zj(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new kj.ValueScope({scope:{},prefixes:Tj,es5:r,lines:n}),this.logger=Aj(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,wj.getRules)(),U$.call(this,Ej,t,"NOT SUPPORTED"),U$.call(this,Ij,t,"DEPRECATED","warn"),this._metaOpts=jj.call(this),t.formats&&Oj.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Nj.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Rj.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=L$;n==="id"&&(o={...L$},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,t,r);async function o(l,d){await s.call(this,l.$schema);let m=this._addSchema(l,d);return m.validate||i.call(this,m)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof V$.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let i of t)this.addSchema(i,void 0,n,o);return this}let s;if(typeof t=="object"){let{schemaId:i}=this.opts;if(s=t[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Zs.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,t);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(t){let r;for(;typeof(r=F$.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Is.SchemaEnv({schema:{},schemaId:n});if(r=Is.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=F$.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,Zs.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Dj.call(this,n,r),!r)return(0,Ap.eachItem)(n,s=>Cp.call(this,s)),this;qj.call(this,r);let o={...r,type:(0,Ca.getJSONTypes)(r.type),schemaType:(0,Ca.getJSONTypes)(r.schemaType)};return(0,Ap.eachItem)(n,o.type.length===0?s=>Cp.call(this,s,o):s=>o.type.forEach(i=>Cp.call(this,s,o,i))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let s=o.split("/").slice(1),i=t;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=J$(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof t=="object")i=t[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,Zs.normalizeId)(i||n);let u=Zs.getSchemaRefs.call(this,t,n);return c=new Is.SchemaEnv({schema:t,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):Is.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{Is.compileSchema.call(this,t)}finally{this.opts=r}}};Rs.ValidationError=zj.default;Rs.MissingRefError=V$.default;We.default=Rs;function U$(e,t,r,n="error"){for(let o in e){let s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function F$(e){return e=(0,Zs.normalizeId)(e),this.schemas[e]||this.refs[e]}function Rj(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function Oj(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Nj(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function jj(){let e={...this.opts};for(let t of Pj)delete e[t];return e}var Cj={log(){},warn(){},error(){}};function Aj(e){if(e===!1)return Cj;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var Mj=/^[a-z_$][a-z0-9_$:-]*$/i;function Dj(e,t){let{RULES:r}=this;if((0,Ap.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Mj.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Cp(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:(0,Ca.getJSONTypes)(t.type),schemaType:(0,Ca.getJSONTypes)(t.schemaType)}};t.before?Lj.call(this,i,a,t.before):i.rules.push(a),s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Lj(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function qj(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=J$(t)),e.validateSchema=this.compile(t,!0))}var Uj={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function J$(e){return{anyOf:[e,Uj]}}});var K$=E(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var Fj={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Mp.default=Fj});var X$=E($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.callRef=$n.getValidate=void 0;var Vj=Ts(),G$=Ot(),_t=K(),co=fr(),W$=Ra(),Aa=oe(),Bj={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=W$.resolveRef.call(c,u,o,r);if(l===void 0)throw new Vj.default(n.opts.uriResolver,o,r);if(l instanceof W$.SchemaEnv)return m(l);return f(l);function d(){if(s===u)return Ma(e,i,s,s.$async);let p=t.scopeValue("root",{ref:u});return Ma(e,(0,_t._)`${p}.validate`,u,u.$async)}function m(p){let h=Y$(e,p);Ma(e,h,p,p.$async)}function f(p){let h=t.scopeValue("schema",a.code.source===!0?{ref:p,code:(0,_t.stringify)(p)}:{ref:p}),_=t.name("valid"),z=e.subschema({schema:p,dataTypes:[],schemaPath:_t.nil,topSchemaRef:h,errSchemaPath:r},_);e.mergeEvaluated(z),e.ok(_)}}};function Y$(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,_t._)`${r.scopeValue("wrapper",{ref:t})}.validate`}$n.getValidate=Y$;function Ma(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?co.default.this:_t.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let p=o.let("valid");o.try(()=>{o.code((0,_t._)`await ${(0,G$.callValidateCode)(e,t,u)}`),f(t),i||o.assign(p,!0)},h=>{o.if((0,_t._)`!(${h} instanceof ${s.ValidationError})`,()=>o.throw(h)),m(h),i||o.assign(p,!1)}),e.ok(p)}function d(){e.result((0,G$.callValidateCode)(e,t,u),()=>f(t),()=>m(t))}function m(p){let h=(0,_t._)`${p}.errors`;o.assign(co.default.vErrors,(0,_t._)`${co.default.vErrors} === null ? ${h} : ${co.default.vErrors}.concat(${h})`),o.assign(co.default.errors,(0,_t._)`${co.default.vErrors}.length`)}function f(p){var h;if(!s.opts.unevaluated)return;let _=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(s.props=Aa.mergeEvaluated.props(o,_.props,s.props));else{let z=o.var("props",(0,_t._)`${p}.evaluated.props`);s.props=Aa.mergeEvaluated.props(o,z,s.props,_t.Name)}if(s.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(s.items=Aa.mergeEvaluated.items(o,_.items,s.items));else{let z=o.var("items",(0,_t._)`${p}.evaluated.items`);s.items=Aa.mergeEvaluated.items(o,z,s.items,_t.Name)}}}$n.callRef=Ma;$n.default=Bj});var Q$=E(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var Jj=K$(),Hj=X$(),Kj=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Jj.default,Hj.default];Dp.default=Kj});var ez=E(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var Da=K(),Ar=Da.operators,La={maximum:{okStr:"<=",ok:Ar.LTE,fail:Ar.GT},minimum:{okStr:">=",ok:Ar.GTE,fail:Ar.LT},exclusiveMaximum:{okStr:"<",ok:Ar.LT,fail:Ar.GTE},exclusiveMinimum:{okStr:">",ok:Ar.GT,fail:Ar.LTE}},Gj={message:({keyword:e,schemaCode:t})=>(0,Da.str)`must be ${La[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Da._)`{comparison: ${La[e].okStr}, limit: ${t}}`},Wj={keyword:Object.keys(La),type:"number",schemaType:"number",$data:!0,error:Gj,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,Da._)`${r} ${La[t].fail} ${n} || isNaN(${r})`)}};Lp.default=Wj});var tz=E(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var Os=K(),Yj={message:({schemaCode:e})=>(0,Os.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Os._)`{multipleOf: ${e}}`},Xj={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Yj,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?(0,Os._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Os._)`${i} !== parseInt(${i})`;e.fail$data((0,Os._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};qp.default=Xj});var nz=E(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});function rz(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}Up.default=rz;rz.code='require("ajv/dist/runtime/ucs2length").default'});var oz=E(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var zn=K(),Qj=oe(),eC=nz(),tC={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,zn.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,zn._)`{limit: ${e}}`},rC={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:tC,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?zn.operators.GT:zn.operators.LT,i=o.opts.unicode===!1?(0,zn._)`${r}.length`:(0,zn._)`${(0,Qj.useFunc)(e.gen,eC.default)}(${r})`;e.fail$data((0,zn._)`${i} ${s} ${n}`)}};Fp.default=rC});var sz=E(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var nC=Ot(),oC=oe(),uo=K(),sC={message:({schemaCode:e})=>(0,uo.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,uo._)`{pattern: ${e}}`},iC={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:sC,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,uo._)`new RegExp`:(0,oC.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,uo._)`${u}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,uo._)`!${l}`)}else{let c=(0,nC.usePattern)(e,o);e.fail$data((0,uo._)`!${c}.test(${r})`)}}};Vp.default=iC});var iz=E(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var Ns=K(),aC={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Ns.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Ns._)`{limit: ${e}}`},cC={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:aC,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Ns.operators.GT:Ns.operators.LT;e.fail$data((0,Ns._)`Object.keys(${r}).length ${o} ${n}`)}};Bp.default=cC});var az=E(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var js=Ot(),Cs=K(),uC=oe(),lC={message:({params:{missingProperty:e}})=>(0,Cs.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,Cs._)`{missingProperty: ${e}}`},dC={keyword:"required",type:"object",schemaType:"array",$data:!0,error:lC,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=e.parentSchema.properties,{definedProperties:p}=e.it;for(let h of r)if(f?.[h]===void 0&&!p.has(h)){let _=i.schemaEnv.baseId+i.errSchemaPath,z=`required property "${h}" is not defined at "${_}" (strictRequired)`;(0,uC.checkStrictMode)(i,z,i.opts.strictRequired)}}function u(){if(c||s)e.block$data(Cs.nil,d);else for(let f of r)(0,js.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||s){let p=t.let("valid",!0);e.block$data(p,()=>m(f,p)),e.ok(p)}else t.if((0,js.checkMissingProp)(e,r,f)),(0,js.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,js.noPropertyInData)(t,o,f,a.ownProperties),()=>e.error())})}function m(f,p){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(p,(0,js.propertyInData)(t,o,f,a.ownProperties)),t.if((0,Cs.not)(p),()=>{e.error(),t.break()})},Cs.nil)}}};Jp.default=dC});var cz=E(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var As=K(),pC={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,As.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,As._)`{limit: ${e}}`},fC={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:pC,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?As.operators.GT:As.operators.LT;e.fail$data((0,As._)`${r}.length ${o} ${n}`)}};Hp.default=fC});var qa=E(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var uz=_p();uz.code='require("ajv/dist/runtime/equal").default';Kp.default=uz});var lz=E(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var Gp=zs(),Ye=K(),mC=oe(),hC=qa(),gC={message:({params:{i:e,j:t}})=>(0,Ye.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Ye._)`{i: ${e}, j: ${t}}`},_C={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:gC,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let c=t.let("valid"),u=s.items?(0,Gp.getSchemaTypes)(s.items):[];e.block$data(c,l,(0,Ye._)`${i} === false`),e.ok(c);function l(){let p=t.let("i",(0,Ye._)`${r}.length`),h=t.let("j");e.setParams({i:p,j:h}),t.assign(c,!0),t.if((0,Ye._)`${p} > 1`,()=>(d()?m:f)(p,h))}function d(){return u.length>0&&!u.some(p=>p==="object"||p==="array")}function m(p,h){let _=t.name("item"),z=(0,Gp.checkDataTypes)(u,_,a.opts.strictNumbers,Gp.DataType.Wrong),g=t.const("indices",(0,Ye._)`{}`);t.for((0,Ye._)`;${p}--;`,()=>{t.let(_,(0,Ye._)`${r}[${p}]`),t.if(z,(0,Ye._)`continue`),u.length>1&&t.if((0,Ye._)`typeof ${_} == "string"`,(0,Ye._)`${_} += "_"`),t.if((0,Ye._)`typeof ${g}[${_}] == "number"`,()=>{t.assign(h,(0,Ye._)`${g}[${_}]`),e.error(),t.assign(c,!1).break()}).code((0,Ye._)`${g}[${_}] = ${p}`)})}function f(p,h){let _=(0,mC.useFunc)(t,hC.default),z=t.name("outer");t.label(z).for((0,Ye._)`;${p}--;`,()=>t.for((0,Ye._)`${h} = ${p}; ${h}--;`,()=>t.if((0,Ye._)`${_}(${r}[${p}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(z)})))}}};Wp.default=_C});var dz=E(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var Yp=K(),yC=oe(),vC=qa(),xC={message:"must be equal to constant",params:({schemaCode:e})=>(0,Yp._)`{allowedValue: ${e}}`},bC={keyword:"const",$data:!0,error:xC,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;n||s&&typeof s=="object"?e.fail$data((0,Yp._)`!${(0,yC.useFunc)(t,vC.default)}(${r}, ${o})`):e.fail((0,Yp._)`${s} !== ${r}`)}};Xp.default=bC});var pz=E(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var Ms=K(),$C=oe(),zC=qa(),wC={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,Ms._)`{allowedValues: ${e}}`},kC={keyword:"enum",schemaType:"array",$data:!0,error:wC,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,$C.useFunc)(t,zC.default)),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",s);l=(0,Ms.or)(...o.map((p,h)=>m(f,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,f=>t.if((0,Ms._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,p){let h=o[p];return typeof h=="object"&&h!==null?(0,Ms._)`${u()}(${r}, ${f}[${p}])`:(0,Ms._)`${r} === ${h}`}}};Qp.default=kC});var fz=E(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var SC=ez(),PC=tz(),TC=oz(),EC=sz(),IC=iz(),ZC=az(),RC=cz(),OC=lz(),NC=dz(),jC=pz(),CC=[SC.default,PC.default,TC.default,EC.default,IC.default,ZC.default,RC.default,OC.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},NC.default,jC.default];ef.default=CC});var rf=E(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.validateAdditionalItems=void 0;var wn=K(),tf=oe(),AC={message:({params:{len:e}})=>(0,wn.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,wn._)`{limit: ${e}}`},MC={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:AC,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,tf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}mz(e,n)}};function mz(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",(0,wn._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,wn._)`${a} <= ${t.length}`);else if(typeof n=="object"&&!(0,tf.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,wn._)`${a} <= ${t.length}`);r.if((0,wn.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,a,l=>{e.subschema({keyword:s,dataProp:l,dataPropType:tf.Type.Num},u),i.allErrors||r.if((0,wn.not)(u),()=>r.break())})}}Ds.validateAdditionalItems=mz;Ds.default=MC});var nf=E(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.validateTuple=void 0;var hz=K(),Ua=oe(),DC=Ot(),LC={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return gz(e,"additionalItems",t);r.items=!0,!(0,Ua.alwaysValidSchema)(r,t)&&e.ok((0,DC.validateArray)(e))}};function gz(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Ua.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,hz._)`${s}.length`);r.forEach((d,m)=>{(0,Ua.alwaysValidSchema)(a,d)||(n.if((0,hz._)`${u} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(d){let{opts:m,errSchemaPath:f}=a,p=r.length,h=p===d.minItems&&(p===d.maxItems||d[t]===!1);if(m.strictTuples&&!h){let _=`"${i}" is ${p}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,Ua.checkStrictMode)(a,_,m.strictTuples)}}}Ls.validateTuple=gz;Ls.default=LC});var _z=E(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var qC=nf(),UC={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,qC.validateTuple)(e,"items")};of.default=UC});var vz=E(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var yz=K(),FC=oe(),VC=Ot(),BC=rf(),JC={message:({params:{len:e}})=>(0,yz.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,yz._)`{limit: ${e}}`},HC={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:JC,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,FC.alwaysValidSchema)(n,t)&&(o?(0,BC.validateAdditionalItems)(e,o):e.ok((0,VC.validateArray)(e)))}};sf.default=HC});var xz=E(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});var jt=K(),Fa=oe(),KC={message:({params:{min:e,max:t}})=>t===void 0?(0,jt.str)`must contain at least ${e} valid item(s)`:(0,jt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,jt._)`{minContains: ${e}}`:(0,jt._)`{minContains: ${e}, maxContains: ${t}}`},GC={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:KC,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=t.const("len",(0,jt._)`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){(0,Fa.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Fa.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,Fa.alwaysValidSchema)(s,r)){let h=(0,jt._)`${l} >= ${i}`;a!==void 0&&(h=(0,jt._)`${h} && ${l} <= ${a}`),e.pass(h);return}s.items=!0;let d=t.name("valid");a===void 0&&i===1?f(d,()=>t.if(d,()=>t.break())):i===0?(t.let(d,!0),a!==void 0&&t.if((0,jt._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let h=t.name("_valid"),_=t.let("count",0);f(h,()=>t.if(h,()=>p(_)))}function f(h,_){t.forRange("i",0,l,z=>{e.subschema({keyword:"contains",dataProp:z,dataPropType:Fa.Type.Num,compositeRule:!0},h),_()})}function p(h){t.code((0,jt._)`${h}++`),a===void 0?t.if((0,jt._)`${h} >= ${i}`,()=>t.assign(d,!0).break()):(t.if((0,jt._)`${h} > ${a}`,()=>t.assign(d,!1).break()),i===1?t.assign(d,!0):t.if((0,jt._)`${h} >= ${i}`,()=>t.assign(d,!0)))}}};af.default=GC});var zz=E(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.validateSchemaDeps=Qt.validatePropertyDeps=Qt.error=void 0;var cf=K(),WC=oe(),qs=Ot();Qt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,cf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,cf._)`{property: ${e},
9
+ missingProperty: ${n},
10
+ depsCount: ${t},
11
+ deps: ${r}}`};var YC={keyword:"dependencies",type:"object",schemaType:"object",error:Qt.error,code(e){let[t,r]=XC(e);bz(e,t),$z(e,r)}};function XC({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function bz(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=(0,qs.propertyInData)(r,n,i,o.opts.ownProperties);e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,qs.checkReportMissingProp)(e,u)}):(r.if((0,cf._)`${c} && (${(0,qs.checkMissingProp)(e,a,s)})`),(0,qs.reportMissingProp)(e,s),r.else())}}Qt.validatePropertyDeps=bz;function $z(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t)(0,WC.alwaysValidSchema)(s,t[a])||(r.if((0,qs.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i))}Qt.validateSchemaDeps=$z;Qt.default=YC});var kz=E(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var wz=K(),QC=oe(),e1={message:"property name must be valid",params:({params:e})=>(0,wz._)`{propertyName: ${e.propertyName}}`},t1={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:e1,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,QC.alwaysValidSchema)(o,r))return;let s=t.name("valid");t.forIn("key",n,i=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if((0,wz.not)(s),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(s)}};uf.default=t1});var df=E(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var Va=Ot(),Vt=K(),r1=fr(),Ba=oe(),n1={message:"must NOT have additional properties",params:({params:e})=>(0,Vt._)`{additionalProperty: ${e.additionalProperty}}`},o1={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:n1,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Ba.alwaysValidSchema)(i,r))return;let u=(0,Va.allSchemaProperties)(n.properties),l=(0,Va.allSchemaProperties)(n.patternProperties);d(),e.ok((0,Vt._)`${s} === ${r1.default.errors}`);function d(){t.forIn("key",o,_=>{!u.length&&!l.length?p(_):t.if(m(_),()=>p(_))})}function m(_){let z;if(u.length>8){let g=(0,Ba.schemaRefOrVal)(i,n.properties,"properties");z=(0,Va.isOwnProperty)(t,g,_)}else u.length?z=(0,Vt.or)(...u.map(g=>(0,Vt._)`${_} === ${g}`)):z=Vt.nil;return l.length&&(z=(0,Vt.or)(z,...l.map(g=>(0,Vt._)`${(0,Va.usePattern)(e,g)}.test(${_})`))),(0,Vt.not)(z)}function f(_){t.code((0,Vt._)`delete ${o}[${_}]`)}function p(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(_);return}if(r===!1){e.setParams({additionalProperty:_}),e.error(),a||t.break();return}if(typeof r=="object"&&!(0,Ba.alwaysValidSchema)(i,r)){let z=t.name("valid");c.removeAdditional==="failing"?(h(_,z,!1),t.if((0,Vt.not)(z),()=>{e.reset(),f(_)})):(h(_,z),a||t.if((0,Vt.not)(z),()=>t.break()))}}function h(_,z,g){let w={keyword:"additionalProperties",dataProp:_,dataPropType:Ba.Type.Str};g===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(w,z)}}};lf.default=o1});var Tz=E(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});var s1=Ps(),Sz=Ot(),pf=oe(),Pz=df(),i1={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Pz.default.code(new s1.KeywordCxt(s,Pz.default,"additionalProperties"));let i=(0,Sz.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=pf.mergeEvaluated.props(t,(0,pf.toHash)(i),s.props));let a=i.filter(d=>!(0,pf.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=t.name("valid");for(let d of a)u(d)?l(d):(t.if((0,Sz.propertyInData)(t,o,d,s.opts.ownProperties)),l(d),s.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};ff.default=i1});var Rz=E(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var Ez=Ot(),Ja=K(),Iz=oe(),Zz=oe(),a1={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=(0,Ez.allSchemaProperties)(r),c=a.filter(h=>(0,Iz.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");s.props!==!0&&!(s.props instanceof Ja.Name)&&(s.props=(0,Zz.evaluatedPropsToName)(t,s.props));let{props:d}=s;m();function m(){for(let h of a)u&&f(h),s.allErrors?p(h):(t.var(l,!0),p(h),t.if(l))}function f(h){for(let _ in u)new RegExp(h).test(_)&&(0,Iz.checkStrictMode)(s,`property ${_} matches pattern ${h} (use allowMatchingProperties)`)}function p(h){t.forIn("key",n,_=>{t.if((0,Ja._)`${(0,Ez.usePattern)(e,h)}.test(${_})`,()=>{let z=c.includes(h);z||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:_,dataPropType:Zz.Type.Str},l),s.opts.unevaluated&&d!==!0?t.assign((0,Ja._)`${d}[${_}]`,!0):!z&&!s.allErrors&&t.if((0,Ja.not)(l),()=>t.break())})})}}};mf.default=a1});var Oz=E(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var c1=oe(),u1={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,c1.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};hf.default=u1});var Nz=E(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var l1=Ot(),d1={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:l1.validateUnion,error:{message:"must match a schema in anyOf"}};gf.default=d1});var jz=E(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Ha=K(),p1=oe(),f1={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,Ha._)`{passingSchemas: ${e.passing}}`},m1={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:f1,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){s.forEach((l,d)=>{let m;(0,p1.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,Ha._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Ha._)`[${a}, ${d}]`).else(),t.if(c,()=>{t.assign(i,!0),t.assign(a,d),m&&e.mergeEvaluated(m,Ha.Name)})})}}};_f.default=m1});var Cz=E(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var h1=oe(),g1={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if((0,h1.alwaysValidSchema)(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};yf.default=g1});var Dz=E(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var Ka=K(),Mz=oe(),_1={message:({params:e})=>(0,Ka.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Ka._)`{failingKeyword: ${e.ifClause}}`},y1={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:_1,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Mz.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Az(n,"then"),s=Az(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,u("then",l),u("else",l))}else o?t.if(a,u("then")):t.if((0,Ka.not)(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},a);t.assign(i,a),e.mergeValidEvaluated(m,i),d?t.assign(d,(0,Ka._)`${l}`):e.setParams({ifClause:l})}}}};function Az(e,t){let r=e.schema[t];return r!==void 0&&!(0,Mz.alwaysValidSchema)(e,r)}vf.default=y1});var Lz=E(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});var v1=oe(),x1={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,v1.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};xf.default=x1});var qz=E(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var b1=rf(),$1=_z(),z1=nf(),w1=vz(),k1=xz(),S1=zz(),P1=kz(),T1=df(),E1=Tz(),I1=Rz(),Z1=Oz(),R1=Nz(),O1=jz(),N1=Cz(),j1=Dz(),C1=Lz();function A1(e=!1){let t=[Z1.default,R1.default,O1.default,N1.default,j1.default,C1.default,P1.default,T1.default,S1.default,E1.default,I1.default];return e?t.push($1.default,w1.default):t.push(b1.default,z1.default),t.push(k1.default),t}bf.default=A1});var Uz=E($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var Ne=K(),M1={message:({schemaCode:e})=>(0,Ne.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,Ne._)`{format: ${e}}`},D1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:M1,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?m():f();function m(){let p=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Ne._)`${p}[${i}]`),_=r.let("fType"),z=r.let("format");r.if((0,Ne._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(_,(0,Ne._)`${h}.type || "string"`).assign(z,(0,Ne._)`${h}.validate`),()=>r.assign(_,(0,Ne._)`"string"`).assign(z,h)),e.fail$data((0,Ne.or)(g(),w()));function g(){return c.strictSchema===!1?Ne.nil:(0,Ne._)`${i} && !${z}`}function w(){let k=l.$async?(0,Ne._)`(${h}.async ? await ${z}(${n}) : ${z}(${n}))`:(0,Ne._)`${z}(${n})`,I=(0,Ne._)`(typeof ${z} == "function" ? ${k} : ${z}.test(${n}))`;return(0,Ne._)`${z} && ${z} !== true && ${_} === ${t} && !${I}`}}function f(){let p=d.formats[s];if(!p){g();return}if(p===!0)return;let[h,_,z]=w(p);h===t&&e.pass(k());function g(){if(c.strictSchema===!1){d.logger.warn(I());return}throw new Error(I());function I(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function w(I){let Le=I instanceof RegExp?(0,Ne.regexpCode)(I):c.code.formats?(0,Ne._)`${c.code.formats}${(0,Ne.getProperty)(s)}`:void 0,rt=r.scopeValue("formats",{key:s,ref:I,code:Le});return typeof I=="object"&&!(I instanceof RegExp)?[I.type||"string",I.validate,(0,Ne._)`${rt}.validate`]:["string",I,rt]}function k(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!l.$async)throw new Error("async format in sync schema");return(0,Ne._)`await ${z}(${n})`}return typeof _=="function"?(0,Ne._)`${z}(${n})`:(0,Ne._)`${z}.test(${n})`}}}};$f.default=D1});var Fz=E(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});var L1=Uz(),q1=[L1.default];zf.default=q1});var Vz=E(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.contentVocabulary=lo.metadataVocabulary=void 0;lo.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];lo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Jz=E(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});var U1=Q$(),F1=fz(),V1=qz(),B1=Fz(),Bz=Vz(),J1=[U1.default,F1.default,(0,V1.default)(),B1.default,Bz.metadataVocabulary,Bz.contentVocabulary];wf.default=J1});var Kz=E(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});Ga.DiscrError=void 0;var Hz;(function(e){e.Tag="tag",e.Mapping="mapping"})(Hz||(Ga.DiscrError=Hz={}))});var Wz=E(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});var po=K(),kf=Kz(),Gz=Ra(),H1=Ts(),K1=oe(),G1={message:({params:{discrError:e,tagName:t}})=>e===kf.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,po._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},W1={keyword:"discriminator",type:"object",schemaType:"object",error:G1,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,po._)`${r}${(0,po.getProperty)(a)}`);t.if((0,po._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:kf.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function l(){let f=m();t.if(!1);for(let p in f)t.elseIf((0,po._)`${u} === ${p}`),t.assign(c,d(f[p]));t.else(),e.error(!1,{discrError:kf.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function d(f){let p=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},p);return e.mergeEvaluated(h,po.Name),p}function m(){var f;let p={},h=z(o),_=!0;for(let k=0;k<i.length;k++){let I=i[k];if(I?.$ref&&!(0,K1.schemaHasRulesButRef)(I,s.self.RULES)){let rt=I.$ref;if(I=Gz.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,rt),I instanceof Gz.SchemaEnv&&(I=I.schema),I===void 0)throw new H1.default(s.opts.uriResolver,s.baseId,rt)}let Le=(f=I?.properties)===null||f===void 0?void 0:f[a];if(typeof Le!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(h||z(I)),g(Le,k)}if(!_)throw new Error(`discriminator: "${a}" must be required`);return p;function z({required:k}){return Array.isArray(k)&&k.includes(a)}function g(k,I){if(k.const)w(k.const,I);else if(k.enum)for(let Le of k.enum)w(Le,I);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(k,I){if(typeof k!="string"||k in p)throw new Error(`discriminator: "${a}" values must be unique strings`);p[k]=I}}}};Sf.default=W1});var Yz=E((kF,Y1)=>{Y1.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}});var Tf=E(($e,Pf)=>{"use strict";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;var X1=H$(),Q1=Jz(),eA=Wz(),Xz=Yz(),tA=["/properties"],Wa="http://json-schema.org/draft-07/schema",fo=class extends X1.default{_addVocabularies(){super._addVocabularies(),Q1.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(eA.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Xz,tA):Xz;this.addMetaSchema(t,Wa,!1),this.refs["http://json-schema.org/schema"]=Wa}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Wa)?Wa:void 0)}};$e.Ajv=fo;Pf.exports=$e=fo;Pf.exports.Ajv=fo;Object.defineProperty($e,"__esModule",{value:!0});$e.default=fo;var rA=Ps();Object.defineProperty($e,"KeywordCxt",{enumerable:!0,get:function(){return rA.KeywordCxt}});var mo=K();Object.defineProperty($e,"_",{enumerable:!0,get:function(){return mo._}});Object.defineProperty($e,"str",{enumerable:!0,get:function(){return mo.str}});Object.defineProperty($e,"stringify",{enumerable:!0,get:function(){return mo.stringify}});Object.defineProperty($e,"nil",{enumerable:!0,get:function(){return mo.nil}});Object.defineProperty($e,"Name",{enumerable:!0,get:function(){return mo.Name}});Object.defineProperty($e,"CodeGen",{enumerable:!0,get:function(){return mo.CodeGen}});var nA=Ia();Object.defineProperty($e,"ValidationError",{enumerable:!0,get:function(){return nA.default}});var oA=Ts();Object.defineProperty($e,"MissingRefError",{enumerable:!0,get:function(){return oA.default}})});var iw=E(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.formatNames=tr.fastFormats=tr.fullFormats=void 0;function er(e,t){return{validate:e,compare:t}}tr.fullFormats={date:er(rw,Rf),time:er(If(!0),Of),"date-time":er(Qz(!0),ow),"iso-time":er(If(),nw),"iso-date-time":er(Qz(),sw),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:lA,"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:_A,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:dA,int32:{type:"number",validate:mA},int64:{type:"number",validate:hA},float:{type:"number",validate:tw},double:{type:"number",validate:tw},password:!0,binary:!0};tr.fastFormats={...tr.fullFormats,date:er(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Rf),time:er(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Of),"date-time":er(/^\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,ow),"iso-time":er(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,nw),"iso-date-time":er(/^\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,sw),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};tr.formatNames=Object.keys(tr.fullFormats);function sA(e){return e%4===0&&(e%100!==0||e%400===0)}var iA=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,aA=[0,31,28,31,30,31,30,31,31,30,31,30,31];function rw(e){let t=iA.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&sA(r)?29:aA[n])}function Rf(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Ef=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function If(e){return function(r){let n=Ef.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function Of(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function nw(e,t){if(!(e&&t))return;let r=Ef.exec(e),n=Ef.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var Zf=/t|\s/i;function Qz(e){let t=If(e);return function(n){let o=n.split(Zf);return o.length===2&&rw(o[0])&&t(o[1])}}function ow(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function sw(e,t){if(!(e&&t))return;let[r,n]=e.split(Zf),[o,s]=t.split(Zf),i=Rf(r,o);if(i!==void 0)return i||Of(n,s)}var cA=/\/|:/,uA=/^(?:[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 lA(e){return cA.test(e)&&uA.test(e)}var ew=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function dA(e){return ew.lastIndex=0,ew.test(e)}var pA=-(2**31),fA=2**31-1;function mA(e){return Number.isInteger(e)&&e<=fA&&e>=pA}function hA(e){return Number.isInteger(e)}function tw(){return!0}var gA=/[^\\]\\Z/;function _A(e){if(gA.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var aw=E(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.formatLimitDefinition=void 0;var yA=Tf(),Bt=K(),Mr=Bt.operators,Ya={formatMaximum:{okStr:"<=",ok:Mr.LTE,fail:Mr.GT},formatMinimum:{okStr:">=",ok:Mr.GTE,fail:Mr.LT},formatExclusiveMaximum:{okStr:"<",ok:Mr.LT,fail:Mr.GTE},formatExclusiveMinimum:{okStr:">",ok:Mr.GT,fail:Mr.LTE}},vA={message:({keyword:e,schemaCode:t})=>(0,Bt.str)`should be ${Ya[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,Bt._)`{comparison: ${Ya[e].okStr}, limit: ${t}}`};ho.formatLimitDefinition={keyword:Object.keys(Ya),type:"string",schemaType:"string",$data:!0,error:vA,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new yA.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",(0,Bt._)`${m}[${c.schemaCode}]`);e.fail$data((0,Bt.or)((0,Bt._)`typeof ${f} != "object"`,(0,Bt._)`${f} instanceof RegExp`,(0,Bt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let m=c.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let p=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?(0,Bt._)`${i.code.formats}${(0,Bt.getProperty)(m)}`:void 0});e.fail$data(d(p))}function d(m){return(0,Bt._)`${m}.compare(${r}, ${n}) ${Ya[o].fail} 0`}},dependencies:["format"]};var xA=e=>(e.addKeyword(ho.formatLimitDefinition),e);ho.default=xA});var dw=E((Us,lw)=>{"use strict";Object.defineProperty(Us,"__esModule",{value:!0});var go=iw(),bA=aw(),Nf=K(),cw=new Nf.Name("fullFormats"),$A=new Nf.Name("fastFormats"),jf=(e,t={keywords:!0})=>{if(Array.isArray(t))return uw(e,t,go.fullFormats,cw),e;let[r,n]=t.mode==="fast"?[go.fastFormats,$A]:[go.fullFormats,cw],o=t.formats||go.formatNames;return uw(e,o,r,n),t.keywords&&(0,bA.default)(e),e};jf.get=(e,t="full")=>{let n=(t==="fast"?go.fastFormats:go.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function uw(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Nf._)`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}lw.exports=Us=jf;Object.defineProperty(Us,"__esModule",{value:!0});Us.default=jf});(function(){Yf().config(Object.assign({},Qf(),tm()(process.argv)))})();import Py from"node:process";var rm;function x(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let m=l[d];m in a||(a[m]=u[m].bind(a))}}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var AA=Symbol("zod_brand"),Jt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Pn=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(rm=globalThis).__zod_globalConfig??(rm.__zod_globalConfig={});var Tn=globalThis.__zod_globalConfig;function yt(e){return e&&Object.assign(Tn,e),Tn}var ne={};vo(ne,{BIGINT_FORMAT_RANGES:()=>im,Class:()=>dc,NUMBER_FORMAT_RANGES:()=>_c,aborted:()=>vr,allowsEval:()=>mc,assert:()=>tk,assertEqual:()=>Yw,assertIs:()=>Qw,assertNever:()=>ek,assertNotEqual:()=>Xw,assignProp:()=>_r,base64ToUint8Array:()=>cm,base64urlToUint8Array:()=>yk,cached:()=>In,captureStackTrace:()=>Gs,cleanEnum:()=>_k,cleanRegex:()=>wo,clone:()=>Ct,cloneDef:()=>nk,createTransparentProxy:()=>uk,defineLazy:()=>ae,esc:()=>Ks,escapeRegex:()=>or,explicitlyAborted:()=>yc,extend:()=>pk,finalizeIssue:()=>wt,floatSafeRemainder:()=>pc,getElementAtPath:()=>ok,getEnumValues:()=>$o,getLengthableOrigin:()=>ko,getParsedType:()=>ck,getSizableOrigin:()=>am,hexToUint8Array:()=>xk,isObject:()=>Ur,isPlainObject:()=>yr,issue:()=>Zn,joinValues:()=>Hs,jsonStringifyReplacer:()=>En,merge:()=>mk,mergeDefs:()=>nr,normalizeParams:()=>L,nullish:()=>zo,numKeys:()=>ak,objectClone:()=>rk,omit:()=>dk,optionalKeys:()=>gc,parsedType:()=>vc,partial:()=>hk,pick:()=>lk,prefixIssues:()=>sr,primitiveTypes:()=>sm,promiseAllObject:()=>sk,propertyKeyTypes:()=>hc,randomString:()=>ik,required:()=>gk,safeExtend:()=>fk,shallowClone:()=>om,slugify:()=>fc,stringifyPrimitive:()=>Ws,uint8ArrayToBase64:()=>um,uint8ArrayToBase64url:()=>vk,uint8ArrayToHex:()=>bk,unwrapMessage:()=>bo});function Yw(e){return e}function Xw(e){return e}function Qw(e){}function ek(e){throw new Error("Unexpected value in exhaustive check")}function tk(e){}function $o(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Hs(e,t="|"){return e.map(r=>Ws(r)).join(t)}function En(e,t){return typeof t=="bigint"?t.toString():t}function In(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function zo(e){return e==null}function wo(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function pc(e,t){let r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var nm=Symbol("evaluating");function ae(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==nm)return n===void 0&&(n=nm,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function rk(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function _r(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function nr(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function nk(e){return nr(e._zod.def)}function ok(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function sk(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function ik(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Ks(e){return JSON.stringify(e)}function fc(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Gs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var mc=In(()=>{if(Tn.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function yr(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 om(e){return yr(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function ak(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var ck=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}`)}},hc=new Set(["string","number","symbol"]),sm=new Set(["string","number","bigint","boolean","symbol","undefined"]);function or(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ct(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function L(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 uk(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Ws(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function gc(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var _c={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]},im={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function lk(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=nr(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=r.shape[a])}return _r(this,"shape",i),i},checks:[]});return Ct(e,s)}function dk(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=nr(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return _r(this,"shape",i),i},checks:[]});return Ct(e,s)}function pk(e,t){if(!yr(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=nr(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return _r(this,"shape",s),s}});return Ct(e,o)}function fk(e,t){if(!yr(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=nr(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return _r(this,"shape",n),n}});return Ct(e,r)}function mk(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=nr(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return _r(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ct(e,r)}function hk(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=nr(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return _r(this,"shape",c),c},checks:[]});return Ct(t,i)}function gk(e,t,r){let n=nr(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return _r(this,"shape",s),s}});return Ct(t,n)}function vr(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 yc(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 sr(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function bo(e){return typeof e=="string"?e:e?.message}function wt(e,t,r){let n=e.message?e.message:bo(e.inst?._zod.def?.error?.(e))??bo(t?.error?.(e))??bo(r.customError?.(e))??bo(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=n,t?.reportInput&&(a.input=i),a}function am(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ko(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function vc(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 Zn(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function _k(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function cm(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function um(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function yk(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return cm(t+r)}function vk(e){return um(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function xk(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 n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function bk(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var dc=class{constructor(...t){}};var lm=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,En,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ys=x("$ZodError",lm),xc=x("$ZodError",lm,{Parent:Error});function dm(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function pm(e,t=r=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(t(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return n(e),r}var Xs=e=>(t,r,n,o)=>{let s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Jt;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>wt(c,s,yt())));throw Gs(a,o?.callee),a}return i.value};var Qs=e=>async(t,r,n,o)=>{let s=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>wt(c,s,yt())));throw Gs(a,o?.callee),a}return i.value};var So=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Jt;return s.issues.length?{success:!1,error:new(e??Ys)(s.issues.map(i=>wt(i,o,yt())))}:{success:!0,data:s.value}},fm=So(xc),Po=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>wt(i,o,yt())))}:{success:!0,data:s.value}},mm=Po(xc),hm=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Xs(e)(t,r,o)};var gm=e=>(t,r,n)=>Xs(e)(t,r,n);var _m=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Qs(e)(t,r,o)};var ym=e=>async(t,r,n)=>Qs(e)(t,r,n);var vm=e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return So(e)(t,r,o)};var xm=e=>(t,r,n)=>So(e)(t,r,n);var bm=e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Po(e)(t,r,o)};var $m=e=>async(t,r,n)=>Po(e)(t,r,n);var zm=/^[cC][0-9a-z]{6,}$/,wm=/^[0-9a-z]+$/,km=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Sm=/^[0-9a-vA-V]{20}$/,Pm=/^[A-Za-z0-9]{27}$/,Tm=/^[a-zA-Z0-9_-]{21}$/,Em=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Im=/^([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})$/,bc=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 Zm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var zk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rm(){return new RegExp(zk,"u")}var Om=/^(?:(?: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])$/,Nm=/^(([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 jm=/^((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])$/,Cm=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Am=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$c=/^[A-Za-z0-9_-]*$/;var Mm=/^https?$/,Dm=/^\+[1-9]\d{6,14}$/,Lm="(?:(?:\\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])))",qm=new RegExp(`^${Lm}$`);function Um(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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Fm(e){return new RegExp(`^${Um(e)}$`)}function Vm(e){let t=Um({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Lm}T(?:${n})$`)}var Bm=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Jm=/^-?\d+$/,zc=/^-?\d+(?:\.\d+)?$/,Hm=/^(?:true|false)$/i,Km=/^null$/i;var Gm=/^[^A-Z]*$/,Wm=/^[^a-z]*$/;var Fe=x("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ym={number:"number",bigint:"bigint",object:"date"},wc=x("$ZodCheckLessThan",(e,t)=>{Fe.init(e,t);let r=Ym[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kc=x("$ZodCheckGreaterThan",(e,t)=>{Fe.init(e,t);let r=Ym[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xm=x("$ZodCheckMultipleOf",(e,t)=>{Fe.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),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"?r.value%t.value===BigInt(0):pc(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})}}),Qm=x("$ZodCheckNumberFormat",(e,t)=>{Fe.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=_c[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=Jm)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var eh=x("$ZodCheckMaxLength",(e,t)=>{var r;Fe.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!zo(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let i=ko(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),th=x("$ZodCheckMinLength",(e,t)=>{var r;Fe.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!zo(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let i=ko(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),rh=x("$ZodCheckLengthEquals",(e,t)=>{var r;Fe.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!zo(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,s=o.length;if(s===t.length)return;let i=ko(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),To=x("$ZodCheckStringFormat",(e,t)=>{var r,n;Fe.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),nh=x("$ZodCheckRegex",(e,t)=>{To.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})}}),oh=x("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Gm),To.init(e,t)}),sh=x("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Wm),To.init(e,t)}),ih=x("$ZodCheckIncludes",(e,t)=>{Fe.init(e,t);let r=or(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),ah=x("$ZodCheckStartsWith",(e,t)=>{Fe.init(e,t);let r=new RegExp(`^${or(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ch=x("$ZodCheckEndsWith",(e,t)=>{Fe.init(e,t);let r=new RegExp(`.*${or(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var uh=x("$ZodCheckOverwrite",(e,t)=>{Fe.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var ti=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
12
+ `).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,o.join(`
13
+ `))}};var dh={major:4,minor:4,patch:3};var _e=x("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=dh;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,a,c)=>{let u=vr(i),l;for(let d of a){if(d._zod.def.when){if(yc(i)||!d._zod.def.when(i))continue}else if(u)continue;let m=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Jt;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==m&&(u||(u=vr(i,m)))});else{if(i.issues.length===m)continue;u||(u=vr(i,m))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(vr(i))return i.aborted=!0,i;let u=o(a,n,c);if(u instanceof Promise){if(c.async===!1)throw new Jt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Jt;return c.then(u=>o(u,n,a))}return o(c,n,a)}}ae(e,"~standard",()=>({validate:o=>{try{let s=fm(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return mm(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),oi=x("$ZodString",(e,t)=>{_e.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Bm(e._zod.bag),e._zod.parse=(r,n)=>{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}}),ye=x("$ZodStringFormat",(e,t)=>{To.init(e,t),oi.init(e,t)}),xh=x("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Im),ye.init(e,t)}),bh=x("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=bc(n))}else t.pattern??(t.pattern=bc());ye.init(e,t)}),$h=x("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Zm),ye.init(e,t)}),zh=x("$ZodURL",(e,t)=>{ye.init(e,t),e._zod.check=r=>{try{let n=r.value.trim();if(!t.normalize&&t.protocol?.source===Mm.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}let o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.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&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),wh=x("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Rm()),ye.init(e,t)}),kh=x("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Tm),ye.init(e,t)}),Sh=x("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=zm),ye.init(e,t)}),Ph=x("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=wm),ye.init(e,t)}),Th=x("$ZodULID",(e,t)=>{t.pattern??(t.pattern=km),ye.init(e,t)}),Eh=x("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Sm),ye.init(e,t)}),Ih=x("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Pm),ye.init(e,t)}),Zh=x("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Vm(t)),ye.init(e,t)}),Rh=x("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=qm),ye.init(e,t)}),Oh=x("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Fm(t)),ye.init(e,t)}),Nh=x("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Em),ye.init(e,t)}),jh=x("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Om),ye.init(e,t),e._zod.bag.format="ipv4"}),Ch=x("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Nm),ye.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var Ah=x("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=jm),ye.init(e,t)}),Mh=x("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Cm),ye.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,s]=n;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Dh(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Lh=x("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Am),ye.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Dh(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function wk(e){if(!$c.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Dh(r)}var qh=x("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=$c),ye.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{wk(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Uh=x("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Dm),ye.init(e,t)});function kk(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Fh=x("$ZodJWT",(e,t)=>{ye.init(e,t),e._zod.check=r=>{kk(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Pc=x("$ZodNumber",(e,t)=>{_e.init(e,t),e._zod.pattern=e._zod.bag.pattern??zc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),Vh=x("$ZodNumberFormat",(e,t)=>{Qm.init(e,t),Pc.init(e,t)}),Bh=x("$ZodBoolean",(e,t)=>{_e.init(e,t),e._zod.pattern=Hm,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Jh=x("$ZodNull",(e,t)=>{_e.init(e,t),e._zod.pattern=Km,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var Hh=x("$ZodUnknown",(e,t)=>{_e.init(e,t),e._zod.parse=r=>r}),Kh=x("$ZodNever",(e,t)=>{_e.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function ph(e,t,r){e.issues.length&&t.issues.push(...sr(r,e.issues)),t.value[r]=e.value}var Gh=x("$ZodArray",(e,t)=>{_e.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>ph(u,r,i))):ph(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function ni(e,t,r,n,o,s){let i=r in n;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...sr(r,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function Wh(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=gc(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Yh(e,t,r,n,o,s){let i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(let m in t){if(m==="__proto__"||a.has(m))continue;if(u==="never"){i.push(m);continue}let f=c.run({value:t[m],issues:[]},n);f instanceof Promise?e.push(f.then(p=>ni(p,r,m,t,l,d))):ni(f,r,m,t,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var Sk=x("$ZodObject",(e,t)=>{if(_e.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=In(()=>Wh(t));ae(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=Ur,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=n.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let l=[],d=i.shape;for(let m of i.keys){let f=d[m],p=f._zod.optin==="optional",h=f._zod.optout==="optional",_=f._zod.run({value:u[m],issues:[]},c);_ instanceof Promise?l.push(_.then(z=>ni(z,a,m,u,p,h))):ni(_,a,m,u,p,h)}return s?Yh(l,u,a,c,n.value,e):l.length?Promise.all(l).then(()=>a):a}}),Xh=x("$ZodObjectJIT",(e,t)=>{Sk.init(e,t);let r=e._zod.parse,n=In(()=>Wh(t)),o=m=>{let f=new ti(["shape","payload","ctx"]),p=n.value,h=w=>{let k=Ks(w);return`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`};f.write("const input = payload.value;");let _=Object.create(null),z=0;for(let w of p.keys)_[w]=`key_${z++}`;f.write("const newResult = {};");for(let w of p.keys){let k=_[w],I=Ks(w),Le=m[w],rt=Le?._zod?.optin==="optional",gr=Le?._zod?.optout==="optional";f.write(`const ${k} = ${h(w)};`),rt&&gr?f.write(`
14
+ if (${k}.issues.length) {
15
+ if (${I} in input) {
16
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
17
+ ...iss,
18
+ path: iss.path ? [${I}, ...iss.path] : [${I}]
19
+ })));
20
+ }
21
+ }
22
+
23
+ if (${k}.value === undefined) {
24
+ if (${I} in input) {
25
+ newResult[${I}] = undefined;
26
+ }
27
+ } else {
28
+ newResult[${I}] = ${k}.value;
29
+ }
30
+
31
+ `):rt?f.write(`
32
+ if (${k}.issues.length) {
33
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
34
+ ...iss,
35
+ path: iss.path ? [${I}, ...iss.path] : [${I}]
36
+ })));
37
+ }
38
+
39
+ if (${k}.value === undefined) {
40
+ if (${I} in input) {
41
+ newResult[${I}] = undefined;
42
+ }
43
+ } else {
44
+ newResult[${I}] = ${k}.value;
45
+ }
46
+
47
+ `):f.write(`
48
+ const ${k}_present = ${I} in input;
49
+ if (${k}.issues.length) {
50
+ payload.issues = payload.issues.concat(${k}.issues.map(iss => ({
51
+ ...iss,
52
+ path: iss.path ? [${I}, ...iss.path] : [${I}]
53
+ })));
54
+ }
55
+ if (!${k}_present && !${k}.issues.length) {
56
+ payload.issues.push({
57
+ code: "invalid_type",
58
+ expected: "nonoptional",
59
+ input: undefined,
60
+ path: [${I}]
61
+ });
62
+ }
63
+
64
+ if (${k}_present) {
65
+ if (${k}.value === undefined) {
66
+ newResult[${I}] = undefined;
67
+ } else {
68
+ newResult[${I}] = ${k}.value;
69
+ }
70
+ }
71
+
72
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let g=f.compile();return(w,k)=>g(m,w,k)},s,i=Ur,a=!Tn.jitless,u=a&&mc.value,l=t.catchall,d;e._zod.parse=(m,f)=>{d??(d=n.value);let p=m.value;return i(p)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=o(t.shape)),m=s(m,f),l?Yh([],p,m,f,d,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),m)}});function fh(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!vr(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>wt(i,n,yt())))}),t)}var Tc=x("$ZodUnion",(e,t)=>{_e.init(e,t),ae(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),ae(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ae(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),ae(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){let n=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${n.map(o=>wo(o.source)).join("|")})$`)}});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>fh(a,n,e,o)):fh(i,n,e,o)}});var Qh=x("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Tc.init(e,t);let r=e._zod.parse;ae(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=In(()=>{let o=t.options,s=new Map;for(let i of o){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Ur(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=n.value.get(i?.[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback||s.direction==="backward"?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:i,path:[t.discriminator],inst:e}),o)}}),eg=x("$ZodIntersection",(e,t)=>{_e.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>mh(r,c,u)):mh(r,s,i)}});function Sc(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(yr(e)&&yr(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let i=Sc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Sc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function mh(e,t,r){let n=new Map,o;for(let a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(a);let s=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),vr(e))return e;let i=Sc(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var tg=x("$ZodRecord",(e,t)=>{_e.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!yr(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=t.keyType._zod.run({value:u,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>wt(f,n,yt())),input:u,path:[u],inst:e});continue}let d=l.value,m=t.valueType._zod.run({value:o[u],issues:[]},n);m instanceof Promise?s.push(m.then(f=>{f.issues.length&&r.issues.push(...sr(u,f.issues)),r.value[d]=f.value})):(m.issues.length&&r.issues.push(...sr(u,m.issues)),r.value[d]=m.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&zc.test(a)&&c.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>wt(d,n,yt())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:o[a],issues:[]},n);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...sr(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...sr(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var rg=x("$ZodEnum",(e,t)=>{_e.init(e,t);let r=$o(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>hc.has(typeof o)).map(o=>typeof o=="string"?or(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),ng=x("$ZodLiteral",(e,t)=>{if(_e.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?or(n):n?or(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var og=x("$ZodTransform",(e,t)=>{_e.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pn(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r.fallback=!0,r));if(o instanceof Promise)throw new Jt;return r.value=o,r.fallback=!0,r}});function hh(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Ec=x("$ZodOptional",(e,t)=>{_e.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ae(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${wo(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=r.value,s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>hh(i,o)):hh(s,o)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),sg=x("$ZodExactOptional",(e,t)=>{Ec.init(e,t),ae(e._zod,"values",()=>t.innerType._zod.values),ae(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ig=x("$ZodNullable",(e,t)=>{_e.init(e,t),ae(e._zod,"optin",()=>t.innerType._zod.optin),ae(e._zod,"optout",()=>t.innerType._zod.optout),ae(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${wo(r.source)}|null)$`):void 0}),ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ag=x("$ZodDefault",(e,t)=>{_e.init(e,t),e._zod.optin="optional",ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>gh(s,t)):gh(o,t)}});function gh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var cg=x("$ZodPrefault",(e,t)=>{_e.init(e,t),e._zod.optin="optional",ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ug=x("$ZodNonOptional",(e,t)=>{_e.init(e,t),ae(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>_h(s,e)):_h(o,e)}});function _h(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var lg=x("$ZodCatch",(e,t)=>{_e.init(e,t),e._zod.optin="optional",ae(e._zod,"optout",()=>t.innerType._zod.optout),ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>wt(i,n,yt()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>wt(s,n,yt()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var Ic=x("$ZodPipe",(e,t)=>{_e.init(e,t),ae(e._zod,"values",()=>t.in._zod.values),ae(e._zod,"optin",()=>t.in._zod.optin),ae(e._zod,"optout",()=>t.out._zod.optout),ae(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>ri(i,t.in,n)):ri(s,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>ri(s,t.out,n)):ri(o,t.out,n)}});function ri(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var dg=x("$ZodPreprocess",(e,t)=>{Ic.init(e,t)}),pg=x("$ZodReadonly",(e,t)=>{_e.init(e,t),ae(e._zod,"propValues",()=>t.innerType._zod.propValues),ae(e._zod,"values",()=>t.innerType._zod.values),ae(e._zod,"optin",()=>t.innerType?._zod?.optin),ae(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(yh):yh(o)}});function yh(e){return e.value=Object.freeze(e.value),e}var fg=x("$ZodCustom",(e,t)=>{Fe.init(e,t),_e.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>vh(s,r,n,e));vh(o,r,n,e)}});function vh(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Zn(o))}}var Pk=()=>{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(o){return e[o]??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",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let s=n[o.expected]??o.expected,i=vc(o.input),a=n[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${Ws(o.values[0])}`:`Invalid option: expected one of ${Hs(o.values,"|")}`;case"too_big":{let s=o.inclusive?"<=":"<",i=t(o.origin);return i?`Too big: expected ${o.origin??"value"} to have ${s}${o.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${s}${o.maximum.toString()}`}case"too_small":{let s=o.inclusive?">=":">",i=t(o.origin);return i?`Too small: expected ${o.origin} to have ${s}${o.minimum.toString()} ${i.unit}`:`Too small: expected ${o.origin} to be ${s}${o.minimum.toString()}`}case"invalid_format":{let s=o;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Hs(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return o.options&&Array.isArray(o.options)&&o.options.length>0?`Invalid discriminator value. Expected ${o.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function mg(){return{localeError:Pk()}}var hg,tM=Symbol("ZodOutput"),rM=Symbol("ZodInput"),Zc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.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 n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Tk(){return new Zc}(hg=globalThis).__zod_globalRegistry??(hg.__zod_globalRegistry=Tk());var Fr=globalThis.__zod_globalRegistry;function gg(e,t){return new e({type:"string",...L(t)})}function _g(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...L(t)})}function Rc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...L(t)})}function yg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...L(t)})}function vg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...L(t)})}function xg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...L(t)})}function bg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...L(t)})}function $g(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...L(t)})}function zg(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...L(t)})}function wg(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...L(t)})}function kg(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...L(t)})}function Sg(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...L(t)})}function Pg(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...L(t)})}function Tg(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...L(t)})}function Eg(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...L(t)})}function Ig(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...L(t)})}function Zg(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...L(t)})}function Rg(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...L(t)})}function Og(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...L(t)})}function Ng(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...L(t)})}function jg(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...L(t)})}function Cg(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...L(t)})}function Ag(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...L(t)})}function Mg(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...L(t)})}function Dg(e,t){return new e({type:"string",format:"date",check:"string_format",...L(t)})}function Lg(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...L(t)})}function qg(e,t){return new e({type:"string",format:"duration",check:"string_format",...L(t)})}function Ug(e,t){return new e({type:"number",checks:[],...L(t)})}function Fg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...L(t)})}function Vg(e,t){return new e({type:"boolean",...L(t)})}function Bg(e,t){return new e({type:"null",...L(t)})}function Jg(e){return new e({type:"unknown"})}function Hg(e,t){return new e({type:"never",...L(t)})}function si(e,t){return new wc({check:"less_than",...L(t),value:e,inclusive:!1})}function Eo(e,t){return new wc({check:"less_than",...L(t),value:e,inclusive:!0})}function ii(e,t){return new kc({check:"greater_than",...L(t),value:e,inclusive:!1})}function Io(e,t){return new kc({check:"greater_than",...L(t),value:e,inclusive:!0})}function ai(e,t){return new Xm({check:"multiple_of",...L(t),value:e})}function ci(e,t){return new eh({check:"max_length",...L(t),maximum:e})}function Rn(e,t){return new th({check:"min_length",...L(t),minimum:e})}function ui(e,t){return new rh({check:"length_equals",...L(t),length:e})}function Oc(e,t){return new nh({check:"string_format",format:"regex",...L(t),pattern:e})}function Nc(e){return new oh({check:"string_format",format:"lowercase",...L(e)})}function jc(e){return new sh({check:"string_format",format:"uppercase",...L(e)})}function Cc(e,t){return new ih({check:"string_format",format:"includes",...L(t),includes:e})}function Ac(e,t){return new ah({check:"string_format",format:"starts_with",...L(t),prefix:e})}function Mc(e,t){return new ch({check:"string_format",format:"ends_with",...L(t),suffix:e})}function xr(e){return new uh({check:"overwrite",tx:e})}function Dc(e){return xr(t=>t.normalize(e))}function Lc(){return xr(e=>e.trim())}function qc(){return xr(e=>e.toLowerCase())}function Uc(){return xr(e=>e.toUpperCase())}function Fc(){return xr(e=>fc(e))}function Kg(e,t,r){return new e({type:"array",element:t,...L(r)})}function Gg(e,t,r){let n=L(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Wg(e,t,r){return new e({type:"custom",check:"custom",fn:t,...L(r)})}function Yg(e,t){let r=Ek(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(Zn(o,n.value,r._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(Zn(s))}},e(n.value,n)),t);return r}function Ek(e,t){let r=new Fe({check:"custom",...L(t)});return r._zod.check=e,r}function Vc(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??Fr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Oe(e,t,r={path:[],schemaPath:[]}){var n;let o=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);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let m=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let d=e._zod.parent;d&&(i.ref||(i.ref=d),Oe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&nt(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Bc(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=n.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,m=e.external.uri??(p=>p);if(d)return{ref:m(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
73
+
74
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=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(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Jc(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){n(d);let f=e.seen.get(d),p=f.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(p)):Object.assign(u,p),Object.assign(u,l),a._zod.parent===d)for(let _ in u)_==="$ref"||_==="allOf"||_ in l||delete u[_];if(p.$ref&&f.def)for(let _ in u)_==="$ref"||_==="allOf"||_ in f.def&&JSON.stringify(u[_])===JSON.stringify(f.def[_])&&delete u[_]}let m=a._zod.parent;if(m&&m!==d){n(m);let f=e.seen.get(m);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let p in u)p==="$ref"||p==="allOf"||p in f.def&&JSON.stringify(u[p])===JSON.stringify(f.def[p])&&delete u[p]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Zo(t,"input",e.processors),output:Zo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function nt(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return nt(n.element,r);if(n.type==="set")return nt(n.valueType,r);if(n.type==="lazy")return nt(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return nt(n.innerType,r);if(n.type==="intersection")return nt(n.left,r)||nt(n.right,r);if(n.type==="record"||n.type==="map")return nt(n.keyType,r)||nt(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:nt(n.in,r)||nt(n.out,r);if(n.type==="object"){for(let o in n.shape)if(nt(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(nt(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(nt(o,r))return!0;return!!(n.rest&&nt(n.rest,r))}return!1}var Xg=(e,t={})=>r=>{let n=Vc({...r,processors:t});return Oe(e,n),Bc(n,e),Jc(n,e)},Zo=(e,t,r={})=>n=>{let{libraryOptions:o,target:s}=n??{},i=Vc({...o??{},target:s,io:t,processors:r});return Oe(e,i),Bc(i,e),Jc(i,e)};var Ik={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Qg=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Ik[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},e_=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),m=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";d?f?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof s=="number"&&(o.minimum=s),m?f?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof i=="number"&&(o.maximum=i),typeof c=="number"&&(o.multipleOf=c)},t_=(e,t,r,n)=>{r.type="boolean"};var r_=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var n_=(e,t,r,n)=>{r.not={}};var o_=(e,t,r,n)=>{};var s_=(e,t,r,n)=>{let o=e._zod.def,s=$o(o.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},i_=(e,t,r,n)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");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};var a_=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var c_=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var u_=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Oe(s.element,t,{...n,path:[...n.path,"items"]})},l_=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let u in i)o.properties[u]=Oe(i[u],t,{...n,path:[...n.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Oe(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},d_=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Oe(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},p_=(e,t,r,n)=>{let o=e._zod.def,s=Oe(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=Oe(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var f_=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=Oe(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Oe(s.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=Oe(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},m_=(e,t,r,n)=>{let o=e._zod.def,s=Oe(o.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},h_=(e,t,r,n)=>{let o=e._zod.def;Oe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},g_=(e,t,r,n)=>{let o=e._zod.def;Oe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},__=(e,t,r,n)=>{let o=e._zod.def;Oe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},y_=(e,t,r,n)=>{let o=e._zod.def;Oe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},v_=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;Oe(i,t,n);let a=t.seen.get(e);a.ref=i},x_=(e,t,r,n)=>{let o=e._zod.def;Oe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var Hc=(e,t,r,n)=>{let o=e._zod.def;Oe(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};var Oo={};vo(Oo,{ZodISODate:()=>$_,ZodISODateTime:()=>b_,ZodISODuration:()=>w_,ZodISOTime:()=>z_,date:()=>Gc,datetime:()=>Kc,duration:()=>Yc,time:()=>Wc});var b_=x("ZodISODateTime",(e,t)=>{Zh.init(e,t),ze.init(e,t)});function Kc(e){return Mg(b_,e)}var $_=x("ZodISODate",(e,t)=>{Rh.init(e,t),ze.init(e,t)});function Gc(e){return Dg($_,e)}var z_=x("ZodISOTime",(e,t)=>{Oh.init(e,t),ze.init(e,t)});function Wc(e){return Lg(z_,e)}var w_=x("ZodISODuration",(e,t)=>{Nh.init(e,t),ze.init(e,t)});function Yc(e){return qg(w_,e)}var Dk=(e,t)=>{Ys.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>pm(e,r)},flatten:{value:r=>dm(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,En,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,En,2)}},isEmpty:{get(){return e.issues.length===0}}})};var vt=x("ZodError",Dk,{Parent:Error});var k_=Xs(vt),S_=Qs(vt),P_=So(vt),T_=Po(vt),E_=hm(vt),I_=gm(vt),Z_=_m(vt),R_=ym(vt),O_=vm(vt),N_=xm(vt),j_=bm(vt),C_=$m(vt);var A_=new WeakMap;function No(e,t,r){let n=Object.getPrototypeOf(e),o=A_.get(n);if(o||(o=new Set,A_.set(n,o)),!o.has(t)){o.add(t);for(let s in r){let i=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var Se=x("ZodType",(e,t)=>(_e.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zo(e,"input"),output:Zo(e,"output")}}),e.toJSONSchema=Xg(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>k_(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>P_(e,r,n),e.parseAsync=async(r,n)=>S_(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>T_(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>E_(e,r,n),e.decode=(r,n)=>I_(e,r,n),e.encodeAsync=async(r,n)=>Z_(e,r,n),e.decodeAsync=async(r,n)=>R_(e,r,n),e.safeEncode=(r,n)=>O_(e,r,n),e.safeDecode=(r,n)=>N_(e,r,n),e.safeEncodeAsync=async(r,n)=>j_(e,r,n),e.safeDecodeAsync=async(r,n)=>C_(e,r,n),No(e,"ZodType",{check(...r){let n=this.def;return this.clone(ne.mergeDefs(n,{checks:[...n.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return Ct(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(E0(r,n))},superRefine(r,n){return this.check(I0(r,n))},overwrite(r){return this.check(xr(r))},optional(){return ke(this)},exactOptional(){return _0(this)},nullable(){return q_(this)},nullish(){return ke(q_(this))},nonoptional(r){return z0(this,r)},array(){return Q(this)},or(r){return ve([this,r])},and(r){return di(this,r)},transform(r){return U_(this,K_(r))},default(r){return x0(this,r)},prefault(r){return $0(this,r)},catch(r){return k0(this,r)},pipe(r){return U_(this,r)},readonly(){return T0(this)},describe(r){let n=this.clone();return Fr.add(n,{description:r}),n},meta(...r){if(r.length===0)return Fr.get(this);let n=this.clone();return Fr.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Fr.get(e)?.description},configurable:!0}),e)),F_=x("_ZodString",(e,t)=>{oi.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Qg(e,n,o,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,No(e,"_ZodString",{regex(...n){return this.check(Oc(...n))},includes(...n){return this.check(Cc(...n))},startsWith(...n){return this.check(Ac(...n))},endsWith(...n){return this.check(Mc(...n))},min(...n){return this.check(Rn(...n))},max(...n){return this.check(ci(...n))},length(...n){return this.check(ui(...n))},nonempty(...n){return this.check(Rn(1,...n))},lowercase(n){return this.check(Nc(n))},uppercase(n){return this.check(jc(n))},trim(){return this.check(Lc())},normalize(...n){return this.check(Dc(...n))},toLowerCase(){return this.check(qc())},toUpperCase(){return this.check(Uc())},slugify(){return this.check(Fc())}})}),qk=x("ZodString",(e,t)=>{oi.init(e,t),F_.init(e,t),e.email=r=>e.check(_g(Uk,r)),e.url=r=>e.check($g(Fk,r)),e.jwt=r=>e.check(Ag(o0,r)),e.emoji=r=>e.check(zg(Vk,r)),e.guid=r=>e.check(Rc(M_,r)),e.uuid=r=>e.check(yg(li,r)),e.uuidv4=r=>e.check(vg(li,r)),e.uuidv6=r=>e.check(xg(li,r)),e.uuidv7=r=>e.check(bg(li,r)),e.nanoid=r=>e.check(wg(Bk,r)),e.guid=r=>e.check(Rc(M_,r)),e.cuid=r=>e.check(kg(Jk,r)),e.cuid2=r=>e.check(Sg(Hk,r)),e.ulid=r=>e.check(Pg(Kk,r)),e.base64=r=>e.check(Ng(t0,r)),e.base64url=r=>e.check(jg(r0,r)),e.xid=r=>e.check(Tg(Gk,r)),e.ksuid=r=>e.check(Eg(Wk,r)),e.ipv4=r=>e.check(Ig(Yk,r)),e.ipv6=r=>e.check(Zg(Xk,r)),e.cidrv4=r=>e.check(Rg(Qk,r)),e.cidrv6=r=>e.check(Og(e0,r)),e.e164=r=>e.check(Cg(n0,r)),e.datetime=r=>e.check(Kc(r)),e.date=r=>e.check(Gc(r)),e.time=r=>e.check(Wc(r)),e.duration=r=>e.check(Yc(r))});function y(e){return gg(qk,e)}var ze=x("ZodStringFormat",(e,t)=>{ye.init(e,t),F_.init(e,t)}),Uk=x("ZodEmail",(e,t)=>{$h.init(e,t),ze.init(e,t)});var M_=x("ZodGUID",(e,t)=>{xh.init(e,t),ze.init(e,t)});var li=x("ZodUUID",(e,t)=>{bh.init(e,t),ze.init(e,t)});var Fk=x("ZodURL",(e,t)=>{zh.init(e,t),ze.init(e,t)});var Vk=x("ZodEmoji",(e,t)=>{wh.init(e,t),ze.init(e,t)});var Bk=x("ZodNanoID",(e,t)=>{kh.init(e,t),ze.init(e,t)});var Jk=x("ZodCUID",(e,t)=>{Sh.init(e,t),ze.init(e,t)});var Hk=x("ZodCUID2",(e,t)=>{Ph.init(e,t),ze.init(e,t)});var Kk=x("ZodULID",(e,t)=>{Th.init(e,t),ze.init(e,t)});var Gk=x("ZodXID",(e,t)=>{Eh.init(e,t),ze.init(e,t)});var Wk=x("ZodKSUID",(e,t)=>{Ih.init(e,t),ze.init(e,t)});var Yk=x("ZodIPv4",(e,t)=>{jh.init(e,t),ze.init(e,t)});var Xk=x("ZodIPv6",(e,t)=>{Ch.init(e,t),ze.init(e,t)});var Qk=x("ZodCIDRv4",(e,t)=>{Ah.init(e,t),ze.init(e,t)});var e0=x("ZodCIDRv6",(e,t)=>{Mh.init(e,t),ze.init(e,t)});var t0=x("ZodBase64",(e,t)=>{Lh.init(e,t),ze.init(e,t)});var r0=x("ZodBase64URL",(e,t)=>{qh.init(e,t),ze.init(e,t)});var n0=x("ZodE164",(e,t)=>{Uh.init(e,t),ze.init(e,t)});var o0=x("ZodJWT",(e,t)=>{Fh.init(e,t),ze.init(e,t)});var V_=x("ZodNumber",(e,t)=>{Pc.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(n,o,s)=>e_(e,n,o,s),No(e,"ZodNumber",{gt(n,o){return this.check(ii(n,o))},gte(n,o){return this.check(Io(n,o))},min(n,o){return this.check(Io(n,o))},lt(n,o){return this.check(si(n,o))},lte(n,o){return this.check(Eo(n,o))},max(n,o){return this.check(Eo(n,o))},int(n){return this.check(D_(n))},safe(n){return this.check(D_(n))},positive(n){return this.check(ii(0,n))},nonnegative(n){return this.check(Io(0,n))},negative(n){return this.check(si(0,n))},nonpositive(n){return this.check(Eo(0,n))},multipleOf(n,o){return this.check(ai(n,o))},step(n,o){return this.check(ai(n,o))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ce(e){return Ug(V_,e)}var s0=x("ZodNumberFormat",(e,t)=>{Vh.init(e,t),V_.init(e,t)});function D_(e){return Fg(s0,e)}var i0=x("ZodBoolean",(e,t)=>{Bh.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>t_(e,r,n,o)});function qe(e){return Vg(i0,e)}var a0=x("ZodNull",(e,t)=>{Jh.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>r_(e,r,n,o)});function B_(e){return Bg(a0,e)}var c0=x("ZodUnknown",(e,t)=>{Hh.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>o_(e,r,n,o)});function we(){return Jg(c0)}var u0=x("ZodNever",(e,t)=>{Kh.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>n_(e,r,n,o)});function l0(e){return Hg(u0,e)}var d0=x("ZodArray",(e,t)=>{Gh.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>u_(e,r,n,o),e.element=t.element,No(e,"ZodArray",{min(r,n){return this.check(Rn(r,n))},nonempty(r){return this.check(Rn(1,r))},max(r,n){return this.check(ci(r,n))},length(r,n){return this.check(ui(r,n))},unwrap(){return this.element}})});function Q(e,t){return Kg(d0,e,t)}var J_=x("ZodObject",(e,t)=>{Xh.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>l_(e,r,n,o),ne.defineLazy(e,"shape",()=>t.shape),No(e,"ZodObject",{keyof(){return ut(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:we()})},loose(){return this.clone({...this._zod.def,catchall:we()})},strict(){return this.clone({...this._zod.def,catchall:l0()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return ne.extend(this,r)},safeExtend(r){return ne.safeExtend(this,r)},merge(r){return ne.merge(this,r)},pick(r){return ne.pick(this,r)},omit(r){return ne.omit(this,r)},partial(...r){return ne.partial(G_,this,r[0])},required(...r){return ne.required(W_,this,r[0])}})});function R(e,t){let r={type:"object",shape:e??{},...ne.normalizeParams(t)};return new J_(r)}function ot(e,t){return new J_({type:"object",shape:e,catchall:we(),...ne.normalizeParams(t)})}var H_=x("ZodUnion",(e,t)=>{Tc.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>d_(e,r,n,o),e.options=t.options});function ve(e,t){return new H_({type:"union",options:e,...ne.normalizeParams(t)})}var p0=x("ZodDiscriminatedUnion",(e,t)=>{H_.init(e,t),Qh.init(e,t)});function Qc(e,t,r){return new p0({type:"union",options:t,discriminator:e,...ne.normalizeParams(r)})}var f0=x("ZodIntersection",(e,t)=>{eg.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>p_(e,r,n,o)});function di(e,t){return new f0({type:"intersection",left:e,right:t})}var L_=x("ZodRecord",(e,t)=>{tg.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>f_(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function fe(e,t,r){return!t||!t._zod?new L_({type:"record",keyType:y(),valueType:e,...ne.normalizeParams(t)}):new L_({type:"record",keyType:e,valueType:t,...ne.normalizeParams(r)})}var Xc=x("ZodEnum",(e,t)=>{rg.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(n,o,s)=>s_(e,n,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Xc({...t,checks:[],...ne.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Xc({...t,checks:[],...ne.normalizeParams(o),entries:s})}});function ut(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Xc({type:"enum",entries:r,...ne.normalizeParams(t)})}var m0=x("ZodLiteral",(e,t)=>{ng.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>i_(e,r,n,o),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 C(e,t){return new m0({type:"literal",values:Array.isArray(e)?e:[e],...ne.normalizeParams(t)})}var h0=x("ZodTransform",(e,t)=>{og.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>c_(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Pn(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(ne.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ne.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=o,r.fallback=!0,r)}});function K_(e){return new h0({type:"transform",transform:e})}var G_=x("ZodOptional",(e,t)=>{Ec.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ke(e){return new G_({type:"optional",innerType:e})}var g0=x("ZodExactOptional",(e,t)=>{sg.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _0(e){return new g0({type:"optional",innerType:e})}var y0=x("ZodNullable",(e,t)=>{ig.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>m_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function q_(e){return new y0({type:"nullable",innerType:e})}var v0=x("ZodDefault",(e,t)=>{ag.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>g_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function x0(e,t){return new v0({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ne.shallowClone(t)}})}var b0=x("ZodPrefault",(e,t)=>{cg.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>__(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $0(e,t){return new b0({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ne.shallowClone(t)}})}var W_=x("ZodNonOptional",(e,t)=>{ug.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>h_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function z0(e,t){return new W_({type:"nonoptional",innerType:e,...ne.normalizeParams(t)})}var w0=x("ZodCatch",(e,t)=>{lg.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>y_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function k0(e,t){return new w0({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Y_=x("ZodPipe",(e,t)=>{Ic.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>v_(e,r,n,o),e.in=t.in,e.out=t.out});function U_(e,t){return new Y_({type:"pipe",in:e,out:t})}var S0=x("ZodPreprocess",(e,t)=>{Y_.init(e,t),dg.init(e,t)}),P0=x("ZodReadonly",(e,t)=>{pg.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>x_(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function T0(e){return new P0({type:"readonly",innerType:e})}var X_=x("ZodCustom",(e,t)=>{fg.init(e,t),Se.init(e,t),e._zod.processJSONSchema=(r,n,o)=>a_(e,r,n,o)});function Q_(e,t){return Gg(X_,e??(()=>!0),t)}function E0(e,t={}){return Wg(X_,e,t)}function I0(e,t){return Yg(e,t)}function eu(e,t){return new S0({type:"pipe",in:K_(e),out:t})}yt(mg());var Z0="io.modelcontextprotocol/related-task",fi="2.0",Ce=Q_(e=>e!==null&&(typeof e=="object"||typeof e=="function")),ty=ve([y(),ce().int()]),ry=y(),KD=ot({ttl:ce().optional(),pollInterval:ce().optional()}),R0=R({ttl:ce().optional()}),O0=R({taskId:y()}),tu=ot({progressToken:ty.optional(),[Z0]:O0.optional()}),xt=R({_meta:tu.optional()}),mi=xt.extend({task:R0.optional()});var Ve=R({method:y(),params:xt.loose().optional()}),kt=R({_meta:tu.optional()}),St=R({method:y(),params:kt.loose().optional()}),Be=ot({_meta:tu.optional()}),hi=ve([y(),ce().int()]),N0=R({jsonrpc:C(fi),id:hi,...Ve.shape}).strict();var j0=R({jsonrpc:C(fi),...St.shape}).strict();var ny=R({jsonrpc:C(fi),id:hi,result:Be}).strict();var ey;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(ey||(ey={}));var oy=R({jsonrpc:C(fi),id:hi.optional(),error:R({code:ce().int(),message:y(),data:we().optional()})}).strict();var sy=ve([N0,j0,ny,oy]),GD=ve([ny,oy]),iy=Be.strict(),C0=kt.extend({requestId:hi.optional(),reason:y().optional()}),ay=St.extend({method:C("notifications/cancelled"),params:C0}),A0=R({src:y(),mimeType:y().optional(),sizes:Q(y()).optional(),theme:ut(["light","dark"]).optional()}),jo=R({icons:Q(A0).optional()}),On=R({name:y(),title:y().optional()}),cy=On.extend({...On.shape,...jo.shape,version:y(),websiteUrl:y().optional(),description:y().optional()}),M0=di(R({applyDefaults:qe().optional()}),fe(y(),we())),D0=eu(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,di(R({form:M0.optional(),url:Ce.optional()}),fe(y(),we()).optional())),L0=ot({list:Ce.optional(),cancel:Ce.optional(),requests:ot({sampling:ot({createMessage:Ce.optional()}).optional(),elicitation:ot({create:Ce.optional()}).optional()}).optional()}),q0=ot({list:Ce.optional(),cancel:Ce.optional(),requests:ot({tools:ot({call:Ce.optional()}).optional()}).optional()}),U0=R({experimental:fe(y(),Ce).optional(),sampling:R({context:Ce.optional(),tools:Ce.optional()}).optional(),elicitation:D0.optional(),roots:R({listChanged:qe().optional()}).optional(),tasks:L0.optional(),extensions:fe(y(),Ce).optional()}),F0=xt.extend({protocolVersion:y(),capabilities:U0,clientInfo:cy}),V0=Ve.extend({method:C("initialize"),params:F0});var B0=R({experimental:fe(y(),Ce).optional(),logging:Ce.optional(),completions:Ce.optional(),prompts:R({listChanged:qe().optional()}).optional(),resources:R({subscribe:qe().optional(),listChanged:qe().optional()}).optional(),tools:R({listChanged:qe().optional()}).optional(),tasks:q0.optional(),extensions:fe(y(),Ce).optional()}),J0=Be.extend({protocolVersion:y(),capabilities:B0,serverInfo:cy,instructions:y().optional()}),H0=St.extend({method:C("notifications/initialized"),params:kt.optional()});var uy=Ve.extend({method:C("ping"),params:xt.optional()}),K0=R({progress:ce(),total:ke(ce()),message:ke(y())}),G0=R({...kt.shape,...K0.shape,progressToken:ty}),ly=St.extend({method:C("notifications/progress"),params:G0}),W0=xt.extend({cursor:ry.optional()}),Co=Ve.extend({params:W0.optional()}),Ao=Be.extend({nextCursor:ry.optional()}),Y0=ut(["working","input_required","completed","failed","cancelled"]),Mo=R({taskId:y(),status:Y0,ttl:ve([ce(),B_()]),createdAt:y(),lastUpdatedAt:y(),pollInterval:ke(ce()),statusMessage:ke(y())}),dy=Be.extend({task:Mo}),X0=kt.merge(Mo),py=St.extend({method:C("notifications/tasks/status"),params:X0}),fy=Ve.extend({method:C("tasks/get"),params:xt.extend({taskId:y()})}),my=Be.merge(Mo),hy=Ve.extend({method:C("tasks/result"),params:xt.extend({taskId:y()})}),WD=Be.loose(),gy=Co.extend({method:C("tasks/list")}),_y=Ao.extend({tasks:Q(Mo)}),yy=Ve.extend({method:C("tasks/cancel"),params:xt.extend({taskId:y()})}),YD=Be.merge(Mo),vy=R({uri:y(),mimeType:ke(y()),_meta:fe(y(),we()).optional()}),xy=vy.extend({text:y()}),ru=y().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),by=vy.extend({blob:ru}),Do=ut(["user","assistant"]),Nn=R({audience:Q(Do).optional(),priority:ce().min(0).max(1).optional(),lastModified:Oo.datetime({offset:!0}).optional()}),$y=R({...On.shape,...jo.shape,uri:y(),description:ke(y()),mimeType:ke(y()),size:ke(ce()),annotations:Nn.optional(),_meta:ke(ot({}))}),Q0=R({...On.shape,...jo.shape,uriTemplate:y(),description:ke(y()),mimeType:ke(y()),annotations:Nn.optional(),_meta:ke(ot({}))}),eS=Co.extend({method:C("resources/list")}),tS=Ao.extend({resources:Q($y)}),rS=Co.extend({method:C("resources/templates/list")}),nS=Ao.extend({resourceTemplates:Q(Q0)}),nu=xt.extend({uri:y()}),oS=nu,sS=Ve.extend({method:C("resources/read"),params:oS}),iS=Be.extend({contents:Q(ve([xy,by]))}),aS=St.extend({method:C("notifications/resources/list_changed"),params:kt.optional()}),cS=nu,uS=Ve.extend({method:C("resources/subscribe"),params:cS}),lS=nu,dS=Ve.extend({method:C("resources/unsubscribe"),params:lS}),pS=kt.extend({uri:y()}),fS=St.extend({method:C("notifications/resources/updated"),params:pS}),mS=R({name:y(),description:ke(y()),required:ke(qe())}),hS=R({...On.shape,...jo.shape,description:ke(y()),arguments:ke(Q(mS)),_meta:ke(ot({}))}),gS=Co.extend({method:C("prompts/list")}),_S=Ao.extend({prompts:Q(hS)}),yS=xt.extend({name:y(),arguments:fe(y(),y()).optional()}),vS=Ve.extend({method:C("prompts/get"),params:yS}),ou=R({type:C("text"),text:y(),annotations:Nn.optional(),_meta:fe(y(),we()).optional()}),su=R({type:C("image"),data:ru,mimeType:y(),annotations:Nn.optional(),_meta:fe(y(),we()).optional()}),iu=R({type:C("audio"),data:ru,mimeType:y(),annotations:Nn.optional(),_meta:fe(y(),we()).optional()}),xS=R({type:C("tool_use"),name:y(),id:y(),input:fe(y(),we()),_meta:fe(y(),we()).optional()}),bS=R({type:C("resource"),resource:ve([xy,by]),annotations:Nn.optional(),_meta:fe(y(),we()).optional()}),$S=$y.extend({type:C("resource_link")}),au=ve([ou,su,iu,$S,bS]),zS=R({role:Do,content:au}),wS=Be.extend({description:y().optional(),messages:Q(zS)}),kS=St.extend({method:C("notifications/prompts/list_changed"),params:kt.optional()}),SS=R({title:y().optional(),readOnlyHint:qe().optional(),destructiveHint:qe().optional(),idempotentHint:qe().optional(),openWorldHint:qe().optional()}),PS=R({taskSupport:ut(["required","optional","forbidden"]).optional()}),zy=R({...On.shape,...jo.shape,description:y().optional(),inputSchema:R({type:C("object"),properties:fe(y(),Ce).optional(),required:Q(y()).optional()}).catchall(we()),outputSchema:R({type:C("object"),properties:fe(y(),Ce).optional(),required:Q(y()).optional()}).catchall(we()).optional(),annotations:SS.optional(),execution:PS.optional(),_meta:fe(y(),we()).optional()}),TS=Co.extend({method:C("tools/list")}),ES=Ao.extend({tools:Q(zy)}),wy=Be.extend({content:Q(au).default([]),structuredContent:fe(y(),we()).optional(),isError:qe().optional()}),XD=wy.or(Be.extend({toolResult:we()})),IS=mi.extend({name:y(),arguments:fe(y(),we()).optional()}),ZS=Ve.extend({method:C("tools/call"),params:IS}),RS=St.extend({method:C("notifications/tools/list_changed"),params:kt.optional()}),QD=R({autoRefresh:qe().default(!0),debounceMs:ce().int().nonnegative().default(300)}),ky=ut(["debug","info","notice","warning","error","critical","alert","emergency"]),OS=xt.extend({level:ky}),NS=Ve.extend({method:C("logging/setLevel"),params:OS}),jS=kt.extend({level:ky,logger:y().optional(),data:we()}),CS=St.extend({method:C("notifications/message"),params:jS}),AS=R({name:y().optional()}),MS=R({hints:Q(AS).optional(),costPriority:ce().min(0).max(1).optional(),speedPriority:ce().min(0).max(1).optional(),intelligencePriority:ce().min(0).max(1).optional()}),DS=R({mode:ut(["auto","required","none"]).optional()}),LS=R({type:C("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:Q(au).default([]),structuredContent:R({}).loose().optional(),isError:qe().optional(),_meta:fe(y(),we()).optional()}),qS=Qc("type",[ou,su,iu]),pi=Qc("type",[ou,su,iu,xS,LS]),US=R({role:Do,content:ve([pi,Q(pi)]),_meta:fe(y(),we()).optional()}),FS=mi.extend({messages:Q(US),modelPreferences:MS.optional(),systemPrompt:y().optional(),includeContext:ut(["none","thisServer","allServers"]).optional(),temperature:ce().optional(),maxTokens:ce().int(),stopSequences:Q(y()).optional(),metadata:Ce.optional(),tools:Q(zy).optional(),toolChoice:DS.optional()}),VS=Ve.extend({method:C("sampling/createMessage"),params:FS}),BS=Be.extend({model:y(),stopReason:ke(ut(["endTurn","stopSequence","maxTokens"]).or(y())),role:Do,content:qS}),JS=Be.extend({model:y(),stopReason:ke(ut(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:Do,content:ve([pi,Q(pi)])}),HS=R({type:C("boolean"),title:y().optional(),description:y().optional(),default:qe().optional()}),KS=R({type:C("string"),title:y().optional(),description:y().optional(),minLength:ce().optional(),maxLength:ce().optional(),format:ut(["email","uri","date","date-time"]).optional(),default:y().optional()}),GS=R({type:ut(["number","integer"]),title:y().optional(),description:y().optional(),minimum:ce().optional(),maximum:ce().optional(),default:ce().optional()}),WS=R({type:C("string"),title:y().optional(),description:y().optional(),enum:Q(y()),default:y().optional()}),YS=R({type:C("string"),title:y().optional(),description:y().optional(),oneOf:Q(R({const:y(),title:y()})),default:y().optional()}),XS=R({type:C("string"),title:y().optional(),description:y().optional(),enum:Q(y()),enumNames:Q(y()).optional(),default:y().optional()}),QS=ve([WS,YS]),eP=R({type:C("array"),title:y().optional(),description:y().optional(),minItems:ce().optional(),maxItems:ce().optional(),items:R({type:C("string"),enum:Q(y())}),default:Q(y()).optional()}),tP=R({type:C("array"),title:y().optional(),description:y().optional(),minItems:ce().optional(),maxItems:ce().optional(),items:R({anyOf:Q(R({const:y(),title:y()}))}),default:Q(y()).optional()}),rP=ve([eP,tP]),nP=ve([XS,QS,rP]),oP=ve([nP,HS,KS,GS]),sP=mi.extend({mode:C("form").optional(),message:y(),requestedSchema:R({type:C("object"),properties:fe(y(),oP),required:Q(y()).optional()})}),iP=mi.extend({mode:C("url"),message:y(),elicitationId:y(),url:y().url()}),aP=ve([sP,iP]),cP=Ve.extend({method:C("elicitation/create"),params:aP}),uP=kt.extend({elicitationId:y()}),lP=St.extend({method:C("notifications/elicitation/complete"),params:uP}),dP=Be.extend({action:ut(["accept","decline","cancel"]),content:eu(e=>e===null?void 0:e,fe(y(),ve([y(),ce(),qe(),Q(y())])).optional())}),pP=R({type:C("ref/resource"),uri:y()});var fP=R({type:C("ref/prompt"),name:y()}),mP=xt.extend({ref:ve([fP,pP]),argument:R({name:y(),value:y()}),context:R({arguments:fe(y(),y()).optional()}).optional()}),hP=Ve.extend({method:C("completion/complete"),params:mP});var gP=Be.extend({completion:ot({values:Q(y()).max(100),total:ke(ce().int()),hasMore:ke(qe())})}),_P=R({uri:y().startsWith("file://"),name:y().optional(),_meta:fe(y(),we()).optional()}),yP=Ve.extend({method:C("roots/list"),params:xt.optional()}),vP=Be.extend({roots:Q(_P)}),xP=St.extend({method:C("notifications/roots/list_changed"),params:kt.optional()}),e4=ve([uy,V0,hP,NS,vS,gS,eS,rS,sS,uS,dS,ZS,TS,fy,hy,gy,yy]),t4=ve([ay,ly,H0,xP,py]),r4=ve([iy,BS,JS,dP,vP,my,_y,dy]),n4=ve([uy,VS,cP,yP,fy,hy,gy,yy]),o4=ve([ay,ly,CS,fS,aS,RS,kS,py,lP]),s4=ve([iy,J0,gP,wS,_S,tS,nS,iS,wy,ES,my,_y,dy]);var gi=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
75
+ `);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),bP(r)}clear(){this._buffer=void 0}};function bP(e){return sy.parse(JSON.parse(e))}function Sy(e){return JSON.stringify(e)+`
76
+ `}var _i=class{constructor(t=Py.stdin,r=Py.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new gi,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=Sy(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var $={};vo($,{BRAND:()=>HP,DIRTY:()=>Vr,EMPTY_PATH:()=>kP,INVALID:()=>q,NEVER:()=>IT,OK:()=>Xe,ParseStatus:()=>Je,Schema:()=>H,ZodAny:()=>zr,ZodArray:()=>ur,ZodBigInt:()=>Jr,ZodBoolean:()=>Hr,ZodBranded:()=>qo,ZodCatch:()=>on,ZodDate:()=>Kr,ZodDefault:()=>nn,ZodDiscriminatedUnion:()=>xi,ZodEffects:()=>Tt,ZodEnum:()=>tn,ZodError:()=>lt,ZodFirstPartyTypeKind:()=>P,ZodFunction:()=>$i,ZodIntersection:()=>Xr,ZodIssueCode:()=>S,ZodLazy:()=>Qr,ZodLiteral:()=>en,ZodMap:()=>Ln,ZodNaN:()=>Un,ZodNativeEnum:()=>rn,ZodNever:()=>At,ZodNull:()=>Wr,ZodNullable:()=>Gt,ZodNumber:()=>Br,ZodObject:()=>pt,ZodOptional:()=>dt,ZodParsedType:()=>Z,ZodPipeline:()=>Uo,ZodPromise:()=>wr,ZodReadonly:()=>sn,ZodRecord:()=>bi,ZodSchema:()=>H,ZodSet:()=>qn,ZodString:()=>$r,ZodSymbol:()=>Mn,ZodTransformer:()=>Tt,ZodTuple:()=>Kt,ZodType:()=>H,ZodUndefined:()=>Gr,ZodUnion:()=>Yr,ZodUnknown:()=>cr,ZodVoid:()=>Dn,addIssueToContext:()=>T,any:()=>rT,array:()=>iT,bigint:()=>YP,boolean:()=>My,coerce:()=>ET,custom:()=>jy,date:()=>XP,datetimeRegex:()=>Oy,defaultErrorMap:()=>ir,discriminatedUnion:()=>uT,effect:()=>bT,enum:()=>yT,function:()=>hT,getErrorMap:()=>jn,getParsedType:()=>Ht,instanceof:()=>GP,intersection:()=>lT,isAborted:()=>yi,isAsync:()=>Cn,isDirty:()=>vi,isValid:()=>br,late:()=>KP,lazy:()=>gT,literal:()=>_T,makeIssue:()=>Lo,map:()=>fT,nan:()=>WP,nativeEnum:()=>vT,never:()=>oT,null:()=>tT,nullable:()=>zT,number:()=>Ay,object:()=>du,objectUtil:()=>cu,oboolean:()=>TT,onumber:()=>PT,optional:()=>$T,ostring:()=>ST,pipeline:()=>kT,preprocess:()=>wT,promise:()=>xT,quotelessJson:()=>$P,record:()=>pT,set:()=>mT,setErrorMap:()=>wP,strictObject:()=>aT,string:()=>Cy,symbol:()=>QP,transformer:()=>bT,tuple:()=>dT,undefined:()=>eT,union:()=>cT,unknown:()=>nT,util:()=>Y,void:()=>sT});var Y;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},e.getValidEnumValues=o=>{let s=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return e.objectValues(i)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},e.find=(o,s)=>{for(let i of o)if(s(i))return i},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}e.joinValues=n,e.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(Y||(Y={}));var cu;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(cu||(cu={}));var Z=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ht=e=>{switch(typeof e){case"undefined":return Z.undefined;case"string":return Z.string;case"number":return Number.isNaN(e)?Z.nan:Z.number;case"boolean":return Z.boolean;case"function":return Z.function;case"bigint":return Z.bigint;case"symbol":return Z.symbol;case"object":return Array.isArray(e)?Z.array:e===null?Z.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Z.promise:typeof Map<"u"&&e instanceof Map?Z.map:typeof Set<"u"&&e instanceof Set?Z.set:typeof Date<"u"&&e instanceof Date?Z.date:Z.object;default:return Z.unknown}};var S=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),$P=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),lt=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};lt.create=e=>new lt(e);var zP=(e,t)=>{let r;switch(e.code){case S.invalid_type:e.received===Z.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case S.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Y.jsonStringifyReplacer)}`;break;case S.unrecognized_keys:r=`Unrecognized key(s) in object: ${Y.joinValues(e.keys,", ")}`;break;case S.invalid_union:r="Invalid input";break;case S.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Y.joinValues(e.options)}`;break;case S.invalid_enum_value:r=`Invalid enum value. Expected ${Y.joinValues(e.options)}, received '${e.received}'`;break;case S.invalid_arguments:r="Invalid function arguments";break;case S.invalid_return_type:r="Invalid function return type";break;case S.invalid_date:r="Invalid date";break;case S.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Y.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case S.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case S.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case S.custom:r="Invalid input";break;case S.invalid_intersection_types:r="Intersection results could not be merged";break;case S.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case S.not_finite:r="Number must be finite";break;default:r=t.defaultError,Y.assertNever(e)}return{message:r}},ir=zP;var Ty=ir;function wP(e){Ty=e}function jn(){return Ty}var Lo=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:t,defaultError:a}).message;return{...o,path:s,message:a}},kP=[];function T(e,t){let r=jn(),n=Lo({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ir?void 0:ir].filter(o=>!!o)});e.common.issues.push(n)}var Je=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return q;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let s=await o.key,i=await o.value;n.push({key:s,value:i})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return q;s.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[s.value]=i.value)}return{status:t.value,value:n}}},q=Object.freeze({status:"aborted"}),Vr=e=>({status:"dirty",value:e}),Xe=e=>({status:"valid",value:e}),yi=e=>e.status==="aborted",vi=e=>e.status==="dirty",br=e=>e.status==="valid",Cn=e=>typeof Promise<"u"&&e instanceof Promise;var N;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(N||(N={}));var Pt=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ey=(e,t)=>{if(br(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new lt(e.common.issues);return this._error=r,this._error}}};function B(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(i,a)=>{let{message:c}=e;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var H=class{get description(){return this._def.description}_getType(t){return Ht(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Je,ctx:{common:t.parent.common,data:t.data,parsedType:Ht(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Cn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ht(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Ey(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ht(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return br(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>br(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Ht(t)},o=this._parse({data:t,path:n.path,parent:n}),s=await(Cn(o)?o:Promise.resolve(o));return Ey(n,s)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let i=t(o),a=()=>s.addIssue({code:S.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Tt({schema:this,typeName:P.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return dt.create(this,this._def)}nullable(){return Gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ur.create(this)}promise(){return wr.create(this,this._def)}or(t){return Yr.create([this,t],this._def)}and(t){return Xr.create(this,t,this._def)}transform(t){return new Tt({...B(this._def),schema:this,typeName:P.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new nn({...B(this._def),innerType:this,defaultValue:r,typeName:P.ZodDefault})}brand(){return new qo({typeName:P.ZodBranded,type:this,...B(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new on({...B(this._def),innerType:this,catchValue:r,typeName:P.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return Uo.create(this,t)}readonly(){return sn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},SP=/^c[^\s-]{8,}$/i,PP=/^[0-9a-z]+$/,TP=/^[0-9A-HJKMNP-TV-Z]{26}$/i,EP=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,IP=/^[a-z0-9_-]{21}$/i,ZP=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,RP=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,OP=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,NP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uu,jP=/^(?:(?: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])$/,CP=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,AP=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,MP=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(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}=))?$/,LP=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zy="((\\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])))",qP=new RegExp(`^${Zy}$`);function Ry(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function UP(e){return new RegExp(`^${Ry(e)}$`)}function Oy(e){let t=`${Zy}T${Ry(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function FP(e,t){return!!((t==="v4"||!t)&&jP.test(e)||(t==="v6"||!t)&&AP.test(e))}function VP(e,t){if(!ZP.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function BP(e,t){return!!((t==="v4"||!t)&&CP.test(e)||(t==="v6"||!t)&&MP.test(e))}var $r=class e extends H{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Z.string){let s=this._getOrReturnCtx(t);return T(s,{code:S.invalid_type,expected:Z.string,received:s.parsedType}),q}let n=new Je,o;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:S.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")t.data.length>s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:S.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=t.data.length>s.value,a=t.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(t,o),i?T(o,{code:S.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&T(o,{code:S.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")OP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"email",code:S.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")uu||(uu=new RegExp(NP,"u")),uu.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"emoji",code:S.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")EP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"uuid",code:S.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")IP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"nanoid",code:S.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")SP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"cuid",code:S.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")PP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"cuid2",code:S.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")TP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"ulid",code:S.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),T(o,{validation:"url",code:S.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"regex",code:S.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="includes"?t.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(t,o),T(o,{code:S.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?t.data=t.data.toLowerCase():s.kind==="toUpperCase"?t.data=t.data.toUpperCase():s.kind==="startsWith"?t.data.startsWith(s.value)||(o=this._getOrReturnCtx(t,o),T(o,{code:S.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),T(o,{code:S.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Oy(s).test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{code:S.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?qP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{code:S.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?UP(s).test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{code:S.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?RP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"duration",code:S.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?FP(t.data,s.version)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"ip",code:S.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?VP(t.data,s.alg)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"jwt",code:S.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?BP(t.data,s.version)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"cidr",code:S.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?DP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"base64",code:S.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?LP.test(t.data)||(o=this._getOrReturnCtx(t,o),T(o,{validation:"base64url",code:S.invalid_string,message:s.message}),n.dirty()):Y.assertNever(s);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:S.invalid_string,...N.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...N.errToObj(t)})}url(t){return this._addCheck({kind:"url",...N.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...N.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...N.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...N.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...N.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...N.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...N.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...N.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...N.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...N.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...N.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...N.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...N.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...N.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...N.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...N.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...N.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...N.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...N.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...N.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...N.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...N.errToObj(r)})}nonempty(t){return this.min(1,N.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};$r.create=e=>new $r({checks:[],typeName:P.ZodString,coerce:e?.coerce??!1,...B(e)});function JP(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}var Br=class e extends H{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Z.number){let s=this._getOrReturnCtx(t);return T(s,{code:S.invalid_type,expected:Z.number,received:s.parsedType}),q}let n,o=new Je;for(let s of this._def.checks)s.kind==="int"?Y.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),T(n,{code:S.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),T(n,{code:S.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),T(n,{code:S.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?JP(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),T(n,{code:S.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),T(n,{code:S.not_finite,message:s.message}),o.dirty()):Y.assertNever(s);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,N.toString(r))}gt(t,r){return this.setLimit("min",t,!1,N.toString(r))}lte(t,r){return this.setLimit("max",t,!0,N.toString(r))}lt(t,r){return this.setLimit("max",t,!1,N.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:N.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:N.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:N.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:N.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:N.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:N.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:N.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:N.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:N.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:N.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Y.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Br.create=e=>new Br({checks:[],typeName:P.ZodNumber,coerce:e?.coerce||!1,...B(e)});var Jr=class e extends H{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Z.bigint)return this._getInvalidInput(t);let n,o=new Je;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),T(n,{code:S.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),T(n,{code:S.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),T(n,{code:S.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):Y.assertNever(s);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return T(r,{code:S.invalid_type,expected:Z.bigint,received:r.parsedType}),q}gte(t,r){return this.setLimit("min",t,!0,N.toString(r))}gt(t,r){return this.setLimit("min",t,!1,N.toString(r))}lte(t,r){return this.setLimit("max",t,!0,N.toString(r))}lt(t,r){return this.setLimit("max",t,!1,N.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:N.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:N.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:N.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:N.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:N.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:N.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Jr.create=e=>new Jr({checks:[],typeName:P.ZodBigInt,coerce:e?.coerce??!1,...B(e)});var Hr=class extends H{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Z.boolean){let n=this._getOrReturnCtx(t);return T(n,{code:S.invalid_type,expected:Z.boolean,received:n.parsedType}),q}return Xe(t.data)}};Hr.create=e=>new Hr({typeName:P.ZodBoolean,coerce:e?.coerce||!1,...B(e)});var Kr=class e extends H{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Z.date){let s=this._getOrReturnCtx(t);return T(s,{code:S.invalid_type,expected:Z.date,received:s.parsedType}),q}if(Number.isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return T(s,{code:S.invalid_date}),q}let n=new Je,o;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:S.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(o=this._getOrReturnCtx(t,o),T(o,{code:S.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):Y.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:N.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:N.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Kr.create=e=>new Kr({checks:[],coerce:e?.coerce||!1,typeName:P.ZodDate,...B(e)});var Mn=class extends H{_parse(t){if(this._getType(t)!==Z.symbol){let n=this._getOrReturnCtx(t);return T(n,{code:S.invalid_type,expected:Z.symbol,received:n.parsedType}),q}return Xe(t.data)}};Mn.create=e=>new Mn({typeName:P.ZodSymbol,...B(e)});var Gr=class extends H{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return T(n,{code:S.invalid_type,expected:Z.undefined,received:n.parsedType}),q}return Xe(t.data)}};Gr.create=e=>new Gr({typeName:P.ZodUndefined,...B(e)});var Wr=class extends H{_parse(t){if(this._getType(t)!==Z.null){let n=this._getOrReturnCtx(t);return T(n,{code:S.invalid_type,expected:Z.null,received:n.parsedType}),q}return Xe(t.data)}};Wr.create=e=>new Wr({typeName:P.ZodNull,...B(e)});var zr=class extends H{constructor(){super(...arguments),this._any=!0}_parse(t){return Xe(t.data)}};zr.create=e=>new zr({typeName:P.ZodAny,...B(e)});var cr=class extends H{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Xe(t.data)}};cr.create=e=>new cr({typeName:P.ZodUnknown,...B(e)});var At=class extends H{_parse(t){let r=this._getOrReturnCtx(t);return T(r,{code:S.invalid_type,expected:Z.never,received:r.parsedType}),q}};At.create=e=>new At({typeName:P.ZodNever,...B(e)});var Dn=class extends H{_parse(t){if(this._getType(t)!==Z.undefined){let n=this._getOrReturnCtx(t);return T(n,{code:S.invalid_type,expected:Z.void,received:n.parsedType}),q}return Xe(t.data)}};Dn.create=e=>new Dn({typeName:P.ZodVoid,...B(e)});var ur=class e extends H{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==Z.array)return T(r,{code:S.invalid_type,expected:Z.array,received:r.parsedType}),q;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(i||a)&&(T(r,{code:i?S.too_big:S.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(T(r,{code:S.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(T(r,{code:S.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>o.type._parseAsync(new Pt(r,i,r.path,a)))).then(i=>Je.mergeArray(n,i));let s=[...r.data].map((i,a)=>o.type._parseSync(new Pt(r,i,r.path,a)));return Je.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:N.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:N.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:N.toString(r)}})}nonempty(t){return this.min(1,t)}};ur.create=(e,t)=>new ur({type:e,minLength:null,maxLength:null,exactLength:null,typeName:P.ZodArray,...B(t)});function An(e){if(e instanceof pt){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=dt.create(An(n))}return new pt({...e._def,shape:()=>t})}else return e instanceof ur?new ur({...e._def,type:An(e.element)}):e instanceof dt?dt.create(An(e.unwrap())):e instanceof Gt?Gt.create(An(e.unwrap())):e instanceof Kt?Kt.create(e.items.map(t=>An(t))):e}var pt=class e extends H{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=Y.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==Z.object){let u=this._getOrReturnCtx(t);return T(u,{code:S.invalid_type,expected:Z.object,received:u.parsedType}),q}let{status:n,ctx:o}=this._processInputParams(t),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof At&&this._def.unknownKeys==="strip"))for(let u in o.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=s[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Pt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof At){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(T(o,{code:S.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Pt(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,m=await l.value;u.push({key:d,value:m,alwaysSet:l.alwaysSet})}return u}).then(u=>Je.mergeObjectSync(n,u)):Je.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return N.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:N.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:P.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of Y.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of Y.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return An(this)}partial(t){let r={};for(let n of Y.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of Y.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof dt;)s=s._def.innerType;r[n]=s}return new e({...this._def,shape:()=>r})}keyof(){return Ny(Y.objectKeys(this.shape))}};pt.create=(e,t)=>new pt({shape:()=>e,unknownKeys:"strip",catchall:At.create(),typeName:P.ZodObject,...B(t)});pt.strictCreate=(e,t)=>new pt({shape:()=>e,unknownKeys:"strict",catchall:At.create(),typeName:P.ZodObject,...B(t)});pt.lazycreate=(e,t)=>new pt({shape:e,unknownKeys:"strip",catchall:At.create(),typeName:P.ZodObject,...B(t)});var Yr=class extends H{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new lt(a.ctx.common.issues));return T(r,{code:S.invalid_union,unionErrors:i}),q}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new lt(c));return T(r,{code:S.invalid_union,unionErrors:a}),q}}get options(){return this._def.options}};Yr.create=(e,t)=>new Yr({options:e,typeName:P.ZodUnion,...B(t)});var ar=e=>e instanceof Qr?ar(e.schema):e instanceof Tt?ar(e.innerType()):e instanceof en?[e.value]:e instanceof tn?e.options:e instanceof rn?Y.objectValues(e.enum):e instanceof nn?ar(e._def.innerType):e instanceof Gr?[void 0]:e instanceof Wr?[null]:e instanceof dt?[void 0,...ar(e.unwrap())]:e instanceof Gt?[null,...ar(e.unwrap())]:e instanceof qo||e instanceof sn?ar(e.unwrap()):e instanceof on?ar(e._def.innerType):[],xi=class e extends H{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.object)return T(r,{code:S.invalid_type,expected:Z.object,received:r.parsedType}),q;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(T(r,{code:S.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let s of r){let i=ar(s.shape[t]);if(!i.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,s)}}return new e({typeName:P.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...B(n)})}};function lu(e,t){let r=Ht(e),n=Ht(t);if(e===t)return{valid:!0,data:e};if(r===Z.object&&n===Z.object){let o=Y.objectKeys(t),s=Y.objectKeys(e).filter(a=>o.indexOf(a)!==-1),i={...e,...t};for(let a of s){let c=lu(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===Z.array&&n===Z.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let s=0;s<e.length;s++){let i=e[s],a=t[s],c=lu(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===Z.date&&n===Z.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Xr=class extends H{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(s,i)=>{if(yi(s)||yi(i))return q;let a=lu(s.value,i.value);return a.valid?((vi(s)||vi(i))&&r.dirty(),{status:r.value,value:a.data}):(T(n,{code:S.invalid_intersection_types}),q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Xr.create=(e,t,r)=>new Xr({left:e,right:t,typeName:P.ZodIntersection,...B(r)});var Kt=class e extends H{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.array)return T(n,{code:S.invalid_type,expected:Z.array,received:n.parsedType}),q;if(n.data.length<this._def.items.length)return T(n,{code:S.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),q;!this._def.rest&&n.data.length>this._def.items.length&&(T(n,{code:S.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Pt(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Je.mergeArray(r,i)):Je.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Kt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Kt({items:e,typeName:P.ZodTuple,rest:null,...B(t)})};var bi=class e extends H{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.object)return T(n,{code:S.invalid_type,expected:Z.object,received:n.parsedType}),q;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in n.data)o.push({key:s._parse(new Pt(n,a,n.path,a)),value:i._parse(new Pt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Je.mergeObjectAsync(r,o):Je.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof H?new e({keyType:t,valueType:r,typeName:P.ZodRecord,...B(n)}):new e({keyType:$r.create(),valueType:t,typeName:P.ZodRecord,...B(r)})}},Ln=class extends H{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.map)return T(n,{code:S.invalid_type,expected:Z.map,received:n.parsedType}),q;let o=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new Pt(n,a,n.path,[u,"key"])),value:s._parse(new Pt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return q;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return q;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};Ln.create=(e,t,r)=>new Ln({valueType:t,keyType:e,typeName:P.ZodMap,...B(r)});var qn=class e extends H{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==Z.set)return T(n,{code:S.invalid_type,expected:Z.set,received:n.parsedType}),q;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(T(n,{code:S.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(T(n,{code:S.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return q;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>s._parse(new Pt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:N.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:N.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};qn.create=(e,t)=>new qn({valueType:e,minSize:null,maxSize:null,typeName:P.ZodSet,...B(t)});var $i=class e extends H{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.function)return T(r,{code:S.invalid_type,expected:Z.function,received:r.parsedType}),q;function n(a,c){return Lo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,jn(),ir].filter(u=>!!u),issueData:{code:S.invalid_arguments,argumentsError:c}})}function o(a,c){return Lo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,jn(),ir].filter(u=>!!u),issueData:{code:S.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof wr){let a=this;return Xe(async function(...c){let u=new lt([]),l=await a._def.args.parseAsync(c,s).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let a=this;return Xe(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new lt([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,s);if(!d.success)throw new lt([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Kt.create(t).rest(cr.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Kt.create([]).rest(cr.create()),returns:r||cr.create(),typeName:P.ZodFunction,...B(n)})}},Qr=class extends H{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Qr.create=(e,t)=>new Qr({getter:e,typeName:P.ZodLazy,...B(t)});var en=class extends H{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return T(r,{received:r.data,code:S.invalid_literal,expected:this._def.value}),q}return{status:"valid",value:t.data}}get value(){return this._def.value}};en.create=(e,t)=>new en({value:e,typeName:P.ZodLiteral,...B(t)});function Ny(e,t){return new tn({values:e,typeName:P.ZodEnum,...B(t)})}var tn=class e extends H{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return T(r,{expected:Y.joinValues(n),received:r.parsedType,code:S.invalid_type}),q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return T(r,{received:r.data,code:S.invalid_enum_value,options:n}),q}return Xe(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};tn.create=Ny;var rn=class extends H{_parse(t){let r=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==Z.string&&n.parsedType!==Z.number){let o=Y.objectValues(r);return T(n,{expected:Y.joinValues(o),received:n.parsedType,code:S.invalid_type}),q}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Y.objectValues(r);return T(n,{received:n.data,code:S.invalid_enum_value,options:o}),q}return Xe(t.data)}get enum(){return this._def.values}};rn.create=(e,t)=>new rn({values:e,typeName:P.ZodNativeEnum,...B(t)});var wr=class extends H{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==Z.promise&&r.common.async===!1)return T(r,{code:S.invalid_type,expected:Z.promise,received:r.parsedType}),q;let n=r.parsedType===Z.promise?r.data:Promise.resolve(r.data);return Xe(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};wr.create=(e,t)=>new wr({type:e,typeName:P.ZodPromise,...B(t)});var Tt=class extends H{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===P.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,s={addIssue:i=>{T(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return q;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?q:c.status==="dirty"?Vr(c.value):r.value==="dirty"?Vr(c.value):c});{if(r.value==="aborted")return q;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?q:a.status==="dirty"?Vr(a.value):r.value==="dirty"?Vr(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?q:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?q:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!br(i))return q;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>br(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:r.value,value:a})):q);Y.assertNever(o)}};Tt.create=(e,t,r)=>new Tt({schema:e,typeName:P.ZodEffects,effect:t,...B(r)});Tt.createWithPreprocess=(e,t,r)=>new Tt({schema:t,effect:{type:"preprocess",transform:e},typeName:P.ZodEffects,...B(r)});var dt=class extends H{_parse(t){return this._getType(t)===Z.undefined?Xe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};dt.create=(e,t)=>new dt({innerType:e,typeName:P.ZodOptional,...B(t)});var Gt=class extends H{_parse(t){return this._getType(t)===Z.null?Xe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Gt.create=(e,t)=>new Gt({innerType:e,typeName:P.ZodNullable,...B(t)});var nn=class extends H{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===Z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};nn.create=(e,t)=>new nn({innerType:e,typeName:P.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...B(t)});var on=class extends H{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Cn(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new lt(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new lt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};on.create=(e,t)=>new on({innerType:e,typeName:P.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...B(t)});var Un=class extends H{_parse(t){if(this._getType(t)!==Z.nan){let n=this._getOrReturnCtx(t);return T(n,{code:S.invalid_type,expected:Z.nan,received:n.parsedType}),q}return{status:"valid",value:t.data}}};Un.create=e=>new Un({typeName:P.ZodNaN,...B(e)});var HP=Symbol("zod_brand"),qo=class extends H{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Uo=class e extends H{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?q:s.status==="dirty"?(r.dirty(),Vr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?q:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:P.ZodPipeline})}},sn=class extends H{_parse(t){let r=this._def.innerType._parse(t),n=o=>(br(o)&&(o.value=Object.freeze(o.value)),o);return Cn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};sn.create=(e,t)=>new sn({innerType:e,typeName:P.ZodReadonly,...B(t)});function Iy(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function jy(e,t={},r){return e?zr.create().superRefine((n,o)=>{let s=e(n);if(s instanceof Promise)return s.then(i=>{if(!i){let a=Iy(t,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=Iy(t,n),a=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:a})}}):zr.create()}var KP={object:pt.lazycreate},P;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(P||(P={}));var GP=(e,t={message:`Input not instance of ${e.name}`})=>jy(r=>r instanceof e,t),Cy=$r.create,Ay=Br.create,WP=Un.create,YP=Jr.create,My=Hr.create,XP=Kr.create,QP=Mn.create,eT=Gr.create,tT=Wr.create,rT=zr.create,nT=cr.create,oT=At.create,sT=Dn.create,iT=ur.create,du=pt.create,aT=pt.strictCreate,cT=Yr.create,uT=xi.create,lT=Xr.create,dT=Kt.create,pT=bi.create,fT=Ln.create,mT=qn.create,hT=$i.create,gT=Qr.create,_T=en.create,yT=tn.create,vT=rn.create,xT=wr.create,bT=Tt.create,$T=dt.create,zT=Gt.create,wT=Tt.createWithPreprocess,kT=Uo.create,ST=()=>Cy().optional(),PT=()=>Ay().optional(),TT=()=>My().optional(),ET={string:e=>$r.create({...e,coerce:!0}),number:e=>Br.create({...e,coerce:!0}),boolean:e=>Hr.create({...e,coerce:!0}),bigint:e=>Jr.create({...e,coerce:!0}),date:e=>Kr.create({...e,coerce:!0})};var IT=q;var ZT=Object.freeze({status:"aborted"});function b(e,t,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,c);for(let l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var RT=Symbol("zod_brand"),lr=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},zi={};function bt(e){return e&&Object.assign(zi,e),zi}var X={};vo(X,{BIGINT_FORMAT_RANGES:()=>Ly,Class:()=>fu,NUMBER_FORMAT_RANGES:()=>xu,aborted:()=>cn,allowsEval:()=>_u,assert:()=>AT,assertEqual:()=>OT,assertIs:()=>jT,assertNever:()=>CT,assertNotEqual:()=>NT,assignProp:()=>gu,cached:()=>Bo,captureStackTrace:()=>ki,cleanEnum:()=>WT,cleanRegex:()=>Ho,clone:()=>$t,createTransparentProxy:()=>FT,defineLazy:()=>me,esc:()=>an,escapeRegex:()=>kr,extend:()=>JT,finalizeIssue:()=>Mt,floatSafeRemainder:()=>hu,getElementAtPath:()=>MT,getEnumValues:()=>Vo,getLengthableOrigin:()=>Ko,getParsedType:()=>UT,getSizableOrigin:()=>qy,isObject:()=>Fn,isPlainObject:()=>Vn,issue:()=>bu,joinValues:()=>wi,jsonStringifyReplacer:()=>mu,merge:()=>HT,normalizeParams:()=>U,nullish:()=>Jo,numKeys:()=>qT,omit:()=>BT,optionalKeys:()=>vu,partial:()=>KT,pick:()=>VT,prefixIssues:()=>Wt,primitiveTypes:()=>Dy,promiseAllObject:()=>DT,propertyKeyTypes:()=>yu,randomString:()=>LT,required:()=>GT,stringifyPrimitive:()=>Si,unwrapMessage:()=>Fo});function OT(e){return e}function NT(e){return e}function jT(e){}function CT(e){throw new Error}function AT(e){}function Vo(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function wi(e,t="|"){return e.map(r=>Si(r)).join(t)}function mu(e,t){return typeof t=="bigint"?t.toString():t}function Bo(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Jo(e){return e==null}function Ho(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function hu(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}function me(e,t,r){Object.defineProperty(e,t,{get(){{let o=r();return e[t]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function gu(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function MT(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function DT(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=n[s];return o})}function LT(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function an(e){return JSON.stringify(e)}var ki=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Fn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var _u=Bo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Vn(e){if(Fn(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;return!(Fn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function qT(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var UT=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}`)}},yu=new Set(["string","number","symbol"]),Dy=new Set(["string","number","bigint","boolean","symbol","undefined"]);function kr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $t(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function U(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 FT(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,s){return t??(t=e()),Reflect.set(t,n,o,s)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function Si(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function vu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var xu={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]},Ly={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function VT(e,t){let r={},n=e._zod.def;for(let o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(r[o]=n.shape[o])}return $t(e,{...e._zod.def,shape:r,checks:[]})}function BT(e,t){let r={...e._zod.def.shape},n=e._zod.def;for(let o in t){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete r[o]}return $t(e,{...e._zod.def,shape:r,checks:[]})}function JT(e,t){if(!Vn(t))throw new Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return gu(this,"shape",n),n},checks:[]};return $t(e,r)}function HT(e,t){return $t(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return gu(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function KT(e,t,r){let n=t._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=e?new e({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)o[s]=e?new e({type:"optional",innerType:n[s]}):n[s];return $t(t,{...t._zod.def,shape:o,checks:[]})}function GT(e,t,r){let n=t._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new e({type:"nonoptional",innerType:n[s]});return $t(t,{...t._zod.def,shape:o,checks:[]})}function cn(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Wt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Fo(e){return typeof e=="string"?e:e?.message}function Mt(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Fo(e.inst?._zod.def?.error?.(e))??Fo(t?.error?.(e))??Fo(r.customError?.(e))??Fo(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function qy(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ko(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function bu(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function WT(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}var fu=class{constructor(...t){}};var Uy=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,mu,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pi=b("$ZodError",Uy),Go=b("$ZodError",Uy,{Parent:Error});function $u(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function zu(e,t){let r=t||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(e),n}var wu=e=>(t,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new lr;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>Mt(c,s,bt())));throw ki(a,o?.callee),a}return i.value},ku=wu(Go),Su=e=>async(t,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>Mt(c,s,bt())));throw ki(a,o?.callee),a}return i.value},Pu=Su(Go),Tu=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new lr;return s.issues.length?{success:!1,error:new(e??Pi)(s.issues.map(i=>Mt(i,o,bt())))}:{success:!0,data:s.value}},un=Tu(Go),Eu=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Mt(i,o,bt())))}:{success:!0,data:s.value}},ln=Eu(Go);var Fy=/^[cC][^\s-]{8,}$/,Vy=/^[0-9a-z]+$/,By=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Jy=/^[0-9a-vA-V]{20}$/,Hy=/^[A-Za-z0-9]{27}$/,Ky=/^[a-zA-Z0-9_-]{21}$/,Gy=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Wy=/^([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})$/,Iu=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)$/;var Yy=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var XT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Xy(){return new RegExp(XT,"u")}var Qy=/^(?:(?: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])$/,ev=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,tv=/^((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])$/,rv=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nv=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zu=/^[A-Za-z0-9_-]*$/,ov=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var sv=/^\+(?:[0-9]){6,14}[0-9]$/,iv="(?:(?:\\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])))",av=new RegExp(`^${iv}$`);function cv(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}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function uv(e){return new RegExp(`^${cv(e)}$`)}function lv(e){let t=cv({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${iv}T(?:${n})$`)}var dv=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var pv=/^\d+$/,fv=/^-?\d+(?:\.\d+)?/i,mv=/true|false/i,hv=/null/i;var gv=/^[^A-Z]*$/,_v=/^[^a-z]*$/;var He=b("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),yv={number:"number",bigint:"bigint",object:"date"},Ru=b("$ZodCheckLessThan",(e,t)=>{He.init(e,t);let r=yv[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ou=b("$ZodCheckGreaterThan",(e,t)=>{He.init(e,t);let r=yv[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vv=b("$ZodCheckMultipleOf",(e,t)=>{He.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),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"?r.value%t.value===BigInt(0):hu(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})}}),xv=b("$ZodCheckNumberFormat",(e,t)=>{He.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=xu[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,r&&(a.pattern=pv)}),e._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}});var bv=b("$ZodCheckMaxLength",(e,t)=>{var r;He.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Jo(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let i=Ko(o);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$v=b("$ZodCheckMinLength",(e,t)=>{var r;He.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Jo(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let i=Ko(o);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zv=b("$ZodCheckLengthEquals",(e,t)=>{var r;He.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Jo(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,s=o.length;if(s===t.length)return;let i=Ko(o),a=s>t.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Wo=b("$ZodCheckStringFormat",(e,t)=>{var r,n;He.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),wv=b("$ZodCheckRegex",(e,t)=>{Wo.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})}}),kv=b("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=gv),Wo.init(e,t)}),Sv=b("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=_v),Wo.init(e,t)}),Pv=b("$ZodCheckIncludes",(e,t)=>{He.init(e,t);let r=kr(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Tv=b("$ZodCheckStartsWith",(e,t)=>{He.init(e,t);let r=new RegExp(`^${kr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ev=b("$ZodCheckEndsWith",(e,t)=>{He.init(e,t);let r=new RegExp(`.*${kr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var Iv=b("$ZodCheckOverwrite",(e,t)=>{He.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ei=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
77
+ `).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...r,o.join(`
78
+ `))}};var Rv={major:4,minor:0,patch:0};var le=b("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Rv;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let s of o._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(s,i,a)=>{let c=cn(s),u;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(c)continue;let d=s.issues.length,m=l._zod.check(s);if(m instanceof Promise&&a?.async===!1)throw new lr;if(u||m instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await m,s.issues.length!==d&&(c||(c=cn(s,d)))});else{if(s.issues.length===d)continue;c||(c=cn(s,d))}}return u?u.then(()=>s):s};e._zod.run=(s,i)=>{let a=e._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new lr;return a.then(c=>o(c,n,i))}return o(a,n,i)}}e["~standard"]={validate:o=>{try{let s=un(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return ln(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Yo=b("$ZodString",(e,t)=>{le.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??dv(e._zod.bag),e._zod.parse=(r,n)=>{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}}),he=b("$ZodStringFormat",(e,t)=>{Wo.init(e,t),Yo.init(e,t)}),ju=b("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Wy),he.init(e,t)}),Cu=b("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Iu(n))}else t.pattern??(t.pattern=Iu());he.init(e,t)}),Au=b("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Yy),he.init(e,t)}),Mu=b("$ZodURL",(e,t)=>{he.init(e,t),e._zod.check=r=>{try{let n=r.value,o=new URL(n),s=o.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:ov.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Du=b("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Xy()),he.init(e,t)}),Lu=b("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ky),he.init(e,t)}),qu=b("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Fy),he.init(e,t)}),Uu=b("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Vy),he.init(e,t)}),Fu=b("$ZodULID",(e,t)=>{t.pattern??(t.pattern=By),he.init(e,t)}),Vu=b("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Jy),he.init(e,t)}),Bu=b("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Hy),he.init(e,t)}),Uv=b("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=lv(t)),he.init(e,t)}),Fv=b("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=av),he.init(e,t)}),Vv=b("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=uv(t)),he.init(e,t)}),Bv=b("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Gy),he.init(e,t)}),Ju=b("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Qy),he.init(e,t),e._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),Hu=b("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ev),he.init(e,t),e._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ku=b("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=tv),he.init(e,t)}),Gu=b("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=rv),he.init(e,t),e._zod.check=r=>{let[n,o]=r.value.split("/");try{if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Jv(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Wu=b("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=nv),he.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{Jv(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function QT(e){if(!Zu.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jv(r)}var Yu=b("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Zu),he.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{QT(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Xu=b("$ZodE164",(e,t)=>{t.pattern??(t.pattern=sv),he.init(e,t)});function eE(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Qu=b("$ZodJWT",(e,t)=>{he.init(e,t),e._zod.check=r=>{eE(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Zi=b("$ZodNumber",(e,t)=>{le.init(e,t),e._zod.pattern=e._zod.bag.pattern??fv,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),el=b("$ZodNumber",(e,t)=>{xv.init(e,t),Zi.init(e,t)}),tl=b("$ZodBoolean",(e,t)=>{le.init(e,t),e._zod.pattern=mv,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var rl=b("$ZodNull",(e,t)=>{le.init(e,t),e._zod.pattern=hv,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}});var nl=b("$ZodUnknown",(e,t)=>{le.init(e,t),e._zod.parse=r=>r}),ol=b("$ZodNever",(e,t)=>{le.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Ov(e,t,r){e.issues.length&&t.issues.push(...Wt(r,e.issues)),t.value[r]=e.value}var sl=b("$ZodArray",(e,t)=>{le.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Ov(u,r,i))):Ov(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Ii(e,t,r){e.issues.length&&t.issues.push(...Wt(r,e.issues)),t.value[r]=e.value}function Nv(e,t,r,n){e.issues.length?n[r]===void 0?r in n?t.value[r]=void 0:t.value[r]=e.value:t.issues.push(...Wt(r,e.issues)):e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}var Ri=b("$ZodObject",(e,t)=>{le.init(e,t);let r=Bo(()=>{let d=Object.keys(t.shape);for(let f of d)if(!(t.shape[f]instanceof le))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);let m=vu(t.shape);return{shape:t.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(m)}});me(e._zod,"propValues",()=>{let d=t.shape,m={};for(let f in d){let p=d[f]._zod;if(p.values){m[f]??(m[f]=new Set);for(let h of p.values)m[f].add(h)}}return m});let n=d=>{let m=new Ei(["shape","payload","ctx"]),f=r.value,p=g=>{let w=an(g);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};m.write("const input = payload.value;");let h=Object.create(null),_=0;for(let g of f.keys)h[g]=`key_${_++}`;m.write("const newResult = {}");for(let g of f.keys)if(f.optionalKeys.has(g)){let w=h[g];m.write(`const ${w} = ${p(g)};`);let k=an(g);m.write(`
79
+ if (${w}.issues.length) {
80
+ if (input[${k}] === undefined) {
81
+ if (${k} in input) {
82
+ newResult[${k}] = undefined;
83
+ }
84
+ } else {
85
+ payload.issues = payload.issues.concat(
86
+ ${w}.issues.map((iss) => ({
87
+ ...iss,
88
+ path: iss.path ? [${k}, ...iss.path] : [${k}],
89
+ }))
90
+ );
91
+ }
92
+ } else if (${w}.value === undefined) {
93
+ if (${k} in input) newResult[${k}] = undefined;
94
+ } else {
95
+ newResult[${k}] = ${w}.value;
96
+ }
97
+ `)}else{let w=h[g];m.write(`const ${w} = ${p(g)};`),m.write(`
98
+ if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
99
+ ...iss,
100
+ path: iss.path ? [${an(g)}, ...iss.path] : [${an(g)}]
101
+ })));`),m.write(`newResult[${an(g)}] = ${w}.value`)}m.write("payload.value = newResult;"),m.write("return payload;");let z=m.compile();return(g,w)=>z(d,g,w)},o,s=Fn,i=!zi.jitless,c=i&&_u.value,u=t.catchall,l;e._zod.parse=(d,m)=>{l??(l=r.value);let f=d.value;if(!s(f))return d.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),d;let p=[];if(i&&c&&m?.async===!1&&m.jitless!==!0)o||(o=n(t.shape)),d=o(d,m);else{d.value={};let w=l.shape;for(let k of l.keys){let I=w[k],Le=I._zod.run({value:f[k],issues:[]},m),rt=I._zod.optin==="optional"&&I._zod.optout==="optional";Le instanceof Promise?p.push(Le.then(gr=>rt?Nv(gr,d,k,f):Ii(gr,d,k))):rt?Nv(Le,d,k,f):Ii(Le,d,k)}}if(!u)return p.length?Promise.all(p).then(()=>d):d;let h=[],_=l.keySet,z=u._zod,g=z.def.type;for(let w of Object.keys(f)){if(_.has(w))continue;if(g==="never"){h.push(w);continue}let k=z.run({value:f[w],issues:[]},m);k instanceof Promise?p.push(k.then(I=>Ii(I,d,w))):Ii(k,d,w)}return h.length&&d.issues.push({code:"unrecognized_keys",keys:h,input:f,inst:e}),p.length?Promise.all(p).then(()=>d):d}});function jv(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(s=>Mt(s,n,bt())))}),t}var Oi=b("$ZodUnion",(e,t)=>{le.init(e,t),me(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),me(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),me(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),me(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Ho(n.source)).join("|")})$`)}}),e._zod.parse=(r,n)=>{let o=!1,s=[];for(let i of t.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>jv(i,r,e,n)):jv(s,r,e,n)}}),il=b("$ZodDiscriminatedUnion",(e,t)=>{Oi.init(e,t);let r=e._zod.parse;me(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Bo(()=>{let o=t.options,s=new Map;for(let i of o){let a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Fn(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=n.value.get(i?.[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),o)}}),al=b("$ZodIntersection",(e,t)=>{le.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Cv(r,c,u)):Cv(r,s,i)}});function Nu(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(Vn(e)&&Vn(t)){let r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),o={...e,...t};for(let s of n){let i=Nu(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=Nu(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Cv(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),cn(e))return e;let n=Nu(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}var cl=b("$ZodRecord",(e,t)=>{le.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Vn(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let s=[];if(t.keyType._zod.values){let i=t.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=t.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...Wt(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...Wt(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=t.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>Mt(u,n,bt())),input:i,path:[i],inst:e}),r.value[a.value]=a.value;continue}let c=t.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...Wt(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...Wt(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var ul=b("$ZodEnum",(e,t)=>{le.init(e,t);let r=Vo(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter(n=>yu.has(typeof n)).map(n=>typeof n=="string"?kr(n):n.toString()).join("|")})$`),e._zod.parse=(n,o)=>{let s=n.value;return e._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:e}),n}}),ll=b("$ZodLiteral",(e,t)=>{le.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?kr(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,n)=>{let o=r.value;return e._zod.values.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}});var dl=b("$ZodTransform",(e,t)=>{le.init(e,t),e._zod.parse=(r,n)=>{let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new lr;return r.value=o,r}}),pl=b("$ZodOptional",(e,t)=>{le.init(e,t),e._zod.optin="optional",e._zod.optout="optional",me(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),me(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ho(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(r,n):r.value===void 0?r:t.innerType._zod.run(r,n)}),fl=b("$ZodNullable",(e,t)=>{le.init(e,t),me(e._zod,"optin",()=>t.innerType._zod.optin),me(e._zod,"optout",()=>t.innerType._zod.optout),me(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ho(r.source)}|null)$`):void 0}),me(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ml=b("$ZodDefault",(e,t)=>{le.init(e,t),e._zod.optin="optional",me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Av(s,t)):Av(o,t)}});function Av(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var hl=b("$ZodPrefault",(e,t)=>{le.init(e,t),e._zod.optin="optional",me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),gl=b("$ZodNonOptional",(e,t)=>{le.init(e,t),me(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Mv(s,e)):Mv(o,e)}});function Mv(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var _l=b("$ZodCatch",(e,t)=>{le.init(e,t),e._zod.optin="optional",me(e._zod,"optout",()=>t.innerType._zod.optout),me(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Mt(i,n,bt()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(s=>Mt(s,n,bt()))},input:r.value}),r.issues=[]),r)}});var yl=b("$ZodPipe",(e,t)=>{le.init(e,t),me(e._zod,"values",()=>t.in._zod.values),me(e._zod,"optin",()=>t.in._zod.optin),me(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,n)=>{let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Dv(s,t,n)):Dv(o,t,n)}});function Dv(e,t,r){return cn(e)?e:t.out._zod.run({value:e.value,issues:e.issues},r)}var vl=b("$ZodReadonly",(e,t)=>{le.init(e,t),me(e._zod,"propValues",()=>t.innerType._zod.propValues),me(e._zod,"values",()=>t.innerType._zod.values),me(e._zod,"optin",()=>t.innerType._zod.optin),me(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Lv):Lv(o)}});function Lv(e){return e.value=Object.freeze(e.value),e}var xl=b("$ZodCustom",(e,t)=>{He.init(e,t),le.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(s=>qv(s,r,n,e));qv(o,r,n,e)}});function qv(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(bu(o))}}var tE=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},rE=()=>{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"}};function t(n){return e[n]??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",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${tE(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${Si(n.values[0])}`:`Invalid option: expected one of ${wi(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=t(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=t(n.origin);return s?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${s.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${wi(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Hv(){return{localeError:rE()}}var nE=Symbol("ZodOutput"),oE=Symbol("ZodInput"),Xo=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...r){let n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new Map,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 n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function Kv(){return new Xo}var Sr=Kv();function bl(e,t){return new e({type:"string",...U(t)})}function $l(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...U(t)})}function Ni(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...U(t)})}function zl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...U(t)})}function wl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(t)})}function kl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(t)})}function Sl(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(t)})}function Pl(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...U(t)})}function Tl(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...U(t)})}function El(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(t)})}function Il(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...U(t)})}function Zl(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(t)})}function Rl(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...U(t)})}function Ol(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...U(t)})}function Nl(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(t)})}function jl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(t)})}function Cl(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(t)})}function Al(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(t)})}function Ml(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(t)})}function Dl(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...U(t)})}function Ll(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...U(t)})}function ql(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...U(t)})}function Ul(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...U(t)})}function Gv(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(t)})}function Wv(e,t){return new e({type:"string",format:"date",check:"string_format",...U(t)})}function Yv(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...U(t)})}function Xv(e,t){return new e({type:"string",format:"duration",check:"string_format",...U(t)})}function Fl(e,t){return new e({type:"number",checks:[],...U(t)})}function Vl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...U(t)})}function Bl(e,t){return new e({type:"boolean",...U(t)})}function Jl(e,t){return new e({type:"null",...U(t)})}function Hl(e){return new e({type:"unknown"})}function Kl(e,t){return new e({type:"never",...U(t)})}function ji(e,t){return new Ru({check:"less_than",...U(t),value:e,inclusive:!1})}function Qo(e,t){return new Ru({check:"less_than",...U(t),value:e,inclusive:!0})}function Ci(e,t){return new Ou({check:"greater_than",...U(t),value:e,inclusive:!1})}function es(e,t){return new Ou({check:"greater_than",...U(t),value:e,inclusive:!0})}function Ai(e,t){return new vv({check:"multiple_of",...U(t),value:e})}function Mi(e,t){return new bv({check:"max_length",...U(t),maximum:e})}function Bn(e,t){return new $v({check:"min_length",...U(t),minimum:e})}function Di(e,t){return new zv({check:"length_equals",...U(t),length:e})}function Gl(e,t){return new wv({check:"string_format",format:"regex",...U(t),pattern:e})}function Wl(e){return new kv({check:"string_format",format:"lowercase",...U(e)})}function Yl(e){return new Sv({check:"string_format",format:"uppercase",...U(e)})}function Xl(e,t){return new Pv({check:"string_format",format:"includes",...U(t),includes:e})}function Ql(e,t){return new Tv({check:"string_format",format:"starts_with",...U(t),prefix:e})}function ed(e,t){return new Ev({check:"string_format",format:"ends_with",...U(t),suffix:e})}function dn(e){return new Iv({check:"overwrite",tx:e})}function td(e){return dn(t=>t.normalize(e))}function rd(){return dn(e=>e.trim())}function nd(){return dn(e=>e.toLowerCase())}function od(){return dn(e=>e.toUpperCase())}function Qv(e,t,r){return new e({type:"array",element:t,...U(r)})}function sd(e,t,r){let n=U(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function id(e,t,r){return new e({type:"custom",check:"custom",fn:t,...U(r)})}var Li=class{constructor(t){this.counter=0,this.metadataRegistry=t?.metadata??Sr,this.target=t?.target??"draft-2020-12",this.unrepresentable=t?.unrepresentable??"throw",this.override=t?.override??(()=>{}),this.io=t?.io??"output",this.seen=new Map}process(t,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,s={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(t,a);let c=t._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,t],path:r.path},m=t._zod.parent;if(m)a.ref=m,this.process(m,d),this.seen.get(m).isParent=!0;else{let f=a.schema;switch(o.type){case"string":{let p=f;p.type="string";let{minimum:h,maximum:_,format:z,patterns:g,contentEncoding:w}=t._zod.bag;if(typeof h=="number"&&(p.minLength=h),typeof _=="number"&&(p.maxLength=_),z&&(p.format=s[z]??z,p.format===""&&delete p.format),w&&(p.contentEncoding=w),g&&g.size>0){let k=[...g];k.length===1?p.pattern=k[0].source:k.length>1&&(a.schema.allOf=[...k.map(I=>({...this.target==="draft-7"?{type:"string"}:{},pattern:I.source}))])}break}case"number":{let p=f,{minimum:h,maximum:_,format:z,multipleOf:g,exclusiveMaximum:w,exclusiveMinimum:k}=t._zod.bag;typeof z=="string"&&z.includes("int")?p.type="integer":p.type="number",typeof k=="number"&&(p.exclusiveMinimum=k),typeof h=="number"&&(p.minimum=h,typeof k=="number"&&(k>=h?delete p.minimum:delete p.exclusiveMinimum)),typeof w=="number"&&(p.exclusiveMaximum=w),typeof _=="number"&&(p.maximum=_,typeof w=="number"&&(w<=_?delete p.maximum:delete p.exclusiveMaximum)),typeof g=="number"&&(p.multipleOf=g);break}case"boolean":{let p=f;p.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{f.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{f.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let p=f,{minimum:h,maximum:_}=t._zod.bag;typeof h=="number"&&(p.minItems=h),typeof _=="number"&&(p.maxItems=_),p.type="array",p.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let p=f;p.type="object",p.properties={};let h=o.shape;for(let g in h)p.properties[g]=this.process(h[g],{...d,path:[...d.path,"properties",g]});let _=new Set(Object.keys(h)),z=new Set([..._].filter(g=>{let w=o.shape[g]._zod;return this.io==="input"?w.optin===void 0:w.optout===void 0}));z.size>0&&(p.required=Array.from(z)),o.catchall?._zod.def.type==="never"?p.additionalProperties=!1:o.catchall?o.catchall&&(p.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(p.additionalProperties=!1);break}case"union":{let p=f;p.anyOf=o.options.map((h,_)=>this.process(h,{...d,path:[...d.path,"anyOf",_]}));break}case"intersection":{let p=f,h=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),_=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),z=w=>"allOf"in w&&Object.keys(w).length===1,g=[...z(h)?h.allOf:[h],...z(_)?_.allOf:[_]];p.allOf=g;break}case"tuple":{let p=f;p.type="array";let h=o.items.map((g,w)=>this.process(g,{...d,path:[...d.path,"prefixItems",w]}));if(this.target==="draft-2020-12"?p.prefixItems=h:p.items=h,o.rest){let g=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?p.items=g:p.additionalItems=g}o.rest&&(p.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:_,maximum:z}=t._zod.bag;typeof _=="number"&&(p.minItems=_),typeof z=="number"&&(p.maxItems=z);break}case"record":{let p=f;p.type="object",p.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),p.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let p=f,h=Vo(o.entries);h.every(_=>typeof _=="number")&&(p.type="number"),h.every(_=>typeof _=="string")&&(p.type="string"),p.enum=h;break}case"literal":{let p=f,h=[];for(let _ of o.values)if(_===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof _=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");h.push(Number(_))}else h.push(_);if(h.length!==0)if(h.length===1){let _=h[0];p.type=_===null?"null":typeof _,p.const=_}else h.every(_=>typeof _=="number")&&(p.type="number"),h.every(_=>typeof _=="string")&&(p.type="string"),h.every(_=>typeof _=="boolean")&&(p.type="string"),h.every(_=>_===null)&&(p.type="null"),p.enum=h;break}case"file":{let p=f,h={type:"string",format:"binary",contentEncoding:"binary"},{minimum:_,maximum:z,mime:g}=t._zod.bag;_!==void 0&&(h.minLength=_),z!==void 0&&(h.maxLength=z),g?g.length===1?(h.contentMediaType=g[0],Object.assign(p,h)):p.anyOf=g.map(w=>({...h,contentMediaType:w})):Object.assign(p,h);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let p=this.process(o.innerType,d);f.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let p=f;p.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,f.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(f._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let p;try{p=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}f.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let p=f,h=t._zod.pattern;if(!h)throw new Error("Pattern not found in template literal");p.type="string",p.pattern=h.source;break}case"pipe":{let p=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(p,d),a.ref=p;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,f.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let p=t._zod.innerType;this.process(p,d),a.ref=p;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(t);return u&&Object.assign(a.schema,u),this.io==="input"&&Ae(t)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(t).schema}emit(t,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let s=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let h=n.external.registry.get(l[0])?.id,_=n.external.uri??(g=>g);if(h)return{ref:_(h)};let z=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=z,{defId:z,ref:`${_("__shared")}#/${d}/${z}`}}if(l[1]===o)return{ref:"#"};let f=`#/${d}/`,p=l[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:f+p}},i=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:m,defId:f}=s(l);d.def={...d.schema},f&&(d.defId=f);let p=d.schema;for(let h in p)delete p[h];p.$ref=m};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
102
+
103
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(t===l[0]){i(l);continue}if(n.external){let f=n.external.registry.get(l[0])?.id;if(t!==l[0]&&f){i(l);continue}}if(this.metadataRegistry.get(l[0])?.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&n.reused==="ref"){i(l);continue}}let a=(l,d)=>{let m=this.seen.get(l),f=m.def??m.schema,p={...f};if(m.ref===null)return;let h=m.ref;if(m.ref=null,h){a(h,d);let _=this.seen.get(h).schema;_.$ref&&d.target==="draft-7"?(f.allOf=f.allOf??[],f.allOf.push(_)):(Object.assign(f,_),Object.assign(f,p))}m.isParent||this.override({zodSchema:l,jsonSchema:f,path:m.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(t)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function ad(e,t){if(e instanceof Xo){let n=new Li(t),o={};for(let a of e._idmap.entries()){let[c,u]=a;n.process(u)}let s={},i={registry:e,uri:t?.uri,defs:o};for(let a of e._idmap.entries()){let[c,u]=a;s[c]=n.emit(u,{...t,external:i})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:o}}return{schemas:s}}let r=new Li(t);return r.process(e),r.emit(e,t)}function Ae(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Ae(o.element,r);case"object":{for(let s in o.shape)if(Ae(o.shape[s],r))return!0;return!1}case"union":{for(let s of o.options)if(Ae(s,r))return!0;return!1}case"intersection":return Ae(o.left,r)||Ae(o.right,r);case"tuple":{for(let s of o.items)if(Ae(s,r))return!0;return!!(o.rest&&Ae(o.rest,r))}case"record":return Ae(o.keyType,r)||Ae(o.valueType,r);case"map":return Ae(o.keyType,r)||Ae(o.valueType,r);case"set":return Ae(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Ae(o.innerType,r);case"lazy":return Ae(o.getter(),r);case"default":return Ae(o.innerType,r);case"prefault":return Ae(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return Ae(o.in,r)||Ae(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var DE=b("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");le.init(e,t),e.def=t,e.parse=(r,n)=>ku(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>un(e,r,n),e.parseAsync=async(r,n)=>Pu(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ln(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>$t(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e)});var LE=b("ZodMiniObject",(e,t)=>{Ri.init(e,t),DE.init(e,t),X.defineLazy(e,"shape",()=>t.shape)});function cd(e,t){let r={type:"object",get shape(){return X.assignProp(this,"shape",{...e}),this.shape},...X.normalizeParams(t)};return new LE(r)}function Et(e){return!!e._zod}function fn(e){let t=Object.values(e);if(t.length===0)return cd({});let r=t.every(Et),n=t.every(o=>!Et(o));if(r)return cd(e);if(n)return du(e);throw new Error("Mixed Zod versions detected in object shape.")}function Pr(e,t){return Et(e)?un(e,t):e.safeParse(t)}async function qi(e,t){return Et(e)?await ln(e,t):await e.safeParseAsync(t)}function Tr(e){if(!e)return;let t;if(Et(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Jn(e){if(e){if(typeof e=="object"){let t=e,r=e;if(!t._def&&!r._zod){let n=Object.values(e);if(n.length>0&&n.every(o=>typeof o=="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse=="function")))return fn(e)}}if(Et(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e}}function Ui(e){if(e&&typeof e=="object"){if("message"in e&&typeof e.message=="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t=="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function tx(e){return e.description}function rx(e){if(Et(e))return e._zod?.def?.type==="optional";let t=e;return typeof e.isOptional=="function"?e.isOptional():t._def?.typeName==="ZodOptional"}function Fi(e){if(Et(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var ts={};vo(ts,{ZodISODate:()=>ox,ZodISODateTime:()=>nx,ZodISODuration:()=>ix,ZodISOTime:()=>sx,date:()=>ld,datetime:()=>ud,duration:()=>pd,time:()=>dd});var nx=b("ZodISODateTime",(e,t)=>{Uv.init(e,t),Pe.init(e,t)});function ud(e){return Gv(nx,e)}var ox=b("ZodISODate",(e,t)=>{Fv.init(e,t),Pe.init(e,t)});function ld(e){return Wv(ox,e)}var sx=b("ZodISOTime",(e,t)=>{Vv.init(e,t),Pe.init(e,t)});function dd(e){return Yv(sx,e)}var ix=b("ZodISODuration",(e,t)=>{Bv.init(e,t),Pe.init(e,t)});function pd(e){return Xv(ix,e)}var ax=(e,t)=>{Pi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>zu(e,r)},flatten:{value:r=>$u(e,r)},addIssue:{value:r=>e.issues.push(r)},addIssues:{value:r=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},LL=b("ZodError",ax),rs=b("ZodError",ax,{Parent:Error});var cx=wu(rs),ux=Su(rs),lx=Tu(rs),dx=Eu(rs);var Ze=b("ZodType",(e,t)=>(le.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),e.clone=(r,n)=>$t(e,r,n),e.brand=()=>e,e.register=(r,n)=>(r.add(e,n),e),e.parse=(r,n)=>cx(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>lx(e,r,n),e.parseAsync=async(r,n)=>ux(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>dx(e,r,n),e.spa=e.safeParseAsync,e.refine=(r,n)=>e.check(AI(r,n)),e.superRefine=r=>e.check(MI(r)),e.overwrite=r=>e.check(dn(r)),e.optional=()=>Ee(e),e.nullable=()=>mx(e),e.nullish=()=>Ee(mx(e)),e.nonoptional=r=>II(e,r),e.array=()=>ee(e),e.or=r=>xe([e,r]),e.and=r=>Bi(e,r),e.transform=r=>md(e,xx(r)),e.default=r=>PI(e,r),e.prefault=r=>EI(e,r),e.catch=r=>RI(e,r),e.pipe=r=>md(e,r),e.readonly=()=>jI(e),e.describe=r=>{let n=e.clone();return Sr.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Sr.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Sr.get(e);let n=e.clone();return Sr.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),hx=b("_ZodString",(e,t)=>{Yo.init(e,t),Ze.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Gl(...n)),e.includes=(...n)=>e.check(Xl(...n)),e.startsWith=(...n)=>e.check(Ql(...n)),e.endsWith=(...n)=>e.check(ed(...n)),e.min=(...n)=>e.check(Bn(...n)),e.max=(...n)=>e.check(Mi(...n)),e.length=(...n)=>e.check(Di(...n)),e.nonempty=(...n)=>e.check(Bn(1,...n)),e.lowercase=n=>e.check(Wl(n)),e.uppercase=n=>e.check(Yl(n)),e.trim=()=>e.check(rd()),e.normalize=(...n)=>e.check(td(...n)),e.toLowerCase=()=>e.check(nd()),e.toUpperCase=()=>e.check(od())}),GE=b("ZodString",(e,t)=>{Yo.init(e,t),hx.init(e,t),e.email=r=>e.check($l(WE,r)),e.url=r=>e.check(Pl(YE,r)),e.jwt=r=>e.check(Ul(pI,r)),e.emoji=r=>e.check(Tl(XE,r)),e.guid=r=>e.check(Ni(px,r)),e.uuid=r=>e.check(zl(Vi,r)),e.uuidv4=r=>e.check(wl(Vi,r)),e.uuidv6=r=>e.check(kl(Vi,r)),e.uuidv7=r=>e.check(Sl(Vi,r)),e.nanoid=r=>e.check(El(QE,r)),e.guid=r=>e.check(Ni(px,r)),e.cuid=r=>e.check(Il(eI,r)),e.cuid2=r=>e.check(Zl(tI,r)),e.ulid=r=>e.check(Rl(rI,r)),e.base64=r=>e.check(Dl(uI,r)),e.base64url=r=>e.check(Ll(lI,r)),e.xid=r=>e.check(Ol(nI,r)),e.ksuid=r=>e.check(Nl(oI,r)),e.ipv4=r=>e.check(jl(sI,r)),e.ipv6=r=>e.check(Cl(iI,r)),e.cidrv4=r=>e.check(Al(aI,r)),e.cidrv6=r=>e.check(Ml(cI,r)),e.e164=r=>e.check(ql(dI,r)),e.datetime=r=>e.check(ud(r)),e.date=r=>e.check(ld(r)),e.time=r=>e.check(dd(r)),e.duration=r=>e.check(pd(r))});function v(e){return bl(GE,e)}var Pe=b("ZodStringFormat",(e,t)=>{he.init(e,t),hx.init(e,t)}),WE=b("ZodEmail",(e,t)=>{Au.init(e,t),Pe.init(e,t)});var px=b("ZodGUID",(e,t)=>{ju.init(e,t),Pe.init(e,t)});var Vi=b("ZodUUID",(e,t)=>{Cu.init(e,t),Pe.init(e,t)});var YE=b("ZodURL",(e,t)=>{Mu.init(e,t),Pe.init(e,t)});var XE=b("ZodEmoji",(e,t)=>{Du.init(e,t),Pe.init(e,t)});var QE=b("ZodNanoID",(e,t)=>{Lu.init(e,t),Pe.init(e,t)});var eI=b("ZodCUID",(e,t)=>{qu.init(e,t),Pe.init(e,t)});var tI=b("ZodCUID2",(e,t)=>{Uu.init(e,t),Pe.init(e,t)});var rI=b("ZodULID",(e,t)=>{Fu.init(e,t),Pe.init(e,t)});var nI=b("ZodXID",(e,t)=>{Vu.init(e,t),Pe.init(e,t)});var oI=b("ZodKSUID",(e,t)=>{Bu.init(e,t),Pe.init(e,t)});var sI=b("ZodIPv4",(e,t)=>{Ju.init(e,t),Pe.init(e,t)});var iI=b("ZodIPv6",(e,t)=>{Hu.init(e,t),Pe.init(e,t)});var aI=b("ZodCIDRv4",(e,t)=>{Ku.init(e,t),Pe.init(e,t)});var cI=b("ZodCIDRv6",(e,t)=>{Gu.init(e,t),Pe.init(e,t)});var uI=b("ZodBase64",(e,t)=>{Wu.init(e,t),Pe.init(e,t)});var lI=b("ZodBase64URL",(e,t)=>{Yu.init(e,t),Pe.init(e,t)});var dI=b("ZodE164",(e,t)=>{Xu.init(e,t),Pe.init(e,t)});var pI=b("ZodJWT",(e,t)=>{Qu.init(e,t),Pe.init(e,t)});var gx=b("ZodNumber",(e,t)=>{Zi.init(e,t),Ze.init(e,t),e.gt=(n,o)=>e.check(Ci(n,o)),e.gte=(n,o)=>e.check(es(n,o)),e.min=(n,o)=>e.check(es(n,o)),e.lt=(n,o)=>e.check(ji(n,o)),e.lte=(n,o)=>e.check(Qo(n,o)),e.max=(n,o)=>e.check(Qo(n,o)),e.int=n=>e.check(fx(n)),e.safe=n=>e.check(fx(n)),e.positive=n=>e.check(Ci(0,n)),e.nonnegative=n=>e.check(es(0,n)),e.negative=n=>e.check(ji(0,n)),e.nonpositive=n=>e.check(Qo(0,n)),e.multipleOf=(n,o)=>e.check(Ai(n,o)),e.step=(n,o)=>e.check(Ai(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ue(e){return Fl(gx,e)}var fI=b("ZodNumberFormat",(e,t)=>{el.init(e,t),gx.init(e,t)});function fx(e){return Vl(fI,e)}var mI=b("ZodBoolean",(e,t)=>{tl.init(e,t),Ze.init(e,t)});function Ue(e){return Bl(mI,e)}var hI=b("ZodNull",(e,t)=>{rl.init(e,t),Ze.init(e,t)});function _x(e){return Jl(hI,e)}var gI=b("ZodUnknown",(e,t)=>{nl.init(e,t),Ze.init(e,t)});function Te(){return Hl(gI)}var _I=b("ZodNever",(e,t)=>{ol.init(e,t),Ze.init(e,t)});function yI(e){return Kl(_I,e)}var vI=b("ZodArray",(e,t)=>{sl.init(e,t),Ze.init(e,t),e.element=t.element,e.min=(r,n)=>e.check(Bn(r,n)),e.nonempty=r=>e.check(Bn(1,r)),e.max=(r,n)=>e.check(Mi(r,n)),e.length=(r,n)=>e.check(Di(r,n)),e.unwrap=()=>e.element});function ee(e,t){return Qv(vI,e,t)}var yx=b("ZodObject",(e,t)=>{Ri.init(e,t),Ze.init(e,t),X.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>ft(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Te()}),e.loose=()=>e.clone({...e._zod.def,catchall:Te()}),e.strict=()=>e.clone({...e._zod.def,catchall:yI()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>X.extend(e,r),e.merge=r=>X.merge(e,r),e.pick=r=>X.pick(e,r),e.omit=r=>X.omit(e,r),e.partial=(...r)=>X.partial(bx,e,r[0]),e.required=(...r)=>X.required($x,e,r[0])});function O(e,t){let r={type:"object",get shape(){return X.assignProp(this,"shape",{...e}),this.shape},...X.normalizeParams(t)};return new yx(r)}function st(e,t){return new yx({type:"object",get shape(){return X.assignProp(this,"shape",{...e}),this.shape},catchall:Te(),...X.normalizeParams(t)})}var vx=b("ZodUnion",(e,t)=>{Oi.init(e,t),Ze.init(e,t),e.options=t.options});function xe(e,t){return new vx({type:"union",options:e,...X.normalizeParams(t)})}var xI=b("ZodDiscriminatedUnion",(e,t)=>{vx.init(e,t),il.init(e,t)});function hd(e,t,r){return new xI({type:"union",options:t,discriminator:e,...X.normalizeParams(r)})}var bI=b("ZodIntersection",(e,t)=>{al.init(e,t),Ze.init(e,t)});function Bi(e,t){return new bI({type:"intersection",left:e,right:t})}var $I=b("ZodRecord",(e,t)=>{cl.init(e,t),Ze.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function ge(e,t,r){return new $I({type:"record",keyType:e,valueType:t,...X.normalizeParams(r)})}var fd=b("ZodEnum",(e,t)=>{ul.init(e,t),Ze.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new fd({...t,checks:[],...X.normalizeParams(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new fd({...t,checks:[],...X.normalizeParams(o),entries:s})}});function ft(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new fd({type:"enum",entries:r,...X.normalizeParams(t)})}var zI=b("ZodLiteral",(e,t)=>{ll.init(e,t),Ze.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function A(e,t){return new zI({type:"literal",values:Array.isArray(e)?e:[e],...X.normalizeParams(t)})}var wI=b("ZodTransform",(e,t)=>{dl.init(e,t),Ze.init(e,t),e._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(X.issue(s,r.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),r.issues.push(X.issue(i))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function xx(e){return new wI({type:"transform",transform:e})}var bx=b("ZodOptional",(e,t)=>{pl.init(e,t),Ze.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ee(e){return new bx({type:"optional",innerType:e})}var kI=b("ZodNullable",(e,t)=>{fl.init(e,t),Ze.init(e,t),e.unwrap=()=>e._zod.def.innerType});function mx(e){return new kI({type:"nullable",innerType:e})}var SI=b("ZodDefault",(e,t)=>{ml.init(e,t),Ze.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function PI(e,t){return new SI({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var TI=b("ZodPrefault",(e,t)=>{hl.init(e,t),Ze.init(e,t),e.unwrap=()=>e._zod.def.innerType});function EI(e,t){return new TI({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}var $x=b("ZodNonOptional",(e,t)=>{gl.init(e,t),Ze.init(e,t),e.unwrap=()=>e._zod.def.innerType});function II(e,t){return new $x({type:"nonoptional",innerType:e,...X.normalizeParams(t)})}var ZI=b("ZodCatch",(e,t)=>{_l.init(e,t),Ze.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function RI(e,t){return new ZI({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var OI=b("ZodPipe",(e,t)=>{yl.init(e,t),Ze.init(e,t),e.in=t.in,e.out=t.out});function md(e,t){return new OI({type:"pipe",in:e,out:t})}var NI=b("ZodReadonly",(e,t)=>{vl.init(e,t),Ze.init(e,t)});function jI(e){return new NI({type:"readonly",innerType:e})}var zx=b("ZodCustom",(e,t)=>{xl.init(e,t),Ze.init(e,t)});function CI(e){let t=new He({check:"custom"});return t._zod.check=e,t}function wx(e,t){return sd(zx,e??(()=>!0),t)}function AI(e,t={}){return id(zx,e,t)}function MI(e){let t=CI(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(X.issue(n,r.value,t._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(X.issue(o))}},e(r.value,r)));return t}function gd(e,t){return md(xx(e),t)}bt(Hv());var yd="2025-11-25";var kx=[yd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Er="io.modelcontextprotocol/related-task",Hi="2.0",Me=wx(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Sx=xe([v(),ue().int()]),Px=v(),e2=st({ttl:ue().optional(),pollInterval:ue().optional()}),DI=O({ttl:ue().optional()}),LI=O({taskId:v()}),vd=st({progressToken:Sx.optional(),[Er]:LI.optional()}),zt=O({_meta:vd.optional()}),ns=zt.extend({task:DI.optional()}),Tx=e=>ns.safeParse(e).success,Ke=O({method:v(),params:zt.loose().optional()}),It=O({_meta:vd.optional()}),Zt=O({method:v(),params:It.loose().optional()}),Ge=st({_meta:vd.optional()}),Ki=xe([v(),ue().int()]),Ex=O({jsonrpc:A(Hi),id:Ki,...Ke.shape}).strict(),xd=e=>Ex.safeParse(e).success,Ix=O({jsonrpc:A(Hi),...Zt.shape}).strict(),Zx=e=>Ix.safeParse(e).success,bd=O({jsonrpc:A(Hi),id:Ki,result:Ge}).strict(),os=e=>bd.safeParse(e).success;var D;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(D||(D={}));var $d=O({jsonrpc:A(Hi),id:Ki.optional(),error:O({code:ue().int(),message:v(),data:Te().optional()})}).strict();var Rx=e=>$d.safeParse(e).success;var t2=xe([Ex,Ix,bd,$d]),r2=xe([bd,$d]),Gi=Ge.strict(),qI=It.extend({requestId:Ki.optional(),reason:v().optional()}),Wi=Zt.extend({method:A("notifications/cancelled"),params:qI}),UI=O({src:v(),mimeType:v().optional(),sizes:ee(v()).optional(),theme:ft(["light","dark"]).optional()}),ss=O({icons:ee(UI).optional()}),Hn=O({name:v(),title:v().optional()}),Ox=Hn.extend({...Hn.shape,...ss.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),FI=Bi(O({applyDefaults:Ue().optional()}),ge(v(),Te())),VI=gd(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Bi(O({form:FI.optional(),url:Me.optional()}),ge(v(),Te()).optional())),BI=st({list:Me.optional(),cancel:Me.optional(),requests:st({sampling:st({createMessage:Me.optional()}).optional(),elicitation:st({create:Me.optional()}).optional()}).optional()}),JI=st({list:Me.optional(),cancel:Me.optional(),requests:st({tools:st({call:Me.optional()}).optional()}).optional()}),HI=O({experimental:ge(v(),Me).optional(),sampling:O({context:Me.optional(),tools:Me.optional()}).optional(),elicitation:VI.optional(),roots:O({listChanged:Ue().optional()}).optional(),tasks:BI.optional(),extensions:ge(v(),Me).optional()}),KI=zt.extend({protocolVersion:v(),capabilities:HI,clientInfo:Ox}),zd=Ke.extend({method:A("initialize"),params:KI});var GI=O({experimental:ge(v(),Me).optional(),logging:Me.optional(),completions:Me.optional(),prompts:O({listChanged:Ue().optional()}).optional(),resources:O({subscribe:Ue().optional(),listChanged:Ue().optional()}).optional(),tools:O({listChanged:Ue().optional()}).optional(),tasks:JI.optional(),extensions:ge(v(),Me).optional()}),WI=Ge.extend({protocolVersion:v(),capabilities:GI,serverInfo:Ox,instructions:v().optional()}),wd=Zt.extend({method:A("notifications/initialized"),params:It.optional()});var Yi=Ke.extend({method:A("ping"),params:zt.optional()}),YI=O({progress:ue(),total:Ee(ue()),message:Ee(v())}),XI=O({...It.shape,...YI.shape,progressToken:Sx}),Xi=Zt.extend({method:A("notifications/progress"),params:XI}),QI=zt.extend({cursor:Px.optional()}),is=Ke.extend({params:QI.optional()}),as=Ge.extend({nextCursor:Px.optional()}),eZ=ft(["working","input_required","completed","failed","cancelled"]),cs=O({taskId:v(),status:eZ,ttl:xe([ue(),_x()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:Ee(ue()),statusMessage:Ee(v())}),Kn=Ge.extend({task:cs}),tZ=It.merge(cs),us=Zt.extend({method:A("notifications/tasks/status"),params:tZ}),Qi=Ke.extend({method:A("tasks/get"),params:zt.extend({taskId:v()})}),ea=Ge.merge(cs),ta=Ke.extend({method:A("tasks/result"),params:zt.extend({taskId:v()})}),n2=Ge.loose(),ra=is.extend({method:A("tasks/list")}),na=as.extend({tasks:ee(cs)}),oa=Ke.extend({method:A("tasks/cancel"),params:zt.extend({taskId:v()})}),Nx=Ge.merge(cs),jx=O({uri:v(),mimeType:Ee(v()),_meta:ge(v(),Te()).optional()}),Cx=jx.extend({text:v()}),kd=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ax=jx.extend({blob:kd}),ls=ft(["user","assistant"]),Gn=O({audience:ee(ls).optional(),priority:ue().min(0).max(1).optional(),lastModified:ts.datetime({offset:!0}).optional()}),Mx=O({...Hn.shape,...ss.shape,uri:v(),description:Ee(v()),mimeType:Ee(v()),size:Ee(ue()),annotations:Gn.optional(),_meta:Ee(st({}))}),rZ=O({...Hn.shape,...ss.shape,uriTemplate:v(),description:Ee(v()),mimeType:Ee(v()),annotations:Gn.optional(),_meta:Ee(st({}))}),sa=is.extend({method:A("resources/list")}),nZ=as.extend({resources:ee(Mx)}),ia=is.extend({method:A("resources/templates/list")}),oZ=as.extend({resourceTemplates:ee(rZ)}),Sd=zt.extend({uri:v()}),sZ=Sd,aa=Ke.extend({method:A("resources/read"),params:sZ}),iZ=Ge.extend({contents:ee(xe([Cx,Ax]))}),aZ=Zt.extend({method:A("notifications/resources/list_changed"),params:It.optional()}),cZ=Sd,uZ=Ke.extend({method:A("resources/subscribe"),params:cZ}),lZ=Sd,dZ=Ke.extend({method:A("resources/unsubscribe"),params:lZ}),pZ=It.extend({uri:v()}),fZ=Zt.extend({method:A("notifications/resources/updated"),params:pZ}),mZ=O({name:v(),description:Ee(v()),required:Ee(Ue())}),hZ=O({...Hn.shape,...ss.shape,description:Ee(v()),arguments:Ee(ee(mZ)),_meta:Ee(st({}))}),ca=is.extend({method:A("prompts/list")}),gZ=as.extend({prompts:ee(hZ)}),_Z=zt.extend({name:v(),arguments:ge(v(),v()).optional()}),ua=Ke.extend({method:A("prompts/get"),params:_Z}),Pd=O({type:A("text"),text:v(),annotations:Gn.optional(),_meta:ge(v(),Te()).optional()}),Td=O({type:A("image"),data:kd,mimeType:v(),annotations:Gn.optional(),_meta:ge(v(),Te()).optional()}),Ed=O({type:A("audio"),data:kd,mimeType:v(),annotations:Gn.optional(),_meta:ge(v(),Te()).optional()}),yZ=O({type:A("tool_use"),name:v(),id:v(),input:ge(v(),Te()),_meta:ge(v(),Te()).optional()}),vZ=O({type:A("resource"),resource:xe([Cx,Ax]),annotations:Gn.optional(),_meta:ge(v(),Te()).optional()}),xZ=Mx.extend({type:A("resource_link")}),Id=xe([Pd,Td,Ed,xZ,vZ]),bZ=O({role:ls,content:Id}),$Z=Ge.extend({description:v().optional(),messages:ee(bZ)}),zZ=Zt.extend({method:A("notifications/prompts/list_changed"),params:It.optional()}),wZ=O({title:v().optional(),readOnlyHint:Ue().optional(),destructiveHint:Ue().optional(),idempotentHint:Ue().optional(),openWorldHint:Ue().optional()}),kZ=O({taskSupport:ft(["required","optional","forbidden"]).optional()}),Dx=O({...Hn.shape,...ss.shape,description:v().optional(),inputSchema:O({type:A("object"),properties:ge(v(),Me).optional(),required:ee(v()).optional()}).catchall(Te()),outputSchema:O({type:A("object"),properties:ge(v(),Me).optional(),required:ee(v()).optional()}).catchall(Te()).optional(),annotations:wZ.optional(),execution:kZ.optional(),_meta:ge(v(),Te()).optional()}),la=is.extend({method:A("tools/list")}),SZ=as.extend({tools:ee(Dx)}),da=Ge.extend({content:ee(Id).default([]),structuredContent:ge(v(),Te()).optional(),isError:Ue().optional()}),o2=da.or(Ge.extend({toolResult:Te()})),PZ=ns.extend({name:v(),arguments:ge(v(),Te()).optional()}),Wn=Ke.extend({method:A("tools/call"),params:PZ}),TZ=Zt.extend({method:A("notifications/tools/list_changed"),params:It.optional()}),s2=O({autoRefresh:Ue().default(!0),debounceMs:ue().int().nonnegative().default(300)}),ds=ft(["debug","info","notice","warning","error","critical","alert","emergency"]),EZ=zt.extend({level:ds}),Zd=Ke.extend({method:A("logging/setLevel"),params:EZ}),IZ=It.extend({level:ds,logger:v().optional(),data:Te()}),ZZ=Zt.extend({method:A("notifications/message"),params:IZ}),RZ=O({name:v().optional()}),OZ=O({hints:ee(RZ).optional(),costPriority:ue().min(0).max(1).optional(),speedPriority:ue().min(0).max(1).optional(),intelligencePriority:ue().min(0).max(1).optional()}),NZ=O({mode:ft(["auto","required","none"]).optional()}),jZ=O({type:A("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:ee(Id).default([]),structuredContent:O({}).loose().optional(),isError:Ue().optional(),_meta:ge(v(),Te()).optional()}),CZ=hd("type",[Pd,Td,Ed]),Ji=hd("type",[Pd,Td,Ed,yZ,jZ]),AZ=O({role:ls,content:xe([Ji,ee(Ji)]),_meta:ge(v(),Te()).optional()}),MZ=ns.extend({messages:ee(AZ),modelPreferences:OZ.optional(),systemPrompt:v().optional(),includeContext:ft(["none","thisServer","allServers"]).optional(),temperature:ue().optional(),maxTokens:ue().int(),stopSequences:ee(v()).optional(),metadata:Me.optional(),tools:ee(Dx).optional(),toolChoice:NZ.optional()}),DZ=Ke.extend({method:A("sampling/createMessage"),params:MZ}),ps=Ge.extend({model:v(),stopReason:Ee(ft(["endTurn","stopSequence","maxTokens"]).or(v())),role:ls,content:CZ}),Rd=Ge.extend({model:v(),stopReason:Ee(ft(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:ls,content:xe([Ji,ee(Ji)])}),LZ=O({type:A("boolean"),title:v().optional(),description:v().optional(),default:Ue().optional()}),qZ=O({type:A("string"),title:v().optional(),description:v().optional(),minLength:ue().optional(),maxLength:ue().optional(),format:ft(["email","uri","date","date-time"]).optional(),default:v().optional()}),UZ=O({type:ft(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ue().optional(),maximum:ue().optional(),default:ue().optional()}),FZ=O({type:A("string"),title:v().optional(),description:v().optional(),enum:ee(v()),default:v().optional()}),VZ=O({type:A("string"),title:v().optional(),description:v().optional(),oneOf:ee(O({const:v(),title:v()})),default:v().optional()}),BZ=O({type:A("string"),title:v().optional(),description:v().optional(),enum:ee(v()),enumNames:ee(v()).optional(),default:v().optional()}),JZ=xe([FZ,VZ]),HZ=O({type:A("array"),title:v().optional(),description:v().optional(),minItems:ue().optional(),maxItems:ue().optional(),items:O({type:A("string"),enum:ee(v())}),default:ee(v()).optional()}),KZ=O({type:A("array"),title:v().optional(),description:v().optional(),minItems:ue().optional(),maxItems:ue().optional(),items:O({anyOf:ee(O({const:v(),title:v()}))}),default:ee(v()).optional()}),GZ=xe([HZ,KZ]),WZ=xe([BZ,JZ,GZ]),YZ=xe([WZ,LZ,qZ,UZ]),XZ=ns.extend({mode:A("form").optional(),message:v(),requestedSchema:O({type:A("object"),properties:ge(v(),YZ),required:ee(v()).optional()})}),QZ=ns.extend({mode:A("url"),message:v(),elicitationId:v(),url:v().url()}),eR=xe([XZ,QZ]),tR=Ke.extend({method:A("elicitation/create"),params:eR}),rR=It.extend({elicitationId:v()}),nR=Zt.extend({method:A("notifications/elicitation/complete"),params:rR}),Yn=Ge.extend({action:ft(["accept","decline","cancel"]),content:gd(e=>e===null?void 0:e,ge(v(),xe([v(),ue(),Ue(),ee(v())])).optional())}),oR=O({type:A("ref/resource"),uri:v()});var sR=O({type:A("ref/prompt"),name:v()}),iR=zt.extend({ref:xe([sR,oR]),argument:O({name:v(),value:v()}),context:O({arguments:ge(v(),v()).optional()}).optional()}),pa=Ke.extend({method:A("completion/complete"),params:iR});function Lx(e){if(e.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function qx(e){if(e.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var aR=Ge.extend({completion:st({values:ee(v()).max(100),total:Ee(ue().int()),hasMore:Ee(Ue())})}),cR=O({uri:v().startsWith("file://"),name:v().optional(),_meta:ge(v(),Te()).optional()}),uR=Ke.extend({method:A("roots/list"),params:zt.optional()}),Od=Ge.extend({roots:ee(cR)}),lR=Zt.extend({method:A("notifications/roots/list_changed"),params:It.optional()}),i2=xe([Yi,zd,pa,Zd,ua,ca,sa,ia,aa,uZ,dZ,Wn,la,Qi,ta,ra,oa]),a2=xe([Wi,Xi,wd,lR,us]),c2=xe([Gi,ps,Rd,Yn,Od,ea,na,Kn]),u2=xe([Yi,DZ,tR,uR,Qi,ta,ra,oa]),l2=xe([Wi,Xi,ZZ,fZ,aZ,TZ,zZ,us,nR]),d2=xe([Gi,WI,aR,$Z,gZ,nZ,oZ,iZ,da,SZ,ea,na,Kn]),j=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===D.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new _d(o.elicitations,r)}return new e(t,r,n)}},_d=class extends j{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(D.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Ir(e){return e==="completed"||e==="failed"||e==="cancelled"}var Fx=Symbol("Let zodToJsonSchema decide on which parser to use");var Ux={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Vx=e=>typeof e=="string"?{...Ux,name:e}:{...Ux,...e};var Bx=e=>{let t=Vx(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}};function Nd(e,t,r,n){n?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function te(e,t,r,n,o){e[t]=r,Nd(e,t,n,o)}var fa=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function Ie(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?fa(t,e.currentPath):t.join("/")}}function Jx(e,t){let r={type:"array"};return e.type?._def&&e.type?._def?.typeName!==P.ZodAny&&(r.items=F(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&te(r,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&te(r,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(te(r,"minItems",e.exactLength.value,e.exactLength.message,t),te(r,"maxItems",e.exactLength.value,e.exactLength.message,t)),r}function Hx(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"min":t.target==="jsonSchema7"?n.inclusive?te(r,"minimum",n.value,n.message,t):te(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),te(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?te(r,"maximum",n.value,n.message,t):te(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),te(r,"maximum",n.value,n.message,t));break;case"multipleOf":te(r,"multipleOf",n.value,n.message,t);break}return r}function Kx(){return{type:"boolean"}}function ma(e,t){return F(e.type._def,t)}var Gx=(e,t)=>F(e.innerType._def,t);function jd(e,t,r){let n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>jd(e,t,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return dR(e,t)}}var dR=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let n of e.checks)switch(n.kind){case"min":te(r,"minimum",n.value,n.message,t);break;case"max":te(r,"maximum",n.value,n.message,t);break}return r};function Wx(e,t){return{...F(e.innerType._def,t),default:e.defaultValue()}}function Yx(e,t){return t.effectStrategy==="input"?F(e.schema._def,t):Ie(t)}function Xx(e){return{type:"string",enum:Array.from(e.values)}}var pR=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Qx(e,t){let r=[F(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),F(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(s=>!!s),n=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(pR(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function eb(e,t){let r=typeof e.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(e.value)?"array":"object"}:t.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[e.value]}:{type:r==="bigint"?"integer":r,const:e.value}}var Cd,Dt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Cd===void 0&&(Cd=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Cd),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ha(e,t){let r={type:"string"};if(e.checks)for(let n of e.checks)switch(n.kind){case"min":te(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t);break;case"max":te(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Lt(r,"email",n.message,t);break;case"format:idn-email":Lt(r,"idn-email",n.message,t);break;case"pattern:zod":it(r,Dt.email,n.message,t);break}break;case"url":Lt(r,"uri",n.message,t);break;case"uuid":Lt(r,"uuid",n.message,t);break;case"regex":it(r,n.regex,n.message,t);break;case"cuid":it(r,Dt.cuid,n.message,t);break;case"cuid2":it(r,Dt.cuid2,n.message,t);break;case"startsWith":it(r,RegExp(`^${Ad(n.value,t)}`),n.message,t);break;case"endsWith":it(r,RegExp(`${Ad(n.value,t)}$`),n.message,t);break;case"datetime":Lt(r,"date-time",n.message,t);break;case"date":Lt(r,"date",n.message,t);break;case"time":Lt(r,"time",n.message,t);break;case"duration":Lt(r,"duration",n.message,t);break;case"length":te(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,t),te(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,t);break;case"includes":{it(r,RegExp(Ad(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Lt(r,"ipv4",n.message,t),n.version!=="v4"&&Lt(r,"ipv6",n.message,t);break}case"base64url":it(r,Dt.base64url,n.message,t);break;case"jwt":it(r,Dt.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&it(r,Dt.ipv4Cidr,n.message,t),n.version!=="v4"&&it(r,Dt.ipv6Cidr,n.message,t);break}case"emoji":it(r,Dt.emoji(),n.message,t);break;case"ulid":{it(r,Dt.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Lt(r,"binary",n.message,t);break}case"contentEncoding:base64":{te(r,"contentEncoding","base64",n.message,t);break}case"pattern:zod":{it(r,Dt.base64,n.message,t);break}}break}case"nanoid":it(r,Dt.nanoid,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function Ad(e,t){return t.patternStrategy==="escape"?mR(e):e}var fR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function mR(e){let t="";for(let r=0;r<e.length;r++)fR.has(e[r])||(t+="\\"),t+=e[r];return t}function Lt(e,t,r,n){e.format||e.anyOf?.some(o=>o.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):te(e,"format",t,r,n)}function it(e,t,r,n){e.pattern||e.allOf?.some(o=>o.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:tb(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):te(e,"pattern",tb(t,n),r,n)}function tb(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=r.i?e.source.toLowerCase():e.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(o+=n[c],a=!0):o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
104
+ ]))`;continue}else if(n[c]==="$"){o+=`($|(?=[\r
105
+ ]))`;continue}}if(r.s&&n[c]==="."){o+=i?`${n[c]}\r
106
+ `:`[${n[c]}\r
107
+ ]`;continue}o+=n[c],n[c]==="\\"?s=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function ga(e,t){if(t.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),t.target==="openApi3"&&e.keyType?._def.typeName===P.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,o)=>({...n,[o]:F(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",o]})??Ie(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:F(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===P.ZodString&&e.keyType._def.checks?.length){let{type:n,...o}=ha(e.keyType._def,t);return{...r,propertyNames:o}}else{if(e.keyType?._def.typeName===P.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===P.ZodBranded&&e.keyType._def.type._def.typeName===P.ZodString&&e.keyType._def.type._def.checks?.length){let{type:n,...o}=ma(e.keyType._def,t);return{...r,propertyNames:o}}}return r}function rb(e,t){if(t.mapStrategy==="record")return ga(e,t);let r=F(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ie(t),n=F(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ie(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function nb(e){let t=e.values,n=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),o=Array.from(new Set(n.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function ob(e){return e.target==="openAi"?void 0:{not:Ie({...e,currentPath:[...e.currentPath,"not"]})}}function sb(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var fs={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ab(e,t){if(t.target==="openApi3")return ib(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in fs&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=fs[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(s=>!n.includes(s))],[])};return ib(e,t)}var ib=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>F(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function cb(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return t.target==="openApi3"?{type:fs[e.innerType._def.typeName],nullable:!0}:{type:[fs[e.innerType._def.typeName],"null"]};if(t.target==="openApi3"){let n=F(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=F(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function ub(e,t){let r={type:"number"};if(!e.checks)return r;for(let n of e.checks)switch(n.kind){case"int":r.type="integer",Nd(r,"type",n.message,t);break;case"min":t.target==="jsonSchema7"?n.inclusive?te(r,"minimum",n.value,n.message,t):te(r,"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(r.exclusiveMinimum=!0),te(r,"minimum",n.value,n.message,t));break;case"max":t.target==="jsonSchema7"?n.inclusive?te(r,"maximum",n.value,n.message,t):te(r,"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(r.exclusiveMaximum=!0),te(r,"maximum",n.value,n.message,t));break;case"multipleOf":te(r,"multipleOf",n.value,n.message,t);break}return r}function lb(e,t){let r=t.target==="openAi",n={type:"object",properties:{}},o=[],s=e.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=gR(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=F(c._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let i=hR(e,t);return i!==void 0&&(n.additionalProperties=i),n}function hR(e,t){if(e.catchall._def.typeName!=="ZodNever")return F(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function gR(e){try{return e.isOptional()}catch{return!0}}var db=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return F(e.innerType._def,t);let r=F(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ie(t)},r]}:Ie(t)};var pb=(e,t)=>{if(t.pipeStrategy==="input")return F(e.in._def,t);if(t.pipeStrategy==="output")return F(e.out._def,t);let r=F(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=F(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function fb(e,t){return F(e.type._def,t)}function mb(e,t){let n={type:"array",uniqueItems:!0,items:F(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&te(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&te(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}function hb(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>F(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:F(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>F(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function gb(e){return{not:Ie(e)}}function _b(e){return Ie(e)}var yb=(e,t)=>F(e.innerType._def,t);var vb=(e,t,r)=>{switch(t){case P.ZodString:return ha(e,r);case P.ZodNumber:return ub(e,r);case P.ZodObject:return lb(e,r);case P.ZodBigInt:return Hx(e,r);case P.ZodBoolean:return Kx();case P.ZodDate:return jd(e,r);case P.ZodUndefined:return gb(r);case P.ZodNull:return sb(r);case P.ZodArray:return Jx(e,r);case P.ZodUnion:case P.ZodDiscriminatedUnion:return ab(e,r);case P.ZodIntersection:return Qx(e,r);case P.ZodTuple:return hb(e,r);case P.ZodRecord:return ga(e,r);case P.ZodLiteral:return eb(e,r);case P.ZodEnum:return Xx(e);case P.ZodNativeEnum:return nb(e);case P.ZodNullable:return cb(e,r);case P.ZodOptional:return db(e,r);case P.ZodMap:return rb(e,r);case P.ZodSet:return mb(e,r);case P.ZodLazy:return()=>e.getter()._def;case P.ZodPromise:return fb(e,r);case P.ZodNaN:case P.ZodNever:return ob(r);case P.ZodEffects:return Yx(e,r);case P.ZodAny:return Ie(r);case P.ZodUnknown:return _b(r);case P.ZodDefault:return Wx(e,r);case P.ZodBranded:return ma(e,r);case P.ZodReadonly:return yb(e,r);case P.ZodCatch:return Gx(e,r);case P.ZodPipeline:return pb(e,r);case P.ZodFunction:case P.ZodVoid:case P.ZodSymbol:return;default:return(n=>{})(t)}};function F(e,t,r=!1){let n=t.seen.get(e);if(t.override){let a=t.override?.(e,t,n,r);if(a!==Fx)return a}if(n&&!r){let a=_R(n,t);if(a!==void 0)return a}let o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);let s=vb(e,e.typeName,t),i=typeof s=="function"?F(s(),t):s;if(i&&yR(e,t,i),t.postProcess){let a=t.postProcess(i,e,t);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var _R=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:fa(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ie(t)):t.$refStrategy==="seen"?Ie(t):void 0}},yR=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);var Md=(e,t)=>{let r=Bx(t),n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,l])=>({...c,[u]:F(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??Ie(r)}),{}):void 0,o=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=F(e._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??Ie(r),i=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;i!==void 0&&(s.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function vR(e){return!e||e==="jsonSchema7"||e==="draft-7"?"draft-7":e==="jsonSchema2019-09"||e==="draft-2020-12"?"draft-2020-12":"draft-7"}function Dd(e,t){return Et(e)?ad(e,{target:vR(t?.target),io:t?.pipeStrategy??"input"}):Md(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function Ld(e){let r=Tr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Fi(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function qd(e,t){let r=Pr(e,t);if(!r.success)throw r.error;return r.data}var xR=6e4,_a=class{constructor(t){this._options=t,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Wi,r=>{this._oncancel(r)}),this.setNotificationHandler(Xi,r=>{this._onprogress(r)}),this.setRequestHandler(Yi,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Qi,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new j(D.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(ta,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,m=new j(d.error.code,d.error.message,d.error.data);l(m)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new j(D.InvalidParams,`Task not found: ${s}`);if(!Ir(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(Ir(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Er]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(ra,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new j(D.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(oa,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new j(D.InvalidParams,`Task not found: ${r.params.taskId}`);if(Ir(o.status))throw new j(D.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new j(D.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof j?o:new j(D.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,s=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),j.fromError(D.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),os(s)||Rx(s)?this._onresponse(s):xd(s)?this._onrequest(s,i):Zx(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=j.fromError(D.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,s=t.params?._meta?.[Er]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:D.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(t.id,i);let a=Tx(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:t.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,m)=>{if(i.signal.aborted)throw new j(D.ConnectionClosed,"Request was cancelled");let f={...m,relatedRequestId:t.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let p=f.relatedTask?.taskId??s;return p&&c&&await c.updateTaskStatus(p,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:D.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(t.id)===i&&this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),os(t))n(t);else{let i=new j(t.error.code,t.error.message,t.error.data);n(i)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(os(t)&&t.result&&typeof t.result=="object"){let i=t.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),os(t))o(t);else{let i=j.fromError(t.error.code,t.error.message,t.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(i){yield{type:"error",error:i instanceof j?i:new j(D.InternalError,String(i))}}return}let s;try{let i=await this.request(t,Kn,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new j(D.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},Ir(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new j(D.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new j(D.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof j?i:new j(D.InternalError,String(i))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=g=>{l(g)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),a&&this.assertTaskCapability(t.method)}catch(g){d(g);return}n?.signal?.throwIfAborted();let m=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[Er]:c}});let p=g=>{this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(g)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(k=>this._onerror(new Error(`Failed to send cancellation: ${k}`)));let w=g instanceof j?g:new j(D.RequestTimeout,String(g));l(w)};this._responseHandlers.set(m,g=>{if(!n?.signal?.aborted){if(g instanceof Error)return l(g);try{let w=Pr(r,g.result);w.success?u(w.data):l(w.error)}catch(w){l(w)}}}),n?.signal?.addEventListener("abort",()=>{p(n?.signal?.reason)});let h=n?.timeout??xR,_=()=>p(j.fromError(D.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(m,h,n?.maxTotalTimeout,_,n?.resetTimeoutOnProgress??!1);let z=c?.taskId;if(z){let g=w=>{let k=this._responseHandlers.get(m);k?k(w):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,g),this._enqueueTaskMessage(z,{type:"request",message:f,timestamp:Date.now()}).catch(w=>{this._cleanupTimeout(m),l(w)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(g=>{this._cleanupTimeout(m),l(g)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},ea,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},na,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Nx,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let a={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Er]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Er]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...t,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Er]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(t,r){let n=Ld(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=qd(t,o);return Promise.resolve(r(i,s))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Ld(t);this._notificationHandlers.set(n,o=>{let s=qd(t,o);return Promise.resolve(r(s))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&xd(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new j(D.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,s)=>{if(r.aborted){s(new j(D.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new j(D.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new j(D.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=us.parse({method:"notifications/tasks/status",params:a});await this.notification(c),Ir(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new j(D.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Ir(a.status))throw new j(D.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=us.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Ir(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function xb(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function bb(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];xb(i)&&xb(s)?r[o]={...i,...s}:r[o]=s}return r}var pw=Bf(Tf(),1),fw=Bf(dw(),1);function zA(){let e=new pw.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,fw.default)(e),e}var Xa=class{constructor(t){this._ajv=t??zA()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Qa=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}createMessageStream(t,r){let n=this._server.getClientCapabilities();if((t.tools||t.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let o=t.messages[t.messages.length-1],s=Array.isArray(o.content)?o.content:[o.content],i=s.some(l=>l.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(m=>m.type==="tool_use").map(m=>m.id)),d=new Set(s.filter(m=>m.type==="tool_result").map(m=>m.toolUseId));if(l.size!==d.size||![...l].every(m=>d.has(m)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:t},ps,r)}elicitInputStream(t,r){let n=this._server.getClientCapabilities(),o=t.mode??"form";switch(o){case"url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=o==="form"&&t.mode===void 0?{...t,mode:"form"}:t;return this.requestStream({method:"elicitation/create",params:s},Yn,r)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function mw(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function hw(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var ec=class extends _a{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(ds.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Xa,this.setRequestHandler(zd,n=>this._oninitialize(n)),this.setNotificationHandler(wd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Zd,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=ds.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Qa(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=bb(this._capabilities,t)}setRequestHandler(t,r){let o=Tr(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let s;if(Et(o)){let a=o;s=a._zod?.def?.value??a.value}else{let a=o;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=Pr(Wn,c);if(!l.success){let p=l.error instanceof Error?l.error.message:String(l.error);throw new j(D.InvalidParams,`Invalid tools/call request: ${p}`)}let{params:d}=l.data,m=await Promise.resolve(r(c,u));if(d.task){let p=Pr(Kn,m);if(!p.success){let h=p.error instanceof Error?p.error.message:String(p.error);throw new j(D.InvalidParams,`Invalid task creation result: ${h}`)}return p.data}let f=Pr(da,m);if(!f.success){let p=f.error instanceof Error?f.error.message:String(f.error);throw new j(D.InvalidParams,`Invalid tools/call result: ${p}`)}return f.data};return super.setRequestHandler(t,a)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){hw(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&mw(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:kx.includes(r)?r:yd,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Gi)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),i=t.messages.length>1?t.messages[t.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},Rd,r):this.request({method:"sampling/createMessage",params:t},ps,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Yn,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},s=await this.request({method:"elicitation/create",params:o},Yn,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new j(D.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof j?i:new j(D.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},Od,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var _w=Symbol.for("mcp.completable");function Cf(e){return!!e&&typeof e=="object"&&_w in e}function yw(e){return e[_w]?.complete}var gw;(function(e){e.Completable="McpCompletable"})(gw||(gw={}));var wA=/^[A-Za-z0-9._-]{1,128}$/;function kA(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"),!wA.test(e)){let r=e.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,s)=>s.indexOf(n)===o);return t.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function SA(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 Af(e){let t=kA(e);return SA(e,t.warnings),t.isValid}var tc=class{constructor(t){this._mcpServer=t}registerToolTask(t,r,n){let o={taskSupport:"required",...r.execution};if(o.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,o,r._meta,n)}};var rc=class{constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new ec(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new tc(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Dr(la)),this.server.assertCanSetRequestHandler(Dr(Wn)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(la,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let n={name:t,title:r.title,description:r.description,inputSchema:(()=>{let o=Jn(r.inputSchema);return o?Dd(o,{strictUnions:!0,pipeStrategy:"input"}):PA})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let o=Jn(r.outputSchema);o&&(n.outputSchema=Dd(o,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Wn,async(t,r)=>{try{let n=this._registeredTools[t.params.name];if(!n)throw new j(D.InvalidParams,`Tool ${t.params.name} not found`);if(!n.enabled)throw new j(D.InvalidParams,`Tool ${t.params.name} disabled`);let o=!!t.params.task,s=n.execution?.taskSupport,i="createTask"in n.handler;if((s==="required"||s==="optional")&&!i)throw new j(D.InternalError,`Tool ${t.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!o)throw new j(D.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!o&&i)return await this.handleAutomaticTaskPolling(n,t,r);let a=await this.validateToolInput(n,t.params.arguments,t.params.name),c=await this.executeToolHandler(n,a,r);return o||await this.validateToolOutput(n,c,t.params.name),c}catch(n){if(n instanceof j&&n.code===D.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,n){if(!t.inputSchema)return;let s=Jn(t.inputSchema)??t.inputSchema,i=await qi(s,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=Ui(a);throw new j(D.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return i.data}async validateToolOutput(t,r,n){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new j(D.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let o=Jn(t.outputSchema),s=await qi(o,r.structuredContent);if(!s.success){let i="error"in s?s.error:"Unknown error",a=Ui(i);throw new j(D.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(t,r,n){let o=t.handler;if("createTask"in o){if(!n.taskStore)throw new Error("No task store provided.");let i={...n,taskStore:n.taskStore};if(t.inputSchema){let a=o;return await Promise.resolve(a.createTask(r,i))}else{let a=o;return await Promise.resolve(a.createTask(i))}}if(t.inputSchema){let i=o;return await Promise.resolve(i(r,n))}else{let i=o;return await Promise.resolve(i(n))}}async handleAutomaticTaskPolling(t,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(t,r.params.arguments,r.params.name),s=t.handler,i={...n,taskStore:n.taskStore},a=o?await Promise.resolve(s.createTask(o,i)):await Promise.resolve(s.createTask(i)),c=a.task.taskId,u=a.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(m=>setTimeout(m,l));let d=await n.taskStore.getTask(c);if(!d)throw new j(D.InternalError,`Task ${c} not found during polling`);u=d}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Dr(pa)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(pa,async t=>{switch(t.params.ref.type){case"ref/prompt":return Lx(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return qx(t),this.handleResourceCompletion(t,t.params.ref);default:throw new j(D.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let n=this._registeredPrompts[r.name];if(!n)throw new j(D.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new j(D.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Fs;let s=Tr(n.argsSchema)?.[t.params.argument.name];if(!Cf(s))return Fs;let i=yw(s);if(!i)return Fs;let a=await i(t.params.argument.value,t.params.context);return xw(a)}async handleResourceCompletion(t,r){let n=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Fs;throw new j(D.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let o=n.resourceTemplate.completeCallback(t.params.argument.name);if(!o)return Fs;let s=await o(t.params.argument.value,t.params.context);return xw(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Dr(sa)),this.server.assertCanSetRequestHandler(Dr(ia)),this.server.assertCanSetRequestHandler(Dr(aa)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(sa,async(t,r)=>{let n=Object.entries(this._registeredResources).filter(([s,i])=>i.enabled).map(([s,i])=>({uri:s,name:i.name,...i.metadata})),o=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let i=await s.resourceTemplate.listCallback(r);for(let a of i.resources)o.push({...s.metadata,...a})}return{resources:[...n,...o]}}),this.server.setRequestHandler(ia,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(aa,async(t,r)=>{let n=new URL(t.params.uri),o=this._registeredResources[n.toString()];if(o){if(!o.enabled)throw new j(D.InvalidParams,`Resource ${n} disabled`);return o.readCallback(n,r)}for(let s of Object.values(this._registeredResourceTemplates)){let i=s.resourceTemplate.uriTemplate.match(n.toString());if(i)return s.readCallback(n,i,r)}throw new j(D.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Dr(ca)),this.server.assertCanSetRequestHandler(Dr(ua)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(ca,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?TA(r.argsSchema):void 0}))})),this.server.setRequestHandler(ua,async(t,r)=>{let n=this._registeredPrompts[t.params.name];if(!n)throw new j(D.InvalidParams,`Prompt ${t.params.name} not found`);if(!n.enabled)throw new j(D.InvalidParams,`Prompt ${t.params.name} disabled`);if(n.argsSchema){let o=Jn(n.argsSchema),s=await qi(o,t.params.arguments);if(!s.success){let c="error"in s?s.error:"Unknown error",u=Ui(c);throw new j(D.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${u}`)}let i=s.data,a=n.callback;return await Promise.resolve(a(i,r))}else{let o=n.callback;return await Promise.resolve(o(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...n){let o;typeof n[0]=="object"&&(o=n.shift());let s=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(t,void 0,r,o,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let i=this._createRegisteredResourceTemplate(t,void 0,r,o,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(t,r,n,o){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(t,r,n,o,s){let i={name:t,title:r,metadata:o,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(t,r,n,o,s){let i={resourceTemplate:n,title:r,metadata:o,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==t&&(delete this._registeredResourceTemplates[t],u.name&&(this._registeredResourceTemplates[u.name]=i)),typeof u.title<"u"&&(i.title=u.title),typeof u.template<"u"&&(i.resourceTemplate=u.template),typeof u.metadata<"u"&&(i.metadata=u.metadata),typeof u.callback<"u"&&(i.readCallback=u.callback),typeof u.enabled<"u"&&(i.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[t]=i;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!n.completeCallback(u))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(t,r,n,o,s){let i={title:r,description:n,argsSchema:o===void 0?void 0:fn(o),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==t&&(delete this._registeredPrompts[t],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=fn(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[t]=i,o&&Object.values(o).some(c=>{let u=c instanceof dt?c._def?.innerType:c;return Cf(u)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(t,r,n,o,s,i,a,c,u){Af(t);let l={title:r,description:n,inputSchema:vw(o),outputSchema:vw(s),annotations:i,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==t&&(typeof d.name=="string"&&Af(d.name),delete this._registeredTools[t],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=fn(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=fn(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[t]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let n,o,s,i;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];if(Mf(c))o=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Mf(r[0])&&(i=r.shift());else if(typeof c=="object"&&c!==null){if(Object.values(c).some(u=>typeof u=="object"&&u!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=r.shift()}}let a=r[0];return this._createRegisteredTool(t,void 0,n,o,s,i,{taskSupport:"forbidden"},void 0,a)}registerTool(t,r,n){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:o,description:s,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(t,o,s,i,a,c,{taskSupport:"forbidden"},u,n)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let o;r.length>1&&(o=r.shift());let s=r[0],i=this._createRegisteredPrompt(t,void 0,n,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(t,r,n){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:o,description:s,argsSchema:i}=r,a=this._createRegisteredPrompt(t,o,s,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var PA={type:"object",properties:{}};function bw(e){return e!==null&&typeof e=="object"&&"parse"in e&&typeof e.parse=="function"&&"safeParse"in e&&typeof e.safeParse=="function"}function $w(e){return"_def"in e||"_zod"in e||bw(e)}function Mf(e){return typeof e!="object"||e===null||$w(e)?!1:Object.keys(e).length===0?!0:Object.values(e).some(bw)}function vw(e){if(e){if(Mf(e))return fn(e);if(!$w(e))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}}function TA(e){let t=Tr(e);return t?Object.entries(t).map(([r,n])=>{let o=tx(n),s=rx(n);return{name:r,description:o,required:!s}}):[]}function Dr(e){let r=Tr(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Fi(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function xw(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var Fs={completion:{values:[],hasMore:!1}};function _o(e){return e?.proposed===!0}var hr=class extends Error{status;constructor(t,r){super(t),this.name="FlowpadError",this.status=r}},Vs=class{cfg;token;cache=new Map;clientName;constructor(t){if(this.cfg=t,t.token)this.token=t.token;else if(!t.mcpKey)throw new hr("Missing credential: provide an OAuth access token, or a FLOWPAD_API_KEY (Settings \u2192 Integrations) for the MCP server env.")}url(t){return`${this.cfg.baseUrl.replace(/\/$/,"")}${t}`}setClientName(t){let r=t?.trim();this.clientName=r?r.slice(0,64):void 0}async login(){if(!this.cfg.mcpKey)throw new hr("Access token rejected and no MCP key to re-authenticate \u2014 the OAuth token is likely expired; reconnect the connector.",401);let t;try{t=await fetch(this.url("/mcp/auth/login"),{method:"POST",headers:{"Content-Type":"application/json","x-mcp-key":this.cfg.mcpKey},signal:AbortSignal.timeout(3e4)})}catch(n){throw n instanceof Error&&n.name==="TimeoutError"?new hr("Backend timed out \u2014 retry"):n}if(!t.ok)throw new hr(`MCP login failed (${t.status}): ${await t.text()}. Check FLOWPAD_API_KEY is a valid, non-revoked key and FLOWPAD_API_URL points at the right backend.`,t.status);let r=await t.json();if(!r.access_token)throw new hr("MCP login response did not contain access_token.");this.token=r.access_token}async guidance(){return(await this.request("/mcp/guidance")).instructions}async request(t,r={},n=!0){this.token||await this.login();let o;try{o=await fetch(this.url(t),{...r,headers:{"Content-Type":"application/json",...this.clientName?{"x-mcp-client":this.clientName}:{},...r.headers??{},Authorization:`Bearer ${this.token}`},signal:AbortSignal.timeout(3e4)})}catch(s){throw s instanceof Error&&s.name==="TimeoutError"?new hr("Backend timed out \u2014 retry"):s}if(o.status===401&&n&&this.cfg.mcpKey)return this.token=void 0,await this.login(),this.request(t,r,!1);if(!o.ok)throw new hr(`${r.method??"GET"} ${t} failed (${o.status}): ${await o.text()}`,o.status);if(o.status!==204)return await o.json()}async listProjects(t){let r=t?`?query=${encodeURIComponent(t)}`:"";return this.request(`/mcp/projects${r}`)}async getProjectRaw(t){return this.request(`/mcp/projects/${t}/raw`)}async getRevision(t){return this.request(`/mcp/projects/${t}/revision`)}async getProjectRawCached(t){let r=this.cache.get(t);if(r)try{let{revision:o}=await this.getRevision(t);if(o===r.version)return r.project}catch{}let n=await this.getProjectRaw(t);return this.cache.set(t,{version:n.version,project:n}),n}invalidate(t){this.cache.delete(t)}async outline(t,r){let n=r!==void 0?`?maxDepth=${r}`:"",{text:o}=await this.request(`/mcp/projects/${t}/outline${n}`);return o}async searchNodes(t,r){let n=new URLSearchParams;for(let[i,a]of Object.entries(r))a!==void 0&&a!==""&&n.set(i,String(a));let o=n.toString()?`?${n.toString()}`:"",{text:s}=await this.request(`/mcp/projects/${t}/search${o}`);return s}async getNode(t,r,n){let o=n!==void 0?`?depth=${n}`:"",{text:s}=await this.request(`/mcp/projects/${t}/nodes/${encodeURIComponent(r)}${o}`);return s}async analyze(t){let{text:r}=await this.request(`/mcp/projects/${t}/analyze`);return r}async connections(t,r={}){let n=new URLSearchParams;r.nodeId&&n.set("nodeId",r.nodeId),r.nodeName&&n.set("nodeName",r.nodeName);let o=n.toString()?`?${n.toString()}`:"",{text:s}=await this.request(`/mcp/projects/${t}/connections${o}`);return s}async updateProject(t,r){let n=await this.request(`/mcp/projects/${t}`,{method:"PUT",body:JSON.stringify(r)});return _o(n)?this.invalidate(t):n&&typeof n.version=="number"&&n.latestData?this.cache.set(t,{version:n.version,project:n}):this.invalidate(t),n}async createProject(t){return this.request("/mcp/projects",{method:"POST",body:JSON.stringify(t)})}async deleteProject(t){return this.request(`/mcp/projects/${t}`,{method:"DELETE"})}async bindTemplate(t,r){return this.request(`/mcp/projects/${t}/bind-template`,{method:"POST",body:JSON.stringify({templateProjectId:r})})}async listTemplates(){return this.request("/mcp/templates")}};import{randomUUID as EA}from"node:crypto";function Lr(){return EA()}function zw(e){let t={x:e.bounds?.x??0,y:e.bounds?.y??0,width:e.bounds?.width??240,height:e.bounds?.height??120};return Df({id:e.id,bounds:t,children:[],parent:e.parentId??null,edges:[],...e.type?{type:e.type}:{},...e.name?{name:e.name}:{},...e.description?{description:e.description}:{},...e.isAutoLayout!=null?{isAutoLayout:e.isAutoLayout}:{},...e.layout?{layout:e.layout}:{},...e.style??{}})}function Df(e){if(e.type!=="text")return e;let t=e.content;if(typeof t=="string"&&t.length>0)return e;let r=e.description??e.name;return r?{...e,content:r}:e}function ww(e){return!e.added?.length&&!e.updated?.length&&!e.removedIds?.length}var Re=e=>({content:[{type:"text",text:e}]}),kn=e=>Re(`Proposed for the user's review: ${e}. They are viewing this project, so the change is waiting in their accept/reject preview \u2014 nothing is saved until they approve it.`),De=e=>({content:[{type:"text",text:`Error: ${e instanceof Error?e.message:String(e)}`}],isError:!0}),kw=$.object({x:$.number().optional(),y:$.number().optional(),width:$.number().optional(),height:$.number().optional()}).describe("Position/size. Missing fields default to x:0 y:0 w:240 h:120."),sc=$.enum(["top","right","bottom","left"]),Sw=$.object({id:$.string().optional().describe("Edge id; a fresh one is minted if omitted."),to:$.string().describe("Target node id this edge points to."),fromPort:sc.optional(),toPort:sc.optional()}).describe("A connection FROM this node TO another node. Direction rule: you may NOT point an edge INTO a task node \u2014 connect task\u2192regular, never regular\u2192task or task\u2192task (invalid edges are dropped server-side)."),Lf=$.object({flexDirection:$.enum(["row","row-reverse","column","column-reverse"]).optional(),flexWrap:$.enum(["nowrap","wrap","wrap-reverse"]).optional(),justifyContent:$.enum(["flex-start","center","flex-end","space-between","space-around","space-evenly"]).optional(),alignItems:$.enum(["flex-start","center","flex-end","stretch","baseline"]).optional(),alignSelf:$.enum(["flex-start","center","flex-end","stretch","baseline","auto"]).optional(),gap:$.number().optional(),padding:$.number().optional(),paddingTop:$.number().optional(),paddingRight:$.number().optional(),paddingBottom:$.number().optional(),paddingLeft:$.number().optional(),margin:$.number().optional(),marginTop:$.number().optional(),marginRight:$.number().optional(),marginBottom:$.number().optional(),marginLeft:$.number().optional(),flexGrow:$.number().optional(),flexShrink:$.number().optional()}).describe("Flexbox layout (standard CSS semantics). CONTAINER props position this node's children: flexDirection, justifyContent (main axis), alignItems (cross axis), gap, padding. PER-CHILD props control how THIS node behaves inside its parent: flexGrow, flexShrink, alignSelf, margin. Engine defaults are browser-parity \u2014 flexShrink 1, flexWrap nowrap, alignItems stretch \u2014 so set flexShrink:0 / a fixed bound only when you want NO shrinking. Use flexGrow:1 on siblings to share a row/column equally without computing widths. A node is a flex container only when isAutoLayout:true."),nc={textColor:$.string().optional().describe('Text fill color as hex, e.g. "#FFFFFF" (text nodes).'),fontSize:$.number().min(6).max(200).optional().describe("Font size in px, 6\u2013200 (text nodes)."),textAlign:$.enum(["left","center","right"]).optional().describe("Horizontal text alignment within the node (text nodes)."),backgroundColor:$.string().optional().describe("Fill color as hex (view/container nodes)."),borderColor:$.string().optional().describe("Border color as hex (view nodes)."),borderWidth:$.number().min(0).optional().describe("Border thickness in px (view nodes)."),borderRadius:$.number().min(0).optional().describe("Corner radius in px (view/container nodes)."),borderStyle:$.enum(["solid","dashed","dotted"]).optional().describe("Border line style (view nodes)."),overflow:$.enum(["hidden","visible"]).optional().describe("Clip content to the node bounds (view & text nodes)."),iconColor:$.string().optional().describe("Tint for FontAwesome icon sources as hex; ignored for raster/SVG (image nodes)."),resizeMode:$.enum(["cover","contain","fill","none"]).optional().describe("How the image fits its bounds (image nodes)."),stickyColor:$.enum(["yellow","pink","green","blue","orange","purple"]).optional().describe("Sticky note color (sticky nodes)."),stickyVariant:$.enum(["note","node"]).optional().describe('Sticky note presentation (sticky nodes): "note" = folded sticky-paper look (default), "node" = clean flat card with the color as a thin border accent.')},oc={content:$.string().optional().describe("A TEXT node's visible body \u2014 THIS is what renders on canvas. name/description are metadata and are NOT painted; set `content` for visible text."),title:$.string().optional().describe("A STICKY note's heading text (sticky nodes).")},IA=[...Object.keys(oc),...Object.keys(nc)];function qf(e){let t={};for(let r of IA)e[r]!==void 0&&(t[r]=e[r]);return t}function Pw(e){return(e??[]).map(t=>({id:t.id??Lr(),to:t.to,...t.fromPort?{fromPort:t.fromPort}:{},...t.toPort?{toPort:t.toPort}:{}}))}async function Uf(e){let t;try{t=await e.guidance()}catch(n){console.error("flowpad-mcp: could not fetch guidance from backend; using minimal fallback.",n),t="Flowpad is a visual canvas of nodes. Read a project (get_project / get_outline) before editing, then write changes with apply_edit / add_node / connect_nodes. (Full design guidance was unavailable.)"}let r=new rc({name:"flowpad-mcp",version:"0.1.0"},{instructions:t});return r.server.oninitialized=()=>{e.setClientName(r.server.getClientVersion()?.name)},r.tool("list_projects","List Flowpad projects for the logged-in user. Optionally filter by a substring of the project name. Returns id + name for each match.",{query:$.string().optional().describe("Case-insensitive substring to match against project names.")},async({query:n})=>{try{let{data:o}=await e.listProjects(n);if(o.length===0)return Re(n?`No projects matching "${n}".`:"No projects found.");let s=o.map(i=>`- ${i.name} (id: ${i.id})`);return Re(`${o.length} project(s):
108
+ ${s.join(`
109
+ `)}`)}catch(o){return De(o)}}),r.tool("get_project","Get a single Flowpad project: its current revision and a summary of its canvas nodes (id, type, name, parent). Use this to understand the canvas before editing.",{projectId:$.string().describe("The project UUID.")},async({projectId:n})=>{try{let o=await e.getProjectRaw(n),s=o.latestData??[],i=`Project "${o.name}" (id: ${o.id})
110
+ revision: ${o.version}
111
+ nodes: ${s.length}`;if(s.length===0)return Re(`${i}
112
+ (empty canvas)`);let a=s.slice(0,200).map(c=>`- #${c.id} ${c.type??"node"}${c.name?` "${c.name}"`:""}${c.parent!==null&&c.parent!==void 0?` (parent #${c.parent})`:""}`);return Re(`${i}
113
+ ${a.join(`
114
+ `)}`)}catch(o){return De(o)}}),r.tool("get_outline","Get a compact, depth-limited outline of a project's canvas (node ids, types, names, child counts). Like `ls -R` for the canvas \u2014 use it to understand structure before drilling in. Scales to large canvases.",{projectId:$.string().describe("The project UUID."),maxDepth:$.number().int().min(0).max(4).optional().describe("How deep to expand the tree. Default 2.")},async({projectId:n,maxDepth:o})=>{try{return Re(await e.outline(n,o))}catch(s){return De(s)}}),r.tool("search_nodes","Search a project's canvas for nodes by name/description substring, type, parent id, and/or faceted labels (category bucket, tag). Paginated. Like `grep` for the canvas \u2014 use it to locate the nodes you need to read or edit. Run get_outline first to see which categories/tags exist.",{projectId:$.string().describe("The project UUID."),query:$.string().optional().describe("Case-insensitive substring matched against name/description."),type:$.string().optional().describe("Restrict to a node type, e.g. 'text', 'view', 'container'."),parentId:$.string().optional().describe("Restrict to direct children of this node id."),category:$.string().optional().describe("Exact-match a node's coarse `category` bucket, e.g. 'auth'."),tag:$.string().optional().describe("Match nodes whose `tags` include this tag, e.g. 'platform:ios'."),limit:$.number().int().min(1).max(100).optional().describe("Default 20."),offset:$.number().int().min(0).optional().describe("For pagination.")},async({projectId:n,query:o,type:s,parentId:i,category:a,tag:c,limit:u,offset:l})=>{try{let d=await e.searchNodes(n,{query:o,type:s,parentId:i,category:a,tag:c,limit:u,offset:l});return Re(d)}catch(d){return De(d)}}),r.tool("get_node","Get a single node's full fields plus its subtree to a given depth. Like `cat` for a canvas node \u2014 use after get_outline/search_nodes to read just the part you care about.",{projectId:$.string().describe("The project UUID."),nodeId:$.string().describe("The node id to inspect."),depth:$.number().int().min(0).max(4).optional().describe("How many child levels to include. Default 1.")},async({projectId:n,nodeId:o,depth:s})=>{try{return Re(await e.getNode(n,o,s))}catch(i){return De(i)}}),r.tool("analyze_project","Analyze a project's canvas: structural stats (node/type counts, root count, max nesting depth) plus deterministic layout-overflow warnings (flex containers whose children can't fit). Lead with this to gauge the shape and health of a project before editing.",{projectId:$.string().describe("The project UUID.")},async({projectId:n})=>{try{return Re(await e.analyze(n))}catch(o){return De(o)}}),r.tool("query_connections",'Answer relationship/rollup questions about a project canvas using edges + work items \u2014 e.g. "how many bugs are attached to the header", "what is connected to this feature", project-wide work-item counts by type/status. Pass nodeId OR nodeName to focus on one node; omit both for a project-wide rollup. Use this instead of inferring relationships from the raw node tree. (To CREATE work items or connections, use apply_edit: add a `type:"task"` node \u2014 the backend creates its task record automatically \u2014 and put an edge in the source node\'s `edges` array.)',{projectId:$.string().describe("The project UUID."),nodeId:$.string().optional().describe("Focus node id. Omit for a project-wide rollup."),nodeName:$.string().optional().describe("Focus node by name. Omit for a project-wide rollup.")},async({projectId:n,nodeId:o,nodeName:s})=>{try{return Re(await e.connections(n,{nodeId:o,nodeName:s}))}catch(i){return De(i)}}),r.tool("apply_edit","Apply a targeted edit to a project's canvas: add, update, and/or remove nodes in one diff. Build the edit yourself from what you read via get_outline/search_nodes/get_node. New nodes get ids assigned automatically if omitted. On a revision conflict the edit is NOT force-written \u2014 re-read the latest and reapply.",{projectId:$.string().describe("The project UUID."),added:$.array($.object({id:$.string().optional(),type:$.string().optional(),name:$.string().optional(),description:$.string().optional().describe("Metadata, NOT painted. A TEXT node\u2019s visible string lives in `content`."),parent:$.string().nullable().optional(),children:$.array($.string()).optional(),bounds:kw.optional(),category:$.string().optional().describe("Coarse discovery bucket, e.g. 'auth'."),tags:$.array($.string()).optional().describe("Faceted labels, e.g. ['platform:ios','type:dialog']."),edges:$.array(Sw).optional().describe("Connections FROM this node to other nodes. For a task node, use this to attach it to what it relates to."),isAutoLayout:$.boolean().optional().describe("Set true to make this node a flexbox container that auto-positions its children (then give it a `layout`). A container WITHOUT isAutoLayout leaves children at their absolute bounds \u2014 almost always wrong for real UI."),layout:Lf.optional(),...oc,...nc})).optional().describe("New nodes to add."),updated:$.array($.object({id:$.string().describe("Existing node id to update."),type:$.string().optional(),name:$.string().optional(),description:$.string().optional().describe("Metadata, NOT painted. A TEXT node\u2019s visible string lives in `content`."),parent:$.string().nullable().optional(),bounds:kw.optional(),category:$.string().optional().describe("Coarse discovery bucket."),tags:$.array($.string()).optional().describe("Replaces the node's tags."),edges:$.array(Sw).optional().describe("Replaces the node's outgoing connections."),isAutoLayout:$.boolean().optional().describe("Toggle whether this node is a flexbox container."),layout:Lf.optional().describe("Merged onto the node's existing layout."),...oc,...nc})).optional().describe("Patches to existing nodes (merged onto current values)."),removedIds:$.array($.string()).optional().describe("Ids of nodes to delete.")},async({projectId:n,added:o,updated:s,removedIds:i})=>{try{let a=await e.getProjectRawCached(n),c=a.latestData??[],u=new Map(c.map(g=>[String(g.id),g])),l=new Set(u.keys());for(let g of o??[])g.id!=null&&l.add(g.id);let d=()=>{let g=Lr();for(;l.has(g);)g=Lr();return l.add(g),g},m=(o??[]).map(g=>Df({id:g.id??d(),bounds:{x:g.bounds?.x??0,y:g.bounds?.y??0,width:g.bounds?.width??240,height:g.bounds?.height??120},children:g.children??[],parent:g.parent??null,edges:Pw(g.edges),...g.type?{type:g.type}:{},...g.name?{name:g.name}:{},...g.description?{description:g.description}:{},...g.category?{category:g.category}:{},...g.tags?{tags:g.tags}:{},...g.isAutoLayout!=null?{isAutoLayout:g.isAutoLayout}:{},...g.layout?{layout:g.layout}:{},...qf(g)})),f=[],p=[];for(let g of s??[]){let w=u.get(String(g.id));if(!w){p.push(g.id);continue}let k={...w};if(g.name!==void 0&&(k.name=g.name),g.description!==void 0&&(k.description=g.description),g.type!==void 0&&(k.type=g.type),g.parent!==void 0&&(k.parent=g.parent),g.bounds&&(k.bounds={...w.bounds,...g.bounds}),g.category!==void 0&&(k.category=g.category),g.tags!==void 0&&(k.tags=g.tags),g.edges!==void 0&&(k.edges=Pw(g.edges)),g.isAutoLayout!==void 0&&(k.isAutoLayout=g.isAutoLayout),g.layout!==void 0){let I=w.layout??{};k.layout={...I,...g.layout}}Object.assign(k,qf(g)),f.push(k)}let h=(i??[]).map(g=>u.get(String(g))?.id).filter(g=>g!==void 0),_={};m.length&&(_.added=m),f.length&&(_.updated=f),h.length&&(_.removedIds=h);let z=p.length?` (skipped unknown update ids: ${p.join(", ")})`:"";if(ww(_))return Re(`Nothing to apply.${z}`);try{let g=[m.length?`${m.length} added (#${m.map(k=>k.id).join(", #")})`:null,f.length?`${f.length} updated`:null,h.length?`${h.length} removed`:null].filter(Boolean).join(", "),w=await e.updateProject(n,{diff:_,baseRevision:a.version});return _o(w)?kn(g):Re(`Applied: ${g}. New revision: ${w.version}.${z}`)}catch(g){if(g instanceof Error&&/409|conflict|revision/i.test(g.message))return e.invalidate(n),Re(`Revision conflict: the project changed since you last read it (your baseRevision ${a.version} is stale). Re-read with get_outline/get_node and reapply your edit. (Non-overlapping edits will merge automatically once server-side node-merge lands.)`);throw g}}catch(a){return De(a)}}),r.tool("add_node","Add a single node to a Flowpad project directly. Use for a deterministic single-node addition when you know its content. For multi-node structures build the tree yourself and use apply_edit. To make this node lay its children out with flexbox, pass isAutoLayout:true + layout.",{projectId:$.string().describe("The project UUID."),name:$.string().optional().describe("Node title (metadata, NOT painted)."),description:$.string().optional().describe("Node description (metadata, NOT painted on canvas). For a TEXT node\u2019s VISIBLE string use `content`, not this."),type:$.string().optional().describe("Node type, e.g. 'view'. Defaults to a plain node."),parentId:$.string().optional().describe("Existing node id to attach this node under."),x:$.number().optional().describe("Top-left x. Default 0."),y:$.number().optional().describe("Top-left y. Default 0."),width:$.number().optional().describe("Width. Default 240."),height:$.number().optional().describe("Height. Default 120."),isAutoLayout:$.boolean().optional().describe("Make this node a flexbox container (pair with `layout`)."),layout:Lf.optional(),...oc,...nc},async n=>{let{projectId:o,name:s,description:i,type:a,parentId:c,x:u,y:l,width:d,height:m,isAutoLayout:f,layout:p}=n;try{let h=await e.getProjectRaw(o),_=Lr(),z=zw({id:_,type:a,name:s,description:i,parentId:c??null,bounds:{x:u,y:l,width:d,height:m},isAutoLayout:f,layout:p,style:qf(n)}),g=await e.updateProject(o,{diff:{added:[z]},baseRevision:h.version});return _o(g)?kn(`1 node added${s?` ("${s}")`:""}`):Re(`Added node #${_}${s?` "${s}"`:""}. New revision: ${g.version}.`)}catch(h){return De(h)}}),r.tool("create_project","Create a NEW, empty project (a fresh canvas) for the user. Use this when the request is a new app/design that does NOT belong in an existing project \u2014 never dump unrelated screens into whatever project happens to be open. Returns the new project id; pass it as projectId to add_node/apply_edit to design into it. Applies immediately (a new empty project is non-destructive).",{name:$.string().describe('The project name, e.g. "Mobile App \u2014 Onboarding".'),isTemplateProject:$.boolean().optional().describe("Mark as a reusable template project. Default false.")},async({name:n,isTemplateProject:o})=>{try{let s=await e.createProject({name:n,...o!=null?{isTemplateProject:o}:{}});return"proposed"in s?kn(`create project "${n}" (the user confirms/edits the name on their screen)`):Re(`Created project "${n}" (#${s.id}). Design into it by passing projectId:"${s.id}" to add_node / apply_edit.`)}catch(s){return De(s instanceof Error?s:new Error(String(s)))}}),r.tool("delete_project","Delete a project by id. DESTRUCTIVE. If the owner is currently viewing that project, the deletion is routed to their accept/reject confirm \u2014 nothing is deleted until they approve. Otherwise it deletes immediately. Use the UUID from list_projects; never guess.",{projectId:$.string().describe("The project UUID to delete.")},async({projectId:n})=>{try{return(await e.deleteProject(n)).proposed?kn(`delete project ${n}`):Re(`Deleted project ${n}.`)}catch(o){return De(o instanceof Error?o:new Error(String(o)))}}),r.tool("bind_template","Install a template project INTO a project so its template nodes become available there. If the owner is viewing the target project, the bind is routed to their confirm dialog; otherwise it applies. Find template project ids via list_projects (template projects) or the project catalog. Both ids are UUIDs.",{projectId:$.string().describe("The project UUID to install the template into."),templateProjectId:$.string().describe("The template project UUID to install.")},async({projectId:n,templateProjectId:o})=>{try{return(await e.bindTemplate(n,o)).proposed?kn(`install template ${o} into ${n}`):Re(`Installed template ${o} into project ${n}.`)}catch(s){return De(s instanceof Error?s:new Error(String(s)))}}),r.tool("list_templates","List the BINDABLE templates you can install into a project: bundled built-ins + the user's own template projects. Returns id + name + source for each \u2014 pick one and pass its id as bind_template's templateProjectId. (Templates already INSTALLED on a project are shown by get_project; THIS is the catalog of what you CAN add.)",{},async()=>{try{let{data:n}=await e.listTemplates();if(!n.length)return Re("No bindable templates available.");let o=n.map(s=>`- ${s.name} (id: ${s.id}, ${s.source})${s.description?` \u2014 ${s.description}`:""}`);return Re(`${n.length} template(s) you can bind:
115
+ ${o.join(`
116
+ `)}`)}catch(n){return De(n instanceof Error?n:new Error(String(n)))}}),r.tool("create_task","Create a work item (task / feature / bug) on a project canvas. Adds a first-class task node; the backend auto-creates the backing task record and resolves taskType/taskStatus to the workspace's tag ids by name. Optionally connect it to an existing node in one shot. This is the deterministic equivalent of the in-app AI's <AddTask> \u2014 use it to plan/track work, not just draw UI.",{projectId:$.string().describe("The project UUID."),title:$.string().describe("Short imperative summary (the task title)."),description:$.string().optional().describe("More detail about the work."),taskType:$.string().optional().describe('Work-item kind, e.g. "bug" / "feat" / "chore". Resolved to a workspace task-type tag by name; omit if unknown (run analyze_project / get_outline to learn the workspace vocabulary).'),taskStatus:$.string().optional().describe('Progress, e.g. "todo" / "in-progress" / "done". Resolved to a workspace progress tag by name; omit if unknown.'),connectTo:$.string().optional().describe("Existing node id to attach this task to. Creates an edge FROM the task TO that node (e.g. a bug attached to the header it affects)."),parentId:$.string().optional().describe("Existing node id to nest under."),x:$.number().optional().describe("Top-left x. Default 0."),y:$.number().optional().describe("Top-left y. Default 0.")},async({projectId:n,title:o,description:s,taskType:i,taskStatus:a,connectTo:c,parentId:u,x:l,y:d})=>{try{let m=await e.getProjectRaw(n);if(c&&!(m.latestData??[]).some(z=>String(z.id)===c))return De(new Error(`connectTo node ${c} not found in project.`));let f=Lr(),p={id:f,type:"task",name:o,bounds:{x:l??0,y:d??0,width:100,height:100},children:[],parent:u??null,edges:c?[{id:Lr(),to:c}]:[],taskId:null,taskVersionNumber:null,...s?{description:s}:{},...i?{aiTaskType:i}:{},...a?{aiTaskStatus:a}:{}},h=await e.updateProject(n,{diff:{added:[p]},baseRevision:m.version}),_=c?`, connected to ${c}`:"";return _o(h)?kn(`task "${o}" created${_}`):Re(`Created task "${o}" (#${f}${i?`, ${i}`:""}${a?`, ${a}`:""}${_}). New revision: ${h.version}.`)}catch(m){return De(m)}}),r.tool("connect_nodes","Draw a connection (edge) between two EXISTING nodes \u2014 e.g. attach a bug to the feature it affects, or link a task to a design region. The edge points FROM fromId TO toId. Direction rule: you may NOT point an edge INTO a task node (connect task\u2192regular, never regular\u2192task or task\u2192task). Idempotent: re-running with the same pair is a no-op.",{projectId:$.string().describe("The project UUID."),fromId:$.string().describe("Source node id (the edge starts here)."),toId:$.string().describe("Target node id (the edge points here)."),fromPort:sc.optional(),toPort:sc.optional()},async({projectId:n,fromId:o,toId:s,fromPort:i,toPort:a})=>{try{if(o===s)return De(new Error("Cannot connect a node to itself."));let c=await e.getProjectRaw(n),u=c.latestData??[],l=u.find(h=>String(h.id)===o);if(!l)return De(new Error(`Source node ${o} not found.`));if(!u.some(h=>String(h.id)===s))return De(new Error(`Target node ${s} not found.`));let d=Array.isArray(l.edges)?l.edges:[];if(d.some(h=>{let _=h;return _.to===s&&_.fromPort===i&&_.toPort===a}))return Re(`Edge ${o} \u2192 ${s} already exists.`);let f={...l,edges:[...d,{id:Lr(),to:s,...i?{fromPort:i}:{},...a?{toPort:a}:{}}]},p=await e.updateProject(n,{diff:{updated:[f]},baseRevision:c.version});return _o(p)?kn(`edge ${o} \u2192 ${s}`):Re(`Connected ${o} \u2192 ${s}. New revision: ${p.version}.`)}catch(c){return De(c)}}),r}var ZA=process.env.FLOWPAD_API_URL??"https://api.getflowpad.com";async function RA(){let e=new Vs({baseUrl:ZA,mcpKey:process.env.FLOWPAD_API_KEY??process.env.MCP_API_KEY});await(await Uf(e)).connect(new _i),console.error("flowpad-mcp-local running on stdio")}RA().catch(e=>{console.error("Fatal:",e),process.exit(1)});