superclawd 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,79 @@
1
+ import { createRequire as __cr } from 'module'; const require = __cr(import.meta.url);
2
+ var Mg=Object.create;var ei=Object.defineProperty;var Dg=Object.getOwnPropertyDescriptor;var qg=Object.getOwnPropertyNames;var Lg=Object.getPrototypeOf,Ug=Object.prototype.hasOwnProperty;var co=(t,e)=>()=>(t&&(e=t(t=0)),e);var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),uo=(t,e)=>{for(var r in e)ei(t,r,{get:e[r],enumerable:!0})},Vg=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of qg(e))!Ug.call(t,o)&&o!==r&&ei(t,o,{get:()=>e[o],enumerable:!(n=Dg(e,o))||n.enumerable});return t};var vl=(t,e,r)=>(r=t!=null?Mg(Lg(t)):{},Vg(e||!t||!t.__esModule?ei(r,"default",{value:t,enumerable:!0}):r,t));var Zn=S(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.regexpCode=G.getEsmExportName=G.getProperty=G.safeStringify=G.stringify=G.strConcat=G.addCodeArg=G.str=G._=G.nil=G._Code=G.Name=G.IDENTIFIER=G._CodeOrName=void 0;var Rn=class{};G._CodeOrName=Rn;G.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var gr=class extends Rn{constructor(e){if(super(),!G.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};G.Name=gr;var He=class extends Rn{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof gr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};G._Code=He;G.nil=new He("");function bf(t,...e){let r=[t[0]],n=0;for(;n<e.length;)$c(r,e[n]),r.push(t[++n]);return new He(r)}G._=bf;var xc=new He("+");function xf(t,...e){let r=[In(t[0])],n=0;for(;n<e.length;)r.push(xc),$c(r,e[n]),r.push(xc,In(t[++n]));return U0(r),new He(r)}G.str=xf;function $c(t,e){e instanceof He?t.push(...e._items):e instanceof gr?t.push(e):t.push(B0(e))}G.addCodeArg=$c;function U0(t){let e=1;for(;e<t.length-1;){if(t[e]===xc){let r=V0(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function V0(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof gr||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof gr))return`"${t}${e.slice(1)}`}function F0(t,e){return e.emptyStr()?t:t.emptyStr()?e:xf`${t}${e}`}G.strConcat=F0;function B0(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:In(Array.isArray(t)?t.join(","):t)}function H0(t){return new He(In(t))}G.stringify=H0;function In(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}G.safeStringify=In;function K0(t){return typeof t=="string"&&G.IDENTIFIER.test(t)?new He(`.${t}`):bf`[${t}]`}G.getProperty=K0;function W0(t){if(typeof t=="string"&&G.IDENTIFIER.test(t))return new He(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}G.getEsmExportName=W0;function J0(t){return new He(t.toString())}G.regexpCode=J0});var Sc=S(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.ValueScope=Ne.ValueScopeName=Ne.Scope=Ne.varKinds=Ne.UsedValueState=void 0;var Ce=Zn(),wc=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},as;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(as||(Ne.UsedValueState=as={}));Ne.varKinds={const:new Ce.Name("const"),let:new Ce.Name("let"),var:new Ce.Name("var")};var cs=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Ce.Name?e:this.name(e)}name(e){return new Ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Ne.Scope=cs;var us=class extends Ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Ce._)`.${new Ce.Name(r)}[${n}]`}};Ne.ValueScopeName=us;var G0=(0,Ce._)`\n`,kc=class extends cs{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?G0:Ce.nil}}get(){return this._scope}name(e){return new us(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ce._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=Ce.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,as.Started);let l=r(u);if(l){let d=this.opts.es5?Ne.varKinds.var:Ne.varKinds.const;s=(0,Ce._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Ce._)`${s}${l}${this.opts._n}`;else throw new wc(u);c.set(u,as.Completed)})}return s}};Ne.ValueScope=kc});var q=S(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.or=U.and=U.not=U.CodeGen=U.operators=U.varKinds=U.ValueScopeName=U.ValueScope=U.Scope=U.Name=U.regexpCode=U.stringify=U.getProperty=U.nil=U.strConcat=U.str=U._=void 0;var K=Zn(),ot=Sc(),At=Zn();Object.defineProperty(U,"_",{enumerable:!0,get:function(){return At._}});Object.defineProperty(U,"str",{enumerable:!0,get:function(){return At.str}});Object.defineProperty(U,"strConcat",{enumerable:!0,get:function(){return At.strConcat}});Object.defineProperty(U,"nil",{enumerable:!0,get:function(){return At.nil}});Object.defineProperty(U,"getProperty",{enumerable:!0,get:function(){return At.getProperty}});Object.defineProperty(U,"stringify",{enumerable:!0,get:function(){return At.stringify}});Object.defineProperty(U,"regexpCode",{enumerable:!0,get:function(){return At.regexpCode}});Object.defineProperty(U,"Name",{enumerable:!0,get:function(){return At.Name}});var fs=Sc();Object.defineProperty(U,"Scope",{enumerable:!0,get:function(){return fs.Scope}});Object.defineProperty(U,"ValueScope",{enumerable:!0,get:function(){return fs.ValueScope}});Object.defineProperty(U,"ValueScopeName",{enumerable:!0,get:function(){return fs.ValueScopeName}});Object.defineProperty(U,"varKinds",{enumerable:!0,get:function(){return fs.varKinds}});U.operators={GT:new K._Code(">"),GTE:new K._Code(">="),LT:new K._Code("<"),LTE:new K._Code("<="),EQ:new K._Code("==="),NEQ:new K._Code("!=="),NOT:new K._Code("!"),OR:new K._Code("||"),AND:new K._Code("&&"),ADD:new K._Code("+")};var zt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},zc=class extends zt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ot.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Kr(this.rhs,e,r)),this}get names(){return this.rhs instanceof K._CodeOrName?this.rhs.names:{}}},ls=class extends zt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof K.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Kr(this.rhs,e,r),this}get names(){let e=this.lhs instanceof K.Name?{}:{...this.lhs.names};return ps(e,this.rhs)}},Pc=class extends ls{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Ec=class extends zt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Tc=class extends zt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Rc=class extends zt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Ic=class extends zt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Kr(this.code,e,r),this}get names(){return this.code instanceof K._CodeOrName?this.code.names:{}}},On=class extends zt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(Y0(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>vr(e,r.names),{})}},Pt=class extends On{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Zc=class extends On{},Hr=class extends Pt{};Hr.kind="else";var _r=class t extends Pt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Hr(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t($f(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Kr(this.condition,e,r),this}get names(){let e=super.names;return ps(e,this.condition),this.else&&vr(e,this.else.names),e}};_r.kind="if";var yr=class extends Pt{};yr.kind="for";var Oc=class extends yr{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Kr(this.iteration,e,r),this}get names(){return vr(super.names,this.iteration.names)}},Cc=class extends yr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?ot.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=ps(super.names,this.from);return ps(e,this.to)}},ds=class extends yr{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Kr(this.iterable,e,r),this}get names(){return vr(super.names,this.iterable.names)}},Cn=class extends Pt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Cn.kind="func";var Nn=class extends On{render(e){return"return "+super.render(e)}};Nn.kind="return";var Nc=class extends Pt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&vr(e,this.catch.names),this.finally&&vr(e,this.finally.names),e}},jn=class extends Pt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};jn.kind="catch";var An=class extends Pt{render(e){return"finally"+super.render(e)}};An.kind="finally";var jc=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ `:""},this._extScope=e,this._scope=new ot.Scope({parent:e}),this._nodes=[new Zc]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new zc(e,s,n)),s}const(e,r,n){return this._def(ot.varKinds.const,e,r,n)}let(e,r,n){return this._def(ot.varKinds.let,e,r,n)}var(e,r,n){return this._def(ot.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new ls(e,r,n))}add(e,r){return this._leafNode(new Pc(e,U.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==K.nil&&this._leafNode(new Ic(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,K.addCodeArg)(r,o));return r.push("}"),new K._Code(r)}if(e,r,n){if(this._blockNode(new _r(e)),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(e){return this._elseNode(new _r(e))}else(){return this._elseNode(new Hr)}endIf(){return this._endBlockNode(_r,Hr)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Oc(e),r)}forRange(e,r,n,o,s=this.opts.es5?ot.varKinds.var:ot.varKinds.let){let i=this._scope.toName(e);return this._for(new Cc(s,i,r,n),()=>o(i))}forOf(e,r,n,o=ot.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof K.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,K._)`${i}.length`,a=>{this.var(s,(0,K._)`${i}[${a}]`),n(s)})}return this._for(new ds("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?ot.varKinds.var:ot.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,K._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new ds("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(yr)}label(e){return this._leafNode(new Ec(e))}break(e){return this._leafNode(new Tc(e))}return(e){let r=new Nn;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Nn)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Nc;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new jn(s),r(s)}return n&&(this._currNode=o.finally=new An,this.code(n)),this._endBlockNode(jn,An)}throw(e){return this._leafNode(new Rc(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){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||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=K.nil,n,o){return this._blockNode(new Cn(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Cn)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof _r))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};U.CodeGen=jc;function vr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function ps(t,e){return e instanceof K._CodeOrName?vr(t,e.names):t}function Kr(t,e,r){if(t instanceof K.Name)return n(t);if(!o(t))return t;return new K._Code(t._items.reduce((s,i)=>(i instanceof K.Name&&(i=n(i)),i instanceof K._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof K._Code&&s._items.some(i=>i instanceof K.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Y0(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function $f(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,K._)`!${Ac(t)}`}U.not=$f;var X0=wf(U.operators.AND);function Q0(...t){return t.reduce(X0)}U.and=Q0;var ex=wf(U.operators.OR);function tx(...t){return t.reduce(ex)}U.or=tx;function wf(t){return(e,r)=>e===K.nil?r:r===K.nil?e:(0,K._)`${Ac(e)} ${t} ${Ac(r)}`}function Ac(t){return t instanceof K.Name?t:(0,K._)`(${t})`}});var Y=S(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.checkStrictMode=V.getErrorPath=V.Type=V.useFunc=V.setEvaluated=V.evaluatedPropsToName=V.mergeEvaluated=V.eachItem=V.unescapeJsonPointer=V.escapeJsonPointer=V.escapeFragment=V.unescapeFragment=V.schemaRefOrVal=V.schemaHasRulesButRef=V.schemaHasRules=V.checkUnknownRules=V.alwaysValidSchema=V.toHash=void 0;var re=q(),rx=Zn();function nx(t){let e={};for(let r of t)e[r]=!0;return e}V.toHash=nx;function ox(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(zf(t,e),!Pf(e,t.self.RULES.all))}V.alwaysValidSchema=ox;function zf(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||Rf(t,`unknown keyword: "${s}"`)}V.checkUnknownRules=zf;function Pf(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}V.schemaHasRules=Pf;function sx(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}V.schemaHasRulesButRef=sx;function ix({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,re._)`${r}`}return(0,re._)`${t}${e}${(0,re.getProperty)(n)}`}V.schemaRefOrVal=ix;function ax(t){return Ef(decodeURIComponent(t))}V.unescapeFragment=ax;function cx(t){return encodeURIComponent(Dc(t))}V.escapeFragment=cx;function Dc(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}V.escapeJsonPointer=Dc;function Ef(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}V.unescapeJsonPointer=Ef;function ux(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}V.eachItem=ux;function kf({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof re.Name?(s instanceof re.Name?t(o,s,i):e(o,s,i),i):s instanceof re.Name?(e(o,i,s),s):r(s,i);return a===re.Name&&!(c instanceof re.Name)?n(o,c):c}}V.mergeEvaluated={props:kf({mergeNames:(t,e,r)=>t.if((0,re._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,re._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,re._)`${r} || {}`).code((0,re._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,re._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,re._)`${r} || {}`),qc(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Tf}),items:kf({mergeNames:(t,e,r)=>t.if((0,re._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,re._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,re._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,re._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Tf(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,re._)`{}`);return e!==void 0&&qc(t,r,e),r}V.evaluatedPropsToName=Tf;function qc(t,e,r){Object.keys(r).forEach(n=>t.assign((0,re._)`${e}${(0,re.getProperty)(n)}`,!0))}V.setEvaluated=qc;var Sf={};function lx(t,e){return t.scopeValue("func",{ref:e,code:Sf[e.code]||(Sf[e.code]=new rx._Code(e.code))})}V.useFunc=lx;var Mc;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Mc||(V.Type=Mc={}));function dx(t,e,r){if(t instanceof re.Name){let n=e===Mc.Num;return r?n?(0,re._)`"[" + ${t} + "]"`:(0,re._)`"['" + ${t} + "']"`:n?(0,re._)`"/" + ${t}`:(0,re._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,re.getProperty)(t).toString():"/"+Dc(t)}V.getErrorPath=dx;function Rf(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}V.checkStrictMode=Rf});var Et=S(Lc=>{"use strict";Object.defineProperty(Lc,"__esModule",{value:!0});var Se=q(),px={data:new Se.Name("data"),valCxt:new Se.Name("valCxt"),instancePath:new Se.Name("instancePath"),parentData:new Se.Name("parentData"),parentDataProperty:new Se.Name("parentDataProperty"),rootData:new Se.Name("rootData"),dynamicAnchors:new Se.Name("dynamicAnchors"),vErrors:new Se.Name("vErrors"),errors:new Se.Name("errors"),this:new Se.Name("this"),self:new Se.Name("self"),scope:new Se.Name("scope"),json:new Se.Name("json"),jsonPos:new Se.Name("jsonPos"),jsonLen:new Se.Name("jsonLen"),jsonPart:new Se.Name("jsonPart")};Lc.default=px});var Mn=S(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.extendErrors=ze.resetErrorsCount=ze.reportExtraError=ze.reportError=ze.keyword$DataError=ze.keywordError=void 0;var W=q(),ms=Y(),Te=Et();ze.keywordError={message:({keyword:t})=>(0,W.str)`must pass "${t}" keyword validation`};ze.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,W.str)`"${t}" keyword must be ${e} ($data)`:(0,W.str)`"${t}" keyword is invalid ($data)`};function fx(t,e=ze.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=Of(t,e,r);n??(i||a)?If(s,c):Zf(o,(0,W._)`[${c}]`)}ze.reportError=fx;function mx(t,e=ze.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=Of(t,e,r);If(o,a),s||i||Zf(n,Te.default.vErrors)}ze.reportExtraError=mx;function hx(t,e){t.assign(Te.default.errors,e),t.if((0,W._)`${Te.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,W._)`${Te.default.vErrors}.length`,e),()=>t.assign(Te.default.vErrors,null)))}ze.resetErrorsCount=hx;function gx({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,Te.default.errors,a=>{t.const(i,(0,W._)`${Te.default.vErrors}[${a}]`),t.if((0,W._)`${i}.instancePath === undefined`,()=>t.assign((0,W._)`${i}.instancePath`,(0,W.strConcat)(Te.default.instancePath,s.errorPath))),t.assign((0,W._)`${i}.schemaPath`,(0,W.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,W._)`${i}.schema`,r),t.assign((0,W._)`${i}.data`,n))})}ze.extendErrors=gx;function If(t,e){let r=t.const("err",e);t.if((0,W._)`${Te.default.vErrors} === null`,()=>t.assign(Te.default.vErrors,(0,W._)`[${r}]`),(0,W._)`${Te.default.vErrors}.push(${r})`),t.code((0,W._)`${Te.default.errors}++`)}function Zf(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,W._)`new ${t.ValidationError}(${e})`):(r.assign((0,W._)`${n}.errors`,e),r.return(!1))}var br={keyword:new W.Name("keyword"),schemaPath:new W.Name("schemaPath"),params:new W.Name("params"),propertyName:new W.Name("propertyName"),message:new W.Name("message"),schema:new W.Name("schema"),parentSchema:new W.Name("parentSchema")};function Of(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,W._)`{}`:_x(t,e,r)}function _x(t,e,r={}){let{gen:n,it:o}=t,s=[yx(o,r),vx(t,r)];return bx(t,e,s),n.object(...s)}function yx({errorPath:t},{instancePath:e}){let r=e?(0,W.str)`${t}${(0,ms.getErrorPath)(e,ms.Type.Str)}`:t;return[Te.default.instancePath,(0,W.strConcat)(Te.default.instancePath,r)]}function vx({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,W.str)`${e}/${t}`;return r&&(o=(0,W.str)`${o}${(0,ms.getErrorPath)(r,ms.Type.Str)}`),[br.schemaPath,o]}function bx(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([br.keyword,o],[br.params,typeof e=="function"?e(t):e||(0,W._)`{}`]),c.messages&&n.push([br.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([br.schema,i],[br.parentSchema,(0,W._)`${l}${d}`],[Te.default.data,s]),u&&n.push([br.propertyName,u])}});var Nf=S(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.boolOrEmptySchema=Wr.topBoolOrEmptySchema=void 0;var xx=Mn(),$x=q(),wx=Et(),kx={message:"boolean schema is false"};function Sx(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Cf(t,!1):typeof r=="object"&&r.$async===!0?e.return(wx.default.data):(e.assign((0,$x._)`${n}.errors`,null),e.return(!0))}Wr.topBoolOrEmptySchema=Sx;function zx(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Cf(t)):r.var(e,!0)}Wr.boolOrEmptySchema=zx;function Cf(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,xx.reportError)(o,kx,void 0,e)}});var Uc=S(Jr=>{"use strict";Object.defineProperty(Jr,"__esModule",{value:!0});Jr.getRules=Jr.isJSONType=void 0;var Px=["string","number","integer","boolean","null","object","array"],Ex=new Set(Px);function Tx(t){return typeof t=="string"&&Ex.has(t)}Jr.isJSONType=Tx;function Rx(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Jr.getRules=Rx});var Vc=S(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.shouldUseRule=Mt.shouldUseGroup=Mt.schemaHasRulesForType=void 0;function Ix({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&jf(t,n)}Mt.schemaHasRulesForType=Ix;function jf(t,e){return e.rules.some(r=>Af(t,r))}Mt.shouldUseGroup=jf;function Af(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Mt.shouldUseRule=Af});var Dn=S(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.reportTypeError=Pe.checkDataTypes=Pe.checkDataType=Pe.coerceAndCheckDataType=Pe.getJSONTypes=Pe.getSchemaTypes=Pe.DataType=void 0;var Zx=Uc(),Ox=Vc(),Cx=Mn(),M=q(),Mf=Y(),Gr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Gr||(Pe.DataType=Gr={}));function Nx(t){let e=Df(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Pe.getSchemaTypes=Nx;function Df(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Zx.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Pe.getJSONTypes=Df;function jx(t,e){let{gen:r,data:n,opts:o}=t,s=Ax(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,Ox.schemaHasRulesForType)(t,e[0]));if(i){let a=Bc(e,n,o.strictNumbers,Gr.Wrong);r.if(a,()=>{s.length?Mx(t,e,s):Hc(t)})}return i}Pe.coerceAndCheckDataType=jx;var qf=new Set(["string","number","integer","boolean","null"]);function Ax(t,e){return e?t.filter(r=>qf.has(r)||e==="array"&&r==="array"):[]}function Mx(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,M._)`typeof ${o}`),a=n.let("coerced",(0,M._)`undefined`);s.coerceTypes==="array"&&n.if((0,M._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,M._)`${o}[0]`).assign(i,(0,M._)`typeof ${o}`).if(Bc(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,M._)`${a} !== undefined`);for(let u of r)(qf.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Hc(t),n.endIf(),n.if((0,M._)`${a} !== undefined`,()=>{n.assign(o,a),Dx(t,a)});function c(u){switch(u){case"string":n.elseIf((0,M._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,M._)`"" + ${o}`).elseIf((0,M._)`${o} === null`).assign(a,(0,M._)`""`);return;case"number":n.elseIf((0,M._)`${i} == "boolean" || ${o} === null
4
+ || (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,M._)`+${o}`);return;case"integer":n.elseIf((0,M._)`${i} === "boolean" || ${o} === null
5
+ || (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,M._)`+${o}`);return;case"boolean":n.elseIf((0,M._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,M._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,M._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,M._)`${i} === "string" || ${i} === "number"
6
+ || ${i} === "boolean" || ${o} === null`).assign(a,(0,M._)`[${o}]`)}}}function Dx({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,M._)`${e} !== undefined`,()=>t.assign((0,M._)`${e}[${r}]`,n))}function Fc(t,e,r,n=Gr.Correct){let o=n===Gr.Correct?M.operators.EQ:M.operators.NEQ,s;switch(t){case"null":return(0,M._)`${e} ${o} null`;case"array":s=(0,M._)`Array.isArray(${e})`;break;case"object":s=(0,M._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,M._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,M._)`typeof ${e} ${o} ${t}`}return n===Gr.Correct?s:(0,M.not)(s);function i(a=M.nil){return(0,M.and)((0,M._)`typeof ${e} == "number"`,a,r?(0,M._)`isFinite(${e})`:M.nil)}}Pe.checkDataType=Fc;function Bc(t,e,r,n){if(t.length===1)return Fc(t[0],e,r,n);let o,s=(0,Mf.toHash)(t);if(s.array&&s.object){let i=(0,M._)`typeof ${e} != "object"`;o=s.null?i:(0,M._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else o=M.nil;s.number&&delete s.integer;for(let i in s)o=(0,M.and)(o,Fc(i,e,r,n));return o}Pe.checkDataTypes=Bc;var qx={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,M._)`{type: ${t}}`:(0,M._)`{type: ${e}}`};function Hc(t){let e=Lx(t);(0,Cx.reportError)(e,qx)}Pe.reportTypeError=Hc;function Lx(t){let{gen:e,data:r,schema:n}=t,o=(0,Mf.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var Uf=S(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});hs.assignDefaults=void 0;var Yr=q(),Ux=Y();function Vx(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)Lf(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Lf(t,s,o.default))}hs.assignDefaults=Vx;function Lf(t,e,r){let{gen:n,compositeRule:o,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Yr._)`${s}${(0,Yr.getProperty)(e)}`;if(o){(0,Ux.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Yr._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Yr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Yr._)`${a} = ${(0,Yr.stringify)(r)}`)}});var Ke=S(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.validateUnion=ee.validateArray=ee.usePattern=ee.callValidateCode=ee.schemaProperties=ee.allSchemaProperties=ee.noPropertyInData=ee.propertyInData=ee.isOwnProperty=ee.hasPropFunc=ee.reportMissingProp=ee.checkMissingProp=ee.checkReportMissingProp=void 0;var se=q(),Kc=Y(),Dt=Et(),Fx=Y();function Bx(t,e){let{gen:r,data:n,it:o}=t;r.if(Jc(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,se._)`${e}`},!0),t.error()})}ee.checkReportMissingProp=Bx;function Hx({gen:t,data:e,it:{opts:r}},n,o){return(0,se.or)(...n.map(s=>(0,se.and)(Jc(t,e,s,r.ownProperties),(0,se._)`${o} = ${s}`)))}ee.checkMissingProp=Hx;function Kx(t,e){t.setParams({missingProperty:e},!0),t.error()}ee.reportMissingProp=Kx;function Vf(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,se._)`Object.prototype.hasOwnProperty`})}ee.hasPropFunc=Vf;function Wc(t,e,r){return(0,se._)`${Vf(t)}.call(${e}, ${r})`}ee.isOwnProperty=Wc;function Wx(t,e,r,n){let o=(0,se._)`${e}${(0,se.getProperty)(r)} !== undefined`;return n?(0,se._)`${o} && ${Wc(t,e,r)}`:o}ee.propertyInData=Wx;function Jc(t,e,r,n){let o=(0,se._)`${e}${(0,se.getProperty)(r)} === undefined`;return n?(0,se.or)(o,(0,se.not)(Wc(t,e,r))):o}ee.noPropertyInData=Jc;function Ff(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ee.allSchemaProperties=Ff;function Jx(t,e){return Ff(e).filter(r=>!(0,Kc.alwaysValidSchema)(t,e[r]))}ee.schemaProperties=Jx;function Gx({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,se._)`${t}, ${e}, ${n}${o}`:e,d=[[Dt.default.instancePath,(0,se.strConcat)(Dt.default.instancePath,s)],[Dt.default.parentData,i.parentData],[Dt.default.parentDataProperty,i.parentDataProperty],[Dt.default.rootData,Dt.default.rootData]];i.opts.dynamicRef&&d.push([Dt.default.dynamicAnchors,Dt.default.dynamicAnchors]);let h=(0,se._)`${l}, ${r.object(...d)}`;return c!==se.nil?(0,se._)`${a}.call(${c}, ${h})`:(0,se._)`${a}(${h})`}ee.callValidateCode=Gx;var Yx=(0,se._)`new RegExp`;function Xx({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,se._)`${o.code==="new RegExp"?Yx:(0,Fx.useFunc)(t,o)}(${r}, ${n})`})}ee.usePattern=Xx;function Qx(t){let{gen:e,data:r,keyword:n,it:o}=t,s=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,se._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Kc.Type.Num},s),e.if((0,se.not)(s),a)})}}ee.validateArray=Qx;function e$(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Kc.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,se._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,se.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}ee.validateUnion=e$});var Kf=S(mt=>{"use strict";Object.defineProperty(mt,"__esModule",{value:!0});mt.validateKeywordUsage=mt.validSchemaType=mt.funcKeywordCode=mt.macroKeywordCode=void 0;var Re=q(),xr=Et(),t$=Ke(),r$=Mn();function n$(t,e){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=t,a=e.macro.call(i.self,o,s,i),c=Hf(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Re.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}mt.macroKeywordCode=n$;function o$(t,e){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=t;i$(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=Hf(n,o,u),d=n.let("valid");t.block$data(d,h),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function h(){if(e.errors===!1)f(),e.modifying&&Bf(t),g(()=>t.error());else{let v=e.async?m():p();e.modifying&&Bf(t),g(()=>s$(t,v))}}function m(){let v=n.let("ruleErrs",null);return n.try(()=>f((0,Re._)`await `),$=>n.assign(d,!1).if((0,Re._)`${$} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Re._)`${$}.errors`),()=>n.throw($))),v}function p(){let v=(0,Re._)`${l}.errors`;return n.assign(v,null),f(Re.nil),v}function f(v=e.async?(0,Re._)`await `:Re.nil){let $=c.opts.passContext?xr.default.this:xr.default.self,w=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Re._)`${v}${(0,t$.callValidateCode)(t,l,$,w)}`,e.modifying)}function g(v){var $;n.if((0,Re.not)(($=e.valid)!==null&&$!==void 0?$:d),v)}}mt.funcKeywordCode=o$;function Bf(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Re._)`${n.parentData}[${n.parentDataProperty}]`))}function s$(t,e){let{gen:r}=t;r.if((0,Re._)`Array.isArray(${e})`,()=>{r.assign(xr.default.vErrors,(0,Re._)`${xr.default.vErrors} === null ? ${e} : ${xr.default.vErrors}.concat(${e})`).assign(xr.default.errors,(0,Re._)`${xr.default.vErrors}.length`),(0,r$.extendErrors)(t)},()=>t.error())}function i$({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Hf(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Re.stringify)(r)})}function a$(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}mt.validSchemaType=a$;function c$({schema:t,opts:e,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}mt.validateKeywordUsage=c$});var Jf=S(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.extendSubschemaMode=qt.extendSubschemaData=qt.getSubschema=void 0;var ht=q(),Wf=Y();function u$(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,ht._)`${t.schemaPath}${(0,ht.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,ht._)`${t.schemaPath}${(0,ht.getProperty)(e)}${(0,ht.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Wf.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}qt.getSubschema=u$;function l$(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,h=a.let("data",(0,ht._)`${e.data}${(0,ht.getProperty)(r)}`,!0);c(h),t.errorPath=(0,ht.str)`${u}${(0,Wf.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,ht._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof ht.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}qt.extendSubschemaData=l$;function d$(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}qt.extendSubschemaMode=d$});var Gc=S((m1,Gf)=>{"use strict";Gf.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Xf=S((h1,Yf)=>{"use strict";var Lt=Yf.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};gs(e,n,o,t,"",t)};Lt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Lt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Lt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Lt.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 gs(t,e,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Lt.arrayKeywords)for(var h=0;h<d.length;h++)gs(t,e,r,d[h],o+"/"+l+"/"+h,s,o,l,n,h)}else if(l in Lt.propsKeywords){if(d&&typeof d=="object")for(var m in d)gs(t,e,r,d[m],o+"/"+l+"/"+p$(m),s,o,l,n,m)}else(l in Lt.keywords||t.allKeys&&!(l in Lt.skipKeywords))&&gs(t,e,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function p$(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var qn=S(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.getSchemaRefs=je.resolveUrl=je.normalizeId=je._getFullPath=je.getFullPath=je.inlineRef=void 0;var f$=Y(),m$=Gc(),h$=Xf(),g$=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function _$(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Yc(t):e?Qf(t)<=e:!1}je.inlineRef=_$;var y$=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Yc(t){for(let e in t){if(y$.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Yc)||typeof r=="object"&&Yc(r))return!0}return!1}function Qf(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!g$.has(r)&&(typeof t[r]=="object"&&(0,f$.eachItem)(t[r],n=>e+=Qf(n)),e===1/0))return 1/0}return e}function em(t,e="",r){r!==!1&&(e=Xr(e));let n=t.parse(e);return tm(t,n)}je.getFullPath=em;function tm(t,e){return t.serialize(e).split("#")[0]+"#"}je._getFullPath=tm;var v$=/#\/?$/;function Xr(t){return t?t.replace(v$,""):""}je.normalizeId=Xr;function b$(t,e,r){return r=Xr(r),t.resolve(e,r)}je.resolveUrl=b$;var x$=/^[a-z_][-a-z0-9._]*$/i;function $$(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Xr(t[r]||e),s={"":o},i=em(n,o,!1),a={},c=new Set;return h$(t,{allKeys:!0},(d,h,m,p)=>{if(p===void 0)return;let f=i+h,g=s[p];typeof d[r]=="string"&&(g=v.call(this,d[r])),$.call(this,d.$anchor),$.call(this,d.$dynamicAnchor),s[h]=g;function v(w){let P=this.opts.uriResolver.resolve;if(w=Xr(g?P(g,w):w),c.has(w))throw l(w);c.add(w);let R=this.refs[w];return typeof R=="string"&&(R=this.refs[R]),typeof R=="object"?u(d,R.schema,w):w!==Xr(f)&&(w[0]==="#"?(u(d,a[w],w),a[w]=d):this.refs[w]=f),w}function $(w){if(typeof w=="string"){if(!x$.test(w))throw new Error(`invalid anchor "${w}"`);v.call(this,`#${w}`)}}}),a;function u(d,h,m){if(h!==void 0&&!m$(d,h))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}je.getSchemaRefs=$$});var Vn=S(Ut=>{"use strict";Object.defineProperty(Ut,"__esModule",{value:!0});Ut.getData=Ut.KeywordCxt=Ut.validateFunctionCode=void 0;var im=Nf(),rm=Dn(),Qc=Vc(),_s=Dn(),w$=Uf(),Un=Kf(),Xc=Jf(),I=q(),j=Et(),k$=qn(),Tt=Y(),Ln=Mn();function S$(t){if(um(t)&&(lm(t),cm(t))){E$(t);return}am(t,()=>(0,im.topBoolOrEmptySchema)(t))}Ut.validateFunctionCode=S$;function am({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,(0,I._)`${j.default.data}, ${j.default.valCxt}`,n.$async,()=>{t.code((0,I._)`"use strict"; ${nm(r,o)}`),P$(t,o),t.code(s)}):t.func(e,(0,I._)`${j.default.data}, ${z$(o)}`,n.$async,()=>t.code(nm(r,o)).code(s))}function z$(t){return(0,I._)`{${j.default.instancePath}="", ${j.default.parentData}, ${j.default.parentDataProperty}, ${j.default.rootData}=${j.default.data}${t.dynamicRef?(0,I._)`, ${j.default.dynamicAnchors}={}`:I.nil}}={}`}function P$(t,e){t.if(j.default.valCxt,()=>{t.var(j.default.instancePath,(0,I._)`${j.default.valCxt}.${j.default.instancePath}`),t.var(j.default.parentData,(0,I._)`${j.default.valCxt}.${j.default.parentData}`),t.var(j.default.parentDataProperty,(0,I._)`${j.default.valCxt}.${j.default.parentDataProperty}`),t.var(j.default.rootData,(0,I._)`${j.default.valCxt}.${j.default.rootData}`),e.dynamicRef&&t.var(j.default.dynamicAnchors,(0,I._)`${j.default.valCxt}.${j.default.dynamicAnchors}`)},()=>{t.var(j.default.instancePath,(0,I._)`""`),t.var(j.default.parentData,(0,I._)`undefined`),t.var(j.default.parentDataProperty,(0,I._)`undefined`),t.var(j.default.rootData,j.default.data),e.dynamicRef&&t.var(j.default.dynamicAnchors,(0,I._)`{}`)})}function E$(t){let{schema:e,opts:r,gen:n}=t;am(t,()=>{r.$comment&&e.$comment&&pm(t),O$(t),n.let(j.default.vErrors,null),n.let(j.default.errors,0),r.unevaluated&&T$(t),dm(t),j$(t)})}function T$(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,I._)`${r}.evaluated`),e.if((0,I._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,I._)`${t.evaluated}.props`,(0,I._)`undefined`)),e.if((0,I._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,I._)`${t.evaluated}.items`,(0,I._)`undefined`))}function nm(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,I._)`/*# sourceURL=${r} */`:I.nil}function R$(t,e){if(um(t)&&(lm(t),cm(t))){I$(t,e);return}(0,im.boolOrEmptySchema)(t,e)}function cm({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function um(t){return typeof t.schema!="boolean"}function I$(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&pm(t),C$(t),N$(t);let s=n.const("_errs",j.default.errors);dm(t,s),n.var(e,(0,I._)`${s} === ${j.default.errors}`)}function lm(t){(0,Tt.checkUnknownRules)(t),Z$(t)}function dm(t,e){if(t.opts.jtd)return om(t,[],!1,e);let r=(0,rm.getSchemaTypes)(t.schema),n=(0,rm.coerceAndCheckDataType)(t,r);om(t,r,!n,e)}function Z$(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Tt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function O$(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Tt.checkStrictMode)(t,"default is ignored in the schema root")}function C$(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,k$.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function N$(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function pm({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)t.code((0,I._)`${j.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,I.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,I._)`${j.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function j$(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=t;r.$async?e.if((0,I._)`${j.default.errors} === 0`,()=>e.return(j.default.data),()=>e.throw((0,I._)`new ${o}(${j.default.vErrors})`)):(e.assign((0,I._)`${n}.errors`,j.default.vErrors),s.unevaluated&&A$(t),e.return((0,I._)`${j.default.errors} === 0`))}function A$({gen:t,evaluated:e,props:r,items:n}){r instanceof I.Name&&t.assign((0,I._)`${e}.props`,r),n instanceof I.Name&&t.assign((0,I._)`${e}.items`,n)}function om(t,e,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Tt.schemaHasRulesButRef)(s,l))){o.block(()=>mm(t,"$ref",l.all.$ref.definition));return}c.jtd||M$(t,e),o.block(()=>{for(let h of l.rules)d(h);d(l.post)});function d(h){(0,Qc.shouldUseGroup)(s,h)&&(h.type?(o.if((0,_s.checkDataType)(h.type,i,c.strictNumbers)),sm(t,h),e.length===1&&e[0]===h.type&&r&&(o.else(),(0,_s.reportTypeError)(t)),o.endIf()):sm(t,h),a||o.if((0,I._)`${j.default.errors} === ${n||0}`))}}function sm(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,w$.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Qc.shouldUseRule)(n,s)&&mm(t,s.keyword,s.definition,e.type)})}function M$(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(D$(t,e),t.opts.allowUnionTypes||q$(t,e),L$(t,t.dataTypes))}function D$(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{fm(t.dataTypes,r)||eu(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),V$(t,e)}}function q$(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&eu(t,"use allowUnionTypes to allow union type keyword")}function L$(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Qc.shouldUseRule)(t.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>U$(e,i))&&eu(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function U$(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function fm(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function V$(t,e){let r=[];for(let n of t.dataTypes)fm(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function eu(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Tt.checkStrictMode)(t,e,t.opts.strictTypes)}var ys=class{constructor(e,r,n){if((0,Un.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Tt.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",hm(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Un.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=e.gen.const("_errs",j.default.errors))}result(e,r,n){this.failResult((0,I.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,I.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,I._)`${r} !== undefined && (${(0,I.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Ln.reportExtraError:Ln.reportError)(this,this.def.error,r)}$dataError(){(0,Ln.reportError)(this,this.def.$dataError||Ln.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ln.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=I.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=I.nil,r=I.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,I.or)((0,I._)`${o} === undefined`,r)),e!==I.nil&&n.assign(e,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==I.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,I.or)(i(),a());function i(){if(n.length){if(!(r instanceof I.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,I._)`${(0,_s.checkDataTypes)(c,r,s.opts.strictNumbers,_s.DataType.Wrong)}`}return I.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,I._)`!${c}(${r})`}return I.nil}}subschema(e,r){let n=(0,Xc.getSubschema)(this.it,e);(0,Xc.extendSubschemaData)(n,this.it,e),(0,Xc.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return R$(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Tt.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Tt.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,I.Name)),!0}};Ut.KeywordCxt=ys;function mm(t,e,r,n){let o=new ys(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Un.funcKeywordCode)(o,r):"macro"in r?(0,Un.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Un.funcKeywordCode)(o,r)}var F$=/^\/(?:[^~]|~0|~1)*$/,B$=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function hm(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,s;if(t==="")return j.default.rootData;if(t[0]==="/"){if(!F$.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,s=j.default.rootData}else{let u=B$.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,I._)`${s}${(0,I.getProperty)((0,Tt.unescapeJsonPointer)(u))}`,i=(0,I._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Ut.getData=hm});var vs=S(ru=>{"use strict";Object.defineProperty(ru,"__esModule",{value:!0});var tu=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};ru.default=tu});var Fn=S(su=>{"use strict";Object.defineProperty(su,"__esModule",{value:!0});var nu=qn(),ou=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,nu.resolveUrl)(e,r,n),this.missingSchema=(0,nu.normalizeId)((0,nu.getFullPath)(e,this.missingRef))}};su.default=ou});var xs=S(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.resolveSchema=We.getCompilingSchema=We.resolveRef=We.compileSchema=We.SchemaEnv=void 0;var st=q(),H$=vs(),$r=Et(),it=qn(),gm=Y(),K$=Vn(),Qr=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,it.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};We.SchemaEnv=Qr;function au(t){let e=_m.call(this,t);if(e)return e;let r=(0,it.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new st.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:H$.default,code:(0,st._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:$r.default.data,parentData:$r.default.parentData,parentDataProperty:$r.default.parentDataProperty,dataNames:[$r.default.data],dataPathArr:[st.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,st.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:st.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,st._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,K$.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs($r.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let m=new Function(`${$r.default.self}`,`${$r.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:p,items:f}=u;m.evaluated={props:p instanceof st.Name?void 0:p,items:f instanceof st.Name?void 0:f,dynamicProps:p instanceof st.Name,dynamicItems:f instanceof st.Name},m.source&&(m.source.evaluated=(0,st.stringify)(m.evaluated))}return t.validate=m,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}We.compileSchema=au;function W$(t,e,r){var n;r=(0,it.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let s=Y$.call(this,t,r);if(s===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new Qr({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=J$.call(this,s)}We.resolveRef=W$;function J$(t){return(0,it.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:au.call(this,t)}function _m(t){for(let e of this._compilations)if(G$(e,t))return e}We.getCompilingSchema=_m;function G$(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Y$(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||bs.call(this,t,e)}function bs(t,e){let r=this.opts.uriResolver.parse(e),n=(0,it._getFullPath)(this.opts.uriResolver,r),o=(0,it.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return iu.call(this,r,t);let s=(0,it.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=bs.call(this,t,i);return typeof a?.schema!="object"?void 0:iu.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||au.call(this,i),s===(0,it.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,it.resolveUrl)(this.opts.uriResolver,o,u)),new Qr({schema:a,schemaId:c,root:t,baseId:o})}return iu.call(this,r,i)}}We.resolveSchema=bs;var X$=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function iu(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,gm.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!X$.has(a)&&u&&(e=(0,it.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,gm.schemaHasRulesButRef)(r,this.RULES)){let a=(0,it.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=bs.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Qr({schema:r,schemaId:i,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var ym=S((x1,Q$)=>{Q$.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var uu=S(($1,$m)=>{"use strict";var ew=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),bm=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function cu(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var tw=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function vm(t){return t.length=0,!0}function rw(t,e,r){if(t.length){let n=cu(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function nw(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=rw;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=vm}else{o.push(u);continue}}return o.length&&(a===vm?r.zone=o.join(""):i?n.push(o.join("")):n.push(cu(o))),r.address=n.join(""),r}function xm(t){if(ow(t,":")<2)return{host:t,isIPV6:!1};let e=nw(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function ow(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function sw(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function iw(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function aw(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!bm(r)){let n=xm(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}$m.exports={nonSimpleDomain:tw,recomposeAuthority:aw,normalizeComponentEncoding:iw,removeDotSegments:sw,isIPv4:bm,isUUID:ew,normalizeIPv6:xm,stringArrayToHexStripped:cu}});var Pm=S((w1,zm)=>{"use strict";var{isUUID:cw}=uu(),uw=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,lw=["http","https","ws","wss","urn","urn:uuid"];function dw(t){return lw.indexOf(t)!==-1}function lu(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function wm(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function km(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function pw(t){return t.secure=lu(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function fw(t){if((t.port===(lu(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function mw(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(uw);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,s=du(o);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function hw(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,s=du(o);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function gw(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!cw(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function _w(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Sm={scheme:"http",domainHost:!0,parse:wm,serialize:km},yw={scheme:"https",domainHost:Sm.domainHost,parse:wm,serialize:km},$s={scheme:"ws",domainHost:!0,parse:pw,serialize:fw},vw={scheme:"wss",domainHost:$s.domainHost,parse:$s.parse,serialize:$s.serialize},bw={scheme:"urn",parse:mw,serialize:hw,skipNormalize:!0},xw={scheme:"urn:uuid",parse:gw,serialize:_w,skipNormalize:!0},ws={http:Sm,https:yw,ws:$s,wss:vw,urn:bw,"urn:uuid":xw};Object.setPrototypeOf(ws,null);function du(t){return t&&(ws[t]||ws[t.toLowerCase()])||void 0}zm.exports={wsIsSecure:lu,SCHEMES:ws,isValidSchemeName:dw,getSchemeHandler:du}});var Rm=S((k1,Ss)=>{"use strict";var{normalizeIPv6:$w,removeDotSegments:Bn,recomposeAuthority:ww,normalizeComponentEncoding:ks,isIPv4:kw,nonSimpleDomain:Sw}=uu(),{SCHEMES:zw,getSchemeHandler:Em}=Pm();function Pw(t,e){return typeof t=="string"?t=gt(Rt(t,e),e):typeof t=="object"&&(t=Rt(gt(t,e),e)),t}function Ew(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Tm(Rt(t,n),Rt(e,n),n,!0);return n.skipEscape=!0,gt(o,n)}function Tm(t,e,r,n){let o={};return n||(t=Rt(gt(t,r),r),e=Rt(gt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Bn(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Bn(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Bn(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Bn(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function Tw(t,e,r){return typeof t=="string"?(t=unescape(t),t=gt(ks(Rt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=gt(ks(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=gt(ks(Rt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=gt(ks(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function gt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],s=Em(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let i=ww(r);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=Bn(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var Rw=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Rt(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let s=t.match(Rw);if(s){if(n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]),n.host)if(kw(n.host)===!1){let c=$w(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!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 i=Em(r.scheme||n.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&n.host&&(r.domainHost||i&&i.domainHost)&&o===!1&&Sw(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a}(!i||i&&!i.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),i&&i.parse&&i.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var pu={SCHEMES:zw,normalize:Pw,resolve:Ew,resolveComponent:Tm,equal:Tw,serialize:gt,parse:Rt};Ss.exports=pu;Ss.exports.default=pu;Ss.exports.fastUri=pu});var Zm=S(fu=>{"use strict";Object.defineProperty(fu,"__esModule",{value:!0});var Im=Rm();Im.code='require("ajv/dist/runtime/uri").default';fu.default=Im});var qm=S($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.CodeGen=$e.Name=$e.nil=$e.stringify=$e.str=$e._=$e.KeywordCxt=void 0;var Iw=Vn();Object.defineProperty($e,"KeywordCxt",{enumerable:!0,get:function(){return Iw.KeywordCxt}});var en=q();Object.defineProperty($e,"_",{enumerable:!0,get:function(){return en._}});Object.defineProperty($e,"str",{enumerable:!0,get:function(){return en.str}});Object.defineProperty($e,"stringify",{enumerable:!0,get:function(){return en.stringify}});Object.defineProperty($e,"nil",{enumerable:!0,get:function(){return en.nil}});Object.defineProperty($e,"Name",{enumerable:!0,get:function(){return en.Name}});Object.defineProperty($e,"CodeGen",{enumerable:!0,get:function(){return en.CodeGen}});var Zw=vs(),Am=Fn(),Ow=Uc(),Hn=xs(),Cw=q(),Kn=qn(),zs=Dn(),hu=Y(),Om=ym(),Nw=Zm(),Mm=(t,e)=>new RegExp(t,e);Mm.code="new RegExp";var jw=["removeAdditional","useDefaults","coerceTypes"],Aw=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Mw={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."},Dw={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Cm=200;function qw(t){var e,r,n,o,s,i,a,c,u,l,d,h,m,p,f,g,v,$,w,P,R,le,De,Er,Xs;let ln=t.strict,Qs=(e=t.code)===null||e===void 0?void 0:e.optimize,_l=Qs===!0||Qs===void 0?1:Qs||0,yl=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Mm,Ag=(o=t.uriResolver)!==null&&o!==void 0?o:Nw.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:ln)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:ln)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:ln)!==null&&l!==void 0?l:"log",strictTuples:(h=(d=t.strictTuples)!==null&&d!==void 0?d:ln)!==null&&h!==void 0?h:"log",strictRequired:(p=(m=t.strictRequired)!==null&&m!==void 0?m:ln)!==null&&p!==void 0?p:!1,code:t.code?{...t.code,optimize:_l,regExp:yl}:{optimize:_l,regExp:yl},loopRequired:(f=t.loopRequired)!==null&&f!==void 0?f:Cm,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:Cm,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:($=t.messages)!==null&&$!==void 0?$:!0,inlineRefs:(w=t.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(P=t.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(R=t.addUsedSchema)!==null&&R!==void 0?R:!0,validateSchema:(le=t.validateSchema)!==null&&le!==void 0?le:!0,validateFormats:(De=t.validateFormats)!==null&&De!==void 0?De:!0,unicodeRegExp:(Er=t.unicodeRegExp)!==null&&Er!==void 0?Er:!0,int32range:(Xs=t.int32range)!==null&&Xs!==void 0?Xs:!0,uriResolver:Ag}}var Wn=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...qw(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new Cw.ValueScope({scope:{},prefixes:Aw,es5:r,lines:n}),this.logger=Hw(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Ow.getRules)(),Nm.call(this,Mw,e,"NOT SUPPORTED"),Nm.call(this,Dw,e,"DEPRECATED","warn"),this._metaOpts=Fw.call(this),e.formats&&Uw.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Vw.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Lw.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=Om;n==="id"&&(o={...Om},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,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,e,r);async function o(l,d){await s.call(this,l.$schema);let h=this._addSchema(l,d);return h.validate||i.call(this,h)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Am.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,o);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Kn.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$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,e);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(e){let r;for(;typeof(r=jm.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Hn.SchemaEnv({schema:{},schemaId:n});if(r=Hn.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=jm.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Kn.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,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(Ww.call(this,n,r),!r)return(0,hu.eachItem)(n,s=>mu.call(this,s)),this;Gw.call(this,r);let o={...r,type:(0,zs.getJSONTypes)(r.type),schemaType:(0,zs.getJSONTypes)(r.schemaType)};return(0,hu.eachItem)(n,o.type.length===0?s=>mu.call(this,s,o):s=>o.type.forEach(i=>mu.call(this,s,o,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let s=o.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Dm(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Kn.normalizeId)(i||n);let u=Kn.getSchemaRefs.call(this,e,n);return c=new Hn.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Hn.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Hn.compileSchema.call(this,e)}finally{this.opts=r}}};Wn.ValidationError=Zw.default;Wn.MissingRefError=Am.default;$e.default=Wn;function Nm(t,e,r,n="error"){for(let o in t){let s=o;s in e&&this.logger[n](`${r}: option ${o}. ${t[s]}`)}}function jm(t){return t=(0,Kn.normalizeId)(t),this.schemas[t]||this.refs[t]}function Lw(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Uw(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Vw(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Fw(){let t={...this.opts};for(let e of jw)delete t[e];return t}var Bw={log(){},warn(){},error(){}};function Hw(t){if(t===!1)return Bw;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Kw=/^[a-z_$][a-z0-9_$:-]*$/i;function Ww(t,e){let{RULES:r}=this;if((0,hu.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Kw.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function mu(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,zs.getJSONTypes)(e.type),schemaType:(0,zs.getJSONTypes)(e.schemaType)}};e.before?Jw.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Jw(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Gw(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Dm(e)),t.validateSchema=this.compile(e,!0))}var Yw={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Dm(t){return{anyOf:[t,Yw]}}});var Lm=S(gu=>{"use strict";Object.defineProperty(gu,"__esModule",{value:!0});var Xw={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};gu.default=Xw});var Bm=S(wr=>{"use strict";Object.defineProperty(wr,"__esModule",{value:!0});wr.callRef=wr.getValidate=void 0;var Qw=Fn(),Um=Ke(),Ae=q(),tn=Et(),Vm=xs(),Ps=Y(),ek={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Vm.resolveRef.call(c,u,o,r);if(l===void 0)throw new Qw.default(n.opts.uriResolver,o,r);if(l instanceof Vm.SchemaEnv)return h(l);return m(l);function d(){if(s===u)return Es(t,i,s,s.$async);let p=e.scopeValue("root",{ref:u});return Es(t,(0,Ae._)`${p}.validate`,u,u.$async)}function h(p){let f=Fm(t,p);Es(t,f,p,p.$async)}function m(p){let f=e.scopeValue("schema",a.code.source===!0?{ref:p,code:(0,Ae.stringify)(p)}:{ref:p}),g=e.name("valid"),v=t.subschema({schema:p,dataTypes:[],schemaPath:Ae.nil,topSchemaRef:f,errSchemaPath:r},g);t.mergeEvaluated(v),t.ok(g)}}};function Fm(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ae._)`${r.scopeValue("wrapper",{ref:e})}.validate`}wr.getValidate=Fm;function Es(t,e,r,n){let{gen:o,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?tn.default.this:Ae.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let p=o.let("valid");o.try(()=>{o.code((0,Ae._)`await ${(0,Um.callValidateCode)(t,e,u)}`),m(e),i||o.assign(p,!0)},f=>{o.if((0,Ae._)`!(${f} instanceof ${s.ValidationError})`,()=>o.throw(f)),h(f),i||o.assign(p,!1)}),t.ok(p)}function d(){t.result((0,Um.callValidateCode)(t,e,u),()=>m(e),()=>h(e))}function h(p){let f=(0,Ae._)`${p}.errors`;o.assign(tn.default.vErrors,(0,Ae._)`${tn.default.vErrors} === null ? ${f} : ${tn.default.vErrors}.concat(${f})`),o.assign(tn.default.errors,(0,Ae._)`${tn.default.vErrors}.length`)}function m(p){var f;if(!s.opts.unevaluated)return;let g=(f=r?.validate)===null||f===void 0?void 0:f.evaluated;if(s.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(s.props=Ps.mergeEvaluated.props(o,g.props,s.props));else{let v=o.var("props",(0,Ae._)`${p}.evaluated.props`);s.props=Ps.mergeEvaluated.props(o,v,s.props,Ae.Name)}if(s.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(s.items=Ps.mergeEvaluated.items(o,g.items,s.items));else{let v=o.var("items",(0,Ae._)`${p}.evaluated.items`);s.items=Ps.mergeEvaluated.items(o,v,s.items,Ae.Name)}}}wr.callRef=Es;wr.default=ek});var Hm=S(_u=>{"use strict";Object.defineProperty(_u,"__esModule",{value:!0});var tk=Lm(),rk=Bm(),nk=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",tk.default,rk.default];_u.default=nk});var Km=S(yu=>{"use strict";Object.defineProperty(yu,"__esModule",{value:!0});var Ts=q(),Vt=Ts.operators,Rs={maximum:{okStr:"<=",ok:Vt.LTE,fail:Vt.GT},minimum:{okStr:">=",ok:Vt.GTE,fail:Vt.LT},exclusiveMaximum:{okStr:"<",ok:Vt.LT,fail:Vt.GTE},exclusiveMinimum:{okStr:">",ok:Vt.GT,fail:Vt.LTE}},ok={message:({keyword:t,schemaCode:e})=>(0,Ts.str)`must be ${Rs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ts._)`{comparison: ${Rs[t].okStr}, limit: ${e}}`},sk={keyword:Object.keys(Rs),type:"number",schemaType:"number",$data:!0,error:ok,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Ts._)`${r} ${Rs[e].fail} ${n} || isNaN(${r})`)}};yu.default=sk});var Wm=S(vu=>{"use strict";Object.defineProperty(vu,"__esModule",{value:!0});var Jn=q(),ik={message:({schemaCode:t})=>(0,Jn.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Jn._)`{multipleOf: ${t}}`},ak={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:ik,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,Jn._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Jn._)`${i} !== parseInt(${i})`;t.fail$data((0,Jn._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};vu.default=ak});var Gm=S(bu=>{"use strict";Object.defineProperty(bu,"__esModule",{value:!0});function Jm(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}bu.default=Jm;Jm.code='require("ajv/dist/runtime/ucs2length").default'});var Ym=S(xu=>{"use strict";Object.defineProperty(xu,"__esModule",{value:!0});var kr=q(),ck=Y(),uk=Gm(),lk={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,kr.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,kr._)`{limit: ${t}}`},dk={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:lk,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,s=e==="maxLength"?kr.operators.GT:kr.operators.LT,i=o.opts.unicode===!1?(0,kr._)`${r}.length`:(0,kr._)`${(0,ck.useFunc)(t.gen,uk.default)}(${r})`;t.fail$data((0,kr._)`${i} ${s} ${n}`)}};xu.default=dk});var Xm=S($u=>{"use strict";Object.defineProperty($u,"__esModule",{value:!0});var pk=Ke(),Is=q(),fk={message:({schemaCode:t})=>(0,Is.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Is._)`{pattern: ${t}}`},mk={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:fk,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:s}=t,i=s.opts.unicodeRegExp?"u":"",a=r?(0,Is._)`(new RegExp(${o}, ${i}))`:(0,pk.usePattern)(t,n);t.fail$data((0,Is._)`!${a}.test(${e})`)}};$u.default=mk});var Qm=S(wu=>{"use strict";Object.defineProperty(wu,"__esModule",{value:!0});var Gn=q(),hk={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Gn.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Gn._)`{limit: ${t}}`},gk={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:hk,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Gn.operators.GT:Gn.operators.LT;t.fail$data((0,Gn._)`Object.keys(${r}).length ${o} ${n}`)}};wu.default=gk});var eh=S(ku=>{"use strict";Object.defineProperty(ku,"__esModule",{value:!0});var Yn=Ke(),Xn=q(),_k=Y(),yk={message:({params:{missingProperty:t}})=>(0,Xn.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Xn._)`{missingProperty: ${t}}`},vk={keyword:"required",type:"object",schemaType:"array",$data:!0,error:yk,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:p}=t.it;for(let f of r)if(m?.[f]===void 0&&!p.has(f)){let g=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${f}" is not defined at "${g}" (strictRequired)`;(0,_k.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(Xn.nil,d);else for(let m of r)(0,Yn.checkReportMissingProp)(t,m)}function l(){let m=e.let("missing");if(c||s){let p=e.let("valid",!0);t.block$data(p,()=>h(m,p)),t.ok(p)}else e.if((0,Yn.checkMissingProp)(t,r,m)),(0,Yn.reportMissingProp)(t,m),e.else()}function d(){e.forOf("prop",n,m=>{t.setParams({missingProperty:m}),e.if((0,Yn.noPropertyInData)(e,o,m,a.ownProperties),()=>t.error())})}function h(m,p){t.setParams({missingProperty:m}),e.forOf(m,n,()=>{e.assign(p,(0,Yn.propertyInData)(e,o,m,a.ownProperties)),e.if((0,Xn.not)(p),()=>{t.error(),e.break()})},Xn.nil)}}};ku.default=vk});var th=S(Su=>{"use strict";Object.defineProperty(Su,"__esModule",{value:!0});var Qn=q(),bk={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Qn.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Qn._)`{limit: ${t}}`},xk={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:bk,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Qn.operators.GT:Qn.operators.LT;t.fail$data((0,Qn._)`${r}.length ${o} ${n}`)}};Su.default=xk});var Zs=S(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});var rh=Gc();rh.code='require("ajv/dist/runtime/equal").default';zu.default=rh});var nh=S(Eu=>{"use strict";Object.defineProperty(Eu,"__esModule",{value:!0});var Pu=Dn(),we=q(),$k=Y(),wk=Zs(),kk={message:({params:{i:t,j:e}})=>(0,we.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,we._)`{i: ${t}, j: ${e}}`},Sk={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:kk,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=s.items?(0,Pu.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,we._)`${i} === false`),t.ok(c);function l(){let p=e.let("i",(0,we._)`${r}.length`),f=e.let("j");t.setParams({i:p,j:f}),e.assign(c,!0),e.if((0,we._)`${p} > 1`,()=>(d()?h:m)(p,f))}function d(){return u.length>0&&!u.some(p=>p==="object"||p==="array")}function h(p,f){let g=e.name("item"),v=(0,Pu.checkDataTypes)(u,g,a.opts.strictNumbers,Pu.DataType.Wrong),$=e.const("indices",(0,we._)`{}`);e.for((0,we._)`;${p}--;`,()=>{e.let(g,(0,we._)`${r}[${p}]`),e.if(v,(0,we._)`continue`),u.length>1&&e.if((0,we._)`typeof ${g} == "string"`,(0,we._)`${g} += "_"`),e.if((0,we._)`typeof ${$}[${g}] == "number"`,()=>{e.assign(f,(0,we._)`${$}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,we._)`${$}[${g}] = ${p}`)})}function m(p,f){let g=(0,$k.useFunc)(e,wk.default),v=e.name("outer");e.label(v).for((0,we._)`;${p}--;`,()=>e.for((0,we._)`${f} = ${p}; ${f}--;`,()=>e.if((0,we._)`${g}(${r}[${p}], ${r}[${f}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Eu.default=Sk});var oh=S(Ru=>{"use strict";Object.defineProperty(Ru,"__esModule",{value:!0});var Tu=q(),zk=Y(),Pk=Zs(),Ek={message:"must be equal to constant",params:({schemaCode:t})=>(0,Tu._)`{allowedValue: ${t}}`},Tk={keyword:"const",$data:!0,error:Ek,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,Tu._)`!${(0,zk.useFunc)(e,Pk.default)}(${r}, ${o})`):t.fail((0,Tu._)`${s} !== ${r}`)}};Ru.default=Tk});var sh=S(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});var eo=q(),Rk=Y(),Ik=Zs(),Zk={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,eo._)`{allowedValues: ${t}}`},Ok={keyword:"enum",schemaType:"array",$data:!0,error:Zk,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,Rk.useFunc)(e,Ik.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let m=e.const("vSchema",s);l=(0,eo.or)(...o.map((p,f)=>h(m,f)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,m=>e.if((0,eo._)`${u()}(${r}, ${m})`,()=>e.assign(l,!0).break()))}function h(m,p){let f=o[p];return typeof f=="object"&&f!==null?(0,eo._)`${u()}(${r}, ${m}[${p}])`:(0,eo._)`${r} === ${f}`}}};Iu.default=Ok});var ih=S(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});var Ck=Km(),Nk=Wm(),jk=Ym(),Ak=Xm(),Mk=Qm(),Dk=eh(),qk=th(),Lk=nh(),Uk=oh(),Vk=sh(),Fk=[Ck.default,Nk.default,jk.default,Ak.default,Mk.default,Dk.default,qk.default,Lk.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Uk.default,Vk.default];Zu.default=Fk});var Cu=S(to=>{"use strict";Object.defineProperty(to,"__esModule",{value:!0});to.validateAdditionalItems=void 0;var Sr=q(),Ou=Y(),Bk={message:({params:{len:t}})=>(0,Sr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Sr._)`{limit: ${t}}`},Hk={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Bk,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Ou.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}ah(t,n)}};function ah(t,e){let{gen:r,schema:n,data:o,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Sr._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Sr._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Ou.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Sr._)`${a} <= ${e.length}`);r.if((0,Sr.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:Ou.Type.Num},u),i.allErrors||r.if((0,Sr.not)(u),()=>r.break())})}}to.validateAdditionalItems=ah;to.default=Hk});var Nu=S(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.validateTuple=void 0;var ch=q(),Os=Y(),Kk=Ke(),Wk={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return uh(t,"additionalItems",e);r.items=!0,!(0,Os.alwaysValidSchema)(r,e)&&t.ok((0,Kk.validateArray)(t))}};function uh(t,e,r=t.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Os.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,ch._)`${s}.length`);r.forEach((d,h)=>{(0,Os.alwaysValidSchema)(a,d)||(n.if((0,ch._)`${u} > ${h}`,()=>t.subschema({keyword:i,schemaProp:h,dataProp:h},c)),t.ok(c))});function l(d){let{opts:h,errSchemaPath:m}=a,p=r.length,f=p===d.minItems&&(p===d.maxItems||d[e]===!1);if(h.strictTuples&&!f){let g=`"${i}" is ${p}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,Os.checkStrictMode)(a,g,h.strictTuples)}}}ro.validateTuple=uh;ro.default=Wk});var lh=S(ju=>{"use strict";Object.defineProperty(ju,"__esModule",{value:!0});var Jk=Nu(),Gk={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Jk.validateTuple)(t,"items")};ju.default=Gk});var ph=S(Au=>{"use strict";Object.defineProperty(Au,"__esModule",{value:!0});var dh=q(),Yk=Y(),Xk=Ke(),Qk=Cu(),eS={message:({params:{len:t}})=>(0,dh.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,dh._)`{limit: ${t}}`},tS={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:eS,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,Yk.alwaysValidSchema)(n,e)&&(o?(0,Qk.validateAdditionalItems)(t,o):t.ok((0,Xk.validateArray)(t)))}};Au.default=tS});var fh=S(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});var Je=q(),Cs=Y(),rS={message:({params:{min:t,max:e}})=>e===void 0?(0,Je.str)`must contain at least ${t} valid item(s)`:(0,Je.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Je._)`{minContains: ${t}}`:(0,Je._)`{minContains: ${t}, maxContains: ${e}}`},nS={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:rS,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,Je._)`${o}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Cs.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Cs.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Cs.alwaysValidSchema)(s,r)){let f=(0,Je._)`${l} >= ${i}`;a!==void 0&&(f=(0,Je._)`${f} && ${l} <= ${a}`),t.pass(f);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?m(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,Je._)`${o}.length > 0`,h)):(e.let(d,!1),h()),t.result(d,()=>t.reset());function h(){let f=e.name("_valid"),g=e.let("count",0);m(f,()=>e.if(f,()=>p(g)))}function m(f,g){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:Cs.Type.Num,compositeRule:!0},f),g()})}function p(f){e.code((0,Je._)`${f}++`),a===void 0?e.if((0,Je._)`${f} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,Je._)`${f} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,Je._)`${f} >= ${i}`,()=>e.assign(d,!0)))}}};Mu.default=nS});var gh=S(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.validateSchemaDeps=_t.validatePropertyDeps=_t.error=void 0;var Du=q(),oS=Y(),no=Ke();_t.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Du.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Du._)`{property: ${t},
7
+ missingProperty: ${n},
8
+ depsCount: ${e},
9
+ deps: ${r}}`};var sS={keyword:"dependencies",type:"object",schemaType:"object",error:_t.error,code(t){let[e,r]=iS(t);mh(t,e),hh(t,r)}};function iS({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function mh(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,no.propertyInData)(r,n,i,o.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,no.checkReportMissingProp)(t,u)}):(r.if((0,Du._)`${c} && (${(0,no.checkMissingProp)(t,a,s)})`),(0,no.reportMissingProp)(t,s),r.else())}}_t.validatePropertyDeps=mh;function hh(t,e=t.schema){let{gen:r,data:n,keyword:o,it:s}=t,i=r.name("valid");for(let a in e)(0,oS.alwaysValidSchema)(s,e[a])||(r.if((0,no.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}_t.validateSchemaDeps=hh;_t.default=sS});var yh=S(qu=>{"use strict";Object.defineProperty(qu,"__esModule",{value:!0});var _h=q(),aS=Y(),cS={message:"property name must be valid",params:({params:t})=>(0,_h._)`{propertyName: ${t.propertyName}}`},uS={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:cS,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,aS.alwaysValidSchema)(o,r))return;let s=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,_h.not)(s),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(s)}};qu.default=uS});var Uu=S(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});var Ns=Ke(),at=q(),lS=Et(),js=Y(),dS={message:"must NOT have additional properties",params:({params:t})=>(0,at._)`{additionalProperty: ${t.additionalProperty}}`},pS={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:dS,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,js.alwaysValidSchema)(i,r))return;let u=(0,Ns.allSchemaProperties)(n.properties),l=(0,Ns.allSchemaProperties)(n.patternProperties);d(),t.ok((0,at._)`${s} === ${lS.default.errors}`);function d(){e.forIn("key",o,g=>{!u.length&&!l.length?p(g):e.if(h(g),()=>p(g))})}function h(g){let v;if(u.length>8){let $=(0,js.schemaRefOrVal)(i,n.properties,"properties");v=(0,Ns.isOwnProperty)(e,$,g)}else u.length?v=(0,at.or)(...u.map($=>(0,at._)`${g} === ${$}`)):v=at.nil;return l.length&&(v=(0,at.or)(v,...l.map($=>(0,at._)`${(0,Ns.usePattern)(t,$)}.test(${g})`))),(0,at.not)(v)}function m(g){e.code((0,at._)`delete ${o}[${g}]`)}function p(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(g);return}if(r===!1){t.setParams({additionalProperty:g}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,js.alwaysValidSchema)(i,r)){let v=e.name("valid");c.removeAdditional==="failing"?(f(g,v,!1),e.if((0,at.not)(v),()=>{t.reset(),m(g)})):(f(g,v),a||e.if((0,at.not)(v),()=>e.break()))}}function f(g,v,$){let w={keyword:"additionalProperties",dataProp:g,dataPropType:js.Type.Str};$===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(w,v)}}};Lu.default=pS});var xh=S(Fu=>{"use strict";Object.defineProperty(Fu,"__esModule",{value:!0});var fS=Vn(),vh=Ke(),Vu=Y(),bh=Uu(),mS={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&bh.default.code(new fS.KeywordCxt(s,bh.default,"additionalProperties"));let i=(0,vh.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Vu.mergeEvaluated.props(e,(0,Vu.toHash)(i),s.props));let a=i.filter(d=>!(0,Vu.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,vh.propertyInData)(e,o,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Fu.default=mS});var Sh=S(Bu=>{"use strict";Object.defineProperty(Bu,"__esModule",{value:!0});var $h=Ke(),As=q(),wh=Y(),kh=Y(),hS={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:s}=t,{opts:i}=s,a=(0,$h.allSchemaProperties)(r),c=a.filter(f=>(0,wh.alwaysValidSchema)(s,r[f]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof As.Name)&&(s.props=(0,kh.evaluatedPropsToName)(e,s.props));let{props:d}=s;h();function h(){for(let f of a)u&&m(f),s.allErrors?p(f):(e.var(l,!0),p(f),e.if(l))}function m(f){for(let g in u)new RegExp(f).test(g)&&(0,wh.checkStrictMode)(s,`property ${g} matches pattern ${f} (use allowMatchingProperties)`)}function p(f){e.forIn("key",n,g=>{e.if((0,As._)`${(0,$h.usePattern)(t,f)}.test(${g})`,()=>{let v=c.includes(f);v||t.subschema({keyword:"patternProperties",schemaProp:f,dataProp:g,dataPropType:kh.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,As._)`${d}[${g}]`,!0):!v&&!s.allErrors&&e.if((0,As.not)(l),()=>e.break())})})}}};Bu.default=hS});var zh=S(Hu=>{"use strict";Object.defineProperty(Hu,"__esModule",{value:!0});var gS=Y(),_S={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,gS.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Hu.default=_S});var Ph=S(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});var yS=Ke(),vS={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yS.validateUnion,error:{message:"must match a schema in anyOf"}};Ku.default=vS});var Eh=S(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});var Ms=q(),bS=Y(),xS={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Ms._)`{passingSchemas: ${t.passing}}`},$S={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:xS,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let h;(0,bS.alwaysValidSchema)(o,l)?e.var(c,!0):h=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Ms._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Ms._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),h&&t.mergeEvaluated(h,Ms.Name)})})}}};Wu.default=$S});var Th=S(Ju=>{"use strict";Object.defineProperty(Ju,"__esModule",{value:!0});var wS=Y(),kS={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((s,i)=>{if((0,wS.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(a)})}};Ju.default=kS});var Zh=S(Gu=>{"use strict";Object.defineProperty(Gu,"__esModule",{value:!0});var Ds=q(),Ih=Y(),SS={message:({params:t})=>(0,Ds.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ds._)`{failingKeyword: ${t.ifClause}}`},zS={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:SS,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Ih.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Rh(n,"then"),s=Rh(n,"else");if(!o&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,Ds.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let h=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(h,i),d?e.assign(d,(0,Ds._)`${l}`):t.setParams({ifClause:l})}}}};function Rh(t,e){let r=t.schema[e];return r!==void 0&&!(0,Ih.alwaysValidSchema)(t,r)}Gu.default=zS});var Oh=S(Yu=>{"use strict";Object.defineProperty(Yu,"__esModule",{value:!0});var PS=Y(),ES={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,PS.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Yu.default=ES});var Ch=S(Xu=>{"use strict";Object.defineProperty(Xu,"__esModule",{value:!0});var TS=Cu(),RS=lh(),IS=Nu(),ZS=ph(),OS=fh(),CS=gh(),NS=yh(),jS=Uu(),AS=xh(),MS=Sh(),DS=zh(),qS=Ph(),LS=Eh(),US=Th(),VS=Zh(),FS=Oh();function BS(t=!1){let e=[DS.default,qS.default,LS.default,US.default,VS.default,FS.default,NS.default,jS.default,CS.default,AS.default,MS.default];return t?e.push(RS.default,ZS.default):e.push(TS.default,IS.default),e.push(OS.default),e}Xu.default=BS});var Nh=S(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});var ge=q(),HS={message:({schemaCode:t})=>(0,ge.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ge._)`{format: ${t}}`},KS={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:HS,code(t,e){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?h():m();function h(){let p=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),f=r.const("fDef",(0,ge._)`${p}[${i}]`),g=r.let("fType"),v=r.let("format");r.if((0,ge._)`typeof ${f} == "object" && !(${f} instanceof RegExp)`,()=>r.assign(g,(0,ge._)`${f}.type || "string"`).assign(v,(0,ge._)`${f}.validate`),()=>r.assign(g,(0,ge._)`"string"`).assign(v,f)),t.fail$data((0,ge.or)($(),w()));function $(){return c.strictSchema===!1?ge.nil:(0,ge._)`${i} && !${v}`}function w(){let P=l.$async?(0,ge._)`(${f}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,ge._)`${v}(${n})`,R=(0,ge._)`(typeof ${v} == "function" ? ${P} : ${v}.test(${n}))`;return(0,ge._)`${v} && ${v} !== true && ${g} === ${e} && !${R}`}}function m(){let p=d.formats[s];if(!p){$();return}if(p===!0)return;let[f,g,v]=w(p);f===e&&t.pass(P());function $(){if(c.strictSchema===!1){d.logger.warn(R());return}throw new Error(R());function R(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function w(R){let le=R instanceof RegExp?(0,ge.regexpCode)(R):c.code.formats?(0,ge._)`${c.code.formats}${(0,ge.getProperty)(s)}`:void 0,De=r.scopeValue("formats",{key:s,ref:R,code:le});return typeof R=="object"&&!(R instanceof RegExp)?[R.type||"string",R.validate,(0,ge._)`${De}.validate`]:["string",R,De]}function P(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ge._)`await ${v}(${n})`}return typeof g=="function"?(0,ge._)`${v}(${n})`:(0,ge._)`${v}.test(${n})`}}}};Qu.default=KS});var jh=S(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});var WS=Nh(),JS=[WS.default];el.default=JS});var Ah=S(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.contentVocabulary=rn.metadataVocabulary=void 0;rn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];rn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Dh=S(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});var GS=Hm(),YS=ih(),XS=Ch(),QS=jh(),Mh=Ah(),ez=[GS.default,YS.default,(0,XS.default)(),QS.default,Mh.metadataVocabulary,Mh.contentVocabulary];tl.default=ez});var Lh=S(qs=>{"use strict";Object.defineProperty(qs,"__esModule",{value:!0});qs.DiscrError=void 0;var qh;(function(t){t.Tag="tag",t.Mapping="mapping"})(qh||(qs.DiscrError=qh={}))});var Vh=S(nl=>{"use strict";Object.defineProperty(nl,"__esModule",{value:!0});var nn=q(),rl=Lh(),Uh=xs(),tz=Fn(),rz=Y(),nz={message:({params:{discrError:t,tagName:e}})=>t===rl.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,nn._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},oz={keyword:"discriminator",type:"object",schemaType:"object",error:nz,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:s}=t,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,nn._)`${r}${(0,nn.getProperty)(a)}`);e.if((0,nn._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:rl.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let m=h();e.if(!1);for(let p in m)e.elseIf((0,nn._)`${u} === ${p}`),e.assign(c,d(m[p]));e.else(),t.error(!1,{discrError:rl.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(m){let p=e.name("valid"),f=t.subschema({keyword:"oneOf",schemaProp:m},p);return t.mergeEvaluated(f,nn.Name),p}function h(){var m;let p={},f=v(o),g=!0;for(let P=0;P<i.length;P++){let R=i[P];if(R?.$ref&&!(0,rz.schemaHasRulesButRef)(R,s.self.RULES)){let De=R.$ref;if(R=Uh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,De),R instanceof Uh.SchemaEnv&&(R=R.schema),R===void 0)throw new tz.default(s.opts.uriResolver,s.baseId,De)}let le=(m=R?.properties)===null||m===void 0?void 0:m[a];if(typeof le!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(f||v(R)),$(le,P)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return p;function v({required:P}){return Array.isArray(P)&&P.includes(a)}function $(P,R){if(P.const)w(P.const,R);else if(P.enum)for(let le of P.enum)w(le,R);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(P,R){if(typeof P!="string"||P in p)throw new Error(`discriminator: "${a}" values must be unique strings`);p[P]=R}}}};nl.default=oz});var Fh=S((pZ,sz)=>{sz.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 sl=S((ie,ol)=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.MissingRefError=ie.ValidationError=ie.CodeGen=ie.Name=ie.nil=ie.stringify=ie.str=ie._=ie.KeywordCxt=ie.Ajv=void 0;var iz=qm(),az=Dh(),cz=Vh(),Bh=Fh(),uz=["/properties"],Ls="http://json-schema.org/draft-07/schema",on=class extends iz.default{_addVocabularies(){super._addVocabularies(),az.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(cz.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Bh,uz):Bh;this.addMetaSchema(e,Ls,!1),this.refs["http://json-schema.org/schema"]=Ls}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ls)?Ls:void 0)}};ie.Ajv=on;ol.exports=ie=on;ol.exports.Ajv=on;Object.defineProperty(ie,"__esModule",{value:!0});ie.default=on;var lz=Vn();Object.defineProperty(ie,"KeywordCxt",{enumerable:!0,get:function(){return lz.KeywordCxt}});var sn=q();Object.defineProperty(ie,"_",{enumerable:!0,get:function(){return sn._}});Object.defineProperty(ie,"str",{enumerable:!0,get:function(){return sn.str}});Object.defineProperty(ie,"stringify",{enumerable:!0,get:function(){return sn.stringify}});Object.defineProperty(ie,"nil",{enumerable:!0,get:function(){return sn.nil}});Object.defineProperty(ie,"Name",{enumerable:!0,get:function(){return sn.Name}});Object.defineProperty(ie,"CodeGen",{enumerable:!0,get:function(){return sn.CodeGen}});var dz=vs();Object.defineProperty(ie,"ValidationError",{enumerable:!0,get:function(){return dz.default}});var pz=Fn();Object.defineProperty(ie,"MissingRefError",{enumerable:!0,get:function(){return pz.default}})});var Qh=S(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.formatNames=vt.fastFormats=vt.fullFormats=void 0;function yt(t,e){return{validate:t,compare:e}}vt.fullFormats={date:yt(Jh,ul),time:yt(al(!0),ll),"date-time":yt(Hh(!0),Yh),"iso-time":yt(al(),Gh),"iso-date-time":yt(Hh(),Xh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:yz,"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:Sz,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:vz,int32:{type:"number",validate:$z},int64:{type:"number",validate:wz},float:{type:"number",validate:Wh},double:{type:"number",validate:Wh},password:!0,binary:!0};vt.fastFormats={...vt.fullFormats,date:yt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,ul),time:yt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ll),"date-time":yt(/^\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,Yh),"iso-time":yt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Gh),"iso-date-time":yt(/^\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,Xh),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};vt.formatNames=Object.keys(vt.fullFormats);function fz(t){return t%4===0&&(t%100!==0||t%400===0)}var mz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,hz=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Jh(t){let e=mz.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&fz(r)?29:hz[n])}function ul(t,e){if(t&&e)return t>e?1:t<e?-1:0}var il=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function al(t){return function(r){let n=il.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,h=o-u*c-(d<0?1:0);return(h===23||h===-1)&&(d===59||d===-1)&&i<61}}function ll(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function Gh(t,e){if(!(t&&e))return;let r=il.exec(t),n=il.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var cl=/t|\s/i;function Hh(t){let e=al(t);return function(n){let o=n.split(cl);return o.length===2&&Jh(o[0])&&e(o[1])}}function Yh(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function Xh(t,e){if(!(t&&e))return;let[r,n]=t.split(cl),[o,s]=e.split(cl),i=ul(r,o);if(i!==void 0)return i||ll(n,s)}var gz=/\/|:/,_z=/^(?:[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 yz(t){return gz.test(t)&&_z.test(t)}var Kh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function vz(t){return Kh.lastIndex=0,Kh.test(t)}var bz=-(2**31),xz=2**31-1;function $z(t){return Number.isInteger(t)&&t<=xz&&t>=bz}function wz(t){return Number.isInteger(t)}function Wh(){return!0}var kz=/[^\\]\\Z/;function Sz(t){if(kz.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var eg=S(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.formatLimitDefinition=void 0;var zz=sl(),ct=q(),Ft=ct.operators,Us={formatMaximum:{okStr:"<=",ok:Ft.LTE,fail:Ft.GT},formatMinimum:{okStr:">=",ok:Ft.GTE,fail:Ft.LT},formatExclusiveMaximum:{okStr:"<",ok:Ft.LT,fail:Ft.GTE},formatExclusiveMinimum:{okStr:">",ok:Ft.GT,fail:Ft.LTE}},Pz={message:({keyword:t,schemaCode:e})=>(0,ct.str)`should be ${Us[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,ct._)`{comparison: ${Us[t].okStr}, limit: ${e}}`};an.formatLimitDefinition={keyword:Object.keys(Us),type:"string",schemaType:"string",$data:!0,error:Pz,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new zz.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let h=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=e.const("fmt",(0,ct._)`${h}[${c.schemaCode}]`);t.fail$data((0,ct.or)((0,ct._)`typeof ${m} != "object"`,(0,ct._)`${m} instanceof RegExp`,(0,ct._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let h=c.schema,m=a.formats[h];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${o}": format "${h}" does not define "compare" function`);let p=e.scopeValue("formats",{key:h,ref:m,code:i.code.formats?(0,ct._)`${i.code.formats}${(0,ct.getProperty)(h)}`:void 0});t.fail$data(d(p))}function d(h){return(0,ct._)`${h}.compare(${r}, ${n}) ${Us[o].fail} 0`}},dependencies:["format"]};var Ez=t=>(t.addKeyword(an.formatLimitDefinition),t);an.default=Ez});var og=S((oo,ng)=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});var cn=Qh(),Tz=eg(),dl=q(),tg=new dl.Name("fullFormats"),Rz=new dl.Name("fastFormats"),pl=(t,e={keywords:!0})=>{if(Array.isArray(e))return rg(t,e,cn.fullFormats,tg),t;let[r,n]=e.mode==="fast"?[cn.fastFormats,Rz]:[cn.fullFormats,tg],o=e.formats||cn.formatNames;return rg(t,o,r,n),e.keywords&&(0,Tz.default)(t),t};pl.get=(t,e="full")=>{let n=(e==="fast"?cn.fastFormats:cn.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function rg(t,e,r,n){var o,s;(o=(s=t.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,dl._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}ng.exports=oo=pl;Object.defineProperty(oo,"__esModule",{value:!0});oo.default=pl});function hg(t){return Dz.find(e=>e.id===t)}function gg(t){return qz.find(e=>e.name===t)}function _g(t){return Lz.find(e=>e.name===t)}function yg(t){return Uz.find(e=>e.id===t)}var Dz,qz,Lz,Uz,vg=co(()=>{"use strict";Dz=[{id:"skill-backend-001",name:"backend-api-conventions",action:"code",executionMode:"auto",description:"writing, creating, modifying, or reviewing backend API code \u2014 HTTP endpoints, routes, controllers, request handlers, or server-side validation and security",categories:[{name:"endpoint-design",instructions:["Name routes with plural nouns and kebab-case (e.g. /user-profiles).","Return RFC-7807 problem+json on errors, never bare strings.","Validate and sanitize every request body against a schema before use."]},{name:"security",instructions:["Use parameterized queries only; never string-concatenate SQL.","Rate-limit auth endpoints to 5 requests/minute per IP."]}]},{id:"skill-testing-001",name:"testing-standards",action:"test",executionMode:"auto",description:"writing or updating automated tests \u2014 unit tests, integration tests, test files, assertions, mocks, or test coverage",categories:[{name:"unit",instructions:["One behavioral assertion per test; name tests as should_<expectation>.","Mock only at process boundaries (network, fs, clock)."]}]},{id:"skill-always-001",name:"repo-foundations",action:"behave",executionMode:"always",description:"foundational rules that always apply in this repository",categories:[{name:"house-rules",instructions:["Every source file must start with a one-line header comment describing its purpose.","Prefer clarity over cleverness; match the surrounding code's style."]}]}];qz=[{name:"ship-checklist",description:"Run this team's pre-merge checklist.",arguments:[{name:"scope",description:"what is being shipped",required:!1}],content:`Pre-merge checklist for $ARGUMENTS:
10
+ 1. Tests pass and cover new behavior.
11
+ 2. No secrets or debug logging left in.
12
+ 3. Public APIs documented.
13
+ 4. Changelog updated.`}],Lz=[{name:"error-codes",description:"Canonical list of this platform's error codes.",content:`E1001 invalid_input
14
+ E1002 unauthorized
15
+ E1003 rate_limited
16
+ E2001 upstream_unavailable`}];Uz=[{id:"workflow-deploy-001",name:"production-deploy",description:"deploying to production, cutting a release, or shipping to prod",itemCount:6,content:`Production deploy workflow:
17
+ 1. Confirm CI is green on main.
18
+ 2. Bump version + update changelog.
19
+ 3. Tag the release.
20
+ 4. Run db migrations.
21
+ 5. Deploy and watch error rate for 10m.
22
+ 6. Announce in #releases.`}]});import{appendFileSync as Vz,mkdirSync as Fz}from"node:fs";import{dirname as Bz}from"node:path";function ae(t){let e=JSON.stringify({seq:Kz++,...t});if(hl)try{Fz(Bz(hl),{recursive:!0}),Vz(hl,e+`
23
+ `)}catch{}Hz&&process.stderr.write("[superclawd-mcp] "+e+`
24
+ `)}var hl,Hz,Kz,Ws=co(()=>{"use strict";hl=process.env.SUPERCLAWD_LOG_FILE,Hz=process.env.SUPERCLAWD_DEBUG==="1",Kz=0});var xg={};uo(xg,{mockBackend:()=>Xz});function Gz(t){return t.categories.reduce((e,r)=>e+r.instructions.length,0)}function Yz(t){let e=t.categories.map(r=>` <category name="${r.name}">
25
+ `+r.instructions.map((n,o)=>` ${o+1}. ${n}`).join(`
26
+ `)+`
27
+ </category>`).join(`
28
+ `);return`<actionable_directives skill="${t.name}" action="${t.action}" skillId="${t.id}">
29
+ ${e}
30
+ </actionable_directives>`}async function bg(t,e){return e===void 0?(ae({tool:t,result:"not_found"}),{ok:!1,status:404,message:"Not found or was removed."}):un==="free"?(ae({tool:t,charged:0,tier:"free"}),{ok:!0,status:200,text:e,charged:0,balanceAfter:null}):ye<Js?(ae({tool:t,result:"insufficient_credits",balance:ye}),{ok:!1,status:402,message:"Insufficient credits. Top up at app.superclawd.com."}):(ye=Number((ye-Js).toFixed(4)),ae({tool:t,charged:Js,balanceAfter:ye}),{ok:!0,status:200,text:e,charged:Js,balanceAfter:ye})}var Wz,Jz,Js,un,ye,Xz,$g=co(()=>{"use strict";vg();Ws();Wz=.05,Jz=.25,Js=.1,un=(process.env.SUPERCLAWD_MOCK_TIER||"paid").toLowerCase(),ye=Number(process.env.SUPERCLAWD_MOCK_BALANCE??100);Xz={async getDirectives(t){let e=t.map(i=>i.skillId).join(","),r=[];for(let{skillId:i}of t){let a=hg(i);if(!a)return ae({tool:"get_directives",skillId:i,result:"not_found"}),{ok:!1,status:404,message:`Skill ${i} not found or was removed.`};r.push(a)}let n=r.reduce((i,a)=>i+Gz(a),0),o=r.map(Yz).join(`
31
+
32
+ `);if(un==="free")return ae({tool:"get_directives",skillIds:e,count:n,charged:0,tier:"free"}),{ok:!0,status:200,text:o,instructionCount:n,charged:0,balanceAfter:null};let s=Math.max(n*Wz,Jz);return ye<s?(ae({tool:"get_directives",skillIds:e,result:"insufficient_credits",balance:ye}),{ok:!1,status:402,message:`Insufficient credits: need ${s}, have ${ye}. Top up at app.superclawd.com.`}):(ye=Number((ye-s).toFixed(4)),ae({tool:"get_directives",skillIds:e,count:n,charged:s,balanceAfter:ye}),{ok:!0,status:200,text:o,instructionCount:n,charged:s,balanceAfter:ye})},getCommand:t=>bg("get_command",gg(t)?.content),getResource:t=>bg("get_resource",_g(t)?.content),async getWorkflow(t){let e=yg(t);if(!e)return ae({tool:"get_workflow",workflowId:t,result:"not_found"}),{ok:!1,status:404,message:`Workflow ${t} not found.`};if(un==="free")return{ok:!0,status:200,text:e.content,charged:0,balanceAfter:null};let r=Math.max(e.itemCount*.025,.25);return ye<r?{ok:!1,status:402,message:"Insufficient credits. Top up at app.superclawd.com."}:(ye=Number((ye-r).toFixed(4)),ae({tool:"get_workflow",workflowId:t,charged:r,balanceAfter:ye}),{ok:!0,status:200,text:e.content,charged:r,balanceAfter:ye})},async workspaceInfo(){return{ok:!0,status:200,text:`<workspace_info>
33
+ <name>Mock Workspace</name>
34
+ <tier>${un}</tier>
35
+ <skills>3</skills>
36
+ <commands>1</commands>
37
+ <resources>1</resources>
38
+ <workflows>1</workflows>
39
+ </workspace_info>`}},async serviceStatus(){return{ok:!0,status:200,text:"<service_status><status>operational</status><mode>mock</mode></service_status>"}},async checkBalance(){return{tier:un,balance:un==="free"?Number.POSITIVE_INFINITY:ye}}}});var Sg={};uo(Sg,{realBackend:()=>rP});import{randomUUID as kg}from"node:crypto";function io(t){let e={"content-type":"application/json","x-mcp-key-id":Qz,"x-mcp-secret":eP,"x-workspace-slug":tP,"x-request-id":kg()};return t&&(e["x-session-request-id"]=t),e}async function wg(){if(zr||(zr=kg()),Ys)return zr;let t=await fetch(`${Ht}/api/prompt/inspector`,{method:"POST",headers:io(zr),body:JSON.stringify({ide:!0,platform:"claude-code",llm_model:"claude",x_session_request_id:zr,enable_session_files:!1})});if(!t.ok)throw new Error(`inspector ${t.status}: ${await t.text().catch(()=>"")}`);return Ys=!0,ae({tool:"inspector",status:t.status,sessionId:zr}),zr}function Pr(t){if(typeof t=="string")return t;if(!t||typeof t!="object")return JSON.stringify(t);let e=t;if(Array.isArray(e.content))return e.content.map(s=>s.text??"").join(`
40
+
41
+ `);let r=e.resource??e.command;if(r&&typeof r.content=="string")return r.content;let{_meta:n,...o}=e;return JSON.stringify(o)}async function Gs(t,e){try{let r=await fetch(e,{headers:io()}),n=await r.json().catch(()=>({}));if(!r.ok)return ae({tool:t,status:r.status}),{ok:!1,status:r.status,message:Pr(n)||`error ${r.status}`};let o=n._meta?.credits;return ae({tool:t,status:r.status,charged:o?.charged}),{ok:!0,status:r.status,text:Pr(n),charged:o?.charged,balanceAfter:o?.balanceAfter??null}}catch(r){return ae({tool:t,error:String(r)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(r)}`}}}var Ht,Qz,eP,tP,zr,Ys,rP,zg=co(()=>{"use strict";Ws();Ht=process.env.SUPERCLAWD_MCP_API_URL||"https://mcp-api.superclawd.com",Qz=process.env.MCP_KEY_ID||"",eP=process.env.MCP_SECRET||"",tP=process.env.MCP_WORKSPACE||"";zr=process.env.SUPERCLAWD_SESSION_ID||null,Ys=!1;rP={async getDirectives(t){let e=t.map(r=>r.skillId).join(",");try{let r=await wg(),n=await fetch(`${Ht}/api/prompt/directives`,{method:"POST",headers:io(r),body:JSON.stringify({assignments:t.map(i=>({action:i.action??"code",skill_id:i.skillId}))})}),o=await n.json().catch(()=>({}));if(!n.ok)return n.status===404&&(Ys=!1),ae({tool:"get_directives",skillIds:e,status:n.status}),{ok:!1,status:n.status,message:Pr(o)||`error ${n.status}`};let s=o._meta?.credits;return ae({tool:"get_directives",skillIds:e,status:n.status,charged:s?.charged,balanceAfter:s?.balanceAfter}),{ok:!0,status:n.status,text:Pr(o),instructionCount:s?.instructionCount,charged:s?.charged,balanceAfter:s?.balanceAfter??null}}catch(r){return ae({tool:"get_directives",skillIds:e,error:String(r)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(r)}`}}},getCommand:t=>Gs("get_command",`${Ht}/api/prompt/commands/${encodeURIComponent(t)}`),getResource:t=>Gs("get_resource",`${Ht}/api/prompt/resources/${encodeURIComponent(t)}`),async getWorkflow(t){try{let e=await wg(),r=await fetch(`${Ht}/api/prompt/workflow`,{method:"POST",headers:io(e),body:JSON.stringify({workflow_id:t})}),n=await r.json().catch(()=>({}));if(!r.ok)return r.status===404&&(Ys=!1),ae({tool:"get_workflow",workflowId:t,status:r.status}),{ok:!1,status:r.status,message:Pr(n)||`error ${r.status}`};let o=n._meta?.credits;return ae({tool:"get_workflow",workflowId:t,status:r.status,charged:o?.charged}),{ok:!0,status:r.status,text:Pr(n),charged:o?.charged,balanceAfter:o?.balanceAfter??null}}catch(e){return ae({tool:"get_workflow",workflowId:t,error:String(e)}),{ok:!1,status:503,message:`SuperClawd backend unreachable: ${String(e)}`}}},workspaceInfo:()=>Gs("workspace_info",`${Ht}/api/prompt/workspace-info`),serviceStatus:()=>Gs("service_status",`${Ht}/api/prompt/status`),async checkBalance(){let t=await fetch(`${Ht}/api/prompt/balance`,{headers:io()}),e=await t.json().catch(()=>({})),r=Pr(e),n=r.match(/<current_balance>([\d.]+)<\/current_balance>/),o=n?Number(n[1]):0,s=r.match(/<tier>(free|paid)<\/tier>/),i=s?s[1]:"free";return ae({tool:"check_balance",status:t.status,balance:o,tier:i}),{tier:i,balance:o}}}});var Ve={};uo(Ve,{BRAND:()=>h_,DIRTY:()=>Jt,EMPTY_PATH:()=>Kg,INVALID:()=>O,NEVER:()=>X_,OK:()=>ke,ParseStatus:()=>ve,Schema:()=>D,ZodAny:()=>Ot,ZodArray:()=>wt,ZodBigInt:()=>Yt,ZodBoolean:()=>Xt,ZodBranded:()=>pn,ZodCatch:()=>ur,ZodDate:()=>Qt,ZodDefault:()=>cr,ZodDiscriminatedUnion:()=>fo,ZodEffects:()=>Ue,ZodEnum:()=>ir,ZodError:()=>Ie,ZodFirstPartyTypeKind:()=>x,ZodFunction:()=>ho,ZodIntersection:()=>nr,ZodIssueCode:()=>b,ZodLazy:()=>or,ZodLiteral:()=>sr,ZodMap:()=>Cr,ZodNaN:()=>jr,ZodNativeEnum:()=>ar,ZodNever:()=>Ge,ZodNull:()=>tr,ZodNullable:()=>dt,ZodNumber:()=>Gt,ZodObject:()=>Ze,ZodOptional:()=>qe,ZodParsedType:()=>z,ZodPipeline:()=>fn,ZodPromise:()=>Ct,ZodReadonly:()=>lr,ZodRecord:()=>mo,ZodSchema:()=>D,ZodSet:()=>Nr,ZodString:()=>Zt,ZodSymbol:()=>Zr,ZodTransformer:()=>Ue,ZodTuple:()=>lt,ZodType:()=>D,ZodUndefined:()=>er,ZodUnion:()=>rr,ZodUnknown:()=>$t,ZodVoid:()=>Or,addIssueToContext:()=>k,any:()=>k_,array:()=>E_,bigint:()=>v_,boolean:()=>Rl,coerce:()=>Y_,custom:()=>Pl,date:()=>b_,datetimeRegex:()=>Sl,defaultErrorMap:()=>bt,discriminatedUnion:()=>I_,effect:()=>V_,enum:()=>q_,function:()=>A_,getErrorMap:()=>Tr,getParsedType:()=>ut,instanceof:()=>__,intersection:()=>Z_,isAborted:()=>lo,isAsync:()=>Rr,isDirty:()=>po,isValid:()=>It,late:()=>g_,lazy:()=>M_,literal:()=>D_,makeIssue:()=>dn,map:()=>N_,nan:()=>y_,nativeEnum:()=>L_,never:()=>z_,null:()=>w_,nullable:()=>B_,number:()=>Tl,object:()=>oi,objectUtil:()=>ti,oboolean:()=>G_,onumber:()=>J_,optional:()=>F_,ostring:()=>W_,pipeline:()=>K_,preprocess:()=>H_,promise:()=>U_,quotelessJson:()=>Fg,record:()=>C_,set:()=>j_,setErrorMap:()=>Hg,strictObject:()=>T_,string:()=>El,symbol:()=>x_,transformer:()=>V_,tuple:()=>O_,undefined:()=>$_,union:()=>R_,unknown:()=>S_,util:()=>F,void:()=>P_});var F;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(F||(F={}));var ti;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ti||(ti={}));var z=F.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ut=t=>{switch(typeof t){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(t)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(t)?z.array:t===null?z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?z.promise:typeof Map<"u"&&t instanceof Map?z.map:typeof Set<"u"&&t instanceof Set?z.set:typeof Date<"u"&&t instanceof Date?z.date:z.object;default:return z.unknown}};var b=F.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"]),Fg=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Ie=class t extends Error{get errors(){return this.issues}constructor(e){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=e}format(e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,F.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ie.create=t=>new Ie(t);var Bg=(t,e)=>{let r;switch(t.code){case b.invalid_type:t.received===z.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case b.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,F.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:r=`Unrecognized key(s) in object: ${F.joinValues(t.keys,", ")}`;break;case b.invalid_union:r="Invalid input";break;case b.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${F.joinValues(t.options)}`;break;case b.invalid_enum_value:r=`Invalid enum value. Expected ${F.joinValues(t.options)}, received '${t.received}'`;break;case b.invalid_arguments:r="Invalid function arguments";break;case b.invalid_return_type:r="Invalid function return type";break;case b.invalid_date:r="Invalid date";break;case b.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:F.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case b.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case b.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case b.custom:r="Invalid input";break;case b.invalid_intersection_types:r="Intersection results could not be merged";break;case b.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case b.not_finite:r="Number must be finite";break;default:r=e.defaultError,F.assertNever(t)}return{message:r}},bt=Bg;var bl=bt;function Hg(t){bl=t}function Tr(){return bl}var dn=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}},Kg=[];function k(t,e){let r=Tr(),n=dn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===bt?void 0:bt].filter(o=>!!o)});t.common.issues.push(n)}var ve=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return O;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,i=await o.value;n.push({key:s,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return O;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},O=Object.freeze({status:"aborted"}),Jt=t=>({status:"dirty",value:t}),ke=t=>({status:"valid",value:t}),lo=t=>t.status==="aborted",po=t=>t.status==="dirty",It=t=>t.status==="valid",Rr=t=>typeof Promise<"u"&&t instanceof Promise;var T;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(T||(T={}));var Le=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,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}},xl=(t,e)=>{if(It(e))return{success:!0,data:e.value};if(!t.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 Ie(t.common.issues);return this._error=r,this._error}}};function A(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var D=class{get description(){return this._def.description}_getType(e){return ut(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:ut(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ve,ctx:{common:e.parent.common,data:e.data,parsedType:ut(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Rr(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ut(e)},o=this._parseSync({data:e,path:n.path,parent:n});return xl(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ut(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return It(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:e,path:[],parent:r}).then(n=>It(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ut(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(Rr(o)?o:Promise.resolve(o));return xl(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:b.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Ue({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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 qe.create(this,this._def)}nullable(){return dt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return wt.create(this)}promise(){return Ct.create(this,this._def)}or(e){return rr.create([this,e],this._def)}and(e){return nr.create(this,e,this._def)}transform(e){return new Ue({...A(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new cr({...A(this._def),innerType:this,defaultValue:r,typeName:x.ZodDefault})}brand(){return new pn({typeName:x.ZodBranded,type:this,...A(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ur({...A(this._def),innerType:this,catchValue:r,typeName:x.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return fn.create(this,e)}readonly(){return lr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Wg=/^c[^\s-]{8,}$/i,Jg=/^[0-9a-z]+$/,Gg=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Yg=/^[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,Xg=/^[a-z0-9_-]{21}$/i,Qg=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,e_=/^[-+]?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)?)??$/,t_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,r_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ri,n_=/^(?:(?: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])$/,o_=/^(?:(?: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])$/,s_=/^(([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]))$/,i_=/^(([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])$/,a_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,c_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,wl="((\\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])))",u_=new RegExp(`^${wl}$`);function kl(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function l_(t){return new RegExp(`^${kl(t)}$`)}function Sl(t){let e=`${wl}T${kl(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function d_(t,e){return!!((e==="v4"||!e)&&n_.test(t)||(e==="v6"||!e)&&s_.test(t))}function p_(t,e){if(!Qg.test(t))return!1;try{let[r]=t.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||e&&o.alg!==e)}catch{return!1}}function f_(t,e){return!!((e==="v4"||!e)&&o_.test(t)||(e==="v6"||!e)&&i_.test(t))}var Zt=class t extends D{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:z.string,received:s.parsedType}),O}let n=new ve,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),k(o,{code:b.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),k(o,{code:b.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?k(o,{code:b.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&k(o,{code:b.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")t_.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"email",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")ri||(ri=new RegExp(r_,"u")),ri.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"emoji",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Yg.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"uuid",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Xg.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"nanoid",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Wg.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"cuid",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Jg.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"cuid2",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Gg.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"ulid",code:b.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),k(o,{validation:"url",code:b.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"regex",code:b.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Sl(s).test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?u_.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?l_(s).test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{code:b.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?e_.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"duration",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?d_(e.data,s.version)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"ip",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?p_(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"jwt",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?f_(e.data,s.version)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"cidr",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?a_.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"base64",code:b.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?c_.test(e.data)||(o=this._getOrReturnCtx(e,o),k(o,{validation:"base64url",code:b.invalid_string,message:s.message}),n.dirty()):F.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:b.invalid_string,...T.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...T.errToObj(e)})}url(e){return this._addCheck({kind:"url",...T.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...T.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...T.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...T.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...T.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...T.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...T.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...T.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...T.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...T.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...T.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...T.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...T.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...T.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...T.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...T.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...T.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...T.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...T.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...T.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...T.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...T.errToObj(r)})}nonempty(e){return this.min(1,T.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Zt.create=t=>new Zt({checks:[],typeName:x.ZodString,coerce:t?.coerce??!1,...A(t)});function m_(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var Gt=class t extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==z.number){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:z.number,received:s.parsedType}),O}let n,o=new ve;for(let s of this._def.checks)s.kind==="int"?F.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?m_(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:b.not_finite,message:s.message}),o.dirty()):F.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:T.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:T.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&F.isInteger(e.value))}get isFinite(){let e=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"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Gt.create=t=>new Gt({checks:[],typeName:x.ZodNumber,coerce:t?.coerce||!1,...A(t)});var Yt=class t extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==z.bigint)return this._getInvalidInput(e);let n,o=new ve;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):F.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:z.bigint,received:r.parsedType}),O}gte(e,r){return this.setLimit("min",e,!0,T.toString(r))}gt(e,r){return this.setLimit("min",e,!1,T.toString(r))}lte(e,r){return this.setLimit("max",e,!0,T.toString(r))}lt(e,r){return this.setLimit("max",e,!1,T.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:T.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Yt.create=t=>new Yt({checks:[],typeName:x.ZodBigInt,coerce:t?.coerce??!1,...A(t)});var Xt=class extends D{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.boolean,received:n.parsedType}),O}return ke(e.data)}};Xt.create=t=>new Xt({typeName:x.ZodBoolean,coerce:t?.coerce||!1,...A(t)});var Qt=class t extends D{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:z.date,received:s.parsedType}),O}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_date}),O}let n=new ve,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),k(o,{code:b.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),k(o,{code:b.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):F.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:T.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:T.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Qt.create=t=>new Qt({checks:[],coerce:t?.coerce||!1,typeName:x.ZodDate,...A(t)});var Zr=class extends D{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.symbol,received:n.parsedType}),O}return ke(e.data)}};Zr.create=t=>new Zr({typeName:x.ZodSymbol,...A(t)});var er=class extends D{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.undefined,received:n.parsedType}),O}return ke(e.data)}};er.create=t=>new er({typeName:x.ZodUndefined,...A(t)});var tr=class extends D{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.null,received:n.parsedType}),O}return ke(e.data)}};tr.create=t=>new tr({typeName:x.ZodNull,...A(t)});var Ot=class extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return ke(e.data)}};Ot.create=t=>new Ot({typeName:x.ZodAny,...A(t)});var $t=class extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ke(e.data)}};$t.create=t=>new $t({typeName:x.ZodUnknown,...A(t)});var Ge=class extends D{_parse(e){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:z.never,received:r.parsedType}),O}};Ge.create=t=>new Ge({typeName:x.ZodNever,...A(t)});var Or=class extends D{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.void,received:n.parsedType}),O}return ke(e.data)}};Or.create=t=>new Or({typeName:x.ZodVoid,...A(t)});var wt=class t extends D{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==z.array)return k(r,{code:b.invalid_type,expected:z.array,received:r.parsedType}),O;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(i||a)&&(k(r,{code:i?b.too_big:b.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(k(r,{code:b.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&&(k(r,{code:b.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>o.type._parseAsync(new Le(r,i,r.path,a)))).then(i=>ve.mergeArray(n,i));let s=[...r.data].map((i,a)=>o.type._parseSync(new Le(r,i,r.path,a)));return ve.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:T.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:T.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:T.toString(r)}})}nonempty(e){return this.min(1,e)}};wt.create=(t,e)=>new wt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...A(e)});function Ir(t){if(t instanceof Ze){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=qe.create(Ir(n))}return new Ze({...t._def,shape:()=>e})}else return t instanceof wt?new wt({...t._def,type:Ir(t.element)}):t instanceof qe?qe.create(Ir(t.unwrap())):t instanceof dt?dt.create(Ir(t.unwrap())):t instanceof lt?lt.create(t.items.map(e=>Ir(e))):t}var Ze=class t extends D{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=F.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==z.object){let u=this._getOrReturnCtx(e);return k(u,{code:b.invalid_type,expected:z.object,received:u.parsedType}),O}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ge&&this._def.unknownKeys==="strip"))for(let u in o.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=s[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Le(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof Ge){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(k(o,{code:b.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Le(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,h=await l.value;u.push({key:d,value:h,alwaysSet:l.alwaysSet})}return u}).then(u=>ve.mergeObjectSync(n,u)):ve.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return T.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:T.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of F.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of F.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Ir(this)}partial(e){let r={};for(let n of F.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of F.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof qe;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return zl(F.objectKeys(this.shape))}};Ze.create=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strip",catchall:Ge.create(),typeName:x.ZodObject,...A(e)});Ze.strictCreate=(t,e)=>new Ze({shape:()=>t,unknownKeys:"strict",catchall:Ge.create(),typeName:x.ZodObject,...A(e)});Ze.lazycreate=(t,e)=>new Ze({shape:t,unknownKeys:"strip",catchall:Ge.create(),typeName:x.ZodObject,...A(e)});var rr=class extends D{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Ie(a.ctx.common.issues));return k(r,{code:b.invalid_union,unionErrors:i}),O}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new Ie(c));return k(r,{code:b.invalid_union,unionErrors:a}),O}}get options(){return this._def.options}};rr.create=(t,e)=>new rr({options:t,typeName:x.ZodUnion,...A(e)});var xt=t=>t instanceof or?xt(t.schema):t instanceof Ue?xt(t.innerType()):t instanceof sr?[t.value]:t instanceof ir?t.options:t instanceof ar?F.objectValues(t.enum):t instanceof cr?xt(t._def.innerType):t instanceof er?[void 0]:t instanceof tr?[null]:t instanceof qe?[void 0,...xt(t.unwrap())]:t instanceof dt?[null,...xt(t.unwrap())]:t instanceof pn||t instanceof lr?xt(t.unwrap()):t instanceof ur?xt(t._def.innerType):[],fo=class t extends D{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return k(r,{code:b.invalid_type,expected:z.object,received:r.parsedType}),O;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(k(r,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),O)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let i=xt(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...A(n)})}};function ni(t,e){let r=ut(t),n=ut(e);if(t===e)return{valid:!0,data:t};if(r===z.object&&n===z.object){let o=F.objectKeys(e),s=F.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=ni(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===z.array&&n===z.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=ni(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===z.date&&n===z.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var nr=class extends D{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,i)=>{if(lo(s)||lo(i))return O;let a=ni(s.value,i.value);return a.valid?((po(s)||po(i))&&r.dirty(),{status:r.value,value:a.data}):(k(n,{code:b.invalid_intersection_types}),O)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};nr.create=(t,e,r)=>new nr({left:t,right:e,typeName:x.ZodIntersection,...A(r)});var lt=class t extends D{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return k(n,{code:b.invalid_type,expected:z.array,received:n.parsedType}),O;if(n.data.length<this._def.items.length)return k(n,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;!this._def.rest&&n.data.length>this._def.items.length&&(k(n,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Le(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>ve.mergeArray(r,i)):ve.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};lt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new lt({items:t,typeName:x.ZodTuple,rest:null,...A(e)})};var mo=class t extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.object)return k(n,{code:b.invalid_type,expected:z.object,received:n.parsedType}),O;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in n.data)o.push({key:s._parse(new Le(n,a,n.path,a)),value:i._parse(new Le(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?ve.mergeObjectAsync(r,o):ve.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof D?new t({keyType:e,valueType:r,typeName:x.ZodRecord,...A(n)}):new t({keyType:Zt.create(),valueType:e,typeName:x.ZodRecord,...A(r)})}},Cr=class extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.map)return k(n,{code:b.invalid_type,expected:z.map,received:n.parsedType}),O;let o=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new Le(n,a,n.path,[u,"key"])),value:s._parse(new Le(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return O;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return O;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};Cr.create=(t,e,r)=>new Cr({valueType:e,keyType:t,typeName:x.ZodMap,...A(r)});var Nr=class t extends D{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return k(n,{code:b.invalid_type,expected:z.set,received:n.parsedType}),O;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(k(n,{code:b.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&&(k(n,{code:b.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return O;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>s._parse(new Le(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:T.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:T.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Nr.create=(t,e)=>new Nr({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,...A(e)});var ho=class t extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.function)return k(r,{code:b.invalid_type,expected:z.function,received:r.parsedType}),O;function n(a,c){return dn({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Tr(),bt].filter(u=>!!u),issueData:{code:b.invalid_arguments,argumentsError:c}})}function o(a,c){return dn({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Tr(),bt].filter(u=>!!u),issueData:{code:b.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Ct){let a=this;return ke(async function(...c){let u=new Ie([]),l=await a._def.args.parseAsync(c,s).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,s).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let a=this;return ke(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new Ie([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,s);if(!d.success)throw new Ie([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:lt.create(e).rest($t.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||lt.create([]).rest($t.create()),returns:r||$t.create(),typeName:x.ZodFunction,...A(n)})}},or=class extends D{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};or.create=(t,e)=>new or({getter:t,typeName:x.ZodLazy,...A(e)});var sr=class extends D{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return k(r,{received:r.data,code:b.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:e.data}}get value(){return this._def.value}};sr.create=(t,e)=>new sr({value:t,typeName:x.ZodLiteral,...A(e)});function zl(t,e){return new ir({values:t,typeName:x.ZodEnum,...A(e)})}var ir=class t extends D{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return k(r,{expected:F.joinValues(n),received:r.parsedType,code:b.invalid_type}),O}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return k(r,{received:r.data,code:b.invalid_enum_value,options:n}),O}return ke(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};ir.create=zl;var ar=class extends D{_parse(e){let r=F.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let o=F.objectValues(r);return k(n,{expected:F.joinValues(o),received:n.parsedType,code:b.invalid_type}),O}if(this._cache||(this._cache=new Set(F.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=F.objectValues(r);return k(n,{received:n.data,code:b.invalid_enum_value,options:o}),O}return ke(e.data)}get enum(){return this._def.values}};ar.create=(t,e)=>new ar({values:t,typeName:x.ZodNativeEnum,...A(e)});var Ct=class extends D{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.promise&&r.common.async===!1)return k(r,{code:b.invalid_type,expected:z.promise,received:r.parsedType}),O;let n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return ke(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ct.create=(t,e)=>new Ct({type:t,typeName:x.ZodPromise,...A(e)});var Ue=class extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{k(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return O;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?O:c.status==="dirty"?Jt(c.value):r.value==="dirty"?Jt(c.value):c});{if(r.value==="aborted")return O;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?O:a.status==="dirty"?Jt(a.value):r.value==="dirty"?Jt(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?O:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?O:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!It(i))return O;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>It(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:r.value,value:a})):O);F.assertNever(o)}};Ue.create=(t,e,r)=>new Ue({schema:t,typeName:x.ZodEffects,effect:e,...A(r)});Ue.createWithPreprocess=(t,e,r)=>new Ue({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,...A(r)});var qe=class extends D{_parse(e){return this._getType(e)===z.undefined?ke(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};qe.create=(t,e)=>new qe({innerType:t,typeName:x.ZodOptional,...A(e)});var dt=class extends D{_parse(e){return this._getType(e)===z.null?ke(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};dt.create=(t,e)=>new dt({innerType:t,typeName:x.ZodNullable,...A(e)});var cr=class extends D{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};cr.create=(t,e)=>new cr({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...A(e)});var ur=class extends D{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Rr(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ie(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ie(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ur.create=(t,e)=>new ur({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...A(e)});var jr=class extends D{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return k(n,{code:b.invalid_type,expected:z.nan,received:n.parsedType}),O}return{status:"valid",value:e.data}}};jr.create=t=>new jr({typeName:x.ZodNaN,...A(t)});var h_=Symbol("zod_brand"),pn=class extends D{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},fn=class t extends D{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?O:s.status==="dirty"?(r.dirty(),Jt(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?O:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:x.ZodPipeline})}},lr=class extends D{_parse(e){let r=this._def.innerType._parse(e),n=o=>(It(o)&&(o.value=Object.freeze(o.value)),o);return Rr(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};lr.create=(t,e)=>new lr({innerType:t,typeName:x.ZodReadonly,...A(e)});function $l(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Pl(t,e={},r){return t?Ot.create().superRefine((n,o)=>{let s=t(n);if(s instanceof Promise)return s.then(i=>{if(!i){let a=$l(e,n),c=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:c})}});if(!s){let i=$l(e,n),a=i.fatal??r??!0;o.addIssue({code:"custom",...i,fatal:a})}}):Ot.create()}var g_={object:Ze.lazycreate},x;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(x||(x={}));var __=(t,e={message:`Input not instance of ${t.name}`})=>Pl(r=>r instanceof t,e),El=Zt.create,Tl=Gt.create,y_=jr.create,v_=Yt.create,Rl=Xt.create,b_=Qt.create,x_=Zr.create,$_=er.create,w_=tr.create,k_=Ot.create,S_=$t.create,z_=Ge.create,P_=Or.create,E_=wt.create,oi=Ze.create,T_=Ze.strictCreate,R_=rr.create,I_=fo.create,Z_=nr.create,O_=lt.create,C_=mo.create,N_=Cr.create,j_=Nr.create,A_=ho.create,M_=or.create,D_=sr.create,q_=ir.create,L_=ar.create,U_=Ct.create,V_=Ue.create,F_=qe.create,B_=dt.create,H_=Ue.createWithPreprocess,K_=fn.create,W_=()=>El().optional(),J_=()=>Tl().optional(),G_=()=>Rl().optional(),Y_={string:t=>Zt.create({...t,coerce:!0}),number:t=>Gt.create({...t,coerce:!0}),boolean:t=>Xt.create({...t,coerce:!0}),bigint:t=>Yt.create({...t,coerce:!0}),date:t=>Qt.create({...t,coerce:!0})};var X_=O;var Q_=Object.freeze({status:"aborted"});function _(t,e,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(let l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var ey=Symbol("zod_brand"),kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},go={};function Ye(t){return t&&Object.assign(go,t),go}var B={};uo(B,{BIGINT_FORMAT_RANGES:()=>Ol,Class:()=>ii,NUMBER_FORMAT_RANGES:()=>fi,aborted:()=>pr,allowsEval:()=>li,assert:()=>sy,assertEqual:()=>ty,assertIs:()=>ny,assertNever:()=>oy,assertNotEqual:()=>ry,assignProp:()=>ui,cached:()=>gn,captureStackTrace:()=>_o,cleanEnum:()=>vy,cleanRegex:()=>yn,clone:()=>Me,createTransparentProxy:()=>py,defineLazy:()=>ne,esc:()=>dr,escapeRegex:()=>Nt,extend:()=>hy,finalizeIssue:()=>Xe,floatSafeRemainder:()=>ci,getElementAtPath:()=>ay,getEnumValues:()=>hn,getLengthableOrigin:()=>vn,getParsedType:()=>dy,getSizableOrigin:()=>Cl,isObject:()=>Ar,isPlainObject:()=>Mr,issue:()=>mi,joinValues:()=>iy,jsonStringifyReplacer:()=>ai,merge:()=>gy,normalizeParams:()=>C,nullish:()=>_n,numKeys:()=>ly,omit:()=>my,optionalKeys:()=>pi,partial:()=>_y,pick:()=>fy,prefixIssues:()=>pt,primitiveTypes:()=>Il,promiseAllObject:()=>cy,propertyKeyTypes:()=>di,randomString:()=>uy,required:()=>yy,stringifyPrimitive:()=>Zl,unwrapMessage:()=>mn});function ty(t){return t}function ry(t){return t}function ny(t){}function oy(t){throw new Error}function sy(t){}function hn(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function iy(t,e="|"){return t.map(r=>Zl(r)).join(e)}function ai(t,e){return typeof e=="bigint"?e.toString():e}function gn(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function _n(t){return t==null}function yn(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function ci(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}function ne(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function ui(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ay(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function cy(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function uy(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function dr(t){return JSON.stringify(t)}var _o=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function Ar(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var li=gn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Mr(t){if(Ar(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(Ar(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ly(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var dy=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},di=new Set(["string","number","symbol"]),Il=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Nt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Me(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function C(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function py(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function Zl(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function pi(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var fi={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]},Ol={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function fy(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return Me(t,{...t._zod.def,shape:r,checks:[]})}function my(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return Me(t,{...t._zod.def,shape:r,checks:[]})}function hy(t,e){if(!Mr(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return ui(this,"shape",n),n},checks:[]};return Me(t,r)}function gy(t,e){return Me(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return ui(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function _y(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)o[s]=t?new t({type:"optional",innerType:n[s]}):n[s];return Me(e,{...e._zod.def,shape:o,checks:[]})}function yy(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return Me(e,{...e._zod.def,shape:o,checks:[]})}function pr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function pt(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function mn(t){return typeof t=="string"?t:t?.message}function Xe(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=mn(t.inst?._zod.def?.error?.(t))??mn(e?.error?.(t))??mn(r.customError?.(t))??mn(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function Cl(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function vn(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function mi(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function vy(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var ii=class{constructor(...e){}};var Nl=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,ai,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},yo=_("$ZodError",Nl),bn=_("$ZodError",Nl,{Parent:Error});function hi(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function gi(t,e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(t),n}var _i=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new kt;if(i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>Xe(c,s,Ye())));throw _o(a,o?.callee),a}return i.value},yi=_i(bn),vi=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>Xe(c,s,Ye())));throw _o(a,o?.callee),a}return i.value},bi=vi(bn),xi=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new kt;return s.issues.length?{success:!1,error:new(t??yo)(s.issues.map(i=>Xe(i,o,Ye())))}:{success:!0,data:s.value}},fr=xi(bn),$i=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>Xe(i,o,Ye())))}:{success:!0,data:s.value}},mr=$i(bn);var jl=/^[cC][^\s-]{8,}$/,Al=/^[0-9a-z]+$/,Ml=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Dl=/^[0-9a-vA-V]{20}$/,ql=/^[A-Za-z0-9]{27}$/,Ll=/^[a-zA-Z0-9_-]{21}$/,Ul=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Vl=/^([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})$/,wi=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;var Fl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var xy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Bl(){return new RegExp(xy,"u")}var Hl=/^(?:(?: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])$/,Kl=/^(([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})$/,Wl=/^((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])$/,Jl=/^(([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])$/,Gl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ki=/^[A-Za-z0-9_-]*$/,Yl=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Xl=/^\+(?:[0-9]){6,14}[0-9]$/,Ql="(?:(?:\\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])))",ed=new RegExp(`^${Ql}$`);function td(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function rd(t){return new RegExp(`^${td(t)}$`)}function nd(t){let e=td({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Ql}T(?:${n})$`)}var od=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var sd=/^\d+$/,id=/^-?\d+(?:\.\d+)?/i,ad=/true|false/i;var cd=/^[^A-Z]*$/,ud=/^[^a-z]*$/;var be=_("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),ld={number:"number",bigint:"bigint",object:"date"},Si=_("$ZodCheckLessThan",(t,e)=>{be.init(t,e);let r=ld[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),zi=_("$ZodCheckGreaterThan",(t,e)=>{be.init(t,e);let r=ld[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),dd=_("$ZodCheckMultipleOf",(t,e)=>{be.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):ci(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),pd=_("$ZodCheckNumberFormat",(t,e)=>{be.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=fi[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=o,a.maximum=s,r&&(a.pattern=sd)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:t})}});var fd=_("$ZodCheckMaxLength",(t,e)=>{var r;be.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!_n(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let i=vn(o);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),md=_("$ZodCheckMinLength",(t,e)=>{var r;be.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!_n(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let i=vn(o);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),hd=_("$ZodCheckLengthEquals",(t,e)=>{var r;be.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!_n(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,s=o.length;if(s===e.length)return;let i=vn(o),a=s>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),xn=_("$ZodCheckStringFormat",(t,e)=>{var r,n;be.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),gd=_("$ZodCheckRegex",(t,e)=>{xn.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),_d=_("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=cd),xn.init(t,e)}),yd=_("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=ud),xn.init(t,e)}),vd=_("$ZodCheckIncludes",(t,e)=>{be.init(t,e);let r=Nt(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),bd=_("$ZodCheckStartsWith",(t,e)=>{be.init(t,e);let r=new RegExp(`^${Nt(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),xd=_("$ZodCheckEndsWith",(t,e)=>{be.init(t,e);let r=new RegExp(`.*${Nt(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});var $d=_("$ZodCheckOverwrite",(t,e)=>{be.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var bo=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
42
+ `).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,o.join(`
43
+ `))}};var kd={major:4,minor:0,patch:0};var te=_("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=kd;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,i,a)=>{let c=pr(s),u;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(c)continue;let d=s.issues.length,h=l._zod.check(s);if(h instanceof Promise&&a?.async===!1)throw new kt;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,s.issues.length!==d&&(c||(c=pr(s,d)))});else{if(s.issues.length===d)continue;c||(c=pr(s,d))}}return u?u.then(()=>s):s};t._zod.run=(s,i)=>{let a=t._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new kt;return a.then(c=>o(c,n,i))}return o(a,n,i)}}t["~standard"]={validate:o=>{try{let s=fr(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return mr(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),$n=_("$ZodString",(t,e)=>{te.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??od(t._zod.bag),t._zod.parse=(r,n)=>{if(e.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:t}),r}}),oe=_("$ZodStringFormat",(t,e)=>{xn.init(t,e),$n.init(t,e)}),Ei=_("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Vl),oe.init(t,e)}),Ti=_("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=wi(n))}else e.pattern??(e.pattern=wi());oe.init(t,e)}),Ri=_("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Fl),oe.init(t,e)}),Ii=_("$ZodURL",(t,e)=>{oe.init(t,e),t._zod.check=r=>{try{let n=r.value,o=new URL(n),s=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Yl.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Zi=_("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Bl()),oe.init(t,e)}),Oi=_("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Ll),oe.init(t,e)}),Ci=_("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=jl),oe.init(t,e)}),Ni=_("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Al),oe.init(t,e)}),ji=_("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Ml),oe.init(t,e)}),Ai=_("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Dl),oe.init(t,e)}),Mi=_("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=ql),oe.init(t,e)}),Cd=_("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=nd(e)),oe.init(t,e)}),Nd=_("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=ed),oe.init(t,e)}),jd=_("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=rd(e)),oe.init(t,e)}),Ad=_("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Ul),oe.init(t,e)}),Di=_("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Hl),oe.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),qi=_("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Kl),oe.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6"}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Li=_("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Wl),oe.init(t,e)}),Ui=_("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Jl),oe.init(t,e),t._zod.check=r=>{let[n,o]=r.value.split("/");try{if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Md(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Vi=_("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Gl),oe.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{Md(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function $y(t){if(!ki.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Md(r)}var Fi=_("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=ki),oe.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{$y(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Bi=_("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Xl),oe.init(t,e)});function wy(t,e=null){try{let r=t.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||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var Hi=_("$ZodJWT",(t,e)=>{oe.init(t,e),t._zod.check=r=>{wy(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var $o=_("$ZodNumber",(t,e)=>{te.init(t,e),t._zod.pattern=t._zod.bag.pattern??id,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),r}}),Ki=_("$ZodNumber",(t,e)=>{pd.init(t,e),$o.init(t,e)}),Wi=_("$ZodBoolean",(t,e)=>{te.init(t,e),t._zod.pattern=ad,t._zod.parse=(r,n)=>{if(e.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:t}),r}});var Ji=_("$ZodUnknown",(t,e)=>{te.init(t,e),t._zod.parse=r=>r}),Gi=_("$ZodNever",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Sd(t,e,r){t.issues.length&&e.issues.push(...pt(r,t.issues)),e.value[r]=t.value}var Yi=_("$ZodArray",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>Sd(u,r,i))):Sd(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function xo(t,e,r){t.issues.length&&e.issues.push(...pt(r,t.issues)),e.value[r]=t.value}function zd(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...pt(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}var wo=_("$ZodObject",(t,e)=>{te.init(t,e);let r=gn(()=>{let d=Object.keys(e.shape);for(let m of d)if(!(e.shape[m]instanceof te))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);let h=pi(e.shape);return{shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(h)}});ne(t._zod,"propValues",()=>{let d=e.shape,h={};for(let m in d){let p=d[m]._zod;if(p.values){h[m]??(h[m]=new Set);for(let f of p.values)h[m].add(f)}}return h});let n=d=>{let h=new bo(["shape","payload","ctx"]),m=r.value,p=$=>{let w=dr($);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};h.write("const input = payload.value;");let f=Object.create(null),g=0;for(let $ of m.keys)f[$]=`key_${g++}`;h.write("const newResult = {}");for(let $ of m.keys)if(m.optionalKeys.has($)){let w=f[$];h.write(`const ${w} = ${p($)};`);let P=dr($);h.write(`
44
+ if (${w}.issues.length) {
45
+ if (input[${P}] === undefined) {
46
+ if (${P} in input) {
47
+ newResult[${P}] = undefined;
48
+ }
49
+ } else {
50
+ payload.issues = payload.issues.concat(
51
+ ${w}.issues.map((iss) => ({
52
+ ...iss,
53
+ path: iss.path ? [${P}, ...iss.path] : [${P}],
54
+ }))
55
+ );
56
+ }
57
+ } else if (${w}.value === undefined) {
58
+ if (${P} in input) newResult[${P}] = undefined;
59
+ } else {
60
+ newResult[${P}] = ${w}.value;
61
+ }
62
+ `)}else{let w=f[$];h.write(`const ${w} = ${p($)};`),h.write(`
63
+ if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
64
+ ...iss,
65
+ path: iss.path ? [${dr($)}, ...iss.path] : [${dr($)}]
66
+ })));`),h.write(`newResult[${dr($)}] = ${w}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");let v=h.compile();return($,w)=>v(d,$,w)},o,s=Ar,i=!go.jitless,c=i&&li.value,u=e.catchall,l;t._zod.parse=(d,h)=>{l??(l=r.value);let m=d.value;if(!s(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d;let p=[];if(i&&c&&h?.async===!1&&h.jitless!==!0)o||(o=n(e.shape)),d=o(d,h);else{d.value={};let w=l.shape;for(let P of l.keys){let R=w[P],le=R._zod.run({value:m[P],issues:[]},h),De=R._zod.optin==="optional"&&R._zod.optout==="optional";le instanceof Promise?p.push(le.then(Er=>De?zd(Er,d,P,m):xo(Er,d,P))):De?zd(le,d,P,m):xo(le,d,P)}}if(!u)return p.length?Promise.all(p).then(()=>d):d;let f=[],g=l.keySet,v=u._zod,$=v.def.type;for(let w of Object.keys(m)){if(g.has(w))continue;if($==="never"){f.push(w);continue}let P=v.run({value:m[w],issues:[]},h);P instanceof Promise?p.push(P.then(R=>xo(R,d,w))):xo(P,d,w)}return f.length&&d.issues.push({code:"unrecognized_keys",keys:f,input:m,inst:t}),p.length?Promise.all(p).then(()=>d):d}});function Pd(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>Xe(s,n,Ye())))}),e}var ko=_("$ZodUnion",(t,e)=>{te.init(t,e),ne(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ne(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ne(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ne(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>yn(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=!1,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>Pd(i,r,t,n)):Pd(s,r,t,n)}}),Xi=_("$ZodDiscriminatedUnion",(t,e)=>{ko.init(t,e);let r=t._zod.parse;ne(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=gn(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!Ar(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),o)}}),Qi=_("$ZodIntersection",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,s=e.left._zod.run({value:o,issues:[]},n),i=e.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Ed(r,c,u)):Ed(r,s,i)}});function Pi(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Mr(t)&&Mr(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let i=Pi(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],s=e[n],i=Pi(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Ed(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),pr(t))return t;let n=Pi(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var ea=_("$ZodRecord",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Mr(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...pt(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...pt(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>Xe(u,n,Ye())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...pt(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...pt(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var ta=_("$ZodEnum",(t,e)=>{te.init(t,e);let r=hn(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>di.has(typeof n)).map(n=>typeof n=="string"?Nt(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return t._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),ra=_("$ZodLiteral",(t,e)=>{te.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Nt(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}});var na=_("$ZodTransform",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new kt;return r.value=o,r}}),oa=_("$ZodOptional",(t,e)=>{te.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ne(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ne(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${yn(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),sa=_("$ZodNullable",(t,e)=>{te.init(t,e),ne(t._zod,"optin",()=>e.innerType._zod.optin),ne(t._zod,"optout",()=>e.innerType._zod.optout),ne(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${yn(r.source)}|null)$`):void 0}),ne(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),ia=_("$ZodDefault",(t,e)=>{te.init(t,e),t._zod.optin="optional",ne(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Td(s,e)):Td(o,e)}});function Td(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var aa=_("$ZodPrefault",(t,e)=>{te.init(t,e),t._zod.optin="optional",ne(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),ca=_("$ZodNonOptional",(t,e)=>{te.init(t,e),ne(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>Rd(s,t)):Rd(o,t)}});function Rd(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var ua=_("$ZodCatch",(t,e)=>{te.init(t,e),t._zod.optin="optional",ne(t._zod,"optout",()=>e.innerType._zod.optout),ne(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Xe(i,n,Ye()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>Xe(s,n,Ye()))},input:r.value}),r.issues=[]),r)}});var la=_("$ZodPipe",(t,e)=>{te.init(t,e),ne(t._zod,"values",()=>e.in._zod.values),ne(t._zod,"optin",()=>e.in._zod.optin),ne(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Id(s,e,n)):Id(o,e,n)}});function Id(t,e,r){return pr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var da=_("$ZodReadonly",(t,e)=>{te.init(t,e),ne(t._zod,"propValues",()=>e.innerType._zod.propValues),ne(t._zod,"values",()=>e.innerType._zod.values),ne(t._zod,"optin",()=>e.innerType._zod.optin),ne(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(Zd):Zd(o)}});function Zd(t){return t.value=Object.freeze(t.value),t}var pa=_("$ZodCustom",(t,e)=>{be.init(t,e),te.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(s=>Od(s,r,n,t));Od(o,r,n,t)}});function Od(t,e,r,n){if(!t){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),e.issues.push(mi(o))}}var ky=Symbol("ZodOutput"),Sy=Symbol("ZodInput"),wn=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Dd(){return new wn}var jt=Dd();function fa(t,e){return new t({type:"string",...C(e)})}function ma(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...C(e)})}function So(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...C(e)})}function ha(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...C(e)})}function ga(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...C(e)})}function _a(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...C(e)})}function ya(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...C(e)})}function va(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...C(e)})}function ba(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...C(e)})}function xa(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...C(e)})}function $a(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...C(e)})}function wa(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...C(e)})}function ka(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...C(e)})}function Sa(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...C(e)})}function za(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...C(e)})}function Pa(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...C(e)})}function Ea(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...C(e)})}function Ta(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...C(e)})}function Ra(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...C(e)})}function Ia(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...C(e)})}function Za(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...C(e)})}function Oa(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...C(e)})}function Ca(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...C(e)})}function qd(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...C(e)})}function Ld(t,e){return new t({type:"string",format:"date",check:"string_format",...C(e)})}function Ud(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...C(e)})}function Vd(t,e){return new t({type:"string",format:"duration",check:"string_format",...C(e)})}function Na(t,e){return new t({type:"number",checks:[],...C(e)})}function ja(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...C(e)})}function Aa(t,e){return new t({type:"boolean",...C(e)})}function Ma(t){return new t({type:"unknown"})}function Da(t,e){return new t({type:"never",...C(e)})}function zo(t,e){return new Si({check:"less_than",...C(e),value:t,inclusive:!1})}function kn(t,e){return new Si({check:"less_than",...C(e),value:t,inclusive:!0})}function Po(t,e){return new zi({check:"greater_than",...C(e),value:t,inclusive:!1})}function Sn(t,e){return new zi({check:"greater_than",...C(e),value:t,inclusive:!0})}function Eo(t,e){return new dd({check:"multiple_of",...C(e),value:t})}function To(t,e){return new fd({check:"max_length",...C(e),maximum:t})}function Dr(t,e){return new md({check:"min_length",...C(e),minimum:t})}function Ro(t,e){return new hd({check:"length_equals",...C(e),length:t})}function qa(t,e){return new gd({check:"string_format",format:"regex",...C(e),pattern:t})}function La(t){return new _d({check:"string_format",format:"lowercase",...C(t)})}function Ua(t){return new yd({check:"string_format",format:"uppercase",...C(t)})}function Va(t,e){return new vd({check:"string_format",format:"includes",...C(e),includes:t})}function Fa(t,e){return new bd({check:"string_format",format:"starts_with",...C(e),prefix:t})}function Ba(t,e){return new xd({check:"string_format",format:"ends_with",...C(e),suffix:t})}function hr(t){return new $d({check:"overwrite",tx:t})}function Ha(t){return hr(e=>e.normalize(t))}function Ka(){return hr(t=>t.trim())}function Wa(){return hr(t=>t.toLowerCase())}function Ja(){return hr(t=>t.toUpperCase())}function Fd(t,e,r){return new t({type:"array",element:e,...C(r)})}function Ga(t,e,r){let n=C(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function Ya(t,e,r){return new t({type:"custom",check:"custom",fn:e,...C(r)})}var Io=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??jt,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.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};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},h=e._zod.parent;if(h)a.ref=h,this.process(h,d),this.seen.get(h).isParent=!0;else{let m=a.schema;switch(o.type){case"string":{let p=m;p.type="string";let{minimum:f,maximum:g,format:v,patterns:$,contentEncoding:w}=e._zod.bag;if(typeof f=="number"&&(p.minLength=f),typeof g=="number"&&(p.maxLength=g),v&&(p.format=s[v]??v,p.format===""&&delete p.format),w&&(p.contentEncoding=w),$&&$.size>0){let P=[...$];P.length===1?p.pattern=P[0].source:P.length>1&&(a.schema.allOf=[...P.map(R=>({...this.target==="draft-7"?{type:"string"}:{},pattern:R.source}))])}break}case"number":{let p=m,{minimum:f,maximum:g,format:v,multipleOf:$,exclusiveMaximum:w,exclusiveMinimum:P}=e._zod.bag;typeof v=="string"&&v.includes("int")?p.type="integer":p.type="number",typeof P=="number"&&(p.exclusiveMinimum=P),typeof f=="number"&&(p.minimum=f,typeof P=="number"&&(P>=f?delete p.minimum:delete p.exclusiveMinimum)),typeof w=="number"&&(p.exclusiveMaximum=w),typeof g=="number"&&(p.maximum=g,typeof w=="number"&&(w<=g?delete p.maximum:delete p.exclusiveMaximum)),typeof $=="number"&&(p.multipleOf=$);break}case"boolean":{let p=m;p.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{m.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{m.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let p=m,{minimum:f,maximum:g}=e._zod.bag;typeof f=="number"&&(p.minItems=f),typeof g=="number"&&(p.maxItems=g),p.type="array",p.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let p=m;p.type="object",p.properties={};let f=o.shape;for(let $ in f)p.properties[$]=this.process(f[$],{...d,path:[...d.path,"properties",$]});let g=new Set(Object.keys(f)),v=new Set([...g].filter($=>{let w=o.shape[$]._zod;return this.io==="input"?w.optin===void 0:w.optout===void 0}));v.size>0&&(p.required=Array.from(v)),o.catchall?._zod.def.type==="never"?p.additionalProperties=!1:o.catchall?o.catchall&&(p.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(p.additionalProperties=!1);break}case"union":{let p=m;p.anyOf=o.options.map((f,g)=>this.process(f,{...d,path:[...d.path,"anyOf",g]}));break}case"intersection":{let p=m,f=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),g=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=w=>"allOf"in w&&Object.keys(w).length===1,$=[...v(f)?f.allOf:[f],...v(g)?g.allOf:[g]];p.allOf=$;break}case"tuple":{let p=m;p.type="array";let f=o.items.map(($,w)=>this.process($,{...d,path:[...d.path,"prefixItems",w]}));if(this.target==="draft-2020-12"?p.prefixItems=f:p.items=f,o.rest){let $=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?p.items=$:p.additionalItems=$}o.rest&&(p.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:g,maximum:v}=e._zod.bag;typeof g=="number"&&(p.minItems=g),typeof v=="number"&&(p.maxItems=v);break}case"record":{let p=m;p.type="object",p.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),p.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let p=m,f=hn(o.entries);f.every(g=>typeof g=="number")&&(p.type="number"),f.every(g=>typeof g=="string")&&(p.type="string"),p.enum=f;break}case"literal":{let p=m,f=[];for(let g of o.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");f.push(Number(g))}else f.push(g);if(f.length!==0)if(f.length===1){let g=f[0];p.type=g===null?"null":typeof g,p.const=g}else f.every(g=>typeof g=="number")&&(p.type="number"),f.every(g=>typeof g=="string")&&(p.type="string"),f.every(g=>typeof g=="boolean")&&(p.type="string"),f.every(g=>g===null)&&(p.type="null"),p.enum=f;break}case"file":{let p=m,f={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:v,mime:$}=e._zod.bag;g!==void 0&&(f.minLength=g),v!==void 0&&(f.maxLength=v),$?$.length===1?(f.contentMediaType=$[0],Object.assign(p,f)):p.anyOf=$.map(w=>({...f,contentMediaType:w})):Object.assign(p,f);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let p=this.process(o.innerType,d);m.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let p=m;p.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,m.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(m._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let p;try{p=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}m.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let p=m,f=e._zod.pattern;if(!f)throw new Error("Pattern not found in template literal");p.type="string",p.pattern=f.source;break}case"pipe":{let p=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(p,d),a.ref=p;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,m.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let p=e._zod.innerType;this.process(p,d),a.ref=p;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&_e(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let s=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let f=n.external.registry.get(l[0])?.id,g=n.external.uri??($=>$);if(f)return{ref:g(f)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${g("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let m=`#/${d}/`,p=l[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:m+p}},i=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:h,defId:m}=s(l);d.def={...d.schema},m&&(d.defId=m);let p=d.schema;for(let f in p)delete p[f];p.$ref=h};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
67
+
68
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){i(l);continue}if(n.external){let m=n.external.registry.get(l[0])?.id;if(e!==l[0]&&m){i(l);continue}}if(this.metadataRegistry.get(l[0])?.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&n.reused==="ref"){i(l);continue}}let a=(l,d)=>{let h=this.seen.get(l),m=h.def??h.schema,p={...m};if(h.ref===null)return;let f=h.ref;if(h.ref=null,f){a(f,d);let g=this.seen.get(f).schema;g.$ref&&d.target==="draft-7"?(m.allOf=m.allOf??[],m.allOf.push(g)):(Object.assign(m,g),Object.assign(m,p))}h.isParent||this.override({zodSchema:l,jsonSchema:m,path:h.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function Xa(t,e){if(t instanceof wn){let n=new Io(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let s={},i={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;s[c]=n.emit(u,{...e,external:i})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:o}}return{schemas:s}}let r=new Io(e);return r.process(t),r.emit(t,e)}function _e(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return _e(o.element,r);case"object":{for(let s in o.shape)if(_e(o.shape[s],r))return!0;return!1}case"union":{for(let s of o.options)if(_e(s,r))return!0;return!1}case"intersection":return _e(o.left,r)||_e(o.right,r);case"tuple":{for(let s of o.items)if(_e(s,r))return!0;return!!(o.rest&&_e(o.rest,r))}case"record":return _e(o.keyType,r)||_e(o.valueType,r);case"map":return _e(o.keyType,r)||_e(o.valueType,r);case"set":return _e(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return _e(o.innerType,r);case"lazy":return _e(o.getter(),r);case"default":return _e(o.innerType,r);case"prefault":return _e(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return _e(o.in,r)||_e(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var uv=_("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");te.init(t,e),t.def=e,t.parse=(r,n)=>yi(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>fr(t,r,n),t.parseAsync=async(r,n)=>bi(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>mr(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Me(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t)});var lv=_("ZodMiniObject",(t,e)=>{wo.init(t,e),uv.init(t,e),B.defineLazy(t,"shape",()=>e.shape)});function Qa(t,e){let r={type:"object",get shape(){return B.assignProp(this,"shape",{...t}),this.shape},...B.normalizeParams(e)};return new lv(r)}function Qe(t){return!!t._zod}function Lr(t){let e=Object.values(t);if(e.length===0)return Qa({});let r=e.every(Qe),n=e.every(o=>!Qe(o));if(r)return Qa(t);if(n)return oi(t);throw new Error("Mixed Zod versions detected in object shape.")}function Zo(t,e){return Qe(t)?fr(t,e):t.safeParse(e)}async function Oo(t,e){return Qe(t)?await mr(t,e):await t.safeParseAsync(e)}function Ur(t){var e,r;if(!t)return;let n;if(Qe(t)?n=(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.shape:n=t.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function Vr(t){var e;if(t){if(typeof t=="object"){let r=t,n=t;if(!r._def&&!n._zod){let o=Object.values(t);if(o.length>0&&o.every(s=>typeof s=="object"&&s!==null&&(s._def!==void 0||s._zod!==void 0||typeof s.parse=="function")))return Lr(t)}}if(Qe(t)){let n=(e=t._zod)===null||e===void 0?void 0:e.def;if(n&&(n.typeName==="object"||n.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function Co(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Bd(t){var e,r,n,o;if(Qe(t))return(r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.description;let s=t;return(n=t.description)!==null&&n!==void 0?n:(o=s._def)===null||o===void 0?void 0:o.description}function Hd(t){var e,r,n;if(Qe(t))return((r=(e=t._zod)===null||e===void 0?void 0:e.def)===null||r===void 0?void 0:r.typeName)==="ZodOptional";let o=t;return typeof t.isOptional=="function"?t.isOptional():((n=o._def)===null||n===void 0?void 0:n.typeName)==="ZodOptional"}function No(t){var e;if(Qe(t)){let i=(e=t._zod)===null||e===void 0?void 0:e.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 n=t._def;if(n){if(n.value!==void 0)return n.value;if(Array.isArray(n.values)&&n.values.length>0)return n.values[0]}let o=t.value;if(o!==void 0)return o}var _v=_("ZodISODateTime",(t,e)=>{Cd.init(t,e),ce.init(t,e)});function Kd(t){return qd(_v,t)}var yv=_("ZodISODate",(t,e)=>{Nd.init(t,e),ce.init(t,e)});function Wd(t){return Ld(yv,t)}var vv=_("ZodISOTime",(t,e)=>{jd.init(t,e),ce.init(t,e)});function Jd(t){return Ud(vv,t)}var bv=_("ZodISODuration",(t,e)=>{Ad.init(t,e),ce.init(t,e)});function Gd(t){return Vd(bv,t)}var Yd=(t,e)=>{yo.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>gi(t,r)},flatten:{value:r=>hi(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},VE=_("ZodError",Yd),zn=_("ZodError",Yd,{Parent:Error});var Xd=_i(zn),Qd=vi(zn),ep=xi(zn),tp=$i(zn);var fe=_("ZodType",(t,e)=>(te.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Me(t,r,n),t.brand=()=>t,t.register=(r,n)=>(r.add(t,n),t),t.parse=(r,n)=>Xd(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>ep(t,r,n),t.parseAsync=async(r,n)=>Qd(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>tp(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(db(r,n)),t.superRefine=r=>t.check(pb(r)),t.overwrite=r=>t.check(hr(r)),t.optional=()=>L(t),t.nullable=()=>op(t),t.nullish=()=>L(op(t)),t.nonoptional=r=>ob(t,r),t.array=()=>J(t),t.or=r=>de([t,r]),t.and=r=>Ao(t,r),t.transform=r=>tc(t,lp(r)),t.default=r=>tb(t,r),t.prefault=r=>nb(t,r),t.catch=r=>ib(t,r),t.pipe=r=>tc(t,r),t.readonly=()=>ub(t),t.describe=r=>{let n=t.clone();return jt.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return jt.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return jt.get(t);let n=t.clone();return jt.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),sp=_("_ZodString",(t,e)=>{$n.init(t,e),fe.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(qa(...n)),t.includes=(...n)=>t.check(Va(...n)),t.startsWith=(...n)=>t.check(Fa(...n)),t.endsWith=(...n)=>t.check(Ba(...n)),t.min=(...n)=>t.check(Dr(...n)),t.max=(...n)=>t.check(To(...n)),t.length=(...n)=>t.check(Ro(...n)),t.nonempty=(...n)=>t.check(Dr(1,...n)),t.lowercase=n=>t.check(La(n)),t.uppercase=n=>t.check(Ua(n)),t.trim=()=>t.check(Ka()),t.normalize=(...n)=>t.check(Ha(...n)),t.toLowerCase=()=>t.check(Wa()),t.toUpperCase=()=>t.check(Ja())}),kv=_("ZodString",(t,e)=>{$n.init(t,e),sp.init(t,e),t.email=r=>t.check(ma(Sv,r)),t.url=r=>t.check(va(zv,r)),t.jwt=r=>t.check(Ca(Lv,r)),t.emoji=r=>t.check(ba(Pv,r)),t.guid=r=>t.check(So(rp,r)),t.uuid=r=>t.check(ha(jo,r)),t.uuidv4=r=>t.check(ga(jo,r)),t.uuidv6=r=>t.check(_a(jo,r)),t.uuidv7=r=>t.check(ya(jo,r)),t.nanoid=r=>t.check(xa(Ev,r)),t.guid=r=>t.check(So(rp,r)),t.cuid=r=>t.check($a(Tv,r)),t.cuid2=r=>t.check(wa(Rv,r)),t.ulid=r=>t.check(ka(Iv,r)),t.base64=r=>t.check(Ia(Mv,r)),t.base64url=r=>t.check(Za(Dv,r)),t.xid=r=>t.check(Sa(Zv,r)),t.ksuid=r=>t.check(za(Ov,r)),t.ipv4=r=>t.check(Pa(Cv,r)),t.ipv6=r=>t.check(Ea(Nv,r)),t.cidrv4=r=>t.check(Ta(jv,r)),t.cidrv6=r=>t.check(Ra(Av,r)),t.e164=r=>t.check(Oa(qv,r)),t.datetime=r=>t.check(Kd(r)),t.date=r=>t.check(Wd(r)),t.time=r=>t.check(Jd(r)),t.duration=r=>t.check(Gd(r))});function y(t){return fa(kv,t)}var ce=_("ZodStringFormat",(t,e)=>{oe.init(t,e),sp.init(t,e)}),Sv=_("ZodEmail",(t,e)=>{Ri.init(t,e),ce.init(t,e)});var rp=_("ZodGUID",(t,e)=>{Ei.init(t,e),ce.init(t,e)});var jo=_("ZodUUID",(t,e)=>{Ti.init(t,e),ce.init(t,e)});var zv=_("ZodURL",(t,e)=>{Ii.init(t,e),ce.init(t,e)});var Pv=_("ZodEmoji",(t,e)=>{Zi.init(t,e),ce.init(t,e)});var Ev=_("ZodNanoID",(t,e)=>{Oi.init(t,e),ce.init(t,e)});var Tv=_("ZodCUID",(t,e)=>{Ci.init(t,e),ce.init(t,e)});var Rv=_("ZodCUID2",(t,e)=>{Ni.init(t,e),ce.init(t,e)});var Iv=_("ZodULID",(t,e)=>{ji.init(t,e),ce.init(t,e)});var Zv=_("ZodXID",(t,e)=>{Ai.init(t,e),ce.init(t,e)});var Ov=_("ZodKSUID",(t,e)=>{Mi.init(t,e),ce.init(t,e)});var Cv=_("ZodIPv4",(t,e)=>{Di.init(t,e),ce.init(t,e)});var Nv=_("ZodIPv6",(t,e)=>{qi.init(t,e),ce.init(t,e)});var jv=_("ZodCIDRv4",(t,e)=>{Li.init(t,e),ce.init(t,e)});var Av=_("ZodCIDRv6",(t,e)=>{Ui.init(t,e),ce.init(t,e)});var Mv=_("ZodBase64",(t,e)=>{Vi.init(t,e),ce.init(t,e)});var Dv=_("ZodBase64URL",(t,e)=>{Fi.init(t,e),ce.init(t,e)});var qv=_("ZodE164",(t,e)=>{Bi.init(t,e),ce.init(t,e)});var Lv=_("ZodJWT",(t,e)=>{Hi.init(t,e),ce.init(t,e)});var ip=_("ZodNumber",(t,e)=>{$o.init(t,e),fe.init(t,e),t.gt=(n,o)=>t.check(Po(n,o)),t.gte=(n,o)=>t.check(Sn(n,o)),t.min=(n,o)=>t.check(Sn(n,o)),t.lt=(n,o)=>t.check(zo(n,o)),t.lte=(n,o)=>t.check(kn(n,o)),t.max=(n,o)=>t.check(kn(n,o)),t.int=n=>t.check(np(n)),t.safe=n=>t.check(np(n)),t.positive=n=>t.check(Po(0,n)),t.nonnegative=n=>t.check(Sn(0,n)),t.negative=n=>t.check(zo(0,n)),t.nonpositive=n=>t.check(kn(0,n)),t.multipleOf=(n,o)=>t.check(Eo(n,o)),t.step=(n,o)=>t.check(Eo(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function me(t){return Na(ip,t)}var Uv=_("ZodNumberFormat",(t,e)=>{Ki.init(t,e),ip.init(t,e)});function np(t){return ja(Uv,t)}var Vv=_("ZodBoolean",(t,e)=>{Wi.init(t,e),fe.init(t,e)});function xe(t){return Aa(Vv,t)}var Fv=_("ZodUnknown",(t,e)=>{Ji.init(t,e),fe.init(t,e)});function pe(){return Ma(Fv)}var Bv=_("ZodNever",(t,e)=>{Gi.init(t,e),fe.init(t,e)});function Hv(t){return Da(Bv,t)}var Kv=_("ZodArray",(t,e)=>{Yi.init(t,e),fe.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(Dr(r,n)),t.nonempty=r=>t.check(Dr(1,r)),t.max=(r,n)=>t.check(To(r,n)),t.length=(r,n)=>t.check(Ro(r,n)),t.unwrap=()=>t.element});function J(t,e){return Fd(Kv,t,e)}var ap=_("ZodObject",(t,e)=>{wo.init(t,e),fe.init(t,e),B.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Fe(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:pe()}),t.loose=()=>t.clone({...t._zod.def,catchall:pe()}),t.strict=()=>t.clone({...t._zod.def,catchall:Hv()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>B.extend(t,r),t.merge=r=>B.merge(t,r),t.pick=r=>B.pick(t,r),t.omit=r=>B.omit(t,r),t.partial=(...r)=>B.partial(dp,t,r[0]),t.required=(...r)=>B.required(pp,t,r[0])});function E(t,e){let r={type:"object",get shape(){return B.assignProp(this,"shape",{...t}),this.shape},...B.normalizeParams(e)};return new ap(r)}function St(t,e){return new ap({type:"object",get shape(){return B.assignProp(this,"shape",{...t}),this.shape},catchall:pe(),...B.normalizeParams(e)})}var cp=_("ZodUnion",(t,e)=>{ko.init(t,e),fe.init(t,e),t.options=e.options});function de(t,e){return new cp({type:"union",options:t,...B.normalizeParams(e)})}var Wv=_("ZodDiscriminatedUnion",(t,e)=>{cp.init(t,e),Xi.init(t,e)});function up(t,e,r){return new Wv({type:"union",options:e,discriminator:t,...B.normalizeParams(r)})}var Jv=_("ZodIntersection",(t,e)=>{Qi.init(t,e),fe.init(t,e)});function Ao(t,e){return new Jv({type:"intersection",left:t,right:e})}var Gv=_("ZodRecord",(t,e)=>{ea.init(t,e),fe.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function he(t,e,r){return new Gv({type:"record",keyType:t,valueType:e,...B.normalizeParams(r)})}var ec=_("ZodEnum",(t,e)=>{ta.init(t,e),fe.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new ec({...e,checks:[],...B.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new ec({...e,checks:[],...B.normalizeParams(o),entries:s})}});function Fe(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new ec({type:"enum",entries:r,...B.normalizeParams(e)})}var Yv=_("ZodLiteral",(t,e)=>{ra.init(t,e),fe.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Z(t,e){return new Yv({type:"literal",values:Array.isArray(t)?t:[t],...B.normalizeParams(e)})}var Xv=_("ZodTransform",(t,e)=>{na.init(t,e),fe.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(B.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(B.issue(i))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function lp(t){return new Xv({type:"transform",transform:t})}var dp=_("ZodOptional",(t,e)=>{oa.init(t,e),fe.init(t,e),t.unwrap=()=>t._zod.def.innerType});function L(t){return new dp({type:"optional",innerType:t})}var Qv=_("ZodNullable",(t,e)=>{sa.init(t,e),fe.init(t,e),t.unwrap=()=>t._zod.def.innerType});function op(t){return new Qv({type:"nullable",innerType:t})}var eb=_("ZodDefault",(t,e)=>{ia.init(t,e),fe.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function tb(t,e){return new eb({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var rb=_("ZodPrefault",(t,e)=>{aa.init(t,e),fe.init(t,e),t.unwrap=()=>t._zod.def.innerType});function nb(t,e){return new rb({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var pp=_("ZodNonOptional",(t,e)=>{ca.init(t,e),fe.init(t,e),t.unwrap=()=>t._zod.def.innerType});function ob(t,e){return new pp({type:"nonoptional",innerType:t,...B.normalizeParams(e)})}var sb=_("ZodCatch",(t,e)=>{ua.init(t,e),fe.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function ib(t,e){return new sb({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var ab=_("ZodPipe",(t,e)=>{la.init(t,e),fe.init(t,e),t.in=e.in,t.out=e.out});function tc(t,e){return new ab({type:"pipe",in:t,out:e})}var cb=_("ZodReadonly",(t,e)=>{da.init(t,e),fe.init(t,e)});function ub(t){return new cb({type:"readonly",innerType:t})}var fp=_("ZodCustom",(t,e)=>{pa.init(t,e),fe.init(t,e)});function lb(t){let e=new be({check:"custom"});return e._zod.check=t,e}function mp(t,e){return Ga(fp,t??(()=>!0),e)}function db(t,e={}){return Ya(fp,t,e)}function pb(t){let e=lb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(B.issue(n,r.value,e._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=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(B.issue(o))}},t(r.value,r)));return e}function hp(t,e){return tc(lp(t),e)}var nc="2025-06-18";var gp=[nc,"2025-03-26","2024-11-05","2024-10-07"],Do="2.0",ft=mp(t=>t!==null&&(typeof t=="object"||typeof t=="function")),_p=de([y(),me().int()]),yp=y(),fb=St({progressToken:_p.optional()}),et=St({_meta:fb.optional()}),Oe=E({method:y(),params:et.optional()}),Br=St({_meta:he(y(),pe()).optional()}),tt=E({method:y(),params:Br.optional()}),Be=St({_meta:he(y(),pe()).optional()}),qo=de([y(),me().int()]),vp=E({jsonrpc:Z(Do),id:qo,...Oe.shape}).strict(),bp=t=>vp.safeParse(t).success,xp=E({jsonrpc:Z(Do),...tt.shape}).strict(),$p=t=>xp.safeParse(t).success,wp=E({jsonrpc:Z(Do),id:qo,result:Be}).strict(),oc=t=>wp.safeParse(t).success,X;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(X||(X={}));var kp=E({jsonrpc:Z(Do),id:qo,error:E({code:me().int(),message:y(),data:L(pe())})}).strict(),Sp=t=>kp.safeParse(t).success,zp=de([vp,xp,wp,kp]),Lo=Be.strict(),mb=Br.extend({requestId:qo,reason:y().optional()}),Uo=tt.extend({method:Z("notifications/cancelled"),params:mb}),hb=E({src:y(),mimeType:y().optional(),sizes:J(y()).optional()}),Pn=E({icons:J(hb).optional()}),Fr=E({name:y(),title:y().optional()}),Pp=Fr.extend({...Fr.shape,...Pn.shape,version:y(),websiteUrl:y().optional()}),gb=Ao(E({applyDefaults:xe().optional()}),he(y(),pe())),_b=hp(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Ao(E({form:gb.optional(),url:ft.optional()}),he(y(),pe()).optional())),yb=E({experimental:he(y(),ft).optional(),sampling:E({context:ft.optional(),tools:ft.optional()}).optional(),elicitation:_b.optional(),roots:E({listChanged:xe().optional()}).optional()}),vb=et.extend({protocolVersion:y(),capabilities:yb,clientInfo:Pp}),sc=Oe.extend({method:Z("initialize"),params:vb});var bb=E({experimental:he(y(),ft).optional(),logging:ft.optional(),completions:ft.optional(),prompts:L(E({listChanged:L(xe())})),resources:E({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:E({listChanged:xe().optional()}).optional()}),xb=Be.extend({protocolVersion:y(),capabilities:bb,serverInfo:Pp,instructions:y().optional()}),ic=tt.extend({method:Z("notifications/initialized")});var Vo=Oe.extend({method:Z("ping")}),$b=E({progress:me(),total:L(me()),message:L(y())}),wb=E({...Br.shape,...$b.shape,progressToken:_p}),Fo=tt.extend({method:Z("notifications/progress"),params:wb}),kb=et.extend({cursor:yp.optional()}),Bo=Oe.extend({params:kb.optional()}),Ho=Be.extend({nextCursor:L(yp)}),Ep=E({uri:y(),mimeType:L(y()),_meta:he(y(),pe()).optional()}),Tp=Ep.extend({text:y()}),ac=y().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Rp=Ep.extend({blob:ac}),Ip=E({...Fr.shape,...Pn.shape,uri:y(),description:L(y()),mimeType:L(y()),_meta:L(St({}))}),Sb=E({...Fr.shape,...Pn.shape,uriTemplate:y(),description:L(y()),mimeType:L(y()),_meta:L(St({}))}),Ko=Bo.extend({method:Z("resources/list")}),zb=Ho.extend({resources:J(Ip)}),Wo=Bo.extend({method:Z("resources/templates/list")}),Pb=Ho.extend({resourceTemplates:J(Sb)}),cc=et.extend({uri:y()}),Eb=cc,Jo=Oe.extend({method:Z("resources/read"),params:Eb}),Tb=Be.extend({contents:J(de([Tp,Rp]))}),Rb=tt.extend({method:Z("notifications/resources/list_changed")}),Ib=cc,Zb=Oe.extend({method:Z("resources/subscribe"),params:Ib}),Ob=cc,Cb=Oe.extend({method:Z("resources/unsubscribe"),params:Ob}),Nb=Br.extend({uri:y()}),jb=tt.extend({method:Z("notifications/resources/updated"),params:Nb}),Ab=E({name:y(),description:L(y()),required:L(xe())}),Mb=E({...Fr.shape,...Pn.shape,description:L(y()),arguments:L(J(Ab)),_meta:L(St({}))}),Go=Bo.extend({method:Z("prompts/list")}),Db=Ho.extend({prompts:J(Mb)}),qb=et.extend({name:y(),arguments:he(y(),y()).optional()}),Yo=Oe.extend({method:Z("prompts/get"),params:qb}),Zp=E({type:Z("text"),text:y(),_meta:he(y(),pe()).optional()}),Op=E({type:Z("image"),data:ac,mimeType:y(),_meta:he(y(),pe()).optional()}),Cp=E({type:Z("audio"),data:ac,mimeType:y(),_meta:he(y(),pe()).optional()}),Lb=E({type:Z("tool_use"),name:y(),id:y(),input:E({}).passthrough(),_meta:L(E({}).passthrough())}).passthrough(),Ub=E({type:Z("resource"),resource:de([Tp,Rp]),_meta:he(y(),pe()).optional()}),Vb=Ip.extend({type:Z("resource_link")}),uc=de([Zp,Op,Cp,Vb,Ub]),Fb=E({role:Fe(["user","assistant"]),content:uc}),Bb=Be.extend({description:L(y()),messages:J(Fb)}),Hb=tt.extend({method:Z("notifications/prompts/list_changed")}),Kb=E({title:y().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),Np=E({...Fr.shape,...Pn.shape,description:y().optional(),inputSchema:E({type:Z("object"),properties:he(y(),ft).optional(),required:J(y()).optional()}).catchall(pe()),outputSchema:E({type:Z("object"),properties:he(y(),ft).optional(),required:J(y()).optional()}).catchall(pe()).optional(),annotations:L(Kb),_meta:he(y(),pe()).optional()}),Xo=Bo.extend({method:Z("tools/list")}),Wb=Ho.extend({tools:J(Np)}),jp=Be.extend({content:J(uc).default([]),structuredContent:he(y(),pe()).optional(),isError:L(xe())}),WE=jp.or(Be.extend({toolResult:pe()})),Jb=et.extend({name:y(),arguments:L(he(y(),pe()))}),Qo=Oe.extend({method:Z("tools/call"),params:Jb}),Gb=tt.extend({method:Z("notifications/tools/list_changed")}),En=Fe(["debug","info","notice","warning","error","critical","alert","emergency"]),Yb=et.extend({level:En}),lc=Oe.extend({method:Z("logging/setLevel"),params:Yb}),Xb=Br.extend({level:En,logger:y().optional(),data:pe()}),Qb=tt.extend({method:Z("notifications/message"),params:Xb}),e0=E({name:y().optional()}),t0=E({hints:L(J(e0)),costPriority:L(me().min(0).max(1)),speedPriority:L(me().min(0).max(1)),intelligencePriority:L(me().min(0).max(1))}),r0=E({mode:L(Fe(["auto","required","none"]))}),n0=E({type:Z("tool_result"),toolUseId:y().describe("The unique identifier for the corresponding tool call."),content:J(uc).default([]),structuredContent:E({}).passthrough().optional(),isError:L(xe()),_meta:L(E({}).passthrough())}).passthrough(),Mo=up("type",[Zp,Op,Cp,Lb,n0]),o0=E({role:Fe(["user","assistant"]),content:de([Mo,J(Mo)]),_meta:L(E({}).passthrough())}).passthrough(),s0=et.extend({messages:J(o0),modelPreferences:t0.optional(),systemPrompt:y().optional(),includeContext:Fe(["none","thisServer","allServers"]).optional(),temperature:me().optional(),maxTokens:me().int(),stopSequences:J(y()).optional(),metadata:ft.optional(),tools:L(J(Np)),toolChoice:L(r0)}),i0=Oe.extend({method:Z("sampling/createMessage"),params:s0}),dc=Be.extend({model:y(),stopReason:L(Fe(["endTurn","stopSequence","maxTokens","toolUse"]).or(y())),role:Fe(["user","assistant"]),content:de([Mo,J(Mo)])}),a0=E({type:Z("boolean"),title:y().optional(),description:y().optional(),default:xe().optional()}),c0=E({type:Z("string"),title:y().optional(),description:y().optional(),minLength:me().optional(),maxLength:me().optional(),format:Fe(["email","uri","date","date-time"]).optional(),default:y().optional()}),u0=E({type:Fe(["number","integer"]),title:y().optional(),description:y().optional(),minimum:me().optional(),maximum:me().optional(),default:me().optional()}),l0=E({type:Z("string"),title:y().optional(),description:y().optional(),enum:J(y()),default:y().optional()}),d0=E({type:Z("string"),title:y().optional(),description:y().optional(),oneOf:J(E({const:y(),title:y()})),default:y().optional()}),p0=E({type:Z("string"),title:y().optional(),description:y().optional(),enum:J(y()),enumNames:J(y()).optional(),default:y().optional()}),f0=de([l0,d0]),m0=E({type:Z("array"),title:y().optional(),description:y().optional(),minItems:me().optional(),maxItems:me().optional(),items:E({type:Z("string"),enum:J(y())}),default:J(y()).optional()}),h0=E({type:Z("array"),title:y().optional(),description:y().optional(),minItems:me().optional(),maxItems:me().optional(),items:E({anyOf:J(E({const:y(),title:y()}))}),default:J(y()).optional()}),g0=de([m0,h0]),_0=de([p0,f0,g0]),y0=de([_0,a0,c0,u0]),v0=et.extend({mode:Z("form").optional(),message:y(),requestedSchema:E({type:Z("object"),properties:he(y(),y0),required:J(y()).optional()})}),b0=et.extend({mode:Z("url"),message:y(),elicitationId:y(),url:y().url()}),x0=de([v0,b0]),$0=Oe.extend({method:Z("elicitation/create"),params:x0}),w0=Br.extend({elicitationId:y()}),k0=tt.extend({method:Z("notifications/elicitation/complete"),params:w0}),es=Be.extend({action:Fe(["accept","decline","cancel"]),content:he(y(),de([y(),me(),xe(),J(y())])).optional()}),S0=E({type:Z("ref/resource"),uri:y()});var z0=E({type:Z("ref/prompt"),name:y()}),P0=et.extend({ref:de([z0,S0]),argument:E({name:y(),value:y()}),context:E({arguments:he(y(),y()).optional()}).optional()}),ts=Oe.extend({method:Z("completion/complete"),params:P0});function Ap(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function Mp(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var E0=Be.extend({completion:St({values:J(y()).max(100),total:L(me().int()),hasMore:L(xe())})}),T0=E({uri:y().startsWith("file://"),name:y().optional(),_meta:he(y(),pe()).optional()}),R0=Oe.extend({method:Z("roots/list")}),pc=Be.extend({roots:J(T0)}),I0=tt.extend({method:Z("notifications/roots/list_changed")}),JE=de([Vo,sc,ts,lc,Yo,Go,Ko,Wo,Jo,Zb,Cb,Qo,Xo]),GE=de([Uo,Fo,ic,I0]),YE=de([Lo,dc,es,pc]),XE=de([Vo,i0,$0,R0]),QE=de([Uo,Fo,Qb,jb,Rb,Gb,Hb,k0]),eT=de([Lo,xb,E0,Bb,Db,zb,Pb,Tb,jp,Wb]),Q=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===X.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new rc(o.elicitations,r)}return new t(e,r,n)}},rc=class extends Q{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(X.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){var e,r;return(r=(e=this.data)===null||e===void 0?void 0:e.elicitations)!==null&&r!==void 0?r:[]}};var qp=Symbol("Let zodToJsonSchema decide on which parser to use");var Dp={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},Lp=t=>typeof t=="string"?{...Dp,name:t}:{...Dp,...t};var Up=t=>{let e=Lp(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function fc(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function H(t,e,r,n,o){t[e]=r,fc(t,e,n,o)}var rs=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function ue(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?rs(e,t.currentPath):e.join("/")}}function Vp(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==x.ZodAny&&(r.items=N(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&H(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&H(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(H(r,"minItems",t.exactLength.value,t.exactLength.message,e),H(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Fp(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?H(r,"minimum",n.value,n.message,e):H(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),H(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?H(r,"maximum",n.value,n.message,e):H(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),H(r,"maximum",n.value,n.message,e));break;case"multipleOf":H(r,"multipleOf",n.value,n.message,e);break}return r}function Bp(){return{type:"boolean"}}function ns(t,e){return N(t.type._def,e)}var Hp=(t,e)=>N(t.innerType._def,e);function mc(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>mc(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Z0(t,e)}}var Z0=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":H(r,"minimum",n.value,n.message,e);break;case"max":H(r,"maximum",n.value,n.message,e);break}return r};function Kp(t,e){return{...N(t.innerType._def,e),default:t.defaultValue()}}function Wp(t,e){return e.effectStrategy==="input"?N(t.schema._def,e):ue(e)}function Jp(t){return{type:"string",enum:Array.from(t.values)}}var O0=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Gp(t,e){let r=[N(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),N(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(O0(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function Yp(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var hc,rt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(hc===void 0&&(hc=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),hc),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function os(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":H(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":H(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":nt(r,"email",n.message,e);break;case"format:idn-email":nt(r,"idn-email",n.message,e);break;case"pattern:zod":Ee(r,rt.email,n.message,e);break}break;case"url":nt(r,"uri",n.message,e);break;case"uuid":nt(r,"uuid",n.message,e);break;case"regex":Ee(r,n.regex,n.message,e);break;case"cuid":Ee(r,rt.cuid,n.message,e);break;case"cuid2":Ee(r,rt.cuid2,n.message,e);break;case"startsWith":Ee(r,RegExp(`^${gc(n.value,e)}`),n.message,e);break;case"endsWith":Ee(r,RegExp(`${gc(n.value,e)}$`),n.message,e);break;case"datetime":nt(r,"date-time",n.message,e);break;case"date":nt(r,"date",n.message,e);break;case"time":nt(r,"time",n.message,e);break;case"duration":nt(r,"duration",n.message,e);break;case"length":H(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),H(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Ee(r,RegExp(gc(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&nt(r,"ipv4",n.message,e),n.version!=="v4"&&nt(r,"ipv6",n.message,e);break}case"base64url":Ee(r,rt.base64url,n.message,e);break;case"jwt":Ee(r,rt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Ee(r,rt.ipv4Cidr,n.message,e),n.version!=="v4"&&Ee(r,rt.ipv6Cidr,n.message,e);break}case"emoji":Ee(r,rt.emoji(),n.message,e);break;case"ulid":{Ee(r,rt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{nt(r,"binary",n.message,e);break}case"contentEncoding:base64":{H(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Ee(r,rt.base64,n.message,e);break}}break}case"nanoid":Ee(r,rt.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function gc(t,e){return e.patternStrategy==="escape"?N0(t):t}var C0=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function N0(t){let e="";for(let r=0;r<t.length;r++)C0.has(t[r])||(e+="\\"),e+=t[r];return e}function nt(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):H(t,"format",e,r,n)}function Ee(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Xp(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):H(t,"pattern",Xp(e,n),r,n)}function Xp(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(o+=n[c],a=!0):o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
69
+ ]))`;continue}else if(n[c]==="$"){o+=`($|(?=[\r
70
+ ]))`;continue}}if(r.s&&n[c]==="."){o+=i?`${n[c]}\r
71
+ `:`[${n[c]}\r
72
+ ]`;continue}o+=n[c],n[c]==="\\"?s=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}function ss(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===x.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:N(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??ue(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:N(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===x.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=os(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===x.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===x.ZodBranded&&t.keyType._def.type._def.typeName===x.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=ns(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function Qp(t,e){if(e.mapStrategy==="record")return ss(t,e);let r=N(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||ue(e),n=N(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||ue(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function ef(t){let e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),o=Array.from(new Set(n.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function tf(t){return t.target==="openAi"?void 0:{not:ue({...t,currentPath:[...t.currentPath,"not"]})}}function rf(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Tn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function of(t,e){if(e.target==="openApi3")return nf(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in Tn&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=Tn[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];case"symbol":case"undefined":case"function":default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(s=>!n.includes(s))],[])};return nf(t,e)}var nf=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>N(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function sf(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:Tn[t.innerType._def.typeName],nullable:!0}:{type:[Tn[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=N(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=N(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function af(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",fc(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?H(r,"minimum",n.value,n.message,e):H(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),H(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?H(r,"maximum",n.value,n.message,e):H(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),H(r,"maximum",n.value,n.message,e));break;case"multipleOf":H(r,"multipleOf",n.value,n.message,e);break}return r}function cf(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],s=t.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=A0(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=N(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let i=j0(t,e);return i!==void 0&&(n.additionalProperties=i),n}function j0(t,e){if(t.catchall._def.typeName!=="ZodNever")return N(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function A0(t){try{return t.isOptional()}catch{return!0}}var uf=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return N(t.innerType._def,e);let r=N(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:ue(e)},r]}:ue(e)};var lf=(t,e)=>{if(e.pipeStrategy==="input")return N(t.in._def,e);if(e.pipeStrategy==="output")return N(t.out._def,e);let r=N(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=N(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function df(t,e){return N(t.type._def,e)}function pf(t,e){let n={type:"array",uniqueItems:!0,items:N(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&H(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&H(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function ff(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>N(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:N(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>N(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function mf(t){return{not:ue(t)}}function hf(t){return ue(t)}var gf=(t,e)=>N(t.innerType._def,e);var _f=(t,e,r)=>{switch(e){case x.ZodString:return os(t,r);case x.ZodNumber:return af(t,r);case x.ZodObject:return cf(t,r);case x.ZodBigInt:return Fp(t,r);case x.ZodBoolean:return Bp();case x.ZodDate:return mc(t,r);case x.ZodUndefined:return mf(r);case x.ZodNull:return rf(r);case x.ZodArray:return Vp(t,r);case x.ZodUnion:case x.ZodDiscriminatedUnion:return of(t,r);case x.ZodIntersection:return Gp(t,r);case x.ZodTuple:return ff(t,r);case x.ZodRecord:return ss(t,r);case x.ZodLiteral:return Yp(t,r);case x.ZodEnum:return Jp(t);case x.ZodNativeEnum:return ef(t);case x.ZodNullable:return sf(t,r);case x.ZodOptional:return uf(t,r);case x.ZodMap:return Qp(t,r);case x.ZodSet:return pf(t,r);case x.ZodLazy:return()=>t.getter()._def;case x.ZodPromise:return df(t,r);case x.ZodNaN:case x.ZodNever:return tf(r);case x.ZodEffects:return Wp(t,r);case x.ZodAny:return ue(r);case x.ZodUnknown:return hf(r);case x.ZodDefault:return Kp(t,r);case x.ZodBranded:return ns(t,r);case x.ZodReadonly:return gf(t,r);case x.ZodCatch:return Hp(t,r);case x.ZodPipeline:return lf(t,r);case x.ZodFunction:case x.ZodVoid:case x.ZodSymbol:return;default:return(n=>{})(e)}};function N(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==qp)return a}if(n&&!r){let a=M0(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let s=_f(t,t.typeName,e),i=typeof s=="function"?N(s(),e):s;if(i&&D0(t,e,i),e.postProcess){let a=e.postProcess(i,t,e);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var M0=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:rs(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),ue(e)):e.$refStrategy==="seen"?ue(e):void 0}},D0=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var _c=(t,e)=>{let r=Up(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:N(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??ue(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=N(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??ue(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(s.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function q0(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function yc(t,e){var r,n,o;return Qe(t)?Xa(t,{target:q0(e?.target),io:(r=e?.pipeStrategy)!==null&&r!==void 0?r:"input"}):_c(t,{strictUnions:(n=e?.strictUnions)!==null&&n!==void 0?n:!0,pipeStrategy:(o=e?.pipeStrategy)!==null&&o!==void 0?o:"input"})}function vc(t){let e=Ur(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=No(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function bc(t,e){let r=Zo(t,e);if(!r.success)throw r.error;return r.data}var L0=6e4,is=class{constructor(e){this._options=e,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.setNotificationHandler(Uo,r=>{let n=this._requestHandlerAbortControllers.get(r.params.requestId);n?.abort(r.params.reason)}),this.setNotificationHandler(Fo,r=>{this._onprogress(r)}),this.setRequestHandler(Vo,r=>({}))}_setupTimeout(e,r,n,o,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),Q.fromError(X.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var r,n,o;this._transport=e;let s=(r=this.transport)===null||r===void 0?void 0:r.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};let i=(n=this.transport)===null||n===void 0?void 0:n.onerror;this._transport.onerror=c=>{i?.(c),this._onerror(c)};let a=(o=this._transport)===null||o===void 0?void 0:o.onmessage;this._transport.onmessage=(c,u)=>{a?.(c,u),oc(c)||Sp(c)?this._onresponse(c):bp(c)?this._onrequest(c,u):$p(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){var e;let r=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let n=Q.fromError(X.ConnectionClosed,"Connection closed");for(let o of r.values())o(n)}_onerror(e){var r;(r=this.onerror)===null||r===void 0||r.call(this,e)}_onnotification(e){var r;let n=(r=this._notificationHandlers.get(e.method))!==null&&r!==void 0?r:this.fallbackNotificationHandler;n!==void 0&&Promise.resolve().then(()=>n(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){var n,o;let s=(n=this._requestHandlers.get(e.method))!==null&&n!==void 0?n:this.fallbackRequestHandler,i=this._transport;if(s===void 0){i?.send({jsonrpc:"2.0",id:e.id,error:{code:X.MethodNotFound,message:"Method not found"}}).catch(u=>this._onerror(new Error(`Failed to send an error response: ${u}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let c={signal:a.signal,sessionId:i?.sessionId,_meta:(o=e.params)===null||o===void 0?void 0:o._meta,sendNotification:u=>this.notification(u,{relatedRequestId:e.id}),sendRequest:(u,l,d)=>this.request(u,l,{...d,relatedRequestId:e.id}),authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo};Promise.resolve().then(()=>s(e,c)).then(u=>{if(!a.signal.aborted)return i?.send({result:u,jsonrpc:"2.0",id:e.id})},u=>{var l;if(!a.signal.aborted)return i?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:X.InternalError,message:(l=u.message)!==null&&l!==void 0?l:"Internal error",...u.data!==void 0&&{data:u.data}}})}).catch(u=>this._onerror(new Error(`Failed to send response: ${u}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){i(c);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),oc(e))n(e);else{let o=Q.fromError(e.error.code,e.error.message,e.error.data);n(o)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}=n??{};return new Promise((a,c)=>{var u,l,d,h,m,p;if(!this._transport){c(new Error("Not connected"));return}((u=this._options)===null||u===void 0?void 0:u.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(l=n?.signal)===null||l===void 0||l.throwIfAborted();let f=this._requestMessageId++,g={...e,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),g.params={...e.params,_meta:{...((d=e.params)===null||d===void 0?void 0:d._meta)||{},progressToken:f}});let v=P=>{var R;this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),(R=this._transport)===null||R===void 0||R.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(P)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(le=>this._onerror(new Error(`Failed to send cancellation: ${le}`))),c(P)};this._responseHandlers.set(f,P=>{var R;if(!(!((R=n?.signal)===null||R===void 0)&&R.aborted)){if(P instanceof Error)return c(P);try{let le=Zo(r,P.result);le.success?a(le.data):c(le.error)}catch(le){c(le)}}}),(h=n?.signal)===null||h===void 0||h.addEventListener("abort",()=>{var P;v((P=n?.signal)===null||P===void 0?void 0:P.reason)});let $=(m=n?.timeout)!==null&&m!==void 0?m:L0,w=()=>v(Q.fromError(X.RequestTimeout,"Request timed out",{timeout:$}));this._setupTimeout(f,$,n?.maxTotalTimeout,w,(p=n?.resetTimeoutOnProgress)!==null&&p!==void 0?p:!1),this._transport.send(g,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(f),c(P)})})}async notification(e,r){var n,o;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((o=(n=this._options)===null||n===void 0?void 0:n.debouncedNotificationMethods)!==null&&o!==void 0?o:[]).includes(e.method)&&!e.params&&!r?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var c;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let u={...e,jsonrpc:"2.0"};(c=this._transport)===null||c===void 0||c.send(u,r).catch(l=>this._onerror(l))});return}let a={...e,jsonrpc:"2.0"};await this._transport.send(a,r)}setRequestHandler(e,r){let n=vc(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=bc(e,o);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=vc(e);this._notificationHandlers.set(n,o=>{let s=bc(e,o);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function yf(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function vf(t,e){let r={...t};for(let n in e){let o=n,s=e[o];if(s===void 0)continue;let i=r[o];yf(i)&&yf(s)?r[o]={...i,...s}:r[o]=s}return r}var sg=vl(sl(),1),ig=vl(og(),1);function Iz(){let t=new sg.Ajv({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,ig.default)(t),t}var Vs=class{constructor(e){this._ajv=e??Iz()}getValidator(e){var r;let n="$id"in e&&typeof e.$id=="string"?(r=this._ajv.getSchema(e.$id))!==null&&r!==void 0?r:this._ajv.compile(e):this._ajv.compile(e);return o=>n(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(n.errors)}}};var Fs=class extends is{constructor(e,r){var n,o;super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(En.options.map((s,i)=>[s,i])),this.isMessageIgnored=(s,i)=>{let a=this._loggingLevels.get(i);return a?this.LOG_LEVEL_SEVERITY.get(s)<this.LOG_LEVEL_SEVERITY.get(a):!1},this._capabilities=(n=r?.capabilities)!==null&&n!==void 0?n:{},this._instructions=r?.instructions,this._jsonSchemaValidator=(o=r?.jsonSchemaValidator)!==null&&o!==void 0?o:new Vs,this.setRequestHandler(sc,s=>this._oninitialize(s)),this.setNotificationHandler(ic,()=>{var s;return(s=this.oninitialized)===null||s===void 0?void 0:s.call(this)}),this._capabilities.logging&&this.setRequestHandler(lc,async(s,i)=>{var a;let c=i.sessionId||((a=i.requestInfo)===null||a===void 0?void 0:a.headers["mcp-session-id"])||void 0,{level:u}=s.params,l=En.safeParse(u);return l.success&&this._loggingLevels.set(c,l.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=vf(this._capabilities,e)}assertCapabilityForMethod(e){var r,n,o;switch(e){case"sampling/createMessage":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((n=this._clientCapabilities)===null||n===void 0)&&n.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((o=this._clientCapabilities)===null||o===void 0)&&o.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){var r,n;switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);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 ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!(!((n=(r=this._clientCapabilities)===null||r===void 0?void 0:r.elicitation)===null||n===void 0)&&n.url))throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:gp.includes(r)?r:nc,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"},Lo)}async createMessage(e,r){var n,o;if((e.tools||e.toolChoice)&&!(!((o=(n=this._clientCapabilities)===null||n===void 0?void 0:n.sampling)===null||o===void 0)&&o.tools))throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let s=e.messages[e.messages.length-1],i=Array.isArray(s.content)?s.content:[s.content],a=i.some(d=>d.type==="tool_result"),c=e.messages.length>1?e.messages[e.messages.length-2]:void 0,u=c?Array.isArray(c.content)?c.content:[c.content]:[],l=u.some(d=>d.type==="tool_use");if(a){if(i.some(d=>d.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!l)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(l){let d=new Set(u.filter(m=>m.type==="tool_use").map(m=>m.id)),h=new Set(i.filter(m=>m.type==="tool_result").map(m=>m.toolUseId));if(d.size!==h.size||![...d].every(m=>h.has(m)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.request({method:"sampling/createMessage",params:e},dc,r)}async elicitInput(e,r){var n,o,s,i,a;switch((n=e.mode)!==null&&n!==void 0?n:"form"){case"url":{if(!(!((s=(o=this._clientCapabilities)===null||o===void 0?void 0:o.elicitation)===null||s===void 0)&&s.url))throw new Error("Client does not support url elicitation.");let u=e;return this.request({method:"elicitation/create",params:u},es,r)}case"form":{if(!(!((a=(i=this._clientCapabilities)===null||i===void 0?void 0:i.elicitation)===null||a===void 0)&&a.form))throw new Error("Client does not support form elicitation.");let u=e.mode==="form"?e:{...e,mode:"form"},l=await this.request({method:"elicitation/create",params:u},es,r);if(l.action==="accept"&&l.content&&u.requestedSchema)try{let h=this._jsonSchemaValidator.getValidator(u.requestedSchema)(l.content);if(!h.valid)throw new Q(X.InvalidParams,`Elicitation response content does not match requested schema: ${h.errorMessage}`)}catch(d){throw d instanceof Q?d:new Q(X.InternalError,`Error validating elicitation response: ${d instanceof Error?d.message:String(d)}`)}return l}}}createElicitationCompletionNotifier(e,r){var n,o;if(!(!((o=(n=this._clientCapabilities)===null||n===void 0?void 0:n.elicitation)===null||o===void 0)&&o.url))throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},pc,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var cg=Symbol.for("mcp.completable");function ug(t){return!!t&&typeof t=="object"&&cg in t}function lg(t){let e=t[cg];return e?.complete}var ag;(function(t){t.Completable="McpCompletable"})(ag||(ag={}));var Zz=/^[A-Za-z0-9._-]{1,128}$/;function Oz(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!Zz.test(t)){let r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,s)=>s.indexOf(n)===o);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function Cz(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function fl(t){let e=Oz(t);return Cz(t,e.warnings),e.isValid}var Bs=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new Fs(e,r)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Bt(Xo)),this.server.assertCanSetRequestHandler(Bt(Qo)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Xo,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:(()=>{let o=Vr(r.inputSchema);return o?yc(o,{strictUnions:!0,pipeStrategy:"input"}):Nz})(),annotations:r.annotations,_meta:r._meta};if(r.outputSchema){let o=Vr(r.outputSchema);o&&(n.outputSchema=yc(o,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(Qo,async(e,r)=>{let n=this._registeredTools[e.params.name],o;try{if(!n)throw new Q(X.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new Q(X.InvalidParams,`Tool ${e.params.name} disabled`);if(n.inputSchema){let s=n.callback,i=Vr(n.inputSchema),a=i??n.inputSchema,c=await Oo(a,e.params.arguments);if(!c.success)throw new Q(X.InvalidParams,`Input validation error: Invalid arguments for tool ${e.params.name}: ${Co(c.error)}`);let u=c.data;o=await Promise.resolve(s(u,r))}else{let s=n.callback;o=await Promise.resolve(s(r))}if(n.outputSchema&&!o.isError){if(!o.structuredContent)throw new Q(X.InvalidParams,`Output validation error: Tool ${e.params.name} has an output schema but no structured content was provided`);let s=Vr(n.outputSchema),i=await Oo(s,o.structuredContent);if(!i.success)throw new Q(X.InvalidParams,`Output validation error: Invalid structured content for tool ${e.params.name}: ${Co(i.error)}`)}}catch(s){if(s instanceof Q&&s.code===X.UrlElicitationRequired)throw s;return this.createToolError(s instanceof Error?s.message:String(s))}return o}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(Bt(ts)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ts,async e=>{switch(e.params.ref.type){case"ref/prompt":return Ap(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return Mp(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Q(X.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new Q(X.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new Q(X.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return so;let o=Ur(n.argsSchema),s=o?.[e.params.argument.name];if(!ug(s))return so;let i=lg(s);if(!i)return so;let a=await i(e.params.argument.value,e.params.context);return pg(a)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return so;throw new Q(X.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=n.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return so;let s=await o(e.params.argument.value,e.params.context);return pg(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(Bt(Ko)),this.server.assertCanSetRequestHandler(Bt(Wo)),this.server.assertCanSetRequestHandler(Bt(Jo)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ko,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([s,i])=>i.enabled).map(([s,i])=>({uri:s,name:i.name,...i.metadata})),o=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let i=await s.resourceTemplate.listCallback(r);for(let a of i.resources)o.push({...s.metadata,...a})}return{resources:[...n,...o]}}),this.server.setRequestHandler(Wo,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Jo,async(e,r)=>{let n=new URL(e.params.uri),o=this._registeredResources[n.toString()];if(o){if(!o.enabled)throw new Q(X.InvalidParams,`Resource ${n} disabled`);return o.readCallback(n,r)}for(let s of Object.values(this._registeredResourceTemplates)){let i=s.resourceTemplate.uriTemplate.match(n.toString());if(i)return s.readCallback(n,i,r)}throw new Q(X.InvalidParams,`Resource ${n} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(Bt(Go)),this.server.assertCanSetRequestHandler(Bt(Yo)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Go,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?Az(r.argsSchema):void 0}))})),this.server.setRequestHandler(Yo,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new Q(X.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new Q(X.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let o=Vr(n.argsSchema),s=await Oo(o,e.params.arguments);if(!s.success)throw new Q(X.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${Co(s.error)}`);let i=s.data,a=n.callback;return await Promise.resolve(a(i,r))}else{let o=n.callback;return await Promise.resolve(o(r))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,r,...n){let o;typeof n[0]=="object"&&(o=n.shift());let s=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,o,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,o,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,n,o){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,r,n,o,s){let i={name:e,title:r,metadata:o,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,r,n,o,s){let i={resourceTemplate:n,title:r,metadata:o,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredResourceTemplates[e],a.name&&(this._registeredResourceTemplates[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.template<"u"&&(i.resourceTemplate=a.template),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,r,n,o,s){let i={title:r,description:n,argsSchema:o===void 0?void 0:Lr(o),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=Lr(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,r,n,o,s,i,a,c){fl(e);let u={title:r,description:n,inputSchema:dg(o),outputSchema:dg(s),annotations:i,_meta:a,callback:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(typeof l.name=="string"&&fl(l.name),delete this._registeredTools[e],l.name&&(this._registeredTools[l.name]=u)),typeof l.title<"u"&&(u.title=l.title),typeof l.description<"u"&&(u.description=l.description),typeof l.paramsSchema<"u"&&(u.inputSchema=Lr(l.paramsSchema)),typeof l.callback<"u"&&(u.callback=l.callback),typeof l.annotations<"u"&&(u.annotations=l.annotations),typeof l._meta<"u"&&(u._meta=l._meta),typeof l.enabled<"u"&&(u.enabled=l.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,o,s,i;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];ml(c)?(o=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!ml(r[0])&&(i=r.shift())):typeof c=="object"&&c!==null&&(i=r.shift())}let a=r[0];return this._createRegisteredTool(e,void 0,n,o,s,i,void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:s,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,o,s,i,a,c,u,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let o;r.length>1&&(o=r.shift());let s=r[0],i=this._createRegisteredPrompt(e,void 0,n,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:s,argsSchema:i}=r,a=this._createRegisteredPrompt(e,o,s,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Nz={type:"object",properties:{}};function ml(t){return typeof t!="object"||t===null?!1:Object.keys(t).length===0||Object.values(t).some(jz)}function jz(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function dg(t){if(t)return ml(t)?Lr(t):t}function Az(t){let e=Ur(t);return e?Object.entries(e).map(([r,n])=>{let o=Bd(n),s=Hd(n);return{name:r,description:o,required:!s}}):[]}function Bt(t){let e=Ur(t),r=e?.method;if(!r)throw new Error("Schema is missing a method literal");let n=No(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function pg(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var so={completion:{values:[],hasMore:!1}};import mg from"node:process";var Hs=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
73
+ `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Mz(r)}clear(){this._buffer=void 0}};function Mz(t){return zp.parse(JSON.parse(t))}function fg(t){return JSON.stringify(t)+`
74
+ `}var Ks=class{constructor(e=mg.stdin,r=mg.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Hs,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{var o;(o=this.onerror)===null||o===void 0||o.call(this,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(var e,r;;)try{let n=this._readBuffer.readMessage();if(n===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,n)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(r=>{let n=fg(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};async function Pg(){return(process.env.SUPERCLAWD_BACKEND||"real").toLowerCase()==="mock"?(await Promise.resolve().then(()=>($g(),xg))).mockBackend:(await Promise.resolve().then(()=>(zg(),Sg))).realBackend}Ws();import{homedir as nP}from"node:os";import{join as ao}from"node:path";import{readFileSync as Eg,writeFileSync as oP,mkdirSync as sP,chmodSync as YZ,existsSync as XZ}from"node:fs";var QZ=(process.env.SUPERCLAWD_BACKEND||"real").toLowerCase();var eO=process.env.SUPERCLAWD_MCP_API_URL||"https://mcp-api.superclawd.com",Tg=process.env.SUPERCLAWD_HOME||ao(nP(),".superclawd"),iP=ao(Tg,"sessions"),aP=ao(Tg,"config.json");function cP(t){if(!t||typeof t!="object")return{};let e=t,r=e.credentials??{...typeof e.keyId=="string"?{keyId:e.keyId}:{},...typeof e.secret=="string"?{secret:e.secret}:{},...typeof e.workspace=="string"?{workspace:e.workspace}:{}},n=e.preferences??{...typeof e.skipPermissions=="boolean"?{skipPermissions:e.skipPermissions}:{},...typeof e.notifications=="boolean"?{notifications:e.notifications}:{},...typeof e.chooseWorkspaceAtStartup=="boolean"?{chooseWorkspaceAtStartup:e.chooseWorkspaceAtStartup}:{}},o={};return Object.keys(r).length&&(o.credentials=r),Object.keys(n).length&&(o.preferences=n),o}function uP(){try{return cP(JSON.parse(Eg(aP,"utf8")))}catch{return null}}function lP(){return uP()?.preferences?.notifications===!0}function Rg(t){return ao(iP,t)}function Ig(t){return ao(t,"config.json")}function Zg(t){try{return JSON.parse(Eg(Ig(t),"utf8"))}catch{return null}}function dP(t,e){try{sP(t,{recursive:!0}),oP(Ig(t),`${JSON.stringify(e,null,2)}
75
+ `)}catch{}}function Og(t){let e=t?Zg(Rg(t)):null;return e&&typeof e.notifications=="boolean"?e.notifications:lP()}function Cg(t,e){if(!t)return e;let r=Rg(t),n=Zg(r)??{};return dP(r,{...n,notifications:e}),e}var tO=1e3*60*60*24*3;var Kt=await Pg(),Wt=new Bs({name:"superclawd",version:"0.1.0"});Wt.tool("get_directives","Fetch and apply the authoritative SuperClawd instructions for one or more skills. Call this whenever an SuperClawd skill activates, BEFORE acting, passing the skill's skillId. If several skills activate at the same time, pass them together in `skills` to fetch them in one (cheaper) call.",{skillId:Ve.string().optional().describe("A single activated skill's skillId."),action:Ve.string().optional().describe("Action context for `skillId`, e.g. code/test/review."),skills:Ve.array(Ve.object({skillId:Ve.string().describe("The activated skill's skillId."),action:Ve.string().optional().describe("Action context, e.g. code/test/review.")})).optional().describe("Batch form: multiple activated skills to fetch in a single call.")},async({skillId:t,action:e,skills:r})=>{let n=r?.length?r:t?[{skillId:t,action:e}]:[];if(n.length===0)return{isError:!0,content:[{type:"text",text:'<superclawd_error status="400">Provide a skillId, or a non-empty skills array.</superclawd_error>'}]};let o=await Kt.getDirectives(n);return o.ok?{content:[{type:"text",text:o.text??""}]}:{isError:!0,content:[{type:"text",text:`<superclawd_error status="${o.status}">${o.message}</superclawd_error>`}]}});function pP(){try{let t=JSON.parse(process.env.SUPERCLAWD_RESOURCES??"[]");return Array.isArray(t)?t:[]}catch{return[]}}var gl=pP();function fP(){return gl.length===0?"":`
76
+
77
+ Available resources (fetch by name when relevant to the task):
78
+ ${gl.map(e=>` - ${e.name}${e.description?`: ${e.description}`:""}`).join(`
79
+ `)}`}function Ng(t,e,r=""){Wt.tool(t,`Fetch the SuperClawd ${e} content by name (call this when running an SuperClawd ${e}).${r}`,{name:Ve.string().describe(`The ${e} name.`)},async({name:n})=>{let o=t==="get_command"?await Kt.getCommand(n):await Kt.getResource(n);return o.ok?{content:[{type:"text",text:o.text??""}]}:{isError:!0,content:[{type:"text",text:`<superclawd_error status="${o.status}">${o.message}</superclawd_error>`}]}})}Ng("get_command","command");Ng("get_resource","resource",fP());for(let t of gl){let e=`superclawd://${encodeURIComponent(t.name)}`;Wt.resource(t.name,e,{description:t.description??"",mimeType:"text/markdown"},async()=>{let r=await Kt.getResource(t.name);if(!r.ok)throw new Error(`<superclawd_error status="${r.status}">${r.message}</superclawd_error>`);return{contents:[{uri:e,mimeType:"text/markdown",text:r.text??""}]}})}Wt.tool("get_workflow","Fetch an SuperClawd workflow's steps by id (call this when an SuperClawd workflow skill activates, before following the process).",{workflowId:Ve.string().describe("The SuperClawd workflowId from the activated workflow skill.")},async({workflowId:t})=>{let e=await Kt.getWorkflow(t);return e.ok?{content:[{type:"text",text:e.text??""}]}:{isError:!0,content:[{type:"text",text:`<superclawd_error status="${e.status}">${e.message}</superclawd_error>`}]}});function jg(t,e){Wt.tool(t,e,{},async()=>{let r=t==="workspace_info"?await Kt.workspaceInfo():await Kt.serviceStatus();return r.ok?{content:[{type:"text",text:r.text??""}]}:{isError:!0,content:[{type:"text",text:`<superclawd_error status="${r.status}">${r.message}</superclawd_error>`}]}})}jg("workspace_info","Show the current SuperClawd workspace: name, tier, and counts of skills/commands/resources/workflows.");jg("service_status","Check whether the SuperClawd service is operational.");Wt.tool("check_balance","Return the current SuperClawd credit balance and tier.",{},async()=>{let t=await Kt.checkBalance();return{content:[{type:"text",text:`tier=${t.tier} balance=${t.balance}`}]}});Wt.tool("notifications","Turn SuperClawd notifications on or off for THIS Claude Code session. Use when the user asks to enable/disable/check notifications (or runs /superclawd:notifications). Per-session only: it starts from the user's default preference and is reset when the session ends.",{action:Ve.enum(["on","off","toggle","status"]).optional().describe("on/off to set, toggle to flip, status to just report. Defaults to toggle.")},async({action:t="toggle"})=>{let e=process.env.SUPERCLAWD_SESSION_ID||"",r=Og(e),n=t==="on"?!0:t==="off"?!1:t==="toggle"?!r:r;t!=="status"&&n!==r&&Cg(e,n);let o=n?"ON \u{1F514}":"OFF \u{1F515}";return{content:[{type:"text",text:t==="status"?`Notifications are ${o} for this session.`:`Notifications ${o} for this session.`}]}});ae({tool:"_server_start",backend:process.env.SUPERCLAWD_BACKEND||"real"});await Wt.connect(new Ks);