superpowers-mcp 6.3.3 → 6.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +138 -224
- package/README.ko.md +139 -225
- package/README.md +139 -228
- package/README.zh-TW.md +139 -226
- package/out/server.js +212 -42
- package/out/setup-runner.js +57 -0
- package/out/setup.js +58 -0
- package/package.json +11 -6
- package/scripts/copy-skills.js +48 -0
- package/scripts/install.ps1 +59 -0
- package/scripts/install.sh +44 -0
- package/scripts/setup.js +31 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +1 -0
- package/skills/subagent-driven-development/implementer-prompt.md +1 -0
- package/skills/using-superpowers/SKILL.md +9 -0
- package/skills/writing-plans/SKILL.md +3 -0
- package/skills/writing-plans/plan-document-reviewer-prompt.md +1 -0
package/out/server.js
CHANGED
|
@@ -1,89 +1,259 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var D_=Object.create;var xs=Object.defineProperty;var Z_=Object.getOwnPropertyDescriptor;var R_=Object.getOwnPropertyNames;var U_=Object.getPrototypeOf,A_=Object.prototype.hasOwnProperty;var w=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},xn=(e,t)=>{for(var r in t)xs(e,r,{get:t[r],enumerable:!0})},C_=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of R_(t))!A_.call(e,o)&&o!==r&&xs(e,o,{get:()=>t[o],enumerable:!(n=Z_(t,o))||n.enumerable});return e};var sr=(e,t,r)=>(r=e!=null?D_(U_(e)):{},C_(t||!e||!e.__esModule?xs(r,"default",{value:e,enumerable:!0}):r,e));var Do=w(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.regexpCode=re.getEsmExportName=re.getProperty=re.safeStringify=re.stringify=re.strConcat=re.addCodeArg=re.str=re._=re.nil=re._Code=re.Name=re.IDENTIFIER=re._CodeOrName=void 0;var Oo=class{};re._CodeOrName=Oo;re.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var vr=class extends Oo{constructor(t){if(super(),!re.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}}};re.Name=vr;var ot=class extends Oo{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 vr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};re._Code=ot;re.nil=new ot("");function Ag(e,...t){let r=[e[0]],n=0;for(;n<t.length;)bd(r,t[n]),r.push(e[++n]);return new ot(r)}re._=Ag;var $d=new ot("+");function Cg(e,...t){let r=[No(e[0])],n=0;for(;n<t.length;)r.push($d),bd(r,t[n]),r.push($d,No(e[++n]));return xw(r),new ot(r)}re.str=Cg;function bd(e,t){t instanceof ot?e.push(...t._items):t instanceof vr?e.push(t):e.push(Sw(t))}re.addCodeArg=bd;function xw(e){let t=1;for(;t<e.length-1;){if(e[t]===$d){let r=kw(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function kw(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof vr||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 vr))return`"${e}${t.slice(1)}`}function ww(e,t){return t.emptyStr()?e:e.emptyStr()?t:Cg`${e}${t}`}re.strConcat=ww;function Sw(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:No(Array.isArray(e)?e.join(","):e)}function zw(e){return new ot(No(e))}re.stringify=zw;function No(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}re.safeStringify=No;function Iw(e){return typeof e=="string"&&re.IDENTIFIER.test(e)?new ot(`.${e}`):Ag`[${e}]`}re.getProperty=Iw;function Pw(e){if(typeof e=="string"&&re.IDENTIFIER.test(e))return new ot(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}re.getEsmExportName=Pw;function Tw(e){return new ot(e.toString())}re.regexpCode=Tw});var wd=w(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.ValueScope=Le.ValueScopeName=Le.Scope=Le.varKinds=Le.UsedValueState=void 0;var qe=Do(),xd=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},ja;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(ja||(Le.UsedValueState=ja={}));Le.varKinds={const:new qe.Name("const"),let:new qe.Name("let"),var:new qe.Name("var")};var Ea=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof qe.Name?t:this.name(t)}name(t){return new qe.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}}};Le.Scope=Ea;var Oa=class extends qe.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,qe._)`.${new qe.Name(r)}[${n}]`}};Le.ValueScopeName=Oa;var jw=(0,qe._)`\n`,kd=class extends Ea{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?jw:qe.nil}}get(){return this._scope}name(t){return new Oa(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:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,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,qe._)`${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 i=qe.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,ja.Started);let l=r(u);if(l){let d=this.opts.es5?Le.varKinds.var:Le.varKinds.const;i=(0,qe._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,qe._)`${i}${l}${this.opts._n}`;else throw new xd(u);c.set(u,ja.Completed)})}return i}};Le.ValueScope=kd});var B=w(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 Q=Do(),mt=wd(),Qt=Do();Object.defineProperty(G,"_",{enumerable:!0,get:function(){return Qt._}});Object.defineProperty(G,"str",{enumerable:!0,get:function(){return Qt.str}});Object.defineProperty(G,"strConcat",{enumerable:!0,get:function(){return Qt.strConcat}});Object.defineProperty(G,"nil",{enumerable:!0,get:function(){return Qt.nil}});Object.defineProperty(G,"getProperty",{enumerable:!0,get:function(){return Qt.getProperty}});Object.defineProperty(G,"stringify",{enumerable:!0,get:function(){return Qt.stringify}});Object.defineProperty(G,"regexpCode",{enumerable:!0,get:function(){return Qt.regexpCode}});Object.defineProperty(G,"Name",{enumerable:!0,get:function(){return Qt.Name}});var Ra=wd();Object.defineProperty(G,"Scope",{enumerable:!0,get:function(){return Ra.Scope}});Object.defineProperty(G,"ValueScope",{enumerable:!0,get:function(){return Ra.ValueScope}});Object.defineProperty(G,"ValueScopeName",{enumerable:!0,get:function(){return Ra.ValueScopeName}});Object.defineProperty(G,"varKinds",{enumerable:!0,get:function(){return Ra.varKinds}});G.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};var At=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Sd=class extends At{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?mt.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=nn(this.rhs,t,r)),this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},Na=class extends At{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 Q.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=nn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Q.Name?{}:{...this.lhs.names};return Za(t,this.rhs)}},zd=class extends Na{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Id=class extends At{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Pd=class extends At{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Td=class extends At{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},jd=class extends At{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=nn(this.code,t,r),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},Zo=class extends At{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 i=n[o];i.optimizeNames(t,r)||(Ew(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>$r(t,r.names),{})}},Ct=class extends Zo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Ed=class extends Zo{},rn=class extends Ct{};rn.kind="else";var yr=class e extends Ct{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 rn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(Mg(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=nn(this.condition,t,r),this}get names(){let t=super.names;return Za(t,this.condition),this.else&&$r(t,this.else.names),t}};yr.kind="if";var _r=class extends Ct{};_r.kind="for";var Od=class extends _r{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=nn(this.iteration,t,r),this}get names(){return $r(super.names,this.iteration.names)}},Nd=class extends _r{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?mt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=Za(super.names,this.from);return Za(t,this.to)}},Da=class extends _r{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=nn(this.iterable,t,r),this}get names(){return $r(super.names,this.iterable.names)}},Ro=class extends Ct{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)}};Ro.kind="func";var Uo=class extends Zo{render(t){return"return "+super.render(t)}};Uo.kind="return";var Dd=class extends Ct{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&&$r(t,this.catch.names),this.finally&&$r(t,this.finally.names),t}},Ao=class extends Ct{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Ao.kind="catch";var Co=class extends Ct{render(t){return"finally"+super.render(t)}};Co.kind="finally";var Zd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
-
`:""},this._extScope=t,this._scope=new mt.Scope({parent:t}),this._nodes=[new Ed]}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 i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Sd(t,i,n)),i}const(t,r,n){return this._def(mt.varKinds.const,t,r,n)}let(t,r,n){return this._def(mt.varKinds.let,t,r,n)}var(t,r,n){return this._def(mt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Na(t,r,n))}add(t,r){return this._leafNode(new zd(t,G.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Q.nil&&this._leafNode(new jd(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,Q.addCodeArg)(r,o));return r.push("}"),new Q._Code(r)}if(t,r,n){if(this._blockNode(new yr(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 yr(t))}else(){return this._elseNode(new rn)}endIf(){return this._endBlockNode(yr,rn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Od(t),r)}forRange(t,r,n,o,i=this.opts.es5?mt.varKinds.var:mt.varKinds.let){let a=this._scope.toName(t);return this._for(new Nd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=mt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof Q.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Q._)`${a}.length`,s=>{this.var(i,(0,Q._)`${a}[${s}]`),n(i)})}return this._for(new Da("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?mt.varKinds.var:mt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Q._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new Da("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(_r)}label(t){return this._leafNode(new Id(t))}break(t){return this._leafNode(new Pd(t))}return(t){let r=new Uo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Uo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Dd;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new Ao(i),r(i)}return n&&(this._currNode=o.finally=new Co,this.code(n)),this._endBlockNode(Ao,Co)}throw(t){return this._leafNode(new Td(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=Q.nil,n,o){return this._blockNode(new Ro(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Ro)}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 yr))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=Zd;function $r(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Za(e,t){return t instanceof Q._CodeOrName?$r(e,t.names):e}function nn(e,t,r){if(e instanceof Q.Name)return n(e);if(!o(e))return e;return new Q._Code(e._items.reduce((i,a)=>(a instanceof Q.Name&&(a=n(a)),a instanceof Q._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof Q._Code&&i._items.some(a=>a instanceof Q.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function Ew(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Mg(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Q._)`!${Rd(e)}`}G.not=Mg;var Ow=qg(G.operators.AND);function Nw(...e){return e.reduce(Ow)}G.and=Nw;var Dw=qg(G.operators.OR);function Zw(...e){return e.reduce(Dw)}G.or=Zw;function qg(e){return(t,r)=>t===Q.nil?r:r===Q.nil?t:(0,Q._)`${Rd(t)} ${e} ${Rd(r)}`}function Rd(e){return e instanceof Q.Name?e:(0,Q._)`(${e})`}});var ee=w(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.checkStrictMode=X.getErrorPath=X.Type=X.useFunc=X.setEvaluated=X.evaluatedPropsToName=X.mergeEvaluated=X.eachItem=X.unescapeJsonPointer=X.escapeJsonPointer=X.escapeFragment=X.unescapeFragment=X.schemaRefOrVal=X.schemaHasRulesButRef=X.schemaHasRules=X.checkUnknownRules=X.alwaysValidSchema=X.toHash=void 0;var le=B(),Rw=Do();function Uw(e){let t={};for(let r of e)t[r]=!0;return t}X.toHash=Uw;function Aw(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(Vg(e,t),!Jg(t,e.self.RULES.all))}X.alwaysValidSchema=Aw;function Vg(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||Hg(e,`unknown keyword: "${i}"`)}X.checkUnknownRules=Vg;function Jg(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}X.schemaHasRules=Jg;function Cw(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}X.schemaHasRulesButRef=Cw;function Mw({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,le._)`${r}`}return(0,le._)`${e}${t}${(0,le.getProperty)(n)}`}X.schemaRefOrVal=Mw;function qw(e){return Kg(decodeURIComponent(e))}X.unescapeFragment=qw;function Lw(e){return encodeURIComponent(Ad(e))}X.escapeFragment=Lw;function Ad(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}X.escapeJsonPointer=Ad;function Kg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}X.unescapeJsonPointer=Kg;function Fw(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}X.eachItem=Fw;function Lg({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof le.Name?(i instanceof le.Name?e(o,i,a):t(o,i,a),a):i instanceof le.Name?(t(o,a,i),i):r(i,a);return s===le.Name&&!(c instanceof le.Name)?n(o,c):c}}X.mergeEvaluated={props:Lg({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,le._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,le._)`${r} || {}`).code((0,le._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,le._)`${r} || {}`),Cd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Bg}),items:Lg({mergeNames:(e,t,r)=>e.if((0,le._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,le._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,le._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,le._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Bg(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,le._)`{}`);return t!==void 0&&Cd(e,r,t),r}X.evaluatedPropsToName=Bg;function Cd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,le._)`${t}${(0,le.getProperty)(n)}`,!0))}X.setEvaluated=Cd;var Fg={};function Vw(e,t){return e.scopeValue("func",{ref:t,code:Fg[t.code]||(Fg[t.code]=new Rw._Code(t.code))})}X.useFunc=Vw;var Ud;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ud||(X.Type=Ud={}));function Jw(e,t,r){if(e instanceof le.Name){let n=t===Ud.Num;return r?n?(0,le._)`"[" + ${e} + "]"`:(0,le._)`"['" + ${e} + "']"`:n?(0,le._)`"/" + ${e}`:(0,le._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,le.getProperty)(e).toString():"/"+Ad(e)}X.getErrorPath=Jw;function Hg(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}X.checkStrictMode=Hg});var Mt=w(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});var je=B(),Kw={data:new je.Name("data"),valCxt:new je.Name("valCxt"),instancePath:new je.Name("instancePath"),parentData:new je.Name("parentData"),parentDataProperty:new je.Name("parentDataProperty"),rootData:new je.Name("rootData"),dynamicAnchors:new je.Name("dynamicAnchors"),vErrors:new je.Name("vErrors"),errors:new je.Name("errors"),this:new je.Name("this"),self:new je.Name("self"),scope:new je.Name("scope"),json:new je.Name("json"),jsonPos:new je.Name("jsonPos"),jsonLen:new je.Name("jsonLen"),jsonPart:new je.Name("jsonPart")};Md.default=Kw});var Mo=w(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.extendErrors=Ee.resetErrorsCount=Ee.reportExtraError=Ee.reportError=Ee.keyword$DataError=Ee.keywordError=void 0;var te=B(),Ua=ee(),Ae=Mt();Ee.keywordError={message:({keyword:e})=>(0,te.str)`must pass "${e}" keyword validation`};Ee.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,te.str)`"${e}" keyword must be ${t} ($data)`:(0,te.str)`"${e}" keyword is invalid ($data)`};function Bw(e,t=Ee.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=Xg(e,t,r);n??(a||s)?Gg(i,c):Wg(o,(0,te._)`[${c}]`)}Ee.reportError=Bw;function Hw(e,t=Ee.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=Xg(e,t,r);Gg(o,s),i||a||Wg(n,Ae.default.vErrors)}Ee.reportExtraError=Hw;function Gw(e,t){e.assign(Ae.default.errors,t),e.if((0,te._)`${Ae.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,te._)`${Ae.default.vErrors}.length`,t),()=>e.assign(Ae.default.vErrors,null)))}Ee.resetErrorsCount=Gw;function Ww({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,Ae.default.errors,s=>{e.const(a,(0,te._)`${Ae.default.vErrors}[${s}]`),e.if((0,te._)`${a}.instancePath === undefined`,()=>e.assign((0,te._)`${a}.instancePath`,(0,te.strConcat)(Ae.default.instancePath,i.errorPath))),e.assign((0,te._)`${a}.schemaPath`,(0,te.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,te._)`${a}.schema`,r),e.assign((0,te._)`${a}.data`,n))})}Ee.extendErrors=Ww;function Gg(e,t){let r=e.const("err",t);e.if((0,te._)`${Ae.default.vErrors} === null`,()=>e.assign(Ae.default.vErrors,(0,te._)`[${r}]`),(0,te._)`${Ae.default.vErrors}.push(${r})`),e.code((0,te._)`${Ae.default.errors}++`)}function Wg(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,te._)`new ${e.ValidationError}(${t})`):(r.assign((0,te._)`${n}.errors`,t),r.return(!1))}var br={keyword:new te.Name("keyword"),schemaPath:new te.Name("schemaPath"),params:new te.Name("params"),propertyName:new te.Name("propertyName"),message:new te.Name("message"),schema:new te.Name("schema"),parentSchema:new te.Name("parentSchema")};function Xg(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,te._)`{}`:Xw(e,t,r)}function Xw(e,t,r={}){let{gen:n,it:o}=e,i=[Yw(o,r),Qw(e,r)];return eS(e,t,i),n.object(...i)}function Yw({errorPath:e},{instancePath:t}){let r=t?(0,te.str)`${e}${(0,Ua.getErrorPath)(t,Ua.Type.Str)}`:e;return[Ae.default.instancePath,(0,te.strConcat)(Ae.default.instancePath,r)]}function Qw({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,te.str)`${t}/${e}`;return r&&(o=(0,te.str)`${o}${(0,Ua.getErrorPath)(r,Ua.Type.Str)}`),[br.schemaPath,o]}function eS(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([br.keyword,o],[br.params,typeof t=="function"?t(e):t||(0,te._)`{}`]),c.messages&&n.push([br.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([br.schema,a],[br.parentSchema,(0,te._)`${l}${d}`],[Ae.default.data,i]),u&&n.push([br.propertyName,u])}});var Qg=w(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.boolOrEmptySchema=on.topBoolOrEmptySchema=void 0;var tS=Mo(),rS=B(),nS=Mt(),oS={message:"boolean schema is false"};function iS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?Yg(e,!1):typeof r=="object"&&r.$async===!0?t.return(nS.default.data):(t.assign((0,rS._)`${n}.errors`,null),t.return(!0))}on.topBoolOrEmptySchema=iS;function aS(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),Yg(e)):r.var(t,!0)}on.boolOrEmptySchema=aS;function Yg(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,tS.reportError)(o,oS,void 0,t)}});var qd=w(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.getRules=an.isJSONType=void 0;var sS=["string","number","integer","boolean","null","object","array"],cS=new Set(sS);function uS(e){return typeof e=="string"&&cS.has(e)}an.isJSONType=uS;function lS(){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:{}}}an.getRules=lS});var Ld=w(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.shouldUseRule=er.shouldUseGroup=er.schemaHasRulesForType=void 0;function dS({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&ev(e,n)}er.schemaHasRulesForType=dS;function ev(e,t){return t.rules.some(r=>tv(e,r))}er.shouldUseGroup=ev;function tv(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))}er.shouldUseRule=tv});var qo=w(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.reportTypeError=Oe.checkDataTypes=Oe.checkDataType=Oe.coerceAndCheckDataType=Oe.getJSONTypes=Oe.getSchemaTypes=Oe.DataType=void 0;var pS=qd(),fS=Ld(),mS=Mo(),K=B(),rv=ee(),sn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(sn||(Oe.DataType=sn={}));function hS(e){let t=nv(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}Oe.getSchemaTypes=hS;function nv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(pS.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Oe.getJSONTypes=nv;function gS(e,t){let{gen:r,data:n,opts:o}=e,i=vS(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,fS.schemaHasRulesForType)(e,t[0]));if(a){let s=Vd(t,n,o.strictNumbers,sn.Wrong);r.if(s,()=>{i.length?yS(e,t,i):Jd(e)})}return a}Oe.coerceAndCheckDataType=gS;var ov=new Set(["string","number","integer","boolean","null"]);function vS(e,t){return t?e.filter(r=>ov.has(r)||t==="array"&&r==="array"):[]}function yS(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,K._)`typeof ${o}`),s=n.let("coerced",(0,K._)`undefined`);i.coerceTypes==="array"&&n.if((0,K._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,K._)`${o}[0]`).assign(a,(0,K._)`typeof ${o}`).if(Vd(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,K._)`${s} !== undefined`);for(let u of r)(ov.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),Jd(e),n.endIf(),n.if((0,K._)`${s} !== undefined`,()=>{n.assign(o,s),_S(e,s)});function c(u){switch(u){case"string":n.elseIf((0,K._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,K._)`"" + ${o}`).elseIf((0,K._)`${o} === null`).assign(s,(0,K._)`""`);return;case"number":n.elseIf((0,K._)`${a} == "boolean" || ${o} === null
|
|
4
|
-
|| (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,
|
|
5
|
-
|| (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,
|
|
6
|
-
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,K._)`[${o}]`)}}}function _S({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,K._)`${t} !== undefined`,()=>e.assign((0,K._)`${t}[${r}]`,n))}function Fd(e,t,r,n=sn.Correct){let o=n===sn.Correct?K.operators.EQ:K.operators.NEQ,i;switch(e){case"null":return(0,K._)`${t} ${o} null`;case"array":i=(0,K._)`Array.isArray(${t})`;break;case"object":i=(0,K._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,K._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,K._)`typeof ${t} ${o} ${e}`}return n===sn.Correct?i:(0,K.not)(i);function a(s=K.nil){return(0,K.and)((0,K._)`typeof ${t} == "number"`,s,r?(0,K._)`isFinite(${t})`:K.nil)}}Oe.checkDataType=Fd;function Vd(e,t,r,n){if(e.length===1)return Fd(e[0],t,r,n);let o,i=(0,rv.toHash)(e);if(i.array&&i.object){let a=(0,K._)`typeof ${t} != "object"`;o=i.null?a:(0,K._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=K.nil;i.number&&delete i.integer;for(let a in i)o=(0,K.and)(o,Fd(a,t,r,n));return o}Oe.checkDataTypes=Vd;var $S={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,K._)`{type: ${e}}`:(0,K._)`{type: ${t}}`};function Jd(e){let t=bS(e);(0,mS.reportError)(t,$S)}Oe.reportTypeError=Jd;function bS(e){let{gen:t,data:r,schema:n}=e,o=(0,rv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var av=w(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});Aa.assignDefaults=void 0;var cn=B(),xS=ee();function kS(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)iv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>iv(e,i,o.default))}Aa.assignDefaults=kS;function iv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,cn._)`${i}${(0,cn.getProperty)(t)}`;if(o){(0,xS.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,cn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,cn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,cn._)`${s} = ${(0,cn.stringify)(r)}`)}});var it=w(ae=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});ae.validateUnion=ae.validateArray=ae.usePattern=ae.callValidateCode=ae.schemaProperties=ae.allSchemaProperties=ae.noPropertyInData=ae.propertyInData=ae.isOwnProperty=ae.hasPropFunc=ae.reportMissingProp=ae.checkMissingProp=ae.checkReportMissingProp=void 0;var me=B(),Kd=ee(),tr=Mt(),wS=ee();function SS(e,t){let{gen:r,data:n,it:o}=e;r.if(Hd(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,me._)`${t}`},!0),e.error()})}ae.checkReportMissingProp=SS;function zS({gen:e,data:t,it:{opts:r}},n,o){return(0,me.or)(...n.map(i=>(0,me.and)(Hd(e,t,i,r.ownProperties),(0,me._)`${o} = ${i}`)))}ae.checkMissingProp=zS;function IS(e,t){e.setParams({missingProperty:t},!0),e.error()}ae.reportMissingProp=IS;function sv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,me._)`Object.prototype.hasOwnProperty`})}ae.hasPropFunc=sv;function Bd(e,t,r){return(0,me._)`${sv(e)}.call(${t}, ${r})`}ae.isOwnProperty=Bd;function PS(e,t,r,n){let o=(0,me._)`${t}${(0,me.getProperty)(r)} !== undefined`;return n?(0,me._)`${o} && ${Bd(e,t,r)}`:o}ae.propertyInData=PS;function Hd(e,t,r,n){let o=(0,me._)`${t}${(0,me.getProperty)(r)} === undefined`;return n?(0,me.or)(o,(0,me.not)(Bd(e,t,r))):o}ae.noPropertyInData=Hd;function cv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ae.allSchemaProperties=cv;function TS(e,t){return cv(t).filter(r=>!(0,Kd.alwaysValidSchema)(e,t[r]))}ae.schemaProperties=TS;function jS({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,me._)`${e}, ${t}, ${n}${o}`:t,d=[[tr.default.instancePath,(0,me.strConcat)(tr.default.instancePath,i)],[tr.default.parentData,a.parentData],[tr.default.parentDataProperty,a.parentDataProperty],[tr.default.rootData,tr.default.rootData]];a.opts.dynamicRef&&d.push([tr.default.dynamicAnchors,tr.default.dynamicAnchors]);let m=(0,me._)`${l}, ${r.object(...d)}`;return c!==me.nil?(0,me._)`${s}.call(${c}, ${m})`:(0,me._)`${s}(${m})`}ae.callValidateCode=jS;var ES=(0,me._)`new RegExp`;function OS({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,me._)`${o.code==="new RegExp"?ES:(0,wS.useFunc)(e,o)}(${r}, ${n})`})}ae.usePattern=OS;function NS(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,me._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:Kd.Type.Num},i),t.if((0,me.not)(i),s)})}}ae.validateArray=NS;function DS(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,Kd.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,me._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,me.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ae.validateUnion=DS});var dv=w(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.validateKeywordUsage=kt.validSchemaType=kt.funcKeywordCode=kt.macroKeywordCode=void 0;var Ce=B(),xr=Mt(),ZS=it(),RS=Mo();function US(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=lv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Ce.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}kt.macroKeywordCode=US;function AS(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;MS(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=lv(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)v(),t.modifying&&uv(e),$(()=>e.error());else{let k=t.async?p():h();t.modifying&&uv(e),$(()=>CS(e,k))}}function p(){let k=n.let("ruleErrs",null);return n.try(()=>v((0,Ce._)`await `),O=>n.assign(d,!1).if((0,Ce._)`${O} instanceof ${c.ValidationError}`,()=>n.assign(k,(0,Ce._)`${O}.errors`),()=>n.throw(O))),k}function h(){let k=(0,Ce._)`${l}.errors`;return n.assign(k,null),v(Ce.nil),k}function v(k=t.async?(0,Ce._)`await `:Ce.nil){let O=c.opts.passContext?xr.default.this:xr.default.self,P=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Ce._)`${k}${(0,ZS.callValidateCode)(e,l,O,P)}`,t.modifying)}function $(k){var O;n.if((0,Ce.not)((O=t.valid)!==null&&O!==void 0?O:d),k)}}kt.funcKeywordCode=AS;function uv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Ce._)`${n.parentData}[${n.parentDataProperty}]`))}function CS(e,t){let{gen:r}=e;r.if((0,Ce._)`Array.isArray(${t})`,()=>{r.assign(xr.default.vErrors,(0,Ce._)`${xr.default.vErrors} === null ? ${t} : ${xr.default.vErrors}.concat(${t})`).assign(xr.default.errors,(0,Ce._)`${xr.default.vErrors}.length`),(0,RS.extendErrors)(e)},()=>e.error())}function MS({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function lv(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,Ce.stringify)(r)})}function qS(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")}kt.validSchemaType=qS;function LS({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}kt.validateKeywordUsage=LS});var fv=w(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.extendSubschemaMode=rr.extendSubschemaData=rr.getSubschema=void 0;var wt=B(),pv=ee();function FS(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,wt._)`${e.schemaPath}${(0,wt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,wt._)`${e.schemaPath}${(0,wt.getProperty)(t)}${(0,wt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,pv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}rr.getSubschema=FS;function VS(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,m=s.let("data",(0,wt._)`${t.data}${(0,wt.getProperty)(r)}`,!0);c(m),e.errorPath=(0,wt.str)`${u}${(0,pv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,wt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof wt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);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]}}rr.extendSubschemaData=VS;function JS(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}rr.extendSubschemaMode=JS});var Gd=w((u6,mv)=>{"use strict";mv.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,i;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(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var gv=w((l6,hv)=>{"use strict";var nr=hv.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(){};Ca(t,n,o,e,"",e)};nr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};nr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};nr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};nr.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 Ca(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in nr.arrayKeywords)for(var m=0;m<d.length;m++)Ca(e,t,r,d[m],o+"/"+l+"/"+m,i,o,l,n,m)}else if(l in nr.propsKeywords){if(d&&typeof d=="object")for(var p in d)Ca(e,t,r,d[p],o+"/"+l+"/"+KS(p),i,o,l,n,p)}else(l in nr.keywords||e.allKeys&&!(l in nr.skipKeywords))&&Ca(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function KS(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Lo=w(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.getSchemaRefs=Fe.resolveUrl=Fe.normalizeId=Fe._getFullPath=Fe.getFullPath=Fe.inlineRef=void 0;var BS=ee(),HS=Gd(),GS=gv(),WS=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function XS(e,t=!0){return typeof e=="boolean"?!0:t===!0?!Wd(e):t?vv(e)<=t:!1}Fe.inlineRef=XS;var YS=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Wd(e){for(let t in e){if(YS.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Wd)||typeof r=="object"&&Wd(r))return!0}return!1}function vv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!WS.has(r)&&(typeof e[r]=="object"&&(0,BS.eachItem)(e[r],n=>t+=vv(n)),t===1/0))return 1/0}return t}function yv(e,t="",r){r!==!1&&(t=un(t));let n=e.parse(t);return _v(e,n)}Fe.getFullPath=yv;function _v(e,t){return e.serialize(t).split("#")[0]+"#"}Fe._getFullPath=_v;var QS=/#\/?$/;function un(e){return e?e.replace(QS,""):""}Fe.normalizeId=un;function e0(e,t,r){return r=un(r),e.resolve(t,r)}Fe.resolveUrl=e0;var t0=/^[a-z_][-a-z0-9._]*$/i;function r0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=un(e[r]||t),i={"":o},a=yv(n,o,!1),s={},c=new Set;return GS(e,{allKeys:!0},(d,m,p,h)=>{if(h===void 0)return;let v=a+m,$=i[h];typeof d[r]=="string"&&($=k.call(this,d[r])),O.call(this,d.$anchor),O.call(this,d.$dynamicAnchor),i[m]=$;function k(P){let C=this.opts.uriResolver.resolve;if(P=un($?C($,P):P),c.has(P))throw l(P);c.add(P);let E=this.refs[P];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?u(d,E.schema,P):P!==un(v)&&(P[0]==="#"?(u(d,s[P],P),s[P]=d):this.refs[P]=v),P}function O(P){if(typeof P=="string"){if(!t0.test(P))throw new Error(`invalid anchor "${P}"`);k.call(this,`#${P}`)}}}),s;function u(d,m,p){if(m!==void 0&&!HS(d,m))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Fe.getSchemaRefs=r0});var Jo=w(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.getData=or.KeywordCxt=or.validateFunctionCode=void 0;var wv=Qg(),$v=qo(),Yd=Ld(),Ma=qo(),n0=av(),Vo=dv(),Xd=fv(),j=B(),q=Mt(),o0=Lo(),qt=ee(),Fo=Mo();function i0(e){if(Iv(e)&&(Pv(e),zv(e))){c0(e);return}Sv(e,()=>(0,wv.topBoolOrEmptySchema)(e))}or.validateFunctionCode=i0;function Sv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,j._)`${q.default.data}, ${q.default.valCxt}`,n.$async,()=>{e.code((0,j._)`"use strict"; ${bv(r,o)}`),s0(e,o),e.code(i)}):e.func(t,(0,j._)`${q.default.data}, ${a0(o)}`,n.$async,()=>e.code(bv(r,o)).code(i))}function a0(e){return(0,j._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${e.dynamicRef?(0,j._)`, ${q.default.dynamicAnchors}={}`:j.nil}}={}`}function s0(e,t){e.if(q.default.valCxt,()=>{e.var(q.default.instancePath,(0,j._)`${q.default.valCxt}.${q.default.instancePath}`),e.var(q.default.parentData,(0,j._)`${q.default.valCxt}.${q.default.parentData}`),e.var(q.default.parentDataProperty,(0,j._)`${q.default.valCxt}.${q.default.parentDataProperty}`),e.var(q.default.rootData,(0,j._)`${q.default.valCxt}.${q.default.rootData}`),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,j._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{e.var(q.default.instancePath,(0,j._)`""`),e.var(q.default.parentData,(0,j._)`undefined`),e.var(q.default.parentDataProperty,(0,j._)`undefined`),e.var(q.default.rootData,q.default.data),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,j._)`{}`)})}function c0(e){let{schema:t,opts:r,gen:n}=e;Sv(e,()=>{r.$comment&&t.$comment&&jv(e),f0(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&u0(e),Tv(e),g0(e)})}function u0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,j._)`${r}.evaluated`),t.if((0,j._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,j._)`${e.evaluated}.props`,(0,j._)`undefined`)),t.if((0,j._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,j._)`${e.evaluated}.items`,(0,j._)`undefined`))}function bv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,j._)`/*# sourceURL=${r} */`:j.nil}function l0(e,t){if(Iv(e)&&(Pv(e),zv(e))){d0(e,t);return}(0,wv.boolOrEmptySchema)(e,t)}function zv({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 Iv(e){return typeof e.schema!="boolean"}function d0(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&jv(e),m0(e),h0(e);let i=n.const("_errs",q.default.errors);Tv(e,i),n.var(t,(0,j._)`${i} === ${q.default.errors}`)}function Pv(e){(0,qt.checkUnknownRules)(e),p0(e)}function Tv(e,t){if(e.opts.jtd)return xv(e,[],!1,t);let r=(0,$v.getSchemaTypes)(e.schema),n=(0,$v.coerceAndCheckDataType)(e,r);xv(e,r,!n,t)}function p0(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,qt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function f0(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,qt.checkStrictMode)(e,"default is ignored in the schema root")}function m0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,o0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function h0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function jv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,j._)`${q.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,j.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,j._)`${q.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function g0(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,j._)`${q.default.errors} === 0`,()=>t.return(q.default.data),()=>t.throw((0,j._)`new ${o}(${q.default.vErrors})`)):(t.assign((0,j._)`${n}.errors`,q.default.vErrors),i.unevaluated&&v0(e),t.return((0,j._)`${q.default.errors} === 0`))}function v0({gen:e,evaluated:t,props:r,items:n}){r instanceof j.Name&&e.assign((0,j._)`${t}.props`,r),n instanceof j.Name&&e.assign((0,j._)`${t}.items`,n)}function xv(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,qt.schemaHasRulesButRef)(i,l))){o.block(()=>Ov(e,"$ref",l.all.$ref.definition));return}c.jtd||y0(e,t),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,Yd.shouldUseGroup)(i,m)&&(m.type?(o.if((0,Ma.checkDataType)(m.type,a,c.strictNumbers)),kv(e,m),t.length===1&&t[0]===m.type&&r&&(o.else(),(0,Ma.reportTypeError)(e)),o.endIf()):kv(e,m),s||o.if((0,j._)`${q.default.errors} === ${n||0}`))}}function kv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,n0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,Yd.shouldUseRule)(n,i)&&Ov(e,i.keyword,i.definition,t.type)})}function y0(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(_0(e,t),e.opts.allowUnionTypes||$0(e,t),b0(e,e.dataTypes))}function _0(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Ev(e.dataTypes,r)||Qd(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),k0(e,t)}}function $0(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&Qd(e,"use allowUnionTypes to allow union type keyword")}function b0(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Yd.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>x0(t,a))&&Qd(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function x0(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Ev(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function k0(e,t){let r=[];for(let n of e.dataTypes)Ev(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function Qd(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,qt.checkStrictMode)(e,t,e.opts.strictTypes)}var qa=class{constructor(t,r,n){if((0,Vo.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,qt.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",Nv(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Vo.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",q.default.errors))}result(t,r,n){this.failResult((0,j.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,j.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,j._)`${r} !== undefined && (${(0,j.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?Fo.reportExtraError:Fo.reportError)(this,this.def.error,r)}$dataError(){(0,Fo.reportError)(this,this.def.$dataError||Fo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Fo.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=j.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=j.nil,r=j.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,j.or)((0,j._)`${o} === undefined`,r)),t!==j.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==j.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,j.or)(a(),s());function a(){if(n.length){if(!(r instanceof j.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,j._)`${(0,Ma.checkDataTypes)(c,r,i.opts.strictNumbers,Ma.DataType.Wrong)}`}return j.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,j._)`!${c}(${r})`}return j.nil}}subschema(t,r){let n=(0,Xd.getSubschema)(this.it,t);(0,Xd.extendSubschemaData)(n,this.it,t),(0,Xd.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return l0(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=qt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=qt.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,j.Name)),!0}};or.KeywordCxt=qa;function Ov(e,t,r,n){let o=new qa(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Vo.funcKeywordCode)(o,r):"macro"in r?(0,Vo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Vo.funcKeywordCode)(o,r)}var w0=/^\/(?:[^~]|~0|~1)*$/,S0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Nv(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!w0.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=q.default.rootData}else{let u=S0.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(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,j._)`${i}${(0,j.getProperty)((0,qt.unescapeJsonPointer)(u))}`,a=(0,j._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}or.getData=Nv});var La=w(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});var ep=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};tp.default=ep});var Ko=w(op=>{"use strict";Object.defineProperty(op,"__esModule",{value:!0});var rp=Lo(),np=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,rp.resolveUrl)(t,r,n),this.missingSchema=(0,rp.normalizeId)((0,rp.getFullPath)(t,this.missingRef))}};op.default=np});var Va=w(at=>{"use strict";Object.defineProperty(at,"__esModule",{value:!0});at.resolveSchema=at.getCompilingSchema=at.resolveRef=at.compileSchema=at.SchemaEnv=void 0;var ht=B(),z0=La(),kr=Mt(),gt=Lo(),Dv=ee(),I0=Jo(),ln=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,gt.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};at.SchemaEnv=ln;function ap(e){let t=Zv.call(this,e);if(t)return t;let r=(0,gt.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new ht.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:z0.default,code:(0,ht._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:kr.default.data,parentData:kr.default.parentData,parentDataProperty:kr.default.parentDataProperty,dataNames:[kr.default.data],dataPathArr:[ht.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,ht.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ht.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ht._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,I0.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(kr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${kr.default.self}`,`${kr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:h,items:v}=u;p.evaluated={props:h instanceof ht.Name?void 0:h,items:v instanceof ht.Name?void 0:v,dynamicProps:h instanceof ht.Name,dynamicItems:v instanceof ht.Name},p.source&&(p.source.evaluated=(0,ht.stringify)(p.evaluated))}return e.validate=p,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)}}at.compileSchema=ap;function P0(e,t,r){var n;r=(0,gt.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=E0.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new ln({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=T0.call(this,i)}at.resolveRef=P0;function T0(e){return(0,gt.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:ap.call(this,e)}function Zv(e){for(let t of this._compilations)if(j0(t,e))return t}at.getCompilingSchema=Zv;function j0(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function E0(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Fa.call(this,e,t)}function Fa(e,t){let r=this.opts.uriResolver.parse(t),n=(0,gt._getFullPath)(this.opts.uriResolver,r),o=(0,gt.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return ip.call(this,r,e);let i=(0,gt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Fa.call(this,e,a);return typeof s?.schema!="object"?void 0:ip.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||ap.call(this,a),i===(0,gt.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,gt.resolveUrl)(this.opts.uriResolver,o,u)),new ln({schema:s,schemaId:c,root:e,baseId:o})}return ip.call(this,r,a)}}at.resolveSchema=Fa;var O0=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ip(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Dv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!O0.has(s)&&u&&(t=(0,gt.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Dv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,gt.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Fa.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new ln({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var Rv=w((g6,N0)=>{N0.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 lp=w((v6,qv)=>{"use strict";var D0=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Av=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),Ja=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),sp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Z0=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu),R0=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/?]$/iu);function cp(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 U0=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Uv(e){return e.length=0,!0}function A0(e,t,r){if(e.length){let n=cp(e);if(n!=="")t.push(n);else return r.error=!0,!1;e.length=0}return!0}function C0(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=A0;for(let c=0;c<e.length;c++){let u=e[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++t>7){r.error=!0;break}c>0&&e[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=Uv}else{o.push(u);continue}}return o.length&&(s===Uv?r.zone=o.join(""):a?n.push(o.join("")):n.push(cp(o))),r.address=n.join(""),r}function Cv(e){if(M0(e,":")<2)return{host:e,isIPV6:!1};let t=C0(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 M0(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function q0(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]==="."){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 L0={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},F0=/[@/?#:]/g,V0=/[@/?#]/g;function Mv(e,t){let r=t?V0:F0;return r.lastIndex=0,e.replace(r,n=>L0[n])}function J0(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(Ja(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));t&&sp(a)?r+=a:r+="%"+i,n+=2;continue}}r+=e[n]}return r}var Xe=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Xe[t]="%"+e[t>>4]+e[t&15]}function up(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function st(e){return e<2048?Xe[192|e>>6]+Xe[128|e&63]:e<65536?Xe[224|e>>12]+Xe[128|e>>6&63]+Xe[128|e&63]:Xe[240|e>>18]+Xe[128|e>>12&63]+Xe[128|e>>6&63]+Xe[128|e&63]}function K0(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Ja(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&sp(a)?t+=a:t+="%"+i,r+=2;continue}}if(Z0(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=up(o)?n:Xe[o];else if(o<55296||o>57343)t+=st(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=st(65536+(o-55296<<10)+(i-56320)),r++):t+=st(65533)}else t+=st(65533)}}return t}function B0(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Ja(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));sp(a)?t+=a:t+="%"+i,r+=2;continue}}if(R0(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=up(o)?n:Xe[o];else if(o<55296||o>57343)t+=st(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=st(65536+(o-55296<<10)+(i-56320)),r++):t+=st(65533)}else t+=st(65533)}}return t}function H0(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Ja(i)){t+="%"+i.toUpperCase(),r+=2;continue}}let o=e.charCodeAt(r);if(o<128)t+=up(o)?n:Xe[o];else if(o<55296||o>57343)t+=st(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=st(65536+(o-55296<<10)+(i-56320)),r++):t+=st(65533)}else t+=st(65533)}return t}function G0(e){let t=[];if(e.userinfo!==void 0&&(t.push(e.userinfo),t.push("@")),e.host!==void 0){let r=unescape(e.host);if(!Av(r)){let n=Cv(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=Mv(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}qv.exports={nonSimpleDomain:U0,recomposeAuthority:G0,reescapeHostDelimiters:Mv,normalizePercentEncoding:J0,normalizePathEncoding:K0,normalizeQueryFragmentEncoding:B0,escapePreservingEscapes:H0,removeDotSegments:q0,isIPv4:Av,isUUID:D0,normalizeIPv6:Cv,stringArrayToHexStripped:cp}});var Kv=w((y6,Jv)=>{"use strict";var{isUUID:W0}=lp(),X0=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Y0=["http","https","ws","wss","urn","urn:uuid"];function Q0(e){return Y0.indexOf(e)!==-1}function dp(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 Lv(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function Fv(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 ez(e){return e.secure=dp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function tz(e){if((e.port===(dp(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 rz(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(X0);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}`,i=pp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function nz(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}`,i=pp(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function oz(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!W0(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function iz(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Vv={scheme:"http",domainHost:!0,parse:Lv,serialize:Fv},az={scheme:"https",domainHost:Vv.domainHost,parse:Lv,serialize:Fv},Ka={scheme:"ws",domainHost:!0,parse:ez,serialize:tz},sz={scheme:"wss",domainHost:Ka.domainHost,parse:Ka.parse,serialize:Ka.serialize},cz={scheme:"urn",parse:rz,serialize:nz,skipNormalize:!0},uz={scheme:"urn:uuid",parse:oz,serialize:iz,skipNormalize:!0},Ba={http:Vv,https:az,ws:Ka,wss:sz,urn:cz,"urn:uuid":uz};Object.setPrototypeOf(Ba,null);function pp(e){return e&&(Ba[e]||Ba[e.toLowerCase()])||void 0}Jv.exports={wsIsSecure:dp,SCHEMES:Ba,isValidSchemeName:Q0,getSchemeHandler:pp}});var Yv=w((_6,Wa)=>{"use strict";var{normalizeIPv6:lz,removeDotSegments:Bo,recomposeAuthority:dz,normalizePercentEncoding:pz,normalizePathEncoding:fz,normalizeQueryFragmentEncoding:Bv,escapePreservingEscapes:mz,reescapeHostDelimiters:hz,isIPv4:gz,nonSimpleDomain:vz}=lp(),{SCHEMES:yz,getSchemeHandler:Gv}=Kv();function _z(e,t){return typeof e=="string"?e=zz(e,t):typeof e=="object"&&(e=Ga(wr(e,t),t)),e}function $z(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:i}=Ha(e,n),{parsed:a,malformedAuthorityOrPort:s}=Ha(t,n);if(i||s)throw new Error(o.error||a.error||"URI is malformed.");let c=Wv(o,a,n,!0);return n.skipEscape=!0,wr(c,n)}function Wv(e,t,r,n){let o={};return n||(e=Ga(wr(e,r),r),t=Ga(wr(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=Bo(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=Bo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Bo(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=Bo(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 bz(e,t,r){let n=Hv(e,r),o=Hv(t,r);return n!==void 0&&o!==void 0&&n.toLowerCase()===o.toLowerCase()}function wr(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=[],i=Gv(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=pz(r.path):(r.path=mz(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=dz(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=Bo(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var xz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,kz=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,wz=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Sz(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 Ha(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,i=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let a=e.match(kz);a!==null&&a[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let s=e.match(wz);if(s!==null){let u=s[1],l=u.replace(/[\t\n\r]/g,"");l.length>=2&&(l.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):u.length!==l.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let c=e.match(xz);if(c){n.scheme=c[1]===void 0?void 0:c[1].toLowerCase(),n.userinfo=c[3],n.host=c[4],n.port=parseInt(c[5],10),n.path=c[6]||"",n.query=c[7],n.fragment=c[8],isNaN(n.port)&&(n.port=c[5]);let u=Sz(n,c);if(u!==void 0&&(n.error=n.error||u,o=!0),n.host)if(gz(n.host)===!1){let m=lz(n.host);n.host=m.host.toLowerCase(),i=m.isIPV6}else i=!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 l=Gv(r.scheme||n.scheme);if(!r.unicodeSupport&&(!l||!l.unicodeSupport)&&n.host&&(r.domainHost||l&&l.domainHost)&&i===!1&&vz(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(d){n.error=n.error||"Host's domain name can not be converted to ASCII: "+d}(!l||l&&!l.skipNormalize)&&(e.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=hz(unescape(n.host),i))),n.path&&(n.path=fz(n.path)),n.query&&(n.query=Bv(n.query)),n.fragment&&(n.fragment=Bv(n.fragment))),l&&l.parse&&l.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o}}function Ga(e,t){return Ha(e,t).parsed}function zz(e,t){return Xv(e,t).normalized}function Xv(e,t){let{parsed:r,malformedAuthorityOrPort:n}=Ha(e,t);return{normalized:n?e:wr(r,t),malformedAuthorityOrPort:n}}function Hv(e,t){if(typeof e=="string"){let{normalized:r,malformedAuthorityOrPort:n}=Xv(e,t);return n?void 0:r}if(typeof e=="object")return wr(e,t)}var fp={SCHEMES:yz,normalize:_z,resolve:$z,resolveComponent:Wv,equal:bz,serialize:wr,parse:Ga};Wa.exports=fp;Wa.exports.default=fp;Wa.exports.fastUri=fp});var ey=w(mp=>{"use strict";Object.defineProperty(mp,"__esModule",{value:!0});var Qv=Yv();Qv.code='require("ajv/dist/runtime/uri").default';mp.default=Qv});var cy=w(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 Iz=Jo();Object.defineProperty(we,"KeywordCxt",{enumerable:!0,get:function(){return Iz.KeywordCxt}});var dn=B();Object.defineProperty(we,"_",{enumerable:!0,get:function(){return dn._}});Object.defineProperty(we,"str",{enumerable:!0,get:function(){return dn.str}});Object.defineProperty(we,"stringify",{enumerable:!0,get:function(){return dn.stringify}});Object.defineProperty(we,"nil",{enumerable:!0,get:function(){return dn.nil}});Object.defineProperty(we,"Name",{enumerable:!0,get:function(){return dn.Name}});Object.defineProperty(we,"CodeGen",{enumerable:!0,get:function(){return dn.CodeGen}});var Pz=La(),iy=Ko(),Tz=qd(),Ho=Va(),jz=B(),Go=Lo(),Xa=qo(),gp=ee(),ty=Rv(),Ez=ey(),ay=(e,t)=>new RegExp(e,t);ay.code="new RegExp";var Oz=["removeAdditional","useDefaults","coerceTypes"],Nz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Dz={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."},Zz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},ry=200;function Rz(e){var t,r,n,o,i,a,s,c,u,l,d,m,p,h,v,$,k,O,P,C,E,ut,lt,_s,$s;let bn=e.strict,bs=(t=e.code)===null||t===void 0?void 0:t.optimize,vf=bs===!0||bs===void 0?1:bs||0,yf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:ay,N_=(o=e.uriResolver)!==null&&o!==void 0?o:Ez.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:bn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:bn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:bn)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:bn)!==null&&m!==void 0?m:"log",strictRequired:(h=(p=e.strictRequired)!==null&&p!==void 0?p:bn)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:vf,regExp:yf}:{optimize:vf,regExp:yf},loopRequired:(v=e.loopRequired)!==null&&v!==void 0?v:ry,loopEnum:($=e.loopEnum)!==null&&$!==void 0?$:ry,meta:(k=e.meta)!==null&&k!==void 0?k:!0,messages:(O=e.messages)!==null&&O!==void 0?O:!0,inlineRefs:(P=e.inlineRefs)!==null&&P!==void 0?P:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(ut=e.validateSchema)!==null&&ut!==void 0?ut:!0,validateFormats:(lt=e.validateFormats)!==null&<!==void 0?lt:!0,unicodeRegExp:(_s=e.unicodeRegExp)!==null&&_s!==void 0?_s:!0,int32range:($s=e.int32range)!==null&&$s!==void 0?$s:!0,uriResolver:N_}}var Wo=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...Rz(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new jz.ValueScope({scope:{},prefixes:Nz,es5:r,lines:n}),this.logger=Lz(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,Tz.getRules)(),ny.call(this,Dz,t,"NOT SUPPORTED"),ny.call(this,Zz,t,"DEPRECATED","warn"),this._metaOpts=Mz.call(this),t.formats&&Az.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&Cz.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),Uz.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=ty;n==="id"&&(o={...ty},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 i.call(this,l.$schema);let m=this._addSchema(l,d);return m.validate||a.call(this,m)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof iy.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({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 i.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 a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,Go.normalizeId)(r||i),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 i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=oy.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Ho.SchemaEnv({schema:{},schemaId:n});if(r=Ho.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=oy.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,Go.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(Vz.call(this,n,r),!r)return(0,gp.eachItem)(n,i=>hp.call(this,i)),this;Kz.call(this,r);let o={...r,type:(0,Xa.getJSONTypes)(r.type),schemaType:(0,Xa.getJSONTypes)(r.schemaType)};return(0,gp.eachItem)(n,o.type.length===0?i=>hp.call(this,i,o):i=>o.type.forEach(a=>hp.call(this,i,o,a))),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(i=>i.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,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=sy(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,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];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,Go.normalizeId)(a||n);let u=Go.getSchemaRefs.call(this,t,n);return c=new Ho.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!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):Ho.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{Ho.compileSchema.call(this,t)}finally{this.opts=r}}};Wo.ValidationError=Pz.default;Wo.MissingRefError=iy.default;we.default=Wo;function ny(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function oy(e){return e=(0,Go.normalizeId)(e),this.schemas[e]||this.refs[e]}function Uz(){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 Az(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function Cz(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 Mz(){let e={...this.opts};for(let t of Oz)delete e[t];return e}var qz={log(){},warn(){},error(){}};function Lz(e){if(e===!1)return qz;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 Fz=/^[a-z_$][a-z0-9_$:-]*$/i;function Vz(e,t){let{RULES:r}=this;if((0,gp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Fz.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 hp(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,Xa.getJSONTypes)(t.type),schemaType:(0,Xa.getJSONTypes)(t.schemaType)}};t.before?Jz.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Jz(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 Kz(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=sy(t)),e.validateSchema=this.compile(t,!0))}var Bz={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function sy(e){return{anyOf:[e,Bz]}}});var uy=w(vp=>{"use strict";Object.defineProperty(vp,"__esModule",{value:!0});var Hz={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};vp.default=Hz});var fy=w(Sr=>{"use strict";Object.defineProperty(Sr,"__esModule",{value:!0});Sr.callRef=Sr.getValidate=void 0;var Gz=Ko(),ly=it(),Ve=B(),pn=Mt(),dy=Va(),Ya=ee(),Wz={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=dy.resolveRef.call(c,u,o,r);if(l===void 0)throw new Gz.default(n.opts.uriResolver,o,r);if(l instanceof dy.SchemaEnv)return m(l);return p(l);function d(){if(i===u)return Qa(e,a,i,i.$async);let h=t.scopeValue("root",{ref:u});return Qa(e,(0,Ve._)`${h}.validate`,u,u.$async)}function m(h){let v=py(e,h);Qa(e,v,h,h.$async)}function p(h){let v=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Ve.stringify)(h)}:{ref:h}),$=t.name("valid"),k=e.subschema({schema:h,dataTypes:[],schemaPath:Ve.nil,topSchemaRef:v,errSchemaPath:r},$);e.mergeEvaluated(k),e.ok($)}}};function py(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ve._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Sr.getValidate=py;function Qa(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?pn.default.this:Ve.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Ve._)`await ${(0,ly.callValidateCode)(e,t,u)}`),p(t),a||o.assign(h,!0)},v=>{o.if((0,Ve._)`!(${v} instanceof ${i.ValidationError})`,()=>o.throw(v)),m(v),a||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,ly.callValidateCode)(e,t,u),()=>p(t),()=>m(t))}function m(h){let v=(0,Ve._)`${h}.errors`;o.assign(pn.default.vErrors,(0,Ve._)`${pn.default.vErrors} === null ? ${v} : ${pn.default.vErrors}.concat(${v})`),o.assign(pn.default.errors,(0,Ve._)`${pn.default.vErrors}.length`)}function p(h){var v;if(!i.opts.unevaluated)return;let $=(v=r?.validate)===null||v===void 0?void 0:v.evaluated;if(i.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(i.props=Ya.mergeEvaluated.props(o,$.props,i.props));else{let k=o.var("props",(0,Ve._)`${h}.evaluated.props`);i.props=Ya.mergeEvaluated.props(o,k,i.props,Ve.Name)}if(i.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(i.items=Ya.mergeEvaluated.items(o,$.items,i.items));else{let k=o.var("items",(0,Ve._)`${h}.evaluated.items`);i.items=Ya.mergeEvaluated.items(o,k,i.items,Ve.Name)}}}Sr.callRef=Qa;Sr.default=Wz});var my=w(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var Xz=uy(),Yz=fy(),Qz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Xz.default,Yz.default];yp.default=Qz});var hy=w(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var es=B(),ir=es.operators,ts={maximum:{okStr:"<=",ok:ir.LTE,fail:ir.GT},minimum:{okStr:">=",ok:ir.GTE,fail:ir.LT},exclusiveMaximum:{okStr:"<",ok:ir.LT,fail:ir.GTE},exclusiveMinimum:{okStr:">",ok:ir.GT,fail:ir.LTE}},eI={message:({keyword:e,schemaCode:t})=>(0,es.str)`must be ${ts[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,es._)`{comparison: ${ts[e].okStr}, limit: ${t}}`},tI={keyword:Object.keys(ts),type:"number",schemaType:"number",$data:!0,error:eI,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,es._)`${r} ${ts[t].fail} ${n} || isNaN(${r})`)}};_p.default=tI});var gy=w($p=>{"use strict";Object.defineProperty($p,"__esModule",{value:!0});var Xo=B(),rI={message:({schemaCode:e})=>(0,Xo.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,Xo._)`{multipleOf: ${e}}`},nI={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:rI,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,Xo._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,Xo._)`${a} !== parseInt(${a})`;e.fail$data((0,Xo._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};$p.default=nI});var yy=w(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});function vy(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}bp.default=vy;vy.code='require("ajv/dist/runtime/ucs2length").default'});var _y=w(xp=>{"use strict";Object.defineProperty(xp,"__esModule",{value:!0});var zr=B(),oI=ee(),iI=yy(),aI={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,zr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,zr._)`{limit: ${e}}`},sI={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:aI,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?zr.operators.GT:zr.operators.LT,a=o.opts.unicode===!1?(0,zr._)`${r}.length`:(0,zr._)`${(0,oI.useFunc)(e.gen,iI.default)}(${r})`;e.fail$data((0,zr._)`${a} ${i} ${n}`)}};xp.default=sI});var $y=w(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var cI=it(),uI=ee(),fn=B(),lI={message:({schemaCode:e})=>(0,fn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,fn._)`{pattern: ${e}}`},dI={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:lI,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,fn._)`new RegExp`:(0,uI.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,fn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,fn._)`!${l}`)}else{let c=(0,cI.usePattern)(e,o);e.fail$data((0,fn._)`!${c}.test(${r})`)}}};kp.default=dI});var by=w(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});var Yo=B(),pI={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,Yo.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,Yo._)`{limit: ${e}}`},fI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:pI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?Yo.operators.GT:Yo.operators.LT;e.fail$data((0,Yo._)`Object.keys(${r}).length ${o} ${n}`)}};wp.default=fI});var xy=w(Sp=>{"use strict";Object.defineProperty(Sp,"__esModule",{value:!0});var Qo=it(),ei=B(),mI=ee(),hI={message:({params:{missingProperty:e}})=>(0,ei.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,ei._)`{missingProperty: ${e}}`},gI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:hI,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let p=e.parentSchema.properties,{definedProperties:h}=e.it;for(let v of r)if(p?.[v]===void 0&&!h.has(v)){let $=a.schemaEnv.baseId+a.errSchemaPath,k=`required property "${v}" is not defined at "${$}" (strictRequired)`;(0,mI.checkStrictMode)(a,k,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(ei.nil,d);else for(let p of r)(0,Qo.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||i){let h=t.let("valid",!0);e.block$data(h,()=>m(p,h)),e.ok(h)}else t.if((0,Qo.checkMissingProp)(e,r,p)),(0,Qo.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,Qo.noPropertyInData)(t,o,p,s.ownProperties),()=>e.error())})}function m(p,h){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(h,(0,Qo.propertyInData)(t,o,p,s.ownProperties)),t.if((0,ei.not)(h),()=>{e.error(),t.break()})},ei.nil)}}};Sp.default=gI});var ky=w(zp=>{"use strict";Object.defineProperty(zp,"__esModule",{value:!0});var ti=B(),vI={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,ti.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,ti._)`{limit: ${e}}`},yI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:vI,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?ti.operators.GT:ti.operators.LT;e.fail$data((0,ti._)`${r}.length ${o} ${n}`)}};zp.default=yI});var rs=w(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});var wy=Gd();wy.code='require("ajv/dist/runtime/equal").default';Ip.default=wy});var Sy=w(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var Pp=qo(),Se=B(),_I=ee(),$I=rs(),bI={message:({params:{i:e,j:t}})=>(0,Se.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Se._)`{i: ${e}, j: ${t}}`},xI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:bI,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,Pp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Se._)`${a} === false`),e.ok(c);function l(){let h=t.let("i",(0,Se._)`${r}.length`),v=t.let("j");e.setParams({i:h,j:v}),t.assign(c,!0),t.if((0,Se._)`${h} > 1`,()=>(d()?m:p)(h,v))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function m(h,v){let $=t.name("item"),k=(0,Pp.checkDataTypes)(u,$,s.opts.strictNumbers,Pp.DataType.Wrong),O=t.const("indices",(0,Se._)`{}`);t.for((0,Se._)`;${h}--;`,()=>{t.let($,(0,Se._)`${r}[${h}]`),t.if(k,(0,Se._)`continue`),u.length>1&&t.if((0,Se._)`typeof ${$} == "string"`,(0,Se._)`${$} += "_"`),t.if((0,Se._)`typeof ${O}[${$}] == "number"`,()=>{t.assign(v,(0,Se._)`${O}[${$}]`),e.error(),t.assign(c,!1).break()}).code((0,Se._)`${O}[${$}] = ${h}`)})}function p(h,v){let $=(0,_I.useFunc)(t,$I.default),k=t.name("outer");t.label(k).for((0,Se._)`;${h}--;`,()=>t.for((0,Se._)`${v} = ${h}; ${v}--;`,()=>t.if((0,Se._)`${$}(${r}[${h}], ${r}[${v}])`,()=>{e.error(),t.assign(c,!1).break(k)})))}}};Tp.default=xI});var zy=w(Ep=>{"use strict";Object.defineProperty(Ep,"__esModule",{value:!0});var jp=B(),kI=ee(),wI=rs(),SI={message:"must be equal to constant",params:({schemaCode:e})=>(0,jp._)`{allowedValue: ${e}}`},zI={keyword:"const",$data:!0,error:SI,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,jp._)`!${(0,kI.useFunc)(t,wI.default)}(${r}, ${o})`):e.fail((0,jp._)`${i} !== ${r}`)}};Ep.default=zI});var Iy=w(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});var ri=B(),II=ee(),PI=rs(),TI={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,ri._)`{allowedValues: ${e}}`},jI={keyword:"enum",schemaType:"array",$data:!0,error:TI,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,II.useFunc)(t,PI.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=t.const("vSchema",i);l=(0,ri.or)(...o.map((h,v)=>m(p,v)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,p=>t.if((0,ri._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function m(p,h){let v=o[h];return typeof v=="object"&&v!==null?(0,ri._)`${u()}(${r}, ${p}[${h}])`:(0,ri._)`${r} === ${v}`}}};Op.default=jI});var Py=w(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var EI=hy(),OI=gy(),NI=_y(),DI=$y(),ZI=by(),RI=xy(),UI=ky(),AI=Sy(),CI=zy(),MI=Iy(),qI=[EI.default,OI.default,NI.default,DI.default,ZI.default,RI.default,UI.default,AI.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},CI.default,MI.default];Np.default=qI});var Zp=w(ni=>{"use strict";Object.defineProperty(ni,"__esModule",{value:!0});ni.validateAdditionalItems=void 0;var Ir=B(),Dp=ee(),LI={message:({params:{len:e}})=>(0,Ir.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Ir._)`{limit: ${e}}`},FI={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:LI,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Dp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Ty(e,n)}};function Ty(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Ir._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Ir._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Dp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Ir._)`${s} <= ${t.length}`);r.if((0,Ir.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Dp.Type.Num},u),a.allErrors||r.if((0,Ir.not)(u),()=>r.break())})}}ni.validateAdditionalItems=Ty;ni.default=FI});var Rp=w(oi=>{"use strict";Object.defineProperty(oi,"__esModule",{value:!0});oi.validateTuple=void 0;var jy=B(),ns=ee(),VI=it(),JI={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Ey(e,"additionalItems",t);r.items=!0,!(0,ns.alwaysValidSchema)(r,t)&&e.ok((0,VI.validateArray)(e))}};function Ey(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=ns.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,jy._)`${i}.length`);r.forEach((d,m)=>{(0,ns.alwaysValidSchema)(s,d)||(n.if((0,jy._)`${u} > ${m}`,()=>e.subschema({keyword:a,schemaProp:m,dataProp:m},c)),e.ok(c))});function l(d){let{opts:m,errSchemaPath:p}=s,h=r.length,v=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(m.strictTuples&&!v){let $=`"${a}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,ns.checkStrictMode)(s,$,m.strictTuples)}}}oi.validateTuple=Ey;oi.default=JI});var Oy=w(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var KI=Rp(),BI={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,KI.validateTuple)(e,"items")};Up.default=BI});var Dy=w(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var Ny=B(),HI=ee(),GI=it(),WI=Zp(),XI={message:({params:{len:e}})=>(0,Ny.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Ny._)`{limit: ${e}}`},YI={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:XI,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,HI.alwaysValidSchema)(n,t)&&(o?(0,WI.validateAdditionalItems)(e,o):e.ok((0,GI.validateArray)(e)))}};Ap.default=YI});var Zy=w(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var ct=B(),os=ee(),QI={message:({params:{min:e,max:t}})=>t===void 0?(0,ct.str)`must contain at least ${e} valid item(s)`:(0,ct.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,ct._)`{minContains: ${e}}`:(0,ct._)`{minContains: ${e}, maxContains: ${t}}`},eP={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:QI,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,ct._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,os.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,os.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,os.alwaysValidSchema)(i,r)){let v=(0,ct._)`${l} >= ${a}`;s!==void 0&&(v=(0,ct._)`${v} && ${l} <= ${s}`),e.pass(v);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?p(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,ct._)`${o}.length > 0`,m)):(t.let(d,!1),m()),e.result(d,()=>e.reset());function m(){let v=t.name("_valid"),$=t.let("count",0);p(v,()=>t.if(v,()=>h($)))}function p(v,$){t.forRange("i",0,l,k=>{e.subschema({keyword:"contains",dataProp:k,dataPropType:os.Type.Num,compositeRule:!0},v),$()})}function h(v){t.code((0,ct._)`${v}++`),s===void 0?t.if((0,ct._)`${v} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,ct._)`${v} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,ct._)`${v} >= ${a}`,()=>t.assign(d,!0)))}}};Cp.default=eP});var Ay=w(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateSchemaDeps=St.validatePropertyDeps=St.error=void 0;var Mp=B(),tP=ee(),ii=it();St.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,Mp.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,Mp._)`{property: ${e},
|
|
2
|
+
"use strict";var f$=Object.create;var Es=Object.defineProperty;var m$=Object.getOwnPropertyDescriptor;var h$=Object.getOwnPropertyNames;var g$=Object.getPrototypeOf,v$=Object.prototype.hasOwnProperty;var z=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},zn=(e,t)=>{for(var r in t)Es(e,r,{get:t[r],enumerable:!0})},y$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of h$(t))!v$.call(e,o)&&o!==r&&Es(e,o,{get:()=>t[o],enumerable:!(n=m$(t,o))||n.enumerable});return e};var ft=(e,t,r)=>(r=e!=null?f$(g$(e)):{},y$(t||!e||!e.__esModule?Es(r,"default",{value:e,enumerable:!0}):r,e));var Co=z(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.regexpCode=re.getEsmExportName=re.getProperty=re.safeStringify=re.stringify=re.strConcat=re.addCodeArg=re.str=re._=re.nil=re._Code=re.Name=re.IDENTIFIER=re._CodeOrName=void 0;var Zo=class{};re._CodeOrName=Zo;re.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var br=class extends Zo{constructor(t){if(super(),!re.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}}};re.Name=br;var st=class extends Zo{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 br&&(r[n.str]=(r[n.str]||0)+1),r),{})}};re._Code=st;re.nil=new st("");function tv(e,...t){let r=[e[0]],n=0;for(;n<t.length;)jd(r,t[n]),r.push(e[++n]);return new st(r)}re._=tv;var Td=new st("+");function rv(e,...t){let r=[Ao(e[0])],n=0;for(;n<t.length;)r.push(Td),jd(r,t[n]),r.push(Td,Ao(e[++n]));return tS(r),new st(r)}re.str=rv;function jd(e,t){t instanceof st?e.push(...t._items):t instanceof br?e.push(t):e.push(oS(t))}re.addCodeArg=jd;function tS(e){let t=1;for(;t<e.length-1;){if(e[t]===Td){let r=rS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function rS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof br||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 br))return`"${e}${t.slice(1)}`}function nS(e,t){return t.emptyStr()?e:e.emptyStr()?t:rv`${e}${t}`}re.strConcat=nS;function oS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Ao(Array.isArray(e)?e.join(","):e)}function iS(e){return new st(Ao(e))}re.stringify=iS;function Ao(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}re.safeStringify=Ao;function aS(e){return typeof e=="string"&&re.IDENTIFIER.test(e)?new st(`.${e}`):tv`[${e}]`}re.getProperty=aS;function sS(e){if(typeof e=="string"&&re.IDENTIFIER.test(e))return new st(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}re.getEsmExportName=sS;function cS(e){return new st(e.toString())}re.regexpCode=cS});var Dd=z(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.ValueScope=He.ValueScopeName=He.Scope=He.varKinds=He.UsedValueState=void 0;var Je=Co(),Ed=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ca;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ca||(He.UsedValueState=Ca={}));He.varKinds={const:new Je.Name("const"),let:new Je.Name("let"),var:new Je.Name("var")};var Ua=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Je.Name?t:this.name(t)}name(t){return new Je.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}}};He.Scope=Ua;var Ma=class extends Je.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Je._)`.${new Je.Name(r)}[${n}]`}};He.ValueScopeName=Ma;var uS=(0,Je._)`\n`,Od=class extends Ua{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?uS:Je.nil}}get(){return this._scope}name(t){return new Ma(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:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,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,Je._)`${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 i=Je.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,Ca.Started);let l=r(u);if(l){let d=this.opts.es5?He.varKinds.var:He.varKinds.const;i=(0,Je._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Je._)`${i}${l}${this.opts._n}`;else throw new Ed(u);c.set(u,Ca.Completed)})}return i}};He.ValueScope=Od});var K=z(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 Q=Co(),vt=Dd(),rr=Co();Object.defineProperty(G,"_",{enumerable:!0,get:function(){return rr._}});Object.defineProperty(G,"str",{enumerable:!0,get:function(){return rr.str}});Object.defineProperty(G,"strConcat",{enumerable:!0,get:function(){return rr.strConcat}});Object.defineProperty(G,"nil",{enumerable:!0,get:function(){return rr.nil}});Object.defineProperty(G,"getProperty",{enumerable:!0,get:function(){return rr.getProperty}});Object.defineProperty(G,"stringify",{enumerable:!0,get:function(){return rr.stringify}});Object.defineProperty(G,"regexpCode",{enumerable:!0,get:function(){return rr.regexpCode}});Object.defineProperty(G,"Name",{enumerable:!0,get:function(){return rr.Name}});var Va=Dd();Object.defineProperty(G,"Scope",{enumerable:!0,get:function(){return Va.Scope}});Object.defineProperty(G,"ValueScope",{enumerable:!0,get:function(){return Va.ValueScope}});Object.defineProperty(G,"ValueScopeName",{enumerable:!0,get:function(){return Va.ValueScopeName}});Object.defineProperty(G,"varKinds",{enumerable:!0,get:function(){return Va.varKinds}});G.operators={GT:new Q._Code(">"),GTE:new Q._Code(">="),LT:new Q._Code("<"),LTE:new Q._Code("<="),EQ:new Q._Code("==="),NEQ:new Q._Code("!=="),NOT:new Q._Code("!"),OR:new Q._Code("||"),AND:new Q._Code("&&"),ADD:new Q._Code("+")};var Ft=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Nd=class extends Ft{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?vt.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=cn(this.rhs,t,r)),this}get names(){return this.rhs instanceof Q._CodeOrName?this.rhs.names:{}}},Fa=class extends Ft{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 Q.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=cn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof Q.Name?{}:{...this.lhs.names};return La(t,this.rhs)}},Rd=class extends Fa{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Zd=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Ad=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Cd=class extends Ft{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Ud=class extends Ft{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=cn(this.code,t,r),this}get names(){return this.code instanceof Q._CodeOrName?this.code.names:{}}},Uo=class extends Ft{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 i=n[o];i.optimizeNames(t,r)||(lS(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>wr(t,r.names),{})}},qt=class extends Uo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Md=class extends Uo{},sn=class extends qt{};sn.kind="else";var xr=class e extends qt{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 sn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(nv(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=cn(this.condition,t,r),this}get names(){let t=super.names;return La(t,this.condition),this.else&&wr(t,this.else.names),t}};xr.kind="if";var kr=class extends qt{};kr.kind="for";var Fd=class extends kr{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=cn(this.iteration,t,r),this}get names(){return wr(super.names,this.iteration.names)}},qd=class extends kr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?vt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=La(super.names,this.from);return La(t,this.to)}},qa=class extends kr{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=cn(this.iterable,t,r),this}get names(){return wr(super.names,this.iterable.names)}},Mo=class extends qt{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)}};Mo.kind="func";var Fo=class extends Uo{render(t){return"return "+super.render(t)}};Fo.kind="return";var Ld=class extends qt{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&&wr(t,this.catch.names),this.finally&&wr(t,this.finally.names),t}},qo=class extends qt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};qo.kind="catch";var Lo=class extends qt{render(t){return"finally"+super.render(t)}};Lo.kind="finally";var Vd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=t,this._scope=new vt.Scope({parent:t}),this._nodes=[new Md]}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 i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Nd(t,i,n)),i}const(t,r,n){return this._def(vt.varKinds.const,t,r,n)}let(t,r,n){return this._def(vt.varKinds.let,t,r,n)}var(t,r,n){return this._def(vt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Fa(t,r,n))}add(t,r){return this._leafNode(new Rd(t,G.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==Q.nil&&this._leafNode(new Ud(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,Q.addCodeArg)(r,o));return r.push("}"),new Q._Code(r)}if(t,r,n){if(this._blockNode(new xr(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 xr(t))}else(){return this._elseNode(new sn)}endIf(){return this._endBlockNode(xr,sn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Fd(t),r)}forRange(t,r,n,o,i=this.opts.es5?vt.varKinds.var:vt.varKinds.let){let a=this._scope.toName(t);return this._for(new qd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=vt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof Q.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Q._)`${a}.length`,s=>{this.var(i,(0,Q._)`${a}[${s}]`),n(i)})}return this._for(new qa("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?vt.varKinds.var:vt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,Q._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new qa("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(kr)}label(t){return this._leafNode(new Zd(t))}break(t){return this._leafNode(new Ad(t))}return(t){let r=new Fo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Fo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Ld;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new qo(i),r(i)}return n&&(this._currNode=o.finally=new Lo,this.code(n)),this._endBlockNode(qo,Lo)}throw(t){return this._leafNode(new Cd(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=Q.nil,n,o){return this._blockNode(new Mo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Mo)}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 xr))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=Vd;function wr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function La(e,t){return t instanceof Q._CodeOrName?wr(e,t.names):e}function cn(e,t,r){if(e instanceof Q.Name)return n(e);if(!o(e))return e;return new Q._Code(e._items.reduce((i,a)=>(a instanceof Q.Name&&(a=n(a)),a instanceof Q._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof Q._Code&&i._items.some(a=>a instanceof Q.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function lS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function nv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,Q._)`!${Jd(e)}`}G.not=nv;var dS=ov(G.operators.AND);function pS(...e){return e.reduce(dS)}G.and=pS;var fS=ov(G.operators.OR);function mS(...e){return e.reduce(fS)}G.or=mS;function ov(e){return(t,r)=>t===Q.nil?r:r===Q.nil?t:(0,Q._)`${Jd(t)} ${e} ${Jd(r)}`}function Jd(e){return e instanceof Q.Name?e:(0,Q._)`(${e})`}});var ee=z(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.checkStrictMode=X.getErrorPath=X.Type=X.useFunc=X.setEvaluated=X.evaluatedPropsToName=X.mergeEvaluated=X.eachItem=X.unescapeJsonPointer=X.escapeJsonPointer=X.escapeFragment=X.unescapeFragment=X.schemaRefOrVal=X.schemaHasRulesButRef=X.schemaHasRules=X.checkUnknownRules=X.alwaysValidSchema=X.toHash=void 0;var pe=K(),hS=Co();function gS(e){let t={};for(let r of e)t[r]=!0;return t}X.toHash=gS;function vS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(sv(e,t),!cv(t,e.self.RULES.all))}X.alwaysValidSchema=vS;function sv(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||dv(e,`unknown keyword: "${i}"`)}X.checkUnknownRules=sv;function cv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}X.schemaHasRules=cv;function yS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}X.schemaHasRulesButRef=yS;function _S({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)}`}X.schemaRefOrVal=_S;function $S(e){return uv(decodeURIComponent(e))}X.unescapeFragment=$S;function bS(e){return encodeURIComponent(Kd(e))}X.escapeFragment=bS;function Kd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}X.escapeJsonPointer=Kd;function uv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}X.unescapeJsonPointer=uv;function xS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}X.eachItem=xS;function iv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof pe.Name?(i instanceof pe.Name?e(o,i,a):t(o,i,a),a):i instanceof pe.Name?(t(o,a,i),i):r(i,a);return s===pe.Name&&!(c instanceof pe.Name)?n(o,c):c}}X.mergeEvaluated={props:iv({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} || {}`),Bd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:lv}),items:iv({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 lv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,pe._)`{}`);return t!==void 0&&Bd(e,r,t),r}X.evaluatedPropsToName=lv;function Bd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,pe._)`${t}${(0,pe.getProperty)(n)}`,!0))}X.setEvaluated=Bd;var av={};function kS(e,t){return e.scopeValue("func",{ref:t,code:av[t.code]||(av[t.code]=new hS._Code(t.code))})}X.useFunc=kS;var Hd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Hd||(X.Type=Hd={}));function wS(e,t,r){if(e instanceof pe.Name){let n=t===Hd.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():"/"+Kd(e)}X.getErrorPath=wS;function dv(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}X.checkStrictMode=dv});var Lt=z(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var De=K(),SS={data:new De.Name("data"),valCxt:new De.Name("valCxt"),instancePath:new De.Name("instancePath"),parentData:new De.Name("parentData"),parentDataProperty:new De.Name("parentDataProperty"),rootData:new De.Name("rootData"),dynamicAnchors:new De.Name("dynamicAnchors"),vErrors:new De.Name("vErrors"),errors:new De.Name("errors"),this:new De.Name("this"),self:new De.Name("self"),scope:new De.Name("scope"),json:new De.Name("json"),jsonPos:new De.Name("jsonPos"),jsonLen:new De.Name("jsonLen"),jsonPart:new De.Name("jsonPart")};Gd.default=SS});var Vo=z(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.extendErrors=Ne.resetErrorsCount=Ne.reportExtraError=Ne.reportError=Ne.keyword$DataError=Ne.keywordError=void 0;var te=K(),Ja=ee(),qe=Lt();Ne.keywordError={message:({keyword:e})=>(0,te.str)`must pass "${e}" keyword validation`};Ne.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,te.str)`"${e}" keyword must be ${t} ($data)`:(0,te.str)`"${e}" keyword is invalid ($data)`};function zS(e,t=Ne.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=mv(e,t,r);n??(a||s)?pv(i,c):fv(o,(0,te._)`[${c}]`)}Ne.reportError=zS;function IS(e,t=Ne.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=mv(e,t,r);pv(o,s),i||a||fv(n,qe.default.vErrors)}Ne.reportExtraError=IS;function PS(e,t){e.assign(qe.default.errors,t),e.if((0,te._)`${qe.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,te._)`${qe.default.vErrors}.length`,t),()=>e.assign(qe.default.vErrors,null)))}Ne.resetErrorsCount=PS;function TS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,qe.default.errors,s=>{e.const(a,(0,te._)`${qe.default.vErrors}[${s}]`),e.if((0,te._)`${a}.instancePath === undefined`,()=>e.assign((0,te._)`${a}.instancePath`,(0,te.strConcat)(qe.default.instancePath,i.errorPath))),e.assign((0,te._)`${a}.schemaPath`,(0,te.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,te._)`${a}.schema`,r),e.assign((0,te._)`${a}.data`,n))})}Ne.extendErrors=TS;function pv(e,t){let r=e.const("err",t);e.if((0,te._)`${qe.default.vErrors} === null`,()=>e.assign(qe.default.vErrors,(0,te._)`[${r}]`),(0,te._)`${qe.default.vErrors}.push(${r})`),e.code((0,te._)`${qe.default.errors}++`)}function fv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,te._)`new ${e.ValidationError}(${t})`):(r.assign((0,te._)`${n}.errors`,t),r.return(!1))}var Sr={keyword:new te.Name("keyword"),schemaPath:new te.Name("schemaPath"),params:new te.Name("params"),propertyName:new te.Name("propertyName"),message:new te.Name("message"),schema:new te.Name("schema"),parentSchema:new te.Name("parentSchema")};function mv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,te._)`{}`:jS(e,t,r)}function jS(e,t,r={}){let{gen:n,it:o}=e,i=[ES(o,r),OS(e,r)];return DS(e,t,i),n.object(...i)}function ES({errorPath:e},{instancePath:t}){let r=t?(0,te.str)`${e}${(0,Ja.getErrorPath)(t,Ja.Type.Str)}`:e;return[qe.default.instancePath,(0,te.strConcat)(qe.default.instancePath,r)]}function OS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,te.str)`${t}/${e}`;return r&&(o=(0,te.str)`${o}${(0,Ja.getErrorPath)(r,Ja.Type.Str)}`),[Sr.schemaPath,o]}function DS(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Sr.keyword,o],[Sr.params,typeof t=="function"?t(e):t||(0,te._)`{}`]),c.messages&&n.push([Sr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Sr.schema,a],[Sr.parentSchema,(0,te._)`${l}${d}`],[qe.default.data,i]),u&&n.push([Sr.propertyName,u])}});var gv=z(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.boolOrEmptySchema=un.topBoolOrEmptySchema=void 0;var NS=Vo(),RS=K(),ZS=Lt(),AS={message:"boolean schema is false"};function CS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?hv(e,!1):typeof r=="object"&&r.$async===!0?t.return(ZS.default.data):(t.assign((0,RS._)`${n}.errors`,null),t.return(!0))}un.topBoolOrEmptySchema=CS;function US(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),hv(e)):r.var(t,!0)}un.boolOrEmptySchema=US;function hv(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,NS.reportError)(o,AS,void 0,t)}});var Wd=z(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.getRules=ln.isJSONType=void 0;var MS=["string","number","integer","boolean","null","object","array"],FS=new Set(MS);function qS(e){return typeof e=="string"&&FS.has(e)}ln.isJSONType=qS;function LS(){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:{}}}ln.getRules=LS});var Xd=z(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function VS({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&vv(e,n)}nr.schemaHasRulesForType=VS;function vv(e,t){return t.rules.some(r=>yv(e,r))}nr.shouldUseGroup=vv;function yv(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))}nr.shouldUseRule=yv});var Jo=z(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var JS=Wd(),HS=Xd(),KS=Vo(),H=K(),_v=ee(),dn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(dn||(Re.DataType=dn={}));function BS(e){let t=$v(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}Re.getSchemaTypes=BS;function $v(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(JS.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Re.getJSONTypes=$v;function GS(e,t){let{gen:r,data:n,opts:o}=e,i=WS(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,HS.schemaHasRulesForType)(e,t[0]));if(a){let s=Qd(t,n,o.strictNumbers,dn.Wrong);r.if(s,()=>{i.length?XS(e,t,i):ep(e)})}return a}Re.coerceAndCheckDataType=GS;var bv=new Set(["string","number","integer","boolean","null"]);function WS(e,t){return t?e.filter(r=>bv.has(r)||t==="array"&&r==="array"):[]}function XS(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,H._)`typeof ${o}`),s=n.let("coerced",(0,H._)`undefined`);i.coerceTypes==="array"&&n.if((0,H._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,H._)`${o}[0]`).assign(a,(0,H._)`typeof ${o}`).if(Qd(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,H._)`${s} !== undefined`);for(let u of r)(bv.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ep(e),n.endIf(),n.if((0,H._)`${s} !== undefined`,()=>{n.assign(o,s),YS(e,s)});function c(u){switch(u){case"string":n.elseIf((0,H._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,H._)`"" + ${o}`).elseIf((0,H._)`${o} === null`).assign(s,(0,H._)`""`);return;case"number":n.elseIf((0,H._)`${a} == "boolean" || ${o} === null
|
|
4
|
+
|| (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,H._)`+${o}`);return;case"integer":n.elseIf((0,H._)`${a} === "boolean" || ${o} === null
|
|
5
|
+
|| (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,H._)`+${o}`);return;case"boolean":n.elseIf((0,H._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,H._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,H._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,H._)`${a} === "string" || ${a} === "number"
|
|
6
|
+
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,H._)`[${o}]`)}}}function YS({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,H._)`${t} !== undefined`,()=>e.assign((0,H._)`${t}[${r}]`,n))}function Yd(e,t,r,n=dn.Correct){let o=n===dn.Correct?H.operators.EQ:H.operators.NEQ,i;switch(e){case"null":return(0,H._)`${t} ${o} null`;case"array":i=(0,H._)`Array.isArray(${t})`;break;case"object":i=(0,H._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,H._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,H._)`typeof ${t} ${o} ${e}`}return n===dn.Correct?i:(0,H.not)(i);function a(s=H.nil){return(0,H.and)((0,H._)`typeof ${t} == "number"`,s,r?(0,H._)`isFinite(${t})`:H.nil)}}Re.checkDataType=Yd;function Qd(e,t,r,n){if(e.length===1)return Yd(e[0],t,r,n);let o,i=(0,_v.toHash)(e);if(i.array&&i.object){let a=(0,H._)`typeof ${t} != "object"`;o=i.null?a:(0,H._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=H.nil;i.number&&delete i.integer;for(let a in i)o=(0,H.and)(o,Yd(a,t,r,n));return o}Re.checkDataTypes=Qd;var QS={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,H._)`{type: ${e}}`:(0,H._)`{type: ${t}}`};function ep(e){let t=e0(e);(0,KS.reportError)(t,QS)}Re.reportTypeError=ep;function e0(e){let{gen:t,data:r,schema:n}=e,o=(0,_v.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var kv=z(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.assignDefaults=void 0;var pn=K(),t0=ee();function r0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)xv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>xv(e,i,o.default))}Ha.assignDefaults=r0;function xv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,pn._)`${i}${(0,pn.getProperty)(t)}`;if(o){(0,t0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,pn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,pn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,pn._)`${s} = ${(0,pn.stringify)(r)}`)}});var ct=z(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.validateUnion=ce.validateArray=ce.usePattern=ce.callValidateCode=ce.schemaProperties=ce.allSchemaProperties=ce.noPropertyInData=ce.propertyInData=ce.isOwnProperty=ce.hasPropFunc=ce.reportMissingProp=ce.checkMissingProp=ce.checkReportMissingProp=void 0;var ge=K(),tp=ee(),or=Lt(),n0=ee();function o0(e,t){let{gen:r,data:n,it:o}=e;r.if(np(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ge._)`${t}`},!0),e.error()})}ce.checkReportMissingProp=o0;function i0({gen:e,data:t,it:{opts:r}},n,o){return(0,ge.or)(...n.map(i=>(0,ge.and)(np(e,t,i,r.ownProperties),(0,ge._)`${o} = ${i}`)))}ce.checkMissingProp=i0;function a0(e,t){e.setParams({missingProperty:t},!0),e.error()}ce.reportMissingProp=a0;function wv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ge._)`Object.prototype.hasOwnProperty`})}ce.hasPropFunc=wv;function rp(e,t,r){return(0,ge._)`${wv(e)}.call(${t}, ${r})`}ce.isOwnProperty=rp;function s0(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} !== undefined`;return n?(0,ge._)`${o} && ${rp(e,t,r)}`:o}ce.propertyInData=s0;function np(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} === undefined`;return n?(0,ge.or)(o,(0,ge.not)(rp(e,t,r))):o}ce.noPropertyInData=np;function Sv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ce.allSchemaProperties=Sv;function c0(e,t){return Sv(t).filter(r=>!(0,tp.alwaysValidSchema)(e,t[r]))}ce.schemaProperties=c0;function u0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ge._)`${e}, ${t}, ${n}${o}`:t,d=[[or.default.instancePath,(0,ge.strConcat)(or.default.instancePath,i)],[or.default.parentData,a.parentData],[or.default.parentDataProperty,a.parentDataProperty],[or.default.rootData,or.default.rootData]];a.opts.dynamicRef&&d.push([or.default.dynamicAnchors,or.default.dynamicAnchors]);let f=(0,ge._)`${l}, ${r.object(...d)}`;return c!==ge.nil?(0,ge._)`${s}.call(${c}, ${f})`:(0,ge._)`${s}(${f})`}ce.callValidateCode=u0;var l0=(0,ge._)`new RegExp`;function d0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ge._)`${o.code==="new RegExp"?l0:(0,n0.useFunc)(e,o)}(${r}, ${n})`})}ce.usePattern=d0;function p0(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,ge._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:tp.Type.Num},i),t.if((0,ge.not)(i),s)})}}ce.validateArray=p0;function f0(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,tp.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ge._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ge.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ce.validateUnion=f0});var Pv=z(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateKeywordUsage=St.validSchemaType=St.funcKeywordCode=St.macroKeywordCode=void 0;var Le=K(),zr=Lt(),m0=ct(),h0=Vo();function g0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=Iv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Le.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}St.macroKeywordCode=g0;function v0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;_0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=Iv(n,o,u),d=n.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1)g(),t.modifying&&zv(e),y(()=>e.error());else{let $=t.async?p():h();t.modifying&&zv(e),y(()=>y0(e,$))}}function p(){let $=n.let("ruleErrs",null);return n.try(()=>g((0,Le._)`await `),k=>n.assign(d,!1).if((0,Le._)`${k} instanceof ${c.ValidationError}`,()=>n.assign($,(0,Le._)`${k}.errors`),()=>n.throw(k))),$}function h(){let $=(0,Le._)`${l}.errors`;return n.assign($,null),g(Le.nil),$}function g($=t.async?(0,Le._)`await `:Le.nil){let k=c.opts.passContext?zr.default.this:zr.default.self,x=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Le._)`${$}${(0,m0.callValidateCode)(e,l,k,x)}`,t.modifying)}function y($){var k;n.if((0,Le.not)((k=t.valid)!==null&&k!==void 0?k:d),$)}}St.funcKeywordCode=v0;function zv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Le._)`${n.parentData}[${n.parentDataProperty}]`))}function y0(e,t){let{gen:r}=e;r.if((0,Le._)`Array.isArray(${t})`,()=>{r.assign(zr.default.vErrors,(0,Le._)`${zr.default.vErrors} === null ? ${t} : ${zr.default.vErrors}.concat(${t})`).assign(zr.default.errors,(0,Le._)`${zr.default.vErrors}.length`),(0,h0.extendErrors)(e)},()=>e.error())}function _0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Iv(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,Le.stringify)(r)})}function $0(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")}St.validSchemaType=$0;function b0({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}St.validateKeywordUsage=b0});var jv=z(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.extendSubschemaMode=ir.extendSubschemaData=ir.getSubschema=void 0;var zt=K(),Tv=ee();function x0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}${(0,zt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Tv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}ir.getSubschema=x0;function k0(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,f=s.let("data",(0,zt._)`${t.data}${(0,zt.getProperty)(r)}`,!0);c(f),e.errorPath=(0,zt.str)`${u}${(0,Tv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,zt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof zt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);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]}}ir.extendSubschemaData=k0;function w0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}ir.extendSubschemaMode=w0});var op=z((mC,Ev)=>{"use strict";Ev.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,i;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(i=Object.keys(t),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var Dv=z((hC,Ov)=>{"use strict";var ar=Ov.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(){};Ka(t,n,o,e,"",e)};ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ar.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ar.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 Ka(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ar.arrayKeywords)for(var f=0;f<d.length;f++)Ka(e,t,r,d[f],o+"/"+l+"/"+f,i,o,l,n,f)}else if(l in ar.propsKeywords){if(d&&typeof d=="object")for(var p in d)Ka(e,t,r,d[p],o+"/"+l+"/"+S0(p),i,o,l,n,p)}else(l in ar.keywords||e.allKeys&&!(l in ar.skipKeywords))&&Ka(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function S0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ho=z(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.getSchemaRefs=Ke.resolveUrl=Ke.normalizeId=Ke._getFullPath=Ke.getFullPath=Ke.inlineRef=void 0;var z0=ee(),I0=op(),P0=Dv(),T0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function j0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ip(e):t?Nv(e)<=t:!1}Ke.inlineRef=j0;var E0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ip(e){for(let t in e){if(E0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(ip)||typeof r=="object"&&ip(r))return!0}return!1}function Nv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!T0.has(r)&&(typeof e[r]=="object"&&(0,z0.eachItem)(e[r],n=>t+=Nv(n)),t===1/0))return 1/0}return t}function Rv(e,t="",r){r!==!1&&(t=fn(t));let n=e.parse(t);return Zv(e,n)}Ke.getFullPath=Rv;function Zv(e,t){return e.serialize(t).split("#")[0]+"#"}Ke._getFullPath=Zv;var O0=/#\/?$/;function fn(e){return e?e.replace(O0,""):""}Ke.normalizeId=fn;function D0(e,t,r){return r=fn(r),e.resolve(t,r)}Ke.resolveUrl=D0;var N0=/^[a-z_][-a-z0-9._]*$/i;function R0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=fn(e[r]||t),i={"":o},a=Rv(n,o,!1),s={},c=new Set;return P0(e,{allKeys:!0},(d,f,p,h)=>{if(h===void 0)return;let g=a+f,y=i[h];typeof d[r]=="string"&&(y=$.call(this,d[r])),k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),i[f]=y;function $(x){let D=this.opts.uriResolver.resolve;if(x=fn(y?D(y,x):x),c.has(x))throw l(x);c.add(x);let O=this.refs[x];return typeof O=="string"&&(O=this.refs[O]),typeof O=="object"?u(d,O.schema,x):x!==fn(g)&&(x[0]==="#"?(u(d,s[x],x),s[x]=d):this.refs[x]=g),x}function k(x){if(typeof x=="string"){if(!N0.test(x))throw new Error(`invalid anchor "${x}"`);$.call(this,`#${x}`)}}}),s;function u(d,f,p){if(f!==void 0&&!I0(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ke.getSchemaRefs=R0});var Go=z(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.getData=sr.KeywordCxt=sr.validateFunctionCode=void 0;var Fv=gv(),Av=Jo(),sp=Xd(),Ba=Jo(),Z0=kv(),Bo=Pv(),ap=jv(),E=K(),F=Lt(),A0=Ho(),Vt=ee(),Ko=Vo();function C0(e){if(Vv(e)&&(Jv(e),Lv(e))){F0(e);return}qv(e,()=>(0,Fv.topBoolOrEmptySchema)(e))}sr.validateFunctionCode=C0;function qv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,E._)`${F.default.data}, ${F.default.valCxt}`,n.$async,()=>{e.code((0,E._)`"use strict"; ${Cv(r,o)}`),M0(e,o),e.code(i)}):e.func(t,(0,E._)`${F.default.data}, ${U0(o)}`,n.$async,()=>e.code(Cv(r,o)).code(i))}function U0(e){return(0,E._)`{${F.default.instancePath}="", ${F.default.parentData}, ${F.default.parentDataProperty}, ${F.default.rootData}=${F.default.data}${e.dynamicRef?(0,E._)`, ${F.default.dynamicAnchors}={}`:E.nil}}={}`}function M0(e,t){e.if(F.default.valCxt,()=>{e.var(F.default.instancePath,(0,E._)`${F.default.valCxt}.${F.default.instancePath}`),e.var(F.default.parentData,(0,E._)`${F.default.valCxt}.${F.default.parentData}`),e.var(F.default.parentDataProperty,(0,E._)`${F.default.valCxt}.${F.default.parentDataProperty}`),e.var(F.default.rootData,(0,E._)`${F.default.valCxt}.${F.default.rootData}`),t.dynamicRef&&e.var(F.default.dynamicAnchors,(0,E._)`${F.default.valCxt}.${F.default.dynamicAnchors}`)},()=>{e.var(F.default.instancePath,(0,E._)`""`),e.var(F.default.parentData,(0,E._)`undefined`),e.var(F.default.parentDataProperty,(0,E._)`undefined`),e.var(F.default.rootData,F.default.data),t.dynamicRef&&e.var(F.default.dynamicAnchors,(0,E._)`{}`)})}function F0(e){let{schema:t,opts:r,gen:n}=e;qv(e,()=>{r.$comment&&t.$comment&&Kv(e),H0(e),n.let(F.default.vErrors,null),n.let(F.default.errors,0),r.unevaluated&&q0(e),Hv(e),G0(e)})}function q0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,E._)`${r}.evaluated`),t.if((0,E._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,E._)`${e.evaluated}.props`,(0,E._)`undefined`)),t.if((0,E._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,E._)`${e.evaluated}.items`,(0,E._)`undefined`))}function Cv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,E._)`/*# sourceURL=${r} */`:E.nil}function L0(e,t){if(Vv(e)&&(Jv(e),Lv(e))){V0(e,t);return}(0,Fv.boolOrEmptySchema)(e,t)}function Lv({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 Vv(e){return typeof e.schema!="boolean"}function V0(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Kv(e),K0(e),B0(e);let i=n.const("_errs",F.default.errors);Hv(e,i),n.var(t,(0,E._)`${i} === ${F.default.errors}`)}function Jv(e){(0,Vt.checkUnknownRules)(e),J0(e)}function Hv(e,t){if(e.opts.jtd)return Uv(e,[],!1,t);let r=(0,Av.getSchemaTypes)(e.schema),n=(0,Av.coerceAndCheckDataType)(e,r);Uv(e,r,!n,t)}function J0(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Vt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function H0(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Vt.checkStrictMode)(e,"default is ignored in the schema root")}function K0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,A0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function B0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Kv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,E._)`${F.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,E.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,E._)`${F.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function G0(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,E._)`${F.default.errors} === 0`,()=>t.return(F.default.data),()=>t.throw((0,E._)`new ${o}(${F.default.vErrors})`)):(t.assign((0,E._)`${n}.errors`,F.default.vErrors),i.unevaluated&&W0(e),t.return((0,E._)`${F.default.errors} === 0`))}function W0({gen:e,evaluated:t,props:r,items:n}){r instanceof E.Name&&e.assign((0,E._)`${t}.props`,r),n instanceof E.Name&&e.assign((0,E._)`${t}.items`,n)}function Uv(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Vt.schemaHasRulesButRef)(i,l))){o.block(()=>Gv(e,"$ref",l.all.$ref.definition));return}c.jtd||X0(e,t),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,sp.shouldUseGroup)(i,f)&&(f.type?(o.if((0,Ba.checkDataType)(f.type,a,c.strictNumbers)),Mv(e,f),t.length===1&&t[0]===f.type&&r&&(o.else(),(0,Ba.reportTypeError)(e)),o.endIf()):Mv(e,f),s||o.if((0,E._)`${F.default.errors} === ${n||0}`))}}function Mv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,Z0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,sp.shouldUseRule)(n,i)&&Gv(e,i.keyword,i.definition,t.type)})}function X0(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Y0(e,t),e.opts.allowUnionTypes||Q0(e,t),ez(e,e.dataTypes))}function Y0(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Bv(e.dataTypes,r)||cp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),rz(e,t)}}function Q0(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&cp(e,"use allowUnionTypes to allow union type keyword")}function ez(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,sp.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>tz(t,a))&&cp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function tz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Bv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function rz(e,t){let r=[];for(let n of e.dataTypes)Bv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function cp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Vt.checkStrictMode)(e,t,e.opts.strictTypes)}var Ga=class{constructor(t,r,n){if((0,Bo.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,Vt.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",Wv(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Bo.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",F.default.errors))}result(t,r,n){this.failResult((0,E.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,E.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,E._)`${r} !== undefined && (${(0,E.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?Ko.reportExtraError:Ko.reportError)(this,this.def.error,r)}$dataError(){(0,Ko.reportError)(this,this.def.$dataError||Ko.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ko.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=E.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=E.nil,r=E.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,E.or)((0,E._)`${o} === undefined`,r)),t!==E.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==E.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,E.or)(a(),s());function a(){if(n.length){if(!(r instanceof E.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,E._)`${(0,Ba.checkDataTypes)(c,r,i.opts.strictNumbers,Ba.DataType.Wrong)}`}return E.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,E._)`!${c}(${r})`}return E.nil}}subschema(t,r){let n=(0,ap.getSubschema)(this.it,t);(0,ap.extendSubschemaData)(n,this.it,t),(0,ap.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return L0(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Vt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Vt.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,E.Name)),!0}};sr.KeywordCxt=Ga;function Gv(e,t,r,n){let o=new Ga(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Bo.funcKeywordCode)(o,r):"macro"in r?(0,Bo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Bo.funcKeywordCode)(o,r)}var nz=/^\/(?:[^~]|~0|~1)*$/,oz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Wv(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return F.default.rootData;if(e[0]==="/"){if(!nz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=F.default.rootData}else{let u=oz.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(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,E._)`${i}${(0,E.getProperty)((0,Vt.unescapeJsonPointer)(u))}`,a=(0,E._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}sr.getData=Wv});var Wa=z(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var up=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};lp.default=up});var Wo=z(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var dp=Ho(),pp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,dp.resolveUrl)(t,r,n),this.missingSchema=(0,dp.normalizeId)((0,dp.getFullPath)(t,this.missingRef))}};fp.default=pp});var Ya=z(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.resolveSchema=ut.getCompilingSchema=ut.resolveRef=ut.compileSchema=ut.SchemaEnv=void 0;var yt=K(),iz=Wa(),Ir=Lt(),_t=Ho(),Xv=ee(),az=Go(),mn=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,_t.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};ut.SchemaEnv=mn;function hp(e){let t=Yv.call(this,e);if(t)return t;let r=(0,_t.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new yt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:iz.default,code:(0,yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,yt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:yt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,az.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${Ir.default.self}`,`${Ir.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:h,items:g}=u;p.evaluated={props:h instanceof yt.Name?void 0:h,items:g instanceof yt.Name?void 0:g,dynamicProps:h instanceof yt.Name,dynamicItems:g instanceof yt.Name},p.source&&(p.source.evaluated=(0,yt.stringify)(p.evaluated))}return e.validate=p,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)}}ut.compileSchema=hp;function sz(e,t,r){var n;r=(0,_t.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=lz.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new mn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=cz.call(this,i)}ut.resolveRef=sz;function cz(e){return(0,_t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:hp.call(this,e)}function Yv(e){for(let t of this._compilations)if(uz(t,e))return t}ut.getCompilingSchema=Yv;function uz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function lz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Xa.call(this,e,t)}function Xa(e,t){let r=this.opts.uriResolver.parse(t),n=(0,_t._getFullPath)(this.opts.uriResolver,r),o=(0,_t.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return mp.call(this,r,e);let i=(0,_t.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Xa.call(this,e,a);return typeof s?.schema!="object"?void 0:mp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||hp.call(this,a),i===(0,_t.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,_t.resolveUrl)(this.opts.uriResolver,o,u)),new mn({schema:s,schemaId:c,root:e,baseId:o})}return mp.call(this,r,a)}}ut.resolveSchema=Xa;var dz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function mp(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Xv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!dz.has(s)&&u&&(t=(0,_t.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Xv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,_t.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Xa.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new mn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var Qv=z((bC,pz)=>{pz.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 xp=z((xC,iy)=>{"use strict";var fz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),vp=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),mz=RegExp.prototype.test.bind(/^\d*$/u),Pr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),yp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),ty=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),_p=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),hz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function gz(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 vz=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),yz=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),_z=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),$z=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),bz=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),xz=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function kz(e){return bz(e)||xz(e)}function wz(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!_z(e[t])){if(e[t]==="%"&&t+2<e.length&&Pr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function ey(e){let t=-1,r=0,n=-1,o=0;for(let s=0;s<e.length;s++)e[s]==="0"?(n===-1&&(n=s),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),a=e.slice(t+r).join(":");return i+"::"+a}function Sz(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let o=r.concat(n),i=0;for(let s=0;s<o.length;s++){let c=o[s];if(c==="")return;if(c.indexOf(".")!==-1){if(s!==o.length-1||t!==-1&&n.length===0||!vp(c))return;i+=2;continue}if(!vz(c))return;o[s]=parseInt(c,16).toString(16),i++}if(t===-1)return i!==8?void 0:ey(o);if(i>=8)return;let a=o.slice(0,r.length);for(let s=i;s<8;s++)a.push("0");for(let s=r.length;s<o.length;s++)a.push(o[s]);return ey(a)}function gp(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&yz(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(zz(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",i=n.indexOf("%");if(i!==-1){let s=n.slice(i,i+3).toLowerCase()==="%25"?3:1;if(o=n.slice(i+s),!wz(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=Sz(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(o?"%"+o:""),escapedHost:a+(o?"%25"+o:""),isIPV6:!0}}function zz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Iz(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]==="."){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 Pz={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Tz=/[@/?#:]/g,jz=/[@/?#]/g;function ry(e,t){let r=t?jz:Tz;return r.lastIndex=0,e.replace(r,n=>Pz[n])}function ny(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(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));t&&yp(a)?r+=a:r+="%"+i,n+=2;continue}}r+=e[n]}return r}var Ze=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ze[t]="%"+e[t>>4]+e[t&15]}function $p(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function ye(e){return e<2048?Ze[192|e>>6]+Ze[128|e&63]:e<65536?Ze[224|e>>12]+Ze[128|e>>6&63]+Ze[128|e&63]:Ze[240|e>>18]+Ze[128|e>>12&63]+Ze[128|e>>6&63]+Ze[128|e&63]}function Ez(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&yp(a)?t+=a:t+="%"+i,r+=2;continue}}if(ty(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=$p(o)?n:Ze[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=ye(65536+(o-55296<<10)+(i-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function Oz(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let i=e[o];if(i==="%"&&o+2<e.length){let a=e.slice(o+1,o+3);if(Pr(a)){r+="%"+a.toUpperCase(),o+=2;continue}}if(i==="/"&&(n=!1),ty(i)&&(i!==":"||!n))r+=i;else{let a=e.charCodeAt(o);if(a<128)r+=Ze[a];else if(a<55296||a>57343)r+=ye(a);else if(a<=56319&&o+1<e.length){let s=e.charCodeAt(o+1);s>=56320&&s<=57343?(r+=ye(65536+(a-55296<<10)+(s-56320)),o++):r+=ye(65533)}else r+=ye(65533)}}return r}function Dz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));yp(a)?t+=a:t+="%"+i,r+=2;continue}}if(_p(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=$p(o)?n:Ze[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=ye(65536+(o-55296<<10)+(i-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function bp(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Pr(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let i=e.charCodeAt(n);if(i<128)r+=Ze[i];else if(i<55296||i>57343)r+=ye(i);else if(i<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=ye(65536+(i-55296<<10)+(a-56320)),n++):r+=ye(65533)}else r+=ye(65533)}}return r}function oy(e){return bp(e,hz)}function Nz(e){return bp(e,_p)}function Rz(e){return bp(e,_p)}function Zz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Pr(i)){t+="%"+i.toUpperCase(),r+=2;continue}}let o=e.charCodeAt(r);if(o<128)t+=$p(o)?n:Ze[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=ye(65536+(o-55296<<10)+(i-56320)),r++):t+=ye(65533)}else t+=ye(65533)}return t}function Az(e){let t=[];if(e.userinfo!==void 0&&(t.push(oy(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!vp(r)){let n=gp(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=ny(r,!0),n=gp(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=ry(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!mz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}iy.exports={BYTE_HEX:Ze,percentEncodeNonAscii:ye,nonSimpleDomain:$z,nonSimpleMailtoDomain:kz,recomposeAuthority:Az,reescapeHostDelimiters:ry,normalizePercentEncoding:ny,normalizePathEncoding:Ez,serializePathEncoding:Oz,normalizeQueryFragmentEncoding:Dz,encodeUserinfo:oy,encodeQuery:Nz,encodeFragment:Rz,escapePreservingEscapes:Zz,removeDotSegments:Iz,isIPv4:vp,isUUID:fz,normalizeIPv6:gp,stringArrayToHexStripped:gz}});var hy=z((kC,my)=>{"use strict";var{isUUID:Cz,BYTE_HEX:Uz,percentEncodeNonAscii:kp,nonSimpleMailtoDomain:Mz}=xp(),Fz=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,qz=["http","https","ws","wss","urn","urn:uuid","mailto"];function Lz(e){return qz.indexOf(e)!==-1}function Sp(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 uy(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function ly(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 Vz(e){return e.secure=Sp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Jz(e){if((e.port===(Sp(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=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function Hz(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Fz);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=zp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Kz(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}`,i=zp(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function Bz(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Cz(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Gz(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var dy={scheme:"http",domainHost:!0,parse:uy,serialize:ly},Wz={scheme:"https",domainHost:dy.domainHost,parse:uy,serialize:ly},Qa={scheme:"ws",domainHost:!0,parse:Vz,serialize:Jz},Xz={scheme:"wss",domainHost:Qa.domainHost,parse:Qa.parse,serialize:Qa.serialize},Yz={scheme:"urn",parse:Hz,serialize:Kz,skipNormalize:!0},Qz={scheme:"urn:uuid",parse:Bz,serialize:Gz,skipNormalize:!0},eI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=",tI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@",py="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function ts(e,t=!1){let r=new Uint8Array(128);for(let i=0;i<e.length;i++)r[e.charCodeAt(i)]=1;let n=e.replace(/[\\\]^-]/gu,"\\$&"),o=t?`[${n}]|[^\\0-\\x7F\\uD800-\\uDFFF]`:`[${n}]`;return{all:new RegExp(`^(?:${o})*$`,"u"),table:r,allowNonAscii:t}}var rI=ts(eI),ay=ts(tI),nI=ts(py),oI=ts(py,!0),iI=/^[\da-f]{2}$/iu,aI=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,wp="URI mailto has an invalid recipient domain.",sy=/[\uD800-\uDFFF]/u;function cr(e){if(typeof e!="string"||e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function cy(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);if(o>=56320&&o<=57343){t+=e[r]+e[r+1],r++;continue}}t+=n>=55296&&n<=57343?"\uFFFD":e[r]}return t}function Xo(e,t){if(t.all.test(e))return e;let r=t.table,n="";for(let o=0;o<e.length;o++){let i=e.charCodeAt(o);if(i<128){r[i]===1?n+=e[o]:i===37&&o+2<e.length&&iI.test(e.slice(o+1,o+3))?(n+="%"+e.slice(o+1,o+3).toUpperCase(),o+=2):n+=Uz[i];continue}if(i<55296||i>57343){n+=t.allowNonAscii?e[o]:kp(i);continue}if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343){n+=t.allowNonAscii?e[o]+e[o+1]:kp(65536+(i-55296<<10)+(a-56320)),o++;continue}}n+=t.allowNonAscii?"\uFFFD":kp(65533)}return n}function fy(e,t,r){let n=String(e).toLowerCase();if(aI.test(n)||n!==""&&!Mz(n))return n;try{let o=new URL("http://"+n);if(o.username||o.password||o.port||o.pathname!=="/"||o.search||o.hash||!o.hostname)throw new Error(wp);return t&&t.unicodeSupport?n:o.hostname}catch{return r&&(r.error=r.error||wp),n}}function sI(e,t){let r=t&&t.unicodeSupport?oI:nI;return e.length>1&&e[0]==="["&&e[e.length-1]==="]"?"["+Xo(e.slice(1,-1),r)+"]":Xo(e,r)}function cI(e,t){let r=e,n=r.path,o=r.query;n&&sy.test(n)&&(n=cy(n)),o&&sy.test(o)&&(o=cy(o));let i=n?n.indexOf(",")===-1?[n]:n.split(","):[];if(r.path=void 0,o){let a=null,s=0;for(;s<=o.length;){let c=o.indexOf("&",s);c===-1&&(c=o.length);let u=o.slice(s,c);s=c+1;let l=u.indexOf("=");if(l!==u.lastIndexOf("=")){r.error=r.error||"URI mailto has malformed header fields.";continue}let d=l===-1?u:u.slice(0,l),f=l===-1?"":u.slice(l+1);if(d==="to"){let p=f.split(",");for(let h=0;h<p.length;h++)i.push(p[h]);continue}if(d==="subject"){r.subject=cr(f);continue}if(d==="body"){r.body=cr(f);continue}a===null&&(a=Object.create(null)),a[cr(d)]=cr(f)}a!==null&&(r.headers=a)}r.query=void 0;for(let a=0;a<i.length;a++){let s=i[a],c=s.lastIndexOf("@");if(c<0){r.error=r.error||wp,i[a]=cr(s);continue}let u=cr(s.slice(0,c)),l=fy(cr(s.slice(c+1)),t,r);i[a]=u+"@"+l}return i.length&&(r.to=i),r}function uI(e,t){let r=e,n=Array.isArray(r.to)?r.to.slice():[];if(n.length){for(let s=0;s<n.length;s++){let c=String(n[s]),u=c.lastIndexOf("@"),l=u>=0?c.slice(0,u):c,d=u>=0?c.slice(u+1):"",f=Xo(l,rI),p=cr(d),h=fy(p,t);n[s]=f+"@"+sI(h,t)}r.path=n.join(","),t.skipEscape=!0}else r.path=void 0;let o=r.headers&&typeof r.headers=="object"?Object.assign(Object.create(null),r.headers):Object.create(null);r.subject&&(o.subject=r.subject),r.body&&(o.body=r.body),r.headers=o;let i="",a=0;for(let s in o)a++!==0&&(i+="&"),i+=Xo(s,ay)+"="+Xo(String(o[s]),ay);return a!==0?r.query=i:r.headers=void 0,r}var lI={scheme:"mailto",parse:cI,serialize:uI,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0},es={http:dy,https:Wz,ws:Qa,wss:Xz,urn:Yz,"urn:uuid":Qz,mailto:lI};Object.setPrototypeOf(es,null);function zp(e){return e&&(es[e]||es[e.toLowerCase()])||void 0}my.exports={wsIsSecure:Sp,SCHEMES:es,isValidSchemeName:Lz,getSchemeHandler:zp}});var Ty=z((wC,os)=>{"use strict";var{normalizeIPv6:$y,removeDotSegments:Qo,recomposeAuthority:dI,normalizePercentEncoding:by,normalizePathEncoding:pI,serializePathEncoding:gy,normalizeQueryFragmentEncoding:vy,encodeQuery:fI,encodeFragment:mI,reescapeHostDelimiters:hI,isIPv4:xy,nonSimpleDomain:gI}=xp(),{SCHEMES:ky,getSchemeHandler:Ip}=hy(),wy=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Sy="URI scheme is malformed.";function yy(e){let t=unescape(String(e));if(!wy.test(t))throw new TypeError(Sy);return t}function vI(e,t){return typeof e=="string"?e=SI(e,t):typeof e=="object"&&(e=ns(Tr(e,t),t)),e}function yI(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:i,malformedPercentEncoding:a,malformedSchemeSpecific:s,malformedHost:c,malformedScheme:u}=rs(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:h,malformedScheme:g}=rs(t,n);if(i||d||a||f||s||p||c||h||u||g)throw new Error(o.error||l.error||"URI is malformed.");let y=zy(o,l,n,!0),$=Ip(r&&r.scheme||y.scheme),k=y.host,x=k!==void 0&&k!==""&&(xy(k)||$y(k).isIPV6);Iy(y,r||{},$,x);let D=k&&k.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(k);if(y.error&&!D)throw new Error(y.error);return n.skipEscape=!0,Tr(y,n)}function zy(e,t,r,n){let o={};return n||(e=ns(Tr(e,r),r),t=ns(Tr(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=Qo(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=Qo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Qo(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=Qo(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 _I(e,t,r){let n=_y(e,r),o=_y(t,r);return n!==void 0&&o!==void 0&&n===o}function Tr(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,to:e.to,subject:e.subject,body:e.body,headers:e.headers,error:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=yy(r.scheme));let i=Ip(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n);let a=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,s=!n.skipEscape&&r.scheme===void 0&&!a;r.path!==void 0&&(n.skipEscape?r.path=by(r.path):r.path=gy(r.path,s)),n.reference!=="suffix"&&r.scheme&&(r.scheme=yy(r.scheme),o.push(r.scheme,":"));let c=dI(r);if(c!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(c),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(u=Qo(u)),s&&(u=gy(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",fI(r.query)),r.fragment!==void 0&&o.push("#",mI(r.fragment)),o.join("")}var $I=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,bI=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,xI=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function kI(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 Yo(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Pp(e){return e[0]==="["&&e[e.length-1]==="]"}function wI(e){let t=e[4];return Yo(e[3])||t!==void 0&&!Pp(t)&&Yo(t)||Yo(e[6])||Yo(e[7])||Yo(e[8])}function Iy(e,t,r,n){let o=e.host&&e.host[0]==="["&&e.host[e.host.length-1]==="]";if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Pp(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&!o&&gI(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(i){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+i,!0}return!1}function rs(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,i=!1,a=!1,s=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(bI);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let f=e.match(xI);if(f!==null){let h=f[1],g=h.replace(/[\t\n\r]/g,"");g.length>=2&&(g.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):h.length!==g.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let p=e.match($I);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||"",n.query=p[7],n.fragment=p[8],n.scheme!==void 0){let y=unescape(n.scheme);wy.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||Sy,u=!0)}i=wI(p),i&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=p[5]);let h=kI(n,p);if(h!==void 0&&(n.error=n.error||h,o=!0),n.host)if(xy(n.host)===!1){let $=Pp(n.host),k=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,x=$y(n.host);l=x.isIPV6||x.isIPVFuture===!0,c=k&&(!$||x.error===!0),n.host=l?x.host:x.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",o=!0)}else l=!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 g=Ip(r.scheme||n.scheme);if(c||(s=Iy(n,r,g,l)),!g||g&&!g.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:by(n.host,!0);n.host=hI(y,l)}n.path&&(n.path=pI(n.path)),n.query&&(n.query=vy(n.query)),n.fragment&&(n.fragment=vy(n.fragment))}g&&g.parse&&(g.parse(n,r),g===ky.urn&&n.nid===void 0&&(a=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:u}}function ns(e,t){return rs(e,t).parsed}function SI(e,t){return Py(e,t).normalized}function Py(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}=rs(e,t);return{normalized:n||o||i||a||s?e:Tr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}}function _y(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Tr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=Py(r,t);return o||i||a||s||c?void 0:n}var Tp={SCHEMES:ky,normalize:vI,resolve:yI,resolveComponent:zy,equal:_I,serialize:Tr,parse:ns};os.exports=Tp;os.exports.default=Tp;os.exports.fastUri=Tp});var Ey=z(jp=>{"use strict";Object.defineProperty(jp,"__esModule",{value:!0});var jy=Ty();jy.code='require("ajv/dist/runtime/uri").default';jp.default=jy});var Uy=z(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.CodeGen=Ie.Name=Ie.nil=Ie.stringify=Ie.str=Ie._=Ie.KeywordCxt=void 0;var zI=Go();Object.defineProperty(Ie,"KeywordCxt",{enumerable:!0,get:function(){return zI.KeywordCxt}});var hn=K();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return hn._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return hn.str}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return hn.stringify}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return hn.nil}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return hn.Name}});Object.defineProperty(Ie,"CodeGen",{enumerable:!0,get:function(){return hn.CodeGen}});var II=Wa(),Zy=Wo(),PI=Wd(),ei=Ya(),TI=K(),ti=Ho(),is=Jo(),Op=ee(),Oy=Qv(),jI=Ey(),Ay=(e,t)=>new RegExp(e,t);Ay.code="new RegExp";var EI=["removeAdditional","useDefaults","coerceTypes"],OI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),DI={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."},NI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Dy=200;function RI(e){var t,r,n,o,i,a,s,c,u,l,d,f,p,h,g,y,$,k,x,D,O,dt,pt,Ps,Ts;let Sn=e.strict,js=(t=e.code)===null||t===void 0?void 0:t.optimize,Nf=js===!0||js===void 0?1:js||0,Rf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Ay,p$=(o=e.uriResolver)!==null&&o!==void 0?o:jI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Sn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Sn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Sn)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:Sn)!==null&&f!==void 0?f:"log",strictRequired:(h=(p=e.strictRequired)!==null&&p!==void 0?p:Sn)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:Nf,regExp:Rf}:{optimize:Nf,regExp:Rf},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Dy,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:Dy,meta:($=e.meta)!==null&&$!==void 0?$:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(D=e.schemaId)!==null&&D!==void 0?D:"$id",addUsedSchema:(O=e.addUsedSchema)!==null&&O!==void 0?O:!0,validateSchema:(dt=e.validateSchema)!==null&&dt!==void 0?dt:!0,validateFormats:(pt=e.validateFormats)!==null&&pt!==void 0?pt:!0,unicodeRegExp:(Ps=e.unicodeRegExp)!==null&&Ps!==void 0?Ps:!0,int32range:(Ts=e.int32range)!==null&&Ts!==void 0?Ts:!0,uriResolver:p$}}var ri=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...RI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new TI.ValueScope({scope:{},prefixes:OI,es5:r,lines:n}),this.logger=FI(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,PI.getRules)(),Ny.call(this,DI,t,"NOT SUPPORTED"),Ny.call(this,NI,t,"DEPRECATED","warn"),this._metaOpts=UI.call(this),t.formats&&AI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&CI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),ZI.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Oy;n==="id"&&(o={...Oy},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 i.call(this,l.$schema);let f=this._addSchema(l,d);return f.validate||a.call(this,f)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Zy.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({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 i.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 a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,ti.normalizeId)(r||i),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 i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(t){let r;for(;typeof(r=Ry.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new ei.SchemaEnv({schema:{},schemaId:n});if(r=ei.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=Ry.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,ti.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(LI.call(this,n,r),!r)return(0,Op.eachItem)(n,i=>Ep.call(this,i)),this;JI.call(this,r);let o={...r,type:(0,is.getJSONTypes)(r.type),schemaType:(0,is.getJSONTypes)(r.schemaType)};return(0,Op.eachItem)(n,o.type.length===0?i=>Ep.call(this,i,o):i=>o.type.forEach(a=>Ep.call(this,i,o,a))),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(i=>i.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,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=Cy(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,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];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,ti.normalizeId)(a||n);let u=ti.getSchemaRefs.call(this,t,n);return c=new ei.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!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):ei.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{ei.compileSchema.call(this,t)}finally{this.opts=r}}};ri.ValidationError=II.default;ri.MissingRefError=Zy.default;Ie.default=ri;function Ny(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function Ry(e){return e=(0,ti.normalizeId)(e),this.schemas[e]||this.refs[e]}function ZI(){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 AI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function CI(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 UI(){let e={...this.opts};for(let t of EI)delete e[t];return e}var MI={log(){},warn(){},error(){}};function FI(e){if(e===!1)return MI;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 qI=/^[a-z_$][a-z0-9_$:-]*$/i;function LI(e,t){let{RULES:r}=this;if((0,Op.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!qI.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 Ep(e,t,r){var n;let o=t?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,is.getJSONTypes)(t.type),schemaType:(0,is.getJSONTypes)(t.schemaType)}};t.before?VI.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function VI(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 JI(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Cy(t)),e.validateSchema=this.compile(t,!0))}var HI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Cy(e){return{anyOf:[e,HI]}}});var My=z(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var KI={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Dp.default=KI});var Vy=z(jr=>{"use strict";Object.defineProperty(jr,"__esModule",{value:!0});jr.callRef=jr.getValidate=void 0;var BI=Wo(),Fy=ct(),Be=K(),gn=Lt(),qy=Ya(),as=ee(),GI={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=qy.resolveRef.call(c,u,o,r);if(l===void 0)throw new BI.default(n.opts.uriResolver,o,r);if(l instanceof qy.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return ss(e,a,i,i.$async);let h=t.scopeValue("root",{ref:u});return ss(e,(0,Be._)`${h}.validate`,u,u.$async)}function f(h){let g=Ly(e,h);ss(e,g,h,h.$async)}function p(h){let g=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Be.stringify)(h)}:{ref:h}),y=t.name("valid"),$=e.subschema({schema:h,dataTypes:[],schemaPath:Be.nil,topSchemaRef:g,errSchemaPath:r},y);e.mergeEvaluated($),e.ok(y)}}};function Ly(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Be._)`${r.scopeValue("wrapper",{ref:t})}.validate`}jr.getValidate=Ly;function ss(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?gn.default.this:Be.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Be._)`await ${(0,Fy.callValidateCode)(e,t,u)}`),p(t),a||o.assign(h,!0)},g=>{o.if((0,Be._)`!(${g} instanceof ${i.ValidationError})`,()=>o.throw(g)),f(g),a||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,Fy.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(h){let g=(0,Be._)`${h}.errors`;o.assign(gn.default.vErrors,(0,Be._)`${gn.default.vErrors} === null ? ${g} : ${gn.default.vErrors}.concat(${g})`),o.assign(gn.default.errors,(0,Be._)`${gn.default.vErrors}.length`)}function p(h){var g;if(!i.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(i.props=as.mergeEvaluated.props(o,y.props,i.props));else{let $=o.var("props",(0,Be._)`${h}.evaluated.props`);i.props=as.mergeEvaluated.props(o,$,i.props,Be.Name)}if(i.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(i.items=as.mergeEvaluated.items(o,y.items,i.items));else{let $=o.var("items",(0,Be._)`${h}.evaluated.items`);i.items=as.mergeEvaluated.items(o,$,i.items,Be.Name)}}}jr.callRef=ss;jr.default=GI});var Jy=z(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var WI=My(),XI=Vy(),YI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",WI.default,XI.default];Np.default=YI});var Hy=z(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var cs=K(),ur=cs.operators,us={maximum:{okStr:"<=",ok:ur.LTE,fail:ur.GT},minimum:{okStr:">=",ok:ur.GTE,fail:ur.LT},exclusiveMaximum:{okStr:"<",ok:ur.LT,fail:ur.GTE},exclusiveMinimum:{okStr:">",ok:ur.GT,fail:ur.LTE}},QI={message:({keyword:e,schemaCode:t})=>(0,cs.str)`must be ${us[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,cs._)`{comparison: ${us[e].okStr}, limit: ${t}}`},eP={keyword:Object.keys(us),type:"number",schemaType:"number",$data:!0,error:QI,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,cs._)`${r} ${us[t].fail} ${n} || isNaN(${r})`)}};Rp.default=eP});var Ky=z(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var ni=K(),tP={message:({schemaCode:e})=>(0,ni.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ni._)`{multipleOf: ${e}}`},rP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:tP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,ni._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,ni._)`${a} !== parseInt(${a})`;e.fail$data((0,ni._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Zp.default=rP});var Gy=z(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});function By(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}Ap.default=By;By.code='require("ajv/dist/runtime/ucs2length").default'});var Wy=z(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var Er=K(),nP=ee(),oP=Gy(),iP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Er.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Er._)`{limit: ${e}}`},aP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:iP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Er.operators.GT:Er.operators.LT,a=o.opts.unicode===!1?(0,Er._)`${r}.length`:(0,Er._)`${(0,nP.useFunc)(e.gen,oP.default)}(${r})`;e.fail$data((0,Er._)`${a} ${i} ${n}`)}};Cp.default=aP});var Xy=z(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var sP=ct(),cP=ee(),vn=K(),uP={message:({schemaCode:e})=>(0,vn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,vn._)`{pattern: ${e}}`},lP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:uP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,vn._)`new RegExp`:(0,cP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,vn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,vn._)`!${l}`)}else{let c=(0,sP.usePattern)(e,o);e.fail$data((0,vn._)`!${c}.test(${r})`)}}};Up.default=lP});var Yy=z(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var oi=K(),dP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,oi.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,oi._)`{limit: ${e}}`},pP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:dP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?oi.operators.GT:oi.operators.LT;e.fail$data((0,oi._)`Object.keys(${r}).length ${o} ${n}`)}};Mp.default=pP});var Qy=z(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var ii=ct(),ai=K(),fP=ee(),mP={message:({params:{missingProperty:e}})=>(0,ai.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,ai._)`{missingProperty: ${e}}`},hP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:mP,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let p=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if(p?.[g]===void 0&&!h.has(g)){let y=a.schemaEnv.baseId+a.errSchemaPath,$=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,fP.checkStrictMode)(a,$,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(ai.nil,d);else for(let p of r)(0,ii.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||i){let h=t.let("valid",!0);e.block$data(h,()=>f(p,h)),e.ok(h)}else t.if((0,ii.checkMissingProp)(e,r,p)),(0,ii.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,ii.noPropertyInData)(t,o,p,s.ownProperties),()=>e.error())})}function f(p,h){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(h,(0,ii.propertyInData)(t,o,p,s.ownProperties)),t.if((0,ai.not)(h),()=>{e.error(),t.break()})},ai.nil)}}};Fp.default=hP});var e_=z(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var si=K(),gP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,si.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,si._)`{limit: ${e}}`},vP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:gP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?si.operators.GT:si.operators.LT;e.fail$data((0,si._)`${r}.length ${o} ${n}`)}};qp.default=vP});var ls=z(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var t_=op();t_.code='require("ajv/dist/runtime/equal").default';Lp.default=t_});var r_=z(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var Vp=Jo(),Pe=K(),yP=ee(),_P=ls(),$P={message:({params:{i:e,j:t}})=>(0,Pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Pe._)`{i: ${e}, j: ${t}}`},bP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$P,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,Vp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Pe._)`${a} === false`),e.ok(c);function l(){let h=t.let("i",(0,Pe._)`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(c,!0),t.if((0,Pe._)`${h} > 1`,()=>(d()?f:p)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function f(h,g){let y=t.name("item"),$=(0,Vp.checkDataTypes)(u,y,s.opts.strictNumbers,Vp.DataType.Wrong),k=t.const("indices",(0,Pe._)`{}`);t.for((0,Pe._)`;${h}--;`,()=>{t.let(y,(0,Pe._)`${r}[${h}]`),t.if($,(0,Pe._)`continue`),u.length>1&&t.if((0,Pe._)`typeof ${y} == "string"`,(0,Pe._)`${y} += "_"`),t.if((0,Pe._)`typeof ${k}[${y}] == "number"`,()=>{t.assign(g,(0,Pe._)`${k}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,Pe._)`${k}[${y}] = ${h}`)})}function p(h,g){let y=(0,yP.useFunc)(t,_P.default),$=t.name("outer");t.label($).for((0,Pe._)`;${h}--;`,()=>t.for((0,Pe._)`${g} = ${h}; ${g}--;`,()=>t.if((0,Pe._)`${y}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break($)})))}}};Jp.default=bP});var n_=z(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var Hp=K(),xP=ee(),kP=ls(),wP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Hp._)`{allowedValue: ${e}}`},SP={keyword:"const",$data:!0,error:wP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Hp._)`!${(0,xP.useFunc)(t,kP.default)}(${r}, ${o})`):e.fail((0,Hp._)`${i} !== ${r}`)}};Kp.default=SP});var o_=z(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var ci=K(),zP=ee(),IP=ls(),PP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,ci._)`{allowedValues: ${e}}`},TP={keyword:"enum",schemaType:"array",$data:!0,error:PP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,zP.useFunc)(t,IP.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let p=t.const("vSchema",i);l=(0,ci.or)(...o.map((h,g)=>f(p,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,p=>t.if((0,ci._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,h){let g=o[h];return typeof g=="object"&&g!==null?(0,ci._)`${u()}(${r}, ${p}[${h}])`:(0,ci._)`${r} === ${g}`}}};Bp.default=TP});var i_=z(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var jP=Hy(),EP=Ky(),OP=Wy(),DP=Xy(),NP=Yy(),RP=Qy(),ZP=e_(),AP=r_(),CP=n_(),UP=o_(),MP=[jP.default,EP.default,OP.default,DP.default,NP.default,RP.default,ZP.default,AP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},CP.default,UP.default];Gp.default=MP});var Xp=z(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.validateAdditionalItems=void 0;var Or=K(),Wp=ee(),FP={message:({params:{len:e}})=>(0,Or.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Or._)`{limit: ${e}}`},qP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:FP,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Wp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}a_(e,n)}};function a_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Or._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Or._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Wp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Or._)`${s} <= ${t.length}`);r.if((0,Or.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Wp.Type.Num},u),a.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}ui.validateAdditionalItems=a_;ui.default=qP});var Yp=z(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.validateTuple=void 0;var s_=K(),ds=ee(),LP=ct(),VP={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return c_(e,"additionalItems",t);r.items=!0,!(0,ds.alwaysValidSchema)(r,t)&&e.ok((0,LP.validateArray)(e))}};function c_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=ds.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,s_._)`${i}.length`);r.forEach((d,f)=>{(0,ds.alwaysValidSchema)(s,d)||(n.if((0,s_._)`${u} > ${f}`,()=>e.subschema({keyword:a,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=s,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(f.strictTuples&&!g){let y=`"${a}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,ds.checkStrictMode)(s,y,f.strictTuples)}}}li.validateTuple=c_;li.default=VP});var u_=z(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var JP=Yp(),HP={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,JP.validateTuple)(e,"items")};Qp.default=HP});var d_=z(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var l_=K(),KP=ee(),BP=ct(),GP=Xp(),WP={message:({params:{len:e}})=>(0,l_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,l_._)`{limit: ${e}}`},XP={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:WP,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,KP.alwaysValidSchema)(n,t)&&(o?(0,GP.validateAdditionalItems)(e,o):e.ok((0,BP.validateArray)(e)))}};ef.default=XP});var p_=z(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var lt=K(),ps=ee(),YP={message:({params:{min:e,max:t}})=>t===void 0?(0,lt.str)`must contain at least ${e} valid item(s)`:(0,lt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,lt._)`{minContains: ${e}}`:(0,lt._)`{minContains: ${e}, maxContains: ${t}}`},QP={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:YP,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,lt._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,ps.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,ps.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,ps.alwaysValidSchema)(i,r)){let g=(0,lt._)`${l} >= ${a}`;s!==void 0&&(g=(0,lt._)`${g} && ${l} <= ${s}`),e.pass(g);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?p(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,lt._)`${o}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let g=t.name("_valid"),y=t.let("count",0);p(g,()=>t.if(g,()=>h(y)))}function p(g,y){t.forRange("i",0,l,$=>{e.subschema({keyword:"contains",dataProp:$,dataPropType:ps.Type.Num,compositeRule:!0},g),y()})}function h(g){t.code((0,lt._)`${g}++`),s===void 0?t.if((0,lt._)`${g} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,lt._)`${g} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,lt._)`${g} >= ${a}`,()=>t.assign(d,!0)))}}};tf.default=QP});var h_=z(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateSchemaDeps=It.validatePropertyDeps=It.error=void 0;var rf=K(),eT=ee(),di=ct();It.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,rf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,rf._)`{property: ${e},
|
|
7
7
|
missingProperty: ${n},
|
|
8
8
|
depsCount: ${t},
|
|
9
|
-
deps: ${r}}`};var rP={keyword:"dependencies",type:"object",schemaType:"object",error:St.error,code(e){let[t,r]=nP(e);Ry(e,t),Uy(e,r)}};function nP({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 Ry(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,ii.propertyInData)(r,n,a,o.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,ii.checkReportMissingProp)(e,u)}):(r.if((0,Mp._)`${c} && (${(0,ii.checkMissingProp)(e,s,i)})`),(0,ii.reportMissingProp)(e,i),r.else())}}St.validatePropertyDeps=Ry;function Uy(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,tP.alwaysValidSchema)(i,t[s])||(r.if((0,ii.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}St.validateSchemaDeps=Uy;St.default=rP});var My=w(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var Cy=B(),oP=ee(),iP={message:"property name must be valid",params:({params:e})=>(0,Cy._)`{propertyName: ${e.propertyName}}`},aP={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:iP,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,oP.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,Cy.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};qp.default=aP});var Fp=w(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var is=it(),vt=B(),sP=Mt(),as=ee(),cP={message:"must NOT have additional properties",params:({params:e})=>(0,vt._)`{additionalProperty: ${e.additionalProperty}}`},uP={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:cP,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,as.alwaysValidSchema)(a,r))return;let u=(0,is.allSchemaProperties)(n.properties),l=(0,is.allSchemaProperties)(n.patternProperties);d(),e.ok((0,vt._)`${i} === ${sP.default.errors}`);function d(){t.forIn("key",o,$=>{!u.length&&!l.length?h($):t.if(m($),()=>h($))})}function m($){let k;if(u.length>8){let O=(0,as.schemaRefOrVal)(a,n.properties,"properties");k=(0,is.isOwnProperty)(t,O,$)}else u.length?k=(0,vt.or)(...u.map(O=>(0,vt._)`${$} === ${O}`)):k=vt.nil;return l.length&&(k=(0,vt.or)(k,...l.map(O=>(0,vt._)`${(0,is.usePattern)(e,O)}.test(${$})`))),(0,vt.not)(k)}function p($){t.code((0,vt._)`delete ${o}[${$}]`)}function h($){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p($);return}if(r===!1){e.setParams({additionalProperty:$}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,as.alwaysValidSchema)(a,r)){let k=t.name("valid");c.removeAdditional==="failing"?(v($,k,!1),t.if((0,vt.not)(k),()=>{e.reset(),p($)})):(v($,k),s||t.if((0,vt.not)(k),()=>t.break()))}}function v($,k,O){let P={keyword:"additionalProperties",dataProp:$,dataPropType:as.Type.Str};O===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(P,k)}}};Lp.default=uP});var Fy=w(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var lP=Jo(),qy=it(),Vp=ee(),Ly=Fp(),dP={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Ly.default.code(new lP.KeywordCxt(i,Ly.default,"additionalProperties"));let a=(0,qy.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Vp.mergeEvaluated.props(t,(0,Vp.toHash)(a),i.props));let s=a.filter(d=>!(0,Vp.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,qy.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Jp.default=dP});var By=w(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var Vy=it(),ss=B(),Jy=ee(),Ky=ee(),pP={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,Vy.allSchemaProperties)(r),c=s.filter(v=>(0,Jy.alwaysValidSchema)(i,r[v]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof ss.Name)&&(i.props=(0,Ky.evaluatedPropsToName)(t,i.props));let{props:d}=i;m();function m(){for(let v of s)u&&p(v),i.allErrors?h(v):(t.var(l,!0),h(v),t.if(l))}function p(v){for(let $ in u)new RegExp(v).test($)&&(0,Jy.checkStrictMode)(i,`property ${$} matches pattern ${v} (use allowMatchingProperties)`)}function h(v){t.forIn("key",n,$=>{t.if((0,ss._)`${(0,Vy.usePattern)(e,v)}.test(${$})`,()=>{let k=c.includes(v);k||e.subschema({keyword:"patternProperties",schemaProp:v,dataProp:$,dataPropType:Ky.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,ss._)`${d}[${$}]`,!0):!k&&!i.allErrors&&t.if((0,ss.not)(l),()=>t.break())})})}}};Kp.default=pP});var Hy=w(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var fP=ee(),mP={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,fP.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"}};Bp.default=mP});var Gy=w(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var hP=it(),gP={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:hP.validateUnion,error:{message:"must match a schema in anyOf"}};Hp.default=gP});var Wy=w(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var cs=B(),vP=ee(),yP={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,cs._)`{passingSchemas: ${e.passing}}`},_P={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:yP,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 i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let m;(0,vP.alwaysValidSchema)(o,l)?t.var(c,!0):m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,cs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,cs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),m&&e.mergeEvaluated(m,cs.Name)})})}}};Gp.default=_P});var Xy=w(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var $P=ee(),bP={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((i,a)=>{if((0,$P.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};Wp.default=bP});var e_=w(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var us=B(),Qy=ee(),xP={message:({params:e})=>(0,us.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,us._)`{failingKeyword: ${e.ifClause}}`},kP={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:xP,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Qy.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Yy(n,"then"),i=Yy(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,us.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let m=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(m,a),d?t.assign(d,(0,us._)`${l}`):e.setParams({ifClause:l})}}}};function Yy(e,t){let r=e.schema[t];return r!==void 0&&!(0,Qy.alwaysValidSchema)(e,r)}Xp.default=kP});var t_=w(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var wP=ee(),SP={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,wP.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};Yp.default=SP});var r_=w(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var zP=Zp(),IP=Oy(),PP=Rp(),TP=Dy(),jP=Zy(),EP=Ay(),OP=My(),NP=Fp(),DP=Fy(),ZP=By(),RP=Hy(),UP=Gy(),AP=Wy(),CP=Xy(),MP=e_(),qP=t_();function LP(e=!1){let t=[RP.default,UP.default,AP.default,CP.default,MP.default,qP.default,OP.default,NP.default,EP.default,DP.default,ZP.default];return e?t.push(IP.default,TP.default):t.push(zP.default,PP.default),t.push(jP.default),t}Qp.default=LP});var n_=w(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var ge=B(),FP={message:({schemaCode:e})=>(0,ge.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,ge._)`{format: ${e}}`},VP={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:FP,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?m():p();function m(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),v=r.const("fDef",(0,ge._)`${h}[${a}]`),$=r.let("fType"),k=r.let("format");r.if((0,ge._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign($,(0,ge._)`${v}.type || "string"`).assign(k,(0,ge._)`${v}.validate`),()=>r.assign($,(0,ge._)`"string"`).assign(k,v)),e.fail$data((0,ge.or)(O(),P()));function O(){return c.strictSchema===!1?ge.nil:(0,ge._)`${a} && !${k}`}function P(){let C=l.$async?(0,ge._)`(${v}.async ? await ${k}(${n}) : ${k}(${n}))`:(0,ge._)`${k}(${n})`,E=(0,ge._)`(typeof ${k} == "function" ? ${C} : ${k}.test(${n}))`;return(0,ge._)`${k} && ${k} !== true && ${$} === ${t} && !${E}`}}function p(){let h=d.formats[i];if(!h){O();return}if(h===!0)return;let[v,$,k]=P(h);v===t&&e.pass(C());function O(){if(c.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function P(E){let ut=E instanceof RegExp?(0,ge.regexpCode)(E):c.code.formats?(0,ge._)`${c.code.formats}${(0,ge.getProperty)(i)}`:void 0,lt=r.scopeValue("formats",{key:i,ref:E,code:ut});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,ge._)`${lt}.validate`]:["string",E,lt]}function C(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ge._)`await ${k}(${n})`}return typeof $=="function"?(0,ge._)`${k}(${n})`:(0,ge._)`${k}.test(${n})`}}}};ef.default=VP});var o_=w(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var JP=n_(),KP=[JP.default];tf.default=KP});var i_=w(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.contentVocabulary=mn.metadataVocabulary=void 0;mn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];mn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var s_=w(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var BP=my(),HP=Py(),GP=r_(),WP=o_(),a_=i_(),XP=[BP.default,HP.default,(0,GP.default)(),WP.default,a_.metadataVocabulary,a_.contentVocabulary];rf.default=XP});var u_=w(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});ls.DiscrError=void 0;var c_;(function(e){e.Tag="tag",e.Mapping="mapping"})(c_||(ls.DiscrError=c_={}))});var d_=w(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var hn=B(),nf=u_(),l_=Va(),YP=Ko(),QP=ee(),eT={message:({params:{discrError:e,tagName:t}})=>e===nf.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,hn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},tT={keyword:"discriminator",type:"object",schemaType:"object",error:eT,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,hn._)`${r}${(0,hn.getProperty)(s)}`);t.if((0,hn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:nf.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=m();t.if(!1);for(let h in p)t.elseIf((0,hn._)`${u} === ${h}`),t.assign(c,d(p[h]));t.else(),e.error(!1,{discrError:nf.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let h=t.name("valid"),v=e.subschema({keyword:"oneOf",schemaProp:p},h);return e.mergeEvaluated(v,hn.Name),h}function m(){var p;let h={},v=k(o),$=!0;for(let C=0;C<a.length;C++){let E=a[C];if(E?.$ref&&!(0,QP.schemaHasRulesButRef)(E,i.self.RULES)){let lt=E.$ref;if(E=l_.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,lt),E instanceof l_.SchemaEnv&&(E=E.schema),E===void 0)throw new YP.default(i.opts.uriResolver,i.baseId,lt)}let ut=(p=E?.properties)===null||p===void 0?void 0:p[s];if(typeof ut!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);$=$&&(v||k(E)),O(ut,C)}if(!$)throw new Error(`discriminator: "${s}" must be required`);return h;function k({required:C}){return Array.isArray(C)&&C.includes(s)}function O(C,E){if(C.const)P(C.const,E);else if(C.enum)for(let ut of C.enum)P(ut,E);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function P(C,E){if(typeof C!="string"||C in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[C]=E}}}};of.default=tT});var p_=w((sU,rT)=>{rT.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 sf=w((he,af)=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.MissingRefError=he.ValidationError=he.CodeGen=he.Name=he.nil=he.stringify=he.str=he._=he.KeywordCxt=he.Ajv=void 0;var nT=cy(),oT=s_(),iT=d_(),f_=p_(),aT=["/properties"],ds="http://json-schema.org/draft-07/schema",gn=class extends nT.default{_addVocabularies(){super._addVocabularies(),oT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(iT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(f_,aT):f_;this.addMetaSchema(t,ds,!1),this.refs["http://json-schema.org/schema"]=ds}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ds)?ds:void 0)}};he.Ajv=gn;af.exports=he=gn;af.exports.Ajv=gn;Object.defineProperty(he,"__esModule",{value:!0});he.default=gn;var sT=Jo();Object.defineProperty(he,"KeywordCxt",{enumerable:!0,get:function(){return sT.KeywordCxt}});var vn=B();Object.defineProperty(he,"_",{enumerable:!0,get:function(){return vn._}});Object.defineProperty(he,"str",{enumerable:!0,get:function(){return vn.str}});Object.defineProperty(he,"stringify",{enumerable:!0,get:function(){return vn.stringify}});Object.defineProperty(he,"nil",{enumerable:!0,get:function(){return vn.nil}});Object.defineProperty(he,"Name",{enumerable:!0,get:function(){return vn.Name}});Object.defineProperty(he,"CodeGen",{enumerable:!0,get:function(){return vn.CodeGen}});var cT=La();Object.defineProperty(he,"ValidationError",{enumerable:!0,get:function(){return cT.default}});var uT=Ko();Object.defineProperty(he,"MissingRefError",{enumerable:!0,get:function(){return uT.default}})});var b_=w(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.formatNames=It.fastFormats=It.fullFormats=void 0;function zt(e,t){return{validate:e,compare:t}}It.fullFormats={date:zt(v_,df),time:zt(uf(!0),pf),"date-time":zt(m_(!0),__),"iso-time":zt(uf(),y_),"iso-date-time":zt(m_(),$_),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:hT,"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:xT,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:gT,int32:{type:"number",validate:_T},int64:{type:"number",validate:$T},float:{type:"number",validate:g_},double:{type:"number",validate:g_},password:!0,binary:!0};It.fastFormats={...It.fullFormats,date:zt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,df),time:zt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,pf),"date-time":zt(/^\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,__),"iso-time":zt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,y_),"iso-date-time":zt(/^\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,$_),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};It.formatNames=Object.keys(It.fullFormats);function lT(e){return e%4===0&&(e%100!==0||e%400===0)}var dT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,pT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function v_(e){let t=dT.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&&lT(r)?29:pT[n])}function df(e,t){if(e&&t)return e>t?1:e<t?-1:0}var cf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function uf(e){return function(r){let n=cf.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&a<61}}function pf(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 y_(e,t){if(!(e&&t))return;let r=cf.exec(e),n=cf.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 lf=/t|\s/i;function m_(e){let t=uf(e);return function(n){let o=n.split(lf);return o.length===2&&v_(o[0])&&t(o[1])}}function __(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function $_(e,t){if(!(e&&t))return;let[r,n]=e.split(lf),[o,i]=t.split(lf),a=df(r,o);if(a!==void 0)return a||pf(n,i)}var fT=/\/|:/,mT=/^(?:[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 hT(e){return fT.test(e)&&mT.test(e)}var h_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function gT(e){return h_.lastIndex=0,h_.test(e)}var vT=-(2**31),yT=2**31-1;function _T(e){return Number.isInteger(e)&&e<=yT&&e>=vT}function $T(e){return Number.isInteger(e)}function g_(){return!0}var bT=/[^\\]\\Z/;function xT(e){if(bT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var x_=w(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.formatLimitDefinition=void 0;var kT=sf(),yt=B(),ar=yt.operators,ps={formatMaximum:{okStr:"<=",ok:ar.LTE,fail:ar.GT},formatMinimum:{okStr:">=",ok:ar.GTE,fail:ar.LT},formatExclusiveMaximum:{okStr:"<",ok:ar.LT,fail:ar.GTE},formatExclusiveMinimum:{okStr:">",ok:ar.GT,fail:ar.LTE}},wT={message:({keyword:e,schemaCode:t})=>(0,yt.str)`should be ${ps[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,yt._)`{comparison: ${ps[e].okStr}, limit: ${t}}`};yn.formatLimitDefinition={keyword:Object.keys(ps),type:"string",schemaType:"string",$data:!0,error:wT,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new kT.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,yt._)`${m}[${c.schemaCode}]`);e.fail$data((0,yt.or)((0,yt._)`typeof ${p} != "object"`,(0,yt._)`${p} instanceof RegExp`,(0,yt._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let m=c.schema,p=s.formats[m];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let h=t.scopeValue("formats",{key:m,ref:p,code:a.code.formats?(0,yt._)`${a.code.formats}${(0,yt.getProperty)(m)}`:void 0});e.fail$data(d(h))}function d(m){return(0,yt._)`${m}.compare(${r}, ${n}) ${ps[o].fail} 0`}},dependencies:["format"]};var ST=e=>(e.addKeyword(yn.formatLimitDefinition),e);yn.default=ST});var z_=w((ai,S_)=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});var _n=b_(),zT=x_(),ff=B(),k_=new ff.Name("fullFormats"),IT=new ff.Name("fastFormats"),mf=(e,t={keywords:!0})=>{if(Array.isArray(t))return w_(e,t,_n.fullFormats,k_),e;let[r,n]=t.mode==="fast"?[_n.fastFormats,IT]:[_n.fullFormats,k_],o=t.formats||_n.formatNames;return w_(e,o,r,n),t.keywords&&(0,zT.default)(e),e};mf.get=(e,t="full")=>{let n=(t==="fast"?_n.fastFormats:_n.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function w_(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,ff._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}S_.exports=ai=mf;Object.defineProperty(ai,"__esModule",{value:!0});ai.default=mf});var Ye=sr(require("path")),O_=sr(require("fs"));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 i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Y||(Y={}));var _f;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(_f||(_f={}));var S=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pt=e=>{switch(typeof e){case"undefined":return S.undefined;case"string":return S.string;case"number":return Number.isNaN(e)?S.nan:S.number;case"boolean":return S.boolean;case"function":return S.function;case"bigint":return S.bigint;case"symbol":return S.symbol;case"object":return Array.isArray(e)?S.array:e===null?S.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?S.promise:typeof Map<"u"&&e instanceof Map?S.map:typeof Set<"u"&&e instanceof Set?S.set:typeof Date<"u"&&e instanceof Date?S.date:S.object;default:return S.unknown}};var y=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"]);var Je=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(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[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=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Je.create=e=>new Je(e);var M_=(e,t)=>{let r;switch(e.code){case y.invalid_type:e.received===S.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case y.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Y.jsonStringifyReplacer)}`;break;case y.unrecognized_keys:r=`Unrecognized key(s) in object: ${Y.joinValues(e.keys,", ")}`;break;case y.invalid_union:r="Invalid input";break;case y.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Y.joinValues(e.options)}`;break;case y.invalid_enum_value:r=`Invalid enum value. Expected ${Y.joinValues(e.options)}, received '${e.received}'`;break;case y.invalid_arguments:r="Invalid function arguments";break;case y.invalid_return_type:r="Invalid function return type";break;case y.invalid_date:r="Invalid date";break;case y.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 y.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 y.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 y.custom:r="Invalid input";break;case y.invalid_intersection_types:r="Intersection results could not be merged";break;case y.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case y.not_finite:r="Number must be finite";break;default:r=t.defaultError,Y.assertNever(e)}return{message:r}},Lt=M_;var q_=Lt;function kn(){return q_}var si=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function b(e,t){let r=kn(),n=si({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Lt?void 0:Lt].filter(o=>!!o)});e.common.issues.push(n)}var Ie=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 U;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 i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return U;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},U=Object.freeze({status:"aborted"}),Tr=e=>({status:"dirty",value:e}),Ne=e=>({status:"valid",value:e}),ks=e=>e.status==="aborted",ws=e=>e.status==="dirty",cr=e=>e.status==="valid",wn=e=>typeof Promise<"u"&&e instanceof Promise;var I;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(I||(I={}));var Qe=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}},$f=(e,t)=>{if(cr(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 Je(e.common.issues);return this._error=r,this._error}}};function F(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:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var H=class{get description(){return this._def.description}_getType(t){return Pt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Pt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Ie,ctx:{common:t.parent.common,data:t.data,parsedType:Pt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(wn(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:Pt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return $f(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Pt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return cr(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=>cr(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:Pt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(wn(o)?o:Promise.resolve(o));return $f(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:y.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!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 pt({schema:this,typeName:N.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 Et.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vt.create(this)}promise(){return ur.create(this,this._def)}or(t){return Dr.create([this,t],this._def)}and(t){return Zr.create(this,t,this._def)}transform(t){return new pt({...F(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Mr({...F(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new ci({typeName:N.ZodBranded,type:this,...F(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new qr({...F(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ui.create(this,t)}readonly(){return Lr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},L_=/^c[^\s-]{8,}$/i,F_=/^[0-9a-z]+$/,V_=/^[0-9A-HJKMNP-TV-Z]{26}$/i,J_=/^[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,K_=/^[a-z0-9_-]{21}$/i,B_=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,H_=/^[-+]?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)?)??$/,G_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,W_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ss,X_=/^(?:(?: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])$/,Y_=/^(?:(?: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])$/,Q_=/^(([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]))$/,e$=/^(([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])$/,t$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,r$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bf="((\\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])))",n$=new RegExp(`^${bf}$`);function xf(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 o$(e){return new RegExp(`^${xf(e)}$`)}function i$(e){let t=`${bf}T${xf(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 a$(e,t){return!!((t==="v4"||!t)&&X_.test(e)||(t==="v6"||!t)&&Q_.test(e))}function s$(e,t){if(!B_.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 c$(e,t){return!!((t==="v4"||!t)&&Y_.test(e)||(t==="v6"||!t)&&e$.test(e))}var Er=class e extends H{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==S.string){let i=this._getOrReturnCtx(t);return b(i,{code:y.invalid_type,expected:S.string,received:i.parsedType}),U}let n=new Ie,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),b(o,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),b(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?b(o,{code:y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&b(o,{code:y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")G_.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"email",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ss||(Ss=new RegExp(W_,"u")),Ss.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"emoji",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")J_.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"uuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")K_.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"nanoid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")L_.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"cuid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")F_.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"cuid2",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")V_.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"ulid",code:y.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),b(o,{validation:"url",code:y.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"regex",code:y.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),b(o,{code:y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),b(o,{code:y.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),b(o,{code:y.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?i$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{code:y.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?n$.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{code:y.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?o$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{code:y.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?H_.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"duration",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?a$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"ip",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?s$(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"jwt",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?c$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"cidr",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?t$.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"base64",code:y.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?r$.test(t.data)||(o=this._getOrReturnCtx(t,o),b(o,{validation:"base64url",code:y.invalid_string,message:i.message}),n.dirty()):Y.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:y.invalid_string,...I.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...I.errToObj(t)})}url(t){return this._addCheck({kind:"url",...I.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...I.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...I.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...I.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...I.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...I.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...I.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...I.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...I.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...I.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...I.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...I.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,...I.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,...I.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...I.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...I.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...I.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...I.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...I.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...I.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...I.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...I.errToObj(r)})}nonempty(t){return this.min(1,I.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}};Er.create=e=>new Er({checks:[],typeName:N.ZodString,coerce:e?.coerce??!1,...F(e)});function u$(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var Sn=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)!==S.number){let i=this._getOrReturnCtx(t);return b(i,{code:y.invalid_type,expected:S.number,received:i.parsedType}),U}let n,o=new Ie;for(let i of this._def.checks)i.kind==="int"?Y.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),b(n,{code:y.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),b(n,{code:y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),b(n,{code:y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?u$(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),b(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),b(n,{code:y.not_finite,message:i.message}),o.dirty()):Y.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,I.toString(r))}gt(t,r){return this.setLimit("min",t,!1,I.toString(r))}lte(t,r){return this.setLimit("max",t,!0,I.toString(r))}lt(t,r){return this.setLimit("max",t,!1,I.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:I.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:I.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:I.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:I.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.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)}};Sn.create=e=>new Sn({checks:[],typeName:N.ZodNumber,coerce:e?.coerce||!1,...F(e)});var zn=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)!==S.bigint)return this._getInvalidInput(t);let n,o=new Ie;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),b(n,{code:y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),b(n,{code:y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),b(n,{code:y.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Y.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return b(r,{code:y.invalid_type,expected:S.bigint,received:r.parsedType}),U}gte(t,r){return this.setLimit("min",t,!0,I.toString(r))}gt(t,r){return this.setLimit("min",t,!1,I.toString(r))}lte(t,r){return this.setLimit("max",t,!0,I.toString(r))}lt(t,r){return this.setLimit("max",t,!1,I.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:I.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:I.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:I.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}};zn.create=e=>new zn({checks:[],typeName:N.ZodBigInt,coerce:e?.coerce??!1,...F(e)});var In=class extends H{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==S.boolean){let n=this._getOrReturnCtx(t);return b(n,{code:y.invalid_type,expected:S.boolean,received:n.parsedType}),U}return Ne(t.data)}};In.create=e=>new In({typeName:N.ZodBoolean,coerce:e?.coerce||!1,...F(e)});var Pn=class e extends H{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==S.date){let i=this._getOrReturnCtx(t);return b(i,{code:y.invalid_type,expected:S.date,received:i.parsedType}),U}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return b(i,{code:y.invalid_date}),U}let n=new Ie,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),b(o,{code:y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),b(o,{code:y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Y.assertNever(i);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:I.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:I.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}};Pn.create=e=>new Pn({checks:[],coerce:e?.coerce||!1,typeName:N.ZodDate,...F(e)});var Tn=class extends H{_parse(t){if(this._getType(t)!==S.symbol){let n=this._getOrReturnCtx(t);return b(n,{code:y.invalid_type,expected:S.symbol,received:n.parsedType}),U}return Ne(t.data)}};Tn.create=e=>new Tn({typeName:N.ZodSymbol,...F(e)});var Or=class extends H{_parse(t){if(this._getType(t)!==S.undefined){let n=this._getOrReturnCtx(t);return b(n,{code:y.invalid_type,expected:S.undefined,received:n.parsedType}),U}return Ne(t.data)}};Or.create=e=>new Or({typeName:N.ZodUndefined,...F(e)});var Nr=class extends H{_parse(t){if(this._getType(t)!==S.null){let n=this._getOrReturnCtx(t);return b(n,{code:y.invalid_type,expected:S.null,received:n.parsedType}),U}return Ne(t.data)}};Nr.create=e=>new Nr({typeName:N.ZodNull,...F(e)});var jn=class extends H{constructor(){super(...arguments),this._any=!0}_parse(t){return Ne(t.data)}};jn.create=e=>new jn({typeName:N.ZodAny,...F(e)});var Ft=class extends H{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ne(t.data)}};Ft.create=e=>new Ft({typeName:N.ZodUnknown,...F(e)});var $t=class extends H{_parse(t){let r=this._getOrReturnCtx(t);return b(r,{code:y.invalid_type,expected:S.never,received:r.parsedType}),U}};$t.create=e=>new $t({typeName:N.ZodNever,...F(e)});var En=class extends H{_parse(t){if(this._getType(t)!==S.undefined){let n=this._getOrReturnCtx(t);return b(n,{code:y.invalid_type,expected:S.void,received:n.parsedType}),U}return Ne(t.data)}};En.create=e=>new En({typeName:N.ZodVoid,...F(e)});var Vt=class e extends H{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==S.array)return b(r,{code:y.invalid_type,expected:S.array,received:r.parsedType}),U;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(b(r,{code:a?y.too_big:y.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?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&&(b(r,{code:y.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&&(b(r,{code:y.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((a,s)=>o.type._parseAsync(new Qe(r,a,r.path,s)))).then(a=>Ie.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Qe(r,a,r.path,s)));return Ie.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:I.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:I.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:I.toString(r)}})}nonempty(t){return this.min(1,t)}};Vt.create=(e,t)=>new Vt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...F(t)});function jr(e){if(e instanceof Ke){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=dt.create(jr(n))}return new Ke({...e._def,shape:()=>t})}else return e instanceof Vt?new Vt({...e._def,type:jr(e.element)}):e instanceof dt?dt.create(jr(e.unwrap())):e instanceof Et?Et.create(jr(e.unwrap())):e instanceof jt?jt.create(e.items.map(t=>jr(t))):e}var Ke=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)!==S.object){let u=this._getOrReturnCtx(t);return b(u,{code:y.invalid_type,expected:S.object,received:u.parsedType}),U}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof $t&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Qe(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof $t){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(b(o,{code:y.unrecognized_keys,keys:s}),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 s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Qe(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=>Ie.mergeObjectSync(n,u)):Ie.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return I.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:I.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:N.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 jr(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 i=this.shape[n];for(;i instanceof dt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return kf(Y.objectKeys(this.shape))}};Ke.create=(e,t)=>new Ke({shape:()=>e,unknownKeys:"strip",catchall:$t.create(),typeName:N.ZodObject,...F(t)});Ke.strictCreate=(e,t)=>new Ke({shape:()=>e,unknownKeys:"strict",catchall:$t.create(),typeName:N.ZodObject,...F(t)});Ke.lazycreate=(e,t)=>new Ke({shape:e,unknownKeys:"strip",catchall:$t.create(),typeName:N.ZodObject,...F(t)});var Dr=class extends H{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Je(s.ctx.common.issues));return b(r,{code:y.invalid_union,unionErrors:a}),U}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];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"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new Je(c));return b(r,{code:y.invalid_union,unionErrors:s}),U}}get options(){return this._def.options}};Dr.create=(e,t)=>new Dr({options:e,typeName:N.ZodUnion,...F(t)});var Tt=e=>e instanceof Rr?Tt(e.schema):e instanceof pt?Tt(e.innerType()):e instanceof Ur?[e.value]:e instanceof Ar?e.options:e instanceof Cr?Y.objectValues(e.enum):e instanceof Mr?Tt(e._def.innerType):e instanceof Or?[void 0]:e instanceof Nr?[null]:e instanceof dt?[void 0,...Tt(e.unwrap())]:e instanceof Et?[null,...Tt(e.unwrap())]:e instanceof ci||e instanceof Lr?Tt(e.unwrap()):e instanceof qr?Tt(e._def.innerType):[],zs=class e extends H{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==S.object)return b(r,{code:y.invalid_type,expected:S.object,received:r.parsedType}),U;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(b(r,{code:y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),U)}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 i of r){let a=Tt(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:N.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...F(n)})}};function Is(e,t){let r=Pt(e),n=Pt(t);if(e===t)return{valid:!0,data:e};if(r===S.object&&n===S.object){let o=Y.objectKeys(t),i=Y.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=Is(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===S.array&&n===S.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=Is(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===S.date&&n===S.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Zr=class extends H{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(ks(i)||ks(a))return U;let s=Is(i.value,a.value);return s.valid?((ws(i)||ws(a))&&r.dirty(),{status:r.value,value:s.data}):(b(n,{code:y.invalid_intersection_types}),U)};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(([i,a])=>o(i,a)):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}))}};Zr.create=(e,t,r)=>new Zr({left:e,right:t,typeName:N.ZodIntersection,...F(r)});var jt=class e extends H{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.array)return b(n,{code:y.invalid_type,expected:S.array,received:n.parsedType}),U;if(n.data.length<this._def.items.length)return b(n,{code:y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&n.data.length>this._def.items.length&&(b(n,{code:y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new Qe(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Ie.mergeArray(r,a)):Ie.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};jt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new jt({items:e,typeName:N.ZodTuple,rest:null,...F(t)})};var Ps=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!==S.object)return b(n,{code:y.invalid_type,expected:S.object,received:n.parsedType}),U;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Qe(n,s,n.path,s)),value:a._parse(new Qe(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Ie.mergeObjectAsync(r,o):Ie.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:N.ZodRecord,...F(n)}):new e({keyType:Er.create(),valueType:t,typeName:N.ZodRecord,...F(r)})}},On=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!==S.map)return b(n,{code:y.invalid_type,expected:S.map,received:n.parsedType}),U;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new Qe(n,s,n.path,[u,"key"])),value:i._parse(new Qe(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return U;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return U;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};On.create=(e,t,r)=>new On({valueType:t,keyType:e,typeName:N.ZodMap,...F(r)});var Nn=class e extends H{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==S.set)return b(n,{code:y.invalid_type,expected:S.set,received:n.parsedType}),U;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(b(n,{code:y.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&&(b(n,{code:y.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return U;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new Qe(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:I.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:I.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Nn.create=(e,t)=>new Nn({valueType:e,minSize:null,maxSize:null,typeName:N.ZodSet,...F(t)});var Ts=class e extends H{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==S.function)return b(r,{code:y.invalid_type,expected:S.function,received:r.parsedType}),U;function n(s,c){return si({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,kn(),Lt].filter(u=>!!u),issueData:{code:y.invalid_arguments,argumentsError:c}})}function o(s,c){return si({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,kn(),Lt].filter(u=>!!u),issueData:{code:y.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof ur){let s=this;return Ne(async function(...c){let u=new Je([]),l=await s._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let s=this;return Ne(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Je([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Je([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:jt.create(t).rest(Ft.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||jt.create([]).rest(Ft.create()),returns:r||Ft.create(),typeName:N.ZodFunction,...F(n)})}},Rr=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})}};Rr.create=(e,t)=>new Rr({getter:e,typeName:N.ZodLazy,...F(t)});var Ur=class extends H{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return b(r,{received:r.data,code:y.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:t.data}}get value(){return this._def.value}};Ur.create=(e,t)=>new Ur({value:e,typeName:N.ZodLiteral,...F(t)});function kf(e,t){return new Ar({values:e,typeName:N.ZodEnum,...F(t)})}var Ar=class e extends H{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return b(r,{expected:Y.joinValues(n),received:r.parsedType,code:y.invalid_type}),U}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 b(r,{received:r.data,code:y.invalid_enum_value,options:n}),U}return Ne(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})}};Ar.create=kf;var Cr=class extends H{_parse(t){let r=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==S.string&&n.parsedType!==S.number){let o=Y.objectValues(r);return b(n,{expected:Y.joinValues(o),received:n.parsedType,code:y.invalid_type}),U}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Y.objectValues(r);return b(n,{received:n.data,code:y.invalid_enum_value,options:o}),U}return Ne(t.data)}get enum(){return this._def.values}};Cr.create=(e,t)=>new Cr({values:e,typeName:N.ZodNativeEnum,...F(t)});var ur=class extends H{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==S.promise&&r.common.async===!1)return b(r,{code:y.invalid_type,expected:S.promise,received:r.parsedType}),U;let n=r.parsedType===S.promise?r.data:Promise.resolve(r.data);return Ne(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ur.create=(e,t)=>new ur({type:e,typeName:N.ZodPromise,...F(t)});var pt=class extends H{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{b(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return U;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?U:c.status==="dirty"?Tr(c.value):r.value==="dirty"?Tr(c.value):c});{if(r.value==="aborted")return U;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?U:s.status==="dirty"?Tr(s.value):r.value==="dirty"?Tr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);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 s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?U:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?U:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!cr(a))return U;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>cr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):U);Y.assertNever(o)}};pt.create=(e,t,r)=>new pt({schema:e,typeName:N.ZodEffects,effect:t,...F(r)});pt.createWithPreprocess=(e,t,r)=>new pt({schema:t,effect:{type:"preprocess",transform:e},typeName:N.ZodEffects,...F(r)});var dt=class extends H{_parse(t){return this._getType(t)===S.undefined?Ne(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};dt.create=(e,t)=>new dt({innerType:e,typeName:N.ZodOptional,...F(t)});var Et=class extends H{_parse(t){return this._getType(t)===S.null?Ne(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Et.create=(e,t)=>new Et({innerType:e,typeName:N.ZodNullable,...F(t)});var Mr=class extends H{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===S.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Mr.create=(e,t)=>new Mr({innerType:e,typeName:N.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...F(t)});var qr=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 wn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Je(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Je(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};qr.create=(e,t)=>new qr({innerType:e,typeName:N.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...F(t)});var Dn=class extends H{_parse(t){if(this._getType(t)!==S.nan){let n=this._getOrReturnCtx(t);return b(n,{code:y.invalid_type,expected:S.nan,received:n.parsedType}),U}return{status:"valid",value:t.data}}};Dn.create=e=>new Dn({typeName:N.ZodNaN,...F(e)});var ci=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}},ui=class e extends H{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?U:i.status==="dirty"?(r.dirty(),Tr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?U: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:N.ZodPipeline})}},Lr=class extends H{_parse(t){let r=this._def.innerType._parse(t),n=o=>(cr(o)&&(o.value=Object.freeze(o.value)),o);return wn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Lr.create=(e,t)=>new Lr({innerType:e,typeName:N.ZodReadonly,...F(t)});var WT={object:Ke.lazycreate},N;(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"})(N||(N={}));var XT=Er.create,YT=Sn.create,QT=Dn.create,ej=zn.create,tj=In.create,rj=Pn.create,nj=Tn.create,oj=Or.create,ij=Nr.create,aj=jn.create,sj=Ft.create,cj=$t.create,uj=En.create,lj=Vt.create,l$=Ke.create,dj=Ke.strictCreate,pj=Dr.create,fj=zs.create,mj=Zr.create,hj=jt.create,gj=Ps.create,vj=On.create,yj=Nn.create,_j=Ts.create,$j=Rr.create,bj=Ur.create,xj=Ar.create,kj=Cr.create,wj=ur.create,Sj=pt.create,zj=dt.create,Ij=Et.create,Pj=pt.createWithPreprocess,Tj=ui.create;var wf=Object.freeze({status:"aborted"});function f(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let m=l[d];m in s||(s[m]=u[m].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var bt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},lr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},li={};function _e(e){return e&&Object.assign(li,e),li}var _={};xn(_,{BIGINT_FORMAT_RANGES:()=>Cs,Class:()=>Es,NUMBER_FORMAT_RANGES:()=>As,aborted:()=>Ht,allowsEval:()=>Ds,assert:()=>v$,assertEqual:()=>f$,assertIs:()=>h$,assertNever:()=>g$,assertNotEqual:()=>m$,assignProp:()=>Kt,base64ToUint8Array:()=>Of,base64urlToUint8Array:()=>P$,cached:()=>Vr,captureStackTrace:()=>pi,cleanEnum:()=>I$,cleanRegex:()=>Un,clone:()=>De,cloneDef:()=>_$,createTransparentProxy:()=>S$,defineLazy:()=>V,esc:()=>di,escapeRegex:()=>et,extend:()=>Pf,finalizeIssue:()=>Me,floatSafeRemainder:()=>Os,getElementAtPath:()=>$$,getEnumValues:()=>Rn,getLengthableOrigin:()=>Mn,getParsedType:()=>w$,getSizableOrigin:()=>Cn,hexToUint8Array:()=>j$,isObject:()=>dr,isPlainObject:()=>Bt,issue:()=>Jr,joinValues:()=>Z,jsonStringifyReplacer:()=>Fr,merge:()=>z$,mergeDefs:()=>Ot,normalizeParams:()=>x,nullish:()=>Jt,numKeys:()=>k$,objectClone:()=>y$,omit:()=>If,optionalKeys:()=>Us,parsedType:()=>A,partial:()=>jf,pick:()=>zf,prefixIssues:()=>Be,primitiveTypes:()=>Rs,promiseAllObject:()=>b$,propertyKeyTypes:()=>An,randomString:()=>x$,required:()=>Ef,safeExtend:()=>Tf,shallowClone:()=>Zs,slugify:()=>Ns,stringifyPrimitive:()=>R,uint8ArrayToBase64:()=>Nf,uint8ArrayToBase64url:()=>T$,uint8ArrayToHex:()=>E$,unwrapMessage:()=>Zn});function f$(e){return e}function m$(e){return e}function h$(e){}function g$(e){throw new Error("Unexpected value in exhaustive check")}function v$(e){}function Rn(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 Z(e,t="|"){return e.map(r=>R(r)).join(t)}function Fr(e,t){return typeof t=="bigint"?t.toString():t}function Vr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Jt(e){return e==null}function Un(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Os(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var Sf=Symbol("evaluating");function V(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Sf)return n===void 0&&(n=Sf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function y$(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Kt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ot(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function _$(e){return Ot(e._zod.def)}function $$(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function b$(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function x$(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function di(e){return JSON.stringify(e)}function Ns(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var pi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function dr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ds=Vr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Bt(e){if(dr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(dr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Zs(e){return Bt(e)?{...e}:Array.isArray(e)?[...e]:e}function k$(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var w$=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}`)}},An=new Set(["string","number","symbol"]),Rs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function De(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function x(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 S$(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},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 R(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Us(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var As={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]},Cs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function zf(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 i=Ot(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Kt(this,"shape",a),a},checks:[]});return De(e,i)}function If(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 i=Ot(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Kt(this,"shape",a),a},checks:[]});return De(e,i)}function Pf(e,t){if(!Bt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Ot(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Kt(this,"shape",i),i}});return De(e,o)}function Tf(e,t){if(!Bt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Ot(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Kt(this,"shape",n),n}});return De(e,r)}function z$(e,t){let r=Ot(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Kt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return De(e,r)}function jf(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 a=Ot(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Kt(this,"shape",c),c},checks:[]});return De(t,a)}function Ef(e,t,r){let n=Ot(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Kt(this,"shape",i),i}});return De(t,n)}function Ht(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 Be(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Zn(e){return typeof e=="string"?e:e?.message}function Me(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Zn(e.inst?._zod.def?.error?.(e))??Zn(t?.error?.(e))??Zn(r.customError?.(e))??Zn(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Cn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Mn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function A(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 Jr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function I$(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Of(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 Nf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function P$(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Of(t+r)}function T$(e){return Nf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function j$(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 E$(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Es=class{constructor(...t){}};var Df=(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,Fr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fi=f("$ZodError",Df),qn=f("$ZodError",Df,{Parent:Error});function mi(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 hi(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Ln=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new bt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Me(c,i,_e())));throw pi(s,o?.callee),s}return a.value},Fn=Ln(qn),Vn=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Me(c,i,_e())));throw pi(s,o?.callee),s}return a.value},Jn=Vn(qn),Kn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new bt;return i.issues.length?{success:!1,error:new(e??fi)(i.issues.map(a=>Me(a,o,_e())))}:{success:!0,data:i.value}},Kr=Kn(qn),Bn=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>Me(a,o,_e())))}:{success:!0,data:i.value}},Hn=Bn(qn),Zf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ln(e)(t,r,o)};var Rf=e=>(t,r,n)=>Ln(e)(t,r,n);var Uf=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Vn(e)(t,r,o)};var Af=e=>async(t,r,n)=>Vn(e)(t,r,n);var Cf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Kn(e)(t,r,o)};var Mf=e=>(t,r,n)=>Kn(e)(t,r,n);var qf=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bn(e)(t,r,o)};var Lf=e=>async(t,r,n)=>Bn(e)(t,r,n);var tt={};xn(tt,{base64:()=>tc,base64url:()=>gi,bigint:()=>sc,boolean:()=>uc,browserEmail:()=>M$,cidrv4:()=>Qs,cidrv6:()=>ec,cuid:()=>Ms,cuid2:()=>qs,date:()=>nc,datetime:()=>ic,domain:()=>F$,duration:()=>Ks,e164:()=>rc,email:()=>Hs,emoji:()=>Gs,extendedDuration:()=>N$,guid:()=>Bs,hex:()=>V$,hostname:()=>L$,html5Email:()=>U$,idnEmail:()=>C$,integer:()=>cc,ipv4:()=>Ws,ipv6:()=>Xs,ksuid:()=>Vs,lowercase:()=>pc,mac:()=>Ys,md5_base64:()=>K$,md5_base64url:()=>B$,md5_hex:()=>J$,nanoid:()=>Js,null:()=>lc,number:()=>vi,rfc5322Email:()=>A$,sha1_base64:()=>G$,sha1_base64url:()=>W$,sha1_hex:()=>H$,sha256_base64:()=>Y$,sha256_base64url:()=>Q$,sha256_hex:()=>X$,sha384_base64:()=>tb,sha384_base64url:()=>rb,sha384_hex:()=>eb,sha512_base64:()=>ob,sha512_base64url:()=>ib,sha512_hex:()=>nb,string:()=>ac,time:()=>oc,ulid:()=>Ls,undefined:()=>dc,unicodeEmail:()=>Ff,uppercase:()=>fc,uuid:()=>pr,uuid4:()=>D$,uuid6:()=>Z$,uuid7:()=>R$,xid:()=>Fs});var Ms=/^[cC][^\s-]{8,}$/,qs=/^[0-9a-z]+$/,Ls=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Fs=/^[0-9a-vA-V]{20}$/,Vs=/^[A-Za-z0-9]{27}$/,Js=/^[a-zA-Z0-9_-]{21}$/,Ks=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,N$=/^[-+]?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)?)??$/,Bs=/^([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})$/,pr=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)$/,D$=pr(4),Z$=pr(6),R$=pr(7),Hs=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,U$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,A$=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Ff=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,C$=Ff,M$=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,q$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Gs(){return new RegExp(q$,"u")}var Ws=/^(?:(?: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])$/,Xs=/^(([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}|:))$/,Ys=e=>{let t=et(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Qs=/^((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])$/,ec=/^(([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])$/,tc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gi=/^[A-Za-z0-9_-]*$/,L$=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,F$=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,rc=/^\+[1-9]\d{6,14}$/,Vf="(?:(?:\\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])))",nc=new RegExp(`^${Vf}$`);function Jf(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 oc(e){return new RegExp(`^${Jf(e)}$`)}function ic(e){let t=Jf({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(`^${Vf}T(?:${n})$`)}var ac=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},sc=/^-?\d+n?$/,cc=/^-?\d+$/,vi=/^-?\d+(?:\.\d+)?$/,uc=/^(?:true|false)$/i,lc=/^null$/i;var dc=/^undefined$/i;var pc=/^[^A-Z]*$/,fc=/^[^a-z]*$/,V$=/^[0-9a-fA-F]*$/;function Gn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Wn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var J$=/^[0-9a-fA-F]{32}$/,K$=Gn(22,"=="),B$=Wn(22),H$=/^[0-9a-fA-F]{40}$/,G$=Gn(27,"="),W$=Wn(27),X$=/^[0-9a-fA-F]{64}$/,Y$=Gn(43,"="),Q$=Wn(43),eb=/^[0-9a-fA-F]{96}$/,tb=Gn(64,""),rb=Wn(64),nb=/^[0-9a-fA-F]{128}$/,ob=Gn(86,"=="),ib=Wn(86);var se=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Bf={number:"number",bigint:"bigint",object:"date"},mc=f("$ZodCheckLessThan",(e,t)=>{se.init(e,t);let r=Bf[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(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})}}),hc=f("$ZodCheckGreaterThan",(e,t)=>{se.init(e,t);let r=Bf[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(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})}}),Hf=f("$ZodCheckMultipleOf",(e,t)=>{se.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):Os(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})}}),Gf=f("$ZodCheckNumberFormat",(e,t)=>{se.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=As[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=cc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,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}):a.issues.push({input:s,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}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Wf=f("$ZodCheckBigIntFormat",(e,t)=>{se.init(e,t);let[r,n]=Cs[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Xf=f("$ZodCheckMaxSize",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Jt(o)&&o.size!==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;o.size<=t.maximum||n.issues.push({origin:Cn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Yf=f("$ZodCheckMinSize",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Jt(o)&&o.size!==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;o.size>=t.minimum||n.issues.push({origin:Cn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qf=f("$ZodCheckSizeEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Jt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Cn(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),em=f("$ZodCheckMaxLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Jt(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 a=Mn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tm=f("$ZodCheckMinLength",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Jt(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 a=Mn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),rm=f("$ZodCheckLengthEquals",(e,t)=>{var r;se.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Jt(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,i=o.length;if(i===t.length)return;let a=Mn(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Xn=f("$ZodCheckStringFormat",(e,t)=>{var r,n;se.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.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=()=>{})}),nm=f("$ZodCheckRegex",(e,t)=>{Xn.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})}}),om=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=pc),Xn.init(e,t)}),im=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=fc),Xn.init(e,t)}),am=f("$ZodCheckIncludes",(e,t)=>{se.init(e,t);let r=et(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.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})}}),sm=f("$ZodCheckStartsWith",(e,t)=>{se.init(e,t);let r=new RegExp(`^${et(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})}}),cm=f("$ZodCheckEndsWith",(e,t)=>{se.init(e,t);let r=new RegExp(`.*${et(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})}});function Kf(e,t,r){e.issues.length&&t.issues.push(...Be(r,e.issues))}var um=f("$ZodCheckProperty",(e,t)=>{se.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Kf(o,r,t.property));Kf(n,r,t.property)}}),lm=f("$ZodCheckMimeType",(e,t)=>{se.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),dm=f("$ZodCheckOverwrite",(e,t)=>{se.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var yi=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(`
|
|
9
|
+
deps: ${r}}`};var tT={keyword:"dependencies",type:"object",schemaType:"object",error:It.error,code(e){let[t,r]=rT(e);f_(e,t),m_(e,r)}};function rT({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 f_(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,di.propertyInData)(r,n,a,o.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,di.checkReportMissingProp)(e,u)}):(r.if((0,rf._)`${c} && (${(0,di.checkMissingProp)(e,s,i)})`),(0,di.reportMissingProp)(e,i),r.else())}}It.validatePropertyDeps=f_;function m_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,eT.alwaysValidSchema)(i,t[s])||(r.if((0,di.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}It.validateSchemaDeps=m_;It.default=tT});var v_=z(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var g_=K(),nT=ee(),oT={message:"property name must be valid",params:({params:e})=>(0,g_._)`{propertyName: ${e.propertyName}}`},iT={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:oT,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,nT.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,g_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};nf.default=iT});var af=z(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var fs=ct(),$t=K(),aT=Lt(),ms=ee(),sT={message:"must NOT have additional properties",params:({params:e})=>(0,$t._)`{additionalProperty: ${e.additionalProperty}}`},cT={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:sT,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,ms.alwaysValidSchema)(a,r))return;let u=(0,fs.allSchemaProperties)(n.properties),l=(0,fs.allSchemaProperties)(n.patternProperties);d(),e.ok((0,$t._)`${i} === ${aT.default.errors}`);function d(){t.forIn("key",o,y=>{!u.length&&!l.length?h(y):t.if(f(y),()=>h(y))})}function f(y){let $;if(u.length>8){let k=(0,ms.schemaRefOrVal)(a,n.properties,"properties");$=(0,fs.isOwnProperty)(t,k,y)}else u.length?$=(0,$t.or)(...u.map(k=>(0,$t._)`${y} === ${k}`)):$=$t.nil;return l.length&&($=(0,$t.or)($,...l.map(k=>(0,$t._)`${(0,fs.usePattern)(e,k)}.test(${y})`))),(0,$t.not)($)}function p(y){t.code((0,$t._)`delete ${o}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,ms.alwaysValidSchema)(a,r)){let $=t.name("valid");c.removeAdditional==="failing"?(g(y,$,!1),t.if((0,$t.not)($),()=>{e.reset(),p(y)})):(g(y,$),s||t.if((0,$t.not)($),()=>t.break()))}}function g(y,$,k){let x={keyword:"additionalProperties",dataProp:y,dataPropType:ms.Type.Str};k===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,$)}}};of.default=cT});var $_=z(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var uT=Go(),y_=ct(),sf=ee(),__=af(),lT={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&__.default.code(new uT.KeywordCxt(i,__.default,"additionalProperties"));let a=(0,y_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=sf.mergeEvaluated.props(t,(0,sf.toHash)(a),i.props));let s=a.filter(d=>!(0,sf.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,y_.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};cf.default=lT});var w_=z(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var b_=ct(),hs=K(),x_=ee(),k_=ee(),dT={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,b_.allSchemaProperties)(r),c=s.filter(g=>(0,x_.alwaysValidSchema)(i,r[g]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof hs.Name)&&(i.props=(0,k_.evaluatedPropsToName)(t,i.props));let{props:d}=i;f();function f(){for(let g of s)u&&p(g),i.allErrors?h(g):(t.var(l,!0),h(g),t.if(l))}function p(g){for(let y in u)new RegExp(g).test(y)&&(0,x_.checkStrictMode)(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",n,y=>{t.if((0,hs._)`${(0,b_.usePattern)(e,g)}.test(${y})`,()=>{let $=c.includes(g);$||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:k_.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,hs._)`${d}[${y}]`,!0):!$&&!i.allErrors&&t.if((0,hs.not)(l),()=>t.break())})})}}};uf.default=dT});var S_=z(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var pT=ee(),fT={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,pT.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"}};lf.default=fT});var z_=z(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var mT=ct(),hT={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:mT.validateUnion,error:{message:"must match a schema in anyOf"}};df.default=hT});var I_=z(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var gs=K(),gT=ee(),vT={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,gs._)`{passingSchemas: ${e.passing}}`},yT={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:vT,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 i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let f;(0,gT.alwaysValidSchema)(o,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,gs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,gs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),f&&e.mergeEvaluated(f,gs.Name)})})}}};pf.default=yT});var P_=z(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});var _T=ee(),$T={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((i,a)=>{if((0,_T.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};ff.default=$T});var E_=z(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var vs=K(),j_=ee(),bT={message:({params:e})=>(0,vs.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,vs._)`{failingKeyword: ${e.ifClause}}`},xT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:bT,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,j_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=T_(n,"then"),i=T_(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,vs.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let f=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(f,a),d?t.assign(d,(0,vs._)`${l}`):e.setParams({ifClause:l})}}}};function T_(e,t){let r=e.schema[t];return r!==void 0&&!(0,j_.alwaysValidSchema)(e,r)}mf.default=xT});var O_=z(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var kT=ee(),wT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,kT.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};hf.default=wT});var D_=z(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var ST=Xp(),zT=u_(),IT=Yp(),PT=d_(),TT=p_(),jT=h_(),ET=v_(),OT=af(),DT=$_(),NT=w_(),RT=S_(),ZT=z_(),AT=I_(),CT=P_(),UT=E_(),MT=O_();function FT(e=!1){let t=[RT.default,ZT.default,AT.default,CT.default,UT.default,MT.default,ET.default,OT.default,jT.default,DT.default,NT.default];return e?t.push(zT.default,PT.default):t.push(ST.default,IT.default),t.push(TT.default),t}gf.default=FT});var N_=z(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var _e=K(),qT={message:({schemaCode:e})=>(0,_e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,_e._)`{format: ${e}}`},LT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:qT,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?f():p();function f(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,_e._)`${h}[${a}]`),y=r.let("fType"),$=r.let("format");r.if((0,_e._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,_e._)`${g}.type || "string"`).assign($,(0,_e._)`${g}.validate`),()=>r.assign(y,(0,_e._)`"string"`).assign($,g)),e.fail$data((0,_e.or)(k(),x()));function k(){return c.strictSchema===!1?_e.nil:(0,_e._)`${a} && !${$}`}function x(){let D=l.$async?(0,_e._)`(${g}.async ? await ${$}(${n}) : ${$}(${n}))`:(0,_e._)`${$}(${n})`,O=(0,_e._)`(typeof ${$} == "function" ? ${D} : ${$}.test(${n}))`;return(0,_e._)`${$} && ${$} !== true && ${y} === ${t} && !${O}`}}function p(){let h=d.formats[i];if(!h){k();return}if(h===!0)return;let[g,y,$]=x(h);g===t&&e.pass(D());function k(){if(c.strictSchema===!1){d.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(O){let dt=O instanceof RegExp?(0,_e.regexpCode)(O):c.code.formats?(0,_e._)`${c.code.formats}${(0,_e.getProperty)(i)}`:void 0,pt=r.scopeValue("formats",{key:i,ref:O,code:dt});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,_e._)`${pt}.validate`]:["string",O,pt]}function D(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,_e._)`await ${$}(${n})`}return typeof y=="function"?(0,_e._)`${$}(${n})`:(0,_e._)`${$}.test(${n})`}}}};vf.default=LT});var R_=z(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var VT=N_(),JT=[VT.default];yf.default=JT});var Z_=z(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.contentVocabulary=yn.metadataVocabulary=void 0;yn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];yn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var C_=z(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var HT=Jy(),KT=i_(),BT=D_(),GT=R_(),A_=Z_(),WT=[HT.default,KT.default,(0,BT.default)(),GT.default,A_.metadataVocabulary,A_.contentVocabulary];_f.default=WT});var M_=z(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.DiscrError=void 0;var U_;(function(e){e.Tag="tag",e.Mapping="mapping"})(U_||(ys.DiscrError=U_={}))});var q_=z(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var _n=K(),$f=M_(),F_=Ya(),XT=Wo(),YT=ee(),QT={message:({params:{discrError:e,tagName:t}})=>e===$f.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,_n._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},ej={keyword:"discriminator",type:"object",schemaType:"object",error:QT,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",(0,_n._)`${r}${(0,_n.getProperty)(s)}`);t.if((0,_n._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:$f.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=f();t.if(!1);for(let h in p)t.elseIf((0,_n._)`${u} === ${h}`),t.assign(c,d(p[h]));t.else(),e.error(!1,{discrError:$f.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:p},h);return e.mergeEvaluated(g,_n.Name),h}function f(){var p;let h={},g=$(o),y=!0;for(let D=0;D<a.length;D++){let O=a[D];if(O?.$ref&&!(0,YT.schemaHasRulesButRef)(O,i.self.RULES)){let pt=O.$ref;if(O=F_.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,pt),O instanceof F_.SchemaEnv&&(O=O.schema),O===void 0)throw new XT.default(i.opts.uriResolver,i.baseId,pt)}let dt=(p=O?.properties)===null||p===void 0?void 0:p[s];if(typeof dt!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(g||$(O)),k(dt,D)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return h;function $({required:D}){return Array.isArray(D)&&D.includes(s)}function k(D,O){if(D.const)x(D.const,O);else if(D.enum)for(let dt of D.enum)x(dt,O);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function x(D,O){if(typeof D!="string"||D in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[D]=O}}}};bf.default=ej});var L_=z((p6,tj)=>{tj.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 kf=z((ve,xf)=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.MissingRefError=ve.ValidationError=ve.CodeGen=ve.Name=ve.nil=ve.stringify=ve.str=ve._=ve.KeywordCxt=ve.Ajv=void 0;var rj=Uy(),nj=C_(),oj=q_(),V_=L_(),ij=["/properties"],_s="http://json-schema.org/draft-07/schema",$n=class extends rj.default{_addVocabularies(){super._addVocabularies(),nj.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(oj.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(V_,ij):V_;this.addMetaSchema(t,_s,!1),this.refs["http://json-schema.org/schema"]=_s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(_s)?_s:void 0)}};ve.Ajv=$n;xf.exports=ve=$n;xf.exports.Ajv=$n;Object.defineProperty(ve,"__esModule",{value:!0});ve.default=$n;var aj=Go();Object.defineProperty(ve,"KeywordCxt",{enumerable:!0,get:function(){return aj.KeywordCxt}});var bn=K();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return bn._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return bn.str}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return bn.stringify}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return bn.nil}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return bn.Name}});Object.defineProperty(ve,"CodeGen",{enumerable:!0,get:function(){return bn.CodeGen}});var sj=Wa();Object.defineProperty(ve,"ValidationError",{enumerable:!0,get:function(){return sj.default}});var cj=Wo();Object.defineProperty(ve,"MissingRefError",{enumerable:!0,get:function(){return cj.default}})});var Y_=z(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.formatNames=Tt.fastFormats=Tt.fullFormats=void 0;function Pt(e,t){return{validate:e,compare:t}}Tt.fullFormats={date:Pt(B_,If),time:Pt(Sf(!0),Pf),"date-time":Pt(J_(!0),W_),"iso-time":Pt(Sf(),G_),"iso-date-time":Pt(J_(),X_),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:mj,"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:bj,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:hj,int32:{type:"number",validate:yj},int64:{type:"number",validate:_j},float:{type:"number",validate:K_},double:{type:"number",validate:K_},password:!0,binary:!0};Tt.fastFormats={...Tt.fullFormats,date:Pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,If),time:Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Pf),"date-time":Pt(/^\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,W_),"iso-time":Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,G_),"iso-date-time":Pt(/^\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,X_),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};Tt.formatNames=Object.keys(Tt.fullFormats);function uj(e){return e%4===0&&(e%100!==0||e%400===0)}var lj=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,dj=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B_(e){let t=lj.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&&uj(r)?29:dj[n])}function If(e,t){if(e&&t)return e>t?1:e<t?-1:0}var wf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Sf(e){return function(r){let n=wf.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function Pf(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 G_(e,t){if(!(e&&t))return;let r=wf.exec(e),n=wf.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 J_(e){let t=Sf(e);return function(n){let o=n.split(zf);return o.length===2&&B_(o[0])&&t(o[1])}}function W_(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function X_(e,t){if(!(e&&t))return;let[r,n]=e.split(zf),[o,i]=t.split(zf),a=If(r,o);if(a!==void 0)return a||Pf(n,i)}var pj=/\/|:/,fj=/^(?:[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 mj(e){return pj.test(e)&&fj.test(e)}var H_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function hj(e){return H_.lastIndex=0,H_.test(e)}var gj=-(2**31),vj=2**31-1;function yj(e){return Number.isInteger(e)&&e<=vj&&e>=gj}function _j(e){return Number.isInteger(e)}function K_(){return!0}var $j=/[^\\]\\Z/;function bj(e){if($j.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Q_=z(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.formatLimitDefinition=void 0;var xj=kf(),bt=K(),lr=bt.operators,$s={formatMaximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},formatMinimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},formatExclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},formatExclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},kj={message:({keyword:e,schemaCode:t})=>(0,bt.str)`should be ${$s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,bt._)`{comparison: ${$s[e].okStr}, limit: ${t}}`};xn.formatLimitDefinition={keyword:Object.keys($s),type:"string",schemaType:"string",$data:!0,error:kj,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new xj.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,bt._)`${f}[${c.schemaCode}]`);e.fail$data((0,bt.or)((0,bt._)`typeof ${p} != "object"`,(0,bt._)`${p} instanceof RegExp`,(0,bt._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=s.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let h=t.scopeValue("formats",{key:f,ref:p,code:a.code.formats?(0,bt._)`${a.code.formats}${(0,bt.getProperty)(f)}`:void 0});e.fail$data(d(h))}function d(f){return(0,bt._)`${f}.compare(${r}, ${n}) ${$s[o].fail} 0`}},dependencies:["format"]};var wj=e=>(e.addKeyword(xn.formatLimitDefinition),e);xn.default=wj});var n$=z((pi,r$)=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});var kn=Y_(),Sj=Q_(),Tf=K(),e$=new Tf.Name("fullFormats"),zj=new Tf.Name("fastFormats"),jf=(e,t={keywords:!0})=>{if(Array.isArray(t))return t$(e,t,kn.fullFormats,e$),e;let[r,n]=t.mode==="fast"?[kn.fastFormats,zj]:[kn.fullFormats,e$],o=t.formats||kn.formatNames;return t$(e,o,r,n),t.keywords&&(0,Sj.default)(e),e};jf.get=(e,t="full")=>{let n=(t==="fast"?kn.fastFormats:kn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function t$(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,Tf._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}r$.exports=pi=jf;Object.defineProperty(pi,"__esModule",{value:!0});pi.default=jf});var tt=ft(require("path")),d$=ft(require("fs"));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 i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(Y||(Y={}));var Zf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Zf||(Zf={}));var I=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Et=e=>{switch(typeof e){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(e)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(e)?I.array:e===null?I.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?I.promise:typeof Map<"u"&&e instanceof Map?I.map:typeof Set<"u"&&e instanceof Set?I.set:typeof Date<"u"&&e instanceof Date?I.date:I.object;default:return I.unknown}};var _=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"]);var Ge=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(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[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=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ge.create=e=>new Ge(e);var _$=(e,t)=>{let r;switch(e.code){case _.invalid_type:e.received===I.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Y.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${Y.joinValues(e.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Y.joinValues(e.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${Y.joinValues(e.options)}, received '${e.received}'`;break;case _.invalid_arguments:r="Invalid function arguments";break;case _.invalid_return_type:r="Invalid function return type";break;case _.invalid_date:r="Invalid date";break;case _.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 _.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 _.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 _.custom:r="Invalid input";break;case _.invalid_intersection_types:r="Intersection results could not be merged";break;case _.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;default:r=t.defaultError,Y.assertNever(e)}return{message:r}},Jt=_$;var $$=Jt;function In(){return $$}var hi=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function w(e,t){let r=In(),n=hi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Jt?void 0:Jt].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 C;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 i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return C;i.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},C=Object.freeze({status:"aborted"}),Dr=e=>({status:"dirty",value:e}),Ae=e=>({status:"valid",value:e}),Os=e=>e.status==="aborted",Ds=e=>e.status==="dirty",pr=e=>e.status==="valid",Pn=e=>typeof Promise<"u"&&e instanceof Promise;var T;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(T||(T={}));var rt=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}},Af=(e,t)=>{if(pr(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 Ge(e.common.issues);return this._error=r,this._error}}};function L(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:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var B=class{get description(){return this._def.description}_getType(t){return Et(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Et(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:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Pn(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:Et(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Af(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return pr(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=>pr(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:Et(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Pn(o)?o:Promise.resolve(o));return Af(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=t(o),s=()=>i.addIssue({code:_.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!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 ht({schema:this,typeName:N.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 mt.create(this,this._def)}nullable(){return Nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kt.create(this)}promise(){return fr.create(this,this._def)}or(t){return Cr.create([this,t],this._def)}and(t){return Ur.create(this,t,this._def)}transform(t){return new ht({...L(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Vr({...L(this._def),innerType:this,defaultValue:r,typeName:N.ZodDefault})}brand(){return new gi({typeName:N.ZodBranded,type:this,...L(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Jr({...L(this._def),innerType:this,catchValue:r,typeName:N.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return vi.create(this,t)}readonly(){return Hr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},b$=/^c[^\s-]{8,}$/i,x$=/^[0-9a-z]+$/,k$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,w$=/^[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,S$=/^[a-z0-9_-]{21}$/i,z$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,I$=/^[-+]?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)?)??$/,P$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,T$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ns,j$=/^(?:(?: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])$/,E$=/^(?:(?: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])$/,O$=/^(([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]))$/,D$=/^(([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])$/,N$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,R$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Cf="((\\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])))",Z$=new RegExp(`^${Cf}$`);function Uf(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 A$(e){return new RegExp(`^${Uf(e)}$`)}function C$(e){let t=`${Cf}T${Uf(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 U$(e,t){return!!((t==="v4"||!t)&&j$.test(e)||(t==="v6"||!t)&&O$.test(e))}function M$(e,t){if(!z$.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 F$(e,t){return!!((t==="v4"||!t)&&E$.test(e)||(t==="v6"||!t)&&D$.test(e))}var Rr=class e extends B{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==I.string){let i=this._getOrReturnCtx(t);return w(i,{code:_.invalid_type,expected:I.string,received:i.parsedType}),C}let n=new je,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:_.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:_.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?w(o,{code:_.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&w(o,{code:_.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")P$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"email",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ns||(Ns=new RegExp(T$,"u")),Ns.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"emoji",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")w$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"uuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")S$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"nanoid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")b$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")x$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid2",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")k$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ulid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),w(o,{validation:"url",code:_.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"regex",code:_.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?C$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Z$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?A$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?I$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"duration",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?U$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ip",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?M$(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"jwt",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?F$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cidr",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?N$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?R$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64url",code:_.invalid_string,message:i.message}),n.dirty()):Y.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:_.invalid_string,...T.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...T.errToObj(t)})}url(t){return this._addCheck({kind:"url",...T.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...T.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...T.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...T.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...T.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...T.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...T.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...T.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...T.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...T.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...T.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...T.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,...T.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,...T.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...T.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...T.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...T.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...T.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...T.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...T.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...T.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...T.errToObj(r)})}nonempty(t){return this.min(1,T.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}};Rr.create=e=>new Rr({checks:[],typeName:N.ZodString,coerce:e?.coerce??!1,...L(e)});function q$(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var Tn=class e extends B{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)!==I.number){let i=this._getOrReturnCtx(t);return w(i,{code:_.invalid_type,expected:I.number,received:i.parsedType}),C}let n,o=new je;for(let i of this._def.checks)i.kind==="int"?Y.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),w(n,{code:_.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:_.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:_.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?q$(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),w(n,{code:_.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),w(n,{code:_.not_finite,message:i.message}),o.dirty()):Y.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:T.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:T.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.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)}};Tn.create=e=>new Tn({checks:[],typeName:N.ZodNumber,coerce:e?.coerce||!1,...L(e)});var jn=class e extends B{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)!==I.bigint)return this._getInvalidInput(t);let n,o=new je;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:_.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:_.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),w(n,{code:_.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):Y.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return w(r,{code:_.invalid_type,expected:I.bigint,received:r.parsedType}),C}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.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:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.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}};jn.create=e=>new jn({checks:[],typeName:N.ZodBigInt,coerce:e?.coerce??!1,...L(e)});var En=class extends B{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==I.boolean){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.boolean,received:n.parsedType}),C}return Ae(t.data)}};En.create=e=>new En({typeName:N.ZodBoolean,coerce:e?.coerce||!1,...L(e)});var On=class e extends B{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==I.date){let i=this._getOrReturnCtx(t);return w(i,{code:_.invalid_type,expected:I.date,received:i.parsedType}),C}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return w(i,{code:_.invalid_date}),C}let n=new je,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:_.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:_.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):Y.assertNever(i);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:T.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:T.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}};On.create=e=>new On({checks:[],coerce:e?.coerce||!1,typeName:N.ZodDate,...L(e)});var Dn=class extends B{_parse(t){if(this._getType(t)!==I.symbol){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.symbol,received:n.parsedType}),C}return Ae(t.data)}};Dn.create=e=>new Dn({typeName:N.ZodSymbol,...L(e)});var Zr=class extends B{_parse(t){if(this._getType(t)!==I.undefined){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.undefined,received:n.parsedType}),C}return Ae(t.data)}};Zr.create=e=>new Zr({typeName:N.ZodUndefined,...L(e)});var Ar=class extends B{_parse(t){if(this._getType(t)!==I.null){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.null,received:n.parsedType}),C}return Ae(t.data)}};Ar.create=e=>new Ar({typeName:N.ZodNull,...L(e)});var Nn=class extends B{constructor(){super(...arguments),this._any=!0}_parse(t){return Ae(t.data)}};Nn.create=e=>new Nn({typeName:N.ZodAny,...L(e)});var Ht=class extends B{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ae(t.data)}};Ht.create=e=>new Ht({typeName:N.ZodUnknown,...L(e)});var xt=class extends B{_parse(t){let r=this._getOrReturnCtx(t);return w(r,{code:_.invalid_type,expected:I.never,received:r.parsedType}),C}};xt.create=e=>new xt({typeName:N.ZodNever,...L(e)});var Rn=class extends B{_parse(t){if(this._getType(t)!==I.undefined){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.void,received:n.parsedType}),C}return Ae(t.data)}};Rn.create=e=>new Rn({typeName:N.ZodVoid,...L(e)});var Kt=class e extends B{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==I.array)return w(r,{code:_.invalid_type,expected:I.array,received:r.parsedType}),C;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(w(r,{code:a?_.too_big:_.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?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&&(w(r,{code:_.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&&(w(r,{code:_.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((a,s)=>o.type._parseAsync(new rt(r,a,r.path,s)))).then(a=>je.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new rt(r,a,r.path,s)));return je.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:T.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:T.toString(r)}})}nonempty(t){return this.min(1,t)}};Kt.create=(e,t)=>new Kt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...L(t)});function Nr(e){if(e instanceof We){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=mt.create(Nr(n))}return new We({...e._def,shape:()=>t})}else return e instanceof Kt?new Kt({...e._def,type:Nr(e.element)}):e instanceof mt?mt.create(Nr(e.unwrap())):e instanceof Nt?Nt.create(Nr(e.unwrap())):e instanceof Dt?Dt.create(e.items.map(t=>Nr(t))):e}var We=class e extends B{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)!==I.object){let u=this._getOrReturnCtx(t);return w(u,{code:_.invalid_type,expected:I.object,received:u.parsedType}),C}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new rt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof xt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(w(o,{code:_.unrecognized_keys,keys:s}),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 s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new rt(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,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>je.mergeObjectSync(n,u)):je.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return T.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:T.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:N.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 Nr(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 i=this.shape[n];for(;i instanceof mt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Mf(Y.objectKeys(this.shape))}};We.create=(e,t)=>new We({shape:()=>e,unknownKeys:"strip",catchall:xt.create(),typeName:N.ZodObject,...L(t)});We.strictCreate=(e,t)=>new We({shape:()=>e,unknownKeys:"strict",catchall:xt.create(),typeName:N.ZodObject,...L(t)});We.lazycreate=(e,t)=>new We({shape:e,unknownKeys:"strip",catchall:xt.create(),typeName:N.ZodObject,...L(t)});var Cr=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Ge(s.ctx.common.issues));return w(r,{code:_.invalid_union,unionErrors:a}),C}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];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"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new Ge(c));return w(r,{code:_.invalid_union,unionErrors:s}),C}}get options(){return this._def.options}};Cr.create=(e,t)=>new Cr({options:e,typeName:N.ZodUnion,...L(t)});var Ot=e=>e instanceof Mr?Ot(e.schema):e instanceof ht?Ot(e.innerType()):e instanceof Fr?[e.value]:e instanceof qr?e.options:e instanceof Lr?Y.objectValues(e.enum):e instanceof Vr?Ot(e._def.innerType):e instanceof Zr?[void 0]:e instanceof Ar?[null]:e instanceof mt?[void 0,...Ot(e.unwrap())]:e instanceof Nt?[null,...Ot(e.unwrap())]:e instanceof gi||e instanceof Hr?Ot(e.unwrap()):e instanceof Jr?Ot(e._def.innerType):[],Rs=class e extends B{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.object)return w(r,{code:_.invalid_type,expected:I.object,received:r.parsedType}),C;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(w(r,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),C)}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 i of r){let a=Ot(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:N.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...L(n)})}};function Zs(e,t){let r=Et(e),n=Et(t);if(e===t)return{valid:!0,data:e};if(r===I.object&&n===I.object){let o=Y.objectKeys(t),i=Y.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=Zs(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===I.array&&n===I.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=Zs(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===I.date&&n===I.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ur=class extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Os(i)||Os(a))return C;let s=Zs(i.value,a.value);return s.valid?((Ds(i)||Ds(a))&&r.dirty(),{status:r.value,value:s.data}):(w(n,{code:_.invalid_intersection_types}),C)};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(([i,a])=>o(i,a)):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}))}};Ur.create=(e,t,r)=>new Ur({left:e,right:t,typeName:N.ZodIntersection,...L(r)});var Dt=class e extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.array)return w(n,{code:_.invalid_type,expected:I.array,received:n.parsedType}),C;if(n.data.length<this._def.items.length)return w(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),C;!this._def.rest&&n.data.length>this._def.items.length&&(w(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new rt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>je.mergeArray(r,a)):je.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Dt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:e,typeName:N.ZodTuple,rest:null,...L(t)})};var As=class e extends B{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!==I.object)return w(n,{code:_.invalid_type,expected:I.object,received:n.parsedType}),C;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new rt(n,s,n.path,s)),value:a._parse(new rt(n,n.data[s],n.path,s)),alwaysSet:s 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 B?new e({keyType:t,valueType:r,typeName:N.ZodRecord,...L(n)}):new e({keyType:Rr.create(),valueType:t,typeName:N.ZodRecord,...L(r)})}},Zn=class extends B{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!==I.map)return w(n,{code:_.invalid_type,expected:I.map,received:n.parsedType}),C;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new rt(n,s,n.path,[u,"key"])),value:i._parse(new rt(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return C;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Zn.create=(e,t,r)=>new Zn({valueType:t,keyType:e,typeName:N.ZodMap,...L(r)});var An=class e extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.set)return w(n,{code:_.invalid_type,expected:I.set,received:n.parsedType}),C;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(w(n,{code:_.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&&(w(n,{code:_.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return C;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new rt(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:T.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};An.create=(e,t)=>new An({valueType:e,minSize:null,maxSize:null,typeName:N.ZodSet,...L(t)});var Cs=class e extends B{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.function)return w(r,{code:_.invalid_type,expected:I.function,received:r.parsedType}),C;function n(s,c){return hi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,In(),Jt].filter(u=>!!u),issueData:{code:_.invalid_arguments,argumentsError:c}})}function o(s,c){return hi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,In(),Jt].filter(u=>!!u),issueData:{code:_.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof fr){let s=this;return Ae(async function(...c){let u=new Ge([]),l=await s._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let s=this;return Ae(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Ge([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Ge([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:Dt.create(t).rest(Ht.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||Dt.create([]).rest(Ht.create()),returns:r||Ht.create(),typeName:N.ZodFunction,...L(n)})}},Mr=class extends B{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})}};Mr.create=(e,t)=>new Mr({getter:e,typeName:N.ZodLazy,...L(t)});var Fr=class extends B{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return w(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),C}return{status:"valid",value:t.data}}get value(){return this._def.value}};Fr.create=(e,t)=>new Fr({value:e,typeName:N.ZodLiteral,...L(t)});function Mf(e,t){return new qr({values:e,typeName:N.ZodEnum,...L(t)})}var qr=class e extends B{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return w(r,{expected:Y.joinValues(n),received:r.parsedType,code:_.invalid_type}),C}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 w(r,{received:r.data,code:_.invalid_enum_value,options:n}),C}return Ae(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})}};qr.create=Mf;var Lr=class extends B{_parse(t){let r=Y.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==I.string&&n.parsedType!==I.number){let o=Y.objectValues(r);return w(n,{expected:Y.joinValues(o),received:n.parsedType,code:_.invalid_type}),C}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=Y.objectValues(r);return w(n,{received:n.data,code:_.invalid_enum_value,options:o}),C}return Ae(t.data)}get enum(){return this._def.values}};Lr.create=(e,t)=>new Lr({values:e,typeName:N.ZodNativeEnum,...L(t)});var fr=class extends B{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.promise&&r.common.async===!1)return w(r,{code:_.invalid_type,expected:I.promise,received:r.parsedType}),C;let n=r.parsedType===I.promise?r.data:Promise.resolve(r.data);return Ae(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fr.create=(e,t)=>new fr({type:e,typeName:N.ZodPromise,...L(t)});var ht=class extends B{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{w(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return C;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?C:c.status==="dirty"?Dr(c.value):r.value==="dirty"?Dr(c.value):c});{if(r.value==="aborted")return C;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?C:s.status==="dirty"?Dr(s.value):r.value==="dirty"?Dr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);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 s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?C:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?C:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!pr(a))return C;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>pr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):C);Y.assertNever(o)}};ht.create=(e,t,r)=>new ht({schema:e,typeName:N.ZodEffects,effect:t,...L(r)});ht.createWithPreprocess=(e,t,r)=>new ht({schema:t,effect:{type:"preprocess",transform:e},typeName:N.ZodEffects,...L(r)});var mt=class extends B{_parse(t){return this._getType(t)===I.undefined?Ae(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:N.ZodOptional,...L(t)});var Nt=class extends B{_parse(t){return this._getType(t)===I.null?Ae(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:N.ZodNullable,...L(t)});var Vr=class extends B{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===I.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Vr.create=(e,t)=>new Vr({innerType:e,typeName:N.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...L(t)});var Jr=class extends B{_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 Pn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ge(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ge(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:N.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...L(t)});var Cn=class extends B{_parse(t){if(this._getType(t)!==I.nan){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.nan,received:n.parsedType}),C}return{status:"valid",value:t.data}}};Cn.create=e=>new Cn({typeName:N.ZodNaN,...L(e)});var gi=class extends B{_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}},vi=class e extends B{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?C:i.status==="dirty"?(r.dirty(),Dr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?C: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:N.ZodPipeline})}},Hr=class extends B{_parse(t){let r=this._def.innerType._parse(t),n=o=>(pr(o)&&(o.value=Object.freeze(o.value)),o);return Pn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Hr.create=(e,t)=>new Hr({innerType:e,typeName:N.ZodReadonly,...L(t)});var tE={object:We.lazycreate},N;(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"})(N||(N={}));var rE=Rr.create,nE=Tn.create,oE=Cn.create,iE=jn.create,aE=En.create,sE=On.create,cE=Dn.create,uE=Zr.create,lE=Ar.create,dE=Nn.create,pE=Ht.create,fE=xt.create,mE=Rn.create,hE=Kt.create,L$=We.create,gE=We.strictCreate,vE=Cr.create,yE=Rs.create,_E=Ur.create,$E=Dt.create,bE=As.create,xE=Zn.create,kE=An.create,wE=Cs.create,SE=Mr.create,zE=Fr.create,IE=qr.create,PE=Lr.create,TE=fr.create,jE=ht.create,EE=mt.create,OE=Nt.create,DE=ht.createWithPreprocess,NE=vi.create;var Ff=Object.freeze({status:"aborted"});function m(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let f=l[d];f in s||(s[f]=u[f].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},mr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},yi={};function xe(e){return e&&Object.assign(yi,e),yi}var b={};zn(b,{BIGINT_FORMAT_RANGES:()=>Bs,Class:()=>Ms,NUMBER_FORMAT_RANGES:()=>Ks,aborted:()=>Xt,allowsEval:()=>Ls,assert:()=>W$,assertEqual:()=>H$,assertIs:()=>B$,assertNever:()=>G$,assertNotEqual:()=>K$,assignProp:()=>Gt,base64ToUint8Array:()=>Gf,base64urlToUint8Array:()=>sb,cached:()=>Br,captureStackTrace:()=>$i,cleanEnum:()=>ab,cleanRegex:()=>Fn,clone:()=>Ce,cloneDef:()=>Y$,createTransparentProxy:()=>ob,defineLazy:()=>V,esc:()=>_i,escapeRegex:()=>nt,extend:()=>Jf,finalizeIssue:()=>Ve,floatSafeRemainder:()=>Fs,getElementAtPath:()=>Q$,getEnumValues:()=>Mn,getLengthableOrigin:()=>Vn,getParsedType:()=>nb,getSizableOrigin:()=>Ln,hexToUint8Array:()=>ub,isObject:()=>hr,isPlainObject:()=>Wt,issue:()=>Gr,joinValues:()=>Z,jsonStringifyReplacer:()=>Kr,merge:()=>ib,mergeDefs:()=>Rt,normalizeParams:()=>S,nullish:()=>Bt,numKeys:()=>rb,objectClone:()=>X$,omit:()=>Vf,optionalKeys:()=>Hs,parsedType:()=>U,partial:()=>Kf,pick:()=>Lf,prefixIssues:()=>Xe,primitiveTypes:()=>Js,promiseAllObject:()=>eb,propertyKeyTypes:()=>qn,randomString:()=>tb,required:()=>Bf,safeExtend:()=>Hf,shallowClone:()=>Vs,slugify:()=>qs,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>Wf,uint8ArrayToBase64url:()=>cb,uint8ArrayToHex:()=>lb,unwrapMessage:()=>Un});function H$(e){return e}function K$(e){return e}function B$(e){}function G$(e){throw new Error("Unexpected value in exhaustive check")}function W$(e){}function Mn(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 Z(e,t="|"){return e.map(r=>A(r)).join(t)}function Kr(e,t){return typeof t=="bigint"?t.toString():t}function Br(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Bt(e){return e==null}function Fn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fs(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var qf=Symbol("evaluating");function V(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==qf)return n===void 0&&(n=qf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function X$(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Gt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Rt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Y$(e){return Rt(e._zod.def)}function Q$(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function eb(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function tb(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function _i(e){return JSON.stringify(e)}function qs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var $i="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ls=Br(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Wt(e){if(hr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(hr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Vs(e){return Wt(e)?{...e}:Array.isArray(e)?[...e]:e}function rb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var nb=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}`)}},qn=new Set(["string","number","symbol"]),Js=new Set(["string","number","bigint","boolean","symbol","undefined"]);function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ce(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function S(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 ob(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},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 A(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Hs(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ks={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]},Bs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Lf(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 i=Rt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Gt(this,"shape",a),a},checks:[]});return Ce(e,i)}function Vf(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 i=Rt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Gt(this,"shape",a),a},checks:[]});return Ce(e,i)}function Jf(e,t){if(!Wt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Rt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Gt(this,"shape",i),i}});return Ce(e,o)}function Hf(e,t){if(!Wt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Gt(this,"shape",n),n}});return Ce(e,r)}function ib(e,t){let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Gt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Ce(e,r)}function Kf(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 a=Rt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Gt(this,"shape",c),c},checks:[]});return Ce(t,a)}function Bf(e,t,r){let n=Rt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Gt(this,"shape",i),i}});return Ce(t,n)}function Xt(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 Xe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Un(e){return typeof e=="string"?e:e?.message}function Ve(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Un(e.inst?._zod.def?.error?.(e))??Un(t?.error?.(e))??Un(r.customError?.(e))??Un(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Ln(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Vn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function U(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 Gr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function ab(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Gf(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 Wf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function sb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Gf(t+r)}function cb(e){return Wf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ub(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 lb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ms=class{constructor(...t){}};var Xf=(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,Kr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bi=m("$ZodError",Xf),Jn=m("$ZodError",Xf,{Parent:Error});function xi(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 ki(e,t=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Hn=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new kt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Ve(c,i,xe())));throw $i(s,o?.callee),s}return a.value},Kn=Hn(Jn),Bn=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Ve(c,i,xe())));throw $i(s,o?.callee),s}return a.value},Gn=Bn(Jn),Wn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new kt;return i.issues.length?{success:!1,error:new(e??bi)(i.issues.map(a=>Ve(a,o,xe())))}:{success:!0,data:i.value}},Wr=Wn(Jn),Xn=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>Ve(a,o,xe())))}:{success:!0,data:i.value}},Yn=Xn(Jn),Yf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Hn(e)(t,r,o)};var Qf=e=>(t,r,n)=>Hn(e)(t,r,n);var em=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bn(e)(t,r,o)};var tm=e=>async(t,r,n)=>Bn(e)(t,r,n);var rm=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Wn(e)(t,r,o)};var nm=e=>(t,r,n)=>Wn(e)(t,r,n);var om=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,o)};var im=e=>async(t,r,n)=>Xn(e)(t,r,n);var ot={};zn(ot,{base64:()=>lc,base64url:()=>wi,bigint:()=>gc,boolean:()=>yc,browserEmail:()=>_b,cidrv4:()=>cc,cidrv6:()=>uc,cuid:()=>Gs,cuid2:()=>Ws,date:()=>pc,datetime:()=>mc,domain:()=>xb,duration:()=>tc,e164:()=>dc,email:()=>nc,emoji:()=>oc,extendedDuration:()=>pb,guid:()=>rc,hex:()=>kb,hostname:()=>bb,html5Email:()=>gb,idnEmail:()=>yb,integer:()=>vc,ipv4:()=>ic,ipv6:()=>ac,ksuid:()=>Qs,lowercase:()=>bc,mac:()=>sc,md5_base64:()=>Sb,md5_base64url:()=>zb,md5_hex:()=>wb,nanoid:()=>ec,null:()=>_c,number:()=>Si,rfc5322Email:()=>vb,sha1_base64:()=>Pb,sha1_base64url:()=>Tb,sha1_hex:()=>Ib,sha256_base64:()=>Eb,sha256_base64url:()=>Ob,sha256_hex:()=>jb,sha384_base64:()=>Nb,sha384_base64url:()=>Rb,sha384_hex:()=>Db,sha512_base64:()=>Ab,sha512_base64url:()=>Cb,sha512_hex:()=>Zb,string:()=>hc,time:()=>fc,ulid:()=>Xs,undefined:()=>$c,unicodeEmail:()=>am,uppercase:()=>xc,uuid:()=>gr,uuid4:()=>fb,uuid6:()=>mb,uuid7:()=>hb,xid:()=>Ys});var Gs=/^[cC][^\s-]{8,}$/,Ws=/^[0-9a-z]+$/,Xs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ys=/^[0-9a-vA-V]{20}$/,Qs=/^[A-Za-z0-9]{27}$/,ec=/^[a-zA-Z0-9_-]{21}$/,tc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pb=/^[-+]?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)?)??$/,rc=/^([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})$/,gr=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)$/,fb=gr(4),mb=gr(6),hb=gr(7),nc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gb=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,vb=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,am=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,yb=am,_b=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,$b="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function oc(){return new RegExp($b,"u")}var ic=/^(?:(?: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])$/,ac=/^(([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}|:))$/,sc=e=>{let t=nt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},cc=/^((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])$/,uc=/^(([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])$/,lc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wi=/^[A-Za-z0-9_-]*$/,bb=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,xb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,dc=/^\+[1-9]\d{6,14}$/,sm="(?:(?:\\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])))",pc=new RegExp(`^${sm}$`);function cm(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 fc(e){return new RegExp(`^${cm(e)}$`)}function mc(e){let t=cm({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(`^${sm}T(?:${n})$`)}var hc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},gc=/^-?\d+n?$/,vc=/^-?\d+$/,Si=/^-?\d+(?:\.\d+)?$/,yc=/^(?:true|false)$/i,_c=/^null$/i;var $c=/^undefined$/i;var bc=/^[^A-Z]*$/,xc=/^[^a-z]*$/,kb=/^[0-9a-fA-F]*$/;function Qn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function eo(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var wb=/^[0-9a-fA-F]{32}$/,Sb=Qn(22,"=="),zb=eo(22),Ib=/^[0-9a-fA-F]{40}$/,Pb=Qn(27,"="),Tb=eo(27),jb=/^[0-9a-fA-F]{64}$/,Eb=Qn(43,"="),Ob=eo(43),Db=/^[0-9a-fA-F]{96}$/,Nb=Qn(64,""),Rb=eo(64),Zb=/^[0-9a-fA-F]{128}$/,Ab=Qn(86,"=="),Cb=eo(86);var ue=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),lm={number:"number",bigint:"bigint",object:"date"},kc=m("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let r=lm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(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})}}),wc=m("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=lm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(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})}}),dm=m("$ZodCheckMultipleOf",(e,t)=>{ue.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):Fs(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})}}),pm=m("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ks[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=vc)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,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}):a.issues.push({input:s,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}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),fm=m("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[r,n]=Bs[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),mm=m("$ZodCheckMaxSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==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;o.size<=t.maximum||n.issues.push({origin:Ln(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hm=m("$ZodCheckMinSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==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;o.size>=t.minimum||n.issues.push({origin:Ln(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gm=m("$ZodCheckSizeEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Ln(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),vm=m("$ZodCheckMaxLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(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 a=Vn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ym=m("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(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 a=Vn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_m=m("$ZodCheckLengthEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(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,i=o.length;if(i===t.length)return;let a=Vn(o),s=i>t.length;n.issues.push({origin:a,...s?{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=m("$ZodCheckStringFormat",(e,t)=>{var r,n;ue.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.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=()=>{})}),$m=m("$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})}}),bm=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=bc),to.init(e,t)}),xm=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=xc),to.init(e,t)}),km=m("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let r=nt(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.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})}}),wm=m("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`^${nt(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})}}),Sm=m("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`.*${nt(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})}});function um(e,t,r){e.issues.length&&t.issues.push(...Xe(r,e.issues))}var zm=m("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>um(o,r,t.property));um(n,r,t.property)}}),Im=m("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Pm=m("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var zi=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(`
|
|
10
10
|
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
|
|
11
|
-
`))}};var fm={major:4,minor:3,patch:6};var L=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=Ht(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let m=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new bt;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==m&&(u||(u=Ht(a,m)))});else{if(a.issues.length===m)continue;u||(u=Ht(a,m))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Ht(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new bt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new bt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}V(e,"~standard",()=>({validate:o=>{try{let i=Kr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Hn(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),fr=f("$ZodString",(e,t)=>{L.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ac(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}}),oe=f("$ZodStringFormat",(e,t)=>{Xn.init(e,t),fr.init(e,t)}),vc=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Bs),oe.init(e,t)}),yc=f("$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=pr(n))}else t.pattern??(t.pattern=pr());oe.init(e,t)}),_c=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Hs),oe.init(e,t)}),$c=f("$ZodURL",(e,t)=>{oe.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),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})}}}),bc=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Gs()),oe.init(e,t)}),xc=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Js),oe.init(e,t)}),kc=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ms),oe.init(e,t)}),wc=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qs),oe.init(e,t)}),Sc=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ls),oe.init(e,t)}),zc=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Fs),oe.init(e,t)}),Ic=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Vs),oe.init(e,t)}),Pc=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ic(t)),oe.init(e,t)}),Tc=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=nc),oe.init(e,t)}),jc=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=oc(t)),oe.init(e,t)}),Ec=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ks),oe.init(e,t)}),Oc=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ws),oe.init(e,t),e._zod.bag.format="ipv4"}),Nc=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Xs),oe.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})}}}),Dc=f("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Ys(t.delimiter)),oe.init(e,t),e._zod.bag.format="mac"}),Zc=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Qs),oe.init(e,t)}),Rc=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ec),oe.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>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 Sm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Uc=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=tc),oe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Sm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function ab(e){if(!gi.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Sm(r)}var Ac=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=gi),oe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{ab(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Cc=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=rc),oe.init(e,t)});function sb(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 Mc=f("$ZodJWT",(e,t)=>{oe.init(e,t),e._zod.check=r=>{sb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),qc=f("$ZodCustomStringFormat",(e,t)=>{oe.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),wi=f("$ZodNumber",(e,t)=>{L.init(e,t),e._zod.pattern=e._zod.bag.pattern??vi,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 i=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,...i?{received:i}:{}}),r}}),Lc=f("$ZodNumberFormat",(e,t)=>{Gf.init(e,t),wi.init(e,t)}),Yn=f("$ZodBoolean",(e,t)=>{L.init(e,t),e._zod.pattern=uc,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}}),Si=f("$ZodBigInt",(e,t)=>{L.init(e,t),e._zod.pattern=sc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Fc=f("$ZodBigIntFormat",(e,t)=>{Wf.init(e,t),Si.init(e,t)}),Vc=f("$ZodSymbol",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),Jc=f("$ZodUndefined",(e,t)=>{L.init(e,t),e._zod.pattern=dc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Kc=f("$ZodNull",(e,t)=>{L.init(e,t),e._zod.pattern=lc,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}}),Bc=f("$ZodAny",(e,t)=>{L.init(e,t),e._zod.parse=r=>r}),Hc=f("$ZodUnknown",(e,t)=>{L.init(e,t),e._zod.parse=r=>r}),Gc=f("$ZodNever",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Wc=f("$ZodVoid",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Xc=f("$ZodDate",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function mm(e,t,r){e.issues.length&&t.issues.push(...Be(r,e.issues)),t.value[r]=e.value}var Yc=f("$ZodArray",(e,t)=>{L.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 i=[];for(let a=0;a<o.length;a++){let s=o[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>mm(u,r,a))):mm(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function ki(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Be(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function zm(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=Us(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Im(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let m=c.run({value:t[d],issues:[]},n);m instanceof Promise?e.push(m.then(p=>ki(p,r,d,t,l))):ki(m,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var Pm=f("$ZodObject",(e,t)=>{if(L.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Vr(()=>zm(t));V(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[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=dr,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let m of a.keys){let p=d[m],h=p._zod.optout==="optional",v=p._zod.run({value:u[m],issues:[]},c);v instanceof Promise?l.push(v.then($=>ki($,s,m,u,h))):ki(v,s,m,u,h)}return i?Im(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Tm=f("$ZodObjectJIT",(e,t)=>{Pm.init(e,t);let r=e._zod.parse,n=Vr(()=>zm(t)),o=m=>{let p=new yi(["shape","payload","ctx"]),h=n.value,v=P=>{let C=di(P);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};p.write("const input = payload.value;");let $=Object.create(null),k=0;for(let P of h.keys)$[P]=`key_${k++}`;p.write("const newResult = {};");for(let P of h.keys){let C=$[P],E=di(P),lt=m[P]?._zod?.optout==="optional";p.write(`const ${C} = ${v(P)};`),lt?p.write(`
|
|
12
|
-
if (${
|
|
13
|
-
if (${
|
|
14
|
-
payload.issues = payload.issues.concat(${
|
|
11
|
+
`))}};var jm={major:4,minor:3,patch:6};var q=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=jm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=Xt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new kt;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=Xt(a,f)))});else{if(a.issues.length===f)continue;u||(u=Xt(a,f))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Xt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new kt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new kt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}V(e,"~standard",()=>({validate:o=>{try{let i=Wr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Yn(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),vr=m("$ZodString",(e,t)=>{q.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hc(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}}),ae=m("$ZodStringFormat",(e,t)=>{to.init(e,t),vr.init(e,t)}),zc=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=rc),ae.init(e,t)}),Ic=m("$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=gr(n))}else t.pattern??(t.pattern=gr());ae.init(e,t)}),Pc=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=nc),ae.init(e,t)}),Tc=m("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),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})}}}),jc=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=oc()),ae.init(e,t)}),Ec=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ec),ae.init(e,t)}),Oc=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Gs),ae.init(e,t)}),Dc=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ws),ae.init(e,t)}),Nc=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Xs),ae.init(e,t)}),Rc=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ys),ae.init(e,t)}),Zc=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Qs),ae.init(e,t)}),Ac=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mc(t)),ae.init(e,t)}),Cc=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=pc),ae.init(e,t)}),Uc=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=fc(t)),ae.init(e,t)}),Mc=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tc),ae.init(e,t)}),Fc=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ic),ae.init(e,t),e._zod.bag.format="ipv4"}),qc=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ac),ae.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})}}}),Lc=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=sc(t.delimiter)),ae.init(e,t),e._zod.bag.format="mac"}),Vc=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=cc),ae.init(e,t)}),Jc=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=uc),ae.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>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 qm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Hc=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=lc),ae.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{qm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Ub(e){if(!wi.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return qm(r)}var Kc=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=wi),ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Ub(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Bc=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=dc),ae.init(e,t)});function Mb(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 Gc=m("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=r=>{Mb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Wc=m("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Oi=m("$ZodNumber",(e,t)=>{q.init(e,t),e._zod.pattern=e._zod.bag.pattern??Si,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 i=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,...i?{received:i}:{}}),r}}),Xc=m("$ZodNumberFormat",(e,t)=>{pm.init(e,t),Oi.init(e,t)}),ro=m("$ZodBoolean",(e,t)=>{q.init(e,t),e._zod.pattern=yc,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}}),Di=m("$ZodBigInt",(e,t)=>{q.init(e,t),e._zod.pattern=gc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Yc=m("$ZodBigIntFormat",(e,t)=>{fm.init(e,t),Di.init(e,t)}),Qc=m("$ZodSymbol",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),eu=m("$ZodUndefined",(e,t)=>{q.init(e,t),e._zod.pattern=$c,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),tu=m("$ZodNull",(e,t)=>{q.init(e,t),e._zod.pattern=_c,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}}),ru=m("$ZodAny",(e,t)=>{q.init(e,t),e._zod.parse=r=>r}),nu=m("$ZodUnknown",(e,t)=>{q.init(e,t),e._zod.parse=r=>r}),ou=m("$ZodNever",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),iu=m("$ZodVoid",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),au=m("$ZodDate",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function Em(e,t,r){e.issues.length&&t.issues.push(...Xe(r,e.issues)),t.value[r]=e.value}var su=m("$ZodArray",(e,t)=>{q.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 i=[];for(let a=0;a<o.length;a++){let s=o[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>Em(u,r,a))):Em(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ei(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Xe(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Lm(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=Hs(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Vm(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let f=c.run({value:t[d],issues:[]},n);f instanceof Promise?e.push(f.then(p=>Ei(p,r,d,t,l))):Ei(f,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var Jm=m("$ZodObject",(e,t)=>{if(q.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Br(()=>Lm(t));V(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[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=hr,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let f of a.keys){let p=d[f],h=p._zod.optout==="optional",g=p._zod.run({value:u[f],issues:[]},c);g instanceof Promise?l.push(g.then(y=>Ei(y,s,f,u,h))):Ei(g,s,f,u,h)}return i?Vm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Hm=m("$ZodObjectJIT",(e,t)=>{Jm.init(e,t);let r=e._zod.parse,n=Br(()=>Lm(t)),o=f=>{let p=new zi(["shape","payload","ctx"]),h=n.value,g=x=>{let D=_i(x);return`shape[${D}]._zod.run({ value: input[${D}], issues: [] }, ctx)`};p.write("const input = payload.value;");let y=Object.create(null),$=0;for(let x of h.keys)y[x]=`key_${$++}`;p.write("const newResult = {};");for(let x of h.keys){let D=y[x],O=_i(x),pt=f[x]?._zod?.optout==="optional";p.write(`const ${D} = ${g(x)};`),pt?p.write(`
|
|
12
|
+
if (${D}.issues.length) {
|
|
13
|
+
if (${O} in input) {
|
|
14
|
+
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
|
|
15
15
|
...iss,
|
|
16
|
-
path: iss.path ? [${
|
|
16
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
17
17
|
})));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
if (${
|
|
22
|
-
if (${
|
|
23
|
-
newResult[${
|
|
21
|
+
if (${D}.value === undefined) {
|
|
22
|
+
if (${O} in input) {
|
|
23
|
+
newResult[${O}] = undefined;
|
|
24
24
|
}
|
|
25
25
|
} else {
|
|
26
|
-
newResult[${
|
|
26
|
+
newResult[${O}] = ${D}.value;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
`):p.write(`
|
|
30
|
-
if (${
|
|
31
|
-
payload.issues = payload.issues.concat(${
|
|
30
|
+
if (${D}.issues.length) {
|
|
31
|
+
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
|
|
32
32
|
...iss,
|
|
33
|
-
path: iss.path ? [${
|
|
33
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
34
34
|
})));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (${
|
|
38
|
-
if (${
|
|
39
|
-
newResult[${
|
|
37
|
+
if (${D}.value === undefined) {
|
|
38
|
+
if (${O} in input) {
|
|
39
|
+
newResult[${O}] = undefined;
|
|
40
40
|
}
|
|
41
41
|
} else {
|
|
42
|
-
newResult[${
|
|
42
|
+
newResult[${O}] = ${D}.value;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
`)}p.write("payload.value = newResult;"),p.write("return payload;");let O=p.compile();return(P,C)=>O(m,P,C)},i,a=dr,s=!li.jitless,u=s&&Ds.value,l=t.catchall,d;e._zod.parse=(m,p)=>{d??(d=n.value);let h=m.value;return a(h)?s&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(t.shape)),m=i(m,p),l?Im([],h,m,p,d,e):m):r(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),m)}});function hm(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Ht(i));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(i=>i.issues.map(a=>Me(a,n,_e())))}),t)}var Qn=f("$ZodUnion",(e,t)=>{L.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Un(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>hm(c,o,e,i)):hm(s,o,e,i)}});function gm(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>Me(a,n,_e())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var Qc=f("$ZodXor",(e,t)=>{Qn.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>gm(c,o,e,i)):gm(s,o,e,i)}}),eu=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Qn.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Vr(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!dr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),tu=f("$ZodIntersection",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>vm(r,c,u)):vm(r,i,a)}});function gc(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(Bt(e)&&Bt(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=gc(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.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],i=t[n],a=gc(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function vm(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),Ht(e))return e;let a=gc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var zi=f("$ZodTuple",(e,t)=>{L.init(e,t);let r=t.items;e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(m=>_i(m,n,u))):_i(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let m=t.rest._zod.run({value:d,issues:[]},o);m instanceof Promise?a.push(m.then(p=>_i(p,n,u))):_i(m,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function _i(e,t,r){e.issues.length&&t.issues.push(...Be(r,e.issues)),t.value[r]=e.value}var ru=f("$ZodRecord",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Bt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Be(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Be(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.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 s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&vi.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),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[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Me(d,n,_e())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Be(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Be(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),nu=f("$ZodMap",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{ym(l,d,r,a,o,e,n)})):ym(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function ym(e,t,r,n,o,i,a){e.issues.length&&(An.has(typeof n)?r.issues.push(...Be(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>Me(s,a,_e()))})),t.issues.length&&(An.has(typeof n)?r.issues.push(...Be(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>Me(s,a,_e()))})),r.value.set(e.value,t.value)}var ou=f("$ZodSet",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>_m(c,r))):_m(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function _m(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var iu=f("$ZodEnum",(e,t)=>{L.init(e,t);let r=Rn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>An.has(typeof o)).map(o=>typeof o=="string"?et(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),au=f("$ZodLiteral",(e,t)=>{if(L.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"?et(n):n?et(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),su=f("$ZodFile",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),cu=f("$ZodTransform",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new lr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new bt;return r.value=o,r}});function $m(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ii=f("$ZodOptional",(e,t)=>{L.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Un(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>$m(i,r.value)):$m(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),uu=f("$ZodExactOptional",(e,t)=>{Ii.init(e,t),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),lu=f("$ZodNullable",(e,t)=>{L.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Un(r.source)}|null)$`):void 0}),V(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)}),du=f("$ZodDefault",(e,t)=>{L.init(e,t),e._zod.optin="optional",V(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(i=>bm(i,t)):bm(o,t)}});function bm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var pu=f("$ZodPrefault",(e,t)=>{L.init(e,t),e._zod.optin="optional",V(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))}),fu=f("$ZodNonOptional",(e,t)=>{L.init(e,t),V(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(i=>xm(i,e)):xm(o,e)}});function xm(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 mu=f("$ZodSuccess",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new lr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),hu=f("$ZodCatch",(e,t)=>{L.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(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(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>Me(a,n,_e()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Me(i,n,_e()))},input:r.value}),r.issues=[]),r)}}),gu=f("$ZodNaN",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),vu=f("$ZodPipe",(e,t)=>{L.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>$i(a,t.in,n)):$i(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>$i(i,t.out,n)):$i(o,t.out,n)}});function $i(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var eo=f("$ZodCodec",(e,t)=>{L.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>bi(a,t,n)):bi(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>bi(a,t,n)):bi(i,t,n)}}});function bi(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>xi(e,i,t.out,r)):xi(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>xi(e,i,t.in,r)):xi(e,o,t.in,r)}}function xi(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var yu=f("$ZodReadonly",(e,t)=>{L.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>t.innerType?._zod?.optin),V(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(km):km(o)}});function km(e){return e.value=Object.freeze(e.value),e}var _u=f("$ZodTemplateLiteral",(e,t)=>{L.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Rs.has(typeof n))r.push(et(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),$u=f("$ZodFunction",(e,t)=>(L.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?Fn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Fn(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=e._def.input?await Jn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Jn(e._def.output,i):i}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new zi({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),bu=f("$ZodPromise",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),xu=f("$ZodLazy",(e,t)=>{L.init(e,t),V(e._zod,"innerType",()=>t.getter()),V(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),V(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),V(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),V(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),ku=f("$ZodCustom",(e,t)=>{se.init(e,t),L.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(i=>wm(i,r,n,e));wm(o,r,n,e)}});function wm(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(Jr(o))}}var ub=()=>{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 i=n[o.expected]??o.expected,a=A(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${R(o.values[0])}`:`Invalid option: expected one of ${Z(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??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":""}: ${Z(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function wu(){return{localeError:ub()}}var jm;var zu=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 Iu(){return new zu}(jm=globalThis).__zod_globalRegistry??(jm.__zod_globalRegistry=Iu());var Ze=globalThis.__zod_globalRegistry;function Pu(e,t){return new e({type:"string",...x(t)})}function Pi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...x(t)})}function to(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...x(t)})}function Ti(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...x(t)})}function ji(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...x(t)})}function Ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...x(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...x(t)})}function ro(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...x(t)})}function Ni(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...x(t)})}function Di(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...x(t)})}function Zi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...x(t)})}function Ri(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...x(t)})}function Ui(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...x(t)})}function Ai(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...x(t)})}function Ci(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...x(t)})}function Mi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...x(t)})}function qi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...x(t)})}function Tu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...x(t)})}function Li(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...x(t)})}function Fi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...x(t)})}function Vi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...x(t)})}function Ji(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...x(t)})}function Ki(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...x(t)})}function Bi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...x(t)})}function ju(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...x(t)})}function Eu(e,t){return new e({type:"string",format:"date",check:"string_format",...x(t)})}function Ou(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...x(t)})}function Nu(e,t){return new e({type:"string",format:"duration",check:"string_format",...x(t)})}function Du(e,t){return new e({type:"number",checks:[],...x(t)})}function Zu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...x(t)})}function Ru(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...x(t)})}function Uu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...x(t)})}function Au(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...x(t)})}function Cu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...x(t)})}function Mu(e,t){return new e({type:"boolean",...x(t)})}function qu(e,t){return new e({type:"bigint",...x(t)})}function Lu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...x(t)})}function Fu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...x(t)})}function Vu(e,t){return new e({type:"symbol",...x(t)})}function Ju(e,t){return new e({type:"undefined",...x(t)})}function Ku(e,t){return new e({type:"null",...x(t)})}function Bu(e){return new e({type:"any"})}function Hu(e){return new e({type:"unknown"})}function Gu(e,t){return new e({type:"never",...x(t)})}function Wu(e,t){return new e({type:"void",...x(t)})}function Xu(e,t){return new e({type:"date",...x(t)})}function Yu(e,t){return new e({type:"nan",...x(t)})}function Nt(e,t){return new mc({check:"less_than",...x(t),value:e,inclusive:!1})}function He(e,t){return new mc({check:"less_than",...x(t),value:e,inclusive:!0})}function Dt(e,t){return new hc({check:"greater_than",...x(t),value:e,inclusive:!1})}function Re(e,t){return new hc({check:"greater_than",...x(t),value:e,inclusive:!0})}function Qu(e){return Dt(0,e)}function el(e){return Nt(0,e)}function tl(e){return He(0,e)}function rl(e){return Re(0,e)}function mr(e,t){return new Hf({check:"multiple_of",...x(t),value:e})}function hr(e,t){return new Xf({check:"max_size",...x(t),maximum:e})}function Zt(e,t){return new Yf({check:"min_size",...x(t),minimum:e})}function Br(e,t){return new Qf({check:"size_equals",...x(t),size:e})}function Hr(e,t){return new em({check:"max_length",...x(t),maximum:e})}function Gt(e,t){return new tm({check:"min_length",...x(t),minimum:e})}function Gr(e,t){return new rm({check:"length_equals",...x(t),length:e})}function no(e,t){return new nm({check:"string_format",format:"regex",...x(t),pattern:e})}function oo(e){return new om({check:"string_format",format:"lowercase",...x(e)})}function io(e){return new im({check:"string_format",format:"uppercase",...x(e)})}function ao(e,t){return new am({check:"string_format",format:"includes",...x(t),includes:e})}function so(e,t){return new sm({check:"string_format",format:"starts_with",...x(t),prefix:e})}function co(e,t){return new cm({check:"string_format",format:"ends_with",...x(t),suffix:e})}function nl(e,t,r){return new um({check:"property",property:e,schema:t,...x(r)})}function uo(e,t){return new lm({check:"mime_type",mime:e,...x(t)})}function xt(e){return new dm({check:"overwrite",tx:e})}function lo(e){return xt(t=>t.normalize(e))}function po(){return xt(e=>e.trim())}function fo(){return xt(e=>e.toLowerCase())}function mo(){return xt(e=>e.toUpperCase())}function Hi(){return xt(e=>Ns(e))}function Em(e,t,r){return new e({type:"array",element:t,...x(r)})}function ol(e,t){return new e({type:"file",...x(t)})}function il(e,t,r){let n=x(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function al(e,t,r){return new e({type:"custom",check:"custom",fn:t,...x(r)})}function sl(e){let t=fb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Jr(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(Jr(o))}},e(r.value,r)));return t}function fb(e,t){let r=new se({check:"custom",...x(t)});return r._zod.check=e,r}function cl(e){let t=new se({check:"describe"});return t._zod.onattach=[r=>{let n=Ze.get(r)??{};Ze.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function ul(e){let t=new se({check:"meta"});return t._zod.onattach=[r=>{let n=Ze.get(r)??{};Ze.add(r,{...n,...e})}],t._zod.check=()=>{},t}function ll(e,t){let r=x(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),a=new Set(o),s=e.Codec??eo,c=e.Boolean??Yn,u=e.String??fr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),m=new s({type:"pipe",in:l,out:d,transform:((p,h)=>{let v=p;return r.case!=="sensitive"&&(v=v.toLowerCase()),i.has(v)?!0:a.has(v)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:m,continue:!1}),{})}),reverseTransform:((p,h)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return m}function Wr(e,t,r,n={}){let o=x(n),i={...x(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}function Gi(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??Ze,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 de(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let m=a.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),de(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Ue(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Wi(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 a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,m=e.external.uri??(h=>h);if(d)return{ref:m(d)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${m("__shared")}#/${s}/${p}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
45
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");let k=p.compile();return(x,D)=>k(f,x,D)},i,a=hr,s=!yi.jitless,u=s&&Ls.value,l=t.catchall,d;e._zod.parse=(f,p)=>{d??(d=n.value);let h=f.value;return a(h)?s&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(t.shape)),f=i(f,p),l?Vm([],h,f,p,d,e):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f)}});function Om(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Xt(i));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(i=>i.issues.map(a=>Ve(a,n,xe())))}),t)}var no=m("$ZodUnion",(e,t)=>{q.init(e,t),V(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),V(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Fn(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Om(c,o,e,i)):Om(s,o,e,i)}});function Dm(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>Ve(a,n,xe())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var cu=m("$ZodXor",(e,t)=>{no.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>Dm(c,o,e,i)):Dm(s,o,e,i)}}),uu=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,no.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Br(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!hr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),lu=m("$ZodIntersection",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Nm(r,c,u)):Nm(r,i,a)}});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(Wt(e)&&Wt(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Sc(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.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],i=t[n],a=Sc(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Nm(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),Xt(e))return e;let a=Sc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Ni=m("$ZodTuple",(e,t)=>{q.init(e,t);let r=t.items;e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(f=>Ii(f,n,u))):Ii(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let f=t.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?a.push(f.then(p=>Ii(p,n,u))):Ii(f,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Ii(e,t,r){e.issues.length&&t.issues.push(...Xe(r,e.issues)),t.value[r]=e.value}var du=m("$ZodRecord",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Wt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Xe(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Xe(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.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 s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Si.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),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[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Ve(d,n,xe())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Xe(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Xe(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),pu=m("$ZodMap",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{Rm(l,d,r,a,o,e,n)})):Rm(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function Rm(e,t,r,n,o,i,a){e.issues.length&&(qn.has(typeof n)?r.issues.push(...Xe(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>Ve(s,a,xe()))})),t.issues.length&&(qn.has(typeof n)?r.issues.push(...Xe(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>Ve(s,a,xe()))})),r.value.set(e.value,t.value)}var fu=m("$ZodSet",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>Zm(c,r))):Zm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Zm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var mu=m("$ZodEnum",(e,t)=>{q.init(e,t);let r=Mn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>qn.has(typeof o)).map(o=>typeof o=="string"?nt(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),hu=m("$ZodLiteral",(e,t)=>{if(q.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"?nt(n):n?nt(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),gu=m("$ZodFile",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),vu=m("$ZodTransform",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new kt;return r.value=o,r}});function Am(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ri=m("$ZodOptional",(e,t)=>{q.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Fn(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Am(i,r.value)):Am(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),yu=m("$ZodExactOptional",(e,t)=>{Ri.init(e,t),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),_u=m("$ZodNullable",(e,t)=>{q.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Fn(r.source)}|null)$`):void 0}),V(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)}),$u=m("$ZodDefault",(e,t)=>{q.init(e,t),e._zod.optin="optional",V(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(i=>Cm(i,t)):Cm(o,t)}});function Cm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var bu=m("$ZodPrefault",(e,t)=>{q.init(e,t),e._zod.optin="optional",V(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))}),xu=m("$ZodNonOptional",(e,t)=>{q.init(e,t),V(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(i=>Um(i,e)):Um(o,e)}});function Um(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 ku=m("$ZodSuccess",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),wu=m("$ZodCatch",(e,t)=>{q.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(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(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>Ve(a,n,xe()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Ve(i,n,xe()))},input:r.value}),r.issues=[]),r)}}),Su=m("$ZodNaN",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),zu=m("$ZodPipe",(e,t)=>{q.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Pi(a,t.in,n)):Pi(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Pi(i,t.out,n)):Pi(o,t.out,n)}});function Pi(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var oo=m("$ZodCodec",(e,t)=>{q.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Ti(a,t,n)):Ti(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ti(a,t,n)):Ti(i,t,n)}}});function Ti(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>ji(e,i,t.out,r)):ji(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>ji(e,i,t.in,r)):ji(e,o,t.in,r)}}function ji(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Iu=m("$ZodReadonly",(e,t)=>{q.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>t.innerType?._zod?.optin),V(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(Mm):Mm(o)}});function Mm(e){return e.value=Object.freeze(e.value),e}var Pu=m("$ZodTemplateLiteral",(e,t)=>{q.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Js.has(typeof n))r.push(nt(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Tu=m("$ZodFunction",(e,t)=>(q.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?Kn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Kn(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=e._def.input?await Gn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Gn(e._def.output,i):i}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Ni({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),ju=m("$ZodPromise",(e,t)=>{q.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),Eu=m("$ZodLazy",(e,t)=>{q.init(e,t),V(e._zod,"innerType",()=>t.getter()),V(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),V(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),V(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),V(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ou=m("$ZodCustom",(e,t)=>{ue.init(e,t),q.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(i=>Fm(i,r,n,e));Fm(o,r,n,e)}});function Fm(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(Gr(o))}}var qb=()=>{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 i=n[o.expected]??o.expected,a=U(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${A(o.values[0])}`:`Invalid option: expected one of ${Z(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??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":""}: ${Z(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Du(){return{localeError:qb()}}var Km;var Ru=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 Zu(){return new Ru}(Km=globalThis).__zod_globalRegistry??(Km.__zod_globalRegistry=Zu());var Ue=globalThis.__zod_globalRegistry;function Au(e,t){return new e({type:"string",...S(t)})}function Zi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...S(t)})}function io(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...S(t)})}function Ai(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...S(t)})}function Ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(t)})}function Ui(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(t)})}function Mi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(t)})}function ao(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...S(t)})}function Fi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...S(t)})}function qi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(t)})}function Li(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...S(t)})}function Vi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(t)})}function Ji(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...S(t)})}function Hi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...S(t)})}function Ki(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(t)})}function Bi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(t)})}function Gi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(t)})}function Cu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...S(t)})}function Wi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(t)})}function Xi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(t)})}function Yi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...S(t)})}function Qi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...S(t)})}function ea(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...S(t)})}function ta(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...S(t)})}function Uu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(t)})}function Mu(e,t){return new e({type:"string",format:"date",check:"string_format",...S(t)})}function Fu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...S(t)})}function qu(e,t){return new e({type:"string",format:"duration",check:"string_format",...S(t)})}function Lu(e,t){return new e({type:"number",checks:[],...S(t)})}function Vu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...S(t)})}function Ju(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...S(t)})}function Hu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...S(t)})}function Ku(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...S(t)})}function Bu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...S(t)})}function Gu(e,t){return new e({type:"boolean",...S(t)})}function Wu(e,t){return new e({type:"bigint",...S(t)})}function Xu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...S(t)})}function Yu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...S(t)})}function Qu(e,t){return new e({type:"symbol",...S(t)})}function el(e,t){return new e({type:"undefined",...S(t)})}function tl(e,t){return new e({type:"null",...S(t)})}function rl(e){return new e({type:"any"})}function nl(e){return new e({type:"unknown"})}function ol(e,t){return new e({type:"never",...S(t)})}function il(e,t){return new e({type:"void",...S(t)})}function al(e,t){return new e({type:"date",...S(t)})}function sl(e,t){return new e({type:"nan",...S(t)})}function Zt(e,t){return new kc({check:"less_than",...S(t),value:e,inclusive:!1})}function Ye(e,t){return new kc({check:"less_than",...S(t),value:e,inclusive:!0})}function At(e,t){return new wc({check:"greater_than",...S(t),value:e,inclusive:!1})}function Me(e,t){return new wc({check:"greater_than",...S(t),value:e,inclusive:!0})}function cl(e){return At(0,e)}function ul(e){return Zt(0,e)}function ll(e){return Ye(0,e)}function dl(e){return Me(0,e)}function yr(e,t){return new dm({check:"multiple_of",...S(t),value:e})}function _r(e,t){return new mm({check:"max_size",...S(t),maximum:e})}function Ct(e,t){return new hm({check:"min_size",...S(t),minimum:e})}function Xr(e,t){return new gm({check:"size_equals",...S(t),size:e})}function Yr(e,t){return new vm({check:"max_length",...S(t),maximum:e})}function Yt(e,t){return new ym({check:"min_length",...S(t),minimum:e})}function Qr(e,t){return new _m({check:"length_equals",...S(t),length:e})}function so(e,t){return new $m({check:"string_format",format:"regex",...S(t),pattern:e})}function co(e){return new bm({check:"string_format",format:"lowercase",...S(e)})}function uo(e){return new xm({check:"string_format",format:"uppercase",...S(e)})}function lo(e,t){return new km({check:"string_format",format:"includes",...S(t),includes:e})}function po(e,t){return new wm({check:"string_format",format:"starts_with",...S(t),prefix:e})}function fo(e,t){return new Sm({check:"string_format",format:"ends_with",...S(t),suffix:e})}function pl(e,t,r){return new zm({check:"property",property:e,schema:t,...S(r)})}function mo(e,t){return new Im({check:"mime_type",mime:e,...S(t)})}function wt(e){return new Pm({check:"overwrite",tx:e})}function ho(e){return wt(t=>t.normalize(e))}function go(){return wt(e=>e.trim())}function vo(){return wt(e=>e.toLowerCase())}function yo(){return wt(e=>e.toUpperCase())}function ra(){return wt(e=>qs(e))}function Bm(e,t,r){return new e({type:"array",element:t,...S(r)})}function fl(e,t){return new e({type:"file",...S(t)})}function ml(e,t,r){let n=S(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function hl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...S(r)})}function gl(e){let t=Hb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Gr(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(Gr(o))}},e(r.value,r)));return t}function Hb(e,t){let r=new ue({check:"custom",...S(t)});return r._zod.check=e,r}function vl(e){let t=new ue({check:"describe"});return t._zod.onattach=[r=>{let n=Ue.get(r)??{};Ue.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function yl(e){let t=new ue({check:"meta"});return t._zod.onattach=[r=>{let n=Ue.get(r)??{};Ue.add(r,{...n,...e})}],t._zod.check=()=>{},t}function _l(e,t){let r=S(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),a=new Set(o),s=e.Codec??oo,c=e.Boolean??ro,u=e.String??vr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:l,out:d,transform:((p,h)=>{let g=p;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:f,continue:!1}),{})}),reverseTransform:((p,h)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function en(e,t,r,n={}){let o=S(n),i={...S(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}function na(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??Ue,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 fe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let f=a.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,f,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Fe(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function oa(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 a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,f=e.external.uri??(h=>h);if(d)return{ref:f(d)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${f("__shared")}#/${s}/${p}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
46
46
|
|
|
47
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function Xi(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 s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let m=e.seen.get(l),p=m.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===l)for(let v in c)v==="$ref"||v==="allOf"||v in u||delete c[v];if(p.$ref&&m.def)for(let v in c)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(c[v])===JSON.stringify(m.def[v])&&delete c[v]}let d=a._zod.parent;if(d&&d!==l){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let p in c)p==="$ref"||p==="allOf"||p in m.def&&JSON.stringify(c[p])===JSON.stringify(m.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:s.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 i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.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:ho(t,"input",e.processors),output:ho(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ue(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 Ue(n.element,r);if(n.type==="set")return Ue(n.valueType,r);if(n.type==="lazy")return Ue(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 Ue(n.innerType,r);if(n.type==="intersection")return Ue(n.left,r)||Ue(n.right,r);if(n.type==="record"||n.type==="map")return Ue(n.keyType,r)||Ue(n.valueType,r);if(n.type==="pipe")return Ue(n.in,r)||Ue(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ue(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ue(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ue(o,r))return!0;return!!(n.rest&&Ue(n.rest,r))}return!1}var Om=(e,t={})=>r=>{let n=Gi({...r,processors:t});return de(e,n),Wi(n,e),Xi(n,e)},ho=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=Gi({...o??{},target:i,io:t,processors:r});return de(e,a),Wi(a,e),Xi(a,e)};var mb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Nm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=mb[s]??s,o.format===""&&delete o.format,s==="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}))])}},Dm=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Zm=(e,t,r,n)=>{r.type="boolean"},Rm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Um=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Am=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Cm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Mm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},qm=(e,t,r,n)=>{r.not={}},Lm=(e,t,r,n)=>{},Fm=(e,t,r,n)=>{},Vm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Jm=(e,t,r,n)=>{let o=e._zod.def,i=Rn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Km=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Bm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Hm=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Gm=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},Wm=(e,t,r,n)=>{r.type="boolean"},Xm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ym=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Qm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},eh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},th=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},rh=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=de(i.element,t,{...n,path:[...n.path,"items"]})},nh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=de(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=de(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},dl=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>de(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},oh=(e,t,r,n)=>{let o=e._zod.def,i=de(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=de(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},ih=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((m,p)=>de(m,t,{...n,path:[...n.path,a,p]})),u=i.rest?de(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},ah=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=de(i.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=de(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=de(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},sh=(e,t,r,n)=>{let o=e._zod.def,i=de(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},ch=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},uh=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},lh=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},dh=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},ph=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;de(i,t,n);let a=t.seen.get(e);a.ref=i},fh=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},mh=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},pl=(e,t,r,n)=>{let o=e._zod.def;de(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},hh=(e,t,r,n)=>{let o=e._zod.innerType;de(o,t,n);let i=t.seen.get(e);i.ref=o};function Xr(e){return!!e._zod}function Wt(e,t){return Xr(e)?Kr(e,t):e.safeParse(t)}function Yi(e){if(!e)return;let t;if(Xr(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function _h(e){if(Xr(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.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 go={};xn(go,{ZodAny:()=>Uh,ZodArray:()=>qh,ZodBase64:()=>Rl,ZodBase64URL:()=>Ul,ZodBigInt:()=>sa,ZodBigIntFormat:()=>Ml,ZodBoolean:()=>aa,ZodCIDRv4:()=>Dl,ZodCIDRv6:()=>Zl,ZodCUID:()=>Il,ZodCUID2:()=>Pl,ZodCatch:()=>sg,ZodCodec:()=>Bl,ZodCustom:()=>pa,ZodCustomStringFormat:()=>yo,ZodDate:()=>Ll,ZodDefault:()=>tg,ZodDiscriminatedUnion:()=>Fh,ZodE164:()=>Al,ZodEmail:()=>wl,ZodEmoji:()=>Sl,ZodEnum:()=>vo,ZodExactOptional:()=>Yh,ZodFile:()=>Wh,ZodFunction:()=>gg,ZodGUID:()=>ea,ZodIPv4:()=>Ol,ZodIPv6:()=>Nl,ZodIntersection:()=>Vh,ZodJWT:()=>Cl,ZodKSUID:()=>El,ZodLazy:()=>fg,ZodLiteral:()=>Gh,ZodMAC:()=>Nh,ZodMap:()=>Bh,ZodNaN:()=>ug,ZodNanoID:()=>zl,ZodNever:()=>Ch,ZodNonOptional:()=>Jl,ZodNull:()=>Rh,ZodNullable:()=>eg,ZodNumber:()=>ia,ZodNumberFormat:()=>Yr,ZodObject:()=>ca,ZodOptional:()=>Vl,ZodPipe:()=>Kl,ZodPrefault:()=>ng,ZodPromise:()=>hg,ZodReadonly:()=>lg,ZodRecord:()=>da,ZodSet:()=>Hh,ZodString:()=>na,ZodStringFormat:()=>ce,ZodSuccess:()=>ag,ZodSymbol:()=>Dh,ZodTemplateLiteral:()=>pg,ZodTransform:()=>Xh,ZodTuple:()=>Jh,ZodType:()=>J,ZodULID:()=>Tl,ZodURL:()=>oa,ZodUUID:()=>Rt,ZodUndefined:()=>Zh,ZodUnion:()=>ua,ZodUnknown:()=>Ah,ZodVoid:()=>Mh,ZodXID:()=>jl,ZodXor:()=>Lh,_ZodString:()=>kl,_default:()=>rg,_function:()=>Ox,any:()=>mx,array:()=>W,base64:()=>Xb,base64url:()=>Yb,bigint:()=>ux,boolean:()=>ve,catch:()=>cg,check:()=>Nx,cidrv4:()=>Gb,cidrv6:()=>Wb,codec:()=>Tx,cuid:()=>qb,cuid2:()=>Lb,custom:()=>Hl,date:()=>gx,describe:()=>Dx,discriminatedUnion:()=>la,e164:()=>Qb,email:()=>Eb,emoji:()=>Cb,enum:()=>Te,exactOptional:()=>Qh,file:()=>Sx,float32:()=>ix,float64:()=>ax,function:()=>Ox,guid:()=>Ob,hash:()=>ox,hex:()=>nx,hostname:()=>rx,httpUrl:()=>Ab,instanceof:()=>Rx,int:()=>xl,int32:()=>sx,int64:()=>lx,intersection:()=>$o,ipv4:()=>Kb,ipv6:()=>Hb,json:()=>Ax,jwt:()=>ex,keyof:()=>vx,ksuid:()=>Jb,lazy:()=>mg,literal:()=>T,looseObject:()=>Pe,looseRecord:()=>bx,mac:()=>Bb,map:()=>xx,meta:()=>Zx,nan:()=>Px,nanoid:()=>Mb,nativeEnum:()=>wx,never:()=>ql,nonoptional:()=>ig,null:()=>_o,nullable:()=>ta,nullish:()=>zx,number:()=>ne,object:()=>z,optional:()=>fe,partialRecord:()=>$x,pipe:()=>ra,prefault:()=>og,preprocess:()=>fa,promise:()=>Ex,readonly:()=>dg,record:()=>pe,refine:()=>vg,set:()=>kx,strictObject:()=>yx,string:()=>g,stringFormat:()=>tx,stringbool:()=>Ux,success:()=>Ix,superRefine:()=>yg,symbol:()=>px,templateLiteral:()=>jx,transform:()=>Fl,tuple:()=>Kh,uint32:()=>cx,uint64:()=>dx,ulid:()=>Fb,undefined:()=>fx,union:()=>ie,unknown:()=>ue,url:()=>Ub,uuid:()=>Nb,uuidv4:()=>Db,uuidv6:()=>Zb,uuidv7:()=>Rb,void:()=>hx,xid:()=>Vb,xor:()=>_x});var Qi={};xn(Qi,{endsWith:()=>co,gt:()=>Dt,gte:()=>Re,includes:()=>ao,length:()=>Gr,lowercase:()=>oo,lt:()=>Nt,lte:()=>He,maxLength:()=>Hr,maxSize:()=>hr,mime:()=>uo,minLength:()=>Gt,minSize:()=>Zt,multipleOf:()=>mr,negative:()=>el,nonnegative:()=>rl,nonpositive:()=>tl,normalize:()=>lo,overwrite:()=>xt,positive:()=>Qu,property:()=>nl,regex:()=>no,size:()=>Br,slugify:()=>Hi,startsWith:()=>so,toLowerCase:()=>fo,toUpperCase:()=>mo,trim:()=>po,uppercase:()=>io});var gr={};xn(gr,{ZodISODate:()=>gl,ZodISODateTime:()=>ml,ZodISODuration:()=>$l,ZodISOTime:()=>yl,date:()=>vl,datetime:()=>hl,duration:()=>bl,time:()=>_l});var ml=f("ZodISODateTime",(e,t)=>{Pc.init(e,t),ce.init(e,t)});function hl(e){return ju(ml,e)}var gl=f("ZodISODate",(e,t)=>{Tc.init(e,t),ce.init(e,t)});function vl(e){return Eu(gl,e)}var yl=f("ZodISOTime",(e,t)=>{jc.init(e,t),ce.init(e,t)});function _l(e){return Ou(yl,e)}var $l=f("ZodISODuration",(e,t)=>{Ec.init(e,t),ce.init(e,t)});function bl(e){return Nu($l,e)}var $h=(e,t)=>{fi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>hi(e,r)},flatten:{value:r=>mi(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Fr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Fr,2)}},isEmpty:{get(){return e.issues.length===0}}})},E4=f("ZodError",$h),Ge=f("ZodError",$h,{Parent:Error});var bh=Ln(Ge),xh=Vn(Ge),kh=Kn(Ge),wh=Bn(Ge),Sh=Zf(Ge),zh=Rf(Ge),Ih=Uf(Ge),Ph=Af(Ge),Th=Cf(Ge),jh=Mf(Ge),Eh=qf(Ge),Oh=Lf(Ge);var J=f("ZodType",(e,t)=>(L.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ho(e,"input"),output:ho(e,"output")}}),e.toJSONSchema=Om(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(_.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>De(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>bh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>kh(e,r,n),e.parseAsync=async(r,n)=>xh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>wh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Sh(e,r,n),e.decode=(r,n)=>zh(e,r,n),e.encodeAsync=async(r,n)=>Ih(e,r,n),e.decodeAsync=async(r,n)=>Ph(e,r,n),e.safeEncode=(r,n)=>Th(e,r,n),e.safeDecode=(r,n)=>jh(e,r,n),e.safeEncodeAsync=async(r,n)=>Eh(e,r,n),e.safeDecodeAsync=async(r,n)=>Oh(e,r,n),e.refine=(r,n)=>e.check(vg(r,n)),e.superRefine=r=>e.check(yg(r)),e.overwrite=r=>e.check(xt(r)),e.optional=()=>fe(e),e.exactOptional=()=>Qh(e),e.nullable=()=>ta(e),e.nullish=()=>fe(ta(e)),e.nonoptional=r=>ig(e,r),e.array=()=>W(e),e.or=r=>ie([e,r]),e.and=r=>$o(e,r),e.transform=r=>ra(e,Fl(r)),e.default=r=>rg(e,r),e.prefault=r=>og(e,r),e.catch=r=>cg(e,r),e.pipe=r=>ra(e,r),e.readonly=()=>dg(e),e.describe=r=>{let n=e.clone();return Ze.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ze.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ze.get(e);let n=e.clone();return Ze.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),kl=f("_ZodString",(e,t)=>{fr.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Nm(e,n,o,i);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(no(...n)),e.includes=(...n)=>e.check(ao(...n)),e.startsWith=(...n)=>e.check(so(...n)),e.endsWith=(...n)=>e.check(co(...n)),e.min=(...n)=>e.check(Gt(...n)),e.max=(...n)=>e.check(Hr(...n)),e.length=(...n)=>e.check(Gr(...n)),e.nonempty=(...n)=>e.check(Gt(1,...n)),e.lowercase=n=>e.check(oo(n)),e.uppercase=n=>e.check(io(n)),e.trim=()=>e.check(po()),e.normalize=(...n)=>e.check(lo(...n)),e.toLowerCase=()=>e.check(fo()),e.toUpperCase=()=>e.check(mo()),e.slugify=()=>e.check(Hi())}),na=f("ZodString",(e,t)=>{fr.init(e,t),kl.init(e,t),e.email=r=>e.check(Pi(wl,r)),e.url=r=>e.check(ro(oa,r)),e.jwt=r=>e.check(Bi(Cl,r)),e.emoji=r=>e.check(Ni(Sl,r)),e.guid=r=>e.check(to(ea,r)),e.uuid=r=>e.check(Ti(Rt,r)),e.uuidv4=r=>e.check(ji(Rt,r)),e.uuidv6=r=>e.check(Ei(Rt,r)),e.uuidv7=r=>e.check(Oi(Rt,r)),e.nanoid=r=>e.check(Di(zl,r)),e.guid=r=>e.check(to(ea,r)),e.cuid=r=>e.check(Zi(Il,r)),e.cuid2=r=>e.check(Ri(Pl,r)),e.ulid=r=>e.check(Ui(Tl,r)),e.base64=r=>e.check(Vi(Rl,r)),e.base64url=r=>e.check(Ji(Ul,r)),e.xid=r=>e.check(Ai(jl,r)),e.ksuid=r=>e.check(Ci(El,r)),e.ipv4=r=>e.check(Mi(Ol,r)),e.ipv6=r=>e.check(qi(Nl,r)),e.cidrv4=r=>e.check(Li(Dl,r)),e.cidrv6=r=>e.check(Fi(Zl,r)),e.e164=r=>e.check(Ki(Al,r)),e.datetime=r=>e.check(hl(r)),e.date=r=>e.check(vl(r)),e.time=r=>e.check(_l(r)),e.duration=r=>e.check(bl(r))});function g(e){return Pu(na,e)}var ce=f("ZodStringFormat",(e,t)=>{oe.init(e,t),kl.init(e,t)}),wl=f("ZodEmail",(e,t)=>{_c.init(e,t),ce.init(e,t)});function Eb(e){return Pi(wl,e)}var ea=f("ZodGUID",(e,t)=>{vc.init(e,t),ce.init(e,t)});function Ob(e){return to(ea,e)}var Rt=f("ZodUUID",(e,t)=>{yc.init(e,t),ce.init(e,t)});function Nb(e){return Ti(Rt,e)}function Db(e){return ji(Rt,e)}function Zb(e){return Ei(Rt,e)}function Rb(e){return Oi(Rt,e)}var oa=f("ZodURL",(e,t)=>{$c.init(e,t),ce.init(e,t)});function Ub(e){return ro(oa,e)}function Ab(e){return ro(oa,{protocol:/^https?$/,hostname:tt.domain,..._.normalizeParams(e)})}var Sl=f("ZodEmoji",(e,t)=>{bc.init(e,t),ce.init(e,t)});function Cb(e){return Ni(Sl,e)}var zl=f("ZodNanoID",(e,t)=>{xc.init(e,t),ce.init(e,t)});function Mb(e){return Di(zl,e)}var Il=f("ZodCUID",(e,t)=>{kc.init(e,t),ce.init(e,t)});function qb(e){return Zi(Il,e)}var Pl=f("ZodCUID2",(e,t)=>{wc.init(e,t),ce.init(e,t)});function Lb(e){return Ri(Pl,e)}var Tl=f("ZodULID",(e,t)=>{Sc.init(e,t),ce.init(e,t)});function Fb(e){return Ui(Tl,e)}var jl=f("ZodXID",(e,t)=>{zc.init(e,t),ce.init(e,t)});function Vb(e){return Ai(jl,e)}var El=f("ZodKSUID",(e,t)=>{Ic.init(e,t),ce.init(e,t)});function Jb(e){return Ci(El,e)}var Ol=f("ZodIPv4",(e,t)=>{Oc.init(e,t),ce.init(e,t)});function Kb(e){return Mi(Ol,e)}var Nh=f("ZodMAC",(e,t)=>{Dc.init(e,t),ce.init(e,t)});function Bb(e){return Tu(Nh,e)}var Nl=f("ZodIPv6",(e,t)=>{Nc.init(e,t),ce.init(e,t)});function Hb(e){return qi(Nl,e)}var Dl=f("ZodCIDRv4",(e,t)=>{Zc.init(e,t),ce.init(e,t)});function Gb(e){return Li(Dl,e)}var Zl=f("ZodCIDRv6",(e,t)=>{Rc.init(e,t),ce.init(e,t)});function Wb(e){return Fi(Zl,e)}var Rl=f("ZodBase64",(e,t)=>{Uc.init(e,t),ce.init(e,t)});function Xb(e){return Vi(Rl,e)}var Ul=f("ZodBase64URL",(e,t)=>{Ac.init(e,t),ce.init(e,t)});function Yb(e){return Ji(Ul,e)}var Al=f("ZodE164",(e,t)=>{Cc.init(e,t),ce.init(e,t)});function Qb(e){return Ki(Al,e)}var Cl=f("ZodJWT",(e,t)=>{Mc.init(e,t),ce.init(e,t)});function ex(e){return Bi(Cl,e)}var yo=f("ZodCustomStringFormat",(e,t)=>{qc.init(e,t),ce.init(e,t)});function tx(e,t,r={}){return Wr(yo,e,t,r)}function rx(e){return Wr(yo,"hostname",tt.hostname,e)}function nx(e){return Wr(yo,"hex",tt.hex,e)}function ox(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=tt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Wr(yo,n,o,t)}var ia=f("ZodNumber",(e,t)=>{wi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Dm(e,n,o,i),e.gt=(n,o)=>e.check(Dt(n,o)),e.gte=(n,o)=>e.check(Re(n,o)),e.min=(n,o)=>e.check(Re(n,o)),e.lt=(n,o)=>e.check(Nt(n,o)),e.lte=(n,o)=>e.check(He(n,o)),e.max=(n,o)=>e.check(He(n,o)),e.int=n=>e.check(xl(n)),e.safe=n=>e.check(xl(n)),e.positive=n=>e.check(Dt(0,n)),e.nonnegative=n=>e.check(Re(0,n)),e.negative=n=>e.check(Nt(0,n)),e.nonpositive=n=>e.check(He(0,n)),e.multipleOf=(n,o)=>e.check(mr(n,o)),e.step=(n,o)=>e.check(mr(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 ne(e){return Du(ia,e)}var Yr=f("ZodNumberFormat",(e,t)=>{Lc.init(e,t),ia.init(e,t)});function xl(e){return Zu(Yr,e)}function ix(e){return Ru(Yr,e)}function ax(e){return Uu(Yr,e)}function sx(e){return Au(Yr,e)}function cx(e){return Cu(Yr,e)}var aa=f("ZodBoolean",(e,t)=>{Yn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zm(e,r,n,o)});function ve(e){return Mu(aa,e)}var sa=f("ZodBigInt",(e,t)=>{Si.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Rm(e,n,o,i),e.gte=(n,o)=>e.check(Re(n,o)),e.min=(n,o)=>e.check(Re(n,o)),e.gt=(n,o)=>e.check(Dt(n,o)),e.gte=(n,o)=>e.check(Re(n,o)),e.min=(n,o)=>e.check(Re(n,o)),e.lt=(n,o)=>e.check(Nt(n,o)),e.lte=(n,o)=>e.check(He(n,o)),e.max=(n,o)=>e.check(He(n,o)),e.positive=n=>e.check(Dt(BigInt(0),n)),e.negative=n=>e.check(Nt(BigInt(0),n)),e.nonpositive=n=>e.check(He(BigInt(0),n)),e.nonnegative=n=>e.check(Re(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(mr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function ux(e){return qu(sa,e)}var Ml=f("ZodBigIntFormat",(e,t)=>{Fc.init(e,t),sa.init(e,t)});function lx(e){return Lu(Ml,e)}function dx(e){return Fu(Ml,e)}var Dh=f("ZodSymbol",(e,t)=>{Vc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Um(e,r,n,o)});function px(e){return Vu(Dh,e)}var Zh=f("ZodUndefined",(e,t)=>{Jc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cm(e,r,n,o)});function fx(e){return Ju(Zh,e)}var Rh=f("ZodNull",(e,t)=>{Kc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Am(e,r,n,o)});function _o(e){return Ku(Rh,e)}var Uh=f("ZodAny",(e,t)=>{Bc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lm(e,r,n,o)});function mx(){return Bu(Uh)}var Ah=f("ZodUnknown",(e,t)=>{Hc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fm(e,r,n,o)});function ue(){return Hu(Ah)}var Ch=f("ZodNever",(e,t)=>{Gc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qm(e,r,n,o)});function ql(e){return Gu(Ch,e)}var Mh=f("ZodVoid",(e,t)=>{Wc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mm(e,r,n,o)});function hx(e){return Wu(Mh,e)}var Ll=f("ZodDate",(e,t)=>{Xc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Vm(e,n,o,i),e.min=(n,o)=>e.check(Re(n,o)),e.max=(n,o)=>e.check(He(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function gx(e){return Xu(Ll,e)}var qh=f("ZodArray",(e,t)=>{Yc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Gt(r,n)),e.nonempty=r=>e.check(Gt(1,r)),e.max=(r,n)=>e.check(Hr(r,n)),e.length=(r,n)=>e.check(Gr(r,n)),e.unwrap=()=>e.element});function W(e,t){return Em(qh,e,t)}function vx(e){let t=e._zod.def.shape;return Te(Object.keys(t))}var ca=f("ZodObject",(e,t)=>{Tm.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nh(e,r,n,o),_.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Te(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ue()}),e.loose=()=>e.clone({...e._zod.def,catchall:ue()}),e.strict=()=>e.clone({...e._zod.def,catchall:ql()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>_.extend(e,r),e.safeExtend=r=>_.safeExtend(e,r),e.merge=r=>_.merge(e,r),e.pick=r=>_.pick(e,r),e.omit=r=>_.omit(e,r),e.partial=(...r)=>_.partial(Vl,e,r[0]),e.required=(...r)=>_.required(Jl,e,r[0])});function z(e,t){let r={type:"object",shape:e??{},..._.normalizeParams(t)};return new ca(r)}function yx(e,t){return new ca({type:"object",shape:e,catchall:ql(),..._.normalizeParams(t)})}function Pe(e,t){return new ca({type:"object",shape:e,catchall:ue(),..._.normalizeParams(t)})}var ua=f("ZodUnion",(e,t)=>{Qn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dl(e,r,n,o),e.options=t.options});function ie(e,t){return new ua({type:"union",options:e,..._.normalizeParams(t)})}var Lh=f("ZodXor",(e,t)=>{ua.init(e,t),Qc.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dl(e,r,n,o),e.options=t.options});function _x(e,t){return new Lh({type:"union",options:e,inclusive:!1,..._.normalizeParams(t)})}var Fh=f("ZodDiscriminatedUnion",(e,t)=>{ua.init(e,t),eu.init(e,t)});function la(e,t,r){return new Fh({type:"union",options:t,discriminator:e,..._.normalizeParams(r)})}var Vh=f("ZodIntersection",(e,t)=>{tu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o)});function $o(e,t){return new Vh({type:"intersection",left:e,right:t})}var Jh=f("ZodTuple",(e,t)=>{zi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Kh(e,t,r){let n=t instanceof L,o=n?r:t,i=n?t:null;return new Jh({type:"tuple",items:e,rest:i,..._.normalizeParams(o)})}var da=f("ZodRecord",(e,t)=>{ru.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function pe(e,t,r){return new da({type:"record",keyType:e,valueType:t,..._.normalizeParams(r)})}function $x(e,t,r){let n=De(e);return n._zod.values=void 0,new da({type:"record",keyType:n,valueType:t,..._.normalizeParams(r)})}function bx(e,t,r){return new da({type:"record",keyType:e,valueType:t,mode:"loose",..._.normalizeParams(r)})}var Bh=f("ZodMap",(e,t)=>{nu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Zt(...r)),e.nonempty=r=>e.check(Zt(1,r)),e.max=(...r)=>e.check(hr(...r)),e.size=(...r)=>e.check(Br(...r))});function xx(e,t,r){return new Bh({type:"map",keyType:e,valueType:t,..._.normalizeParams(r)})}var Hh=f("ZodSet",(e,t)=>{ou.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>th(e,r,n,o),e.min=(...r)=>e.check(Zt(...r)),e.nonempty=r=>e.check(Zt(1,r)),e.max=(...r)=>e.check(hr(...r)),e.size=(...r)=>e.check(Br(...r))});function kx(e,t){return new Hh({type:"set",valueType:e,..._.normalizeParams(t)})}var vo=f("ZodEnum",(e,t)=>{iu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Jm(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new vo({...t,checks:[],..._.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new vo({...t,checks:[],..._.normalizeParams(o),entries:i})}});function Te(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new vo({type:"enum",entries:r,..._.normalizeParams(t)})}function wx(e,t){return new vo({type:"enum",entries:e,..._.normalizeParams(t)})}var Gh=f("ZodLiteral",(e,t)=>{au.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Km(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 T(e,t){return new Gh({type:"literal",values:Array.isArray(e)?e:[e],..._.normalizeParams(t)})}var Wh=f("ZodFile",(e,t)=>{su.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gm(e,r,n,o),e.min=(r,n)=>e.check(Zt(r,n)),e.max=(r,n)=>e.check(hr(r,n)),e.mime=(r,n)=>e.check(uo(Array.isArray(r)?r:[r],n))});function Sx(e){return ol(Wh,e)}var Xh=f("ZodTransform",(e,t)=>{cu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qm(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new lr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(_.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(_.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Fl(e){return new Xh({type:"transform",transform:e})}var Vl=f("ZodOptional",(e,t)=>{Ii.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fe(e){return new Vl({type:"optional",innerType:e})}var Yh=f("ZodExactOptional",(e,t)=>{uu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Qh(e){return new Yh({type:"optional",innerType:e})}var eg=f("ZodNullable",(e,t)=>{lu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ta(e){return new eg({type:"nullable",innerType:e})}function zx(e){return fe(ta(e))}var tg=f("ZodDefault",(e,t)=>{du.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rg(e,t){return new tg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():_.shallowClone(t)}})}var ng=f("ZodPrefault",(e,t)=>{pu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function og(e,t){return new ng({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():_.shallowClone(t)}})}var Jl=f("ZodNonOptional",(e,t)=>{fu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ch(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ig(e,t){return new Jl({type:"nonoptional",innerType:e,..._.normalizeParams(t)})}var ag=f("ZodSuccess",(e,t)=>{mu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wm(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ix(e){return new ag({type:"success",innerType:e})}var sg=f("ZodCatch",(e,t)=>{hu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cg(e,t){return new sg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var ug=f("ZodNaN",(e,t)=>{gu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bm(e,r,n,o)});function Px(e){return Yu(ug,e)}var Kl=f("ZodPipe",(e,t)=>{vu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ph(e,r,n,o),e.in=t.in,e.out=t.out});function ra(e,t){return new Kl({type:"pipe",in:e,out:t})}var Bl=f("ZodCodec",(e,t)=>{Kl.init(e,t),eo.init(e,t)});function Tx(e,t,r){return new Bl({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var lg=f("ZodReadonly",(e,t)=>{yu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dg(e){return new lg({type:"readonly",innerType:e})}var pg=f("ZodTemplateLiteral",(e,t)=>{_u.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hm(e,r,n,o)});function jx(e,t){return new pg({type:"template_literal",parts:e,..._.normalizeParams(t)})}var fg=f("ZodLazy",(e,t)=>{xu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function mg(e){return new fg({type:"lazy",getter:e})}var hg=f("ZodPromise",(e,t)=>{bu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ex(e){return new hg({type:"promise",innerType:e})}var gg=f("ZodFunction",(e,t)=>{$u.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o)});function Ox(e){return new gg({type:"function",input:Array.isArray(e?.input)?Kh(e?.input):e?.input??W(ue()),output:e?.output??ue()})}var pa=f("ZodCustom",(e,t)=>{ku.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xm(e,r,n,o)});function Nx(e){let t=new se({check:"custom"});return t._zod.check=e,t}function Hl(e,t){return il(pa,e??(()=>!0),t)}function vg(e,t={}){return al(pa,e,t)}function yg(e){return sl(e)}var Dx=cl,Zx=ul;function Rx(e,t={}){let r=new pa({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,..._.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Ux=(...e)=>ll({Codec:Bl,Boolean:aa,String:na},...e);function Ax(e){let t=mg(()=>ie([g(e),ne(),ve(),_o(),W(t),pe(g(),t)]));return t}function fa(e,t){return ra(Fl(e),t)}var _g;_g||(_g={});var C4={...go,...Qi,iso:gr};_e(wu());var Wl="2025-11-25";var $g=[Wl,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Xt="io.modelcontextprotocol/related-task",ha="2.0",$e=Hl(e=>e!==null&&(typeof e=="object"||typeof e=="function")),bg=ie([g(),ne().int()]),xg=g(),oN=Pe({ttl:ie([ne(),_o()]).optional(),pollInterval:ne().optional()}),Lx=z({ttl:ne().optional()}),Fx=z({taskId:g()}),Xl=Pe({progressToken:bg.optional(),[Xt]:Fx.optional()}),We=z({_meta:Xl.optional()}),bo=We.extend({task:Lx.optional()}),kg=e=>bo.safeParse(e).success,be=z({method:g(),params:We.loose().optional()}),rt=z({_meta:Xl.optional()}),nt=z({method:g(),params:rt.loose().optional()}),xe=Pe({_meta:Xl.optional()}),ga=ie([g(),ne().int()]),wg=z({jsonrpc:T(ha),id:ga,...be.shape}).strict(),Yl=e=>wg.safeParse(e).success,Sg=z({jsonrpc:T(ha),...nt.shape}).strict(),zg=e=>Sg.safeParse(e).success,Ql=z({jsonrpc:T(ha),id:ga,result:xe}).strict(),xo=e=>Ql.safeParse(e).success;var M;(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"})(M||(M={}));var ed=z({jsonrpc:T(ha),id:ga.optional(),error:z({code:ne().int(),message:g(),data:ue().optional()})}).strict();var Ig=e=>ed.safeParse(e).success;var Pg=ie([wg,Sg,Ql,ed]),iN=ie([Ql,ed]),va=xe.strict(),Vx=rt.extend({requestId:ga.optional(),reason:g().optional()}),ya=nt.extend({method:T("notifications/cancelled"),params:Vx}),Jx=z({src:g(),mimeType:g().optional(),sizes:W(g()).optional(),theme:Te(["light","dark"]).optional()}),ko=z({icons:W(Jx).optional()}),Qr=z({name:g(),title:g().optional()}),Tg=Qr.extend({...Qr.shape,...ko.shape,version:g(),websiteUrl:g().optional(),description:g().optional()}),Kx=$o(z({applyDefaults:ve().optional()}),pe(g(),ue())),Bx=fa(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,$o(z({form:Kx.optional(),url:$e.optional()}),pe(g(),ue()).optional())),Hx=Pe({list:$e.optional(),cancel:$e.optional(),requests:Pe({sampling:Pe({createMessage:$e.optional()}).optional(),elicitation:Pe({create:$e.optional()}).optional()}).optional()}),Gx=Pe({list:$e.optional(),cancel:$e.optional(),requests:Pe({tools:Pe({call:$e.optional()}).optional()}).optional()}),Wx=z({experimental:pe(g(),$e).optional(),sampling:z({context:$e.optional(),tools:$e.optional()}).optional(),elicitation:Bx.optional(),roots:z({listChanged:ve().optional()}).optional(),tasks:Hx.optional()}),Xx=We.extend({protocolVersion:g(),capabilities:Wx,clientInfo:Tg}),td=be.extend({method:T("initialize"),params:Xx});var Yx=z({experimental:pe(g(),$e).optional(),logging:$e.optional(),completions:$e.optional(),prompts:z({listChanged:ve().optional()}).optional(),resources:z({subscribe:ve().optional(),listChanged:ve().optional()}).optional(),tools:z({listChanged:ve().optional()}).optional(),tasks:Gx.optional()}),Qx=xe.extend({protocolVersion:g(),capabilities:Yx,serverInfo:Tg,instructions:g().optional()}),rd=nt.extend({method:T("notifications/initialized"),params:rt.optional()});var _a=be.extend({method:T("ping"),params:We.optional()}),ek=z({progress:ne(),total:fe(ne()),message:fe(g())}),tk=z({...rt.shape,...ek.shape,progressToken:bg}),$a=nt.extend({method:T("notifications/progress"),params:tk}),rk=We.extend({cursor:xg.optional()}),wo=be.extend({params:rk.optional()}),So=xe.extend({nextCursor:xg.optional()}),nk=Te(["working","input_required","completed","failed","cancelled"]),zo=z({taskId:g(),status:nk,ttl:ie([ne(),_o()]),createdAt:g(),lastUpdatedAt:g(),pollInterval:fe(ne()),statusMessage:fe(g())}),en=xe.extend({task:zo}),ok=rt.merge(zo),Io=nt.extend({method:T("notifications/tasks/status"),params:ok}),ba=be.extend({method:T("tasks/get"),params:We.extend({taskId:g()})}),xa=xe.merge(zo),ka=be.extend({method:T("tasks/result"),params:We.extend({taskId:g()})}),aN=xe.loose(),wa=wo.extend({method:T("tasks/list")}),Sa=So.extend({tasks:W(zo)}),za=be.extend({method:T("tasks/cancel"),params:We.extend({taskId:g()})}),jg=xe.merge(zo),Eg=z({uri:g(),mimeType:fe(g()),_meta:pe(g(),ue()).optional()}),Og=Eg.extend({text:g()}),nd=g().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ng=Eg.extend({blob:nd}),Po=Te(["user","assistant"]),tn=z({audience:W(Po).optional(),priority:ne().min(0).max(1).optional(),lastModified:gr.datetime({offset:!0}).optional()}),Dg=z({...Qr.shape,...ko.shape,uri:g(),description:fe(g()),mimeType:fe(g()),annotations:tn.optional(),_meta:fe(Pe({}))}),ik=z({...Qr.shape,...ko.shape,uriTemplate:g(),description:fe(g()),mimeType:fe(g()),annotations:tn.optional(),_meta:fe(Pe({}))}),od=wo.extend({method:T("resources/list")}),ak=So.extend({resources:W(Dg)}),sk=wo.extend({method:T("resources/templates/list")}),ck=So.extend({resourceTemplates:W(ik)}),id=We.extend({uri:g()}),uk=id,ad=be.extend({method:T("resources/read"),params:uk}),lk=xe.extend({contents:W(ie([Og,Ng]))}),dk=nt.extend({method:T("notifications/resources/list_changed"),params:rt.optional()}),pk=id,fk=be.extend({method:T("resources/subscribe"),params:pk}),mk=id,hk=be.extend({method:T("resources/unsubscribe"),params:mk}),gk=rt.extend({uri:g()}),vk=nt.extend({method:T("notifications/resources/updated"),params:gk}),yk=z({name:g(),description:fe(g()),required:fe(ve())}),_k=z({...Qr.shape,...ko.shape,description:fe(g()),arguments:fe(W(yk)),_meta:fe(Pe({}))}),sd=wo.extend({method:T("prompts/list")}),$k=So.extend({prompts:W(_k)}),bk=We.extend({name:g(),arguments:pe(g(),g()).optional()}),cd=be.extend({method:T("prompts/get"),params:bk}),ud=z({type:T("text"),text:g(),annotations:tn.optional(),_meta:pe(g(),ue()).optional()}),ld=z({type:T("image"),data:nd,mimeType:g(),annotations:tn.optional(),_meta:pe(g(),ue()).optional()}),dd=z({type:T("audio"),data:nd,mimeType:g(),annotations:tn.optional(),_meta:pe(g(),ue()).optional()}),xk=z({type:T("tool_use"),name:g(),id:g(),input:pe(g(),ue()),_meta:pe(g(),ue()).optional()}),kk=z({type:T("resource"),resource:ie([Og,Ng]),annotations:tn.optional(),_meta:pe(g(),ue()).optional()}),wk=Dg.extend({type:T("resource_link")}),pd=ie([ud,ld,dd,wk,kk]),Sk=z({role:Po,content:pd}),zk=xe.extend({description:g().optional(),messages:W(Sk)}),Ik=nt.extend({method:T("notifications/prompts/list_changed"),params:rt.optional()}),Pk=z({title:g().optional(),readOnlyHint:ve().optional(),destructiveHint:ve().optional(),idempotentHint:ve().optional(),openWorldHint:ve().optional()}),Tk=z({taskSupport:Te(["required","optional","forbidden"]).optional()}),Zg=z({...Qr.shape,...ko.shape,description:g().optional(),inputSchema:z({type:T("object"),properties:pe(g(),$e).optional(),required:W(g()).optional()}).catchall(ue()),outputSchema:z({type:T("object"),properties:pe(g(),$e).optional(),required:W(g()).optional()}).catchall(ue()).optional(),annotations:Pk.optional(),execution:Tk.optional(),_meta:pe(g(),ue()).optional()}),fd=wo.extend({method:T("tools/list")}),jk=So.extend({tools:W(Zg)}),Ia=xe.extend({content:W(pd).default([]),structuredContent:pe(g(),ue()).optional(),isError:ve().optional()}),sN=Ia.or(xe.extend({toolResult:ue()})),Ek=bo.extend({name:g(),arguments:pe(g(),ue()).optional()}),To=be.extend({method:T("tools/call"),params:Ek}),Ok=nt.extend({method:T("notifications/tools/list_changed"),params:rt.optional()}),cN=z({autoRefresh:ve().default(!0),debounceMs:ne().int().nonnegative().default(300)}),jo=Te(["debug","info","notice","warning","error","critical","alert","emergency"]),Nk=We.extend({level:jo}),md=be.extend({method:T("logging/setLevel"),params:Nk}),Dk=rt.extend({level:jo,logger:g().optional(),data:ue()}),Zk=nt.extend({method:T("notifications/message"),params:Dk}),Rk=z({name:g().optional()}),Uk=z({hints:W(Rk).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),Ak=z({mode:Te(["auto","required","none"]).optional()}),Ck=z({type:T("tool_result"),toolUseId:g().describe("The unique identifier for the corresponding tool call."),content:W(pd).default([]),structuredContent:z({}).loose().optional(),isError:ve().optional(),_meta:pe(g(),ue()).optional()}),Mk=la("type",[ud,ld,dd]),ma=la("type",[ud,ld,dd,xk,Ck]),qk=z({role:Po,content:ie([ma,W(ma)]),_meta:pe(g(),ue()).optional()}),Lk=bo.extend({messages:W(qk),modelPreferences:Uk.optional(),systemPrompt:g().optional(),includeContext:Te(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:W(g()).optional(),metadata:$e.optional(),tools:W(Zg).optional(),toolChoice:Ak.optional()}),Fk=be.extend({method:T("sampling/createMessage"),params:Lk}),hd=xe.extend({model:g(),stopReason:fe(Te(["endTurn","stopSequence","maxTokens"]).or(g())),role:Po,content:Mk}),gd=xe.extend({model:g(),stopReason:fe(Te(["endTurn","stopSequence","maxTokens","toolUse"]).or(g())),role:Po,content:ie([ma,W(ma)])}),Vk=z({type:T("boolean"),title:g().optional(),description:g().optional(),default:ve().optional()}),Jk=z({type:T("string"),title:g().optional(),description:g().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Te(["email","uri","date","date-time"]).optional(),default:g().optional()}),Kk=z({type:Te(["number","integer"]),title:g().optional(),description:g().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),Bk=z({type:T("string"),title:g().optional(),description:g().optional(),enum:W(g()),default:g().optional()}),Hk=z({type:T("string"),title:g().optional(),description:g().optional(),oneOf:W(z({const:g(),title:g()})),default:g().optional()}),Gk=z({type:T("string"),title:g().optional(),description:g().optional(),enum:W(g()),enumNames:W(g()).optional(),default:g().optional()}),Wk=ie([Bk,Hk]),Xk=z({type:T("array"),title:g().optional(),description:g().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({type:T("string"),enum:W(g())}),default:W(g()).optional()}),Yk=z({type:T("array"),title:g().optional(),description:g().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:z({anyOf:W(z({const:g(),title:g()}))}),default:W(g()).optional()}),Qk=ie([Xk,Yk]),ew=ie([Gk,Wk,Qk]),tw=ie([ew,Vk,Jk,Kk]),rw=bo.extend({mode:T("form").optional(),message:g(),requestedSchema:z({type:T("object"),properties:pe(g(),tw),required:W(g()).optional()})}),nw=bo.extend({mode:T("url"),message:g(),elicitationId:g(),url:g().url()}),ow=ie([rw,nw]),iw=be.extend({method:T("elicitation/create"),params:ow}),aw=rt.extend({elicitationId:g()}),sw=nt.extend({method:T("notifications/elicitation/complete"),params:aw}),Pa=xe.extend({action:Te(["accept","decline","cancel"]),content:fa(e=>e===null?void 0:e,pe(g(),ie([g(),ne(),ve(),W(g())])).optional())}),cw=z({type:T("ref/resource"),uri:g()});var uw=z({type:T("ref/prompt"),name:g()}),lw=We.extend({ref:ie([uw,cw]),argument:z({name:g(),value:g()}),context:z({arguments:pe(g(),g()).optional()}).optional()}),dw=be.extend({method:T("completion/complete"),params:lw});var pw=xe.extend({completion:Pe({values:W(g()).max(100),total:fe(ne().int()),hasMore:fe(ve())})}),fw=z({uri:g().startsWith("file://"),name:g().optional(),_meta:pe(g(),ue()).optional()}),mw=be.extend({method:T("roots/list"),params:We.optional()}),vd=xe.extend({roots:W(fw)}),hw=nt.extend({method:T("notifications/roots/list_changed"),params:rt.optional()}),uN=ie([_a,td,dw,md,cd,sd,od,sk,ad,fk,hk,To,fd,ba,ka,wa,za]),lN=ie([ya,$a,rd,hw,Io]),dN=ie([va,hd,gd,Pa,vd,xa,Sa,en]),pN=ie([_a,Fk,iw,mw,ba,ka,wa,za]),fN=ie([ya,$a,Zk,vk,dk,Ok,Ik,Io,sw]),mN=ie([va,Qx,pw,zk,$k,ak,ck,lk,Ia,jk,xa,Sa,en]),D=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===M.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Gl(o.elicitations,r)}return new e(t,r,n)}},Gl=class extends D{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(M.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function Yt(e){return e==="completed"||e==="failed"||e==="cancelled"}var HN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function yd(e){let r=Yi(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=_h(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function _d(e,t){let r=Wt(e,t);if(!r.success)throw r.error;return r.data}var bw=6e4,Ta=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(ya,r=>{this._oncancel(r)}),this.setNotificationHandler($a,r=>{this._onprogress(r)}),this.setRequestHandler(_a,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ba,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new D(M.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(ka,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,m=new D(d.error.code,d.error.message,d.error.data);l(m)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new D(M.InvalidParams,`Task not found: ${i}`);if(!Yt(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(Yt(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[Xt]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(wa,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new D(M.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(za,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new D(M.InvalidParams,`Task not found: ${r.params.taskId}`);if(Yt(o.status))throw new D(M.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 i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new D(M.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof D?o:new D(M.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,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,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),D.fromError(M.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=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),xo(i)||Ig(i)?this._onresponse(i):Yl(i)?this._onrequest(i,a):zg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=D.fromError(M.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,i=t.params?._meta?.[Xt]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:M.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{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 a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=kg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,m)=>{if(a.signal.aborted)throw new D(M.ConnectionClosed,"Request was cancelled");let p={...m,relatedRequestId:t.id};i&&!p.relatedTask&&(p.relatedTask={taskId:i});let h=p.relatedTask?.taskId??i;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,p)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:M.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{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.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),xo(t))n(t);else{let a=new D(t.error.code,t.error.message,t.error.data);n(a)}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 i=!1;if(xo(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),xo(t))o(t);else{let a=D.fromError(t.error.code,t.error.message,t.error.data);o(a)}}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(a){yield{type:"error",error:a instanceof D?a:new D(M.InternalError,String(a))}}return}let i;try{let a=await this.request(t,en,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new D(M.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},Yt(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new D(M.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new D(M.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof D?a:new D(M.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=O=>{l(O)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(O){d(O);return}n?.signal?.throwIfAborted();let m=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:m};n?.onprogress&&(this._progressHandlers.set(m,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:m}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[Xt]:c}});let h=O=>{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(O)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let P=O instanceof D?O:new D(M.RequestTimeout,String(O));l(P)};this._responseHandlers.set(m,O=>{if(!n?.signal?.aborted){if(O instanceof Error)return l(O);try{let P=Wt(r,O.result);P.success?u(P.data):l(P.error)}catch(P){l(P)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let v=n?.timeout??bw,$=()=>h(D.fromError(M.RequestTimeout,"Request timed out",{timeout:v}));this._setupTimeout(m,v,n?.maxTotalTimeout,$,n?.resetTimeoutOnProgress??!1);let k=c?.taskId;if(k){let O=P=>{let C=this._responseHandlers.get(m);C?C(P):this._onerror(new Error(`Response handler missing for side-channeled request ${m}`))};this._requestResolvers.set(m,O),this._enqueueTaskMessage(k,{type:"request",message:p,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(m),l(P)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(O=>{this._cleanupTimeout(m),l(O)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},xa,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},Sa,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},jg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[Xt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Xt]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Xt]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=yd(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=_d(t,o);return Promise.resolve(r(a,i))})}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=yd(t);this._notificationHandlers.set(n,o=>{let i=_d(t,o);return Promise.resolve(r(i))})}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"&&Yl(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new D(M.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} 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,i)=>{if(r.aborted){i(new D(M.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new D(M.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 i=await n.getTask(o,r);if(!i)throw new D(M.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Io.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Yt(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new D(M.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Yt(s.status))throw new D(M.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Io.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Yt(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Rg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ug(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];Rg(a)&&Rg(i)?r[o]={...a,...i}:r[o]=i}return r}var I_=sr(sf(),1),P_=sr(z_(),1);function PT(){let e=new I_.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,P_.default)(e),e}var fs=class{constructor(t){this._ajv=t??PT()}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 ms=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function T_(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 j_(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 hs=class extends Ta{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(jo.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new fs,this.setRequestHandler(td,n=>this._oninitialize(n)),this.setNotificationHandler(rd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(md,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=jo.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ms(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ug(this._capabilities,t)}setRequestHandler(t,r){let o=Yi(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(Xr(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=Wt(To,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new D(M.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,m=await Promise.resolve(r(c,u));if(d.task){let h=Wt(en,m);if(!h.success){let v=h.error instanceof Error?h.error.message:String(h.error);throw new D(M.InvalidParams,`Invalid task creation result: ${v}`)}return h.data}let p=Wt(Ia,m);if(!p.success){let h=p.error instanceof Error?p.error.message:String(p.error);throw new D(M.InvalidParams,`Invalid tools/call result: ${h}`)}return p.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){j_(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&T_(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:$g.includes(r)?r:Wl,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"},va)}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],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){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(s.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},gd,r):this.request({method:"sampling/createMessage",params:t},hd,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},Pa,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"},i=await this.request({method:"elicitation/create",params:o},Pa,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new D(M.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof D?a:new D(M.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}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},vd,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 hf=sr(require("node:process"),1);var gs=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
48
|
-
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),
|
|
49
|
-
`}var
|
|
47
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function ia(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 s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let f=e.seen.get(l),p=f.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===l)for(let g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(p.$ref&&f.def)for(let g in c)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(c[g])===JSON.stringify(f.def[g])&&delete c[g]}let d=a._zod.parent;if(d&&d!==l){n(d);let f=e.seen.get(d);if(f?.schema.$ref&&(c.$ref=f.schema.$ref,f.def))for(let p in c)p==="$ref"||p==="allOf"||p in f.def&&JSON.stringify(c[p])===JSON.stringify(f.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:s.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 i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.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:_o(t,"input",e.processors),output:_o(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Fe(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 Fe(n.element,r);if(n.type==="set")return Fe(n.valueType,r);if(n.type==="lazy")return Fe(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 Fe(n.innerType,r);if(n.type==="intersection")return Fe(n.left,r)||Fe(n.right,r);if(n.type==="record"||n.type==="map")return Fe(n.keyType,r)||Fe(n.valueType,r);if(n.type==="pipe")return Fe(n.in,r)||Fe(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Fe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Fe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Fe(o,r))return!0;return!!(n.rest&&Fe(n.rest,r))}return!1}var Gm=(e,t={})=>r=>{let n=na({...r,processors:t});return fe(e,n),oa(n,e),ia(n,e)},_o=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=na({...o??{},target:i,io:t,processors:r});return fe(e,a),oa(a,e),ia(a,e)};var Kb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Wm=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=Kb[s]??s,o.format===""&&delete o.format,s==="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}))])}},Xm=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Ym=(e,t,r,n)=>{r.type="boolean"},Qm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},eh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},th=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},rh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},nh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},oh=(e,t,r,n)=>{r.not={}},ih=(e,t,r,n)=>{},ah=(e,t,r,n)=>{},sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ch=(e,t,r,n)=>{let o=e._zod.def,i=Mn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},uh=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},lh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},dh=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},ph=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},fh=(e,t,r,n)=>{r.type="boolean"},mh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},hh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},gh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},vh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},yh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},_h=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,t,{...n,path:[...n.path,"items"]})},$h=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},$l=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},bh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},xh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((f,p)=>fe(f,t,{...n,path:[...n.path,a,p]})),u=i.rest?fe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},kh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.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=fe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},wh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Sh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},zh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Ih=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ph=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Th=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,t,n);let a=t.seen.get(e);a.ref=i},jh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Eh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},bl=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Oh=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o};function tn(e){return!!e._zod}function Qt(e,t){return tn(e)?Wr(e,t):e.safeParse(t)}function aa(e){if(!e)return;let t;if(tn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Zh(e){if(tn(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.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 $o={};zn($o,{ZodAny:()=>eg,ZodArray:()=>og,ZodBase64:()=>Jl,ZodBase64URL:()=>Hl,ZodBigInt:()=>ha,ZodBigIntFormat:()=>Gl,ZodBoolean:()=>ma,ZodCIDRv4:()=>Ll,ZodCIDRv6:()=>Vl,ZodCUID:()=>Zl,ZodCUID2:()=>Al,ZodCatch:()=>wg,ZodCodec:()=>rd,ZodCustom:()=>$a,ZodCustomStringFormat:()=>xo,ZodDate:()=>Xl,ZodDefault:()=>yg,ZodDiscriminatedUnion:()=>ag,ZodE164:()=>Kl,ZodEmail:()=>Dl,ZodEmoji:()=>Nl,ZodEnum:()=>bo,ZodExactOptional:()=>hg,ZodFile:()=>fg,ZodFunction:()=>Dg,ZodGUID:()=>ca,ZodIPv4:()=>Fl,ZodIPv6:()=>ql,ZodIntersection:()=>sg,ZodJWT:()=>Bl,ZodKSUID:()=>Ml,ZodLazy:()=>jg,ZodLiteral:()=>pg,ZodMAC:()=>Wh,ZodMap:()=>lg,ZodNaN:()=>zg,ZodNanoID:()=>Rl,ZodNever:()=>rg,ZodNonOptional:()=>ed,ZodNull:()=>Qh,ZodNullable:()=>vg,ZodNumber:()=>fa,ZodNumberFormat:()=>rn,ZodObject:()=>ga,ZodOptional:()=>Ql,ZodPipe:()=>td,ZodPrefault:()=>$g,ZodPromise:()=>Og,ZodReadonly:()=>Ig,ZodRecord:()=>_a,ZodSet:()=>dg,ZodString:()=>da,ZodStringFormat:()=>le,ZodSuccess:()=>kg,ZodSymbol:()=>Xh,ZodTemplateLiteral:()=>Tg,ZodTransform:()=>mg,ZodTuple:()=>cg,ZodType:()=>J,ZodULID:()=>Cl,ZodURL:()=>pa,ZodUUID:()=>Ut,ZodUndefined:()=>Yh,ZodUnion:()=>va,ZodUnknown:()=>tg,ZodVoid:()=>ng,ZodXID:()=>Ul,ZodXor:()=>ig,_ZodString:()=>Ol,_default:()=>_g,_function:()=>dk,any:()=>Kx,array:()=>W,base64:()=>jx,base64url:()=>Ex,bigint:()=>qx,boolean:()=>$e,catch:()=>Sg,check:()=>pk,cidrv4:()=>Px,cidrv6:()=>Tx,codec:()=>ck,cuid:()=>$x,cuid2:()=>bx,custom:()=>nd,date:()=>Gx,describe:()=>fk,discriminatedUnion:()=>ya,e164:()=>Ox,email:()=>lx,emoji:()=>yx,enum:()=>Oe,exactOptional:()=>gg,file:()=>ok,float32:()=>Cx,float64:()=>Ux,function:()=>dk,guid:()=>dx,hash:()=>Ax,hex:()=>Zx,hostname:()=>Rx,httpUrl:()=>vx,instanceof:()=>hk,int:()=>El,int32:()=>Mx,int64:()=>Lx,intersection:()=>wo,ipv4:()=>Sx,ipv6:()=>Ix,json:()=>vk,jwt:()=>Dx,keyof:()=>Wx,ksuid:()=>wx,lazy:()=>Eg,literal:()=>j,looseObject:()=>Ee,looseRecord:()=>ek,mac:()=>zx,map:()=>tk,meta:()=>mk,nan:()=>sk,nanoid:()=>_x,nativeEnum:()=>nk,never:()=>Wl,nonoptional:()=>xg,null:()=>ko,nullable:()=>ua,nullish:()=>ik,number:()=>ne,object:()=>P,optional:()=>he,partialRecord:()=>Qx,pipe:()=>la,prefault:()=>bg,preprocess:()=>ba,promise:()=>lk,readonly:()=>Pg,record:()=>me,refine:()=>Ng,set:()=>rk,strictObject:()=>Xx,string:()=>v,stringFormat:()=>Nx,stringbool:()=>gk,success:()=>ak,superRefine:()=>Rg,symbol:()=>Jx,templateLiteral:()=>uk,transform:()=>Yl,tuple:()=>ug,uint32:()=>Fx,uint64:()=>Vx,ulid:()=>xx,undefined:()=>Hx,union:()=>se,unknown:()=>de,url:()=>gx,uuid:()=>px,uuidv4:()=>fx,uuidv6:()=>mx,uuidv7:()=>hx,void:()=>Bx,xid:()=>kx,xor:()=>Yx});var sa={};zn(sa,{endsWith:()=>fo,gt:()=>At,gte:()=>Me,includes:()=>lo,length:()=>Qr,lowercase:()=>co,lt:()=>Zt,lte:()=>Ye,maxLength:()=>Yr,maxSize:()=>_r,mime:()=>mo,minLength:()=>Yt,minSize:()=>Ct,multipleOf:()=>yr,negative:()=>ul,nonnegative:()=>dl,nonpositive:()=>ll,normalize:()=>ho,overwrite:()=>wt,positive:()=>cl,property:()=>pl,regex:()=>so,size:()=>Xr,slugify:()=>ra,startsWith:()=>po,toLowerCase:()=>vo,toUpperCase:()=>yo,trim:()=>go,uppercase:()=>uo});var $r={};zn($r,{ZodISODate:()=>Sl,ZodISODateTime:()=>kl,ZodISODuration:()=>Tl,ZodISOTime:()=>Il,date:()=>zl,datetime:()=>wl,duration:()=>jl,time:()=>Pl});var kl=m("ZodISODateTime",(e,t)=>{Ac.init(e,t),le.init(e,t)});function wl(e){return Uu(kl,e)}var Sl=m("ZodISODate",(e,t)=>{Cc.init(e,t),le.init(e,t)});function zl(e){return Mu(Sl,e)}var Il=m("ZodISOTime",(e,t)=>{Uc.init(e,t),le.init(e,t)});function Pl(e){return Fu(Il,e)}var Tl=m("ZodISODuration",(e,t)=>{Mc.init(e,t),le.init(e,t)});function jl(e){return qu(Tl,e)}var Ah=(e,t)=>{bi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ki(e,r)},flatten:{value:r=>xi(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Kr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Kr,2)}},isEmpty:{get(){return e.issues.length===0}}})},ZN=m("ZodError",Ah),Qe=m("ZodError",Ah,{Parent:Error});var Ch=Hn(Qe),Uh=Bn(Qe),Mh=Wn(Qe),Fh=Xn(Qe),qh=Yf(Qe),Lh=Qf(Qe),Vh=em(Qe),Jh=tm(Qe),Hh=rm(Qe),Kh=nm(Qe),Bh=om(Qe),Gh=im(Qe);var J=m("ZodType",(e,t)=>(q.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:_o(e,"input"),output:_o(e,"output")}}),e.toJSONSchema=Gm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(b.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Ce(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Ch(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Mh(e,r,n),e.parseAsync=async(r,n)=>Uh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Fh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>qh(e,r,n),e.decode=(r,n)=>Lh(e,r,n),e.encodeAsync=async(r,n)=>Vh(e,r,n),e.decodeAsync=async(r,n)=>Jh(e,r,n),e.safeEncode=(r,n)=>Hh(e,r,n),e.safeDecode=(r,n)=>Kh(e,r,n),e.safeEncodeAsync=async(r,n)=>Bh(e,r,n),e.safeDecodeAsync=async(r,n)=>Gh(e,r,n),e.refine=(r,n)=>e.check(Ng(r,n)),e.superRefine=r=>e.check(Rg(r)),e.overwrite=r=>e.check(wt(r)),e.optional=()=>he(e),e.exactOptional=()=>gg(e),e.nullable=()=>ua(e),e.nullish=()=>he(ua(e)),e.nonoptional=r=>xg(e,r),e.array=()=>W(e),e.or=r=>se([e,r]),e.and=r=>wo(e,r),e.transform=r=>la(e,Yl(r)),e.default=r=>_g(e,r),e.prefault=r=>bg(e,r),e.catch=r=>Sg(e,r),e.pipe=r=>la(e,r),e.readonly=()=>Pg(e),e.describe=r=>{let n=e.clone();return Ue.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ue.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ue.get(e);let n=e.clone();return Ue.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Ol=m("_ZodString",(e,t)=>{vr.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Wm(e,n,o,i);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(so(...n)),e.includes=(...n)=>e.check(lo(...n)),e.startsWith=(...n)=>e.check(po(...n)),e.endsWith=(...n)=>e.check(fo(...n)),e.min=(...n)=>e.check(Yt(...n)),e.max=(...n)=>e.check(Yr(...n)),e.length=(...n)=>e.check(Qr(...n)),e.nonempty=(...n)=>e.check(Yt(1,...n)),e.lowercase=n=>e.check(co(n)),e.uppercase=n=>e.check(uo(n)),e.trim=()=>e.check(go()),e.normalize=(...n)=>e.check(ho(...n)),e.toLowerCase=()=>e.check(vo()),e.toUpperCase=()=>e.check(yo()),e.slugify=()=>e.check(ra())}),da=m("ZodString",(e,t)=>{vr.init(e,t),Ol.init(e,t),e.email=r=>e.check(Zi(Dl,r)),e.url=r=>e.check(ao(pa,r)),e.jwt=r=>e.check(ta(Bl,r)),e.emoji=r=>e.check(Fi(Nl,r)),e.guid=r=>e.check(io(ca,r)),e.uuid=r=>e.check(Ai(Ut,r)),e.uuidv4=r=>e.check(Ci(Ut,r)),e.uuidv6=r=>e.check(Ui(Ut,r)),e.uuidv7=r=>e.check(Mi(Ut,r)),e.nanoid=r=>e.check(qi(Rl,r)),e.guid=r=>e.check(io(ca,r)),e.cuid=r=>e.check(Li(Zl,r)),e.cuid2=r=>e.check(Vi(Al,r)),e.ulid=r=>e.check(Ji(Cl,r)),e.base64=r=>e.check(Yi(Jl,r)),e.base64url=r=>e.check(Qi(Hl,r)),e.xid=r=>e.check(Hi(Ul,r)),e.ksuid=r=>e.check(Ki(Ml,r)),e.ipv4=r=>e.check(Bi(Fl,r)),e.ipv6=r=>e.check(Gi(ql,r)),e.cidrv4=r=>e.check(Wi(Ll,r)),e.cidrv6=r=>e.check(Xi(Vl,r)),e.e164=r=>e.check(ea(Kl,r)),e.datetime=r=>e.check(wl(r)),e.date=r=>e.check(zl(r)),e.time=r=>e.check(Pl(r)),e.duration=r=>e.check(jl(r))});function v(e){return Au(da,e)}var le=m("ZodStringFormat",(e,t)=>{ae.init(e,t),Ol.init(e,t)}),Dl=m("ZodEmail",(e,t)=>{Pc.init(e,t),le.init(e,t)});function lx(e){return Zi(Dl,e)}var ca=m("ZodGUID",(e,t)=>{zc.init(e,t),le.init(e,t)});function dx(e){return io(ca,e)}var Ut=m("ZodUUID",(e,t)=>{Ic.init(e,t),le.init(e,t)});function px(e){return Ai(Ut,e)}function fx(e){return Ci(Ut,e)}function mx(e){return Ui(Ut,e)}function hx(e){return Mi(Ut,e)}var pa=m("ZodURL",(e,t)=>{Tc.init(e,t),le.init(e,t)});function gx(e){return ao(pa,e)}function vx(e){return ao(pa,{protocol:/^https?$/,hostname:ot.domain,...b.normalizeParams(e)})}var Nl=m("ZodEmoji",(e,t)=>{jc.init(e,t),le.init(e,t)});function yx(e){return Fi(Nl,e)}var Rl=m("ZodNanoID",(e,t)=>{Ec.init(e,t),le.init(e,t)});function _x(e){return qi(Rl,e)}var Zl=m("ZodCUID",(e,t)=>{Oc.init(e,t),le.init(e,t)});function $x(e){return Li(Zl,e)}var Al=m("ZodCUID2",(e,t)=>{Dc.init(e,t),le.init(e,t)});function bx(e){return Vi(Al,e)}var Cl=m("ZodULID",(e,t)=>{Nc.init(e,t),le.init(e,t)});function xx(e){return Ji(Cl,e)}var Ul=m("ZodXID",(e,t)=>{Rc.init(e,t),le.init(e,t)});function kx(e){return Hi(Ul,e)}var Ml=m("ZodKSUID",(e,t)=>{Zc.init(e,t),le.init(e,t)});function wx(e){return Ki(Ml,e)}var Fl=m("ZodIPv4",(e,t)=>{Fc.init(e,t),le.init(e,t)});function Sx(e){return Bi(Fl,e)}var Wh=m("ZodMAC",(e,t)=>{Lc.init(e,t),le.init(e,t)});function zx(e){return Cu(Wh,e)}var ql=m("ZodIPv6",(e,t)=>{qc.init(e,t),le.init(e,t)});function Ix(e){return Gi(ql,e)}var Ll=m("ZodCIDRv4",(e,t)=>{Vc.init(e,t),le.init(e,t)});function Px(e){return Wi(Ll,e)}var Vl=m("ZodCIDRv6",(e,t)=>{Jc.init(e,t),le.init(e,t)});function Tx(e){return Xi(Vl,e)}var Jl=m("ZodBase64",(e,t)=>{Hc.init(e,t),le.init(e,t)});function jx(e){return Yi(Jl,e)}var Hl=m("ZodBase64URL",(e,t)=>{Kc.init(e,t),le.init(e,t)});function Ex(e){return Qi(Hl,e)}var Kl=m("ZodE164",(e,t)=>{Bc.init(e,t),le.init(e,t)});function Ox(e){return ea(Kl,e)}var Bl=m("ZodJWT",(e,t)=>{Gc.init(e,t),le.init(e,t)});function Dx(e){return ta(Bl,e)}var xo=m("ZodCustomStringFormat",(e,t)=>{Wc.init(e,t),le.init(e,t)});function Nx(e,t,r={}){return en(xo,e,t,r)}function Rx(e){return en(xo,"hostname",ot.hostname,e)}function Zx(e){return en(xo,"hex",ot.hex,e)}function Ax(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=ot[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return en(xo,n,o,t)}var fa=m("ZodNumber",(e,t)=>{Oi.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Xm(e,n,o,i),e.gt=(n,o)=>e.check(At(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Zt(n,o)),e.lte=(n,o)=>e.check(Ye(n,o)),e.max=(n,o)=>e.check(Ye(n,o)),e.int=n=>e.check(El(n)),e.safe=n=>e.check(El(n)),e.positive=n=>e.check(At(0,n)),e.nonnegative=n=>e.check(Me(0,n)),e.negative=n=>e.check(Zt(0,n)),e.nonpositive=n=>e.check(Ye(0,n)),e.multipleOf=(n,o)=>e.check(yr(n,o)),e.step=(n,o)=>e.check(yr(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 ne(e){return Lu(fa,e)}var rn=m("ZodNumberFormat",(e,t)=>{Xc.init(e,t),fa.init(e,t)});function El(e){return Vu(rn,e)}function Cx(e){return Ju(rn,e)}function Ux(e){return Hu(rn,e)}function Mx(e){return Ku(rn,e)}function Fx(e){return Bu(rn,e)}var ma=m("ZodBoolean",(e,t)=>{ro.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o)});function $e(e){return Gu(ma,e)}var ha=m("ZodBigInt",(e,t)=>{Di.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Qm(e,n,o,i),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.gt=(n,o)=>e.check(At(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Zt(n,o)),e.lte=(n,o)=>e.check(Ye(n,o)),e.max=(n,o)=>e.check(Ye(n,o)),e.positive=n=>e.check(At(BigInt(0),n)),e.negative=n=>e.check(Zt(BigInt(0),n)),e.nonpositive=n=>e.check(Ye(BigInt(0),n)),e.nonnegative=n=>e.check(Me(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(yr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function qx(e){return Wu(ha,e)}var Gl=m("ZodBigIntFormat",(e,t)=>{Yc.init(e,t),ha.init(e,t)});function Lx(e){return Xu(Gl,e)}function Vx(e){return Yu(Gl,e)}var Xh=m("ZodSymbol",(e,t)=>{Qc.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eh(e,r,n,o)});function Jx(e){return Qu(Xh,e)}var Yh=m("ZodUndefined",(e,t)=>{eu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o)});function Hx(e){return el(Yh,e)}var Qh=m("ZodNull",(e,t)=>{tu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>th(e,r,n,o)});function ko(e){return tl(Qh,e)}var eg=m("ZodAny",(e,t)=>{ru.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o)});function Kx(){return rl(eg)}var tg=m("ZodUnknown",(e,t)=>{nu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o)});function de(){return nl(tg)}var rg=m("ZodNever",(e,t)=>{ou.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o)});function Wl(e){return ol(rg,e)}var ng=m("ZodVoid",(e,t)=>{iu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nh(e,r,n,o)});function Bx(e){return il(ng,e)}var Xl=m("ZodDate",(e,t)=>{au.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>sh(e,n,o,i),e.min=(n,o)=>e.check(Me(n,o)),e.max=(n,o)=>e.check(Ye(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Gx(e){return al(Xl,e)}var og=m("ZodArray",(e,t)=>{su.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Yt(r,n)),e.nonempty=r=>e.check(Yt(1,r)),e.max=(r,n)=>e.check(Yr(r,n)),e.length=(r,n)=>e.check(Qr(r,n)),e.unwrap=()=>e.element});function W(e,t){return Bm(og,e,t)}function Wx(e){let t=e._zod.def.shape;return Oe(Object.keys(t))}var ga=m("ZodObject",(e,t)=>{Hm.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o),b.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Oe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:de()}),e.loose=()=>e.clone({...e._zod.def,catchall:de()}),e.strict=()=>e.clone({...e._zod.def,catchall:Wl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>b.extend(e,r),e.safeExtend=r=>b.safeExtend(e,r),e.merge=r=>b.merge(e,r),e.pick=r=>b.pick(e,r),e.omit=r=>b.omit(e,r),e.partial=(...r)=>b.partial(Ql,e,r[0]),e.required=(...r)=>b.required(ed,e,r[0])});function P(e,t){let r={type:"object",shape:e??{},...b.normalizeParams(t)};return new ga(r)}function Xx(e,t){return new ga({type:"object",shape:e,catchall:Wl(),...b.normalizeParams(t)})}function Ee(e,t){return new ga({type:"object",shape:e,catchall:de(),...b.normalizeParams(t)})}var va=m("ZodUnion",(e,t)=>{no.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$l(e,r,n,o),e.options=t.options});function se(e,t){return new va({type:"union",options:e,...b.normalizeParams(t)})}var ig=m("ZodXor",(e,t)=>{va.init(e,t),cu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$l(e,r,n,o),e.options=t.options});function Yx(e,t){return new ig({type:"union",options:e,inclusive:!1,...b.normalizeParams(t)})}var ag=m("ZodDiscriminatedUnion",(e,t)=>{va.init(e,t),uu.init(e,t)});function ya(e,t,r){return new ag({type:"union",options:t,discriminator:e,...b.normalizeParams(r)})}var sg=m("ZodIntersection",(e,t)=>{lu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o)});function wo(e,t){return new sg({type:"intersection",left:e,right:t})}var cg=m("ZodTuple",(e,t)=>{Ni.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function ug(e,t,r){let n=t instanceof q,o=n?r:t,i=n?t:null;return new cg({type:"tuple",items:e,rest:i,...b.normalizeParams(o)})}var _a=m("ZodRecord",(e,t)=>{du.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function me(e,t,r){return new _a({type:"record",keyType:e,valueType:t,...b.normalizeParams(r)})}function Qx(e,t,r){let n=Ce(e);return n._zod.values=void 0,new _a({type:"record",keyType:n,valueType:t,...b.normalizeParams(r)})}function ek(e,t,r){return new _a({type:"record",keyType:e,valueType:t,mode:"loose",...b.normalizeParams(r)})}var lg=m("ZodMap",(e,t)=>{pu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Ct(...r)),e.nonempty=r=>e.check(Ct(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(Xr(...r))});function tk(e,t,r){return new lg({type:"map",keyType:e,valueType:t,...b.normalizeParams(r)})}var dg=m("ZodSet",(e,t)=>{fu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o),e.min=(...r)=>e.check(Ct(...r)),e.nonempty=r=>e.check(Ct(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(Xr(...r))});function rk(e,t){return new dg({type:"set",valueType:e,...b.normalizeParams(t)})}var bo=m("ZodEnum",(e,t)=>{mu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ch(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new bo({...t,checks:[],...b.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new bo({...t,checks:[],...b.normalizeParams(o),entries:i})}});function Oe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new bo({type:"enum",entries:r,...b.normalizeParams(t)})}function nk(e,t){return new bo({type:"enum",entries:e,...b.normalizeParams(t)})}var pg=m("ZodLiteral",(e,t)=>{hu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(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 j(e,t){return new pg({type:"literal",values:Array.isArray(e)?e:[e],...b.normalizeParams(t)})}var fg=m("ZodFile",(e,t)=>{gu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ph(e,r,n,o),e.min=(r,n)=>e.check(Ct(r,n)),e.max=(r,n)=>e.check(_r(r,n)),e.mime=(r,n)=>e.check(mo(Array.isArray(r)?r:[r],n))});function ok(e){return fl(fg,e)}var mg=m("ZodTransform",(e,t)=>{vu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(b.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(b.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Yl(e){return new mg({type:"transform",transform:e})}var Ql=m("ZodOptional",(e,t)=>{Ri.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function he(e){return new Ql({type:"optional",innerType:e})}var hg=m("ZodExactOptional",(e,t)=>{yu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gg(e){return new hg({type:"optional",innerType:e})}var vg=m("ZodNullable",(e,t)=>{_u.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ua(e){return new vg({type:"nullable",innerType:e})}function ik(e){return he(ua(e))}var yg=m("ZodDefault",(e,t)=>{$u.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _g(e,t){return new yg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var $g=m("ZodPrefault",(e,t)=>{bu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bg(e,t){return new $g({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var ed=m("ZodNonOptional",(e,t)=>{xu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xg(e,t){return new ed({type:"nonoptional",innerType:e,...b.normalizeParams(t)})}var kg=m("ZodSuccess",(e,t)=>{ku.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ak(e){return new kg({type:"success",innerType:e})}var wg=m("ZodCatch",(e,t)=>{wu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ph(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Sg(e,t){return new wg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var zg=m("ZodNaN",(e,t)=>{Su.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o)});function sk(e){return sl(zg,e)}var td=m("ZodPipe",(e,t)=>{zu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),e.in=t.in,e.out=t.out});function la(e,t){return new td({type:"pipe",in:e,out:t})}var rd=m("ZodCodec",(e,t)=>{td.init(e,t),oo.init(e,t)});function ck(e,t,r){return new rd({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Ig=m("ZodReadonly",(e,t)=>{Iu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Pg(e){return new Ig({type:"readonly",innerType:e})}var Tg=m("ZodTemplateLiteral",(e,t)=>{Pu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dh(e,r,n,o)});function uk(e,t){return new Tg({type:"template_literal",parts:e,...b.normalizeParams(t)})}var jg=m("ZodLazy",(e,t)=>{Eu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oh(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Eg(e){return new jg({type:"lazy",getter:e})}var Og=m("ZodPromise",(e,t)=>{ju.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function lk(e){return new Og({type:"promise",innerType:e})}var Dg=m("ZodFunction",(e,t)=>{Tu.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o)});function dk(e){return new Dg({type:"function",input:Array.isArray(e?.input)?ug(e?.input):e?.input??W(de()),output:e?.output??de()})}var $a=m("ZodCustom",(e,t)=>{Ou.init(e,t),J.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o)});function pk(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function nd(e,t){return ml($a,e??(()=>!0),t)}function Ng(e,t={}){return hl($a,e,t)}function Rg(e){return gl(e)}var fk=vl,mk=yl;function hk(e,t={}){let r=new $a({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...b.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var gk=(...e)=>_l({Codec:rd,Boolean:ma,String:da},...e);function vk(e){let t=Eg(()=>se([v(e),ne(),$e(),ko(),W(t),me(v(),t)]));return t}function ba(e,t){return la(Yl(e),t)}var Zg;Zg||(Zg={});var VN={...$o,...sa,iso:$r};xe(Du());var id="2025-11-25";var Ag=[id,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],er="io.modelcontextprotocol/related-task",ka="2.0",ke=nd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Cg=se([v(),ne().int()]),Ug=v(),u4=Ee({ttl:se([ne(),ko()]).optional(),pollInterval:ne().optional()}),bk=P({ttl:ne().optional()}),xk=P({taskId:v()}),ad=Ee({progressToken:Cg.optional(),[er]:xk.optional()}),et=P({_meta:ad.optional()}),So=et.extend({task:bk.optional()}),Mg=e=>So.safeParse(e).success,we=P({method:v(),params:et.loose().optional()}),it=P({_meta:ad.optional()}),at=P({method:v(),params:it.loose().optional()}),Se=Ee({_meta:ad.optional()}),wa=se([v(),ne().int()]),Fg=P({jsonrpc:j(ka),id:wa,...we.shape}).strict(),sd=e=>Fg.safeParse(e).success,qg=P({jsonrpc:j(ka),...at.shape}).strict(),Lg=e=>qg.safeParse(e).success,cd=P({jsonrpc:j(ka),id:wa,result:Se}).strict(),zo=e=>cd.safeParse(e).success;var M;(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"})(M||(M={}));var ud=P({jsonrpc:j(ka),id:wa.optional(),error:P({code:ne().int(),message:v(),data:de().optional()})}).strict();var Vg=e=>ud.safeParse(e).success;var Jg=se([Fg,qg,cd,ud]),l4=se([cd,ud]),Sa=Se.strict(),kk=it.extend({requestId:wa.optional(),reason:v().optional()}),za=at.extend({method:j("notifications/cancelled"),params:kk}),wk=P({src:v(),mimeType:v().optional(),sizes:W(v()).optional(),theme:Oe(["light","dark"]).optional()}),Io=P({icons:W(wk).optional()}),nn=P({name:v(),title:v().optional()}),Hg=nn.extend({...nn.shape,...Io.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Sk=wo(P({applyDefaults:$e().optional()}),me(v(),de())),zk=ba(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,wo(P({form:Sk.optional(),url:ke.optional()}),me(v(),de()).optional())),Ik=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({sampling:Ee({createMessage:ke.optional()}).optional(),elicitation:Ee({create:ke.optional()}).optional()}).optional()}),Pk=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({tools:Ee({call:ke.optional()}).optional()}).optional()}),Tk=P({experimental:me(v(),ke).optional(),sampling:P({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:zk.optional(),roots:P({listChanged:$e().optional()}).optional(),tasks:Ik.optional()}),jk=et.extend({protocolVersion:v(),capabilities:Tk,clientInfo:Hg}),ld=we.extend({method:j("initialize"),params:jk});var Ek=P({experimental:me(v(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:P({listChanged:$e().optional()}).optional(),resources:P({subscribe:$e().optional(),listChanged:$e().optional()}).optional(),tools:P({listChanged:$e().optional()}).optional(),tasks:Pk.optional()}),Ok=Se.extend({protocolVersion:v(),capabilities:Ek,serverInfo:Hg,instructions:v().optional()}),dd=at.extend({method:j("notifications/initialized"),params:it.optional()});var Ia=we.extend({method:j("ping"),params:et.optional()}),Dk=P({progress:ne(),total:he(ne()),message:he(v())}),Nk=P({...it.shape,...Dk.shape,progressToken:Cg}),Pa=at.extend({method:j("notifications/progress"),params:Nk}),Rk=et.extend({cursor:Ug.optional()}),Po=we.extend({params:Rk.optional()}),To=Se.extend({nextCursor:Ug.optional()}),Zk=Oe(["working","input_required","completed","failed","cancelled"]),jo=P({taskId:v(),status:Zk,ttl:se([ne(),ko()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:he(ne()),statusMessage:he(v())}),on=Se.extend({task:jo}),Ak=it.merge(jo),Eo=at.extend({method:j("notifications/tasks/status"),params:Ak}),Ta=we.extend({method:j("tasks/get"),params:et.extend({taskId:v()})}),ja=Se.merge(jo),Ea=we.extend({method:j("tasks/result"),params:et.extend({taskId:v()})}),d4=Se.loose(),Oa=Po.extend({method:j("tasks/list")}),Da=To.extend({tasks:W(jo)}),Na=we.extend({method:j("tasks/cancel"),params:et.extend({taskId:v()})}),Kg=Se.merge(jo),Bg=P({uri:v(),mimeType:he(v()),_meta:me(v(),de()).optional()}),Gg=Bg.extend({text:v()}),pd=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Wg=Bg.extend({blob:pd}),Oo=Oe(["user","assistant"]),an=P({audience:W(Oo).optional(),priority:ne().min(0).max(1).optional(),lastModified:$r.datetime({offset:!0}).optional()}),Xg=P({...nn.shape,...Io.shape,uri:v(),description:he(v()),mimeType:he(v()),annotations:an.optional(),_meta:he(Ee({}))}),Ck=P({...nn.shape,...Io.shape,uriTemplate:v(),description:he(v()),mimeType:he(v()),annotations:an.optional(),_meta:he(Ee({}))}),fd=Po.extend({method:j("resources/list")}),Uk=To.extend({resources:W(Xg)}),Mk=Po.extend({method:j("resources/templates/list")}),Fk=To.extend({resourceTemplates:W(Ck)}),md=et.extend({uri:v()}),qk=md,hd=we.extend({method:j("resources/read"),params:qk}),Lk=Se.extend({contents:W(se([Gg,Wg]))}),Vk=at.extend({method:j("notifications/resources/list_changed"),params:it.optional()}),Jk=md,Hk=we.extend({method:j("resources/subscribe"),params:Jk}),Kk=md,Bk=we.extend({method:j("resources/unsubscribe"),params:Kk}),Gk=it.extend({uri:v()}),Wk=at.extend({method:j("notifications/resources/updated"),params:Gk}),Xk=P({name:v(),description:he(v()),required:he($e())}),Yk=P({...nn.shape,...Io.shape,description:he(v()),arguments:he(W(Xk)),_meta:he(Ee({}))}),gd=Po.extend({method:j("prompts/list")}),Qk=To.extend({prompts:W(Yk)}),ew=et.extend({name:v(),arguments:me(v(),v()).optional()}),vd=we.extend({method:j("prompts/get"),params:ew}),yd=P({type:j("text"),text:v(),annotations:an.optional(),_meta:me(v(),de()).optional()}),_d=P({type:j("image"),data:pd,mimeType:v(),annotations:an.optional(),_meta:me(v(),de()).optional()}),$d=P({type:j("audio"),data:pd,mimeType:v(),annotations:an.optional(),_meta:me(v(),de()).optional()}),tw=P({type:j("tool_use"),name:v(),id:v(),input:me(v(),de()),_meta:me(v(),de()).optional()}),rw=P({type:j("resource"),resource:se([Gg,Wg]),annotations:an.optional(),_meta:me(v(),de()).optional()}),nw=Xg.extend({type:j("resource_link")}),bd=se([yd,_d,$d,nw,rw]),ow=P({role:Oo,content:bd}),iw=Se.extend({description:v().optional(),messages:W(ow)}),aw=at.extend({method:j("notifications/prompts/list_changed"),params:it.optional()}),sw=P({title:v().optional(),readOnlyHint:$e().optional(),destructiveHint:$e().optional(),idempotentHint:$e().optional(),openWorldHint:$e().optional()}),cw=P({taskSupport:Oe(["required","optional","forbidden"]).optional()}),Yg=P({...nn.shape,...Io.shape,description:v().optional(),inputSchema:P({type:j("object"),properties:me(v(),ke).optional(),required:W(v()).optional()}).catchall(de()),outputSchema:P({type:j("object"),properties:me(v(),ke).optional(),required:W(v()).optional()}).catchall(de()).optional(),annotations:sw.optional(),execution:cw.optional(),_meta:me(v(),de()).optional()}),xd=Po.extend({method:j("tools/list")}),uw=To.extend({tools:W(Yg)}),Ra=Se.extend({content:W(bd).default([]),structuredContent:me(v(),de()).optional(),isError:$e().optional()}),p4=Ra.or(Se.extend({toolResult:de()})),lw=So.extend({name:v(),arguments:me(v(),de()).optional()}),Do=we.extend({method:j("tools/call"),params:lw}),dw=at.extend({method:j("notifications/tools/list_changed"),params:it.optional()}),f4=P({autoRefresh:$e().default(!0),debounceMs:ne().int().nonnegative().default(300)}),No=Oe(["debug","info","notice","warning","error","critical","alert","emergency"]),pw=et.extend({level:No}),kd=we.extend({method:j("logging/setLevel"),params:pw}),fw=it.extend({level:No,logger:v().optional(),data:de()}),mw=at.extend({method:j("notifications/message"),params:fw}),hw=P({name:v().optional()}),gw=P({hints:W(hw).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),vw=P({mode:Oe(["auto","required","none"]).optional()}),yw=P({type:j("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:W(bd).default([]),structuredContent:P({}).loose().optional(),isError:$e().optional(),_meta:me(v(),de()).optional()}),_w=ya("type",[yd,_d,$d]),xa=ya("type",[yd,_d,$d,tw,yw]),$w=P({role:Oo,content:se([xa,W(xa)]),_meta:me(v(),de()).optional()}),bw=So.extend({messages:W($w),modelPreferences:gw.optional(),systemPrompt:v().optional(),includeContext:Oe(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:W(v()).optional(),metadata:ke.optional(),tools:W(Yg).optional(),toolChoice:vw.optional()}),xw=we.extend({method:j("sampling/createMessage"),params:bw}),wd=Se.extend({model:v(),stopReason:he(Oe(["endTurn","stopSequence","maxTokens"]).or(v())),role:Oo,content:_w}),Sd=Se.extend({model:v(),stopReason:he(Oe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:Oo,content:se([xa,W(xa)])}),kw=P({type:j("boolean"),title:v().optional(),description:v().optional(),default:$e().optional()}),ww=P({type:j("string"),title:v().optional(),description:v().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Oe(["email","uri","date","date-time"]).optional(),default:v().optional()}),Sw=P({type:Oe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),zw=P({type:j("string"),title:v().optional(),description:v().optional(),enum:W(v()),default:v().optional()}),Iw=P({type:j("string"),title:v().optional(),description:v().optional(),oneOf:W(P({const:v(),title:v()})),default:v().optional()}),Pw=P({type:j("string"),title:v().optional(),description:v().optional(),enum:W(v()),enumNames:W(v()).optional(),default:v().optional()}),Tw=se([zw,Iw]),jw=P({type:j("array"),title:v().optional(),description:v().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:P({type:j("string"),enum:W(v())}),default:W(v()).optional()}),Ew=P({type:j("array"),title:v().optional(),description:v().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:P({anyOf:W(P({const:v(),title:v()}))}),default:W(v()).optional()}),Ow=se([jw,Ew]),Dw=se([Pw,Tw,Ow]),Nw=se([Dw,kw,ww,Sw]),Rw=So.extend({mode:j("form").optional(),message:v(),requestedSchema:P({type:j("object"),properties:me(v(),Nw),required:W(v()).optional()})}),Zw=So.extend({mode:j("url"),message:v(),elicitationId:v(),url:v().url()}),Aw=se([Rw,Zw]),Cw=we.extend({method:j("elicitation/create"),params:Aw}),Uw=it.extend({elicitationId:v()}),Mw=at.extend({method:j("notifications/elicitation/complete"),params:Uw}),Za=Se.extend({action:Oe(["accept","decline","cancel"]),content:ba(e=>e===null?void 0:e,me(v(),se([v(),ne(),$e(),W(v())])).optional())}),Fw=P({type:j("ref/resource"),uri:v()});var qw=P({type:j("ref/prompt"),name:v()}),Lw=et.extend({ref:se([qw,Fw]),argument:P({name:v(),value:v()}),context:P({arguments:me(v(),v()).optional()}).optional()}),Vw=we.extend({method:j("completion/complete"),params:Lw});var Jw=Se.extend({completion:Ee({values:W(v()).max(100),total:he(ne().int()),hasMore:he($e())})}),Hw=P({uri:v().startsWith("file://"),name:v().optional(),_meta:me(v(),de()).optional()}),Kw=we.extend({method:j("roots/list"),params:et.optional()}),zd=Se.extend({roots:W(Hw)}),Bw=at.extend({method:j("notifications/roots/list_changed"),params:it.optional()}),m4=se([Ia,ld,Vw,kd,vd,gd,fd,Mk,hd,Hk,Bk,Do,xd,Ta,Ea,Oa,Na]),h4=se([za,Pa,dd,Bw,Eo]),g4=se([Sa,wd,Sd,Za,zd,ja,Da,on]),v4=se([Ia,xw,Cw,Kw,Ta,Ea,Oa,Na]),y4=se([za,Pa,mw,Wk,Vk,dw,aw,Eo,Mw]),_4=se([Sa,Ok,Jw,iw,Qk,Uk,Fk,Lk,Ra,uw,ja,Da,on]),R=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===M.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new od(o.elicitations,r)}return new e(t,r,n)}},od=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(M.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function tr(e){return e==="completed"||e==="failed"||e==="cancelled"}var Q4=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Id(e){let r=aa(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Zh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Pd(e,t){let r=Qt(e,t);if(!r.success)throw r.error;return r.data}var eS=6e4,Aa=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(za,r=>{this._oncancel(r)}),this.setNotificationHandler(Pa,r=>{this._onprogress(r)}),this.setRequestHandler(Ia,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ta,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(M.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ea,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,f=new R(d.error.code,d.error.message,d.error.data);l(f)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new R(M.InvalidParams,`Task not found: ${i}`);if(!tr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(tr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[er]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Oa,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new R(M.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Na,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(M.InvalidParams,`Task not found: ${r.params.taskId}`);if(tr(o.status))throw new R(M.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 i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new R(M.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof R?o:new R(M.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,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,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),R.fromError(M.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=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),zo(i)||Vg(i)?this._onresponse(i):sd(i)?this._onrequest(i,a):Lg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(M.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,i=t.params?._meta?.[er]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:M.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{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 a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=Mg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,f)=>{if(a.signal.aborted)throw new R(M.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:t.id};i&&!p.relatedTask&&(p.relatedTask={taskId:i});let h=p.relatedTask?.taskId??i;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,p)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:M.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{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.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),zo(t))n(t);else{let a=new R(t.error.code,t.error.message,t.error.data);n(a)}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 i=!1;if(zo(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),zo(t))o(t);else{let a=R.fromError(t.error.code,t.error.message,t.error.data);o(a)}}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(a){yield{type:"error",error:a instanceof R?a:new R(M.InternalError,String(a))}}return}let i;try{let a=await this.request(t,on,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new R(M.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},tr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new R(M.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new R(M.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof R?a:new R(M.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=k=>{l(k)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(k){d(k);return}n?.signal?.throwIfAborted();let f=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[er]:c}});let h=k=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(k)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(D=>this._onerror(new Error(`Failed to send cancellation: ${D}`)));let x=k instanceof R?k:new R(M.RequestTimeout,String(k));l(x)};this._responseHandlers.set(f,k=>{if(!n?.signal?.aborted){if(k instanceof Error)return l(k);try{let x=Qt(r,k.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let g=n?.timeout??eS,y=()=>h(R.fromError(M.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(f,g,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let $=c?.taskId;if($){let k=x=>{let D=this._responseHandlers.get(f);D?D(x):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,k),this._enqueueTaskMessage($,{type:"request",message:p,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(f),l(x)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(k=>{this._cleanupTimeout(f),l(k)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},ja,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},Da,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Kg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[er]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[er]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[er]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Id(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Pd(t,o);return Promise.resolve(r(a,i))})}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=Id(t);this._notificationHandlers.set(n,o=>{let i=Pd(t,o);return Promise.resolve(r(i))})}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"&&sd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new R(M.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} 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,i)=>{if(r.aborted){i(new R(M.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new R(M.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 i=await n.getTask(o,r);if(!i)throw new R(M.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Eo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),tr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new R(M.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(tr(s.status))throw new R(M.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Eo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),tr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Qg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ev(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];Qg(a)&&Qg(i)?r[o]={...a,...i}:r[o]=i}return r}var o$=ft(kf(),1),i$=ft(n$(),1);function Ij(){let e=new o$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,i$.default)(e),e}var bs=class{constructor(t){this._ajv=t??Ij()}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 xs=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function a$(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 s$(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 ks=class extends Aa{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(No.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new bs,this.setRequestHandler(ld,n=>this._oninitialize(n)),this.setNotificationHandler(dd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(kd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=No.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new xs(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ev(this._capabilities,t)}setRequestHandler(t,r){let o=aa(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(tn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=Qt(Do,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new R(M.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let h=Qt(on,f);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new R(M.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let p=Qt(Ra,f);if(!p.success){let h=p.error instanceof Error?p.error.message:String(p.error);throw new R(M.InvalidParams,`Invalid tools/call result: ${h}`)}return p.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){s$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&a$(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:Ag.includes(r)?r:id,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"},Sa)}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],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){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(s.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},Sd,r):this.request({method:"sampling/createMessage",params:t},wd,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},Za,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"},i=await this.request({method:"elicitation/create",params:o},Za,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new R(M.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof R?a:new R(M.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}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},zd,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 Ef=ft(require("node:process"),1);var ws=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
48
|
+
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),Pj(r)}clear(){this._buffer=void 0}};function Pj(e){return Jg.parse(JSON.parse(e))}function c$(e){return JSON.stringify(e)+`
|
|
49
|
+
`}var Ss=class{constructor(t=Ef.default.stdin,r=Ef.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new ws,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=c$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Te=ft(require("fs/promises")),be=ft(require("path")),wn=10*1024*1024,zs=class{skillsPath;cachedSkills=null;loadingPromise=null;skillMap=new Map;contentCache=new Map;constructor(t){this.skillsPath=t}stripQuotes(t){return t.replace(/^"(.*)"$|^'(.*)'$/,"$1$2").trim()}parseFrontmatter(t){let r=t;if(r.charCodeAt(0)===65279&&(r=r.slice(1)),!r.startsWith("---"))return{name:"",description:""};let n=r.split(/\r?\n/),o=[],i=!1;for(let u=1;u<n.length;u++){if(n[u].trim()==="---"){i=!0;break}o.push(n[u])}if(!i)return{name:"",description:""};let a="",s="",c=!1;for(let u of o){let l=u.match(/^name:\s*(.*?)\s*$/);if(l){a=this.stripQuotes(l[1]),c=!1;continue}let d=u.match(/^description:\s*(.*?)\s*$/);if(d){s=this.stripQuotes(d[1]),c=!0;continue}c&&/^\s+/.test(u)?s+=" "+u.trim():c=!1}return{name:a,description:s}}async exists(t){try{return await Te.access(t),!0}catch{return!1}}async listSkills(t=!1){if(this.cachedSkills&&!t)return this.cachedSkills;if(this.loadingPromise&&!t)return this.loadingPromise;t&&this.contentCache.clear();let r=this.internalListSkills();this.loadingPromise=r;try{return await r}finally{this.loadingPromise===r&&(this.loadingPromise=null)}}async internalListSkills(){if(!await this.exists(this.skillsPath))return this.cachedSkills??[];let t=[],r=new Map,n=!1;try{let o=await Te.readdir(this.skillsPath,{withFileTypes:!0});for(let i of o){if(!i.isDirectory()&&!i.isSymbolicLink())continue;let a=be.join(this.skillsPath,i.name),s=be.join(a,"SKILL.md");if(await this.exists(s))try{let c=await this.readFileNoFollow(s,this.skillsPath),{name:u,description:l}=this.parseFrontmatter(c),f={name:u||i.name,description:l,skillPath:s};t.push(f),r.set(f.name.toLowerCase(),f);let p=be.basename(be.dirname(f.skillPath)).toLowerCase();r.set(p,f)}catch{process.stderr.write(`Warning: Failed to read skill file in directory "${i.name}"
|
|
50
50
|
`)}}n=!0}catch(o){process.stderr.write(`Error reading skills directory: ${String(o)}
|
|
51
|
-
`)}return n&&(this.skillMap=r,this.cachedSkills=t.sort((o,i)=>o.name.localeCompare(i.name))),this.cachedSkills??[]}async findSkill(t){let r=typeof t=="string"?t.trim():"";if(!(!r||r==="."||r===".."||r.includes("/")||r.includes("\\")||r.includes("\0")))return this.cachedSkills||await this.listSkills(),this.skillMap.get(r.toLowerCase())}async readFileNoFollow(t,r){let n=
|
|
52
|
-
`)
|
|
51
|
+
`)}return n&&(this.skillMap=r,this.cachedSkills=t.sort((o,i)=>o.name.localeCompare(i.name))),this.cachedSkills??[]}async findSkill(t){let r=typeof t=="string"?t.trim():"";if(!(!r||r==="."||r===".."||r.includes("/")||r.includes("\\")||r.includes("\0")))return this.cachedSkills||await this.listSkills(),this.skillMap.get(r.toLowerCase())}async readFileNoFollow(t,r){let n=be.resolve(t),o=be.resolve(r),i=async()=>{let l=await Te.realpath(n),d=await Te.realpath(o);if(!(await Te.stat(d)).isDirectory())throw new Error("Skills directory must be a directory");let p=be.relative(d,l);if(p===".."||p.startsWith(`..${be.sep}`)||be.isAbsolute(p))throw new Error("File is outside skills directory");let h=await Te.stat(l);if(!h.isFile()||h.nlink<1)throw new Error("Skill path is not a regular file");if(h.size>wn)throw new Error("Skill file exceeds size limit");return{realFilePath:l,stat:h}},a=await i(),s=await i();if(a.realFilePath!==s.realFilePath||a.stat.dev!==s.stat.dev||a.stat.ino!==s.stat.ino)throw new Error("File changed while validating its path");let c=process.platform==="win32"?0:Te.constants.O_NOFOLLOW,u=await Te.open(s.realFilePath,Te.constants.O_RDONLY|c);try{let l=await u.stat();if(!l.isFile()||l.nlink<1||l.dev!==s.stat.dev||l.ino!==s.stat.ino||l.size>wn)throw new Error("File changed while opening");let d=[],f=64*1024,p=0;for(;p<=wn;){let g=Buffer.allocUnsafe(Math.min(f,wn+1-p)),{bytesRead:y}=await u.read(g,0,g.length,null);if(y===0)break;if(p+=y,d.push(g.subarray(0,y)),p>wn)throw new Error("Skill file exceeds size limit")}let h=await u.stat();if(h.size>wn||h.dev!==s.stat.dev||h.ino!==s.stat.ino)throw new Error("File changed while reading");return Buffer.concat(d,p).toString("utf-8")}finally{await u.close()}}async readSkillContent(t,r=!1){let n=be.resolve(t),o=be.resolve(this.skillsPath),i=n,a=o;try{i=await Te.realpath(n),a=await Te.realpath(o)}catch{}let s=be.relative(a,i);if(s.startsWith("..")||be.isAbsolute(s))throw new Error(`Access denied: path "${t}" is outside skills directory`);if(this.contentCache.has(i)&&!r)return this.contentCache.get(i);try{let c=await this.readFileNoFollow(t,this.skillsPath);c.charCodeAt(0)===65279&&(c=c.slice(1));let u=c.replace(/^---\s*\r?\n[\s\S]*?\r?\n---\s*\r?\n?/,"").trim();return this.contentCache.set(i,u),u}catch(c){throw new Error(`Failed to read skill content: ${c instanceof Error?c.message:String(c)}`)}}clearCache(){this.cachedSkills=null,this.loadingPromise=null,this.skillMap.clear(),this.contentCache.clear()}};var ie=ft(require("fs")),oe=ft(require("path")),Is=ft(require("os")),u$=ft(require("crypto")),fi={copilot:{name:"GitHub Copilot (VS Code)",aliases:["vscode","code","copilot"],getConfigPath:(e,t,r,n)=>e==="win32"?oe.join(r||oe.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?oe.join(t,"Library","Application Support","Code","User","mcp.json"):oe.join(t,".config","Code","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},cursor:{name:"Cursor",aliases:["cursor"],getConfigPath:(e,t)=>oe.join(t,".cursor","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},hermes:{name:"Hermes Desktop / Agent",aliases:["hermes","hermes-desktop"],getConfigPath:(e,t,r,n)=>{if(e==="win32"){let o=n||oe.join(t,"AppData","Local");return oe.join(o,"hermes","config.yaml")}return oe.join(t,".hermes","config.yaml")},type:"yaml",defaultConfig:(e,t)=>({command:e,args:t})},kimi:{name:"Kimi Work / Kimi Code",aliases:["kimi","kimi-work","kimi-code"],getConfigPath:(e,t)=>oe.join(t,".kimi-code","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},claude:{name:"Claude Desktop",aliases:["claude","claude-desktop"],getConfigPath:(e,t,r)=>e==="win32"?oe.join(r||oe.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?oe.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):oe.join(t,".config","Claude","claude_desktop_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},devin:{name:"Devin Desktop (formerly Windsurf)",aliases:["devin","devin-desktop","windsurf","codeium"],getConfigPath:(e,t)=>{let r=oe.join(t,".config","devin","mcp_config.json");return ie.existsSync(r)?r:oe.join(t,".codeium","windsurf","mcp_config.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},antigravity:{name:"Antigravity (Google DeepMind)",aliases:["antigravity","agy","gemini"],getConfigPath:(e,t)=>oe.join(t,".gemini","config","mcp_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},"pi-desktop":{name:"Pi Desktop / Pi Agent",aliases:["pi-desktop","pi","pi-agent"],getConfigPath:(e,t,r)=>{if(e==="win32"){let i=oe.join(r||oe.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(ie.existsSync(i))return i;let a=oe.join(t,".pi","agent","mcp.json");if(ie.existsSync(a))return a;let s=oe.join(t,".pi","mcp.json");return ie.existsSync(s)?s:a}let n=oe.join(t,".pi","agent","mcp.json");if(ie.existsSync(n))return n;let o=oe.join(t,".pi","mcp.json");return ie.existsSync(o)?o:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}};function Of(e){return Object.prototype.toString.call(e)==="[object Object]"}function Tj(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/(^|[^:])\/\/.*$/gm,"$1").replace(/,\s*([\]}])/g,"$1")}function jj(e,t,r,n=!1){let o=e?e.split(/\r?\n/):[];if(n){let d=[],f=!1,p=0,h=!1,g=0;for(let y=0;y<o.length;y++){let $=o[y],k=$.match(/^(\s*)mcp_servers:\s*$/);if(k){f=!0,p=k[1].length,d.push($);continue}if(f){let x=$.match(/^(\s*)/)?.[1].length||0;if($.trim()!==""&&x<=p)f=!1,h=!1;else{let D=$.match(/^(\s*)superpowers:\s*$/);if(D&&D[1].length>p){h=!0,g=D[1].length;continue}if(h){if(x>g||$.trim()==="")continue;h=!1}}}d.push($)}return d.join(`
|
|
52
|
+
`)}let i=" ";for(let d of o){let f=d.match(/^(\s+)[a-zA-Z0-9_-]+:/);if(f&&f[1].length>0){i=f[1];break}}let a=JSON.stringify(t),s=JSON.stringify(r),c=[`${i}superpowers:`,`${i}${i}command: ${a}`,`${i}${i}args: ${s}`];if(!e||e.trim()==="")return`mcp_servers:
|
|
53
|
+
${c.join(`
|
|
54
|
+
`)}
|
|
55
|
+
`;let u=o.findIndex(d=>/^\s*mcp_servers:\s*$/.test(d));if(u===-1)return`${e.trimEnd()}
|
|
53
56
|
|
|
54
|
-
|
|
57
|
+
mcp_servers:
|
|
58
|
+
${c.join(`
|
|
59
|
+
`)}
|
|
60
|
+
`;let l=-1;for(let d=u+1;d<o.length;d++){let f=o[d];if(/^[^\s#]/.test(f))break;if(/^\s+superpowers:\s*$/.test(f)){l=d;break}}if(l!==-1){let d=o[l].match(/^(\s*)/)?.[1].length||2,f=l+1;for(;f<o.length;){let p=o[f];if((p.match(/^(\s*)/)?.[1].length||0)>d||p.trim()==="")f++;else break}return o.splice(l,f-l,...c),o.join(`
|
|
61
|
+
`)}else return o.splice(u+1,0,...c),o.join(`
|
|
62
|
+
`)}function Ej(e,t,r,n,o=!1){let i={};if(e&&e.trim()!=="")try{let c=JSON.parse(e);Of(c)?i=c:i={}}catch{try{let u=Tj(e),l=JSON.parse(u);Of(l)?i=l:i={}}catch(u){let l=u instanceof Error?u.message:String(u);throw new Error(`Failed to parse existing JSON: ${l}`)}}let a=t==="json-servers"?"servers":"mcpServers";Of(i[a])||(i[a]={});let s=i[a];return o?delete s.superpowers:t==="json-servers"?s.superpowers={command:r,args:n,type:"stdio"}:s.superpowers={command:r,args:n},JSON.stringify(i,null,2)+`
|
|
63
|
+
`}function Oj(e,t,r=!1){let n=e;try{let c=ie.lstatSync(e,{throwIfNoEntry:!1});if(c&&c.isSymbolicLink())try{n=ie.realpathSync(e)}catch{let l=ie.readlinkSync(e);n=oe.resolve(oe.dirname(e),l)}}catch{}let o=oe.dirname(n);ie.existsSync(o)||ie.mkdirSync(o,{recursive:!0,mode:448});let i=384;if(ie.existsSync(n)){try{i=ie.statSync(n).mode}catch{}if(r){let c=ie.readFileSync(n,"utf8"),u=`${n}.${Date.now()}.bak`;try{ie.writeFileSync(u,c,{encoding:"utf8",mode:i})}catch(l){let d=l instanceof Error?l.message:String(l);throw new Error(`Failed to create safe backup before write: ${d}`)}}}let a=u$.randomBytes(8).toString("hex"),s=oe.join(o,`.tmp.${oe.basename(n)}.${process.pid}.${a}`);try{ie.writeFileSync(s,t,{encoding:"utf8",mode:i,flag:"wx"}),ie.renameSync(s,n)}catch(c){try{ie.existsSync(s)&&ie.unlinkSync(s)}catch{}throw c}}async function Dj(e={}){let t=e.platform||Is.platform(),r=e.homeDir||Is.homedir(),n=e.appData||process.env.APPDATA,o=e.localAppData||process.env.LOCALAPPDATA,i=!!e.dryRun,a=!!e.remove,s=!!e.bun,c=e.target?e.target.toLowerCase():null,u=s?"bunx":"npx",l=["-y","superpowers-mcp"],d=[];if(!c)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(fi).join("|")}>.`);let f=Object.keys(fi).find(h=>h===c||fi[h].aliases.includes(c));if(!f)throw new Error(`Unknown harness target: "${c}". Supported targets: ${Object.keys(fi).join(", ")}`);let p=[f];for(let h of p){let g=fi[h],y=g.getConfigPath(t,r,n,o),$=ie.existsSync(y);if(a&&!$){d.push({target:h,name:g.name,path:y,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let k="";$&&(k=ie.readFileSync(y,"utf8"));let x="";if(g.type==="yaml"?x=jj(k,u,l,a):x=Ej(k,g.type,u,l,a),k.trim()===x.trim()&&$){d.push({target:h,name:g.name,path:y,status:"up-to-date",message:a?"Already not configured":"Already configured and up-to-date"});continue}i||Oj(y,x,!!e.backup),d.push({target:h,name:g.name,path:y,status:a?"removed":$?"updated":"created",message:i?`[Dry Run] Would ${a?"remove from":$?"update":"create"} ${y}`:`Successfully ${a?"removed from":$?"updated":"configured"}!`})}catch(k){let x=k instanceof Error?k.message:String(k);d.push({target:h,name:g.name,path:y,status:"error",message:x})}}return d}async function l$(e=process.argv.slice(2)){let t={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let r=0;r<e.length;r++){let n=e[r];if(!(n==="setup"||n==="--setup"))if(n==="--dry-run")t.dryRun=!0;else if(n==="--remove"||n==="--uninstall")t.remove=!0;else if(n==="--bun")t.bun=!0;else if(n==="--backup")t.backup=!0;else if(n==="--target"||n==="-t"){let o=e[r+1];(!o||o.startsWith("-"))&&(console.error(`\u274C Error: Missing value for --target flag.
|
|
64
|
+
`),process.exit(1)),t.target=e[++r]}else if(n.startsWith("--target=")){let o=n.split("=")[1];o||(console.error(`\u274C Error: Missing value for --target flag.
|
|
65
|
+
`),process.exit(1)),t.target=o}else if(n==="--help"||n==="-h"){Nj();return}else!n.startsWith("-")&&!t.target&&n!=="setup"?t.target=n:n.startsWith("-")&&(console.error(`\u274C Error: Unknown option "${n}". Use --help for usage.
|
|
66
|
+
`),process.exit(1))}if(console.log(`
|
|
67
|
+
========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
|
|
68
|
+
`),!t.target){console.log(`Please select which AI Agent client you would like to configure:
|
|
69
|
+
`),console.log(" npx -y superpowers-mcp setup --target antigravity # Antigravity (~/.gemini/config/mcp_config.json)"),console.log(" npx -y superpowers-mcp setup --target pi-desktop # Pi Desktop / Pi Agent (~/.pi/agent/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target cursor # Cursor (~/.cursor/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot # GitHub Copilot (VS Code mcp.json)"),console.log(" npx -y superpowers-mcp setup --target hermes # Hermes Desktop / Agent"),console.log(" npx -y superpowers-mcp setup --target kimi # Kimi Work / Kimi Code"),console.log(" npx -y superpowers-mcp setup --target claude # Claude Desktop"),console.log(` npx -y superpowers-mcp setup --target devin # Devin Desktop (formerly Windsurf)
|
|
70
|
+
`),console.log("\u{1F4A1} Tip:"),console.log(" You can run this setup command from ANY folder on your system."),console.log(` It automatically targets your global config files (~/...) without needing to clone this repo.
|
|
71
|
+
`),console.log("\u{1F4A1} Privacy & Safety:"),console.log(" Superpowers MCP only configures the specific client you explicitly choose."),console.log(` It will NEVER silently scan or modify unselected environments.
|
|
72
|
+
`);return}try{let r=await Dj(t),n=0,o=0,i=0;for(let a of r){let s=a.status==="created"||a.status==="updated"||a.status==="removed"?"\u2705":a.status==="up-to-date"?"\u2728":a.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${s} [${a.name}] (${a.status})`),console.log(` Path: ${a.path}`),console.log(` Info: ${a.message}
|
|
73
|
+
`),a.status==="created"||a.status==="updated"||a.status==="up-to-date"||a.status==="removed"?n++:a.status==="skipped"?o++:a.status==="error"&&i++}console.log("--------------------------------------------------------"),i>0&&(console.error(`\u26A0\uFE0F Setup finished with errors: ${i} failure(s), ${n} succeeded.`),process.exit(1)),console.log(`\u{1F389} Setup complete! ${n} environment(s) ready.`)}catch(r){let n=r instanceof Error?r.message:String(r);console.error(`\u274C Setup failed: ${n}
|
|
74
|
+
`),process.exit(1)}}function Nj(){console.log(`
|
|
75
|
+
Superpowers MCP - Targeted Global Setup
|
|
55
76
|
|
|
56
|
-
|
|
77
|
+
Usage:
|
|
78
|
+
npx -y superpowers-mcp setup --target <name> [options]
|
|
79
|
+
|
|
80
|
+
Options:
|
|
81
|
+
--target, -t <name> Configure specific harness (Required):
|
|
82
|
+
antigravity (agy, gemini), pi-desktop (pi, pi-agent), cursor,
|
|
83
|
+
copilot (vscode), hermes, kimi, claude, devin (windsurf)
|
|
84
|
+
--bun Use "bunx" instead of "npx" in server commands
|
|
85
|
+
--backup Create a timestamped .bak backup before modifying (Default: false, zero-pollution)
|
|
86
|
+
--remove Remove superpowers MCP configuration from target
|
|
87
|
+
--dry-run Preview changes without writing files
|
|
88
|
+
--help, -h Show this help message
|
|
89
|
+
|
|
90
|
+
Examples:
|
|
91
|
+
npx -y superpowers-mcp setup --target antigravity # Configure Antigravity only
|
|
92
|
+
npx -y superpowers-mcp setup --target pi-desktop # Configure Pi Desktop / Pi Agent only
|
|
93
|
+
npx -y superpowers-mcp setup --target cursor # Configure Cursor only
|
|
94
|
+
npx -y superpowers-mcp setup --target copilot # Configure GitHub Copilot (VS Code) only
|
|
95
|
+
npx -y superpowers-mcp setup --target hermes # Configure Hermes Desktop only
|
|
96
|
+
npx -y superpowers-mcp setup --target kimi # Configure Kimi Work only
|
|
97
|
+
npx -y superpowers-mcp setup --target claude # Configure Claude Desktop only
|
|
98
|
+
npx -y superpowers-mcp setup --target devin # Configure Devin Desktop (Windsurf) only
|
|
99
|
+
|
|
100
|
+
Any Directory:
|
|
101
|
+
You can run this command from ANY directory on your machine.
|
|
102
|
+
It automatically resolves global configuration paths based on your user home folder.
|
|
103
|
+
|
|
104
|
+
Privacy & Safety:
|
|
105
|
+
Superpowers MCP only touches the client you explicitly choose.
|
|
106
|
+
It never bulk-modifies your environment without your consent.
|
|
107
|
+
`)}function Rj(){let e=process.env.SKILLS_PATH;if(e){let r=tt.resolve(e),n=tt.normalize(r).toLowerCase(),o=tt.parse(r).root.toLowerCase();if(n===o||["/etc","/var","/bin","/sbin","/usr","/root","/sys","/proc","/dev","c:\\windows","c:\\program files","c:\\program files (x86)"].some(s=>n===s||n.startsWith(s+tt.sep)))process.stderr.write(`Warning: Potentially unsafe SKILLS_PATH: "${e}". Fallback to default.
|
|
108
|
+
`);else return r}let t=tt.join(__dirname,"..","skills");return d$.existsSync(t)?t:tt.join(__dirname,"skills")}var Df=Rj(),jt=new zs(Df),dr=new ks({name:"superpowers-mcp",version:"6.3.4"},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});dr.setRequestHandler(fd,async()=>({resources:(await jt.listSkills()).map(t=>({uri:`skill://superpowers/${encodeURIComponent(t.name)}`,name:t.name,description:t.description,mimeType:"text/markdown"}))}));dr.setRequestHandler(hd,async e=>{let t=e.params.uri,r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new R(M.InvalidRequest,`Invalid skill URI: ${t}`);let n;try{n=decodeURIComponent(r[1])}catch{throw new R(M.InvalidRequest,`Invalid skill URI: ${t}`)}let o=await jt.findSkill(n);if(!o)throw new R(M.InvalidRequest,`Skill not found: ${n}`);try{let i=await jt.readSkillContent(o.skillPath);return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}}catch{throw new R(M.InternalError,"Failed to read skill content safely.")}});function mi(e,t){let r=Object.keys(t).filter(i=>{let a=t[i];return a!==void 0&&a!==""});if(r.length===0)return e;let n=r.sort((i,a)=>a.length-i.length).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),o=new RegExp(n,"g");return e.replace(o,i=>{let a=t[i];return a!==void 0&&a!==""?String(a):i})}dr.setRequestHandler(gd,async()=>({prompts:[{name:"session-start",description:"Inject the Superpowers context into an AI agent session. Tells the agent it has superpowers and how to use the skill system."},{name:"sdd-implementer",description:"Subagent-Driven Development (SDD) Implementer Prompt. Directs a subagent to implement a specific task using TDD and self-verification.",arguments:[{name:"brief_file",description:"Path to the task brief file (scripts/task-brief PLAN N)",required:!1},{name:"task_name",description:"Name or description of the task to implement",required:!1},{name:"report_file",description:"Path where the implementer should write its detailed report",required:!1},{name:"work_dir",description:"Working directory path for implementation",required:!1},{name:"model",description:"Model tier/name selection for implementer",required:!1},{name:"plan_file",description:"Legacy alias: Path to the task brief or plan file",required:!1},{name:"task_description",description:"Legacy alias: Task description",required:!1}]},{name:"sdd-task-reviewer",description:"Subagent-Driven Development (SDD) Task Reviewer Prompt. Evaluates task implementation against specification and code quality.",arguments:[{name:"brief_file",description:"Path to the task brief file",required:!1},{name:"report_file",description:"Path to the implementer's report file",required:!1},{name:"diff_file",description:"Path to the review package diff file",required:!1},{name:"base_sha",description:"Base commit SHA before this task",required:!1},{name:"head_sha",description:"Head commit SHA for this task",required:!1},{name:"global_constraints",description:"Binding global constraints copied verbatim from the plan or spec",required:!1},{name:"model",description:"Reviewer model selection",required:!1},{name:"task_description",description:"Legacy alias: Description of the task being reviewed",required:!1},{name:"review_target",description:"Legacy alias: Review target or diff path",required:!1}]},{name:"sdd-re-review",description:"SDD Scoped Re-Review Prompt. Reviews only fix-round deltas and previous feedback to prevent context bloat.",arguments:[{name:"brief_file",description:"Path to the task brief file",required:!1},{name:"report_file",description:"Path to the implementer's report file with fix notes",required:!1},{name:"diff_file",description:"Path to the scoped review package diff file over fix range",required:!1},{name:"previous_findings",description:"Previous reviewer findings that needed fixing",required:!1},{name:"base_sha",description:"Base commit SHA for the fix round",required:!1},{name:"head_sha",description:"Current head commit SHA",required:!1},{name:"model",description:"Re-reviewer model selection",required:!1},{name:"fix_summary",description:"Legacy alias: Summary of changes made to address previous findings",required:!1}]},{name:"spec-reviewer",description:"Spec Document Reviewer Prompt. Adversarially reviews a design specification across requirements, architecture, and edge cases.",arguments:[{name:"spec_file",description:"Path to the specification document to review (e.g., docs/superpowers/specs/...)",required:!1}]},{name:"plan-reviewer",description:"Plan Document Reviewer Prompt. Adversarially reviews an implementation plan for completeness, testability, and task contracts.",arguments:[{name:"plan_file",description:"Path to the implementation plan document to review",required:!1},{name:"spec_file",description:"Path to the reference specification document",required:!1}]},{name:"feature-pipeline",description:"Feature Development Pipeline Prompt. Chains brainstorming, writing-plans, git-worktrees, SDD/TDD, verification, code review, and branch finishing into a structured workflow.",arguments:[{name:"feature_name",description:"Name or title of the feature to develop",required:!1},{name:"requirements",description:"Initial feature requirements, constraints, or description",required:!1}]},{name:"structured-debug",description:"Structured Troubleshooting Pipeline Prompt. Chains systematic debugging, worktree isolation, parallel agent investigation, TDD fix, full verification, and review.",arguments:[{name:"issue_description",description:"Description of the bug, error logs, or symptoms",required:!1},{name:"failing_tests",description:"Names or paths of failing tests",required:!1}]},{name:"skill-composition",description:"Skill Composition & Workflow Guide Prompt. Recommends multi-skill compositions for feature development, debugging, refactoring, or legacy safety net.",arguments:[{name:"scenario",description:"Development scenario (feature, debug, refactor, legacy-safety)",required:!1}]}]}));dr.setRequestHandler(vd,async e=>{let t=e.params.name,r=e.params.arguments||{},n=32*1024,o=(a,s=n)=>{let c=Object.prototype.hasOwnProperty.call(r,a)?r[a]:void 0,u="";return typeof c=="string"?u=c.trim():c!=null&&(u=String(c).trim()),u.length>s?u.slice(0,s):u},i=async a=>{let s=tt.join(Df,a);try{return await jt.readSkillContent(s)}catch{return""}};if(t==="session-start"){let a="";try{let c=await jt.findSkill("using-superpowers"),u=c?c.skillPath:tt.join(Df,"using-superpowers","SKILL.md");a=await jt.readSkillContent(u)}catch{a=`# Superpowers
|
|
109
|
+
|
|
110
|
+
You have superpowers. Use the read_skill and list_skills tools to discover and load skills.`}return{description:"Superpowers session start context \u2014 establishes how to find and use skills",messages:[{role:"user",content:{type:"text",text:`<EXTREMELY_IMPORTANT>
|
|
57
111
|
You have superpowers.
|
|
58
112
|
|
|
59
113
|
**Below is the full content of your 'superpowers:using-superpowers' skill - your introduction to using skills. For all other skills, use the read_skill tool:**
|
|
60
114
|
|
|
61
|
-
${
|
|
62
|
-
</EXTREMELY_IMPORTANT>`}}]}}if(t==="sdd-implementer"){let
|
|
115
|
+
${a}
|
|
116
|
+
</EXTREMELY_IMPORTANT>`}}]}}if(t==="sdd-implementer"){let a=await i("subagent-driven-development/implementer-prompt.md"),s=o("brief_file")||o("plan_file"),c=o("task_name")||o("task_description"),u=o("report_file"),l=o("work_dir"),d=o("model"),f=o("task_description"),p=o("plan_file"),h=mi(a,{"[BRIEF_FILE]":s,"[task name]":c,"[REPORT_FILE]":u,"[directory]":l,"[MODEL]":d}),g=[f&&!h.includes(f)?`
|
|
63
117
|
|
|
64
118
|
### Target Task:
|
|
65
|
-
${
|
|
119
|
+
${f}`:"",p&&!h.includes(p)?`
|
|
66
120
|
|
|
67
121
|
### Plan / Brief File:
|
|
68
|
-
${
|
|
122
|
+
${p}`:""].join("");return{description:"Subagent-Driven Development Implementer Prompt",messages:[{role:"user",content:{type:"text",text:`${h}${g}`}}]}}if(t==="sdd-task-reviewer"){let a=await i("subagent-driven-development/task-reviewer-prompt.md"),s=o("brief_file"),c=o("report_file"),u=o("diff_file")||o("review_target"),l=o("base_sha"),d=o("head_sha"),f=o("global_constraints"),p=o("model"),h=o("task_description"),g=o("review_target"),y=mi(a,{"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[BASE_SHA]":l,"[HEAD_SHA]":d,"[GLOBAL_CONSTRAINTS]":f,"[MODEL]":p}),$=[h&&!y.includes(h)?`
|
|
69
123
|
|
|
70
124
|
### Reviewed Task:
|
|
71
|
-
${
|
|
125
|
+
${h}`:"",g&&!y.includes(g)?`
|
|
72
126
|
|
|
73
127
|
### Review Target:
|
|
74
|
-
${
|
|
128
|
+
${g}`:""].join("");return{description:"Subagent-Driven Development Task Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${y}${$}`}}]}}if(t==="sdd-re-review"){let a=await i("subagent-driven-development/re-review-prompt.md"),s=o("brief_file"),c=o("report_file"),u=o("diff_file"),l=o("previous_findings"),d=o("base_sha")||o("fix_base_sha"),f=o("head_sha"),p=o("model"),h=o("fix_summary"),g=mi(a,{"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[FINDINGS]":l,"[BASE_SHA]":d,"[HEAD_SHA]":f,"[MODEL]":p}),y=[l&&!g.includes(l)?`
|
|
75
129
|
|
|
76
130
|
### Previous Findings:
|
|
77
|
-
${
|
|
131
|
+
${l}`:"",h?`
|
|
78
132
|
|
|
79
133
|
### Fix Summary:
|
|
80
|
-
${
|
|
134
|
+
${h}`:""].join("");return{description:"SDD Scoped Re-Review Prompt",messages:[{role:"user",content:{type:"text",text:`${g}${y}`}}]}}if(t==="spec-reviewer"){let a=await i("brainstorming/spec-document-reviewer-prompt.md"),s=o("spec_file"),c=mi(a,{"[SPEC_FILE_PATH]":s}),u=s&&!c.includes(s)?`
|
|
81
135
|
|
|
82
136
|
### Target Specification:
|
|
83
|
-
${
|
|
137
|
+
${s}`:"";return{description:"Brainstorming Spec Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${c}${u}`}}]}}if(t==="plan-reviewer"){let a=await i("writing-plans/plan-document-reviewer-prompt.md"),s=o("plan_file"),c=o("spec_file"),u=mi(a,{"[PLAN_FILE_PATH]":s,"[SPEC_FILE_PATH]":c}),l=s&&!u.includes(s)?`
|
|
84
138
|
|
|
85
139
|
### Target Implementation Plan:
|
|
86
|
-
${
|
|
140
|
+
${s}`:"",d=c&&!u.includes(c)?`
|
|
141
|
+
|
|
142
|
+
### Reference Specification:
|
|
143
|
+
${c}`:"";return{description:"Writing-Plans Plan Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${u}${l}${d}`}}]}}if(t==="feature-pipeline"){let a=o("feature_name"),s=a?a.replace(/[\r\n]+/g," "):"(Unspecified feature)",c=o("requirements"),u=c?`
|
|
144
|
+
### Requirements / Context:
|
|
145
|
+
${c}
|
|
146
|
+
`:"";return{description:"Feature Development Pipeline Prompt",messages:[{role:"user",content:{type:"text",text:`# Feature Development Pipeline
|
|
147
|
+
|
|
148
|
+
You are executing an end-to-end feature development workflow using Superpowers skills.
|
|
149
|
+
|
|
150
|
+
**Target Feature:** ${s}
|
|
151
|
+
${u}
|
|
152
|
+
## Mandatory Execution Stages:
|
|
153
|
+
|
|
154
|
+
1. **Stage 1: Requirements & Architecture Discovery**
|
|
155
|
+
- **Invoke Skill:** \`superpowers:brainstorming\`
|
|
156
|
+
- Clarify user intent, requirements, constraints, and architecture decisions.
|
|
157
|
+
- Produce a design specification document (e.g., in \`docs/superpowers/specs/\`).
|
|
158
|
+
|
|
159
|
+
2. **Stage 2: Plan Construction**
|
|
160
|
+
- **Invoke Skill:** \`superpowers:writing-plans\`
|
|
161
|
+
- Decompose the spec into bite-sized, independently testable tasks.
|
|
162
|
+
- Specify Recommended Skills (e.g. \`superpowers:test-driven-development\`) for each task.
|
|
163
|
+
- Save plan to \`docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md\`.
|
|
164
|
+
|
|
165
|
+
3. **Stage 3: Workspace Isolation**
|
|
166
|
+
- **Invoke Skill:** \`superpowers:using-git-worktrees\`
|
|
167
|
+
- Create an isolated Git worktree for this feature development to keep main branch pristine.
|
|
168
|
+
|
|
169
|
+
4. **Stage 4: Execution & Implementation**
|
|
170
|
+
- **Invoke Skill:** \`superpowers:subagent-driven-development\` (or \`superpowers:executing-plans\`)
|
|
171
|
+
- For each task:
|
|
172
|
+
- Follow \`superpowers:test-driven-development\` (Red -> Green -> Refactor).
|
|
173
|
+
- Run task-level verification and self-review.
|
|
174
|
+
- Dispatch fresh task reviewer per task.
|
|
175
|
+
|
|
176
|
+
5. **Stage 5: Full Suite Verification**
|
|
177
|
+
- **Invoke Skill:** \`superpowers:verification-before-completion\`
|
|
178
|
+
- Run complete repository test suite, linter, and type checks. Do NOT skip.
|
|
179
|
+
|
|
180
|
+
6. **Stage 6: Code Review**
|
|
181
|
+
- **Invoke Skill:** \`superpowers:requesting-code-review\` (and \`superpowers:receiving-code-review\`)
|
|
182
|
+
- Generate review package and resolve all findings.
|
|
183
|
+
|
|
184
|
+
7. **Stage 7: Branch Finishing & Cleanup**
|
|
185
|
+
- **Invoke Skill:** \`superpowers:finishing-a-development-branch\`
|
|
186
|
+
- Merge/PR, remove temporary worktree, and clean up.`}}]}}if(t==="structured-debug"){let a=o("issue_description"),s=a?`
|
|
187
|
+
### Issue Description / Logs:
|
|
188
|
+
${a}
|
|
189
|
+
`:"",c=o("failing_tests"),u=c?`
|
|
190
|
+
### Failing Tests:
|
|
191
|
+
${c}
|
|
192
|
+
`:"";return{description:"Structured Troubleshooting Pipeline Prompt",messages:[{role:"user",content:{type:"text",text:`# Structured Troubleshooting Pipeline
|
|
193
|
+
|
|
194
|
+
You are executing a rigorous root-cause debugging process for complex failures or multiple failing tests.
|
|
195
|
+
${s}${u}
|
|
196
|
+
## Mandatory Troubleshooting Stages:
|
|
197
|
+
|
|
198
|
+
1. **Stage 1: Systematic Root Cause Analysis**
|
|
199
|
+
- **Invoke Skill:** \`superpowers:systematic-debugging\`
|
|
200
|
+
- Gather exact error traces, logs, and state.
|
|
201
|
+
- Decompose into testable, mutually exclusive hypotheses.
|
|
202
|
+
|
|
203
|
+
2. **Stage 2: Workspace Isolation for Investigation**
|
|
204
|
+
- **Invoke Skill:** \`superpowers:using-git-worktrees\`
|
|
205
|
+
- If investigating multiple independent hypotheses in parallel, create separate worktrees to prevent test interference and race conditions.
|
|
206
|
+
|
|
207
|
+
3. **Stage 3: Parallel Hypothesis Verification (Optional / Recommended for multi-bug)**
|
|
208
|
+
- **Invoke Skill:** \`superpowers:dispatching-parallel-agents\`
|
|
209
|
+
- Dispatch subagents into isolated worktrees to prove/disprove hypotheses.
|
|
210
|
+
|
|
211
|
+
4. **Stage 4: Test-Driven Bugfix**
|
|
212
|
+
- **Invoke Skill:** \`superpowers:test-driven-development\`
|
|
213
|
+
- Write a minimal failing reproduction test first (RED).
|
|
214
|
+
- Apply the fix until test passes (GREEN).
|
|
215
|
+
- Refactor without altering semantics.
|
|
216
|
+
|
|
217
|
+
5. **Stage 5: Full Regression Verification**
|
|
218
|
+
- **Invoke Skill:** \`superpowers:verification-before-completion\`
|
|
219
|
+
- Run entire repository test suite to confirm zero regressions.
|
|
220
|
+
|
|
221
|
+
6. **Stage 6: Code Review & Findings Resolution**
|
|
222
|
+
- **Invoke Skill:** \`superpowers:requesting-code-review\` (and \`superpowers:receiving-code-review\`)
|
|
223
|
+
- Review fix delta, ensure regression tests are defensive, and resolve all review findings.
|
|
224
|
+
|
|
225
|
+
7. **Stage 7: Branch Finishing & Cleanup**
|
|
226
|
+
- **Invoke Skill:** \`superpowers:finishing-a-development-branch\`
|
|
227
|
+
- Merge/PR the bugfix branch, clean up temporary worktrees, and delete obsolete branches.`}}]}}if(t==="skill-composition"){let a=o("scenario"),s=a?`
|
|
228
|
+
### Selected Scenario:
|
|
229
|
+
${a}
|
|
230
|
+
`:"",c="";if(a){let l=a.toLowerCase();l.includes("debug")||l.includes("troubleshoot")||l.includes("bug")||l.includes("fix")?c=`
|
|
231
|
+
> **Recommended Pipeline Focus:** Pipeline 2 (Structured Debugging & Troubleshooting)
|
|
232
|
+
`:l.includes("refactor")||l.includes("migrat")||l.includes("upgrade")?c=`
|
|
233
|
+
> **Recommended Pipeline Focus:** Pipeline 3 (Large Refactoring & System Migration)
|
|
234
|
+
`:l.includes("legacy")||l.includes("safety")?c=`
|
|
235
|
+
> **Recommended Pipeline Focus:** Pipeline 4 (Legacy Codebase Safety Net)
|
|
236
|
+
`:(l.includes("feature")||l.includes("new")||l.includes("build"))&&(c=`
|
|
237
|
+
> **Recommended Pipeline Focus:** Pipeline 1 (New Feature Development)
|
|
238
|
+
`)}return{description:"Superpowers Skill Composition Guide Prompt",messages:[{role:"user",content:{type:"text",text:`# Superpowers Skill Composition Guide
|
|
239
|
+
|
|
240
|
+
You are selecting or executing a multi-skill workflow pipeline.
|
|
241
|
+
${s}${c}
|
|
242
|
+
## Available Workflow Pipelines (see docs/skill-compositions.md for full details):
|
|
243
|
+
|
|
244
|
+
1. **New Feature Development:**
|
|
245
|
+
\`brainstorming\` \u2794 \`writing-plans\` \u2794 \`using-git-worktrees\` \u2794 \`subagent-driven-development\` (TDD) \u2794 \`verification-before-completion\` \u2794 \`requesting-code-review\` \u2794 \`finishing-a-development-branch\`
|
|
246
|
+
|
|
247
|
+
2. **Structured Debugging & Multi-failure Troubleshooting:**
|
|
248
|
+
\`systematic-debugging\` \u2794 \`using-git-worktrees\` \u2794 \`dispatching-parallel-agents\` \u2794 \`test-driven-development\` \u2794 \`verification-before-completion\` \u2794 \`requesting-code-review\` \u2794 \`finishing-a-development-branch\`
|
|
249
|
+
|
|
250
|
+
3. **Large Refactoring & System Migration:**
|
|
251
|
+
\`brainstorming\` \u2794 \`writing-plans\` (skeleton-first) \u2794 \`using-git-worktrees\` \u2794 \`subagent-driven-development\` \u2794 \`verification-before-completion\` \u2794 \`requesting-code-review\` \u2794 \`finishing-a-development-branch\`
|
|
252
|
+
|
|
253
|
+
4. **Legacy Codebase Safety Net:**
|
|
254
|
+
\`brainstorming\` \u2794 \`writing-plans\` \u2794 \`test-driven-development\` (characterization tests) \u2794 \`systematic-debugging\` \u2794 \`verification-before-completion\`
|
|
255
|
+
|
|
256
|
+
Use \`read_skill(skill_name)\` to inspect any skill before starting.`}}]}}throw new R(M.InvalidRequest,`Unknown prompt: ${t}`)});dr.setRequestHandler(xd,async()=>({tools:[{name:"list_skills",description:"List all available Superpowers skills with their names and descriptions. Use this to discover which skills are available before loading one.",inputSchema:{type:"object",properties:{},required:[]}},{name:"read_skill",description:"Read the full content of a Superpowers skill by name. The skill content contains instructions, checklists, and patterns to follow. Read a skill before attempting the task it covers.",inputSchema:{type:"object",properties:{skill_name:{type:"string",description:'Name of the skill to read (e.g. "brainstorming", "test-driven-development", "systematic-debugging")'}},required:["skill_name"]}}]}));dr.setRequestHandler(Do,async e=>{let{name:t,arguments:r}=e.params;if(t==="list_skills"){let n=await jt.listSkills(),o=n.map(i=>`**${i.name}**
|
|
87
257
|
${i.description}`).join(`
|
|
88
258
|
|
|
89
259
|
---
|
|
@@ -94,7 +264,7 @@ Use \`read_skill\` with the skill name to load its full content.
|
|
|
94
264
|
|
|
95
265
|
---
|
|
96
266
|
|
|
97
|
-
${o}`}]}}if(t==="read_skill"){let n=r,o=typeof n?.skill_name=="string"?n.skill_name.trim():void 0;if(!o)throw new
|
|
267
|
+
${o}`}]}}if(t==="read_skill"){let n=r,o=typeof n?.skill_name=="string"?n.skill_name.trim():void 0;if(!o)throw new R(M.InvalidParams,"skill_name is required");let i=await jt.findSkill(o);if(!i){let s=(await jt.listSkills()).map(c=>c.name).join(", ");throw new R(M.InvalidRequest,`Skill "${o}" not found. Available skills: ${s}`)}try{let a=await jt.readSkillContent(i.skillPath);return{content:[{type:"text",text:`# Skill: ${i.name}
|
|
98
268
|
|
|
99
|
-
${a}`}]}}catch{throw new
|
|
269
|
+
${a}`}]}}catch{throw new R(M.InternalError,`Failed to read skill "${o}" due to an internal error.`)}}throw new R(M.MethodNotFound,`Unknown tool: ${t}`)});async function Zj(){let e=process.argv.slice(2),t=e[0];if(t==="setup"||t==="--setup"){try{await l$(e),process.exit(0)}catch(o){console.error("Setup failed:",o),process.exit(1)}return}let r=new Ss;await dr.connect(r);let n=async()=>{try{await dr.close()}catch{}process.exit(0)};process.on("SIGINT",n),process.on("SIGTERM",n)}Zj().catch(e=>{process.stderr.write(`MCP Server fatal error: ${String(e)}
|
|
100
270
|
`),process.exit(1)});
|