@stophy/mcp 1.2.0 → 2.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.
- package/README.md +17 -17
- package/dist/index.js +76 -41
- package/package.json +36 -38
package/dist/index.js
CHANGED
|
@@ -1,46 +1,81 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var Cg=Object.create;var{getPrototypeOf:Og,defineProperty:za,getOwnPropertyNames:jg}=Object;var Sa=Object.prototype.hasOwnProperty;function Ng(e){return this[e]}var Ag,Zg,ka=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?Ag??=new WeakMap:Zg??=new WeakMap,s=n.get(e);if(s)return s}r=e!=null?Cg(Og(e)):{};let i=t||!e||!e.__esModule||!Sa.call(e,"default")?za(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of jg(e))if(!Sa.call(i,a))za(i,a,{get:Ng.bind(e,a),enumerable:!0})}if(o)n.set(e,i);return i};var T=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var eo=T(function(cd){Object.defineProperty(cd,"__esModule",{value:!0});cd.regexpCode=cd.getEsmExportName=cd.getProperty=cd.safeStringify=cd.stringify=cd.strConcat=cd.addCodeArg=cd.str=cd._=cd.nil=cd._Code=cd.Name=cd.IDENTIFIER=cd._CodeOrName=void 0;class Yo{}cd._CodeOrName=Yo;cd.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class ir extends Yo{constructor(e){super();if(!cd.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}cd.Name=ir;class Le extends Yo{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((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof ir)t[r.str]=(t[r.str]||0)+1;return t},{})}}cd._Code=Le;cd.nil=new Le("");function id(e,...t){let r=[e[0]],o=0;while(o<t.length)fi(r,t[o]),r.push(e[++o]);return new Le(r)}cd._=id;var pi=new Le("+");function ad(e,...t){let r=[Xr(e[0])],o=0;while(o<t.length)r.push(pi),fi(r,t[o]),r.push(pi,Xr(e[++o]));return Sv(r),new Le(r)}cd.str=ad;function fi(e,t){if(t instanceof Le)e.push(...t._items);else if(t instanceof ir)e.push(t);else e.push(Ev(t))}cd.addCodeArg=fi;function Sv(e){let t=1;while(t<e.length-1){if(e[t]===pi){let r=kv(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function kv(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof ir||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof ir))return`"${e}${t.slice(1)}`;return}function Pv(e,t){return t.emptyStr()?e:e.emptyStr()?t:ad`${e}${t}`}cd.strConcat=Pv;function Ev(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Xr(Array.isArray(e)?e.join(","):e)}function Tv(e){return new Le(Xr(e))}cd.stringify=Tv;function Xr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}cd.safeStringify=Xr;function Rv(e){return typeof e=="string"&&cd.IDENTIFIER.test(e)?new Le(`.${e}`):id`[${e}]`}cd.getProperty=Rv;function Iv(e){if(typeof e=="string"&&cd.IDENTIFIER.test(e))return new Le(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}cd.getEsmExportName=Iv;function Cv(e){return new Le(e.toString())}cd.regexpCode=Cv});var _i=T(function(pd){Object.defineProperty(pd,"__esModule",{value:!0});pd.ValueScope=pd.ValueScopeName=pd.Scope=pd.varKinds=pd.UsedValueState=void 0;var W=eo();class ld extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Xo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Xo||(pd.UsedValueState=Xo={}));pd.varKinds={const:new W.Name("const"),let:new W.Name("let"),var:new W.Name("var")};class hi{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof W.Name?e:this.name(e)}name(e){return new W.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}pd.Scope=hi;class gi extends W.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=W._`.${new W.Name(t)}[${r}]`}}pd.ValueScopeName=gi;var Hv=W._`\n`;class dd extends hi{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Hv:W.nil}}get(){return this._scope}name(e){return new gi(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:n}=o,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[n];if(i){let c=i.get(s);if(c)return c}else i=this._values[n]=new Map;i.set(s,o);let a=this._scope[n]||(this._scope[n]=[]),u=a.length;return a[u]=t.ref,o.setValue(t,{property:n,itemIndex:u}),o}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return W._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(o)=>{if(o.value===void 0)throw Error(`CodeGen: name "${o}" has no value`);return o.value.code},t,r)}_reduceValues(e,t,r={},o){let n=W.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((u)=>{if(a.has(u))return;a.set(u,Xo.Started);let c=t(u);if(c){let l=this.opts.es5?pd.varKinds.var:pd.varKinds.const;n=W._`${n}${l} ${u} = ${c};${this.opts._n}`}else if(c=o===null||o===void 0?void 0:o(u))n=W._`${n}${c}${this.opts._n}`;else throw new ld(u);a.set(u,Xo.Completed)})}return n}}pd.ValueScope=dd});var U=T(function(Ee){Object.defineProperty(Ee,"__esModule",{value:!0});Ee.or=Ee.and=Ee.not=Ee.CodeGen=Ee.operators=Ee.varKinds=Ee.ValueScopeName=Ee.ValueScope=Ee.Scope=Ee.Name=Ee.regexpCode=Ee.stringify=Ee.getProperty=Ee.nil=Ee.strConcat=Ee.str=Ee._=void 0;var R=eo(),ce=_i(),yt=eo();Object.defineProperty(Ee,"_",{enumerable:!0,get:function(){return yt._}});Object.defineProperty(Ee,"str",{enumerable:!0,get:function(){return yt.str}});Object.defineProperty(Ee,"strConcat",{enumerable:!0,get:function(){return yt.strConcat}});Object.defineProperty(Ee,"nil",{enumerable:!0,get:function(){return yt.nil}});Object.defineProperty(Ee,"getProperty",{enumerable:!0,get:function(){return yt.getProperty}});Object.defineProperty(Ee,"stringify",{enumerable:!0,get:function(){return yt.stringify}});Object.defineProperty(Ee,"regexpCode",{enumerable:!0,get:function(){return yt.regexpCode}});Object.defineProperty(Ee,"Name",{enumerable:!0,get:function(){return yt.Name}});var sn=_i();Object.defineProperty(Ee,"Scope",{enumerable:!0,get:function(){return sn.Scope}});Object.defineProperty(Ee,"ValueScope",{enumerable:!0,get:function(){return sn.ValueScope}});Object.defineProperty(Ee,"ValueScopeName",{enumerable:!0,get:function(){return sn.ValueScopeName}});Object.defineProperty(Ee,"varKinds",{enumerable:!0,get:function(){return sn.varKinds}});Ee.operators={GT:new R._Code(">"),GTE:new R._Code(">="),LT:new R._Code("<"),LTE:new R._Code("<="),EQ:new R._Code("==="),NEQ:new R._Code("!=="),NOT:new R._Code("!"),OR:new R._Code("||"),AND:new R._Code("&&"),ADD:new R._Code("+")};class vt{optimizeNodes(){return this}optimizeNames(e,t){return this}}class md extends vt{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?ce.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=cr(this.rhs,e,t);return this}get names(){return this.rhs instanceof R._CodeOrName?this.rhs.names:{}}}class $i extends vt{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof R.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=cr(this.rhs,e,t),this}get names(){let e=this.lhs instanceof R.Name?{}:{...this.lhs.names};return nn(e,this.rhs)}}class hd extends $i{constructor(e,t,r,o){super(e,r,o);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class gd extends vt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class _d extends vt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class yd extends vt{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class vd extends vt{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=cr(this.code,e,t),this}get names(){return this.code instanceof R._CodeOrName?this.code.names:{}}}class an extends vt{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;while(o--){let n=r[o];if(n.optimizeNames(e,t))continue;Jv(e,n.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Vt(e,t.names),{})}}class $t extends an{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class $d extends an{}class to extends $t{}to.kind="else";class it extends $t{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new to(r):r}if(t){if(e===!1)return t instanceof it?t:t.nodes;if(this.nodes.length)return this;return new it(Sd(e),t instanceof it?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=cr(this.condition,e,t),this}get names(){let e=super.names;if(nn(e,this.condition),this.else)Vt(e,this.else.names);return e}}it.kind="if";class ar extends $t{}ar.kind="for";class wd extends ar{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=cr(this.iteration,e,t),this}get names(){return Vt(super.names,this.iteration.names)}}class xd extends ar{constructor(e,t,r,o){super();this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?ce.varKinds.var:this.varKind,{name:r,from:o,to:n}=this;return`for(${t} ${r}=${o}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){let e=nn(super.names,this.from);return nn(e,this.to)}}class yi extends ar{constructor(e,t,r,o){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=cr(this.iterable,e,t),this}get names(){return Vt(super.names,this.iterable.names)}}class en extends $t{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}en.kind="func";class tn extends an{render(e){return"return "+super.render(e)}}tn.kind="return";class bd extends $t{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(o=this.finally)===null||o===void 0||o.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Vt(e,this.catch.names);if(this.finally)Vt(e,this.finally.names);return e}}class rn extends $t{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}rn.kind="catch";class on extends $t{render(e){return"finally"+super.render(e)}}on.kind="finally";class zd{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
3
|
-
`:""},this._extScope=e,this._scope=new ce.Scope({parent:e}),this._nodes=[new $d]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){let n=this._scope.toName(t);if(r!==void 0&&o)this._constants[n.str]=r;return this._leafNode(new md(e,n,r)),n}const(e,t,r){return this._def(ce.varKinds.const,e,t,r)}let(e,t,r){return this._def(ce.varKinds.let,e,t,r)}var(e,t,r){return this._def(ce.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new $i(e,t,r))}add(e,t){return this._leafNode(new hd(e,Ee.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==R.nil)this._leafNode(new vd(e));return this}object(...e){let t=["{"];for(let[r,o]of e){if(t.length>1)t.push(",");if(t.push(r),r!==o||this.opts.es5)t.push(":"),R.addCodeArg(t,o)}return t.push("}"),new R._Code(t)}if(e,t,r){if(this._blockNode(new it(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new it(e))}else(){return this._elseNode(new to)}endIf(){return this._endBlockNode(it,to)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new wd(e),t)}forRange(e,t,r,o,n=this.opts.es5?ce.varKinds.var:ce.varKinds.let){let s=this._scope.toName(e);return this._for(new xd(n,s,t,r),()=>o(s))}forOf(e,t,r,o=ce.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let s=t instanceof R.Name?t:this.var("_arr",t);return this.forRange("_i",0,R._`${s}.length`,(i)=>{this.var(n,R._`${s}[${i}]`),r(n)})}return this._for(new yi("of",o,n,t),()=>r(n))}forIn(e,t,r,o=this.opts.es5?ce.varKinds.var:ce.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,R._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new yi("in",o,n,t),()=>r(n))}endFor(){return this._endBlockNode(ar)}label(e){return this._leafNode(new gd(e))}break(e){return this._leafNode(new _d(e))}return(e){let t=new tn;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(tn)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new bd;if(this._blockNode(o),this.code(e),t){let n=this.name("e");this._currNode=o.catch=new rn(n),t(n)}if(r)this._currNode=o.finally=new on,this.code(r);return this._endBlockNode(rn,on)}throw(e){return this._leafNode(new yd(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=R.nil,r,o){if(this._blockNode(new en(e,t,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(en)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof it))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}Ee.CodeGen=zd;function Vt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function nn(e,t){return t instanceof R._CodeOrName?Vt(e,t.names):e}function cr(e,t,r){if(e instanceof R.Name)return o(e);if(!n(e))return e;return new R._Code(e._items.reduce((s,i)=>{if(i instanceof R.Name)i=o(i);if(i instanceof R._Code)s.push(...i._items);else s.push(i);return s},[]));function o(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function n(s){return s instanceof R._Code&&s._items.some((i)=>i instanceof R.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function Jv(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Sd(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:R._`!${vi(e)}`}Ee.not=Sd;var Gv=kd(Ee.operators.AND);function Yv(...e){return e.reduce(Gv)}Ee.and=Yv;var Qv=kd(Ee.operators.OR);function Xv(...e){return e.reduce(Qv)}Ee.or=Xv;function kd(e){return(t,r)=>t===R.nil?r:r===R.nil?t:R._`${vi(t)} ${e} ${vi(r)}`}function vi(e){return e instanceof R.Name?e:R._`(${e})`}});var V=T(function(Ad){Object.defineProperty(Ad,"__esModule",{value:!0});Ad.checkStrictMode=Ad.getErrorPath=Ad.Type=Ad.useFunc=Ad.setEvaluated=Ad.evaluatedPropsToName=Ad.mergeEvaluated=Ad.eachItem=Ad.unescapeJsonPointer=Ad.escapeJsonPointer=Ad.escapeFragment=Ad.unescapeFragment=Ad.schemaRefOrVal=Ad.schemaHasRulesButRef=Ad.schemaHasRules=Ad.checkUnknownRules=Ad.alwaysValidSchema=Ad.toHash=void 0;var A=U(),Rd=eo();function o$(e){let t={};for(let r of e)t[r]=!0;return t}Ad.toHash=o$;function n$(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return Id(e,t),!Cd(t,e.self.RULES.all)}Ad.alwaysValidSchema=n$;function Id(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=o.RULES.keywords;for(let s in t)if(!n[s])Nd(e,`unknown keyword: "${s}"`)}Ad.checkUnknownRules=Id;function Cd(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Ad.schemaHasRules=Cd;function s$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Ad.schemaHasRulesButRef=s$;function i$({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return A._`${r}`}return A._`${e}${t}${A.getProperty(o)}`}Ad.schemaRefOrVal=i$;function a$(e){return Od(decodeURIComponent(e))}Ad.unescapeFragment=a$;function c$(e){return encodeURIComponent(xi(e))}Ad.escapeFragment=c$;function xi(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Ad.escapeJsonPointer=xi;function Od(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Ad.unescapeJsonPointer=Od;function u$(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Ad.eachItem=u$;function Ed({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let u=i===void 0?s:i instanceof A.Name?(s instanceof A.Name?e(n,s,i):t(n,s,i),i):s instanceof A.Name?(t(n,i,s),s):r(s,i);return a===A.Name&&!(u instanceof A.Name)?o(n,u):u}}Ad.mergeEvaluated={props:Ed({mergeNames:(e,t,r)=>e.if(A._`${r} !== true && ${t} !== undefined`,()=>{e.if(A._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,A._`${r} || {}`).code(A._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(A._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,A._`${r} || {}`),bi(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:jd}),items:Ed({mergeNames:(e,t,r)=>e.if(A._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,A._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(A._`${r} !== true`,()=>e.assign(r,t===!0?!0:A._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function jd(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",A._`{}`);if(t!==void 0)bi(e,r,t);return r}Ad.evaluatedPropsToName=jd;function bi(e,t,r){Object.keys(r).forEach((o)=>e.assign(A._`${t}${A.getProperty(o)}`,!0))}Ad.setEvaluated=bi;var Td={};function l$(e,t){return e.scopeValue("func",{ref:t,code:Td[t.code]||(Td[t.code]=new Rd._Code(t.code))})}Ad.useFunc=l$;var wi;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(wi||(Ad.Type=wi={}));function d$(e,t,r){if(e instanceof A.Name){let o=t===wi.Num;return r?o?A._`"[" + ${e} + "]"`:A._`"['" + ${e} + "']"`:o?A._`"/" + ${e}`:A._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?A.getProperty(e).toString():"/"+xi(e)}Ad.getErrorPath=d$;function Nd(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Ad.checkStrictMode=Nd});var at=T(function(qd){Object.defineProperty(qd,"__esModule",{value:!0});var K=U(),T$={data:new K.Name("data"),valCxt:new K.Name("valCxt"),instancePath:new K.Name("instancePath"),parentData:new K.Name("parentData"),parentDataProperty:new K.Name("parentDataProperty"),rootData:new K.Name("rootData"),dynamicAnchors:new K.Name("dynamicAnchors"),vErrors:new K.Name("vErrors"),errors:new K.Name("errors"),this:new K.Name("this"),self:new K.Name("self"),scope:new K.Name("scope"),json:new K.Name("json"),jsonPos:new K.Name("jsonPos"),jsonLen:new K.Name("jsonLen"),jsonPart:new K.Name("jsonPart")};qd.default=T$});var ro=T(function(Ud){Object.defineProperty(Ud,"__esModule",{value:!0});Ud.extendErrors=Ud.resetErrorsCount=Ud.reportExtraError=Ud.reportError=Ud.keyword$DataError=Ud.keywordError=void 0;var I=U(),wt=V(),Se=at();Ud.keywordError={message:({keyword:e})=>I.str`must pass "${e}" keyword validation`};Ud.keyword$DataError={message:({keyword:e,schemaType:t})=>t?I.str`"${e}" keyword must be ${t} ($data)`:I.str`"${e}" keyword is invalid ($data)`};function I$(e,t=Ud.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,u=Ld(e,t,r);if(o!==null&&o!==void 0?o:i||a)Md(s,u);else Dd(n,I._`[${u}]`)}Ud.reportError=I$;function C$(e,t=Ud.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=Ld(e,t,r);if(Md(n,a),!(s||i))Dd(o,Se.default.vErrors)}Ud.reportExtraError=C$;function O$(e,t){e.assign(Se.default.errors,t),e.if(I._`${Se.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(I._`${Se.default.vErrors}.length`,t),()=>e.assign(Se.default.vErrors,null)))}Ud.resetErrorsCount=O$;function j$({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,Se.default.errors,(a)=>{if(e.const(i,I._`${Se.default.vErrors}[${a}]`),e.if(I._`${i}.instancePath === undefined`,()=>e.assign(I._`${i}.instancePath`,I.strConcat(Se.default.instancePath,s.errorPath))),e.assign(I._`${i}.schemaPath`,I.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(I._`${i}.schema`,r),e.assign(I._`${i}.data`,o)})}Ud.extendErrors=j$;function Md(e,t){let r=e.const("err",t);e.if(I._`${Se.default.vErrors} === null`,()=>e.assign(Se.default.vErrors,I._`[${r}]`),I._`${Se.default.vErrors}.push(${r})`),e.code(I._`${Se.default.errors}++`)}function Dd(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;if(n.$async)r.throw(I._`new ${e.ValidationError}(${t})`);else r.assign(I._`${o}.errors`,t),r.return(!1)}var Ft={keyword:new I.Name("keyword"),schemaPath:new I.Name("schemaPath"),params:new I.Name("params"),propertyName:new I.Name("propertyName"),message:new I.Name("message"),schema:new I.Name("schema"),parentSchema:new I.Name("parentSchema")};function Ld(e,t,r){let{createErrors:o}=e.it;if(o===!1)return I._`{}`;return N$(e,t,r)}function N$(e,t,r={}){let{gen:o,it:n}=e,s=[A$(n,r),Z$(e,r)];return q$(e,t,s),o.object(...s)}function A$({errorPath:e},{instancePath:t}){let r=t?I.str`${e}${wt.getErrorPath(t,wt.Type.Str)}`:e;return[Se.default.instancePath,I.strConcat(Se.default.instancePath,r)]}function Z$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:I.str`${t}/${e}`;if(r)n=I.str`${n}${wt.getErrorPath(r,wt.Type.Str)}`;return[Ft.schemaPath,n]}function q$(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:u,propertyName:c,topSchemaRef:l,schemaPath:d}=a;if(o.push([Ft.keyword,n],[Ft.params,typeof t=="function"?t(e):t||I._`{}`]),u.messages)o.push([Ft.message,typeof r=="function"?r(e):r]);if(u.verbose)o.push([Ft.schema,i],[Ft.parentSchema,I._`${l}${d}`],[Se.default.data,s]);if(c)o.push([Ft.propertyName,c])}});var Jd=T(function(Bd){Object.defineProperty(Bd,"__esModule",{value:!0});Bd.boolOrEmptySchema=Bd.topBoolOrEmptySchema=void 0;var Fd=ro(),Hd=U(),V$=at(),F$={message:"boolean schema is false"};function H$(e){let{gen:t,schema:r,validateName:o}=e;if(r===!1)Kd(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(V$.default.data);else t.assign(Hd._`${o}.errors`,null),t.return(!0)}Bd.topBoolOrEmptySchema=H$;function K$(e,t){let{gen:r,schema:o}=e;if(o===!1)r.var(t,!1),Kd(e);else r.var(t,!0)}Bd.boolOrEmptySchema=K$;function Kd(e,t){let{gen:r,data:o}=e;Fd.reportError({gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},F$,void 0,t)}});var Si=T(function(Gd){Object.defineProperty(Gd,"__esModule",{value:!0});Gd.getRules=Gd.isJSONType=void 0;var W$=["string","number","integer","boolean","null","object","array"],J$=new Set(W$);function G$(e){return typeof e=="string"&&J$.has(e)}Gd.isJSONType=G$;function Y$(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Gd.getRules=Y$});var ki=T(function(ep){Object.defineProperty(ep,"__esModule",{value:!0});ep.shouldUseRule=ep.shouldUseGroup=ep.schemaHasRulesForType=void 0;function X$({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&Qd(e,o)}ep.schemaHasRulesForType=X$;function Qd(e,t){return t.rules.some((r)=>Xd(e,r))}ep.shouldUseGroup=Qd;function Xd(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((o)=>e[o]!==void 0))}ep.shouldUseRule=Xd});var oo=T(function(ap){Object.defineProperty(ap,"__esModule",{value:!0});ap.reportTypeError=ap.checkDataTypes=ap.checkDataType=ap.coerceAndCheckDataType=ap.getJSONTypes=ap.getSchemaTypes=ap.DataType=void 0;var rp=Si(),op=ki(),np=ro(),z=U(),un=V(),ur;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(ur||(ap.DataType=ur={}));function rw(e){let t=sp(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}ap.getSchemaTypes=rw;function sp(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(rp.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}ap.getJSONTypes=sp;function ow(e,t){let{gen:r,data:o,opts:n}=e,s=nw(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&op.schemaHasRulesForType(e,t[0]));if(i){let a=Ei(t,o,n.strictNumbers,ur.Wrong);r.if(a,()=>{if(s.length)sw(e,t,s);else Ti(e)})}return i}ap.coerceAndCheckDataType=ow;var ip=new Set(["string","number","integer","boolean","null"]);function nw(e,t){return t?e.filter((r)=>ip.has(r)||t==="array"&&r==="array"):[]}function sw(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",z._`typeof ${n}`),a=o.let("coerced",z._`undefined`);if(s.coerceTypes==="array")o.if(z._`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,z._`${n}[0]`).assign(i,z._`typeof ${n}`).if(Ei(t,n,s.strictNumbers),()=>o.assign(a,n)));o.if(z._`${a} !== undefined`);for(let c of r)if(ip.has(c)||c==="array"&&s.coerceTypes==="array")u(c);o.else(),Ti(e),o.endIf(),o.if(z._`${a} !== undefined`,()=>{o.assign(n,a),iw(e,a)});function u(c){switch(c){case"string":o.elseIf(z._`${i} == "number" || ${i} == "boolean"`).assign(a,z._`"" + ${n}`).elseIf(z._`${n} === null`).assign(a,z._`""`);return;case"number":o.elseIf(z._`${i} == "boolean" || ${n} === null
|
|
4
|
-
|| (${i} == "string" && ${
|
|
5
|
-
|| (${i} === "string" && ${
|
|
6
|
-
|| ${i} === "boolean" || ${n} === null`).assign(a,z._`[${n}]`)}}}function iw({gen:e,parentData:t,parentDataProperty:r},o){e.if(z._`${t} !== undefined`,()=>e.assign(z._`${t}[${r}]`,o))}function Pi(e,t,r,o=ur.Correct){let n=o===ur.Correct?z.operators.EQ:z.operators.NEQ,s;switch(e){case"null":return z._`${t} ${n} null`;case"array":s=z._`Array.isArray(${t})`;break;case"object":s=z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return z._`typeof ${t} ${n} ${e}`}return o===ur.Correct?s:z.not(s);function i(a=z.nil){return z.and(z._`typeof ${t} == "number"`,a,r?z._`isFinite(${t})`:z.nil)}}ap.checkDataType=Pi;function Ei(e,t,r,o){if(e.length===1)return Pi(e[0],t,r,o);let n,s=un.toHash(e);if(s.array&&s.object){let i=z._`typeof ${t} != "object"`;n=s.null?i:z._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=z.nil;if(s.number)delete s.integer;for(let i in s)n=z.and(n,Pi(i,t,r,o));return n}ap.checkDataTypes=Ei;var aw={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?z._`{type: ${e}}`:z._`{type: ${t}}`};function Ti(e){let t=cw(e);np.reportError(t,aw)}ap.reportTypeError=Ti;function cw(e){let{gen:t,data:r,schema:o}=e,n=un.schemaRefOrVal(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var fp=T(function(dp){Object.defineProperty(dp,"__esModule",{value:!0});dp.assignDefaults=void 0;var Ae=U(),lp=V();function hw(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)up(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,s)=>up(e,s,n.default))}dp.assignDefaults=hw;function up(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=Ae._`${s}${Ae.getProperty(t)}`;if(n){lp.checkStrictMode(e,`default is ignored for: ${a}`);return}let u=Ae._`${a} === undefined`;if(i.useDefaults==="empty")u=Ae._`${u} || ${a} === null || ${a} === ""`;o.if(u,Ae._`${a} = ${Ae.stringify(r)}`)}});var Ze=T(function(_p){Object.defineProperty(_p,"__esModule",{value:!0});_p.validateUnion=_p.validateArray=_p.usePattern=_p.callValidateCode=_p.schemaProperties=_p.allSchemaProperties=_p.noPropertyInData=_p.propertyInData=_p.isOwnProperty=_p.hasPropFunc=_p.reportMissingProp=_p.checkMissingProp=_p.checkReportMissingProp=void 0;var q=U(),lr=V(),xt=at(),mp=V();function gw(e,t){let{gen:r,data:o,it:n}=e;r.if(Ii(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:q._`${t}`},!0),e.error()})}_p.checkReportMissingProp=gw;function _w({gen:e,data:t,it:{opts:r}},o,n){return q.or(...o.map((s)=>q.and(Ii(e,t,s,r.ownProperties),q._`${n} = ${s}`)))}_p.checkMissingProp=_w;function yw(e,t){e.setParams({missingProperty:t},!0),e.error()}_p.reportMissingProp=yw;function hp(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:q._`Object.prototype.hasOwnProperty`})}_p.hasPropFunc=hp;function Ri(e,t,r){return q._`${hp(e)}.call(${t}, ${r})`}_p.isOwnProperty=Ri;function vw(e,t,r,o){let n=q._`${t}${q.getProperty(r)} !== undefined`;return o?q._`${n} && ${Ri(e,t,r)}`:n}_p.propertyInData=vw;function Ii(e,t,r,o){let n=q._`${t}${q.getProperty(r)} === undefined`;return o?q.or(n,q.not(Ri(e,t,r))):n}_p.noPropertyInData=Ii;function gp(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}_p.allSchemaProperties=gp;function $w(e,t){return gp(t).filter((r)=>!lr.alwaysValidSchema(e,t[r]))}_p.schemaProperties=$w;function ww({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,u,c){let l=c?q._`${e}, ${t}, ${o}${n}`:t,d=[[xt.default.instancePath,q.strConcat(xt.default.instancePath,s)],[xt.default.parentData,i.parentData],[xt.default.parentDataProperty,i.parentDataProperty],[xt.default.rootData,xt.default.rootData]];if(i.opts.dynamicRef)d.push([xt.default.dynamicAnchors,xt.default.dynamicAnchors]);let f=q._`${l}, ${r.object(...d)}`;return u!==q.nil?q._`${a}.call(${u}, ${f})`:q._`${a}(${f})`}_p.callValidateCode=ww;var xw=q._`new RegExp`;function bw({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:q._`${n.code==="new RegExp"?xw:mp.useFunc(e,n)}(${r}, ${o})`})}_p.usePattern=bw;function zw(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let u=t.const("len",q._`${r}.length`);t.forRange("i",0,u,(c)=>{e.subschema({keyword:o,dataProp:c,dataPropType:lr.Type.Num},s),t.if(q.not(s),a)})}}_p.validateArray=zw;function Sw(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((u)=>lr.alwaysValidSchema(n,u))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:o,schemaProp:c,compositeRule:!0},a);if(t.assign(i,q._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(q.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}_p.validateUnion=Sw});var Sp=T(function(bp){Object.defineProperty(bp,"__esModule",{value:!0});bp.validateKeywordUsage=bp.validSchemaType=bp.funcKeywordCode=bp.macroKeywordCode=void 0;var B=U(),Ht=at(),$p=Ze(),wp=ro();function qw(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),u=xp(r,o,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:B.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}bp.macroKeywordCode=qw;function Mw(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:u}=e;Lw(u,t);let c=!a&&t.compile?t.compile.call(u.self,s,i,u):t.validate,l=xp(o,n,c),d=o.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1){if(g(),t.modifying)vp(e);x(()=>e.error())}else{let w=t.async?m():h();if(t.modifying)vp(e);x(()=>Dw(e,w))}}function m(){let w=o.let("ruleErrs",null);return o.try(()=>g(B._`await `),(E)=>o.assign(d,!1).if(B._`${E} instanceof ${u.ValidationError}`,()=>o.assign(w,B._`${E}.errors`),()=>o.throw(E))),w}function h(){let w=B._`${l}.errors`;return o.assign(w,null),g(B.nil),w}function g(w=t.async?B._`await `:B.nil){let E=u.opts.passContext?Ht.default.this:Ht.default.self,S=!(("compile"in t)&&!a||t.schema===!1);o.assign(d,B._`${w}${$p.callValidateCode(e,l,E,S)}`,t.modifying)}function x(w){var E;o.if(B.not((E=t.valid)!==null&&E!==void 0?E:d),w)}}bp.funcKeywordCode=Mw;function vp(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,B._`${o.parentData}[${o.parentDataProperty}]`))}function Dw(e,t){let{gen:r}=e;r.if(B._`Array.isArray(${t})`,()=>{r.assign(Ht.default.vErrors,B._`${Ht.default.vErrors} === null ? ${t} : ${Ht.default.vErrors}.concat(${t})`).assign(Ht.default.errors,B._`${Ht.default.vErrors}.length`),wp.extendErrors(e)},()=>e.error())}function Lw({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function xp(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:B.stringify(r)})}function Uw(e,t,r=!1){return!t.length||t.some((o)=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}bp.validSchemaType=Uw;function Vw({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw Error("ajv implementation error");let i=n.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[s])){let u=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw Error(u)}}}bp.validateKeywordUsage=Vw});var Ep=T(function(kp){Object.defineProperty(kp,"__esModule",{value:!0});kp.extendSubschemaMode=kp.extendSubschemaData=kp.getSubschema=void 0;var me=U(),ln=V();function Bw(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:me._`${e.schemaPath}${me.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:me._`${e.schemaPath}${me.getProperty(t)}${me.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${ln.escapeFragment(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}kp.getSubschema=Bw;function Ww(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:l,opts:d}=t,f=a.let("data",me._`${t.data}${me.getProperty(r)}`,!0);u(f),e.errorPath=me.str`${c}${ln.getErrorPath(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=me._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let c=n instanceof me.Name?n:a.let("data",n,!0);if(u(c),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}kp.extendSubschemaData=Ww;function Jw(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){if(o!==void 0)e.compositeRule=o;if(n!==void 0)e.createErrors=n;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}kp.extendSubschemaMode=Jw});var Ci=T(function(e1,Tp){Tp.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Ip=T(function(t1,Rp){var bt=Rp.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};dn(t,o,n,e,"",e)};bt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};bt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};bt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};bt.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 dn(e,t,r,o,n,s,i,a,u,c){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,u,c);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in bt.arrayKeywords)for(var f=0;f<d.length;f++)dn(e,t,r,d[f],n+"/"+l+"/"+f,s,n,l,o,f)}else if(l in bt.propsKeywords){if(d&&typeof d=="object")for(var m in d)dn(e,t,r,d[m],n+"/"+l+"/"+Qw(m),s,n,l,o,m)}else if(l in bt.keywords||e.allKeys&&!(l in bt.skipKeywords))dn(e,t,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,u,c)}}function Qw(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var no=T(function(Ap){Object.defineProperty(Ap,"__esModule",{value:!0});Ap.getSchemaRefs=Ap.resolveUrl=Ap.normalizeId=Ap._getFullPath=Ap.getFullPath=Ap.inlineRef=void 0;var Cp=V(),Xw=Ci(),ex=Ip(),tx=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function rx(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Oi(e);if(!t)return!1;return Op(e)<=t}Ap.inlineRef=rx;var ox=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Oi(e){for(let t in e){if(ox.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Oi))return!0;if(typeof r=="object"&&Oi(r))return!0}return!1}function Op(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,tx.has(r))continue;if(typeof e[r]=="object")Cp.eachItem(e[r],(o)=>t+=Op(o));if(t===1/0)return 1/0}return t}function jp(e,t="",r){if(r!==!1)t=dr(t);let o=e.parse(t);return Np(e,o)}Ap.getFullPath=jp;function Np(e,t){return e.serialize(t).split("#")[0]+"#"}Ap._getFullPath=Np;var nx=/#\/?$/;function dr(e){return e?e.replace(nx,""):""}Ap.normalizeId=dr;function sx(e,t,r){return r=dr(r),e.resolve(t,r)}Ap.resolveUrl=sx;var ix=/^[a-z_][-a-z0-9._]*$/i;function ax(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=dr(e[r]||t),s={"":n},i=jp(o,n,!1),a={},u=new Set;return ex(e,{allKeys:!0},(d,f,m,h)=>{if(h===void 0)return;let g=i+f,x=s[h];if(typeof d[r]=="string")x=w.call(this,d[r]);E.call(this,d.$anchor),E.call(this,d.$dynamicAnchor),s[f]=x;function w(S){let N=this.opts.uriResolver.resolve;if(S=dr(x?N(x,S):S),u.has(S))throw l(S);u.add(S);let v=this.refs[S];if(typeof v=="string")v=this.refs[v];if(typeof v=="object")c(d,v.schema,S);else if(S!==dr(g))if(S[0]==="#")c(d,a[S],S),a[S]=d;else this.refs[S]=g;return S}function E(S){if(typeof S=="string"){if(!ix.test(S))throw Error(`invalid anchor "${S}"`);w.call(this,`#${S}`)}}}),a;function c(d,f,m){if(f!==void 0&&!Xw(d,f))throw l(m)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}Ap.getSchemaRefs=ax});var so=T(function(Qp){Object.defineProperty(Qp,"__esModule",{value:!0});Qp.getData=Qp.KeywordCxt=Qp.validateFunctionCode=void 0;var fn=Jd(),pn=oo(),fr=ki(),zt=oo(),Lp=fp(),He=Sp(),pr=Ep(),y=U(),D=at(),Up=no(),ye=V(),Fe=ro();function fx(e){if(Hp(e)){if(Kp(e),Fp(e)){gx(e);return}}Vp(e,()=>fn.topBoolOrEmptySchema(e))}Qp.validateFunctionCode=fx;function Vp({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){if(n.code.es5)e.func(t,y._`${D.default.data}, ${D.default.valCxt}`,o.$async,()=>{e.code(y._`"use strict"; ${qp(r,n)}`),hx(e,n),e.code(s)});else e.func(t,y._`${D.default.data}, ${mx(n)}`,o.$async,()=>e.code(qp(r,n)).code(s))}function mx(e){return y._`{${D.default.instancePath}="", ${D.default.parentData}, ${D.default.parentDataProperty}, ${D.default.rootData}=${D.default.data}${e.dynamicRef?y._`, ${D.default.dynamicAnchors}={}`:y.nil}}={}`}function hx(e,t){e.if(D.default.valCxt,()=>{if(e.var(D.default.instancePath,y._`${D.default.valCxt}.${D.default.instancePath}`),e.var(D.default.parentData,y._`${D.default.valCxt}.${D.default.parentData}`),e.var(D.default.parentDataProperty,y._`${D.default.valCxt}.${D.default.parentDataProperty}`),e.var(D.default.rootData,y._`${D.default.valCxt}.${D.default.rootData}`),t.dynamicRef)e.var(D.default.dynamicAnchors,y._`${D.default.valCxt}.${D.default.dynamicAnchors}`)},()=>{if(e.var(D.default.instancePath,y._`""`),e.var(D.default.parentData,y._`undefined`),e.var(D.default.parentDataProperty,y._`undefined`),e.var(D.default.rootData,D.default.data),t.dynamicRef)e.var(D.default.dynamicAnchors,y._`{}`)})}function gx(e){let{schema:t,opts:r,gen:o}=e;Vp(e,()=>{if(r.$comment&&t.$comment)Wp(e);if(wx(e),o.let(D.default.vErrors,null),o.let(D.default.errors,0),r.unevaluated)_x(e);Bp(e),zx(e)});return}function _x(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",y._`${r}.evaluated`),t.if(y._`${e.evaluated}.dynamicProps`,()=>t.assign(y._`${e.evaluated}.props`,y._`undefined`)),t.if(y._`${e.evaluated}.dynamicItems`,()=>t.assign(y._`${e.evaluated}.items`,y._`undefined`))}function qp(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?y._`/*# sourceURL=${r} */`:y.nil}function yx(e,t){if(Hp(e)){if(Kp(e),Fp(e)){vx(e,t);return}}fn.boolOrEmptySchema(e,t)}function Fp({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Hp(e){return typeof e.schema!="boolean"}function vx(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)Wp(e);xx(e),bx(e);let s=o.const("_errs",D.default.errors);Bp(e,s),o.var(t,y._`${s} === ${D.default.errors}`)}function Kp(e){ye.checkUnknownRules(e),$x(e)}function Bp(e,t){if(e.opts.jtd)return Mp(e,[],!1,t);let r=pn.getSchemaTypes(e.schema),o=pn.coerceAndCheckDataType(e,r);Mp(e,r,!o,t)}function $x(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&ye.schemaHasRulesButRef(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function wx(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)ye.checkStrictMode(e,"default is ignored in the schema root")}function xx(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=Up.resolveUrl(e.opts.uriResolver,e.baseId,t)}function bx(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function Wp({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code(y._`${D.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=y.str`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(y._`${D.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function zx(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;if(r.$async)t.if(y._`${D.default.errors} === 0`,()=>t.return(D.default.data),()=>t.throw(y._`new ${n}(${D.default.vErrors})`));else{if(t.assign(y._`${o}.errors`,D.default.vErrors),s.unevaluated)Sx(e);t.return(y._`${D.default.errors} === 0`)}}function Sx({gen:e,evaluated:t,props:r,items:o}){if(r instanceof y.Name)e.assign(y._`${t}.props`,r);if(o instanceof y.Name)e.assign(y._`${t}.items`,o)}function Mp(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:u,self:c}=e,{RULES:l}=c;if(s.$ref&&(u.ignoreKeywordsWithRef||!ye.schemaHasRulesButRef(s,l))){n.block(()=>Gp(e,"$ref",l.all.$ref.definition));return}if(!u.jtd)kx(e,t);n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){if(!fr.shouldUseGroup(s,f))return;if(f.type){if(n.if(zt.checkDataType(f.type,i,u.strictNumbers)),Dp(e,f),t.length===1&&t[0]===f.type&&r)n.else(),zt.reportTypeError(e);n.endIf()}else Dp(e,f);if(!a)n.if(y._`${D.default.errors} === ${o||0}`)}}function Dp(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)Lp.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(fr.shouldUseRule(o,s))Gp(e,s.keyword,s.definition,t.type)})}function kx(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(Px(e,t),!e.opts.allowUnionTypes)Ex(e,t);Tx(e,e.dataTypes)}function Px(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!Jp(e.dataTypes,r))ji(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Ix(e,t)}function Ex(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))ji(e,"use allowUnionTypes to allow union type keyword")}function Tx(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&fr.shouldUseRule(e.schema,n)){let{type:s}=n.definition;if(s.length&&!s.some((i)=>Rx(t,i)))ji(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Rx(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Jp(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Ix(e,t){let r=[];for(let o of e.dataTypes)if(Jp(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function ji(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,ye.checkStrictMode(e,t,e.opts.strictTypes)}class Ni{constructor(e,t,r){if(He.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=ye.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",Yp(this.$data,e));else if(this.schemaCode=this.schemaValue,!He.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",D.default.errors)}result(e,t,r){this.failResult(y.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(y.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(y._`${t} !== undefined && (${y.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Fe.reportExtraError:Fe.reportError)(this,this.def.error,t)}$dataError(){Fe.reportError(this,this.def.$dataError||Fe.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Fe.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=y.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=y.nil,t=y.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:s}=this;if(r.if(y.or(y._`${o} === undefined`,t)),e!==y.nil)r.assign(e,!0);if(n.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==y.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return y.or(s(),i());function s(){if(r.length){if(!(t instanceof y.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return y._`${zt.checkDataTypes(a,t,n.opts.strictNumbers,zt.DataType.Wrong)}`}return y.nil}function i(){if(o.validateSchema){let a=e.scopeValue("validate$data",{ref:o.validateSchema});return y._`!${a}(${t})`}return y.nil}}subschema(e,t){let r=pr.getSubschema(this.it,e);pr.extendSubschemaData(r,this.it,e),pr.extendSubschemaMode(r,e);let o={...this.it,...r,items:void 0,props:void 0};return yx(o,t),o}mergeEvaluated(e,t){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=ye.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=ye.mergeEvaluated.items(o,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(t,()=>this.mergeEvaluated(e,y.Name)),!0}}Qp.KeywordCxt=Ni;function Gp(e,t,r,o){let n=new Ni(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)He.funcKeywordCode(n,r);else if("macro"in r)He.macroKeywordCode(n,r);else if(r.compile||r.validate)He.funcKeywordCode(n,r)}var Cx=/^\/(?:[^~]|~0|~1)*$/,Ox=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Yp(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return D.default.rootData;if(e[0]==="/"){if(!Cx.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,s=D.default.rootData}else{let c=Ox.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(n=c[2],n==="#"){if(l>=t)throw Error(u("property/index",l));return o[t-l]}if(l>t)throw Error(u("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let c of a)if(c)s=y._`${s}${y.getProperty(ye.unescapeJsonPointer(c))}`,i=y._`${i} && ${s}`;return i;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}Qp.getData=Yp});var mn=T(function(tf){Object.defineProperty(tf,"__esModule",{value:!0});class ef extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}tf.default=ef});var io=T(function(of){Object.defineProperty(of,"__esModule",{value:!0});var mr=no();class rf extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=mr.resolveUrl(e,t,r),this.missingSchema=mr.normalizeId(mr.getFullPath(e,this.missingRef))}}of.default=rf});var _n=T(function(af){Object.defineProperty(af,"__esModule",{value:!0});af.resolveSchema=af.getCompilingSchema=af.resolveRef=af.compileSchema=af.SchemaEnv=void 0;var ue=U(),qx=mn(),Kt=at(),le=no(),hn=V(),nf=so();class ao{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:le.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}af.SchemaEnv=ao;function Zi(e){let t=sf.call(this,e);if(t)return t;let r=le.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new ue.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:qx.default,code:ue._`require("ajv/dist/runtime/validation_error").default`});let u=i.scopeName("validate");e.validateName=u;let c={gen:i,allErrors:this.opts.allErrors,data:Kt.default.data,parentData:Kt.default.parentData,parentDataProperty:Kt.default.parentDataProperty,dataNames:[Kt.default.data],dataPathArr:[ue.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:ue.stringify(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:ue.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:ue._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),nf.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(Kt.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let m=Function(`${Kt.default.self}`,`${Kt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:m}),m.errors=null,m.schema=e.schema,m.schemaEnv=e,e.$async)m.$async=!0;if(this.opts.code.source===!0)m.source={validateName:u,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:h,items:g}=c;if(m.evaluated={props:h instanceof ue.Name?void 0:h,items:g instanceof ue.Name?void 0:g,dynamicProps:h instanceof ue.Name,dynamicItems:g instanceof ue.Name},m.source)m.source.evaluated=ue.stringify(m.evaluated)}return e.validate=m,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}af.compileSchema=Zi;function Mx(e,t,r){var o;r=le.resolveUrl(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=Ux.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;if(i)s=new ao({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=Dx.call(this,s)}af.resolveRef=Mx;function Dx(e){if(le.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Zi.call(this,e)}function sf(e){for(let t of this._compilations)if(Lx(t,e))return t}af.getCompilingSchema=sf;function Lx(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Ux(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||gn.call(this,e,t)}function gn(e,t){let r=this.opts.uriResolver.parse(t),o=le._getFullPath(this.opts.uriResolver,r),n=le.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return Ai.call(this,r,e);let s=le.normalizeId(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=gn.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Ai.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Zi.call(this,i);if(s===le.normalizeId(t)){let{schema:a}=i,{schemaId:u}=this.opts,c=a[u];if(c)n=le.resolveUrl(this.opts.uriResolver,n,c);return new ao({schema:a,schemaId:u,root:e,baseId:n})}return Ai.call(this,r,i)}af.resolveSchema=gn;var Vx=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ai(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let u=r[hn.unescapeFragment(a)];if(u===void 0)return;r=u;let c=typeof r==="object"&&r[this.opts.schemaId];if(!Vx.has(a)&&c)t=le.resolveUrl(this.opts.uriResolver,t,c)}let s;if(typeof r!="boolean"&&r.$ref&&!hn.schemaHasRulesButRef(r,this.RULES)){let a=le.resolveUrl(this.opts.uriResolver,t,r.$ref);s=gn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new ao({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s;return}});var uf=T(function(a1,Wx){Wx.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 Di=T(function(c1,hf){var Jx=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),df=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),qi=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),pf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Gx=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Mi(e){let t="",r=0,o=0;for(o=0;o<e.length;o++){if(r=e[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var Yx=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function lf(e){return e.length=0,!0}function Qx(e,t,r){if(e.length){let o=Mi(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function Xx(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Qx;for(let u=0;u<e.length;u++){let c=e[u];if(c==="["||c==="]")continue;if(c===":"){if(s===!0)i=!0;if(!a(n,o,r))break;if(++t>7){r.error=!0;break}if(u>0&&e[u-1]===":")s=!0;o.push(":");continue}else if(c==="%"){if(!a(n,o,r))break;a=lf}else{n.push(c);continue}}if(n.length)if(a===lf)r.zone=n.join("");else if(i)o.push(n.join(""));else o.push(Mi(n));return r.address=o.join(""),r}function ff(e){if(eb(e,":")<2)return{host:e,isIPV6:!1};let t=Xx(e);if(!t.error){let{address:r,address:o}=t;if(t.zone)r+="%"+t.zone,o+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:o}}else return{host:e,isIPV6:!1}}function eb(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function tb(e){let t=e,r=[],o=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var rb={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ob=/[@/?#:]/g,nb=/[@/?#]/g;function mf(e,t){let r=t?nb:ob;return r.lastIndex=0,e.replace(r,(o)=>rb[o])}function sb(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if(qi(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&pf(i))r+=i;else r+="%"+s;o+=2;continue}}r+=e[o]}return r}function ib(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(qi(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));if(s!=="."&&pf(s))t+=s;else t+="%"+n;r+=2;continue}}if(Gx(e[r]))t+=e[r];else t+=escape(e[r])}return t}function ab(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(qi(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function cb(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!df(r)){let o=ff(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=mf(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}hf.exports={nonSimpleDomain:Yx,recomposeAuthority:cb,reescapeHostDelimiters:mf,normalizePercentEncoding:sb,normalizePathEncoding:ib,escapePreservingEscapes:ab,removeDotSegments:tb,isIPv4:df,isUUID:Jx,normalizeIPv6:ff,stringArrayToHexStripped:Mi}});var $f=T(function(u1,vf){var{isUUID:ub}=Di(),lb=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,db=["http","https","ws","wss","urn","urn:uuid"];function pb(e){return db.indexOf(e)!==-1}function Li(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function gf(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function _f(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function fb(e){return e.secure=Li(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function mb(e){if(e.port===(Li(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function hb(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(lb);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=Ui(n);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function gb(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=Ui(n);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function _b(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!ub(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function yb(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var yf={scheme:"http",domainHost:!0,parse:gf,serialize:_f},vb={scheme:"https",domainHost:yf.domainHost,parse:gf,serialize:_f},yn={scheme:"ws",domainHost:!0,parse:fb,serialize:mb},$b={scheme:"wss",domainHost:yn.domainHost,parse:yn.parse,serialize:yn.serialize},wb={scheme:"urn",parse:hb,serialize:gb,skipNormalize:!0},xb={scheme:"urn:uuid",parse:_b,serialize:yb,skipNormalize:!0},vn={http:yf,https:vb,ws:yn,wss:$b,urn:wb,"urn:uuid":xb};Object.setPrototypeOf(vn,null);function Ui(e){return e&&(vn[e]||vn[e.toLowerCase()])||void 0}vf.exports={wsIsSecure:Li,SCHEMES:vn,isValidSchemeName:pb,getSchemeHandler:Ui}});var kf=T(function(l1,$n){var{normalizeIPv6:bb,removeDotSegments:co,recomposeAuthority:zb,normalizePercentEncoding:Sb,normalizePathEncoding:kb,escapePreservingEscapes:Pb,reescapeHostDelimiters:Eb,isIPv4:Tb,nonSimpleDomain:Rb}=Di(),{SCHEMES:Ib,getSchemeHandler:xf}=$f();function Cb(e,t){if(typeof e==="string")e=Zb(e,t);else if(typeof e==="object")e=hr(Bt(e,t),t);return e}function Ob(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=bf(hr(e,o),hr(t,o),o,!0);return o.skipEscape=!0,Bt(n,o)}function bf(e,t,r,o){let n={};if(!o)e=hr(Bt(e,r),r),t=hr(Bt(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=co(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=co(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=co(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=co(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function jb(e,t,r){let o=wf(e,r),n=wf(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Bt(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[],s=xf(o.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=Pb(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=Sb(r.path);if(o.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let i=zb(r);if(i!==void 0){if(o.reference!=="suffix")n.push("//");if(n.push(i),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let a=r.path;if(!o.absolutePath&&(!s||!s.absolutePath))a=co(a);if(i===void 0&&a[0]==="/"&&a[1]==="/")a="/%2F"+a.slice(2);n.push(a)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var Nb=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ab(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function zf(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let i=e.match(Nb);if(i){if(o.scheme=i[1],o.userinfo=i[3],o.host=i[4],o.port=parseInt(i[5],10),o.path=i[6]||"",o.query=i[7],o.fragment=i[8],isNaN(o.port))o.port=i[5];let a=Ab(o,i);if(a!==void 0)o.error=o.error||a,n=!0;if(o.host)if(Tb(o.host)===!1){let l=bb(o.host);o.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let u=xf(r.scheme||o.scheme);if(!r.unicodeSupport&&(!u||!u.unicodeSupport)){if(o.host&&(r.domainHost||u&&u.domainHost)&&s===!1&&Rb(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(c){o.error=o.error||"Host's domain name can not be converted to ASCII: "+c}}if(!u||u&&!u.skipNormalize){if(e.indexOf("%")!==-1){if(o.scheme!==void 0)o.scheme=unescape(o.scheme);if(o.host!==void 0)o.host=Eb(unescape(o.host),s)}if(o.path)o.path=kb(o.path);if(o.fragment)try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}}if(u&&u.parse)u.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function hr(e,t){return zf(e,t).parsed}function Zb(e,t){return Sf(e,t).normalized}function Sf(e,t){let{parsed:r,malformedAuthorityOrPort:o}=zf(e,t);return{normalized:o?e:Bt(r,t),malformedAuthorityOrPort:o}}function wf(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:o}=Sf(e,t);return o?void 0:r}if(typeof e==="object")return Bt(e,t)}var Vi={SCHEMES:Ib,normalize:Cb,resolve:Ob,resolveComponent:bf,equal:jb,serialize:Bt,parse:hr};$n.exports=Vi;$n.exports.default=Vi;$n.exports.fastUri=Vi});var Tf=T(function(Ef){Object.defineProperty(Ef,"__esModule",{value:!0});var Pf=kf();Pf.code='require("ajv/dist/runtime/uri").default';Ef.default=Pf});var Mf=T(function(ct){Object.defineProperty(ct,"__esModule",{value:!0});ct.CodeGen=ct.Name=ct.nil=ct.stringify=ct.str=ct._=ct.KeywordCxt=void 0;var Mb=so();Object.defineProperty(ct,"KeywordCxt",{enumerable:!0,get:function(){return Mb.KeywordCxt}});var _r=U();Object.defineProperty(ct,"_",{enumerable:!0,get:function(){return _r._}});Object.defineProperty(ct,"str",{enumerable:!0,get:function(){return _r.str}});Object.defineProperty(ct,"stringify",{enumerable:!0,get:function(){return _r.stringify}});Object.defineProperty(ct,"nil",{enumerable:!0,get:function(){return _r.nil}});Object.defineProperty(ct,"Name",{enumerable:!0,get:function(){return _r.Name}});Object.defineProperty(ct,"CodeGen",{enumerable:!0,get:function(){return _r.CodeGen}});var Db=mn(),jf=io(),Nf=Si(),Ke=_n(),Af=U(),Be=no(),St=oo(),gr=V(),Rf=uf(),Lb=Tf(),Zf=(e,t)=>new RegExp(e,t);Zf.code="new RegExp";var Ub=["removeAdditional","useDefaults","coerceTypes"],Vb=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Fb={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."},Hb={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},If=200;function Kb(e){var t,r,o,n,s,i,a,u,c,l,d,f,m,h,g,x,w,E,S,N,v,b,M,re,fe;let ke=e.strict,Ir=(t=e.code)===null||t===void 0?void 0:t.optimize,mo=Ir===!0||Ir===void 0?1:Ir||0,ho=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Zf,ut=(n=e.uriResolver)!==null&&n!==void 0?n:Lb.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:ke)!==null&&i!==void 0?i:!0,strictNumbers:(u=(a=e.strictNumbers)!==null&&a!==void 0?a:ke)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:ke)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:ke)!==null&&f!==void 0?f:"log",strictRequired:(h=(m=e.strictRequired)!==null&&m!==void 0?m:ke)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:mo,regExp:ho}:{optimize:mo,regExp:ho},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:If,loopEnum:(x=e.loopEnum)!==null&&x!==void 0?x:If,meta:(w=e.meta)!==null&&w!==void 0?w:!0,messages:(E=e.messages)!==null&&E!==void 0?E:!0,inlineRefs:(S=e.inlineRefs)!==null&&S!==void 0?S:!0,schemaId:(N=e.schemaId)!==null&&N!==void 0?N:"$id",addUsedSchema:(v=e.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(b=e.validateSchema)!==null&&b!==void 0?b:!0,validateFormats:(M=e.validateFormats)!==null&&M!==void 0?M:!0,unicodeRegExp:(re=e.unicodeRegExp)!==null&&re!==void 0?re:!0,int32range:(fe=e.int32range)!==null&&fe!==void 0?fe:!0,uriResolver:ut}}class wn{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Kb(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new Af.ValueScope({scope:{},prefixes:Vb,es5:t,lines:r}),this.logger=Qb(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=Nf.getRules(),Cf.call(this,Fb,e,"NOT SUPPORTED"),Cf.call(this,Hb,e,"DEPRECATED","warn"),this._metaOpts=Gb.call(this),e.formats)Wb.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)Jb.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);Bb.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=Rf;if(r==="id")o={...Rf},o.id=o.$id,delete o.$id;if(t&&e)this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);if(!("$async"in r))this.errors=r.errors;return o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(c,l){await n.call(this,c.$schema);let d=this._addSchema(c,l);return d.validate||s.call(this,d)}async function n(c){if(c&&!this.getSchema(c))await o.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(l){if(!(l instanceof jf.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,c)}}function i({missingSchema:c,missingRef:l}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${l} cannot be resolved`)}async function a(c){let l=await u.call(this,c);if(!this.refs[c])await n.call(this,l.$schema);if(!this.refs[c])this.addSchema(l,c,t)}async function u(c){let l=this._loading[c];if(l)return l;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,o);return this}let n;if(typeof e==="object"){let{schemaId:s}=this.opts;if(n=e[s],n!==void 0&&typeof n!="string")throw Error(`schema ${s} must be string`)}return t=Be.normalizeId(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return o}getSchema(e){let t;while(typeof(t=Of.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new Ke.SchemaEnv({schema:{},schemaId:r});if(t=Ke.resolveSchema.call(this,o,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}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 t=Of.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=Be.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(e0.call(this,r,t),!t)return gr.eachItem(r,(n)=>Fi.call(this,n)),this;r0.call(this,t);let o={...t,type:St.getJSONTypes(t.type),schemaType:St.getJSONTypes(t.schemaType)};return gr.eachItem(r,o.type.length===0?(n)=>Fi.call(this,n,o):(n)=>o.type.forEach((s)=>Fi.call(this,n,o,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let o=r.rules.findIndex((n)=>n.keyword===e);if(o>=0)r.rules.splice(o,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,n)=>o+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of t){let n=o.split("/").slice(1),s=e;for(let i of n)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:u}=a.definition,c=s[i];if(u&&c)s[i]=qf(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];if(!t||t.test(r)){if(typeof o=="string")delete e[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete e[r]}}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=Be.normalizeId(s||r);let u=Be.getSchemaRefs.call(this,e,r);if(a=new Ke.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:u}),this._cache.set(a.schema,a),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(o)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Ke.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Ke.compileSchema.call(this,e)}finally{this.opts=t}}}wn.ValidationError=Db.default;wn.MissingRefError=jf.default;ct.default=wn;function Cf(e,t,r,o="error"){for(let n in e){let s=n;if(s in t)this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function Of(e){return e=Be.normalizeId(e),this.schemas[e]||this.refs[e]}function Bb(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function Wb(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function Jb(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function Gb(){let e={...this.opts};for(let t of Ub)delete e[t];return e}var Yb={log(){},warn(){},error(){}};function Qb(e){if(e===!1)return Yb;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var Xb=/^[a-z_$][a-z0-9_$:-]*$/i;function e0(e,t){let{RULES:r}=this;if(gr.eachItem(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!Xb.test(o))throw Error(`Keyword ${o} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Fi(e,t,r){var o;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:u})=>u===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:St.getJSONTypes(t.type),schemaType:St.getJSONTypes(t.schemaType)}};if(t.before)t0.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach((u)=>this.addKeyword(u))}function t0(e,t,r){let o=e.rules.findIndex((n)=>n.keyword===r);if(o>=0)e.rules.splice(o,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function r0(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=qf(t);e.validateSchema=this.compile(t,!0)}var o0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function qf(e){return{anyOf:[e,o0]}}});var Lf=T(function(Df){Object.defineProperty(Df,"__esModule",{value:!0});var i0={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Df.default=i0});var Hf=T(function(Vf){Object.defineProperty(Vf,"__esModule",{value:!0});Vf.callRef=Vf.getValidate=void 0;var c0=io(),bn=Ze(),J=U(),yr=at(),zn=_n(),kt=V(),u0={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:u}=o,{root:c}=s;if((r==="#"||r==="#/")&&n===c.baseId)return d();let l=zn.resolveRef.call(u,c,n,r);if(l===void 0)throw new c0.default(o.opts.uriResolver,n,r);if(l instanceof zn.SchemaEnv)return f(l);return m(l);function d(){if(s===c)return xn(e,i,s,s.$async);let h=t.scopeValue("root",{ref:c});return xn(e,J._`${h}.validate`,c,c.$async)}function f(h){let g=Uf(e,h);xn(e,g,h,h.$async)}function m(h){let g=t.scopeValue("schema",a.code.source===!0?{ref:h,code:J.stringify(h)}:{ref:h}),x=t.name("valid"),w=e.subschema({schema:h,dataTypes:[],schemaPath:J.nil,topSchemaRef:g,errSchemaPath:r},x);e.mergeEvaluated(w),e.ok(x)}}};function Uf(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):J._`${r.scopeValue("wrapper",{ref:t})}.validate`}Vf.getValidate=Uf;function xn(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:u}=s,c=u.passContext?yr.default.this:J.nil;if(o)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{if(n.code(J._`await ${bn.callValidateCode(e,t,c)}`),m(t),!i)n.assign(h,!0)},(g)=>{if(n.if(J._`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),f(g),!i)n.assign(h,!1)}),e.ok(h)}function d(){e.result(bn.callValidateCode(e,t,c),()=>m(t),()=>f(t))}function f(h){let g=J._`${h}.errors`;n.assign(yr.default.vErrors,J._`${yr.default.vErrors} === null ? ${g} : ${yr.default.vErrors}.concat(${g})`),n.assign(yr.default.errors,J._`${yr.default.vErrors}.length`)}function m(h){var g;if(!s.opts.unevaluated)return;let x=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(x&&!x.dynamicProps){if(x.props!==void 0)s.props=kt.mergeEvaluated.props(n,x.props,s.props)}else{let w=n.var("props",J._`${h}.evaluated.props`);s.props=kt.mergeEvaluated.props(n,w,s.props,J.Name)}if(s.items!==!0)if(x&&!x.dynamicItems){if(x.items!==void 0)s.items=kt.mergeEvaluated.items(n,x.items,s.items)}else{let w=n.var("items",J._`${h}.evaluated.items`);s.items=kt.mergeEvaluated.items(n,w,s.items,J.Name)}}}Vf.callRef=xn;Vf.default=u0});var Bf=T(function(Kf){Object.defineProperty(Kf,"__esModule",{value:!0});var p0=Lf(),f0=Hf(),m0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",p0.default,f0.default];Kf.default=m0});var Jf=T(function(Wf){Object.defineProperty(Wf,"__esModule",{value:!0});var Et=U(),Pt=Et.operators,Sn={maximum:{okStr:"<=",ok:Pt.LTE,fail:Pt.GT},minimum:{okStr:">=",ok:Pt.GTE,fail:Pt.LT},exclusiveMaximum:{okStr:"<",ok:Pt.LT,fail:Pt.GTE},exclusiveMinimum:{okStr:">",ok:Pt.GT,fail:Pt.LTE}},g0={message:({keyword:e,schemaCode:t})=>Et.str`must be ${Sn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Et._`{comparison: ${Sn[e].okStr}, limit: ${t}}`},_0={keyword:Object.keys(Sn),type:"number",schemaType:"number",$data:!0,error:g0,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(Et._`${r} ${Sn[t].fail} ${o} || isNaN(${r})`)}};Wf.default=_0});var Yf=T(function(Gf){Object.defineProperty(Gf,"__esModule",{value:!0});var We=U(),v0={message:({schemaCode:e})=>We.str`must be multiple of ${e}`,params:({schemaCode:e})=>We._`{multipleOf: ${e}}`},$0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:v0,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?We._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:We._`${i} !== parseInt(${i})`;e.fail$data(We._`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Gf.default=$0});var em=T(function(Xf){Object.defineProperty(Xf,"__esModule",{value:!0});function Qf(e){let t=e.length,r=0,o=0,n;while(o<t)if(r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t){if(n=e.charCodeAt(o),(n&64512)===56320)o++}return r}Xf.default=Qf;Qf.code='require("ajv/dist/runtime/ucs2length").default'});var om=T(function(rm){Object.defineProperty(rm,"__esModule",{value:!0});var Te=U(),tm=V(),b0=em(),z0={message({keyword:e,schemaCode:t}){return Te.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Te._`{limit: ${e}}`},S0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:z0,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Te.operators.GT:Te.operators.LT,i=n.opts.unicode===!1?Te._`${r}.length`:Te._`${tm.useFunc(e.gen,b0.default)}(${r})`;e.fail$data(Te._`${i} ${s} ${o}`)}};rm.default=S0});var am=T(function(im){Object.defineProperty(im,"__esModule",{value:!0});var nm=Ze(),sm=V(),qe=U(),P0={message:({schemaCode:e})=>qe.str`must match pattern "${e}"`,params:({schemaCode:e})=>qe._`{pattern: ${e}}`},E0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:P0,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:u}=i.opts.code,c=u.code==="new RegExp"?qe._`new RegExp`:sm.useFunc(t,u),l=t.let("valid");t.try(()=>t.assign(l,qe._`${c}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(qe._`!${l}`)}else{let u=nm.usePattern(e,n);e.fail$data(qe._`!${u}.test(${r})`)}}};im.default=E0});var um=T(function(cm){Object.defineProperty(cm,"__esModule",{value:!0});var Je=U(),R0={message({keyword:e,schemaCode:t}){return Je.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Je._`{limit: ${e}}`},I0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:R0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?Je.operators.GT:Je.operators.LT;e.fail$data(Je._`Object.keys(${r}).length ${n} ${o}`)}};cm.default=I0});var pm=T(function(dm){Object.defineProperty(dm,"__esModule",{value:!0});var Ge=Ze(),Ye=U(),lm=V(),O0={message:({params:{missingProperty:e}})=>Ye.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Ye._`{missingProperty: ${e}}`},j0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:O0,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let u=r.length>=a.loopRequired;if(i.allErrors)c();else l();if(a.strictRequired){let m=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if((m===null||m===void 0?void 0:m[g])===void 0&&!h.has(g)){let x=i.schemaEnv.baseId+i.errSchemaPath,w=`required property "${g}" is not defined at "${x}" (strictRequired)`;lm.checkStrictMode(i,w,i.opts.strictRequired)}}function c(){if(u||s)e.block$data(Ye.nil,d);else for(let m of r)Ge.checkReportMissingProp(e,m)}function l(){let m=t.let("missing");if(u||s){let h=t.let("valid",!0);e.block$data(h,()=>f(m,h)),e.ok(h)}else t.if(Ge.checkMissingProp(e,r,m)),Ge.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",o,(m)=>{e.setParams({missingProperty:m}),t.if(Ge.noPropertyInData(t,n,m,a.ownProperties),()=>e.error())})}function f(m,h){e.setParams({missingProperty:m}),t.forOf(m,o,()=>{t.assign(h,Ge.propertyInData(t,n,m,a.ownProperties)),t.if(Ye.not(h),()=>{e.error(),t.break()})},Ye.nil)}}};dm.default=j0});var mm=T(function(fm){Object.defineProperty(fm,"__esModule",{value:!0});var Qe=U(),A0={message({keyword:e,schemaCode:t}){return Qe.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Qe._`{limit: ${e}}`},Z0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:A0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?Qe.operators.GT:Qe.operators.LT;e.fail$data(Qe._`${r}.length ${n} ${o}`)}};fm.default=Z0});var kn=T(function(gm){Object.defineProperty(gm,"__esModule",{value:!0});var hm=Ci();hm.code='require("ajv/dist/runtime/equal").default';gm.default=hm});var vm=T(function(ym){Object.defineProperty(ym,"__esModule",{value:!0});var vr=oo(),F=U(),_m=V(),D0=kn(),L0={message:({params:{i:e,j:t}})=>F.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>F._`{i: ${e}, j: ${t}}`},U0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:L0,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let u=t.let("valid"),c=s.items?vr.getSchemaTypes(s.items):[];e.block$data(u,l,F._`${i} === false`),e.ok(u);function l(){let h=t.let("i",F._`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(u,!0),t.if(F._`${h} > 1`,()=>(d()?f:m)(h,g))}function d(){return c.length>0&&!c.some((h)=>h==="object"||h==="array")}function f(h,g){let x=t.name("item"),w=vr.checkDataTypes(c,x,a.opts.strictNumbers,vr.DataType.Wrong),E=t.const("indices",F._`{}`);t.for(F._`;${h}--;`,()=>{if(t.let(x,F._`${r}[${h}]`),t.if(w,F._`continue`),c.length>1)t.if(F._`typeof ${x} == "string"`,F._`${x} += "_"`);t.if(F._`typeof ${E}[${x}] == "number"`,()=>{t.assign(g,F._`${E}[${x}]`),e.error(),t.assign(u,!1).break()}).code(F._`${E}[${x}] = ${h}`)})}function m(h,g){let x=_m.useFunc(t,D0.default),w=t.name("outer");t.label(w).for(F._`;${h}--;`,()=>t.for(F._`${g} = ${h}; ${g}--;`,()=>t.if(F._`${x}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(u,!1).break(w)})))}}};ym.default=U0});var xm=T(function(wm){Object.defineProperty(wm,"__esModule",{value:!0});var $r=U(),$m=V(),F0=kn(),H0={message:"must be equal to constant",params:({schemaCode:e})=>$r._`{allowedValue: ${e}}`},K0={keyword:"const",$data:!0,error:H0,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;if(o||s&&typeof s=="object")e.fail$data($r._`!${$m.useFunc(t,F0.default)}(${r}, ${n})`);else e.fail($r._`${s} !== ${r}`)}};wm.default=K0});var Sm=T(function(zm){Object.defineProperty(zm,"__esModule",{value:!0});var Xe=U(),bm=V(),W0=kn(),J0={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Xe._`{allowedValues: ${e}}`},G0={keyword:"enum",schemaType:"array",$data:!0,error:J0,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,u,c=()=>u!==null&&u!==void 0?u:u=bm.useFunc(t,W0.default),l;if(a||o)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(n))throw Error("ajv implementation error");let m=t.const("vSchema",s);l=Xe.or(...n.map((h,g)=>f(m,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(m)=>t.if(Xe._`${c()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function f(m,h){let g=n[h];return typeof g==="object"&&g!==null?Xe._`${c()}(${r}, ${m}[${h}])`:Xe._`${r} === ${g}`}}};zm.default=G0});var Pm=T(function(km){Object.defineProperty(km,"__esModule",{value:!0});var Q0=Jf(),X0=Yf(),ez=om(),tz=am(),rz=um(),oz=pm(),nz=mm(),sz=vm(),iz=xm(),az=Sm(),cz=[Q0.default,X0.default,ez.default,tz.default,rz.default,oz.default,nz.default,sz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},iz.default,az.default];km.default=cz});var Hi=T(function(Tm){Object.defineProperty(Tm,"__esModule",{value:!0});Tm.validateAdditionalItems=void 0;var Re=U(),wr=V(),lz={message:({params:{len:e}})=>Re.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Re._`{limit: ${e}}`},dz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:lz,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){wr.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Em(e,o)}};function Em(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",Re._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass(Re._`${a} <= ${t.length}`);else if(typeof o=="object"&&!wr.alwaysValidSchema(i,o)){let c=r.var("valid",Re._`${a} <= ${t.length}`);r.if(Re.not(c),()=>u(c)),e.ok(c)}function u(c){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:wr.Type.Num},c),!i.allErrors)r.if(Re.not(c),()=>r.break())})}}Tm.validateAdditionalItems=Em;Tm.default=dz});var Ki=T(function(Om){Object.defineProperty(Om,"__esModule",{value:!0});Om.validateTuple=void 0;var Pn=U(),Tt=V(),Im=Ze(),fz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Cm(e,"additionalItems",t);if(r.items=!0,Tt.alwaysValidSchema(r,t))return;e.ok(Im.validateArray(e))}};function Cm(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;if(l(n),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=Tt.mergeEvaluated.items(o,r.length,a.items);let u=o.name("valid"),c=o.const("len",Pn._`${s}.length`);r.forEach((d,f)=>{if(Tt.alwaysValidSchema(a,d))return;o.if(Pn._`${c} > ${f}`,()=>e.subschema({keyword:i,schemaProp:f,dataProp:f},u)),e.ok(u)});function l(d){let{opts:f,errSchemaPath:m}=a,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(f.strictTuples&&!g){let x=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;Tt.checkStrictMode(a,x,f.strictTuples)}}}Om.validateTuple=Cm;Om.default=fz});var Zm=T(function(Am){Object.defineProperty(Am,"__esModule",{value:!0});var Nm=Ki(),hz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>Nm.validateTuple(e,"items")};Am.default=hz});var Um=T(function(Lm){Object.defineProperty(Lm,"__esModule",{value:!0});var En=U(),qm=V(),Mm=Ze(),Dm=Hi(),_z={message:({params:{len:e}})=>En.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>En._`{limit: ${e}}`},yz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:_z,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,qm.alwaysValidSchema(o,t))return;if(n)Dm.validateAdditionalItems(e,n);else e.ok(Mm.validateArray(e))}};Lm.default=yz});var Fm=T(function(Vm){Object.defineProperty(Vm,"__esModule",{value:!0});var ae=U(),Rt=V(),$z={message:({params:{min:e,max:t}})=>t===void 0?ae.str`must contain at least ${e} valid item(s)`:ae.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ae._`{minContains: ${e}}`:ae._`{minContains: ${e}, maxContains: ${t}}`},wz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:$z,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:u,maxContains:c}=o;if(s.opts.next)i=u===void 0?1:u,a=c;else i=1;let l=t.const("len",ae._`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Rt.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Rt.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Rt.alwaysValidSchema(s,r)){let g=ae._`${l} >= ${i}`;if(a!==void 0)g=ae._`${g} && ${l} <= ${a}`;e.pass(g);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)m(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(ae._`${n}.length > 0`,f)}else t.let(d,!1),f();e.result(d,()=>e.reset());function f(){let g=t.name("_valid"),x=t.let("count",0);m(g,()=>t.if(g,()=>h(x)))}function m(g,x){t.forRange("i",0,l,(w)=>{e.subschema({keyword:"contains",dataProp:w,dataPropType:Rt.Type.Num,compositeRule:!0},g),x()})}function h(g){if(t.code(ae._`${g}++`),a===void 0)t.if(ae._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(ae._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(ae._`${g} >= ${i}`,()=>t.assign(d,!0))}}};Vm.default=wz});var Ym=T(function(Wm){Object.defineProperty(Wm,"__esModule",{value:!0});Wm.validateSchemaDeps=Wm.validatePropertyDeps=Wm.error=void 0;var xr=U(),Hm=V(),et=Ze();Wm.error={message:({params:{property:e,depsCount:t,deps:r}})=>xr.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>xr._`{property: ${e},
|
|
7
|
-
missingProperty: ${
|
|
2
|
+
var Bv=Object.create;var{getPrototypeOf:Jv,defineProperty:Wc,getOwnPropertyNames:Kv}=Object;var Gc=Object.prototype.hasOwnProperty;function Wv(e){return this[e]}var Gv,Xv,Xc=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?Gv??=new WeakMap:Xv??=new WeakMap,s=o.get(e);if(s)return s}r=e!=null?Bv(Jv(e)):{};let i=t||!e||!e.__esModule||!Gc.call(e,"default")?Wc(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Kv(e))if(!Gc.call(i,a))Wc(i,a,{get:Wv.bind(e,a),enumerable:!0})}if(n)o.set(e,i);return i};var E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Rn=E(function(im){Object.defineProperty(im,"__esModule",{value:!0});im.regexpCode=im.getEsmExportName=im.getProperty=im.safeStringify=im.stringify=im.strConcat=im.addCodeArg=im.str=im._=im.nil=im._Code=im.Name=im.IDENTIFIER=im._CodeOrName=void 0;class Uo{}im._CodeOrName=Uo;im.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Tr extends Uo{constructor(e){super();if(!im.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}im.Name=Tr;class Ye extends Uo{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((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof Tr)t[r.str]=(t[r.str]||0)+1;return t},{})}}im._Code=Ye;im.nil=new Ye("");function om(e,...t){let r=[e[0]],n=0;while(n<t.length)Oa(r,t[n]),r.push(e[++n]);return new Ye(r)}im._=om;var Ra=new Ye("+");function sm(e,...t){let r=[Tn(e[0])],n=0;while(n<t.length)r.push(Ra),Oa(r,t[n]),r.push(Ra,Tn(e[++n]));return zx(r),new Ye(r)}im.str=sm;function Oa(e,t){if(t instanceof Ye)e.push(...t._items);else if(t instanceof Tr)e.push(t);else e.push(Px(t))}im.addCodeArg=Oa;function zx(e){let t=1;while(t<e.length-1){if(e[t]===Ra){let r=Sx(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Sx(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Tr||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Tr))return`"${e}${t.slice(1)}`;return}function kx(e,t){return t.emptyStr()?e:e.emptyStr()?t:sm`${e}${t}`}im.strConcat=kx;function Px(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Tn(Array.isArray(e)?e.join(","):e)}function Ex(e){return new Ye(Tn(e))}im.stringify=Ex;function Tn(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}im.safeStringify=Tn;function Tx(e){return typeof e=="string"&&im.IDENTIFIER.test(e)?new Ye(`.${e}`):om`[${e}]`}im.getProperty=Tx;function Rx(e){if(typeof e=="string"&&im.IDENTIFIER.test(e))return new Ye(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}im.getEsmExportName=Rx;function Ox(e){return new Ye(e.toString())}im.regexpCode=Ox});var Na=E(function(lm){Object.defineProperty(lm,"__esModule",{value:!0});lm.ValueScope=lm.ValueScopeName=lm.Scope=lm.varKinds=lm.UsedValueState=void 0;var G=Rn();class cm extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Vo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Vo||(lm.UsedValueState=Vo={}));lm.varKinds={const:new G.Name("const"),let:new G.Name("let"),var:new G.Name("var")};class Ca{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof G.Name?e:this.name(e)}name(e){return new G.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}lm.Scope=Ca;class Aa extends G.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=G._`.${new G.Name(t)}[${r}]`}}lm.ValueScopeName=Aa;var Vx=G._`\n`;class um extends Ca{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Vx:G.nil}}get(){return this._scope}name(e){return new Aa(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:o}=n,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[o];if(i){let c=i.get(s);if(c)return c}else i=this._values[o]=new Map;i.set(s,n);let a=this._scope[o]||(this._scope[o]=[]),u=a.length;return a[u]=t.ref,n.setValue(t,{property:o,itemIndex:u}),n}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return G._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(n)=>{if(n.value===void 0)throw Error(`CodeGen: name "${n}" has no value`);return n.value.code},t,r)}_reduceValues(e,t,r={},n){let o=G.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((u)=>{if(a.has(u))return;a.set(u,Vo.Started);let c=t(u);if(c){let l=this.opts.es5?lm.varKinds.var:lm.varKinds.const;o=G._`${o}${l} ${u} = ${c};${this.opts._n}`}else if(c=n===null||n===void 0?void 0:n(u))o=G._`${o}${c}${this.opts._n}`;else throw new cm(u);a.set(u,Vo.Completed)})}return o}}lm.ValueScope=um});var L=E(function(Ce){Object.defineProperty(Ce,"__esModule",{value:!0});Ce.or=Ce.and=Ce.not=Ce.CodeGen=Ce.operators=Ce.varKinds=Ce.ValueScopeName=Ce.ValueScope=Ce.Scope=Ce.Name=Ce.regexpCode=Ce.stringify=Ce.getProperty=Ce.nil=Ce.strConcat=Ce.str=Ce._=void 0;var T=Rn(),le=Na(),Nt=Rn();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return Nt._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return Nt.str}});Object.defineProperty(Ce,"strConcat",{enumerable:!0,get:function(){return Nt.strConcat}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return Nt.nil}});Object.defineProperty(Ce,"getProperty",{enumerable:!0,get:function(){return Nt.getProperty}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return Nt.stringify}});Object.defineProperty(Ce,"regexpCode",{enumerable:!0,get:function(){return Nt.regexpCode}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return Nt.Name}});var Go=Na();Object.defineProperty(Ce,"Scope",{enumerable:!0,get:function(){return Go.Scope}});Object.defineProperty(Ce,"ValueScope",{enumerable:!0,get:function(){return Go.ValueScope}});Object.defineProperty(Ce,"ValueScopeName",{enumerable:!0,get:function(){return Go.ValueScopeName}});Object.defineProperty(Ce,"varKinds",{enumerable:!0,get:function(){return Go.varKinds}});Ce.operators={GT:new T._Code(">"),GTE:new T._Code(">="),LT:new T._Code("<"),LTE:new T._Code("<="),EQ:new T._Code("==="),NEQ:new T._Code("!=="),NOT:new T._Code("!"),OR:new T._Code("||"),AND:new T._Code("&&"),ADD:new T._Code("+")};class jt{optimizeNodes(){return this}optimizeNames(e,t){return this}}class fm extends jt{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?le.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${n};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Or(this.rhs,e,t);return this}get names(){return this.rhs instanceof T._CodeOrName?this.rhs.names:{}}}class Da extends jt{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof T.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Or(this.rhs,e,t),this}get names(){let e=this.lhs instanceof T.Name?{}:{...this.lhs.names};return Wo(e,this.rhs)}}class pm extends Da{constructor(e,t,r,n){super(e,r,n);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class mm extends jt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class hm extends jt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class gm extends jt{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class _m extends jt{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Or(this.code,e,t),this}get names(){return this.code instanceof T._CodeOrName?this.code.names:{}}}class Xo extends jt{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,n=r.length;while(n--){let o=r[n];if(o.optimizeNames(e,t))continue;Kx(e,o.names),r.splice(n,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>cr(e,t.names),{})}}class Zt extends Xo{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class ym extends Xo{}class On extends Zt{}On.kind="else";class wt extends Zt{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new On(r):r}if(t){if(e===!1)return t instanceof wt?t:t.nodes;if(this.nodes.length)return this;return new wt($m(e),t instanceof wt?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Or(this.condition,e,t),this}get names(){let e=super.names;if(Wo(e,this.condition),this.else)cr(e,this.else.names);return e}}wt.kind="if";class Rr extends Zt{}Rr.kind="for";class vm extends Rr{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=Or(this.iteration,e,t),this}get names(){return cr(super.names,this.iteration.names)}}class bm extends Rr{constructor(e,t,r,n){super();this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){let t=e.es5?le.varKinds.var:this.varKind,{name:r,from:n,to:o}=this;return`for(${t} ${r}=${n}; ${r}<${o}; ${r}++)`+super.render(e)}get names(){let e=Wo(super.names,this.from);return Wo(e,this.to)}}class ja extends Rr{constructor(e,t,r,n){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=Or(this.iterable,e,t),this}get names(){return cr(super.names,this.iterable.names)}}class Ho extends Zt{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}Ho.kind="func";class Bo extends Xo{render(e){return"return "+super.render(e)}}Bo.kind="return";class wm extends Zt{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(n=this.finally)===null||n===void 0||n.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)cr(e,this.catch.names);if(this.finally)cr(e,this.finally.names);return e}}class Jo extends Zt{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Jo.kind="catch";class Ko extends Zt{render(e){return"finally"+super.render(e)}}Ko.kind="finally";class xm{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new le.Scope({parent:e}),this._nodes=[new ym]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){let o=this._scope.toName(t);if(r!==void 0&&n)this._constants[o.str]=r;return this._leafNode(new fm(e,o,r)),o}const(e,t,r){return this._def(le.varKinds.const,e,t,r)}let(e,t,r){return this._def(le.varKinds.let,e,t,r)}var(e,t,r){return this._def(le.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Da(e,t,r))}add(e,t){return this._leafNode(new pm(e,Ce.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==T.nil)this._leafNode(new _m(e));return this}object(...e){let t=["{"];for(let[r,n]of e){if(t.length>1)t.push(",");if(t.push(r),r!==n||this.opts.es5)t.push(":"),T.addCodeArg(t,n)}return t.push("}"),new T._Code(t)}if(e,t,r){if(this._blockNode(new wt(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new wt(e))}else(){return this._elseNode(new On)}endIf(){return this._endBlockNode(wt,On)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new vm(e),t)}forRange(e,t,r,n,o=this.opts.es5?le.varKinds.var:le.varKinds.let){let s=this._scope.toName(e);return this._for(new bm(o,s,t,r),()=>n(s))}forOf(e,t,r,n=le.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let s=t instanceof T.Name?t:this.var("_arr",t);return this.forRange("_i",0,T._`${s}.length`,(i)=>{this.var(o,T._`${s}[${i}]`),r(o)})}return this._for(new ja("of",n,o,t),()=>r(o))}forIn(e,t,r,n=this.opts.es5?le.varKinds.var:le.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,T._`Object.keys(${t})`,r);let o=this._scope.toName(e);return this._for(new ja("in",n,o,t),()=>r(o))}endFor(){return this._endBlockNode(Rr)}label(e){return this._leafNode(new mm(e))}break(e){return this._leafNode(new hm(e))}return(e){let t=new Bo;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Bo)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let n=new wm;if(this._blockNode(n),this.code(e),t){let o=this.name("e");this._currNode=n.catch=new Jo(o),t(o)}if(r)this._currNode=n.finally=new Ko,this.code(r);return this._endBlockNode(Jo,Ko)}throw(e){return this._leafNode(new gm(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=T.nil,r,n){if(this._blockNode(new Ho(e,t,r)),n)this.code(n).endFunc();return this}endFunc(){return this._endBlockNode(Ho)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof wt))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}Ce.CodeGen=xm;function cr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Wo(e,t){return t instanceof T._CodeOrName?cr(e,t.names):e}function Or(e,t,r){if(e instanceof T.Name)return n(e);if(!o(e))return e;return new T._Code(e._items.reduce((s,i)=>{if(i instanceof T.Name)i=n(i);if(i instanceof T._Code)s.push(...i._items);else s.push(i);return s},[]));function n(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function o(s){return s instanceof T._Code&&s._items.some((i)=>i instanceof T.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function Kx(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function $m(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:T._`!${Za(e)}`}Ce.not=$m;var Wx=zm(Ce.operators.AND);function Gx(...e){return e.reduce(Wx)}Ce.and=Gx;var Xx=zm(Ce.operators.OR);function Yx(...e){return e.reduce(Xx)}Ce.or=Yx;function zm(e){return(t,r)=>t===T.nil?r:r===T.nil?t:T._`${Za(t)} ${e} ${Za(r)}`}function Za(e){return e instanceof T.Name?e:T._`(${e})`}});var V=E(function(Am){Object.defineProperty(Am,"__esModule",{value:!0});Am.checkStrictMode=Am.getErrorPath=Am.Type=Am.useFunc=Am.setEvaluated=Am.evaluatedPropsToName=Am.mergeEvaluated=Am.eachItem=Am.unescapeJsonPointer=Am.escapeJsonPointer=Am.escapeFragment=Am.unescapeFragment=Am.schemaRefOrVal=Am.schemaHasRulesButRef=Am.schemaHasRules=Am.checkUnknownRules=Am.alwaysValidSchema=Am.toHash=void 0;var Z=L(),Em=Rn();function r$(e){let t={};for(let r of e)t[r]=!0;return t}Am.toHash=r$;function n$(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return Tm(e,t),!Rm(t,e.self.RULES.all)}Am.alwaysValidSchema=n$;function Tm(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let o=n.RULES.keywords;for(let s in t)if(!o[s])Cm(e,`unknown keyword: "${s}"`)}Am.checkUnknownRules=Tm;function Rm(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Am.schemaHasRules=Rm;function o$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Am.schemaHasRulesButRef=o$;function s$({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return Z._`${r}`}return Z._`${e}${t}${Z.getProperty(n)}`}Am.schemaRefOrVal=s$;function i$(e){return Om(decodeURIComponent(e))}Am.unescapeFragment=i$;function a$(e){return encodeURIComponent(qa(e))}Am.escapeFragment=a$;function qa(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Am.escapeJsonPointer=qa;function Om(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Am.unescapeJsonPointer=Om;function c$(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Am.eachItem=c$;function km({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let u=i===void 0?s:i instanceof Z.Name?(s instanceof Z.Name?e(o,s,i):t(o,s,i),i):s instanceof Z.Name?(t(o,i,s),s):r(s,i);return a===Z.Name&&!(u instanceof Z.Name)?n(o,u):u}}Am.mergeEvaluated={props:km({mergeNames:(e,t,r)=>e.if(Z._`${r} !== true && ${t} !== undefined`,()=>{e.if(Z._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,Z._`${r} || {}`).code(Z._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(Z._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,Z._`${r} || {}`),La(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Im}),items:km({mergeNames:(e,t,r)=>e.if(Z._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,Z._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(Z._`${r} !== true`,()=>e.assign(r,t===!0?!0:Z._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Im(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",Z._`{}`);if(t!==void 0)La(e,r,t);return r}Am.evaluatedPropsToName=Im;function La(e,t,r){Object.keys(r).forEach((n)=>e.assign(Z._`${t}${Z.getProperty(n)}`,!0))}Am.setEvaluated=La;var Pm={};function u$(e,t){return e.scopeValue("func",{ref:t,code:Pm[t.code]||(Pm[t.code]=new Em._Code(t.code))})}Am.useFunc=u$;var Ma;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ma||(Am.Type=Ma={}));function l$(e,t,r){if(e instanceof Z.Name){let n=t===Ma.Num;return r?n?Z._`"[" + ${e} + "]"`:Z._`"['" + ${e} + "']"`:n?Z._`"/" + ${e}`:Z._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?Z.getProperty(e).toString():"/"+qa(e)}Am.getErrorPath=l$;function Cm(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Am.checkStrictMode=Cm});var xt=E(function(jm){Object.defineProperty(jm,"__esModule",{value:!0});var K=L(),E$={data:new K.Name("data"),valCxt:new K.Name("valCxt"),instancePath:new K.Name("instancePath"),parentData:new K.Name("parentData"),parentDataProperty:new K.Name("parentDataProperty"),rootData:new K.Name("rootData"),dynamicAnchors:new K.Name("dynamicAnchors"),vErrors:new K.Name("vErrors"),errors:new K.Name("errors"),this:new K.Name("this"),self:new K.Name("self"),scope:new K.Name("scope"),json:new K.Name("json"),jsonPos:new K.Name("jsonPos"),jsonLen:new K.Name("jsonLen"),jsonPart:new K.Name("jsonPart")};jm.default=E$});var In=E(function(qm){Object.defineProperty(qm,"__esModule",{value:!0});qm.extendErrors=qm.resetErrorsCount=qm.reportExtraError=qm.reportError=qm.keyword$DataError=qm.keywordError=void 0;var R=L(),Dt=V(),Te=xt();qm.keywordError={message:({keyword:e})=>R.str`must pass "${e}" keyword validation`};qm.keyword$DataError={message:({keyword:e,schemaType:t})=>t?R.str`"${e}" keyword must be ${t} ($data)`:R.str`"${e}" keyword is invalid ($data)`};function R$(e,t=qm.keywordError,r,n){let{it:o}=e,{gen:s,compositeRule:i,allErrors:a}=o,u=Mm(e,t,r);if(n!==null&&n!==void 0?n:i||a)Zm(s,u);else Dm(o,R._`[${u}]`)}qm.reportError=R$;function O$(e,t=qm.keywordError,r){let{it:n}=e,{gen:o,compositeRule:s,allErrors:i}=n,a=Mm(e,t,r);if(Zm(o,a),!(s||i))Dm(n,Te.default.vErrors)}qm.reportExtraError=O$;function I$(e,t){e.assign(Te.default.errors,t),e.if(R._`${Te.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(R._`${Te.default.vErrors}.length`,t),()=>e.assign(Te.default.vErrors,null)))}qm.resetErrorsCount=I$;function C$({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",o,Te.default.errors,(a)=>{if(e.const(i,R._`${Te.default.vErrors}[${a}]`),e.if(R._`${i}.instancePath === undefined`,()=>e.assign(R._`${i}.instancePath`,R.strConcat(Te.default.instancePath,s.errorPath))),e.assign(R._`${i}.schemaPath`,R.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(R._`${i}.schema`,r),e.assign(R._`${i}.data`,n)})}qm.extendErrors=C$;function Zm(e,t){let r=e.const("err",t);e.if(R._`${Te.default.vErrors} === null`,()=>e.assign(Te.default.vErrors,R._`[${r}]`),R._`${Te.default.vErrors}.push(${r})`),e.code(R._`${Te.default.errors}++`)}function Dm(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;if(o.$async)r.throw(R._`new ${e.ValidationError}(${t})`);else r.assign(R._`${n}.errors`,t),r.return(!1)}var ur={keyword:new R.Name("keyword"),schemaPath:new R.Name("schemaPath"),params:new R.Name("params"),propertyName:new R.Name("propertyName"),message:new R.Name("message"),schema:new R.Name("schema"),parentSchema:new R.Name("parentSchema")};function Mm(e,t,r){let{createErrors:n}=e.it;if(n===!1)return R._`{}`;return A$(e,t,r)}function A$(e,t,r={}){let{gen:n,it:o}=e,s=[N$(o,r),j$(e,r)];return Z$(e,t,s),n.object(...s)}function N$({errorPath:e},{instancePath:t}){let r=t?R.str`${e}${Dt.getErrorPath(t,Dt.Type.Str)}`:e;return[Te.default.instancePath,R.strConcat(Te.default.instancePath,r)]}function j$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:R.str`${t}/${e}`;if(r)o=R.str`${o}${Dt.getErrorPath(r,Dt.Type.Str)}`;return[ur.schemaPath,o]}function Z$(e,{params:t,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=e,{opts:u,propertyName:c,topSchemaRef:l,schemaPath:d}=a;if(n.push([ur.keyword,o],[ur.params,typeof t=="function"?t(e):t||R._`{}`]),u.messages)n.push([ur.message,typeof r=="function"?r(e):r]);if(u.verbose)n.push([ur.schema,i],[ur.parentSchema,R._`${l}${d}`],[Te.default.data,s]);if(c)n.push([ur.propertyName,c])}});var Jm=E(function(Hm){Object.defineProperty(Hm,"__esModule",{value:!0});Hm.boolOrEmptySchema=Hm.topBoolOrEmptySchema=void 0;var Um=In(),Fm=L(),U$=xt(),F$={message:"boolean schema is false"};function V$(e){let{gen:t,schema:r,validateName:n}=e;if(r===!1)Vm(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(U$.default.data);else t.assign(Fm._`${n}.errors`,null),t.return(!0)}Hm.topBoolOrEmptySchema=V$;function H$(e,t){let{gen:r,schema:n}=e;if(n===!1)r.var(t,!1),Vm(e);else r.var(t,!0)}Hm.boolOrEmptySchema=H$;function Vm(e,t){let{gen:r,data:n}=e;Um.reportError({gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},F$,void 0,t)}});var Fa=E(function(Km){Object.defineProperty(Km,"__esModule",{value:!0});Km.getRules=Km.isJSONType=void 0;var J$=["string","number","integer","boolean","null","object","array"],K$=new Set(J$);function W$(e){return typeof e=="string"&&K$.has(e)}Km.isJSONType=W$;function G$(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Km.getRules=G$});var Va=E(function(Ym){Object.defineProperty(Ym,"__esModule",{value:!0});Ym.shouldUseRule=Ym.shouldUseGroup=Ym.schemaHasRulesForType=void 0;function Y$({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Gm(e,n)}Ym.schemaHasRulesForType=Y$;function Gm(e,t){return t.rules.some((r)=>Xm(e,r))}Ym.shouldUseGroup=Gm;function Xm(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((n)=>e[n]!==void 0))}Ym.shouldUseRule=Xm});var Cn=E(function(sh){Object.defineProperty(sh,"__esModule",{value:!0});sh.reportTypeError=sh.checkDataTypes=sh.checkDataType=sh.coerceAndCheckDataType=sh.getJSONTypes=sh.getSchemaTypes=sh.DataType=void 0;var eh=Fa(),th=Va(),rh=In(),z=L(),Qo=V(),Ir;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(Ir||(sh.DataType=Ir={}));function tz(e){let t=nh(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}sh.getSchemaTypes=tz;function nh(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(eh.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}sh.getJSONTypes=nh;function rz(e,t){let{gen:r,data:n,opts:o}=e,s=nz(t,o.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&th.schemaHasRulesForType(e,t[0]));if(i){let a=Ba(t,n,o.strictNumbers,Ir.Wrong);r.if(a,()=>{if(s.length)oz(e,t,s);else Ja(e)})}return i}sh.coerceAndCheckDataType=rz;var oh=new Set(["string","number","integer","boolean","null"]);function nz(e,t){return t?e.filter((r)=>oh.has(r)||t==="array"&&r==="array"):[]}function oz(e,t,r){let{gen:n,data:o,opts:s}=e,i=n.let("dataType",z._`typeof ${o}`),a=n.let("coerced",z._`undefined`);if(s.coerceTypes==="array")n.if(z._`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,z._`${o}[0]`).assign(i,z._`typeof ${o}`).if(Ba(t,o,s.strictNumbers),()=>n.assign(a,o)));n.if(z._`${a} !== undefined`);for(let c of r)if(oh.has(c)||c==="array"&&s.coerceTypes==="array")u(c);n.else(),Ja(e),n.endIf(),n.if(z._`${a} !== undefined`,()=>{n.assign(o,a),sz(e,a)});function u(c){switch(c){case"string":n.elseIf(z._`${i} == "number" || ${i} == "boolean"`).assign(a,z._`"" + ${o}`).elseIf(z._`${o} === null`).assign(a,z._`""`);return;case"number":n.elseIf(z._`${i} == "boolean" || ${o} === null
|
|
4
|
+
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,z._`+${o}`);return;case"integer":n.elseIf(z._`${i} === "boolean" || ${o} === null
|
|
5
|
+
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,z._`+${o}`);return;case"boolean":n.elseIf(z._`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf(z._`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf(z._`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf(z._`${i} === "string" || ${i} === "number"
|
|
6
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,z._`[${o}]`)}}}function sz({gen:e,parentData:t,parentDataProperty:r},n){e.if(z._`${t} !== undefined`,()=>e.assign(z._`${t}[${r}]`,n))}function Ha(e,t,r,n=Ir.Correct){let o=n===Ir.Correct?z.operators.EQ:z.operators.NEQ,s;switch(e){case"null":return z._`${t} ${o} null`;case"array":s=z._`Array.isArray(${t})`;break;case"object":s=z._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(z._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return z._`typeof ${t} ${o} ${e}`}return n===Ir.Correct?s:z.not(s);function i(a=z.nil){return z.and(z._`typeof ${t} == "number"`,a,r?z._`isFinite(${t})`:z.nil)}}sh.checkDataType=Ha;function Ba(e,t,r,n){if(e.length===1)return Ha(e[0],t,r,n);let o,s=Qo.toHash(e);if(s.array&&s.object){let i=z._`typeof ${t} != "object"`;o=s.null?i:z._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else o=z.nil;if(s.number)delete s.integer;for(let i in s)o=z.and(o,Ha(i,t,r,n));return o}sh.checkDataTypes=Ba;var iz={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?z._`{type: ${e}}`:z._`{type: ${t}}`};function Ja(e){let t=az(e);rh.reportError(t,iz)}sh.reportTypeError=Ja;function az(e){let{gen:t,data:r,schema:n}=e,o=Qo.schemaRefOrVal(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var dh=E(function(uh){Object.defineProperty(uh,"__esModule",{value:!0});uh.assignDefaults=void 0;var Be=L(),ch=V();function mz(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)ah(e,o,r[o].default);else if(t==="array"&&Array.isArray(n))n.forEach((o,s)=>ah(e,s,o.default))}uh.assignDefaults=mz;function ah(e,t,r){let{gen:n,compositeRule:o,data:s,opts:i}=e;if(r===void 0)return;let a=Be._`${s}${Be.getProperty(t)}`;if(o){ch.checkStrictMode(e,`default is ignored for: ${a}`);return}let u=Be._`${a} === undefined`;if(i.useDefaults==="empty")u=Be._`${u} || ${a} === null || ${a} === ""`;n.if(u,Be._`${a} = ${Be.stringify(r)}`)}});var Je=E(function(hh){Object.defineProperty(hh,"__esModule",{value:!0});hh.validateUnion=hh.validateArray=hh.usePattern=hh.callValidateCode=hh.schemaProperties=hh.allSchemaProperties=hh.noPropertyInData=hh.propertyInData=hh.isOwnProperty=hh.hasPropFunc=hh.reportMissingProp=hh.checkMissingProp=hh.checkReportMissingProp=void 0;var D=L(),Cr=V(),Mt=xt(),fh=V();function hz(e,t){let{gen:r,data:n,it:o}=e;r.if(Wa(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:D._`${t}`},!0),e.error()})}hh.checkReportMissingProp=hz;function gz({gen:e,data:t,it:{opts:r}},n,o){return D.or(...n.map((s)=>D.and(Wa(e,t,s,r.ownProperties),D._`${o} = ${s}`)))}hh.checkMissingProp=gz;function _z(e,t){e.setParams({missingProperty:t},!0),e.error()}hh.reportMissingProp=_z;function ph(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:D._`Object.prototype.hasOwnProperty`})}hh.hasPropFunc=ph;function Ka(e,t,r){return D._`${ph(e)}.call(${t}, ${r})`}hh.isOwnProperty=Ka;function yz(e,t,r,n){let o=D._`${t}${D.getProperty(r)} !== undefined`;return n?D._`${o} && ${Ka(e,t,r)}`:o}hh.propertyInData=yz;function Wa(e,t,r,n){let o=D._`${t}${D.getProperty(r)} === undefined`;return n?D.or(o,D.not(Ka(e,t,r))):o}hh.noPropertyInData=Wa;function mh(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}hh.allSchemaProperties=mh;function vz(e,t){return mh(t).filter((r)=>!Cr.alwaysValidSchema(e,t[r]))}hh.schemaProperties=vz;function bz({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,u,c){let l=c?D._`${e}, ${t}, ${n}${o}`:t,d=[[Mt.default.instancePath,D.strConcat(Mt.default.instancePath,s)],[Mt.default.parentData,i.parentData],[Mt.default.parentDataProperty,i.parentDataProperty],[Mt.default.rootData,Mt.default.rootData]];if(i.opts.dynamicRef)d.push([Mt.default.dynamicAnchors,Mt.default.dynamicAnchors]);let m=D._`${l}, ${r.object(...d)}`;return u!==D.nil?D._`${a}.call(${u}, ${m})`:D._`${a}(${m})`}hh.callValidateCode=bz;var wz=D._`new RegExp`;function xz({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,s=o(r,n);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:D._`${o.code==="new RegExp"?wz:fh.useFunc(e,o)}(${r}, ${n})`})}hh.usePattern=xz;function $z(e){let{gen:t,data:r,keyword:n,it:o}=e,s=t.name("valid");if(o.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let u=t.const("len",D._`${r}.length`);t.forRange("i",0,u,(c)=>{e.subschema({keyword:n,dataProp:c,dataPropType:Cr.Type.Num},s),t.if(D.not(s),a)})}}hh.validateArray=$z;function zz(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((u)=>Cr.alwaysValidSchema(o,u))&&!o.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:n,schemaProp:c,compositeRule:!0},a);if(t.assign(i,D._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(D.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}hh.validateUnion=zz});var $h=E(function(wh){Object.defineProperty(wh,"__esModule",{value:!0});wh.validateKeywordUsage=wh.validSchemaType=wh.funcKeywordCode=wh.macroKeywordCode=void 0;var W=L(),lr=xt(),yh=Je(),vh=In();function Zz(e,t){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=e,a=t.macro.call(i.self,o,s,i),u=bh(r,n,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:W.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}wh.macroKeywordCode=Zz;function Dz(e,t){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:u}=e;qz(u,t);let c=!a&&t.compile?t.compile.call(u.self,s,i,u):t.validate,l=bh(n,o,c),d=n.let("valid");e.block$data(d,m),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function m(){if(t.errors===!1){if(g(),t.modifying)_h(e);_(()=>e.error())}else{let y=t.async?f():p();if(t.modifying)_h(e);_(()=>Mz(e,y))}}function f(){let y=n.let("ruleErrs",null);return n.try(()=>g(W._`await `),(k)=>n.assign(d,!1).if(W._`${k} instanceof ${u.ValidationError}`,()=>n.assign(y,W._`${k}.errors`),()=>n.throw(k))),y}function p(){let y=W._`${l}.errors`;return n.assign(y,null),g(W.nil),y}function g(y=t.async?W._`await `:W.nil){let k=u.opts.passContext?lr.default.this:lr.default.self,C=!(("compile"in t)&&!a||t.schema===!1);n.assign(d,W._`${y}${yh.callValidateCode(e,l,k,C)}`,t.modifying)}function _(y){var k;n.if(W.not((k=t.valid)!==null&&k!==void 0?k:d),y)}}wh.funcKeywordCode=Dz;function _h(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,W._`${n.parentData}[${n.parentDataProperty}]`))}function Mz(e,t){let{gen:r}=e;r.if(W._`Array.isArray(${t})`,()=>{r.assign(lr.default.vErrors,W._`${lr.default.vErrors} === null ? ${t} : ${lr.default.vErrors}.concat(${t})`).assign(lr.default.errors,W._`${lr.default.vErrors}.length`),vh.extendErrors(e)},()=>e.error())}function qz({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function bh(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:W.stringify(r)})}function Lz(e,t,r=!1){return!t.length||t.some((n)=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}wh.validSchemaType=Lz;function Uz({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw Error("ajv implementation error");let i=o.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){let u=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw Error(u)}}}wh.validateKeywordUsage=Uz});var kh=E(function(zh){Object.defineProperty(zh,"__esModule",{value:!0});zh.extendSubschemaMode=zh.extendSubschemaData=zh.getSubschema=void 0;var ge=L(),es=V();function Bz(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&n!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:ge._`${e.schemaPath}${ge.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:ge._`${e.schemaPath}${ge.getProperty(t)}${ge.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${es.escapeFragment(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}zh.getSubschema=Bz;function Jz(e,t,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:l,opts:d}=t,m=a.let("data",ge._`${t.data}${ge.getProperty(r)}`,!0);u(m),e.errorPath=ge.str`${c}${es.getErrorPath(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=ge._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let c=o instanceof ge.Name?o:a.let("data",o,!0);if(u(c),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}zh.extendSubschemaData=Jz;function Kz(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){if(n!==void 0)e.compositeRule=n;if(o!==void 0)e.createErrors=o;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}zh.extendSubschemaMode=Kz});var Ga=E(function(SZ,Ph){Ph.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Th=E(function(kZ,Eh){var qt=Eh.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};ts(t,n,o,e,"",e)};qt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};qt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};qt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};qt.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 ts(e,t,r,n,o,s,i,a,u,c){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,s,i,a,u,c);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in qt.arrayKeywords)for(var m=0;m<d.length;m++)ts(e,t,r,d[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in qt.propsKeywords){if(d&&typeof d=="object")for(var f in d)ts(e,t,r,d[f],o+"/"+l+"/"+Xz(f),s,o,l,n,f)}else if(l in qt.keywords||e.allKeys&&!(l in qt.skipKeywords))ts(e,t,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,u,c)}}function Xz(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var An=E(function(Ah){Object.defineProperty(Ah,"__esModule",{value:!0});Ah.getSchemaRefs=Ah.resolveUrl=Ah.normalizeId=Ah._getFullPath=Ah.getFullPath=Ah.inlineRef=void 0;var Rh=V(),Yz=Ga(),Qz=Th(),eS=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function tS(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Xa(e);if(!t)return!1;return Oh(e)<=t}Ah.inlineRef=tS;var rS=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Xa(e){for(let t in e){if(rS.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Xa))return!0;if(typeof r=="object"&&Xa(r))return!0}return!1}function Oh(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,eS.has(r))continue;if(typeof e[r]=="object")Rh.eachItem(e[r],(n)=>t+=Oh(n));if(t===1/0)return 1/0}return t}function Ih(e,t="",r){if(r!==!1)t=Ar(t);let n=e.parse(t);return Ch(e,n)}Ah.getFullPath=Ih;function Ch(e,t){return e.serialize(t).split("#")[0]+"#"}Ah._getFullPath=Ch;var nS=/#\/?$/;function Ar(e){return e?e.replace(nS,""):""}Ah.normalizeId=Ar;function oS(e,t,r){return r=Ar(r),e.resolve(t,r)}Ah.resolveUrl=oS;var sS=/^[a-z_][-a-z0-9._]*$/i;function iS(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=Ar(e[r]||t),s={"":o},i=Ih(n,o,!1),a={},u=new Set;return Qz(e,{allKeys:!0},(d,m,f,p)=>{if(p===void 0)return;let g=i+m,_=s[p];if(typeof d[r]=="string")_=y.call(this,d[r]);k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),s[m]=_;function y(C){let U=this.opts.uriResolver.resolve;if(C=Ar(_?U(_,C):C),u.has(C))throw l(C);u.add(C);let b=this.refs[C];if(typeof b=="string")b=this.refs[b];if(typeof b=="object")c(d,b.schema,C);else if(C!==Ar(g))if(C[0]==="#")c(d,a[C],C),a[C]=d;else this.refs[C]=g;return C}function k(C){if(typeof C=="string"){if(!sS.test(C))throw Error(`invalid anchor "${C}"`);y.call(this,`#${C}`)}}}),a;function c(d,m,f){if(m!==void 0&&!Yz(d,m))throw l(f)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}Ah.getSchemaRefs=iS});var Nn=E(function(Gh){Object.defineProperty(Gh,"__esModule",{value:!0});Gh.getData=Gh.KeywordCxt=Gh.validateFunctionCode=void 0;var ns=Jm(),rs=Cn(),jr=Va(),Lt=Cn(),Mh=dh(),nt=$h(),Nr=kh(),w=L(),M=xt(),qh=An(),be=V(),rt=In();function fS(e){if(Fh(e)){if(Vh(e),Uh(e)){hS(e);return}}Lh(e,()=>ns.topBoolOrEmptySchema(e))}Gh.validateFunctionCode=fS;function Lh({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){if(o.code.es5)e.func(t,w._`${M.default.data}, ${M.default.valCxt}`,n.$async,()=>{e.code(w._`"use strict"; ${jh(r,o)}`),mS(e,o),e.code(s)});else e.func(t,w._`${M.default.data}, ${pS(o)}`,n.$async,()=>e.code(jh(r,o)).code(s))}function pS(e){return w._`{${M.default.instancePath}="", ${M.default.parentData}, ${M.default.parentDataProperty}, ${M.default.rootData}=${M.default.data}${e.dynamicRef?w._`, ${M.default.dynamicAnchors}={}`:w.nil}}={}`}function mS(e,t){e.if(M.default.valCxt,()=>{if(e.var(M.default.instancePath,w._`${M.default.valCxt}.${M.default.instancePath}`),e.var(M.default.parentData,w._`${M.default.valCxt}.${M.default.parentData}`),e.var(M.default.parentDataProperty,w._`${M.default.valCxt}.${M.default.parentDataProperty}`),e.var(M.default.rootData,w._`${M.default.valCxt}.${M.default.rootData}`),t.dynamicRef)e.var(M.default.dynamicAnchors,w._`${M.default.valCxt}.${M.default.dynamicAnchors}`)},()=>{if(e.var(M.default.instancePath,w._`""`),e.var(M.default.parentData,w._`undefined`),e.var(M.default.parentDataProperty,w._`undefined`),e.var(M.default.rootData,M.default.data),t.dynamicRef)e.var(M.default.dynamicAnchors,w._`{}`)})}function hS(e){let{schema:t,opts:r,gen:n}=e;Lh(e,()=>{if(r.$comment&&t.$comment)Bh(e);if(bS(e),n.let(M.default.vErrors,null),n.let(M.default.errors,0),r.unevaluated)gS(e);Hh(e),$S(e)});return}function gS(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",w._`${r}.evaluated`),t.if(w._`${e.evaluated}.dynamicProps`,()=>t.assign(w._`${e.evaluated}.props`,w._`undefined`)),t.if(w._`${e.evaluated}.dynamicItems`,()=>t.assign(w._`${e.evaluated}.items`,w._`undefined`))}function jh(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?w._`/*# sourceURL=${r} */`:w.nil}function _S(e,t){if(Fh(e)){if(Vh(e),Uh(e)){yS(e,t);return}}ns.boolOrEmptySchema(e,t)}function Uh({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Fh(e){return typeof e.schema!="boolean"}function yS(e,t){let{schema:r,gen:n,opts:o}=e;if(o.$comment&&r.$comment)Bh(e);wS(e),xS(e);let s=n.const("_errs",M.default.errors);Hh(e,s),n.var(t,w._`${s} === ${M.default.errors}`)}function Vh(e){be.checkUnknownRules(e),vS(e)}function Hh(e,t){if(e.opts.jtd)return Zh(e,[],!1,t);let r=rs.getSchemaTypes(e.schema),n=rs.coerceAndCheckDataType(e,r);Zh(e,r,!n,t)}function vS(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;if(t.$ref&&n.ignoreKeywordsWithRef&&be.schemaHasRulesButRef(t,o.RULES))o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function bS(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)be.checkStrictMode(e,"default is ignored in the schema root")}function wS(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=qh.resolveUrl(e.opts.uriResolver,e.baseId,t)}function xS(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function Bh({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)e.code(w._`${M.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=w.str`${n}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(w._`${M.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function $S(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;if(r.$async)t.if(w._`${M.default.errors} === 0`,()=>t.return(M.default.data),()=>t.throw(w._`new ${o}(${M.default.vErrors})`));else{if(t.assign(w._`${n}.errors`,M.default.vErrors),s.unevaluated)zS(e);t.return(w._`${M.default.errors} === 0`)}}function zS({gen:e,evaluated:t,props:r,items:n}){if(r instanceof w.Name)e.assign(w._`${t}.props`,r);if(n instanceof w.Name)e.assign(w._`${t}.items`,n)}function Zh(e,t,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:u,self:c}=e,{RULES:l}=c;if(s.$ref&&(u.ignoreKeywordsWithRef||!be.schemaHasRulesButRef(s,l))){o.block(()=>Kh(e,"$ref",l.all.$ref.definition));return}if(!u.jtd)SS(e,t);o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){if(!jr.shouldUseGroup(s,m))return;if(m.type){if(o.if(Lt.checkDataType(m.type,i,u.strictNumbers)),Dh(e,m),t.length===1&&t[0]===m.type&&r)o.else(),Lt.reportTypeError(e);o.endIf()}else Dh(e,m);if(!a)o.if(w._`${M.default.errors} === ${n||0}`)}}function Dh(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;if(o)Mh.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(jr.shouldUseRule(n,s))Kh(e,s.keyword,s.definition,t.type)})}function SS(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(kS(e,t),!e.opts.allowUnionTypes)PS(e,t);ES(e,e.dataTypes)}function kS(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!Jh(e.dataTypes,r))Ya(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),RS(e,t)}function PS(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Ya(e,"use allowUnionTypes to allow union type keyword")}function ES(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&jr.shouldUseRule(e.schema,o)){let{type:s}=o.definition;if(s.length&&!s.some((i)=>TS(t,i)))Ya(e,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function TS(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Jh(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function RS(e,t){let r=[];for(let n of e.dataTypes)if(Jh(t,n))r.push(n);else if(t.includes("integer")&&n==="number")r.push("integer");e.dataTypes=r}function Ya(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,be.checkStrictMode(e,t,e.opts.strictTypes)}class Qa{constructor(e,t,r){if(nt.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=be.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",Wh(this.$data,e));else if(this.schemaCode=this.schemaValue,!nt.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",M.default.errors)}result(e,t,r){this.failResult(w.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(w.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(w._`${t} !== undefined && (${w.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?rt.reportExtraError:rt.reportError)(this,this.def.error,t)}$dataError(){rt.reportError(this,this.def.$dataError||rt.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');rt.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=w.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=w.nil,t=w.nil){if(!this.$data)return;let{gen:r,schemaCode:n,schemaType:o,def:s}=this;if(r.if(w.or(w._`${n} === undefined`,t)),e!==w.nil)r.assign(e,!0);if(o.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==w.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:n,it:o}=this;return w.or(s(),i());function s(){if(r.length){if(!(t instanceof w.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return w._`${Lt.checkDataTypes(a,t,o.opts.strictNumbers,Lt.DataType.Wrong)}`}return w.nil}function i(){if(n.validateSchema){let a=e.scopeValue("validate$data",{ref:n.validateSchema});return w._`!${a}(${t})`}return w.nil}}subschema(e,t){let r=Nr.getSubschema(this.it,e);Nr.extendSubschemaData(r,this.it,e),Nr.extendSubschemaMode(r,e);let n={...this.it,...r,items:void 0,props:void 0};return _S(n,t),n}mergeEvaluated(e,t){let{it:r,gen:n}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=be.mergeEvaluated.props(n,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=be.mergeEvaluated.items(n,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:n}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return n.if(t,()=>this.mergeEvaluated(e,w.Name)),!0}}Gh.KeywordCxt=Qa;function Kh(e,t,r,n){let o=new Qa(e,r,t);if("code"in r)r.code(o,n);else if(o.$data&&r.validate)nt.funcKeywordCode(o,r);else if("macro"in r)nt.macroKeywordCode(o,r);else if(r.compile||r.validate)nt.funcKeywordCode(o,r)}var OS=/^\/(?:[^~]|~0|~1)*$/,IS=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Wh(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(e==="")return M.default.rootData;if(e[0]==="/"){if(!OS.test(e))throw Error(`Invalid JSON-pointer: ${e}`);o=e,s=M.default.rootData}else{let c=IS.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(o=c[2],o==="#"){if(l>=t)throw Error(u("property/index",l));return n[t-l]}if(l>t)throw Error(u("data",l));if(s=r[t-l],!o)return s}let i=s,a=o.split("/");for(let c of a)if(c)s=w._`${s}${w.getProperty(be.unescapeJsonPointer(c))}`,i=w._`${i} && ${s}`;return i;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}Gh.getData=Wh});var os=E(function(Qh){Object.defineProperty(Qh,"__esModule",{value:!0});class Yh extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}Qh.default=Yh});var jn=E(function(tg){Object.defineProperty(tg,"__esModule",{value:!0});var Zr=An();class eg extends Error{constructor(e,t,r,n){super(n||`can't resolve reference ${r} from id ${t}`);this.missingRef=Zr.resolveUrl(e,t,r),this.missingSchema=Zr.normalizeId(Zr.getFullPath(e,this.missingRef))}}tg.default=eg});var as=E(function(og){Object.defineProperty(og,"__esModule",{value:!0});og.resolveSchema=og.getCompilingSchema=og.resolveRef=og.compileSchema=og.SchemaEnv=void 0;var de=L(),ZS=os(),dr=xt(),fe=An(),ss=V(),rg=Nn();class Zn{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:fe.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}og.SchemaEnv=Zn;function tc(e){let t=ng.call(this,e);if(t)return t;let r=fe.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new de.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:ZS.default,code:de._`require("ajv/dist/runtime/validation_error").default`});let u=i.scopeName("validate");e.validateName=u;let c={gen:i,allErrors:this.opts.allErrors,data:dr.default.data,parentData:dr.default.parentData,parentDataProperty:dr.default.parentDataProperty,dataNames:[dr.default.data],dataPathArr:[de.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:de.stringify(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:de.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:de._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),rg.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(dr.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let f=Function(`${dr.default.self}`,`${dr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async)f.$async=!0;if(this.opts.code.source===!0)f.source={validateName:u,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:p,items:g}=c;if(f.evaluated={props:p instanceof de.Name?void 0:p,items:g instanceof de.Name?void 0:g,dynamicProps:p instanceof de.Name,dynamicItems:g instanceof de.Name},f.source)f.source.evaluated=de.stringify(f.evaluated)}return e.validate=f,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}og.compileSchema=tc;function DS(e,t,r){var n;r=fe.resolveUrl(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let s=LS.call(this,e,r);if(s===void 0){let i=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;if(i)s=new Zn({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=MS.call(this,s)}og.resolveRef=DS;function MS(e){if(fe.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:tc.call(this,e)}function ng(e){for(let t of this._compilations)if(qS(t,e))return t}og.getCompilingSchema=ng;function qS(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function LS(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||is.call(this,e,t)}function is(e,t){let r=this.opts.uriResolver.parse(t),n=fe._getFullPath(this.opts.uriResolver,r),o=fe.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return ec.call(this,r,e);let s=fe.normalizeId(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=is.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return ec.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)tc.call(this,i);if(s===fe.normalizeId(t)){let{schema:a}=i,{schemaId:u}=this.opts,c=a[u];if(c)o=fe.resolveUrl(this.opts.uriResolver,o,c);return new Zn({schema:a,schemaId:u,root:e,baseId:o})}return ec.call(this,r,i)}og.resolveSchema=is;var US=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ec(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let u=r[ss.unescapeFragment(a)];if(u===void 0)return;r=u;let c=typeof r==="object"&&r[this.opts.schemaId];if(!US.has(a)&&c)t=fe.resolveUrl(this.opts.uriResolver,t,c)}let s;if(typeof r!="boolean"&&r.$ref&&!ss.schemaHasRulesButRef(r,this.RULES)){let a=fe.resolveUrl(this.opts.uriResolver,t,r.$ref);s=is.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new Zn({schema:r,schemaId:i,root:n,baseId:t}),s.schema!==s.root.schema)return s;return}});var ig=E(function(IZ,JS){JS.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 ac=E(function(CZ,mg){var KS=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),nc=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),WS=RegExp.prototype.test.bind(/^\d*$/u),fr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),oc=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),cg=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),sc=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),GS=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u),Ae=Array(256);for(let t=0;t<256;t++)Ae[t]="%"+"0123456789ABCDEF"[t>>4]+"0123456789ABCDEF"[t&15];function ke(e){if(e<2048)return Ae[192|e>>6]+Ae[128|e&63];if(e<65536)return Ae[224|e>>12]+Ae[128|e>>6&63]+Ae[128|e&63];return Ae[240|e>>18]+Ae[128|e>>12&63]+Ae[128|e>>6&63]+Ae[128|e&63]}function XS(e){let t="",r=0,n=0;for(n=0;n<e.length;n++){if(r=e[n].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var YS=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),QS=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),ek=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),tk=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function rk(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++){if(ek(e[t]))continue;if(e[t]==="%"&&t+2<e.length&&fr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function ag(e){let t=-1,r=0,n=-1,o=0;for(let a=0;a<e.length;a++)if(e[a]==="0"){if(n===-1)n=a;if(o++,o>r)r=o,t=n}else n=-1,o=0;if(r<2)return e.join(":");let s=e.slice(0,t).join(":"),i=e.slice(t+r).join(":");return s+"::"+i}function nk(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");if(t!==-1){if(r.length===1&&r[0]==="")r.length=0;if(n.length===1&&n[0]==="")n.length=0}let o=r.concat(n),s=0;for(let a=0;a<o.length;a++){let u=o[a];if(u==="")return;if(u.indexOf(".")!==-1){if(a!==o.length-1||t!==-1&&n.length===0||!nc(u))return;s+=2;continue}if(!YS(u))return;o[a]=parseInt(u,16).toString(16),s++}if(t===-1){if(s!==8)return;return ag(o)}if(s>=8)return;let i=o.slice(0,r.length);for(let a=s;a<8;a++)i.push("0");for(let a=r.length;a<o.length;a++)i.push(o[a]);return ag(i)}function rc(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&QS(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(ok(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",s=n.indexOf("%");if(s!==-1){let a=n.slice(s,s+3).toLowerCase()==="%25"?3:1;if(o=n.slice(s+a),!rk(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,s)}let i=nk(n);if(i===void 0)return{host:e,isIPV6:!1,error:!0};return{host:i+(o?"%"+o:""),escapedHost:i+(o?"%25"+o:""),isIPV6:!0}}function ok(e,t){let r=0;for(let n=0;n<e.length;n++)if(e[n]===t)r++;return r}function ug(e){let t=e,r=[],n=-1,o=0;while(o=t.length){if(o===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(o===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(o===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}function sk(e){if(e===""||e[0]==="/")return ug(e);let t=e.split("/"),r=t.length-1,n=[],o=!1;for(let s=0;s<=r;s++){let i=t[s];if(i==="."||i===".."){if(i==="..")if(n.length!==0&&n[n.length-1]!=="..")n.pop();else n.push("..");o=s===r}else n.push(i)}if(o&&n[n.length-1]!=="..")n.push("");if(n.length===0||n[0]===""||n[0].includes(":"))n.unshift(".");return n.join("/")}var ik={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},ak=/[@/?#:]/g,ck=/[@/?#]/g;function lg(e,t){let r=t?ck:ak;return r.lastIndex=0,e.replace(r,(n)=>ik[n])}function dg(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(fr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&oc(i))r+=i;else r+="%"+s;n+=2;continue}}r+=e[n]}return r}function uk(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(fr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(i!=="."&&oc(i))t+=i;else t+="%"+s;r+=2;continue}}if(cg(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=pg(o)?n:Ae[o];else if(o<55296||o>57343)t+=ke(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=ke(65536+(o-55296<<10)+(s-56320)),r++;else t+=ke(65533)}else t+=ke(65533)}}return t}function lk(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let s=e[o];if(s==="%"&&o+2<e.length){let i=e.slice(o+1,o+3);if(fr(i)){r+="%"+i.toUpperCase(),o+=2;continue}}if(s==="/")n=!1;if(cg(s)&&(s!==":"||!n))r+=s;else{let i=e.charCodeAt(o);if(i<128)r+=Ae[i];else if(i<55296||i>57343)r+=ke(i);else if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343)r+=ke(65536+(i-55296<<10)+(a-56320)),o++;else r+=ke(65533)}else r+=ke(65533)}}return r}function ic(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let s=e.slice(n+1,n+3);if(fr(s)){r+="%"+s.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let s=e.charCodeAt(n);if(s<128)r+=Ae[s];else if(s<55296||s>57343)r+=ke(s);else if(s<=56319&&n+1<e.length){let i=e.charCodeAt(n+1);if(i>=56320&&i<=57343)r+=ke(65536+(s-55296<<10)+(i-56320)),n++;else r+=ke(65533)}else r+=ke(65533)}}return r}function fg(e){return ic(e,GS)}function dk(e){return ic(e,sc)}function fk(e){return ic(e,sc)}function pg(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function pk(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(fr(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(oc(i))t+=i;else t+="%"+s;r+=2;continue}}if(sc(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=pg(o)?n:Ae[o];else if(o<55296||o>57343)t+=ke(o);else if(o<=56319&&r+1<e.length){let s=e.charCodeAt(r+1);if(s>=56320&&s<=57343)t+=ke(65536+(o-55296<<10)+(s-56320)),r++;else t+=ke(65533)}else t+=ke(65533)}}return t}function mk(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let n=e.slice(r+1,r+3);if(fr(n)){t+="%"+n.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function hk(e){let t=[];if(e.userinfo!==void 0)t.push(fg(e.userinfo)),t.push("@");if(e.host!==void 0){let r=e.host;if(!nc(r)){let n=rc(r);if(n.isIPV6!==!0&&n.isIPVFuture!==!0)r=dg(r,!0),n=rc(r);if(n.isIPV6===!0||n.isIPVFuture===!0)r=`[${n.escapedHost}]`;else r=lg(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string"){let r=String(e.port);if(!WS(r))throw TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}mg.exports={nonSimpleDomain:tk,recomposeAuthority:hk,reescapeHostDelimiters:lg,normalizePercentEncoding:dg,normalizePathEncoding:uk,serializePathEncoding:lk,normalizeQueryFragmentEncoding:pk,encodeUserinfo:fg,encodeQuery:dk,encodeFragment:fk,escapePreservingEscapes:mk,removeDotSegments:ug,removeDotSegmentsRelative:sk,isIPv4:nc,isUUID:KS,normalizeIPv6:rc,stringArrayToHexStripped:XS}});var vg=E(function(AZ,yg){var{isUUID:gk}=ac(),_k=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,yk=["http","https","ws","wss","urn","urn:uuid"];function vk(e){return yk.indexOf(e)!==-1}function cc(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function hg(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function gg(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function bk(e){return e.secure=cc(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function wk(e){if(e.port===(cc(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function xk(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(_k);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,s=uc(o);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function $k(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,s=uc(o);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${n||t.nid}:${a}`,t.skipEscape=!0,i}function zk(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!gk(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function Sk(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var _g={scheme:"http",domainHost:!0,parse:hg,serialize:gg},kk={scheme:"https",domainHost:_g.domainHost,parse:hg,serialize:gg},cs={scheme:"ws",domainHost:!0,parse:bk,serialize:wk},Pk={scheme:"wss",domainHost:cs.domainHost,parse:cs.parse,serialize:cs.serialize},Ek={scheme:"urn",parse:xk,serialize:$k,skipNormalize:!0},Tk={scheme:"urn:uuid",parse:zk,serialize:Sk,skipNormalize:!0},us={http:_g,https:kk,ws:cs,wss:Pk,urn:Ek,"urn:uuid":Tk};Object.setPrototypeOf(us,null);function uc(e){return e&&(us[e]||us[e.toLowerCase()])||void 0}yg.exports={wsIsSecure:cc,SCHEMES:us,isValidSchemeName:vk,getSchemeHandler:uc}});var Cg=E(function(NZ,ps){var{normalizeIPv6:zg,removeDotSegments:Mn,removeDotSegmentsRelative:Sg,recomposeAuthority:Rk,normalizePercentEncoding:lc,normalizePathEncoding:Ok,serializePathEncoding:bg,normalizeQueryFragmentEncoding:wg,encodeQuery:Ik,encodeFragment:Ck,reescapeHostDelimiters:Ak,isIPv4:kg,nonSimpleDomain:Nk}=ac(),{SCHEMES:Pg,getSchemeHandler:dc}=vg(),Eg=/^[A-Za-z][A-Za-z0-9+.-]*$/u,jk=/[\0-\x20"#/:<>?@[\\\]^`{|}\x7F]/u;function xg(e){let t=String(e);if(!Eg.test(t))throw TypeError("URI scheme is malformed.");return t}function Zk(e,t){if(typeof e==="string")e=Bk(e,t);else if(typeof e==="object")e=ds(pr(e,t),t);return e}function Dk(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:s,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:u,malformedScheme:c}=ls(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:m,malformedSchemeSpecific:f,malformedHost:p,malformedScheme:g}=ls(t,n);if(s||d||i||m||a||f||u||p||c||g)throw Error(o.error||l.error||"URI is malformed.");let _=Tg(o,l,n,!0),y=dc(r&&r.scheme||_.scheme),k=_.host,C=k!==void 0&&k!==""&&(kg(k)||zg(k).isIPV6);if(Og(_,r||{},y,C))throw Error("URI host is malformed.");Rg(_,r||{},y,C);let U=k&&k.indexOf("%")!==-1&&!/\P{ASCII}/u.test(k);if(_.error&&!U)throw Error(_.error);return n.skipEscape=!0,pr(_,n)}function Tg(e,t,r,n){let o={};if(!n)e=ds(pr(e,r),r),t=ds(pr(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Mn(t.path||""),o.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Mn(t.path||""),o.query=t.query;else{if(!t.path)if(o.path=e.path,t.query!==void 0)o.query=t.query;else o.query=e.query;else{if(t.path[0]==="/")o.path=Mn(t.path);else{let s=e.userinfo!==void 0||e.host!==void 0||e.port!==void 0;if(s&&!e.path)o.path="/"+t.path;else if(!e.path)o.path=t.path;else o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;o.path=e.scheme===void 0&&!s&&o.path[0]!=="/"?Sg(o.path):Mn(o.path)}o.query=t.query}o.userinfo=e.userinfo,o.host=e.host,o.port=e.port}o.scheme=e.scheme}return o.fragment=t.fragment,o}function Mk(e,t,r){let n=$g(e,r),o=$g(t,r);return n!==void 0&&o!==void 0&&n===o}function pr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},n=Object.assign({},t),o=[];if(r.scheme)r.scheme=xg(r.scheme);let s=dc(n.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,n);let i=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,a=(r.scheme===void 0||n.reference==="suffix")&&!i,u=!n.skipEscape&&a;if(r.path!==void 0)if(!n.skipEscape)r.path=bg(r.path,u);else r.path=lc(r.path);if(n.reference!=="suffix"&&r.scheme)r.scheme=xg(r.scheme),o.push(r.scheme,":");let c=Rk(r);if(c!==void 0){if(n.reference!=="suffix")o.push("//");if(o.push(c),r.path&&r.path[0]!=="/")o.push("/")}if(r.path!==void 0){let l=r.path;if(!n.absolutePath&&(!s||!s.absolutePath))l=a&&l[0]!=="/"?Sg(l):Mn(l);if(a)l=bg(l,!0);if(c===void 0&&l[0]==="/"&&l[1]==="/")l="/%2F"+l.slice(2);o.push(l)}if(r.query!==void 0)o.push("?",Ik(r.query));if(r.fragment!==void 0)o.push("#",Ck(r.fragment));return o.join("")}var qk=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,Lk=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,Uk=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function Fk(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function Dn(e){if(e===void 0)return!1;let t=e.indexOf("%");while(t!==-1){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function fs(e){return e[0]==="["&&e[e.length-1]==="]"}function Vk(e){let t=e[4];return Dn(e[3])||t!==void 0&&!fs(t)&&Dn(t)||Dn(e[6])||Dn(e[7])||Dn(e[8])}function Rg(e,t,r,n){if(Og(e,t,r,n))return e.error=e.error||"URI host is malformed.",!0;if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!fs(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&Nk(e.host)){let o;try{o=new URL("http://"+e.host)}catch(s){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+s,!0}if(!Hk(o))return e.error=e.error||"URI host is malformed.",!0;e.host=o.hostname}return!1}function Og(e,t,r,n){return Boolean(e.host&&n===!1&&!fs(e.host)&&(t.domainHost||r&&r.domainHost)&&jk.test(e.host))}function Hk(e){return e.username===""&&e.password===""&&e.port===""&&e.pathname==="/"&&e.search===""&&e.hash===""&&e.hostname!==""}function ls(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1,i=!1,a=!1,u=!1,c=!1,l=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let d=e.match(Lk);if(d!==null&&d[1].indexOf("\\")!==-1)n.error="URI authority must not contain a literal backslash.",o=!0;let m=e.match(Uk);if(m!==null){let p=m[1],g=p.replace(/[\t\n\r]/g,"");if(g.length>=2){if(g.slice(0,2)!=="//")n.error=n.error||"URI authority must not contain a literal backslash.",o=!0;else if(p.length!==g.length)n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0}}let f=e.match(qk);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0)if(Eg.test(n.scheme))n.scheme=n.scheme.toLowerCase();else n.error=n.error||"URI scheme is malformed.",c=!0;if(s=Vk(f),s)n.error=n.error||"URI contains malformed percent-encoding.";if(isNaN(n.port))n.port=f[5];let p=Fk(n,f);if(p!==void 0)n.error=n.error||p,o=!0;if(n.host)if(kg(n.host)===!1){let y=fs(n.host),k=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,C=zg(n.host);if(l=C.isIPV6||C.isIPVFuture===!0,u=k&&(!y||C.error===!0),n.host=l?C.host:C.host.toLowerCase(),u)n.error=n.error||"URI host is malformed.",o=!0}else l=!0;if(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";else if(n.scheme===void 0)n.reference="relative";else if(n.fragment===void 0)n.reference="absolute";else n.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==n.reference)n.error=n.error||"URI is not a "+r.reference+" reference.";let g=dc(r.scheme||n.scheme);if(!u)a=Rg(n,r,g,l);if(e.indexOf("%")!==-1&&n.host!==void 0&&!u){let _=l?n.host:lc(n.host,!0);if(!l)_=lc(_.toLowerCase());n.host=l||r.scheme!=="null"?Ak(_,l):_}if(!g||g&&!g.skipNormalize){if(n.path)n.path=Ok(n.path);if(n.query)n.query=wg(n.query);if(n.fragment)n.fragment=wg(n.fragment)}if(g&&g.parse){if(g.parse(n,r),g===Pg.urn&&n.nid===void 0)i=!0}}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:c}}function ds(e,t){return ls(e,t).parsed}function Bk(e,t){return Ig(e,t).normalized}function Ig(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}=ls(e,t);return{normalized:n||o||s||i||a?e:pr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:s,malformedHost:i,malformedScheme:a}}function $g(e,t){if(typeof e!=="string"&&typeof e!=="object")return;let r;try{r=typeof e==="string"?e:pr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:s,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:u}=Ig(r,t);return o||s||i||a||u?void 0:n}var fc={SCHEMES:Pg,normalize:Zk,resolve:Dk,resolveComponent:Tg,equal:Mk,serialize:pr,parse:ds};ps.exports=fc;ps.exports.default=fc;ps.exports.fastUri=fc});var jg=E(function(Ng){Object.defineProperty(Ng,"__esModule",{value:!0});var Ag=Cg();Ag.code='require("ajv/dist/runtime/uri").default';Ng.default=Ag});var Bg=E(function($t){Object.defineProperty($t,"__esModule",{value:!0});$t.CodeGen=$t.Name=$t.nil=$t.stringify=$t.str=$t._=$t.KeywordCxt=void 0;var Kk=Nn();Object.defineProperty($t,"KeywordCxt",{enumerable:!0,get:function(){return Kk.KeywordCxt}});var Mr=L();Object.defineProperty($t,"_",{enumerable:!0,get:function(){return Mr._}});Object.defineProperty($t,"str",{enumerable:!0,get:function(){return Mr.str}});Object.defineProperty($t,"stringify",{enumerable:!0,get:function(){return Mr.stringify}});Object.defineProperty($t,"nil",{enumerable:!0,get:function(){return Mr.nil}});Object.defineProperty($t,"Name",{enumerable:!0,get:function(){return Mr.Name}});Object.defineProperty($t,"CodeGen",{enumerable:!0,get:function(){return Mr.CodeGen}});var Wk=os(),Lg=jn(),Ug=Fa(),ot=as(),Fg=L(),st=An(),Ut=Cn(),Dr=V(),Zg=ig(),Gk=jg(),Vg=(e,t)=>new RegExp(e,t);Vg.code="new RegExp";var Xk=["removeAdditional","useDefaults","coerceTypes"],Yk=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Qk={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."},eP={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Dg=200;function tP(e){var t,r,n,o,s,i,a,u,c,l,d,m,f,p,g,_,y,k,C,U,b,x,N,Y,F;let se=e.strict,mt=(t=e.code)===null||t===void 0?void 0:t.optimize,rr=mt===!0||mt===void 0?1:mt||0,_r=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Vg,zt=(o=e.uriResolver)!==null&&o!==void 0?o:Gk.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:se)!==null&&i!==void 0?i:!0,strictNumbers:(u=(a=e.strictNumbers)!==null&&a!==void 0?a:se)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:se)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=e.strictTuples)!==null&&d!==void 0?d:se)!==null&&m!==void 0?m:"log",strictRequired:(p=(f=e.strictRequired)!==null&&f!==void 0?f:se)!==null&&p!==void 0?p:!1,code:e.code?{...e.code,optimize:rr,regExp:_r}:{optimize:rr,regExp:_r},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Dg,loopEnum:(_=e.loopEnum)!==null&&_!==void 0?_:Dg,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(C=e.inlineRefs)!==null&&C!==void 0?C:!0,schemaId:(U=e.schemaId)!==null&&U!==void 0?U:"$id",addUsedSchema:(b=e.addUsedSchema)!==null&&b!==void 0?b:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:(N=e.validateFormats)!==null&&N!==void 0?N:!0,unicodeRegExp:(Y=e.unicodeRegExp)!==null&&Y!==void 0?Y:!0,int32range:(F=e.int32range)!==null&&F!==void 0?F:!0,uriResolver:zt}}class ms{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...tP(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new Fg.ValueScope({scope:{},prefixes:Yk,es5:t,lines:r}),this.logger=aP(e.logger);let n=e.validateFormats;if(e.validateFormats=!1,this.RULES=Ug.getRules(),Mg.call(this,Qk,e,"NOT SUPPORTED"),Mg.call(this,eP,e,"DEPRECATED","warn"),this._metaOpts=sP.call(this),e.formats)nP.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)oP.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);rP.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,n=Zg;if(r==="id")n={...Zg},n.id=n.$id,delete n.$id;if(t&&e)this.addMetaSchema(n,n[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let n=r(t);if(!("$async"in r))this.errors=r.errors;return n}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(c,l){await o.call(this,c.$schema);let d=this._addSchema(c,l);return d.validate||s.call(this,d)}async function o(c){if(c&&!this.getSchema(c))await n.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(l){if(!(l instanceof Lg.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,c)}}function i({missingSchema:c,missingRef:l}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${l} cannot be resolved`)}async function a(c){let l=await u.call(this,c);if(!this.refs[c])await o.call(this,l.$schema);if(!this.refs[c])this.addSchema(l,c,t)}async function u(c){let l=this._loading[c];if(l)return l;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,n);return this}let o;if(typeof e==="object"){let{schemaId:s}=this.opts;if(o=e[s],o!==void 0&&typeof o!="string")throw Error(`schema ${s} must be string`)}return t=st.normalizeId(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(r,e);if(!n&&t){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw Error(o)}return n}getSchema(e){let t;while(typeof(t=qg.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,n=new ot.SchemaEnv({schema:{},schemaId:r});if(t=ot.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}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 t=qg.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=st.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(uP.call(this,r,t),!t)return Dr.eachItem(r,(o)=>pc.call(this,o)),this;dP.call(this,t);let n={...t,type:Ut.getJSONTypes(t.type),schemaType:Ut.getJSONTypes(t.schemaType)};return Dr.eachItem(r,n.type.length===0?(o)=>pc.call(this,o,n):(o)=>n.type.forEach((s)=>pc.call(this,o,n,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let n=r.rules.findIndex((o)=>o.keyword===e);if(n>=0)r.rules.splice(n,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((n)=>`${r}${n.instancePath} ${n.message}`).reduce((n,o)=>n+t+o)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of t){let o=n.split("/").slice(1),s=e;for(let i of o)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:u}=a.definition,c=s[i];if(u&&c)s[i]=Hg(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let n=e[r];if(!t||t.test(r)){if(typeof n=="string")delete e[r];else if(n&&!n.meta)this._cache.delete(n.schema),delete e[r]}}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=st.normalizeId(s||r);let u=st.getSchemaRefs.call(this,e,r);if(a=new ot.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:u}),this._cache.set(a.schema,a),o&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(n)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else ot.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{ot.compileSchema.call(this,e)}finally{this.opts=t}}}ms.ValidationError=Wk.default;ms.MissingRefError=Lg.default;$t.default=ms;function Mg(e,t,r,n="error"){for(let o in e){let s=o;if(s in t)this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function qg(e){return e=st.normalizeId(e),this.schemas[e]||this.refs[e]}function rP(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function nP(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function oP(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function sP(){let e={...this.opts};for(let t of Xk)delete e[t];return e}var iP={log(){},warn(){},error(){}};function aP(e){if(e===!1)return iP;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var cP=/^[a-z_$][a-z0-9_$:-]*$/i;function uP(e,t){let{RULES:r}=this;if(Dr.eachItem(e,(n)=>{if(r.keywords[n])throw Error(`Keyword ${n} is already defined`);if(!cP.test(n))throw Error(`Keyword ${n} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function pc(e,t,r){var n;let o=t===null||t===void 0?void 0:t.post;if(r&&o)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:u})=>u===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Ut.getJSONTypes(t.type),schemaType:Ut.getJSONTypes(t.schemaType)}};if(t.before)lP.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(n=t.implements)===null||n===void 0||n.forEach((u)=>this.addKeyword(u))}function lP(e,t,r){let n=e.rules.findIndex((o)=>o.keyword===r);if(n>=0)e.rules.splice(n,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function dP(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=Hg(t);e.validateSchema=this.compile(t,!0)}var fP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Hg(e){return{anyOf:[e,fP]}}});var Kg=E(function(Jg){Object.defineProperty(Jg,"__esModule",{value:!0});var hP={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Jg.default=hP});var Yg=E(function(Gg){Object.defineProperty(Gg,"__esModule",{value:!0});Gg.callRef=Gg.getValidate=void 0;var _P=jn(),gs=Je(),X=L(),qr=xt(),_s=as(),Ft=V(),yP={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:u}=n,{root:c}=s;if((r==="#"||r==="#/")&&o===c.baseId)return d();let l=_s.resolveRef.call(u,c,o,r);if(l===void 0)throw new _P.default(n.opts.uriResolver,o,r);if(l instanceof _s.SchemaEnv)return m(l);return f(l);function d(){if(s===c)return hs(e,i,s,s.$async);let p=t.scopeValue("root",{ref:c});return hs(e,X._`${p}.validate`,c,c.$async)}function m(p){let g=Wg(e,p);hs(e,g,p,p.$async)}function f(p){let g=t.scopeValue("schema",a.code.source===!0?{ref:p,code:X.stringify(p)}:{ref:p}),_=t.name("valid"),y=e.subschema({schema:p,dataTypes:[],schemaPath:X.nil,topSchemaRef:g,errSchemaPath:r},_);e.mergeEvaluated(y),e.ok(_)}}};function Wg(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):X._`${r.scopeValue("wrapper",{ref:t})}.validate`}Gg.getValidate=Wg;function hs(e,t,r,n){let{gen:o,it:s}=e,{allErrors:i,schemaEnv:a,opts:u}=s,c=u.passContext?qr.default.this:X.nil;if(n)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let p=o.let("valid");o.try(()=>{if(o.code(X._`await ${gs.callValidateCode(e,t,c)}`),f(t),!i)o.assign(p,!0)},(g)=>{if(o.if(X._`!(${g} instanceof ${s.ValidationError})`,()=>o.throw(g)),m(g),!i)o.assign(p,!1)}),e.ok(p)}function d(){e.result(gs.callValidateCode(e,t,c),()=>f(t),()=>m(t))}function m(p){let g=X._`${p}.errors`;o.assign(qr.default.vErrors,X._`${qr.default.vErrors} === null ? ${g} : ${qr.default.vErrors}.concat(${g})`),o.assign(qr.default.errors,X._`${qr.default.vErrors}.length`)}function f(p){var g;if(!s.opts.unevaluated)return;let _=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps){if(_.props!==void 0)s.props=Ft.mergeEvaluated.props(o,_.props,s.props)}else{let y=o.var("props",X._`${p}.evaluated.props`);s.props=Ft.mergeEvaluated.props(o,y,s.props,X.Name)}if(s.items!==!0)if(_&&!_.dynamicItems){if(_.items!==void 0)s.items=Ft.mergeEvaluated.items(o,_.items,s.items)}else{let y=o.var("items",X._`${p}.evaluated.items`);s.items=Ft.mergeEvaluated.items(o,y,s.items,X.Name)}}}Gg.callRef=hs;Gg.default=yP});var e_=E(function(Qg){Object.defineProperty(Qg,"__esModule",{value:!0});var wP=Kg(),xP=Yg(),$P=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",wP.default,xP.default];Qg.default=$P});var r_=E(function(t_){Object.defineProperty(t_,"__esModule",{value:!0});var Ht=L(),Vt=Ht.operators,ys={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}},SP={message:({keyword:e,schemaCode:t})=>Ht.str`must be ${ys[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ht._`{comparison: ${ys[e].okStr}, limit: ${t}}`},kP={keyword:Object.keys(ys),type:"number",schemaType:"number",$data:!0,error:SP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data(Ht._`${r} ${ys[t].fail} ${n} || isNaN(${r})`)}};t_.default=kP});var o_=E(function(n_){Object.defineProperty(n_,"__esModule",{value:!0});var it=L(),EP={message:({schemaCode:e})=>it.str`must be multiple of ${e}`,params:({schemaCode:e})=>it._`{multipleOf: ${e}}`},TP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:EP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,s=o.opts.multipleOfPrecision,i=t.let("res"),a=s?it._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:it._`${i} !== parseInt(${i})`;e.fail$data(it._`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};n_.default=TP});var a_=E(function(i_){Object.defineProperty(i_,"__esModule",{value:!0});function s_(e){let t=e.length,r=0,n=0,o;while(n<t)if(r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t){if(o=e.charCodeAt(n),(o&64512)===56320)n++}return r}i_.default=s_;s_.code='require("ajv/dist/runtime/ucs2length").default'});var l_=E(function(u_){Object.defineProperty(u_,"__esModule",{value:!0});var Ne=L(),c_=V(),IP=a_(),CP={message({keyword:e,schemaCode:t}){return Ne.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Ne._`{limit: ${e}}`},AP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:CP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,s=t==="maxLength"?Ne.operators.GT:Ne.operators.LT,i=o.opts.unicode===!1?Ne._`${r}.length`:Ne._`${c_.useFunc(e.gen,IP.default)}(${r})`;e.fail$data(Ne._`${i} ${s} ${n}`)}};u_.default=AP});var m_=E(function(p_){Object.defineProperty(p_,"__esModule",{value:!0});var d_=Je(),f_=V(),Ke=L(),jP={message:({schemaCode:e})=>Ke.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ke._`{pattern: ${e}}`},ZP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:jP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:u}=i.opts.code,c=u.code==="new RegExp"?Ke._`new RegExp`:f_.useFunc(t,u),l=t.let("valid");t.try(()=>t.assign(l,Ke._`${c}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(Ke._`!${l}`)}else{let u=d_.usePattern(e,o);e.fail$data(Ke._`!${u}.test(${r})`)}}};p_.default=ZP});var g_=E(function(h_){Object.defineProperty(h_,"__esModule",{value:!0});var at=L(),MP={message({keyword:e,schemaCode:t}){return at.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>at._`{limit: ${e}}`},qP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:MP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?at.operators.GT:at.operators.LT;e.fail$data(at._`Object.keys(${r}).length ${o} ${n}`)}};h_.default=qP});var v_=E(function(y_){Object.defineProperty(y_,"__esModule",{value:!0});var ct=Je(),ut=L(),__=V(),UP={message:({params:{missingProperty:e}})=>ut.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>ut._`{missingProperty: ${e}}`},FP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:UP,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let u=r.length>=a.loopRequired;if(i.allErrors)c();else l();if(a.strictRequired){let f=e.parentSchema.properties,{definedProperties:p}=e.it;for(let g of r)if((f===null||f===void 0?void 0:f[g])===void 0&&!p.has(g)){let _=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${g}" is not defined at "${_}" (strictRequired)`;__.checkStrictMode(i,y,i.opts.strictRequired)}}function c(){if(u||s)e.block$data(ut.nil,d);else for(let f of r)ct.checkReportMissingProp(e,f)}function l(){let f=t.let("missing");if(u||s){let p=t.let("valid",!0);e.block$data(p,()=>m(f,p)),e.ok(p)}else t.if(ct.checkMissingProp(e,r,f)),ct.reportMissingProp(e,f),t.else()}function d(){t.forOf("prop",n,(f)=>{e.setParams({missingProperty:f}),t.if(ct.noPropertyInData(t,o,f,a.ownProperties),()=>e.error())})}function m(f,p){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(p,ct.propertyInData(t,o,f,a.ownProperties)),t.if(ut.not(p),()=>{e.error(),t.break()})},ut.nil)}}};y_.default=FP});var w_=E(function(b_){Object.defineProperty(b_,"__esModule",{value:!0});var lt=L(),HP={message({keyword:e,schemaCode:t}){return lt.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>lt._`{limit: ${e}}`},BP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:HP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?lt.operators.GT:lt.operators.LT;e.fail$data(lt._`${r}.length ${o} ${n}`)}};b_.default=BP});var vs=E(function($_){Object.defineProperty($_,"__esModule",{value:!0});var x_=Ga();x_.code='require("ajv/dist/runtime/equal").default';$_.default=x_});var k_=E(function(S_){Object.defineProperty(S_,"__esModule",{value:!0});var Lr=Cn(),H=L(),z_=V(),WP=vs(),GP={message:({params:{i:e,j:t}})=>H.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>H._`{i: ${e}, j: ${t}}`},XP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:GP,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=e;if(!n&&!o)return;let u=t.let("valid"),c=s.items?Lr.getSchemaTypes(s.items):[];e.block$data(u,l,H._`${i} === false`),e.ok(u);function l(){let p=t.let("i",H._`${r}.length`),g=t.let("j");e.setParams({i:p,j:g}),t.assign(u,!0),t.if(H._`${p} > 1`,()=>(d()?m:f)(p,g))}function d(){return c.length>0&&!c.some((p)=>p==="object"||p==="array")}function m(p,g){let _=t.name("item"),y=Lr.checkDataTypes(c,_,a.opts.strictNumbers,Lr.DataType.Wrong),k=t.const("indices",H._`{}`);t.for(H._`;${p}--;`,()=>{if(t.let(_,H._`${r}[${p}]`),t.if(y,H._`continue`),c.length>1)t.if(H._`typeof ${_} == "string"`,H._`${_} += "_"`);t.if(H._`typeof ${k}[${_}] == "number"`,()=>{t.assign(g,H._`${k}[${_}]`),e.error(),t.assign(u,!1).break()}).code(H._`${k}[${_}] = ${p}`)})}function f(p,g){let _=z_.useFunc(t,WP.default),y=t.name("outer");t.label(y).for(H._`;${p}--;`,()=>t.for(H._`${g} = ${p}; ${g}--;`,()=>t.if(H._`${_}(${r}[${p}], ${r}[${g}])`,()=>{e.error(),t.assign(u,!1).break(y)})))}}};S_.default=XP});var T_=E(function(E_){Object.defineProperty(E_,"__esModule",{value:!0});var Ur=L(),P_=V(),QP=vs(),eE={message:"must be equal to constant",params:({schemaCode:e})=>Ur._`{allowedValue: ${e}}`},tE={keyword:"const",$data:!0,error:eE,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:s}=e;if(n||s&&typeof s=="object")e.fail$data(Ur._`!${P_.useFunc(t,QP.default)}(${r}, ${o})`);else e.fail(Ur._`${s} !== ${r}`)}};E_.default=tE});var I_=E(function(O_){Object.defineProperty(O_,"__esModule",{value:!0});var dt=L(),R_=V(),nE=vs(),oE={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>dt._`{allowedValues: ${e}}`},sE={keyword:"enum",schemaType:"array",$data:!0,error:oE,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:s,it:i}=e;if(!n&&o.length===0)throw Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,u,c=()=>u!==null&&u!==void 0?u:u=R_.useFunc(t,nE.default),l;if(a||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw Error("ajv implementation error");let f=t.const("vSchema",s);l=dt.or(...o.map((p,g)=>m(f,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(f)=>t.if(dt._`${c()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function m(f,p){let g=o[p];return typeof g==="object"&&g!==null?dt._`${c()}(${r}, ${f}[${p}])`:dt._`${r} === ${g}`}}};O_.default=sE});var A_=E(function(C_){Object.defineProperty(C_,"__esModule",{value:!0});var aE=r_(),cE=o_(),uE=l_(),lE=m_(),dE=g_(),fE=v_(),pE=w_(),mE=k_(),hE=T_(),gE=I_(),_E=[aE.default,cE.default,uE.default,lE.default,dE.default,fE.default,pE.default,mE.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},hE.default,gE.default];C_.default=_E});var mc=E(function(j_){Object.defineProperty(j_,"__esModule",{value:!0});j_.validateAdditionalItems=void 0;var je=L(),Fr=V(),vE={message:({params:{len:e}})=>je.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>je._`{limit: ${e}}`},bE={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:vE,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){Fr.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}N_(e,n)}};function N_(e,t){let{gen:r,schema:n,data:o,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",je._`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass(je._`${a} <= ${t.length}`);else if(typeof n=="object"&&!Fr.alwaysValidSchema(i,n)){let c=r.var("valid",je._`${a} <= ${t.length}`);r.if(je.not(c),()=>u(c)),e.ok(c)}function u(c){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:Fr.Type.Num},c),!i.allErrors)r.if(je.not(c),()=>r.break())})}}j_.validateAdditionalItems=N_;j_.default=bE});var hc=E(function(q_){Object.defineProperty(q_,"__esModule",{value:!0});q_.validateTuple=void 0;var bs=L(),Bt=V(),D_=Je(),xE={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return M_(e,"additionalItems",t);if(r.items=!0,Bt.alwaysValidSchema(r,t))return;e.ok(D_.validateArray(e))}};function M_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=e;if(l(o),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=Bt.mergeEvaluated.items(n,r.length,a.items);let u=n.name("valid"),c=n.const("len",bs._`${s}.length`);r.forEach((d,m)=>{if(Bt.alwaysValidSchema(a,d))return;n.if(bs._`${c} > ${m}`,()=>e.subschema({keyword:i,schemaProp:m,dataProp:m},u)),e.ok(u)});function l(d){let{opts:m,errSchemaPath:f}=a,p=r.length,g=p===d.minItems&&(p===d.maxItems||d[t]===!1);if(m.strictTuples&&!g){let _=`"${i}" is ${p}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;Bt.checkStrictMode(a,_,m.strictTuples)}}}q_.validateTuple=M_;q_.default=xE});var V_=E(function(F_){Object.defineProperty(F_,"__esModule",{value:!0});var U_=hc(),zE={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>U_.validateTuple(e,"items")};F_.default=zE});var W_=E(function(K_){Object.defineProperty(K_,"__esModule",{value:!0});var ws=L(),H_=V(),B_=Je(),J_=mc(),kE={message:({params:{len:e}})=>ws.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>ws._`{limit: ${e}}`},PE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:kE,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;if(n.items=!0,H_.alwaysValidSchema(n,t))return;if(o)J_.validateAdditionalItems(e,o);else e.ok(B_.validateArray(e))}};K_.default=PE});var X_=E(function(G_){Object.defineProperty(G_,"__esModule",{value:!0});var ce=L(),Jt=V(),TE={message:({params:{min:e,max:t}})=>t===void 0?ce.str`must contain at least ${e} valid item(s)`:ce.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ce._`{minContains: ${e}}`:ce._`{minContains: ${e}, maxContains: ${t}}`},RE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:TE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e,i,a,{minContains:u,maxContains:c}=n;if(s.opts.next)i=u===void 0?1:u,a=c;else i=1;let l=t.const("len",ce._`${o}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Jt.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Jt.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Jt.alwaysValidSchema(s,r)){let g=ce._`${l} >= ${i}`;if(a!==void 0)g=ce._`${g} && ${l} <= ${a}`;e.pass(g);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)f(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(ce._`${o}.length > 0`,m)}else t.let(d,!1),m();e.result(d,()=>e.reset());function m(){let g=t.name("_valid"),_=t.let("count",0);f(g,()=>t.if(g,()=>p(_)))}function f(g,_){t.forRange("i",0,l,(y)=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:Jt.Type.Num,compositeRule:!0},g),_()})}function p(g){if(t.code(ce._`${g}++`),a===void 0)t.if(ce._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(ce._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(ce._`${g} >= ${i}`,()=>t.assign(d,!0))}}};G_.default=RE});var oy=E(function(ty){Object.defineProperty(ty,"__esModule",{value:!0});ty.validateSchemaDeps=ty.validatePropertyDeps=ty.error=void 0;var Vr=L(),Y_=V(),ft=Je();ty.error={message:({params:{property:e,depsCount:t,deps:r}})=>Vr.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>Vr._`{property: ${e},
|
|
7
|
+
missingProperty: ${n},
|
|
8
8
|
depsCount: ${t},
|
|
9
|
-
deps: ${r}}`};var bz={keyword:"dependencies",type:"object",schemaType:"object",error:Wm.error,code(e){let[t,r]=zz(e);Km(e,t),Bm(e,r)}};function zz({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Km(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let u=et.propertyInData(r,o,i,n.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors)r.if(u,()=>{for(let c of a)et.checkReportMissingProp(e,c)});else r.if(xr._`${u} && (${et.checkMissingProp(e,a,s)})`),et.reportMissingProp(e,s),r.else()}}Wm.validatePropertyDeps=Km;function Bm(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t){if(Hm.alwaysValidSchema(s,t[a]))continue;r.if(et.propertyInData(r,o,a,s.opts.ownProperties),()=>{let u=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(u,i)},()=>r.var(i,!0)),e.ok(i)}}Wm.validateSchemaDeps=Bm;Wm.default=bz});var eh=T(function(Xm){Object.defineProperty(Xm,"__esModule",{value:!0});var Tn=U(),Qm=V(),Pz={message:"property name must be valid",params:({params:e})=>Tn._`{propertyName: ${e.propertyName}}`},Ez={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Pz,code(e){let{gen:t,schema:r,data:o,it:n}=e;if(Qm.alwaysValidSchema(n,r))return;let s=t.name("valid");t.forIn("key",o,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if(Tn.not(s),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(s)}};Xm.default=Ez});var Bi=T(function(th){Object.defineProperty(th,"__esModule",{value:!0});var It=Ze(),de=U(),Rz=at(),Ct=V(),Iz={message:"must NOT have additional properties",params:({params:e})=>de._`{additionalProperty: ${e.additionalProperty}}`},Cz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Iz,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:u}=i;if(i.props=!0,u.removeAdditional!=="all"&&Ct.alwaysValidSchema(i,r))return;let c=It.allSchemaProperties(o.properties),l=It.allSchemaProperties(o.patternProperties);d(),e.ok(de._`${s} === ${Rz.default.errors}`);function d(){t.forIn("key",n,(x)=>{if(!c.length&&!l.length)h(x);else t.if(f(x),()=>h(x))})}function f(x){let w;if(c.length>8){let E=Ct.schemaRefOrVal(i,o.properties,"properties");w=It.isOwnProperty(t,E,x)}else if(c.length)w=de.or(...c.map((E)=>de._`${x} === ${E}`));else w=de.nil;if(l.length)w=de.or(w,...l.map((E)=>de._`${It.usePattern(e,E)}.test(${x})`));return de.not(w)}function m(x){t.code(de._`delete ${n}[${x}]`)}function h(x){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){m(x);return}if(r===!1){if(e.setParams({additionalProperty:x}),e.error(),!a)t.break();return}if(typeof r=="object"&&!Ct.alwaysValidSchema(i,r)){let w=t.name("valid");if(u.removeAdditional==="failing")g(x,w,!1),t.if(de.not(w),()=>{e.reset(),m(x)});else if(g(x,w),!a)t.if(de.not(w),()=>t.break())}}function g(x,w,E){let S={keyword:"additionalProperties",dataProp:x,dataPropType:Ct.Type.Str};if(E===!1)Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(S,w)}}};th.default=Cz});var sh=T(function(nh){Object.defineProperty(nh,"__esModule",{value:!0});var oh=so(),Rn=Ze(),br=V(),rh=Bi(),jz={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;if(s.opts.removeAdditional==="all"&&o.additionalProperties===void 0)rh.default.code(new oh.KeywordCxt(s,rh.default,"additionalProperties"));let i=Rn.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=br.mergeEvaluated.props(t,br.toHash(i),s.props);let a=i.filter((d)=>!br.alwaysValidSchema(s,r[d]));if(a.length===0)return;let u=t.name("valid");for(let d of a){if(c(d))l(d);else{if(t.if(Rn.propertyInData(t,n,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(u,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(u)}function c(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},u)}}};nh.default=jz});var ah=T(function(ih){Object.defineProperty(ih,"__esModule",{value:!0});var In=Ze(),Ot=U(),Cn=V(),On=V(),Az={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=In.allSchemaProperties(r),u=a.filter((g)=>Cn.alwaysValidSchema(s,r[g]));if(a.length===0||u.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof Ot.Name))s.props=On.evaluatedPropsToName(t,s.props);let{props:d}=s;f();function f(){for(let g of a){if(c)m(g);if(s.allErrors)h(g);else t.var(l,!0),h(g),t.if(l)}}function m(g){for(let x in c)if(new RegExp(g).test(x))Cn.checkStrictMode(s,`property ${x} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",o,(x)=>{t.if(Ot._`${In.usePattern(e,g)}.test(${x})`,()=>{let w=u.includes(g);if(!w)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:x,dataPropType:On.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(Ot._`${d}[${x}]`,!0);else if(!w&&!s.allErrors)t.if(Ot.not(l),()=>t.break())})})}}};ih.default=Az});var lh=T(function(uh){Object.defineProperty(uh,"__esModule",{value:!0});var ch=V(),qz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if(ch.alwaysValidSchema(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};uh.default=qz});var fh=T(function(ph){Object.defineProperty(ph,"__esModule",{value:!0});var dh=Ze(),Dz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:dh.validateUnion,error:{message:"must match a schema in anyOf"}};ph.default=Dz});var gh=T(function(hh){Object.defineProperty(hh,"__esModule",{value:!0});var jt=U(),mh=V(),Uz={message:"must match exactly one schema in oneOf",params:({params:e})=>jt._`{passingSchemas: ${e.passing}}`},Vz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Uz,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),u=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){s.forEach((l,d)=>{let f;if(mh.alwaysValidSchema(n,l))t.var(u,!0);else f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u);if(d>0)t.if(jt._`${u} && ${i}`).assign(i,!1).assign(a,jt._`[${a}, ${d}]`).else();t.if(u,()=>{if(t.assign(i,!0),t.assign(a,d),f)e.mergeEvaluated(f,jt.Name)})})}}};hh.default=Vz});var vh=T(function(yh){Object.defineProperty(yh,"__esModule",{value:!0});var _h=V(),Hz={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if(_h.alwaysValidSchema(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};yh.default=Hz});var xh=T(function(wh){Object.defineProperty(wh,"__esModule",{value:!0});var Nt=U(),jn=V(),Bz={message:({params:e})=>Nt.str`must match "${e.ifClause}" schema`,params:({params:e})=>Nt._`{failingKeyword: ${e.ifClause}}`},Wz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Bz,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)jn.checkStrictMode(o,'"if" without "then" and "else" is ignored');let n=$h(o,"then"),s=$h(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(u(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,c("then",l),c("else",l))}else if(n)t.if(a,c("then"));else t.if(Nt.not(a),c("else"));e.pass(i,()=>e.error(!0));function u(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function c(l,d){return()=>{let f=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(f,i),d)t.assign(d,Nt._`${l}`);else e.setParams({ifClause:l})}}}};function $h(e,t){let r=e.schema[t];return r!==void 0&&!jn.alwaysValidSchema(e,r)}wh.default=Wz});var Sh=T(function(zh){Object.defineProperty(zh,"__esModule",{value:!0});var bh=V(),Gz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)bh.checkStrictMode(r,`"${e}" without "if" is ignored`)}};zh.default=Gz});var Ph=T(function(kh){Object.defineProperty(kh,"__esModule",{value:!0});var Qz=Hi(),Xz=Zm(),eS=Ki(),tS=Um(),rS=Fm(),oS=Ym(),nS=eh(),sS=Bi(),iS=sh(),aS=ah(),cS=lh(),uS=fh(),lS=gh(),dS=vh(),pS=xh(),fS=Sh();function mS(e=!1){let t=[cS.default,uS.default,lS.default,dS.default,pS.default,fS.default,nS.default,sS.default,oS.default,iS.default,aS.default];if(e)t.push(Xz.default,tS.default);else t.push(Qz.default,eS.default);return t.push(rS.default),t}kh.default=mS});var Th=T(function(Eh){Object.defineProperty(Eh,"__esModule",{value:!0});var L=U(),gS={message:({schemaCode:e})=>L.str`must match format "${e}"`,params:({schemaCode:e})=>L._`{format: ${e}}`},_S={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:gS,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:d}=a;if(!u.validateFormats)return;if(n)f();else m();function f(){let h=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),g=r.const("fDef",L._`${h}[${i}]`),x=r.let("fType"),w=r.let("format");r.if(L._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(x,L._`${g}.type || "string"`).assign(w,L._`${g}.validate`),()=>r.assign(x,L._`"string"`).assign(w,g)),e.fail$data(L.or(E(),S()));function E(){if(u.strictSchema===!1)return L.nil;return L._`${i} && !${w}`}function S(){let N=l.$async?L._`(${g}.async ? await ${w}(${o}) : ${w}(${o}))`:L._`${w}(${o})`,v=L._`(typeof ${w} == "function" ? ${N} : ${w}.test(${o}))`;return L._`${w} && ${w} !== true && ${x} === ${t} && !${v}`}}function m(){let h=d.formats[s];if(!h){E();return}if(h===!0)return;let[g,x,w]=S(h);if(g===t)e.pass(N());function E(){if(u.strictSchema===!1){d.logger.warn(v());return}throw Error(v());function v(){return`unknown format "${s}" ignored in schema at path "${c}"`}}function S(v){let b=v instanceof RegExp?L.regexpCode(v):u.code.formats?L._`${u.code.formats}${L.getProperty(s)}`:void 0,M=r.scopeValue("formats",{key:s,ref:v,code:b});if(typeof v=="object"&&!(v instanceof RegExp))return[v.type||"string",v.validate,L._`${M}.validate`];return["string",v,M]}function N(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw Error("async format in sync schema");return L._`await ${w}(${o})`}return typeof x=="function"?L._`${w}(${o})`:L._`${w}.test(${o})`}}}};Eh.default=_S});var Ih=T(function(Rh){Object.defineProperty(Rh,"__esModule",{value:!0});var vS=Th(),$S=[vS.default];Rh.default=$S});var jh=T(function(Ch){Object.defineProperty(Ch,"__esModule",{value:!0});Ch.contentVocabulary=Ch.metadataVocabulary=void 0;Ch.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Ch.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Ah=T(function(Nh){Object.defineProperty(Nh,"__esModule",{value:!0});var bS=Bf(),zS=Pm(),SS=Ph(),kS=Ih(),Nn=jh(),PS=[bS.default,zS.default,(0,SS.default)(),kS.default,Nn.metadataVocabulary,Nn.contentVocabulary];Nh.default=PS});var Dh=T(function(qh){Object.defineProperty(qh,"__esModule",{value:!0});qh.DiscrError=void 0;var Zh;(function(e){e.Tag="tag",e.Mapping="mapping"})(Zh||(qh.DiscrError=Zh={}))});var Vh=T(function(Uh){Object.defineProperty(Uh,"__esModule",{value:!0});var Me=U(),zr=Dh(),An=_n(),TS=io(),Lh=V(),RS={message:({params:{discrError:e,tagName:t}})=>e===zr.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Me._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},IS={keyword:"discriminator",type:"object",schemaType:"object",error:RS,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let u=t.let("valid",!1),c=t.const("tag",Me._`${r}${Me.getProperty(a)}`);t.if(Me._`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:zr.DiscrError.Tag,tag:c,tagName:a})),e.ok(u);function l(){let m=f();t.if(!1);for(let h in m)t.elseIf(Me._`${c} === ${h}`),t.assign(u,d(m[h]));t.else(),e.error(!1,{discrError:zr.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(g,Me.Name),h}function f(){var m;let h={},g=w(n),x=!0;for(let N=0;N<i.length;N++){let v=i[N];if((v===null||v===void 0?void 0:v.$ref)&&!Lh.schemaHasRulesButRef(v,s.self.RULES)){let M=v.$ref;if(v=An.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,M),v instanceof An.SchemaEnv)v=v.schema;if(v===void 0)throw new TS.default(s.opts.uriResolver,s.baseId,M)}let b=(m=v===null||v===void 0?void 0:v.properties)===null||m===void 0?void 0:m[a];if(typeof b!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);x=x&&(g||w(v)),E(b,N)}if(!x)throw Error(`discriminator: "${a}" must be required`);return h;function w({required:N}){return Array.isArray(N)&&N.includes(a)}function E(N,v){if(N.const)S(N.const,v);else if(N.enum)for(let b of N.enum)S(b,v);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(N,v){if(typeof N!="string"||N in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[N]=v}}}};Uh.default=IS});var Fh=T(function(nO,OS){OS.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 Ji=T(function(Ie,Wi){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 jS=Mf(),NS=Ah(),AS=Vh(),Hh=Fh(),ZS=["/properties"],Zn="http://json-schema.org/draft-07/schema";class uo extends jS.default{_addVocabularies(){if(super._addVocabularies(),NS.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(AS.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Hh,ZS):Hh;this.addMetaSchema(e,Zn,!1),this.refs["http://json-schema.org/schema"]=Zn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Zn)?Zn:void 0)}}Ie.Ajv=uo;Wi.exports=Ie=uo;Wi.exports.Ajv=uo;Object.defineProperty(Ie,"__esModule",{value:!0});Ie.default=uo;var qS=so();Object.defineProperty(Ie,"KeywordCxt",{enumerable:!0,get:function(){return qS.KeywordCxt}});var Sr=U();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return Sr._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return Sr.str}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return Sr.stringify}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return Sr.nil}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return Sr.Name}});Object.defineProperty(Ie,"CodeGen",{enumerable:!0,get:function(){return Sr.CodeGen}});var MS=mn();Object.defineProperty(Ie,"ValidationError",{enumerable:!0,get:function(){return MS.default}});var DS=io();Object.defineProperty(Ie,"MissingRefError",{enumerable:!0,get:function(){return DS.default}})});var tg=T(function(Xh){Object.defineProperty(Xh,"__esModule",{value:!0});Xh.formatNames=Xh.fastFormats=Xh.fullFormats=void 0;function tt(e,t){return{validate:e,compare:t}}Xh.fullFormats={date:tt(Jh,Xi),time:tt(Yi(!0),ea),"date-time":tt(Kh(!0),Yh),"iso-time":tt(Yi(),Gh),"iso-date-time":tt(Kh(),Qh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:WS,"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:tk,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:JS,int32:{type:"number",validate:QS},int64:{type:"number",validate:XS},float:{type:"number",validate:Wh},double:{type:"number",validate:Wh},password:!0,binary:!0};Xh.fastFormats={...Xh.fullFormats,date:tt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Xi),time:tt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ea),"date-time":tt(/^\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":tt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Gh),"iso-date-time":tt(/^\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,Qh),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};Xh.formatNames=Object.keys(Xh.fullFormats);function VS(e){return e%4===0&&(e%100!==0||e%400===0)}var FS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,HS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Jh(e){let t=FS.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&VS(r)?29:HS[o])}function Xi(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Gi=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Yi(e){return function(r){let o=Gi.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],u=o[5]==="-"?-1:1,c=+(o[6]||0),l=+(o[7]||0);if(c>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*u,f=n-c*u-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&i<61}}function ea(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function Gh(e,t){if(!(e&&t))return;let r=Gi.exec(e),o=Gi.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var Qi=/t|\s/i;function Kh(e){let t=Yi(e);return function(o){let n=o.split(Qi);return n.length===2&&Jh(n[0])&&t(n[1])}}function Yh(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function Qh(e,t){if(!(e&&t))return;let[r,o]=e.split(Qi),[n,s]=t.split(Qi),i=Xi(r,n);if(i===void 0)return;return i||ea(o,s)}var KS=/\/|:/,BS=/^(?:[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 WS(e){return KS.test(e)&&BS.test(e)}var Bh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function JS(e){return Bh.lastIndex=0,Bh.test(e)}var GS=-2147483648,YS=2147483647;function QS(e){return Number.isInteger(e)&&e<=YS&&e>=GS}function XS(e){return Number.isInteger(e)}function Wh(){return!0}var ek=/[^\\]\\Z/;function tk(e){if(ek.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var ng=T(function(og){Object.defineProperty(og,"__esModule",{value:!0});og.formatLimitDefinition=void 0;var rg=Ji(),pe=U(),At=pe.operators,qn={formatMaximum:{okStr:"<=",ok:At.LTE,fail:At.GT},formatMinimum:{okStr:">=",ok:At.GTE,fail:At.LT},formatExclusiveMaximum:{okStr:"<",ok:At.LT,fail:At.GTE},formatExclusiveMinimum:{okStr:">",ok:At.GT,fail:At.LTE}},ok={message:({keyword:e,schemaCode:t})=>pe.str`should be ${qn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>pe._`{comparison: ${qn[e].okStr}, limit: ${t}}`};og.formatLimitDefinition={keyword:Object.keys(qn),type:"string",schemaType:"string",$data:!0,error:ok,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let u=new rg.KeywordCxt(s,a.RULES.all.format.definition,"format");if(u.$data)c();else l();function c(){let f=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=t.const("fmt",pe._`${f}[${u.schemaCode}]`);e.fail$data(pe.or(pe._`typeof ${m} != "object"`,pe._`${m} instanceof RegExp`,pe._`typeof ${m}.compare != "function"`,d(m)))}function l(){let f=u.schema,m=a.formats[f];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw Error(`"${n}": format "${f}" does not define "compare" function`);let h=t.scopeValue("formats",{key:f,ref:m,code:i.code.formats?pe._`${i.code.formats}${pe.getProperty(f)}`:void 0});e.fail$data(d(h))}function d(f){return pe._`${f}.compare(${r}, ${o}) ${qn[n].fail} 0`}},dependencies:["format"]};var nk=(e)=>(e.addKeyword(og.formatLimitDefinition),e);og.default=nk});var cg=T(function(lo,ag){Object.defineProperty(lo,"__esModule",{value:!0});var De=tg(),ik=ng(),kr=U(),sg=new kr.Name("fullFormats"),ak=new kr.Name("fastFormats"),oa=(e,t={keywords:!0})=>{if(Array.isArray(t))return ig(e,t,De.fullFormats,sg),e;let[r,o]=t.mode==="fast"?[De.fastFormats,ak]:[De.fullFormats,sg],n=t.formats||De.formatNames;if(ig(e,n,r,o),t.keywords)(0,ik.default)(e);return e};oa.get=(e,t="full")=>{let o=(t==="fast"?De.fastFormats:De.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function ig(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=kr._`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}ag.exports=lo=oa;Object.defineProperty(lo,"__esModule",{value:!0});lo.default=oa});var rs=Object.freeze({status:"aborted"});function _(e,t,r){function o(a,u){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,u);for(let l in i.prototype)if(!(l in a))Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=u}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var u;let c=r?.Parent?new s:this;o(c,a),(u=c._zod).deferred??(u.deferred=[]);for(let l of c._zod.deferred)l();return c}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var qg=Symbol("zod_brand");class lt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var go={};function Ce(e){if(e)Object.assign(go,e);return go}function Pa(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function ns(e,t="|"){return e.map((r)=>is(r)).join(t)}function Ea(e,t){if(typeof t==="bigint")return t.toString();return t}function yo(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function vo(e){return e===null||e===void 0}function $o(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ta(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,s=Number.parseInt(e.toFixed(n).replace(".","")),i=Number.parseInt(t.toFixed(n).replace(".",""));return s%i/10**n}function Q(e,t,r){Object.defineProperty(e,t,{get(){{let n=r();return e[t]=n,n}throw Error("cached value already set")},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function wo(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Gt(e){return JSON.stringify(e)}var ss=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Cr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Ra=yo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Or(e){if(Cr(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(Cr(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}var Ia=new Set(["string","number","symbol"]);function Mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ue(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function C(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function is(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Ca(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Oa={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Mg(e,t){let r={},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;r[n]=o.shape[n]}return Ue(e,{...e._zod.def,shape:r,checks:[]})}function Dg(e,t){let r={...e._zod.def.shape},o=e._zod.def;for(let n in t){if(!(n in o.shape))throw Error(`Unrecognized key: "${n}"`);if(!t[n])continue;delete r[n]}return Ue(e,{...e._zod.def,shape:r,checks:[]})}function Lg(e,t){if(!Or(t))throw Error("Invalid input to extend: expected a plain object");let r={...e._zod.def,get shape(){let o={...e._zod.def.shape,...t};return wo(this,"shape",o),o},checks:[]};return Ue(e,r)}function Ug(e,t){return Ue(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return wo(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function Vg(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in o))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;n[s]=e?new e({type:"optional",innerType:o[s]}):o[s]}else for(let s in o)n[s]=e?new e({type:"optional",innerType:o[s]}):o[s];return Ue(t,{...t._zod.def,shape:n,checks:[]})}function Fg(e,t,r){let o=t._zod.def.shape,n={...o};if(r)for(let s in r){if(!(s in n))throw Error(`Unrecognized key: "${s}"`);if(!r[s])continue;n[s]=new e({type:"nonoptional",innerType:o[s]})}else for(let s in o)n[s]=new e({type:"nonoptional",innerType:o[s]});return Ue(t,{...t._zod.def,shape:n,checks:[]})}function Yt(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function rt(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function _o(e){return typeof e==="string"?e:e?.message}function Ve(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=_o(e.inst?._zod.def?.error?.(e))??_o(t?.error?.(e))??_o(r.customError?.(e))??_o(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function xo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Qt(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var ja=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Ea,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bo=_("$ZodError",ja),as=_("$ZodError",ja,{Parent:Error});function cs(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function us(e,t){let r=t||function(s){return s.message},o={_errors:[]},n=(s)=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)o._errors.push(r(i));else{let a=o,u=0;while(u<i.path.length){let c=i.path[u];if(u!==i.path.length-1)a[c]=a[c]||{_errors:[]};else a[c]=a[c]||{_errors:[]},a[c]._errors.push(r(i));a=a[c],u++}}};return n(e),o}var Na=(e)=>(t,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new lt;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((u)=>Ve(u,s,Ce())));throw ss(a,n?.callee),a}return i.value};var Aa=(e)=>async(t,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((u)=>Ve(u,s,Ce())));throw ss(a,n?.callee),a}return i.value};var ls=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new lt;return s.issues.length?{success:!1,error:new(e??bo)(s.issues.map((i)=>Ve(i,n,Ce())))}:{success:!0,data:s.value}},jr=ls(as),ds=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>Ve(i,n,Ce())))}:{success:!0,data:s.value}},zo=ds(as);var Za=/^[cC][^\s-]{8,}$/,qa=/^[0-9a-z]+$/,Ma=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Da=/^[0-9a-vA-V]{20}$/,La=/^[A-Za-z0-9]{27}$/,Ua=/^[a-zA-Z0-9_-]{21}$/,Va=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Fa=/^([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})$/,ps=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Ha=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Ka(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var Ba=/^(?:(?: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])$/,Wa=/^(([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})$/,Ja=/^((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])$/,Ga=/^(([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])$/,Ya=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fs=/^[A-Za-z0-9_-]*$/,Qa=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Xa=/^\+(?:[0-9]){6,14}[0-9]$/,ec="(?:(?:\\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])))",tc=new RegExp(`^${ec}$`);function rc(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function oc(e){return new RegExp(`^${rc(e)}$`)}function nc(e){let t=rc({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-]\\d{2}:\\d{2})");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${ec}T(?:${o})$`)}var sc=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var ic=/^\d+$/,ac=/^-?\d+(?:\.\d+)?/i,cc=/true|false/i,uc=/null/i;var lc=/^[^A-Z]*$/,dc=/^[^a-z]*$/;var be=_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),pc={number:"number",bigint:"bigint",object:"date"},ms=_("$ZodCheckLessThan",(e,t)=>{be.init(e,t);let r=pc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hs=_("$ZodCheckGreaterThan",(e,t)=>{be.init(e,t);let r=pc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fc=_("$ZodCheckMultipleOf",(e,t)=>{be.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):Ta(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),mc=_("$ZodCheckNumberFormat",(e,t)=>{be.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Oa[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=s,r)a.pattern=ic}),e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}if(a<n)i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}});var hc=_("$ZodCheckMaxLength",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!vo(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let i=xo(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),gc=_("$ZodCheckMinLength",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!vo(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let i=xo(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),_c=_("$ZodCheckLengthEquals",(e,t)=>{var r;be.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!vo(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,s=n.length;if(s===t.length)return;let i=xo(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Nr=_("$ZodCheckStringFormat",(e,t)=>{var r,o;if(be.init(e,t),e._zod.onattach.push((n)=>{let s=n._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),yc=_("$ZodCheckRegex",(e,t)=>{Nr.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vc=_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=lc),Nr.init(e,t)}),$c=_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dc),Nr.init(e,t)}),wc=_("$ZodCheckIncludes",(e,t)=>{be.init(e,t);let r=Mt(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),xc=_("$ZodCheckStartsWith",(e,t)=>{be.init(e,t);let r=new RegExp(`^${Mt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),bc=_("$ZodCheckEndsWith",(e,t)=>{be.init(e,t);let r=new RegExp(`.*${Mt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var zc=_("$ZodCheckOverwrite",(e,t)=>{be.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class gs{constructor(e=[]){if(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 r=e.split(`
|
|
10
|
-
`).filter((s)=>s),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (input[${N}] === undefined) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
payload.issues
|
|
19
|
-
|
|
20
|
-
...iss,
|
|
21
|
-
path: iss.path ? [${N}, ...iss.path] : [${N}],
|
|
22
|
-
}))
|
|
23
|
-
);
|
|
9
|
+
deps: ${r}}`};var IE={keyword:"dependencies",type:"object",schemaType:"object",error:ty.error,code(e){let[t,r]=CE(e);Q_(e,t),ey(e,r)}};function CE({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function Q_(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let u=ft.propertyInData(r,n,i,o.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors)r.if(u,()=>{for(let c of a)ft.checkReportMissingProp(e,c)});else r.if(Vr._`${u} && (${ft.checkMissingProp(e,a,s)})`),ft.reportMissingProp(e,s),r.else()}}ty.validatePropertyDeps=Q_;function ey(e,t=e.schema){let{gen:r,data:n,keyword:o,it:s}=e,i=r.name("valid");for(let a in t){if(Y_.alwaysValidSchema(s,t[a]))continue;r.if(ft.propertyInData(r,n,a,s.opts.ownProperties),()=>{let u=e.subschema({keyword:o,schemaProp:a},i);e.mergeValidEvaluated(u,i)},()=>r.var(i,!0)),e.ok(i)}}ty.validateSchemaDeps=ey;ty.default=IE});var ay=E(function(iy){Object.defineProperty(iy,"__esModule",{value:!0});var xs=L(),sy=V(),jE={message:"property name must be valid",params:({params:e})=>xs._`{propertyName: ${e.propertyName}}`},ZE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:jE,code(e){let{gen:t,schema:r,data:n,it:o}=e;if(sy.alwaysValidSchema(o,r))return;let s=t.name("valid");t.forIn("key",n,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if(xs.not(s),()=>{if(e.error(!0),!o.allErrors)t.break()})}),e.ok(s)}};iy.default=ZE});var gc=E(function(cy){Object.defineProperty(cy,"__esModule",{value:!0});var Kt=Je(),pe=L(),ME=xt(),Wt=V(),qE={message:"must NOT have additional properties",params:({params:e})=>pe._`{additionalProperty: ${e.additionalProperty}}`},LE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:qE,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:u}=i;if(i.props=!0,u.removeAdditional!=="all"&&Wt.alwaysValidSchema(i,r))return;let c=Kt.allSchemaProperties(n.properties),l=Kt.allSchemaProperties(n.patternProperties);d(),e.ok(pe._`${s} === ${ME.default.errors}`);function d(){t.forIn("key",o,(_)=>{if(!c.length&&!l.length)p(_);else t.if(m(_),()=>p(_))})}function m(_){let y;if(c.length>8){let k=Wt.schemaRefOrVal(i,n.properties,"properties");y=Kt.isOwnProperty(t,k,_)}else if(c.length)y=pe.or(...c.map((k)=>pe._`${_} === ${k}`));else y=pe.nil;if(l.length)y=pe.or(y,...l.map((k)=>pe._`${Kt.usePattern(e,k)}.test(${_})`));return pe.not(y)}function f(_){t.code(pe._`delete ${o}[${_}]`)}function p(_){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){f(_);return}if(r===!1){if(e.setParams({additionalProperty:_}),e.error(),!a)t.break();return}if(typeof r=="object"&&!Wt.alwaysValidSchema(i,r)){let y=t.name("valid");if(u.removeAdditional==="failing")g(_,y,!1),t.if(pe.not(y),()=>{e.reset(),f(_)});else if(g(_,y),!a)t.if(pe.not(y),()=>t.break())}}function g(_,y,k){let C={keyword:"additionalProperties",dataProp:_,dataPropType:Wt.Type.Str};if(k===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(C,y)}}};cy.default=LE});var fy=E(function(dy){Object.defineProperty(dy,"__esModule",{value:!0});var ly=Nn(),$s=Je(),Hr=V(),uy=gc(),FE={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:s}=e;if(s.opts.removeAdditional==="all"&&n.additionalProperties===void 0)uy.default.code(new ly.KeywordCxt(s,uy.default,"additionalProperties"));let i=$s.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=Hr.mergeEvaluated.props(t,Hr.toHash(i),s.props);let a=i.filter((d)=>!Hr.alwaysValidSchema(s,r[d]));if(a.length===0)return;let u=t.name("valid");for(let d of a){if(c(d))l(d);else{if(t.if($s.propertyInData(t,o,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(u,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(u)}function c(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},u)}}};dy.default=FE});var my=E(function(py){Object.defineProperty(py,"__esModule",{value:!0});var zs=Je(),Gt=L(),Ss=V(),ks=V(),HE={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:s}=e,{opts:i}=s,a=zs.allSchemaProperties(r),u=a.filter((g)=>Ss.alwaysValidSchema(s,r[g]));if(a.length===0||u.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof Gt.Name))s.props=ks.evaluatedPropsToName(t,s.props);let{props:d}=s;m();function m(){for(let g of a){if(c)f(g);if(s.allErrors)p(g);else t.var(l,!0),p(g),t.if(l)}}function f(g){for(let _ in c)if(new RegExp(g).test(_))Ss.checkStrictMode(s,`property ${_} matches pattern ${g} (use allowMatchingProperties)`)}function p(g){t.forIn("key",n,(_)=>{t.if(Gt._`${zs.usePattern(e,g)}.test(${_})`,()=>{let y=u.includes(g);if(!y)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:_,dataPropType:ks.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(Gt._`${d}[${_}]`,!0);else if(!y&&!s.allErrors)t.if(Gt.not(l),()=>t.break())})})}}};py.default=HE});var _y=E(function(gy){Object.defineProperty(gy,"__esModule",{value:!0});var hy=V(),JE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(hy.alwaysValidSchema(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};gy.default=JE});var by=E(function(vy){Object.defineProperty(vy,"__esModule",{value:!0});var yy=Je(),WE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:yy.validateUnion,error:{message:"must match a schema in anyOf"}};vy.default=WE});var $y=E(function(xy){Object.defineProperty(xy,"__esModule",{value:!0});var Xt=L(),wy=V(),XE={message:"must match exactly one schema in oneOf",params:({params:e})=>Xt._`{passingSchemas: ${e.passing}}`},YE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:XE,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),u=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){s.forEach((l,d)=>{let m;if(wy.alwaysValidSchema(o,l))t.var(u,!0);else m=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u);if(d>0)t.if(Xt._`${u} && ${i}`).assign(i,!1).assign(a,Xt._`[${a}, ${d}]`).else();t.if(u,()=>{if(t.assign(i,!0),t.assign(a,d),m)e.mergeEvaluated(m,Xt.Name)})})}}};xy.default=YE});var ky=E(function(Sy){Object.defineProperty(Sy,"__esModule",{value:!0});var zy=V(),eT={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let o=t.name("valid");r.forEach((s,i)=>{if(zy.alwaysValidSchema(n,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},o);e.ok(o),e.mergeEvaluated(a)})}};Sy.default=eT});var Ty=E(function(Ey){Object.defineProperty(Ey,"__esModule",{value:!0});var Yt=L(),Ps=V(),rT={message:({params:e})=>Yt.str`must match "${e.ifClause}" schema`,params:({params:e})=>Yt._`{failingKeyword: ${e.ifClause}}`},nT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:rT,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)Ps.checkStrictMode(n,'"if" without "then" and "else" is ignored');let o=Py(n,"then"),s=Py(n,"else");if(!o&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(u(),e.reset(),o&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,c("then",l),c("else",l))}else if(o)t.if(a,c("then"));else t.if(Yt.not(a),c("else"));e.pass(i,()=>e.error(!0));function u(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function c(l,d){return()=>{let m=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(m,i),d)t.assign(d,Yt._`${l}`);else e.setParams({ifClause:l})}}}};function Py(e,t){let r=e.schema[t];return r!==void 0&&!Ps.alwaysValidSchema(e,r)}Ey.default=nT});var Iy=E(function(Oy){Object.defineProperty(Oy,"__esModule",{value:!0});var Ry=V(),sT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)Ry.checkStrictMode(r,`"${e}" without "if" is ignored`)}};Oy.default=sT});var Ay=E(function(Cy){Object.defineProperty(Cy,"__esModule",{value:!0});var aT=mc(),cT=V_(),uT=hc(),lT=W_(),dT=X_(),fT=oy(),pT=ay(),mT=gc(),hT=fy(),gT=my(),_T=_y(),yT=by(),vT=$y(),bT=ky(),wT=Ty(),xT=Iy();function $T(e=!1){let t=[_T.default,yT.default,vT.default,bT.default,wT.default,xT.default,pT.default,mT.default,fT.default,hT.default,gT.default];if(e)t.push(cT.default,lT.default);else t.push(aT.default,uT.default);return t.push(dT.default),t}Cy.default=$T});var jy=E(function(Ny){Object.defineProperty(Ny,"__esModule",{value:!0});var q=L(),ST={message:({schemaCode:e})=>q.str`must match format "${e}"`,params:({schemaCode:e})=>q._`{format: ${e}}`},kT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:ST,code(e,t){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:d}=a;if(!u.validateFormats)return;if(o)m();else f();function m(){let p=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),g=r.const("fDef",q._`${p}[${i}]`),_=r.let("fType"),y=r.let("format");r.if(q._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(_,q._`${g}.type || "string"`).assign(y,q._`${g}.validate`),()=>r.assign(_,q._`"string"`).assign(y,g)),e.fail$data(q.or(k(),C()));function k(){if(u.strictSchema===!1)return q.nil;return q._`${i} && !${y}`}function C(){let U=l.$async?q._`(${g}.async ? await ${y}(${n}) : ${y}(${n}))`:q._`${y}(${n})`,b=q._`(typeof ${y} == "function" ? ${U} : ${y}.test(${n}))`;return q._`${y} && ${y} !== true && ${_} === ${t} && !${b}`}}function f(){let p=d.formats[s];if(!p){k();return}if(p===!0)return;let[g,_,y]=C(p);if(g===t)e.pass(U());function k(){if(u.strictSchema===!1){d.logger.warn(b());return}throw Error(b());function b(){return`unknown format "${s}" ignored in schema at path "${c}"`}}function C(b){let x=b instanceof RegExp?q.regexpCode(b):u.code.formats?q._`${u.code.formats}${q.getProperty(s)}`:void 0,N=r.scopeValue("formats",{key:s,ref:b,code:x});if(typeof b=="object"&&!(b instanceof RegExp))return[b.type||"string",b.validate,q._`${N}.validate`];return["string",b,N]}function U(){if(typeof p=="object"&&!(p instanceof RegExp)&&p.async){if(!l.$async)throw Error("async format in sync schema");return q._`await ${y}(${n})`}return typeof _=="function"?q._`${y}(${n})`:q._`${y}.test(${n})`}}}};Ny.default=kT});var Dy=E(function(Zy){Object.defineProperty(Zy,"__esModule",{value:!0});var ET=jy(),TT=[ET.default];Zy.default=TT});var Ly=E(function(My){Object.defineProperty(My,"__esModule",{value:!0});My.contentVocabulary=My.metadataVocabulary=void 0;My.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];My.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Fy=E(function(Uy){Object.defineProperty(Uy,"__esModule",{value:!0});var IT=e_(),CT=A_(),AT=Ay(),NT=Dy(),Es=Ly(),jT=[IT.default,CT.default,(0,AT.default)(),NT.default,Es.metadataVocabulary,Es.contentVocabulary];Uy.default=jT});var Jy=E(function(Hy){Object.defineProperty(Hy,"__esModule",{value:!0});Hy.DiscrError=void 0;var Vy;(function(e){e.Tag="tag",e.Mapping="mapping"})(Vy||(Hy.DiscrError=Vy={}))});var Gy=E(function(Wy){Object.defineProperty(Wy,"__esModule",{value:!0});var We=L(),Br=Jy(),Ts=as(),DT=jn(),Ky=V(),MT={message:({params:{discrError:e,tagName:t}})=>e===Br.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>We._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},qT={keyword:"discriminator",type:"object",schemaType:"object",error:MT,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:s}=e,{oneOf:i}=o;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let u=t.let("valid",!1),c=t.const("tag",We._`${r}${We.getProperty(a)}`);t.if(We._`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:Br.DiscrError.Tag,tag:c,tagName:a})),e.ok(u);function l(){let f=m();t.if(!1);for(let p in f)t.elseIf(We._`${c} === ${p}`),t.assign(u,d(f[p]));t.else(),e.error(!1,{discrError:Br.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(f){let p=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:f},p);return e.mergeEvaluated(g,We.Name),p}function m(){var f;let p={},g=y(o),_=!0;for(let U=0;U<i.length;U++){let b=i[U];if((b===null||b===void 0?void 0:b.$ref)&&!Ky.schemaHasRulesButRef(b,s.self.RULES)){let N=b.$ref;if(b=Ts.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,N),b instanceof Ts.SchemaEnv)b=b.schema;if(b===void 0)throw new DT.default(s.opts.uriResolver,s.baseId,N)}let x=(f=b===null||b===void 0?void 0:b.properties)===null||f===void 0?void 0:f[a];if(typeof x!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(g||y(b)),k(x,U)}if(!_)throw Error(`discriminator: "${a}" must be required`);return p;function y({required:U}){return Array.isArray(U)&&U.includes(a)}function k(U,b){if(U.const)C(U.const,b);else if(U.enum)for(let x of U.enum)C(x,b);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function C(U,b){if(typeof U!="string"||U in p)throw Error(`discriminator: "${a}" values must be unique strings`);p[U]=b}}}};Wy.default=qT});var Xy=E(function(TD,UT){UT.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 yc=E(function(Ze,_c){Object.defineProperty(Ze,"__esModule",{value:!0});Ze.MissingRefError=Ze.ValidationError=Ze.CodeGen=Ze.Name=Ze.nil=Ze.stringify=Ze.str=Ze._=Ze.KeywordCxt=Ze.Ajv=void 0;var FT=Bg(),VT=Fy(),HT=Gy(),Yy=Xy(),BT=["/properties"],Rs="http://json-schema.org/draft-07/schema";class qn extends FT.default{_addVocabularies(){if(super._addVocabularies(),VT.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(HT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Yy,BT):Yy;this.addMetaSchema(e,Rs,!1),this.refs["http://json-schema.org/schema"]=Rs}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Rs)?Rs:void 0)}}Ze.Ajv=qn;_c.exports=Ze=qn;_c.exports.Ajv=qn;Object.defineProperty(Ze,"__esModule",{value:!0});Ze.default=qn;var JT=Nn();Object.defineProperty(Ze,"KeywordCxt",{enumerable:!0,get:function(){return JT.KeywordCxt}});var Jr=L();Object.defineProperty(Ze,"_",{enumerable:!0,get:function(){return Jr._}});Object.defineProperty(Ze,"str",{enumerable:!0,get:function(){return Jr.str}});Object.defineProperty(Ze,"stringify",{enumerable:!0,get:function(){return Jr.stringify}});Object.defineProperty(Ze,"nil",{enumerable:!0,get:function(){return Jr.nil}});Object.defineProperty(Ze,"Name",{enumerable:!0,get:function(){return Jr.Name}});Object.defineProperty(Ze,"CodeGen",{enumerable:!0,get:function(){return Jr.CodeGen}});var KT=os();Object.defineProperty(Ze,"ValidationError",{enumerable:!0,get:function(){return KT.default}});var WT=jn();Object.defineProperty(Ze,"MissingRefError",{enumerable:!0,get:function(){return WT.default}})});var cv=E(function(iv){Object.defineProperty(iv,"__esModule",{value:!0});iv.formatNames=iv.fastFormats=iv.fullFormats=void 0;function pt(e,t){return{validate:e,compare:t}}iv.fullFormats={date:pt(rv,xc),time:pt(bc(!0),$c),"date-time":pt(Qy(!0),ov),"iso-time":pt(bc(),nv),"iso-date-time":pt(Qy(),sv),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nR,"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:lR,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:oR,int32:{type:"number",validate:aR},int64:{type:"number",validate:cR},float:{type:"number",validate:tv},double:{type:"number",validate:tv},password:!0,binary:!0};iv.fastFormats={...iv.fullFormats,date:pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,xc),time:pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,$c),"date-time":pt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ov),"iso-time":pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,nv),"iso-date-time":pt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,sv),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};iv.formatNames=Object.keys(iv.fullFormats);function YT(e){return e%4===0&&(e%100!==0||e%400===0)}var QT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,eR=[0,31,28,31,30,31,30,31,31,30,31,30,31];function rv(e){let t=QT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&YT(r)?29:eR[n])}function xc(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var vc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function bc(e){return function(r){let n=vc.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],u=n[5]==="-"?-1:1,c=+(n[6]||0),l=+(n[7]||0);if(c>23||l>59||e&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*u,m=o-c*u-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function $c(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(!(r&&n))return;return r-n}function nv(e,t){if(!(e&&t))return;let r=vc.exec(e),n=vc.exec(t);if(!(r&&n))return;if(e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t)return 1;if(e<t)return-1;return 0}var wc=/t|\s/i;function Qy(e){let t=bc(e);return function(n){let o=n.split(wc);return o.length===2&&rv(o[0])&&t(o[1])}}function ov(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(!(r&&n))return;return r-n}function sv(e,t){if(!(e&&t))return;let[r,n]=e.split(wc),[o,s]=t.split(wc),i=xc(r,o);if(i===void 0)return;return i||$c(n,s)}var tR=/\/|:/,rR=/^(?:[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 nR(e){return tR.test(e)&&rR.test(e)}var ev=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function oR(e){return ev.lastIndex=0,ev.test(e)}var sR=-2147483648,iR=2147483647;function aR(e){return Number.isInteger(e)&&e<=iR&&e>=sR}function cR(e){return Number.isInteger(e)}function tv(){return!0}var uR=/[^\\]\\Z/;function lR(e){if(uR.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var dv=E(function(lv){Object.defineProperty(lv,"__esModule",{value:!0});lv.formatLimitDefinition=void 0;var uv=yc(),me=L(),Qt=me.operators,Os={formatMaximum:{okStr:"<=",ok:Qt.LTE,fail:Qt.GT},formatMinimum:{okStr:">=",ok:Qt.GTE,fail:Qt.LT},formatExclusiveMaximum:{okStr:"<",ok:Qt.LT,fail:Qt.GTE},formatExclusiveMinimum:{okStr:">",ok:Qt.GT,fail:Qt.LTE}},fR={message:({keyword:e,schemaCode:t})=>me.str`should be ${Os[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>me._`{comparison: ${Os[e].okStr}, limit: ${t}}`};lv.formatLimitDefinition={keyword:Object.keys(Os),type:"string",schemaType:"string",$data:!0,error:fR,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let u=new uv.KeywordCxt(s,a.RULES.all.format.definition,"format");if(u.$data)c();else l();function c(){let m=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",me._`${m}[${u.schemaCode}]`);e.fail$data(me.or(me._`typeof ${f} != "object"`,me._`${f} instanceof RegExp`,me._`typeof ${f}.compare != "function"`,d(f)))}function l(){let m=u.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw Error(`"${o}": format "${m}" does not define "compare" function`);let p=t.scopeValue("formats",{key:m,ref:f,code:i.code.formats?me._`${i.code.formats}${me.getProperty(m)}`:void 0});e.fail$data(d(p))}function d(m){return me._`${m}.compare(${r}, ${n}) ${Os[o].fail} 0`}},dependencies:["format"]};var pR=(e)=>(e.addKeyword(lv.formatLimitDefinition),e);lv.default=pR});var hv=E(function(Ln,mv){Object.defineProperty(Ln,"__esModule",{value:!0});var Ge=cv(),hR=dv(),Kr=L(),fv=new Kr.Name("fullFormats"),gR=new Kr.Name("fastFormats"),kc=(e,t={keywords:!0})=>{if(Array.isArray(t))return pv(e,t,Ge.fullFormats,fv),e;let[r,n]=t.mode==="fast"?[Ge.fastFormats,gR]:[Ge.fullFormats,fv],o=t.formats||Ge.formatNames;if(pv(e,o,r,n),t.keywords)(0,hR.default)(e);return e};kc.get=(e,t="full")=>{let n=(t==="fast"?Ge.fastFormats:Ge.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function pv(e,t,r,n){var o,s;(o=(s=e.opts.code).formats)!==null&&o!==void 0||(s.formats=Kr._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}mv.exports=Ln=kc;Object.defineProperty(Ln,"__esModule",{value:!0});Ln.default=kc});function en(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Ys(e,t="|"){return e.map((r)=>ti(r)).join(t)}function tn(e,t){if(typeof t==="bigint")return t.toString();return t}class Yc{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function rn(e){return new Yc(e)}function Qc(e){return e===null||e===void 0}function Vn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function eu(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function Le(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function nn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ht(e){return nn(e._zod.def)??e._zod.def.shape}function tu(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Le(this,t,n),n},enumerable:!0,configurable:!0})}function ru(e,t,r){if(t in e)Le(e,t,r);else e[t]=r}function nr(e,t,r,n){let o=ht(t);for(let s of r){let i=Object.getOwnPropertyDescriptor(o,s);if(!i.enumerable)continue;if(i.get)tu(e,s,()=>{let a=t._zod.def.shape[s];return n?n(a,s):a});else ru(e,s,n?n(i.value,s):i.value)}}function Yv(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)tu(e,r,()=>t[r]);else ru(e,r,n.value)}}function De(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function nu(e){return JSON.stringify(e)}function ou(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Qs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var su=rn(()=>{if(Re.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function or(e){if(yr(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(yr(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ei(e){if(or(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var iu=new Set(["string","number","symbol"]);function kt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xe(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function O(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function ti(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function au(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Hn=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),ri={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Qv(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s={};return nr(s,e,Bn(e,t)),Xe(e,De(r,{shape:s,checks:[]}))}function Bn(e,t){let r=ht(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function eb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=new Set(Bn(e,t)),i={};return nr(i,e,Reflect.ownKeys(ht(e)).filter((a)=>!s.has(a))),Xe(e,De(r,{shape:i,checks:[]}))}function tb(e,t){if(!or(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=ht(e);for(let s of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Xe(e,De(e._zod.def,{shape:cu(e,t)}))}function cu(e,t){let r={};return nr(r,e,Reflect.ownKeys(ht(e))),Yv(r,t),r}function rb(e,t){if(!or(t))throw Error("Invalid input to safeExtend: expected a plain object");return Xe(e,De(e._zod.def,{shape:cu(e,t)}))}function nb(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};nr(r,e,Reflect.ownKeys(ht(e))),nr(r,t,Reflect.ownKeys(ht(t)));let n=De(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Xe(e,n)}function uu(e,t,r,n="partial"){let s=t._zod.def.checks;if(s&&s.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(Bn(t,r)):void 0,u={};return nr(u,t,Reflect.ownKeys(ht(t)),e&&((c,l)=>a&&!a.has(l)?c:new e({type:"optional",innerType:c}))),Xe(t,De(t._zod.def,{shape:u,checks:[]}))}function ob(e,t,r){let n=r?new Set(Bn(t,r)):void 0,o={};return nr(o,t,Reflect.ownKeys(ht(t)),(s,i)=>n&&!n.has(i)?s:new e({type:"nonoptional",innerType:s})),Xe(t,De(t._zod.def,{shape:o}))}function Qe(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function lu(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Pt(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Qr(e){return typeof e==="string"?e:e?.message}function ni(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Jn(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function et(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,i=e.message?e.message:Qr(e.inst?._zod.def?.error?.(e))??Qr(s?.(e))??Qr(t?.error?.(e))??Qr(r.customError?.(e))??Qr(r.localeError?.(e))??"Invalid input",a={};for(let u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;a[u]=e[u]}if(a.path??(a.path=[]),a.message=i,t?.reportInput)a.input=e.input;return a}var sb=/[\uD800-\uDBFF]/;function Kn(e){let t=e.length;if(!sb.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Wn(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function du(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function sr(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function fu(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else ib(e,r,n.value)}}function gt(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Gn(e,t,r){return gt(e,t,r,!1)}function pu(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return gt(this,r,n(this))},set(o){gt(this,r,o)}})}return t}function ib(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:gt(this,t,r.bind(this))},set(n){gt(this,t,n)}})}function ab(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Xs,St=!1,cb={configurable:!0,get(){St=!0;return}};function J(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Xs!==e._zod){Xs=void 0;return}Xs=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,cb);let o=St;St=!1;try{let s=r(this);if(St)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return St=St||o,s}catch(s){throw delete this[t],St=St||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function ub(e,t,r,n){let o=ab(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,s),s.value=r(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:s})}})}var lb="~constantCatch";function mu(e){let t=()=>e;return t[lb]=!0,t}var hu,si=Object.freeze({status:"aborted"}),oi={value:void 0,enumerable:!1},gu="captureStackTrace"in Error?Error:null;function db(e){let t=gu;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return gu=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function v(e,t,r,n){let o={};function s(m){this.def=m,this.constr=d,this.traits=new Set}s.prototype=o;let i=r,a=i&&new WeakSet;function u(m,f){if(!m._zod){oi.value=new s(f);try{Object.defineProperty(m,"_zod",oi)}finally{oi.value=void 0}}else if(m._zod.traits.has(e))return;if(m._zod.traits.add(e),t(m,f),a){let g=Object.getPrototypeOf(m),_=m._zod.constr.prototype,y=g;while(y&&y!==_)y=Object.getPrototypeOf(y);let k=y??g;if(!a.has(k))a.add(k),fu(k,i)}let p=d.prototype;for(let g in p){if(!Object.prototype.hasOwnProperty.call(p,g))continue;if(!(g in m))m[g]=p[g].bind(m)}}let c=n?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function d(m){let f=n?.Parent?db(l):this;u(f,m);let p=f._zod.deferred;if(p){for(let _ of p)_();f._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;if(g)g(f);return f}return Object.defineProperty(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:(m)=>{if(n?.Parent&&m instanceof n.Parent)return!0;return m?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class tt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class on extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(hu=globalThis).__zod_globalConfig??(hu.__zod_globalConfig={});var Re=globalThis.__zod_globalConfig;function Oe(e){if(e)Object.assign(Re,e);return Re}function fb(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,tn,2)),e.message}function pb(e){this._zod.message=e}var mb={get:fb,set:pb,enumerable:!0,configurable:!0},ai={value:void 0,enumerable:!1},_u=new WeakSet([Object.prototype,Error.prototype]),yu=(e,t)=>{e.name="$ZodError",ai.value=t,Object.defineProperty(e,"issues",ai),ai.value=void 0,Object.defineProperty(e,"message",mb);let r=Object.getPrototypeOf(e);if(!_u.has(r))_u.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},vu=v("$ZodError",yu),bu=v("$ZodError",yu,void 0,{Parent:Error});function hb(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function ci(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)hb(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function ui(e,t=(r)=>r.message){let r={_errors:[]},n=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map((a)=>n({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(t(i));else{let u=r,c=0;while(c<a.length){let l=a[c],d=c===a.length-1;if(l==="_errors"){if(d)u._errors.push(t(i));c++;continue}if(!Object.prototype.hasOwnProperty.call(u,l))Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=u[l];if(d)m._errors.push(t(i));u=m,c++}}}};return n(e),r}function Xn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Yn=(e)=>{let t=(r,n,o,s)=>{let i=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new tt;if(a.issues.length){let u=new(s?.Err??e)(a.issues.map((c)=>et(c,i,Oe())));throw Qs(u,s?.callee??t),u}return a.value};return t};var Qn=(e)=>{let t=async(r,n,o,s)=>{let i=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let u=new(s?.Err??e)(a.issues.map((c)=>et(c,i,Oe())));throw Qs(u,s?.callee??t),u}return a.value};return t};var sn=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new tt;return s.issues.length?wu(e,s.issues,o):{success:!0,data:s.value}},li=sn(bu);function wu(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>et(o,r,Oe()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var eo=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?wu(e,s.issues,o):{success:!0,data:s.value}};var _b=Symbol.for("zod.compile.invalid"),yb=Symbol.for("zod.compile.fallback"),to=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==_b)return!0;if(n.definite===!0&&r===void 0)return!1}return vb(e,t,r)};function vb(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,s;if(o)n[yb]=!0,s=o({value:t,issues:[]},n);else s=e._zod.run({value:t,issues:[]},n);if(s instanceof Promise)throw new tt;return s.issues.length===0}var ro=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},xu=(e)=>{let t=Yn(e),r=(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return t(n,o,a,Xn(r,i))};return r};var $u=(e)=>{let t=Yn(e),r=(n,o,s,i)=>t(n,o,s,Xn(r,i));return r};var zu=(e)=>{let t=Qn(e),r=async(n,o,s,i)=>{let a=s?{...s,direction:"backward"}:{direction:"backward"};return await t(n,o,a,Xn(r,i))};return r};var Su=(e)=>{let t=Qn(e),r=async(n,o,s,i)=>await t(n,o,s,Xn(r,i));return r};var ku=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return sn(e)(t,r,o)};var Pu=(e)=>(t,r,n)=>sn(e)(t,r,n);var Eu=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return eo(e)(t,r,o)};var Tu=(e)=>async(t,r,n)=>eo(e)(t,r,n);var Ru=/^[cC][0-9a-z]{6,}$/,Ou=/^[0-9a-z]+$/,Iu=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Cu=/^[0-9a-vA-V]{20}$/,Au=/^[A-Za-z0-9]{27}$/,Nu=/^[a-zA-Z0-9_-]{21}$/;function ju(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Zu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Du=/^([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})$/,fi=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Mu=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var bb="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function qu(){return new RegExp(bb,"u")}var Lu=/^(?:(?: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])$/,Uu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Fu=/^((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])$/,Vu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Hu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Bu=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Ju=/^https?$/,Ku=/^\+[1-9]\d{6,14}$/;var Wu="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function wb(e){return new RegExp(`^${e}$`)}var Gu=wb(Wu);function di(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Xu(e){return new RegExp(`^${di(e)}$`)}function Yu(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${di({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${di({precision:e.precision})}`:r;return new RegExp(`^${Wu}T(?:${n})$`)}var Qu=/^[\s\S]{0,}$/;var pi=/^-?\d+$/,an=/^-?\d+(?:\.\d+)?$/,el=/^(?:true|false)$/i,tl=/^null$/i;var rl=/^[^A-Z]*$/,nl=/^[^a-z]*$/;var we=v("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var mi=(e)=>{let t=e.value;return!Qc(t)&&t.length!==void 0},no={number:"number",bigint:"bigint",object:"date"},hi=v("$ZodCheckLessThan",(e,t)=>{we.init(e,t);let r=no[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:no[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gi=v("$ZodCheckGreaterThan",(e,t)=>{we.init(e,t);let r=no[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:no[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ol=v("$ZodCheckMultipleOf",(e,t)=>{we.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):eu(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),sl=v("$ZodCheckNumberFormat",(e,t)=>{we.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,s]=Hn[t.format];e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(a<o)i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var il=v("$ZodCheckMaxLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=mi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>t.maximum?Kn(o):s)<=t.maximum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),al=v("$ZodCheckMinLength",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=mi),e._zod.check=(n)=>{let o=n.value,s=o.length;if((typeof o==="string"&&s>=t.minimum&&s<t.minimum*2?Kn(o):s)>=t.minimum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),cl=v("$ZodCheckLengthEquals",(e,t)=>{var r;we.init(e,t),(r=e._zod.def).when??(r.when=mi),e._zod.check=(n)=>{let o=n.value,s=o.length,i=typeof o==="string"&&s>=t.length&&s<=t.length*2?Kn(o):s;if(i===t.length)return;let a=Wn(o),u=i>t.length;n.issues.push({origin:a,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),cn=v("$ZodCheckStringFormat",(e,t)=>{var r,n;if(we.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),ul=v("$ZodCheckRegex",(e,t)=>{cn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ll=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=rl),cn.init(e,t)}),dl=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nl),cn.init(e,t)}),fl=v("$ZodCheckIncludes",(e,t)=>{we.init(e,t);let r=kt(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),pl=v("$ZodCheckStartsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`^${kt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ml=v("$ZodCheckEndsWith",(e,t)=>{we.init(e,t);let r=new RegExp(`.*${kt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var hl=v("$ZodCheckOverwrite",(e,t)=>{we.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class _i{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
10
|
+
`).filter((s)=>s),n=Math.min(...r.map((s)=>s.length-s.trimStart().length)),o=r.map((s)=>s.slice(n)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of o)this.content.push(s)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
11
|
+
${t.join(`
|
|
12
|
+
`)}
|
|
13
|
+
};`)(...Object.values(this.closed))}}var _l={major:4,minor:6,patch:7};var ee=v("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_l;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let s of o)for(let i of s._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(a,u,c)=>{if(a.memo)return a;let l=Qe(a),d;for(let m of u){if(m._zod.def.when){if(lu(a))continue;if(!m._zod.def.when(a))continue}else if(l)continue;let f=a.issues.length,p=m._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new tt;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await p,a.issues.length===f)return;if(Jn(a.issues,f,e),!l)l=Qe(a,f)});else{if(a.issues.length===f)continue;if(Jn(a.issues,f,e),!l)l=Qe(a,f)}}if(d)return d.then(()=>a);return a},i=(a,u,c)=>{if(Qe(a))return a.aborted=!0,a;let l=s(u,o,c);if(l instanceof Promise){if(c.async===!1)throw new tt;return l.then((d)=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(a,u)=>{if(u.skipChecks)return e._zod.parse(a,u);if(u.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((d)=>i(d,a,u));return i(l,a,u)}let c=e._zod.parse(a,u);if(c instanceof Promise){if(u.async===!1)throw new tt;return c.then((l)=>s(l,o,u))}return s(c,o,u)}}},{get "~standard"(){return Gn(this,"~standard",vi(this))},set "~standard"(e){gt(this,"~standard",e)}}),El=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>et(r,t,Oe()))}:{value:e.value};async function xb(e,t){let r={async:!0};return El(await e._zod.run({value:t,issues:[]},r),r)}function vi(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return El(n,r)}catch(n){}return xb(e,t)},vendor:"zod",version:1}}var ao=v("$ZodString",(e,t)=>{ee.init(e,t),e._zod.pattern=t.pattern??Qu,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),re=v("$ZodStringFormat",(e,t)=>{cn.init(e,t),ao.init(e,t)}),Tl=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Du),re.init(e,t)}),Rl=v("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=fi(n))}else t.pattern??(t.pattern=fi());re.init(e,t)}),Ol=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Mu),re.init(e,t)}),Il=1,so=2;function Cl(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function $b(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return Cl(e)||so;return zb(e,t)}function zb(e,t){if(!t.normalize&&t.protocol?.source===Ju.source&&!/^https?:\/\//i.test(e))return Il;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??so}return new URL(e)}catch{return so}}var Sb=/[\t\n\r]/g;function yl(e){return e.replace(Sb,"")}function kb(e,t){return t.lastIndex=0,t.test(e.hostname)}function Pb(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Al=v("$ZodURL",(e,t)=>{re.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=$b(n,t);if(o===Il){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===so){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=yl(n);return}if(t.hostname&&!kb(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Pb(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:yl(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Nl=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=qu()),re.init(e,t)}),jl=v("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Nu:ju(t.length)),re.init(e,t)}),Zl=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ru),re.init(e,t)}),Dl=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ou),re.init(e,t)}),Ml=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Iu),re.init(e,t)}),ql=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Cu),re.init(e,t)}),Ll=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Au),re.init(e,t)}),Ul=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Yu(t)),re.init(e,t)}),Fl=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Gu),re.init(e,t)}),Vl=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Xu(t)),re.init(e,t)}),Hl=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Zu),re.init(e,t)}),Bl=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Lu),re.init(e,t)}),Eb=/^[0-9a-fA-F:.]+$/;function Jl(e){if(!Eb.test(e))return!1;return Cl(`http://[${e}]`)}var Kl=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Uu),re.init(e,t),e._zod.check=(r)=>{if(!Jl(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Wl=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Fu),re.init(e,t)});function Tb(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return Jl(r)}var Gl=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vu),re.init(e,t),e._zod.check=(r)=>{if(!Tb(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Xl(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var bi=/^[0-9a-zA-Z+/]*={0,2}$/,Yl=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=bi),re.init(e,t),e._zod.check=(r)=>{if(Xl(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),co=/^[A-Za-z0-9_-]*$/;function Rb(e){if(!co.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Xl(r)}var Ql=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=co),re.init(e,t),e._zod.check=(r)=>{if(Rb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ed=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ku),re.init(e,t)});function Ob(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var td=v("$ZodJWT",(e,t)=>{re.init(e,t),e._zod.check=(r)=>{if(Ob(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var wi=v("$ZodNumber",(e,t)=>{ee.init(e,t),e._zod.pattern=an,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}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)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),rd=v("$ZodNumberFormat",(e,t)=>{sl.init(e,t),wi.init(e,t)}),nd=v("$ZodBoolean",(e,t)=>{ee.init(e,t),e._zod.pattern=el,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var od=v("$ZodNull",(e,t)=>{ee.init(e,t),e._zod.pattern=tl,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;if(o===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),sd=v("$ZodAny",(e,t)=>{ee.init(e,t),e._zod.parse=(r)=>r}),id=v("$ZodUnknown",(e,t)=>{ee.init(e,t),e._zod.parse=(r)=>r}),ad=v("$ZodNever",(e,t)=>{ee.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Ib(e,t){let r=ni(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((s)=>s[0])),o=e._zod.parse;e._zod.parse=(s,i)=>{let a=t(s.value);if(a>n&&!i?.skipChecks&&i?.direction!=="backward"){for(let[u,c]of ni(e._zod.def.checks))if(a>u&&c._zod.def.when(s)){let l=s.issues.length;return c._zod.check(s),s.issues[l].continue=!1,Jn(s.issues,l,e),s}}return o(s,i)}}var Cb=(e)=>Array.isArray(e)?e.length:-1;function vl(e,t,r){if(e.issues.length)t.issues.push(...Pt(r,e.issues));t.value[r]=e.value}var cd=v("$ZodArray",(e,t)=>{ee.init(e,t);let r=Re.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=r?r.alloc(e,n,Array(s.length),o):Array(s.length);let i=[],a=o?.abortEarly;for(let u=0;u<s.length;u++){let c=s[u],l=t.element._zod.run({value:c,issues:[]},o);if(l instanceof Promise)i.push(l.then((d)=>vl(d,n,u)));else if(vl(l,n,u),a&&l.issues.length!==0&&Qe(l))break}if(i.length)return Promise.all(i).then(()=>n);return n},Ib(e,Cb)});function io(e,t,r,n,o,s){let i=r in n,a=s==="optional";if(!i&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!i)return;t.issues.push(...Pt(r,e.issues))}if(!i&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(i||o==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}var Ab=[];function ud(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Ab,o=n.length?[...t,...n]:t;for(let i of o)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(i)}": expected a Zod schema`);let s=au(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function ld(e,t,r,n,o,s,i){let a=[],u=o.keySet,c=o.catchall._zod,l=c.def.type,{optin:d,optout:m}=c,f=0;for(let p in t){if(i&&r.issues.length!==f){if(Qe(r,f))break;f=r.issues.length}if(u.has(p))continue;if(p==="__proto__"){if(l==="never")a.push(p);continue}if(l==="never"){a.push(p);continue}let g=c.run({value:t[p],issues:[]},n);if(g instanceof Promise)e.push(g.then((_)=>io(_,r,p,t,d,m)));else io(g,r,p,t,d,m)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Nb=v("$ZodObject",(e,t)=>{ee.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let c=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),c.raw=l,l};c.raw=n,Object.defineProperty(t,"shape",{get:c})}let o=rn(()=>ud(t));J(e,"propValues",(c)=>{let l=c.def.shape,d={};for(let m in l){let f=l[m]._zod;if(f.values){if(!Object.prototype.hasOwnProperty.call(d,m))Le(d,m,new Set);for(let p of f.values)d[m].add(p);if(f.optin!==void 0)d[m].add(void 0)}}return d});let s=yr,i=t.catchall,a,u=Re.memoizer;u?.attach(e),e._zod.parse=(c,l)=>{a??(a=o.value);let d=c.value;if(!s(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value=u?u.alloc(e,c,{},l):{};let m=[],f=a.shape,p=l?.abortEarly,g=c.issues.length;for(let _ of a.allKeys){if(p&&c.issues.length!==g){if(Qe(c,g))break;g=c.issues.length}if(_==="__proto__")continue;let y=f[_],k=y._zod.optin,C=y._zod.optout,U=y._zod.run({value:d[_],issues:[]},l);if(U instanceof Promise)m.push(U.then((b)=>io(b,c,_,d,k,C)));else io(U,c,_,d,k,C)}if(!i)return m.length?Promise.all(m).then(()=>c):c;return ld(m,d,c,l,o.value,e,p===!0)}}),dd=v("$ZodObjectJIT",(e,t)=>{Nb.init(e,t);let r=e._zod.parse,n=rn(()=>ud(t)),o=Re.memoizer,s=(f)=>{let p=n.value,g=p.symbolKeys,_=new _i(["payload","ctx"],{shape:f,inst:e,memo:o,syms:g}),y=(b)=>`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`,k=(b,x)=>`
|
|
14
|
+
let ${b}_ab = false;
|
|
15
|
+
for (let i = 0; i < ${b}.issues.length; i++) {
|
|
16
|
+
const iss = ${b}.issues[i];
|
|
17
|
+
iss.path = iss.path ? [${x}, ...iss.path] : [${x}];
|
|
18
|
+
payload.issues.push(iss);
|
|
19
|
+
if (iss.continue !== true) ${b}_ab = true;
|
|
24
20
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
newResult[${N}] = ${
|
|
21
|
+
if (${b}_ab && ctx && ctx.abortEarly) {
|
|
22
|
+
payload.value = newResult;
|
|
23
|
+
return payload;
|
|
24
|
+
}`;_.write("const input = payload.value;");let C=Object.create(null),U=0;for(let b of p.allKeys)C[b]=`key_${U++}`;_.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let b of p.allKeys){if(b==="__proto__")continue;let x=C[b],N=typeof b==="symbol"?`syms[${g.indexOf(b)}]`:nu(b),Y=`${N} in input`,F=f[b],se=F?._zod?.optin,mt=se!==void 0,rr=F?._zod?.optout==="optional";if(_.write(`const ${x} = ${y(N)};`),mt&&rr){let _r=se==="optional"?`${x}_present`:`${x}.value !== undefined || ${x}_present`;_.write(`
|
|
25
|
+
const ${x}_present = ${Y};
|
|
26
|
+
if (!${x}.issues.length || ${x}_present) {
|
|
27
|
+
if (${x}.issues.length) {${k(x,N)}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (${_r}) {
|
|
31
|
+
newResult[${N}] = ${x}.value;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
`)}else if(!mt)_.write(`
|
|
36
|
+
const ${x}_present = ${Y};
|
|
37
|
+
if (${x}.issues.length) {${k(x,N)}
|
|
38
|
+
}
|
|
39
|
+
if (!${x}_present && !${x}.issues.length) {
|
|
40
|
+
payload.issues.push({
|
|
41
|
+
code: "invalid_type",
|
|
42
|
+
expected: "nonoptional",
|
|
43
|
+
input: undefined,
|
|
44
|
+
path: [${N}]
|
|
45
|
+
});
|
|
46
|
+
if (ctx && ctx.abortEarly) {
|
|
47
|
+
payload.value = newResult;
|
|
48
|
+
return payload;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (${x}_present) {
|
|
53
|
+
newResult[${N}] = ${x}.value;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
`);else if(_.write(`
|
|
57
|
+
if (${x}.issues.length) {${k(x,N)}
|
|
58
|
+
}
|
|
59
|
+
`),se==="defaulted")_.write(`newResult[${N}] = ${x}.value;`);else _.write(`
|
|
60
|
+
if (${x}.value !== undefined || ${Y}) {
|
|
61
|
+
newResult[${N}] = ${x}.value;
|
|
29
62
|
}
|
|
30
|
-
`)}else{let S=g[E];f.write(`const ${S} = ${h(E)};`),f.write(`
|
|
31
|
-
|
|
32
|
-
...iss,
|
|
33
|
-
|
|
34
|
-
})));`),f.write(`newResult[${Gt(E)}] = ${S}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let w=f.compile();return(E,S)=>w(d,E,S)},n,s=Cr,i=!go.jitless,u=i&&Ra.value,c=t.catchall,l;e._zod.parse=(d,f)=>{l??(l=r.value);let m=d.value;if(!s(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d;let h=[];if(i&&u&&f?.async===!1&&f.jitless!==!0){if(!n)n=o(t.shape);d=n(d,f)}else{d.value={};let S=l.shape;for(let N of l.keys){let v=S[N],b=v._zod.run({value:m[N],issues:[]},f),M=v._zod.optin==="optional"&&v._zod.optout==="optional";if(b instanceof Promise)h.push(b.then((re)=>M?Ec(re,d,N,m):ko(re,d,N)));else if(M)Ec(b,d,N,m);else ko(b,d,N)}}if(!c)return h.length?Promise.all(h).then(()=>d):d;let g=[],x=l.keySet,w=c._zod,E=w.def.type;for(let S of Object.keys(m)){if(x.has(S))continue;if(E==="never"){g.push(S);continue}let N=w.run({value:m[S],issues:[]},f);if(N instanceof Promise)h.push(N.then((v)=>ko(v,d,S)));else ko(N,d,S)}if(g.length)d.issues.push({code:"unrecognized_keys",keys:g,input:m,inst:e});if(!h.length)return d;return Promise.all(h).then(()=>d)}});function Tc(e,t,r,o){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((n)=>n.issues.map((s)=>Ve(s,o,Ce())))}),t}var vs=_("$ZodUnion",(e,t)=>{G.init(e,t),Q(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),Q(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),Q(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),Q(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((o)=>o._zod.pattern);return new RegExp(`^(${r.map((o)=>$o(o.source)).join("|")})$`)}return}),e._zod.parse=(r,o)=>{let n=!1,s=[];for(let i of t.options){let a=i._zod.run({value:r.value,issues:[]},o);if(a instanceof Promise)s.push(a),n=!0;else{if(a.issues.length===0)return a;s.push(a)}}if(!n)return Tc(s,r,e,o);return Promise.all(s).then((i)=>Tc(i,r,e,o))}}),mu=_("$ZodDiscriminatedUnion",(e,t)=>{vs.init(e,t);let r=e._zod.parse;Q(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,u]of Object.entries(i)){if(!n[a])n[a]=new Set;for(let c of u)n[a].add(c)}}return n});let o=yo(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let u of a){if(s.has(u))throw Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!Cr(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);if(a)return a._zod.run(n,s);if(t.unionFallback)return r(n,s);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),n}}),hu=_("$ZodIntersection",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([u,c])=>Rc(r,u,c));return Rc(r,s,i)}});function _s(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Or(e)&&Or(t)){let r=Object.keys(t),o=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=_s(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=_s(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Rc(e,t,r){if(t.issues.length)e.issues.push(...t.issues);if(r.issues.length)e.issues.push(...r.issues);if(Yt(e))return e;let o=_s(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var gu=_("$ZodRecord",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Or(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[];if(t.keyType._zod.values){let i=t.keyType._zod.values;r.value={};for(let u of i)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){let c=t.valueType._zod.run({value:n[u],issues:[]},o);if(c instanceof Promise)s.push(c.then((l)=>{if(l.issues.length)r.issues.push(...rt(u,l.issues));r.value[u]=l.value}));else{if(c.issues.length)r.issues.push(...rt(u,c.issues));r.value[u]=c.value}}let a;for(let u in n)if(!i.has(u))a=a??[],a.push(u);if(a&&a.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(n)){if(i==="__proto__")continue;let a=t.keyType._zod.run({value:i,issues:[]},o);if(a instanceof Promise)throw 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((c)=>Ve(c,o,Ce())),input:i,path:[i],inst:e}),r.value[a.value]=a.value;continue}let u=t.valueType._zod.run({value:n[i],issues:[]},o);if(u instanceof Promise)s.push(u.then((c)=>{if(c.issues.length)r.issues.push(...rt(i,c.issues));r.value[a.value]=c.value}));else{if(u.issues.length)r.issues.push(...rt(i,u.issues));r.value[a.value]=u.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var _u=_("$ZodEnum",(e,t)=>{G.init(e,t);let r=Pa(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter((o)=>Ia.has(typeof o)).map((o)=>typeof o==="string"?Mt(o):o.toString()).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;if(e._zod.values.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),yu=_("$ZodLiteral",(e,t)=>{G.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?Mt(r):r?r.toString():String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let n=r.value;if(e._zod.values.has(n))return r;return r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}});var vu=_("$ZodTransform",(e,t)=>{G.init(e,t),e._zod.parse=(r,o)=>{let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((i)=>(r.value=i,r));if(n instanceof Promise)throw new lt;return r.value=n,r}}),$u=_("$ZodOptional",(e,t)=>{G.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Q(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${$o(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional")return t.innerType._zod.run(r,o);if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),wu=_("$ZodNullable",(e,t)=>{G.init(e,t),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${$o(r.source)}|null)$`):void 0}),Q(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),xu=_("$ZodDefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Ic(s,t));return Ic(n,t)}});function Ic(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var bu=_("$ZodPrefault",(e,t)=>{G.init(e,t),e._zod.optin="optional",Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),zu=_("$ZodNonOptional",(e,t)=>{G.init(e,t),Q(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Cc(s,e));return Cc(n,e)}});function Cc(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Su=_("$ZodCatch",(e,t)=>{G.init(e,t),e._zod.optin="optional",Q(e._zod,"optout",()=>t.innerType._zod.optout),Q(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>Ve(i,o,Ce()))},input:r.value}),r.issues=[];return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((s)=>Ve(s,o,Ce()))},input:r.value}),r.issues=[];return r}});var ku=_("$ZodPipe",(e,t)=>{G.init(e,t),Q(e._zod,"values",()=>t.in._zod.values),Q(e._zod,"optin",()=>t.in._zod.optin),Q(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(r,o)=>{let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Oc(s,t,o));return Oc(n,t,o)}});function Oc(e,t,r){if(Yt(e))return e;return t.out._zod.run({value:e.value,issues:e.issues},r)}var Pu=_("$ZodReadonly",(e,t)=>{G.init(e,t),Q(e._zod,"propValues",()=>t.innerType._zod.propValues),Q(e._zod,"values",()=>t.innerType._zod.values),Q(e._zod,"optin",()=>t.innerType._zod.optin),Q(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(jc);return jc(n)}});function jc(e){return e.value=Object.freeze(e.value),e}var Eu=_("$ZodCustom",(e,t)=>{be.init(e,t),G.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((s)=>Nc(s,r,o,e));Nc(n,r,o,e);return}});function Nc(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(Qt(n))}}var Wg=(e)=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},Jg=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(o){return e[o]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(o)=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${Wg(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${is(o.values[0])}`;return`Invalid option: expected one of ${ns(o.values,"|")}`;case"too_big":{let n=o.inclusive?"<=":"<",s=t(o.origin);if(s)return`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${s.unit??"elements"}`;return`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{let n=o.inclusive?">=":">",s=t(o.origin);if(s)return`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${s.unit}`;return`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{let n=o;if(n.format==="starts_with")return`Invalid string: must start with "${n.prefix}"`;if(n.format==="ends_with")return`Invalid string: must end with "${n.suffix}"`;if(n.format==="includes")return`Invalid string: must include "${n.includes}"`;if(n.format==="regex")return`Invalid string: must match pattern ${n.pattern}`;return`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${ns(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function $s(){return{localeError:Jg()}}var Gg=Symbol("ZodOutput"),Yg=Symbol("ZodInput");class Tu{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};return delete r.id,{...r,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Ru(){return new Tu}var Xt=Ru();function Iu(e,t){return new e({type:"string",...C(t)})}function Cu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...C(t)})}function ws(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...C(t)})}function Ou(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...C(t)})}function ju(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...C(t)})}function Nu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...C(t)})}function Au(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...C(t)})}function xs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...C(t)})}function Zu(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...C(t)})}function qu(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...C(t)})}function Mu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...C(t)})}function Du(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...C(t)})}function Lu(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...C(t)})}function Uu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...C(t)})}function Vu(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...C(t)})}function Fu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...C(t)})}function Hu(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...C(t)})}function Ku(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...C(t)})}function Bu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...C(t)})}function Wu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...C(t)})}function Ju(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...C(t)})}function Gu(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...C(t)})}function Yu(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...C(t)})}function Qu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...C(t)})}function Xu(e,t){return new e({type:"string",format:"date",check:"string_format",...C(t)})}function el(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...C(t)})}function tl(e,t){return new e({type:"string",format:"duration",check:"string_format",...C(t)})}function rl(e,t){return new e({type:"number",checks:[],...C(t)})}function ol(e,t){return new e({type:"number",coerce:!0,checks:[],...C(t)})}function nl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...C(t)})}function sl(e,t){return new e({type:"boolean",...C(t)})}function il(e,t){return new e({type:"null",...C(t)})}function al(e){return new e({type:"any"})}function cl(e){return new e({type:"unknown"})}function ul(e,t){return new e({type:"never",...C(t)})}function Eo(e,t){return new ms({check:"less_than",...C(t),value:e,inclusive:!1})}function Ar(e,t){return new ms({check:"less_than",...C(t),value:e,inclusive:!0})}function To(e,t){return new hs({check:"greater_than",...C(t),value:e,inclusive:!1})}function Zr(e,t){return new hs({check:"greater_than",...C(t),value:e,inclusive:!0})}function Ro(e,t){return new fc({check:"multiple_of",...C(t),value:e})}function Io(e,t){return new hc({check:"max_length",...C(t),maximum:e})}function er(e,t){return new gc({check:"min_length",...C(t),minimum:e})}function Co(e,t){return new _c({check:"length_equals",...C(t),length:e})}function bs(e,t){return new yc({check:"string_format",format:"regex",...C(t),pattern:e})}function zs(e){return new vc({check:"string_format",format:"lowercase",...C(e)})}function Ss(e){return new $c({check:"string_format",format:"uppercase",...C(e)})}function ks(e,t){return new wc({check:"string_format",format:"includes",...C(t),includes:e})}function Ps(e,t){return new xc({check:"string_format",format:"starts_with",...C(t),prefix:e})}function Es(e,t){return new bc({check:"string_format",format:"ends_with",...C(t),suffix:e})}function Dt(e){return new zc({check:"overwrite",tx:e})}function Ts(e){return Dt((t)=>t.normalize(e))}function Rs(){return Dt((e)=>e.trim())}function Is(){return Dt((e)=>e.toLowerCase())}function Cs(){return Dt((e)=>e.toUpperCase())}function ll(e,t,r){return new e({type:"array",element:t,...C(r)})}function dl(e,t,r){let o=C(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function pl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...C(r)})}function pt(e){return!!e._zod}function ze(e,t){if(pt(e))return jr(e,t);return e.safeParse(t)}function rr(e){if(!e)return;let t;if(pt(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function fl(e){if(pt(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o;return}var n_=_("ZodISODateTime",(e,t)=>{Bc.init(e,t),oe.init(e,t)});function Os(e){return Qu(n_,e)}var s_=_("ZodISODate",(e,t)=>{Wc.init(e,t),oe.init(e,t)});function ml(e){return Xu(s_,e)}var i_=_("ZodISOTime",(e,t)=>{Jc.init(e,t),oe.init(e,t)});function hl(e){return el(i_,e)}var a_=_("ZodISODuration",(e,t)=>{Gc.init(e,t),oe.init(e,t)});function gl(e){return tl(a_,e)}var yl=(e,t)=>{bo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>us(e,r)},flatten:{value:(r)=>cs(e,r)},addIssue:{value:(r)=>e.issues.push(r)},addIssues:{value:(r)=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},DP=_("ZodError",yl),qr=_("ZodError",yl,{Parent:Error});var vl=Na(qr),$l=Aa(qr),wl=ls(qr),xl=ds(qr);var ie=_("ZodType",(e,t)=>(G.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),e.clone=(r,o)=>Ue(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.parse=(r,o)=>vl(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>wl(e,r,o),e.parseAsync=async(r,o)=>$l(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>xl(e,r,o),e.spa=e.safeParseAsync,e.refine=(r,o)=>e.check(J_(r,o)),e.superRefine=(r)=>e.check(G_(r)),e.overwrite=(r)=>e.check(Dt(r)),e.optional=()=>se(e),e.nullable=()=>Sl(e),e.nullish=()=>se(Sl(e)),e.nonoptional=(r)=>U_(e,r),e.array=()=>k(e),e.or=(r)=>te([e,r]),e.and=(r)=>No(e,r),e.transform=(r)=>As(e,Nl(r)),e.default=(r)=>M_(e,r),e.prefault=(r)=>L_(e,r),e.catch=(r)=>F_(e,r),e.pipe=(r)=>As(e,r),e.readonly=()=>B_(e),e.describe=(r)=>{let o=e.clone();return Xt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Xt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Xt.get(e);let o=e.clone();return Xt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),kl=_("_ZodString",(e,t)=>{Po.init(e,t),ie.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(bs(...o)),e.includes=(...o)=>e.check(ks(...o)),e.startsWith=(...o)=>e.check(Ps(...o)),e.endsWith=(...o)=>e.check(Es(...o)),e.min=(...o)=>e.check(er(...o)),e.max=(...o)=>e.check(Io(...o)),e.length=(...o)=>e.check(Co(...o)),e.nonempty=(...o)=>e.check(er(1,...o)),e.lowercase=(o)=>e.check(zs(o)),e.uppercase=(o)=>e.check(Ss(o)),e.trim=()=>e.check(Rs()),e.normalize=(...o)=>e.check(Ts(...o)),e.toLowerCase=()=>e.check(Is()),e.toUpperCase=()=>e.check(Cs())}),Pl=_("ZodString",(e,t)=>{Po.init(e,t),kl.init(e,t),e.email=(r)=>e.check(Cu(u_,r)),e.url=(r)=>e.check(xs(El,r)),e.jwt=(r)=>e.check(Yu(z_,r)),e.emoji=(r)=>e.check(Zu(l_,r)),e.guid=(r)=>e.check(ws(bl,r)),e.uuid=(r)=>e.check(Ou(Oo,r)),e.uuidv4=(r)=>e.check(ju(Oo,r)),e.uuidv6=(r)=>e.check(Nu(Oo,r)),e.uuidv7=(r)=>e.check(Au(Oo,r)),e.nanoid=(r)=>e.check(qu(d_,r)),e.guid=(r)=>e.check(ws(bl,r)),e.cuid=(r)=>e.check(Mu(p_,r)),e.cuid2=(r)=>e.check(Du(f_,r)),e.ulid=(r)=>e.check(Lu(m_,r)),e.base64=(r)=>e.check(Wu(w_,r)),e.base64url=(r)=>e.check(Ju(x_,r)),e.xid=(r)=>e.check(Uu(h_,r)),e.ksuid=(r)=>e.check(Vu(g_,r)),e.ipv4=(r)=>e.check(Fu(__,r)),e.ipv6=(r)=>e.check(Hu(y_,r)),e.cidrv4=(r)=>e.check(Ku(v_,r)),e.cidrv6=(r)=>e.check(Bu($_,r)),e.e164=(r)=>e.check(Gu(b_,r)),e.datetime=(r)=>e.check(Os(r)),e.date=(r)=>e.check(ml(r)),e.time=(r)=>e.check(hl(r)),e.duration=(r)=>e.check(gl(r))});function p(e){return Iu(Pl,e)}var oe=_("ZodStringFormat",(e,t)=>{ee.init(e,t),kl.init(e,t)}),u_=_("ZodEmail",(e,t)=>{qc.init(e,t),oe.init(e,t)});var bl=_("ZodGUID",(e,t)=>{Ac.init(e,t),oe.init(e,t)});var Oo=_("ZodUUID",(e,t)=>{Zc.init(e,t),oe.init(e,t)});var El=_("ZodURL",(e,t)=>{Mc.init(e,t),oe.init(e,t)});function Tl(e){return xs(El,e)}var l_=_("ZodEmoji",(e,t)=>{Dc.init(e,t),oe.init(e,t)});var d_=_("ZodNanoID",(e,t)=>{Lc.init(e,t),oe.init(e,t)});var p_=_("ZodCUID",(e,t)=>{Uc.init(e,t),oe.init(e,t)});var f_=_("ZodCUID2",(e,t)=>{Vc.init(e,t),oe.init(e,t)});var m_=_("ZodULID",(e,t)=>{Fc.init(e,t),oe.init(e,t)});var h_=_("ZodXID",(e,t)=>{Hc.init(e,t),oe.init(e,t)});var g_=_("ZodKSUID",(e,t)=>{Kc.init(e,t),oe.init(e,t)});var __=_("ZodIPv4",(e,t)=>{Yc.init(e,t),oe.init(e,t)});var y_=_("ZodIPv6",(e,t)=>{Qc.init(e,t),oe.init(e,t)});var v_=_("ZodCIDRv4",(e,t)=>{Xc.init(e,t),oe.init(e,t)});var $_=_("ZodCIDRv6",(e,t)=>{eu.init(e,t),oe.init(e,t)});var w_=_("ZodBase64",(e,t)=>{ru.init(e,t),oe.init(e,t)});var x_=_("ZodBase64URL",(e,t)=>{ou.init(e,t),oe.init(e,t)});var b_=_("ZodE164",(e,t)=>{nu.init(e,t),oe.init(e,t)});var z_=_("ZodJWT",(e,t)=>{su.init(e,t),oe.init(e,t)});var jo=_("ZodNumber",(e,t)=>{ys.init(e,t),ie.init(e,t),e.gt=(o,n)=>e.check(To(o,n)),e.gte=(o,n)=>e.check(Zr(o,n)),e.min=(o,n)=>e.check(Zr(o,n)),e.lt=(o,n)=>e.check(Eo(o,n)),e.lte=(o,n)=>e.check(Ar(o,n)),e.max=(o,n)=>e.check(Ar(o,n)),e.int=(o)=>e.check(zl(o)),e.safe=(o)=>e.check(zl(o)),e.positive=(o)=>e.check(To(0,o)),e.nonnegative=(o)=>e.check(Zr(0,o)),e.negative=(o)=>e.check(Eo(0,o)),e.nonpositive=(o)=>e.check(Ar(0,o)),e.multipleOf=(o,n)=>e.check(Ro(o,n)),e.step=(o,n)=>e.check(Ro(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function H(e){return rl(jo,e)}var S_=_("ZodNumberFormat",(e,t)=>{iu.init(e,t),jo.init(e,t)});function zl(e){return nl(S_,e)}var Rl=_("ZodBoolean",(e,t)=>{au.init(e,t),ie.init(e,t)});function Y(e){return sl(Rl,e)}var k_=_("ZodNull",(e,t)=>{cu.init(e,t),ie.init(e,t)});function Il(e){return il(k_,e)}var P_=_("ZodAny",(e,t)=>{uu.init(e,t),ie.init(e,t)});function Cl(){return al(P_)}var E_=_("ZodUnknown",(e,t)=>{lu.init(e,t),ie.init(e,t)});function ne(){return cl(E_)}var T_=_("ZodNever",(e,t)=>{du.init(e,t),ie.init(e,t)});function R_(e){return ul(T_,e)}var I_=_("ZodArray",(e,t)=>{pu.init(e,t),ie.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(er(r,o)),e.nonempty=(r)=>e.check(er(1,r)),e.max=(r,o)=>e.check(Io(r,o)),e.length=(r,o)=>e.check(Co(r,o)),e.unwrap=()=>e.element});function k(e,t){return ll(I_,e,t)}var Ol=_("ZodObject",(e,t)=>{fu.init(e,t),ie.init(e,t),Q(e,"shape",()=>t.shape),e.keyof=()=>Pe(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ne()}),e.loose=()=>e.clone({...e._zod.def,catchall:ne()}),e.strict=()=>e.clone({...e._zod.def,catchall:R_()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>Lg(e,r),e.merge=(r)=>Ug(e,r),e.pick=(r)=>Mg(e,r),e.omit=(r)=>Dg(e,r),e.partial=(...r)=>Vg(Al,e,r[0]),e.required=(...r)=>Fg(Zl,e,r[0])});function P(e,t){let r={type:"object",get shape(){return wo(this,"shape",{...e}),this.shape},...C(t)};return new Ol(r)}function ge(e,t){return new Ol({type:"object",get shape(){return wo(this,"shape",{...e}),this.shape},catchall:ne(),...C(t)})}var jl=_("ZodUnion",(e,t)=>{vs.init(e,t),ie.init(e,t),e.options=t.options});function te(e,t){return new jl({type:"union",options:e,...C(t)})}var C_=_("ZodDiscriminatedUnion",(e,t)=>{jl.init(e,t),mu.init(e,t)});function Zs(e,t,r){return new C_({type:"union",options:t,discriminator:e,...C(r)})}var O_=_("ZodIntersection",(e,t)=>{hu.init(e,t),ie.init(e,t)});function No(e,t){return new O_({type:"intersection",left:e,right:t})}var j_=_("ZodRecord",(e,t)=>{gu.init(e,t),ie.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function X(e,t,r){return new j_({type:"record",keyType:e,valueType:t,...C(r)})}var Ns=_("ZodEnum",(e,t)=>{_u.init(e,t),ie.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Ns({...t,checks:[],...C(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new Ns({...t,checks:[],...C(n),entries:s})}});function Pe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Ns({type:"enum",entries:r,...C(t)})}var N_=_("ZodLiteral",(e,t)=>{yu.init(e,t),ie.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function O(e,t){return new N_({type:"literal",values:Array.isArray(e)?e:[e],...C(t)})}var A_=_("ZodTransform",(e,t)=>{vu.init(e,t),ie.init(e,t),e._zod.parse=(r,o)=>{r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(Qt(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),r.issues.push(Qt(i))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((s)=>(r.value=s,r));return r.value=n,r}});function Nl(e){return new A_({type:"transform",transform:e})}var Al=_("ZodOptional",(e,t)=>{$u.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function se(e){return new Al({type:"optional",innerType:e})}var Z_=_("ZodNullable",(e,t)=>{wu.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Sl(e){return new Z_({type:"nullable",innerType:e})}var q_=_("ZodDefault",(e,t)=>{xu.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function M_(e,t){return new q_({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var D_=_("ZodPrefault",(e,t)=>{bu.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function L_(e,t){return new D_({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var Zl=_("ZodNonOptional",(e,t)=>{zu.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType});function U_(e,t){return new Zl({type:"nonoptional",innerType:e,...C(t)})}var V_=_("ZodCatch",(e,t)=>{Su.init(e,t),ie.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function F_(e,t){return new V_({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var H_=_("ZodPipe",(e,t)=>{ku.init(e,t),ie.init(e,t),e.in=t.in,e.out=t.out});function As(e,t){return new H_({type:"pipe",in:e,out:t})}var K_=_("ZodReadonly",(e,t)=>{Pu.init(e,t),ie.init(e,t)});function B_(e){return new K_({type:"readonly",innerType:e})}var ql=_("ZodCustom",(e,t)=>{Eu.init(e,t),ie.init(e,t)});function W_(e){let t=new be({check:"custom"});return t._zod.check=e,t}function Ml(e,t){return dl(ql,e??(()=>!0),t)}function J_(e,t={}){return pl(ql,e,t)}function G_(e){let t=W_((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Qt(o,r.value,t._zod.def));else{let n=o;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Qt(n))}},e(r.value,r)));return t}function qs(e,t){return As(Nl(e),t)}var Dl={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Y_(e){return ol(jo,e)}Ce($s());var ft="2025-11-25";var Zo=[ft,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],mt="io.modelcontextprotocol/related-task",qo="2.0",_e=Ml((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),Ul=te([p(),H().int()]),Vl=p(),UE=ge({ttl:H().optional(),pollInterval:H().optional()}),X_=P({ttl:H().optional()}),ey=P({taskId:p()}),Ms=ge({progressToken:Ul.optional(),[mt]:ey.optional()}),Oe=P({_meta:Ms.optional()}),Mr=Oe.extend({task:X_.optional()}),Fl=(e)=>Mr.safeParse(e).success,ve=P({method:p(),params:Oe.loose().optional()}),je=P({_meta:Ms.optional()}),Ne=P({method:p(),params:je.loose().optional()}),$e=ge({_meta:Ms.optional()}),Mo=te([p(),H().int()]),Hl=P({jsonrpc:O(qo),id:Mo,...ve.shape}).strict(),Dr=(e)=>Hl.safeParse(e).success,Kl=P({jsonrpc:O(qo),...Ne.shape}).strict(),Bl=(e)=>Kl.safeParse(e).success,Ds=P({jsonrpc:O(qo),id:Mo,result:$e}).strict(),Lt=(e)=>Ds.safeParse(e).success;var Z;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Z||(Z={}));var Ls=P({jsonrpc:O(qo),id:Mo.optional(),error:P({code:H().int(),message:p(),data:ne().optional()})}).strict();var Wl=(e)=>Ls.safeParse(e).success;var nr=te([Hl,Kl,Ds,Ls]),VE=te([Ds,Ls]),ot=$e.strict(),ty=je.extend({requestId:Mo.optional(),reason:p().optional()}),Do=Ne.extend({method:O("notifications/cancelled"),params:ty}),ry=P({src:p(),mimeType:p().optional(),sizes:k(p()).optional(),theme:Pe(["light","dark"]).optional()}),Lr=P({icons:k(ry).optional()}),or=P({name:p(),title:p().optional()}),Jl=or.extend({...or.shape,...Lr.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),oy=No(P({applyDefaults:Y().optional()}),X(p(),ne())),ny=qs((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},No(P({form:oy.optional(),url:_e.optional()}),X(p(),ne()).optional())),sy=ge({list:_e.optional(),cancel:_e.optional(),requests:ge({sampling:ge({createMessage:_e.optional()}).optional(),elicitation:ge({create:_e.optional()}).optional()}).optional()}),iy=ge({list:_e.optional(),cancel:_e.optional(),requests:ge({tools:ge({call:_e.optional()}).optional()}).optional()}),ay=P({experimental:X(p(),_e).optional(),sampling:P({context:_e.optional(),tools:_e.optional()}).optional(),elicitation:ny.optional(),roots:P({listChanged:Y().optional()}).optional(),tasks:sy.optional(),extensions:X(p(),_e).optional()}),cy=Oe.extend({protocolVersion:p(),capabilities:ay,clientInfo:Jl}),Us=ve.extend({method:O("initialize"),params:cy});var uy=P({experimental:X(p(),_e).optional(),logging:_e.optional(),completions:_e.optional(),prompts:P({listChanged:Y().optional()}).optional(),resources:P({subscribe:Y().optional(),listChanged:Y().optional()}).optional(),tools:P({listChanged:Y().optional()}).optional(),tasks:iy.optional(),extensions:X(p(),_e).optional()}),Vs=$e.extend({protocolVersion:p(),capabilities:uy,serverInfo:Jl,instructions:p().optional()}),Lo=Ne.extend({method:O("notifications/initialized"),params:je.optional()}),Gl=(e)=>Lo.safeParse(e).success,Uo=ve.extend({method:O("ping"),params:Oe.optional()}),ly=P({progress:H(),total:se(H()),message:se(p())}),dy=P({...je.shape,...ly.shape,progressToken:Ul}),Vo=Ne.extend({method:O("notifications/progress"),params:dy}),py=Oe.extend({cursor:Vl.optional()}),Ur=ve.extend({params:py.optional()}),Vr=$e.extend({nextCursor:Vl.optional()}),fy=Pe(["working","input_required","completed","failed","cancelled"]),Fr=P({taskId:p(),status:fy,ttl:te([H(),Il()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:se(H()),statusMessage:se(p())}),nt=$e.extend({task:Fr}),my=je.merge(Fr),Hr=Ne.extend({method:O("notifications/tasks/status"),params:my}),Fo=ve.extend({method:O("tasks/get"),params:Oe.extend({taskId:p()})}),Ho=$e.merge(Fr),Ko=ve.extend({method:O("tasks/result"),params:Oe.extend({taskId:p()})}),FE=$e.loose(),Bo=Ur.extend({method:O("tasks/list")}),Wo=Vr.extend({tasks:k(Fr)}),Jo=ve.extend({method:O("tasks/cancel"),params:Oe.extend({taskId:p()})}),Yl=$e.merge(Fr),Ql=P({uri:p(),mimeType:se(p()),_meta:X(p(),ne()).optional()}),Xl=Ql.extend({text:p()}),Fs=p().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ed=Ql.extend({blob:Fs}),Kr=Pe(["user","assistant"]),sr=P({audience:k(Kr).optional(),priority:H().min(0).max(1).optional(),lastModified:Os({offset:!0}).optional()}),td=P({...or.shape,...Lr.shape,uri:p(),description:se(p()),mimeType:se(p()),size:se(H()),annotations:sr.optional(),_meta:se(ge({}))}),hy=P({...or.shape,...Lr.shape,uriTemplate:p(),description:se(p()),mimeType:se(p()),annotations:sr.optional(),_meta:se(ge({}))}),gy=Ur.extend({method:O("resources/list")}),Hs=Vr.extend({resources:k(td)}),_y=Ur.extend({method:O("resources/templates/list")}),Ks=Vr.extend({resourceTemplates:k(hy)}),Bs=Oe.extend({uri:p()}),yy=Bs,vy=ve.extend({method:O("resources/read"),params:yy}),Ws=$e.extend({contents:k(te([Xl,ed]))}),Js=Ne.extend({method:O("notifications/resources/list_changed"),params:je.optional()}),$y=Bs,wy=ve.extend({method:O("resources/subscribe"),params:$y}),xy=Bs,by=ve.extend({method:O("resources/unsubscribe"),params:xy}),zy=je.extend({uri:p()}),Sy=Ne.extend({method:O("notifications/resources/updated"),params:zy}),ky=P({name:p(),description:se(p()),required:se(Y())}),Py=P({...or.shape,...Lr.shape,description:se(p()),arguments:se(k(ky)),_meta:se(ge({}))}),Ey=Ur.extend({method:O("prompts/list")}),Gs=Vr.extend({prompts:k(Py)}),Ty=Oe.extend({name:p(),arguments:X(p(),p()).optional()}),Ry=ve.extend({method:O("prompts/get"),params:Ty}),Ys=P({type:O("text"),text:p(),annotations:sr.optional(),_meta:X(p(),ne()).optional()}),Qs=P({type:O("image"),data:Fs,mimeType:p(),annotations:sr.optional(),_meta:X(p(),ne()).optional()}),Xs=P({type:O("audio"),data:Fs,mimeType:p(),annotations:sr.optional(),_meta:X(p(),ne()).optional()}),Iy=P({type:O("tool_use"),name:p(),id:p(),input:X(p(),ne()),_meta:X(p(),ne()).optional()}),Cy=P({type:O("resource"),resource:te([Xl,ed]),annotations:sr.optional(),_meta:X(p(),ne()).optional()}),Oy=td.extend({type:O("resource_link")}),ei=te([Ys,Qs,Xs,Oy,Cy]),jy=P({role:Kr,content:ei}),ti=$e.extend({description:p().optional(),messages:k(jy)}),ri=Ne.extend({method:O("notifications/prompts/list_changed"),params:je.optional()}),Ny=P({title:p().optional(),readOnlyHint:Y().optional(),destructiveHint:Y().optional(),idempotentHint:Y().optional(),openWorldHint:Y().optional()}),Ay=P({taskSupport:Pe(["required","optional","forbidden"]).optional()}),rd=P({...or.shape,...Lr.shape,description:p().optional(),inputSchema:P({type:O("object"),properties:X(p(),_e).optional(),required:k(p()).optional()}).catchall(ne()),outputSchema:P({type:O("object"),properties:X(p(),_e).optional(),required:k(p()).optional()}).catchall(ne()).optional(),annotations:Ny.optional(),execution:Ay.optional(),_meta:X(p(),ne()).optional()}),oi=Ur.extend({method:O("tools/list")}),ni=Vr.extend({tools:k(rd)}),ht=$e.extend({content:k(ei).default([]),structuredContent:X(p(),ne()).optional(),isError:Y().optional()}),HE=ht.or($e.extend({toolResult:ne()})),Zy=Mr.extend({name:p(),arguments:X(p(),ne()).optional()}),Br=ve.extend({method:O("tools/call"),params:Zy}),Wr=Ne.extend({method:O("notifications/tools/list_changed"),params:je.optional()}),od=P({autoRefresh:Y().default(!0),debounceMs:H().int().nonnegative().default(300)}),Jr=Pe(["debug","info","notice","warning","error","critical","alert","emergency"]),qy=Oe.extend({level:Jr}),si=ve.extend({method:O("logging/setLevel"),params:qy}),My=je.extend({level:Jr,logger:p().optional(),data:ne()}),Dy=Ne.extend({method:O("notifications/message"),params:My}),Ly=P({name:p().optional()}),Uy=P({hints:k(Ly).optional(),costPriority:H().min(0).max(1).optional(),speedPriority:H().min(0).max(1).optional(),intelligencePriority:H().min(0).max(1).optional()}),Vy=P({mode:Pe(["auto","required","none"]).optional()}),Fy=P({type:O("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:k(ei).default([]),structuredContent:P({}).loose().optional(),isError:Y().optional(),_meta:X(p(),ne()).optional()}),Hy=Zs("type",[Ys,Qs,Xs]),Ao=Zs("type",[Ys,Qs,Xs,Iy,Fy]),Ky=P({role:Kr,content:te([Ao,k(Ao)]),_meta:X(p(),ne()).optional()}),By=Mr.extend({messages:k(Ky),modelPreferences:Uy.optional(),systemPrompt:p().optional(),includeContext:Pe(["none","thisServer","allServers"]).optional(),temperature:H().optional(),maxTokens:H().int(),stopSequences:k(p()).optional(),metadata:_e.optional(),tools:k(rd).optional(),toolChoice:Vy.optional()}),ii=ve.extend({method:O("sampling/createMessage"),params:By}),Ut=$e.extend({model:p(),stopReason:se(Pe(["endTurn","stopSequence","maxTokens"]).or(p())),role:Kr,content:Hy}),Gr=$e.extend({model:p(),stopReason:se(Pe(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:Kr,content:te([Ao,k(Ao)])}),Wy=P({type:O("boolean"),title:p().optional(),description:p().optional(),default:Y().optional()}),Jy=P({type:O("string"),title:p().optional(),description:p().optional(),minLength:H().optional(),maxLength:H().optional(),format:Pe(["email","uri","date","date-time"]).optional(),default:p().optional()}),Gy=P({type:Pe(["number","integer"]),title:p().optional(),description:p().optional(),minimum:H().optional(),maximum:H().optional(),default:H().optional()}),Yy=P({type:O("string"),title:p().optional(),description:p().optional(),enum:k(p()),default:p().optional()}),Qy=P({type:O("string"),title:p().optional(),description:p().optional(),oneOf:k(P({const:p(),title:p()})),default:p().optional()}),Xy=P({type:O("string"),title:p().optional(),description:p().optional(),enum:k(p()),enumNames:k(p()).optional(),default:p().optional()}),ev=te([Yy,Qy]),tv=P({type:O("array"),title:p().optional(),description:p().optional(),minItems:H().optional(),maxItems:H().optional(),items:P({type:O("string"),enum:k(p())}),default:k(p()).optional()}),rv=P({type:O("array"),title:p().optional(),description:p().optional(),minItems:H().optional(),maxItems:H().optional(),items:P({anyOf:k(P({const:p(),title:p()}))}),default:k(p()).optional()}),ov=te([tv,rv]),nv=te([Xy,ev,ov]),sv=te([nv,Wy,Jy,Gy]),iv=Mr.extend({mode:O("form").optional(),message:p(),requestedSchema:P({type:O("object"),properties:X(p(),sv),required:k(p()).optional()})}),av=Mr.extend({mode:O("url"),message:p(),elicitationId:p(),url:p().url()}),cv=te([iv,av]),ai=ve.extend({method:O("elicitation/create"),params:cv}),uv=je.extend({elicitationId:p()}),lv=Ne.extend({method:O("notifications/elicitation/complete"),params:uv}),gt=$e.extend({action:Pe(["accept","decline","cancel"]),content:qs((e)=>e===null?void 0:e,X(p(),te([p(),H(),Y(),k(p())])).optional())}),dv=P({type:O("ref/resource"),uri:p()});var pv=P({type:O("ref/prompt"),name:p()}),fv=Oe.extend({ref:te([pv,dv]),argument:P({name:p(),value:p()}),context:P({arguments:X(p(),p()).optional()}).optional()}),mv=ve.extend({method:O("completion/complete"),params:fv});var ci=$e.extend({completion:ge({values:k(p()).max(100),total:se(H().int()),hasMore:se(Y())})}),hv=P({uri:p().startsWith("file://"),name:p().optional(),_meta:X(p(),ne()).optional()}),gv=ve.extend({method:O("roots/list"),params:Oe.optional()}),ui=$e.extend({roots:k(hv)}),_v=Ne.extend({method:O("notifications/roots/list_changed"),params:je.optional()}),KE=te([Uo,Us,mv,si,Ry,Ey,gy,_y,vy,wy,by,Br,oi,Fo,Ko,Bo,Jo]),BE=te([Do,Vo,Lo,_v,Hr]),WE=te([ot,Ut,Gr,gt,ui,Ho,Wo,nt]),JE=te([Uo,ii,ai,gv,Fo,Ko,Bo,Jo]),GE=te([Do,Vo,Dy,Sy,Js,Wr,ri,Hr,lv]),YE=te([ot,Vs,ci,ti,Gs,Hs,Ks,Ws,ht,ni,Ho,Wo,nt]);class j extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===Z.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new nd(o.elicitations,t)}return new j(e,t,r)}}class nd extends j{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Z.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function _t(e){return e==="completed"||e==="failed"||e==="cancelled"}var yv=Symbol("Let zodToJsonSchema decide on which parser to use");var RT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function li(e){let r=rr(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=fl(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function di(e,t){let r=ze(e,t);if(!r.success)throw r.error;return r.data}var zv=60000;class Qr{constructor(e){if(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._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Do,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Vo,(t)=>{this._onprogress(t)}),this.setRequestHandler(Uo,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(Fo,async(t,r)=>{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new j(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ko,async(t,r)=>{let o=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,u=a.id,c=this._requestResolvers.get(u);if(c)if(this._requestResolvers.delete(u),i.type==="response")c(a);else{let l=a,d=new j(l.error.code,l.error.message,l.error.data);c(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${u}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(n,r.sessionId);if(!s)throw new j(Z.InvalidParams,`Task not found: ${n}`);if(!_t(s.status))return await this._waitForTaskUpdate(n,r.signal),await o();if(_t(s.status)){let i=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...i,_meta:{...i._meta,[mt]:{taskId:n}}}}return await o()};return await o()}),this.setRequestHandler(Bo,async(t,r)=>{try{let{tasks:o,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:n,_meta:{}}}catch(o){throw new j(Z.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Jo,async(t,r)=>{try{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new j(Z.InvalidParams,`Task not found: ${t.params.taskId}`);if(_t(o.status))throw new j(Z.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new j(Z.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(o){if(o instanceof j)throw o;throw new j(Z.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),j.fromError(Z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{if(o?.(n,s),Lt(n)||Wl(n))this._onresponse(n);else if(Dr(n))this._onrequest(n,s);else if(Bl(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=j.fromError(Z.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,n=e.params?._meta?.[mt]?.taskId;if(r===void 0){let c={jsonrpc:"2.0",id:e.id,error:{code:Z.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:c,timestamp:Date.now()},o?.sessionId).catch((l)=>this._onerror(Error(`Failed to enqueue error response: ${l}`)));else o?.send(c).catch((l)=>this._onerror(Error(`Failed to send an error response: ${l}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=Fl(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:s.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async(c)=>{if(s.signal.aborted)return;let l={relatedRequestId:e.id};if(n)l.relatedTask={taskId:n};await this.notification(c,l)},sendRequest:async(c,l,d)=>{if(s.signal.aborted)throw new j(Z.ConnectionClosed,"Request was cancelled");let f={...d,relatedRequestId:e.id};if(n&&!f.relatedTask)f.relatedTask={taskId:n};let m=f.relatedTask?.taskId??n;if(m&&a)await a.updateTaskStatus(m,"input_required");return await this.request(c,l,f)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:a,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(i)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,u)).then(async(c)=>{if(s.signal.aborted)return;let l={result:c,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)},async(c)=>{if(s.signal.aborted)return;let l={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:Z.InternalError,message:c.message??"Internal error",...c.data!==void 0&&{data:c.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)}).catch((c)=>this._onerror(Error(`Failed to send response: ${c}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===s)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Lt(e))r(e);else{let s=new j(e.error.code,e.error.message,e.error.data);r(s)}return}let o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(Lt(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")n=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(Lt(e))o(e);else{let s=j.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(s){yield{type:"error",error:s instanceof j?s:new j(Z.InternalError,String(s))}}return}let n;try{let s=await this.request(e,nt,r);if(s.task)n=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new j(Z.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:i},_t(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(i.status==="failed")yield{type:"error",error:new j(Z.InternalError,`Task ${n} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new j(Z.InternalError,`Task ${n} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((u)=>setTimeout(u,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof j?s:new j(Z.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((u,c)=>{let l=(w)=>{c(w)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(w){l(w);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)f.params={...f.params,task:i};if(a)f.params={...f.params,_meta:{...f.params?._meta||{},[mt]:a}};let m=(w)=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(w)}},{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((S)=>this._onerror(Error(`Failed to send cancellation: ${S}`)));let E=w instanceof j?w:new j(Z.RequestTimeout,String(w));c(E)};this._responseHandlers.set(d,(w)=>{if(r?.signal?.aborted)return;if(w instanceof Error)return c(w);try{let E=ze(t,w.result);if(!E.success)c(E.error);else u(E.data)}catch(E){c(E)}}),r?.signal?.addEventListener("abort",()=>{m(r?.signal?.reason)});let h=r?.timeout??zv,g=()=>m(j.fromError(Z.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(d,h,r?.maxTotalTimeout,g,r?.resetTimeoutOnProgress??!1);let x=a?.taskId;if(x){let w=(E)=>{let S=this._responseHandlers.get(d);if(S)S(E);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,w),this._enqueueTaskMessage(x,{type:"request",message:f,timestamp:Date.now()}).catch((E)=>{this._cleanupTimeout(d),c(E)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((w)=>{this._cleanupTimeout(d),c(w)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Ho,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Wo,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Yl,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[mt]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[mt]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[mt]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=li(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,n)=>{let s=di(e,o);return Promise.resolve(t(s,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=li(e);this._notificationHandlers.set(r,(o)=>{let n=di(e,o);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let o of r)if(o.type==="request"&&Dr(o.message)){let n=o.message.id,s=this._requestResolvers.get(n);if(s)s(new j(Z.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e);if(o?.pollInterval)r=o.pollInterval}catch{}return new Promise((o,n)=>{if(t.aborted){n(new j(Z.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(s),n(new j(Z.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(o)=>{if(!e)throw Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async(o)=>{let n=await r.getTask(o,t);if(!n)throw new j(Z.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(o,n,s)=>{await r.storeTaskResult(o,n,s,t);let i=await r.getTask(o,t);if(i){let a=Hr.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),_t(i.status))this._cleanupTaskProgressHandler(o)}},getTaskResult:(o)=>r.getTaskResult(o,t),updateTaskStatus:async(o,n,s)=>{let i=await r.getTask(o,t);if(!i)throw new j(Z.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(_t(i.status))throw new j(Z.InvalidParams,`Cannot update task "${o}" from terminal status "${i.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,n,s,t);let a=await r.getTask(o,t);if(a){let u=Hr.parse({method:"notifications/tasks/status",params:a});if(await this.notification(u),_t(a.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>r.listTasks(o,t)}}}function sd(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Go(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];if(sd(i)&&sd(s))r[n]={...i,...s};else r[n]=s}return r}var ug=ka(Ji(),1),lg=ka(cg(),1);function ck(){let e=new ug.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return lg.default(e),e}class po{constructor(e){this._ajv=e??ck()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class na{constructor(e){this._client=e}async*callToolStream(e,t=ht,r){let o=this._client,n={...r,task:r?.task??(o.isToolTask(e.name)?{}:void 0)},s=o.requestStream({method:"tools/call",params:e},t,n),i=o.getToolOutputValidator(e.name);for await(let a of s){if(a.type==="result"&&i){let u=a.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new j(Z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let c=i(u.structuredContent);if(!c.valid){yield{type:"error",error:new j(Z.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)};return}}catch(c){if(c instanceof j){yield{type:"error",error:c};return}yield{type:"error",error:new j(Z.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)};return}}yield a}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function Mn(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Dn(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function Ln(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];if(r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default"))r[n]=s.default;if(r[n]!==void 0)Ln(s,r[n])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")Ln(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")Ln(r,t)}}function uk(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}class sa extends Qr{constructor(e,t){super(t);if(this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new po,t?.listChanged)this._pendingListChangedConfig=t.listChanged}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",Wr,e.tools,async()=>(await this.listTools()).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",ri,e.prompts,async()=>(await this.listPrompts()).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",Js,e.resources,async()=>(await this.listResources()).resources)}get experimental(){if(!this._experimental)this._experimental={tasks:new na(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Go(this._capabilities,e)}setRequestHandler(e,t){let o=rr(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(pt(o)){let i=o;n=i._zod?.def?.value??i.value}else{let i=o;n=i._def?.value??i.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");let s=n;if(s==="elicitation/create"){let i=async(a,u)=>{let c=ze(ai,a);if(!c.success){let w=c.error instanceof Error?c.error.message:String(c.error);throw new j(Z.InvalidParams,`Invalid elicitation request: ${w}`)}let{params:l}=c.data;l.mode=l.mode??"form";let{supportsFormMode:d,supportsUrlMode:f}=uk(this._capabilities.elicitation);if(l.mode==="form"&&!d)throw new j(Z.InvalidParams,"Client does not support form-mode elicitation requests");if(l.mode==="url"&&!f)throw new j(Z.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(t(a,u));if(l.task){let w=ze(nt,m);if(!w.success){let E=w.error instanceof Error?w.error.message:String(w.error);throw new j(Z.InvalidParams,`Invalid task creation result: ${E}`)}return w.data}let h=ze(gt,m);if(!h.success){let w=h.error instanceof Error?h.error.message:String(h.error);throw new j(Z.InvalidParams,`Invalid elicitation result: ${w}`)}let g=h.data,x=l.mode==="form"?l.requestedSchema:void 0;if(l.mode==="form"&&g.action==="accept"&&g.content&&x){if(this._capabilities.elicitation?.form?.applyDefaults)try{Ln(x,g.content)}catch{}}return g};return super.setRequestHandler(e,i)}if(s==="sampling/createMessage"){let i=async(a,u)=>{let c=ze(ii,a);if(!c.success){let g=c.error instanceof Error?c.error.message:String(c.error);throw new j(Z.InvalidParams,`Invalid sampling request: ${g}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let g=ze(nt,d);if(!g.success){let x=g.error instanceof Error?g.error.message:String(g.error);throw new j(Z.InvalidParams,`Invalid task creation result: ${x}`)}return g.data}let m=l.tools||l.toolChoice?Gr:Ut,h=ze(m,d);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new j(Z.InvalidParams,`Invalid sampling result: ${g}`)}return h.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId!==void 0)return;try{let r=await this.request({method:"initialize",params:{protocolVersion:ft,capabilities:this._capabilities,clientInfo:this._clientInfo}},Vs,t);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);if(!Zo.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);if(this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion)e.setProtocolVersion(r.protocolVersion);if(this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){Mn(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Dn(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},ot,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},ci,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},ot,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},ti,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Gs,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},Hs,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Ks,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Ws,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},ot,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},ot,t)}async callTool(e,t=ht,r){if(this.isToolTaskRequired(e.name))throw new j(Z.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},t,r),n=this.getToolOutputValidator(e.name);if(n){if(!o.structuredContent&&!o.isError)throw new j(Z.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=n(o.structuredContent);if(!s.valid)throw new j(Z.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){if(s instanceof j)throw s;throw new j(Z.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let t of e){if(t.outputSchema){let o=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,o)}let r=t.execution?.taskSupport;if(r==="required"||r==="optional")this._cachedKnownTaskTools.add(t.name);if(r==="required")this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},ni,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,o){let n=od.safeParse(r);if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof r.onChanged!=="function")throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=n.data,{onChanged:a}=r,u=async()=>{if(!s){a(null,null);return}try{let l=await o();a(null,l)}catch(l){let d=l instanceof Error?l:Error(String(l));a(d,null)}},c=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);if(l)clearTimeout(l);let d=setTimeout(u,i);this._listChangedDebounceTimers.set(e,d)}else u()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}function Un(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function dg(e=fetch,t){if(!t)return e;return async(r,o)=>{let n={...t,...o,headers:o?.headers?{...Un(t.headers),...Un(o.headers)}:t.headers};return e(r,n)}}var ia;ia=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then((e)=>e.webcrypto);async function lk(e){return(await ia).getRandomValues(new Uint8Array(e))}async function dk(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,o="";while(o.length<e){let n=await lk(e-o.length);for(let s of n)if(s<r)o+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[s%66]}return o}async function pk(e){return await dk(e)}async function fk(e){let t=await(await ia).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function aa(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await pk(e),r=await fk(t);return{code_verifier:t,code_challenge:r}}var xe=Tl().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Dl.custom,message:"URL must be parseable",fatal:!0}),rs}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),fg=ge({resource:p().url(),authorization_servers:k(xe).optional(),jwks_uri:p().url().optional(),scopes_supported:k(p()).optional(),bearer_methods_supported:k(p()).optional(),resource_signing_alg_values_supported:k(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:Y().optional(),authorization_details_types_supported:k(p()).optional(),dpop_signing_alg_values_supported:k(p()).optional(),dpop_bound_access_tokens_required:Y().optional()}),ca=ge({issuer:p(),authorization_endpoint:xe,token_endpoint:xe,registration_endpoint:xe.optional(),scopes_supported:k(p()).optional(),response_types_supported:k(p()),response_modes_supported:k(p()).optional(),grant_types_supported:k(p()).optional(),token_endpoint_auth_methods_supported:k(p()).optional(),token_endpoint_auth_signing_alg_values_supported:k(p()).optional(),service_documentation:xe.optional(),revocation_endpoint:xe.optional(),revocation_endpoint_auth_methods_supported:k(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:k(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:k(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:k(p()).optional(),code_challenge_methods_supported:k(p()).optional(),client_id_metadata_document_supported:Y().optional()}),mk=ge({issuer:p(),authorization_endpoint:xe,token_endpoint:xe,userinfo_endpoint:xe.optional(),jwks_uri:xe,registration_endpoint:xe.optional(),scopes_supported:k(p()).optional(),response_types_supported:k(p()),response_modes_supported:k(p()).optional(),grant_types_supported:k(p()).optional(),acr_values_supported:k(p()).optional(),subject_types_supported:k(p()),id_token_signing_alg_values_supported:k(p()),id_token_encryption_alg_values_supported:k(p()).optional(),id_token_encryption_enc_values_supported:k(p()).optional(),userinfo_signing_alg_values_supported:k(p()).optional(),userinfo_encryption_alg_values_supported:k(p()).optional(),userinfo_encryption_enc_values_supported:k(p()).optional(),request_object_signing_alg_values_supported:k(p()).optional(),request_object_encryption_alg_values_supported:k(p()).optional(),request_object_encryption_enc_values_supported:k(p()).optional(),token_endpoint_auth_methods_supported:k(p()).optional(),token_endpoint_auth_signing_alg_values_supported:k(p()).optional(),display_values_supported:k(p()).optional(),claim_types_supported:k(p()).optional(),claims_supported:k(p()).optional(),service_documentation:p().optional(),claims_locales_supported:k(p()).optional(),ui_locales_supported:k(p()).optional(),claims_parameter_supported:Y().optional(),request_parameter_supported:Y().optional(),request_uri_parameter_supported:Y().optional(),require_request_uri_registration:Y().optional(),op_policy_uri:xe.optional(),op_tos_uri:xe.optional(),client_id_metadata_document_supported:Y().optional()}),mg=P({...mk.shape,...ca.pick({code_challenge_methods_supported:!0}).shape}),hg=P({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:Y_().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),gg=P({error:p(),error_description:p().optional(),error_uri:p().optional()}),pg=xe.optional().or(O("").transform(()=>{return})),hk=P({redirect_uris:k(xe),token_endpoint_auth_method:p().optional(),grant_types:k(p()).optional(),response_types:k(p()).optional(),client_name:p().optional(),client_uri:xe.optional(),logo_uri:pg,scope:p().optional(),contacts:k(p()).optional(),tos_uri:pg,policy_uri:p().optional(),jwks_uri:xe.optional(),jwks:Cl().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),gk=P({client_id:p(),client_secret:p().optional(),client_id_issued_at:H().optional(),client_secret_expires_at:H().optional()}).strip(),_g=hk.merge(gk),EO=P({error:p(),error_description:p().optional()}).strip(),TO=P({token:p(),token_type_hint:p().optional()}).strip();function yg(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function vg({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),o=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin)return!1;if(r.pathname.length<o.pathname.length)return!1;let n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(s)}class he extends Error{constructor(e,t){super(e);this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};if(this.errorUri)e.error_uri=this.errorUri;return e}get errorCode(){return this.constructor.errorCode}}class Vn extends he{}Vn.errorCode="invalid_request";class Pr extends he{}Pr.errorCode="invalid_client";class Er extends he{}Er.errorCode="invalid_grant";class Tr extends he{}Tr.errorCode="unauthorized_client";class Fn extends he{}Fn.errorCode="unsupported_grant_type";class Hn extends he{}Hn.errorCode="invalid_scope";class Kn extends he{}Kn.errorCode="access_denied";class Zt extends he{}Zt.errorCode="server_error";class Bn extends he{}Bn.errorCode="temporarily_unavailable";class Wn extends he{}Wn.errorCode="unsupported_response_type";class Jn extends he{}Jn.errorCode="unsupported_token_type";class Gn extends he{}Gn.errorCode="invalid_token";class Yn extends he{}Yn.errorCode="method_not_allowed";class Qn extends he{}Qn.errorCode="too_many_requests";class Rr extends he{}Rr.errorCode="invalid_client_metadata";class Xn extends he{}Xn.errorCode="insufficient_scope";class es extends he{}es.errorCode="invalid_target";var $g={[Vn.errorCode]:Vn,[Pr.errorCode]:Pr,[Er.errorCode]:Er,[Tr.errorCode]:Tr,[Fn.errorCode]:Fn,[Hn.errorCode]:Hn,[Kn.errorCode]:Kn,[Zt.errorCode]:Zt,[Bn.errorCode]:Bn,[Wn.errorCode]:Wn,[Jn.errorCode]:Jn,[Gn.errorCode]:Gn,[Yn.errorCode]:Yn,[Qn.errorCode]:Qn,[Rr.errorCode]:Rr,[Xn.errorCode]:Xn,[es.errorCode]:es};class qt extends Error{constructor(e){super(e??"Unauthorized")}}function _k(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var ua="code",la="S256";function yk(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&_k(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function vk(e,t,r,o){let{client_id:n,client_secret:s}=t;switch(e){case"client_secret_basic":$k(n,s,r);return;case"client_secret_post":wk(n,s,o);return;case"none":xk(n,o);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function $k(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function wk(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function xk(e,t){t.set("client_id",e)}async function xg(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=gg.parse(JSON.parse(r)),{error:n,error_description:s,error_uri:i}=o;return new($g[n]||Zt)(s||"",i)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new Zt(n)}}async function fo(e,t){try{return await da(e,t)}catch(r){if(r instanceof Pr||r instanceof Tr)return await e.invalidateCredentials?.("all"),await da(e,t);else if(r instanceof Er)return await e.invalidateCredentials?.("tokens"),await da(e,t);throw r}}async function da(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:s}){let i=await e.discoveryState?.(),a,u,c,l=n;if(!l&&i?.resourceMetadataUrl)l=new URL(i.resourceMetadataUrl);if(i?.authorizationServerUrl){if(u=i.authorizationServerUrl,a=i.resourceMetadata,c=i.authorizationServerMetadata??await zg(u,{fetchFn:s}),!a)try{a=await bg(t,{resourceMetadataUrl:l},s)}catch{}if(c!==i.authorizationServerMetadata||a!==i.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}else{let S=await Tk(t,{resourceMetadataUrl:l,fetchFn:s});u=S.authorizationServerUrl,c=S.authorizationServerMetadata,a=S.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=await zk(t,e,a),f=o||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,m=await Promise.resolve(e.clientInformation());if(!m){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let S=c?.client_id_metadata_document_supported===!0,N=e.clientMetadataUrl;if(N&&!bk(N))throw new Rr(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${N}`);if(S&&N)m={client_id:N},await e.saveClientInformation?.(m);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let b=await jk(u,{metadata:c,clientMetadata:e.clientMetadata,scope:f,fetchFn:s});await e.saveClientInformation(b),m=b}}let h=!e.redirectUrl;if(r!==void 0||h){let S=await Ok(e,u,{metadata:c,resource:d,authorizationCode:r,fetchFn:s});return await e.saveTokens(S),"AUTHORIZED"}let g=await e.tokens();if(g?.refresh_token)try{let S=await Ck(u,{metadata:c,clientInformation:m,refreshToken:g.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(S),"AUTHORIZED"}catch(S){if(!(S instanceof he)||S instanceof Zt);else throw S}let x=e.state?await e.state():void 0,{authorizationUrl:w,codeVerifier:E}=await Rk(u,{metadata:c,clientInformation:m,state:x,redirectUrl:e.redirectUrl,scope:f,resource:d});return await e.saveCodeVerifier(E),await e.redirectToAuthorization(w),"REDIRECT"}function bk(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function zk(e,t,r){let o=yg(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(!r)return;if(!vg({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}function fa(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=pa(e,"resource_metadata")||void 0,s;if(n)try{s=new URL(n)}catch{}let i=pa(e,"scope")||void 0,a=pa(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function pa(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let o=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),n=r.match(o);if(n)return n[1]||n[2];return null}async function bg(e,t,r=fetch){let o=await Pk(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw await o?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw await o.body?.cancel(),Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return fg.parse(await o.json())}async function ma(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)if(t)return ma(e,void 0,r);else return;throw o}}function Sk(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function wg(e,t,r=fetch){return await ma(e,{"MCP-Protocol-Version":t},r)}function kk(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function Pk(e,t,r,o){let n=new URL(e),s=o?.protocolVersion??ft,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let u=Sk(t,n.pathname);i=new URL(u,o?.metadataServerUrl??n),i.search=n.search}let a=await wg(i,s,r);if(!o?.metadataUrl&&kk(a,n.pathname)){let u=new URL(`/.well-known/${t}`,n);a=await wg(u,s,r)}return a}function Ek(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;if(n.endsWith("/"))n=n.slice(0,-1);return o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function zg(e,{fetchFn:t=fetch,protocolVersion:r=ft}={}){let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=Ek(e);for(let{url:s,type:i}of n){let a=await ma(s,o,t);if(!a)continue;if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(i==="oauth")return ca.parse(await a.json());else return mg.parse(await a.json())}return}async function Tk(e,t){let r,o;try{if(r=await bg(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)o=r.authorization_servers[0]}catch{}if(!o)o=String(new URL("/",e));let n=await zg(o,{fetchFn:t?.fetchFn});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}async function Rk(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(ua))throw Error(`Incompatible auth server: does not support response type ${ua}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(la))throw Error(`Incompatible auth server: does not support code challenge method ${la}`)}else a=new URL("/authorize",e);let u=await aa(),{code_verifier:c,code_challenge:l}=u;if(a.searchParams.set("response_type",ua),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",la),a.searchParams.set("redirect_uri",String(o)),s)a.searchParams.set("state",s);if(n)a.searchParams.set("scope",n);if(n?.includes("offline_access"))a.searchParams.append("prompt","consent");if(i)a.searchParams.set("resource",i.href);return{authorizationUrl:a,codeVerifier:c}}function Ik(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Sg(e,{metadata:t,tokenRequestParams:r,clientInformation:o,addClientAuthentication:n,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s)r.set("resource",s.href);if(n)await n(u,r,a,t);else if(o){let l=t?.token_endpoint_auth_methods_supported??[],d=yk(o,l);vk(d,o,u,r)}let c=await(i??fetch)(a,{method:"POST",headers:u,body:r});if(!c.ok)throw await xg(c);return hg.parse(await c.json())}async function Ck(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:o}),u=await Sg(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:n,fetchFn:i});return{refresh_token:o,...u}}async function Ok(e,t,{metadata:r,resource:o,authorizationCode:n,fetchFn:s}={}){let i=e.clientMetadata.scope,a;if(e.prepareTokenRequest)a=await e.prepareTokenRequest(i);if(!a){if(!n)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let c=await e.codeVerifier();a=Ik(n,c,e.redirectUrl)}let u=await e.clientInformation();return Sg(t,{metadata:r,tokenRequestParams:a,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:s})}async function jk(e,{metadata:t,clientMetadata:r,scope:o,fetchFn:n}){let s;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await(n??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...o!==void 0?{scope:o}:{}})});if(!i.ok)throw await xg(i);return _g.parse(await i.json())}class ts extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var kg=10,Nk=13,Wt=32;function ha(e){}function Tg(e){if(typeof e=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=ha,onError:r=ha,onRetry:o=ha,onComment:n,maxBufferSize:s}=e,i=[],a=0,u=!0,c,l="",d=0,f,m=!1;function h(v){if(m)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(u&&(u=!1,v.charCodeAt(0)===239&&v.charCodeAt(1)===187&&v.charCodeAt(2)===191&&(v=v.slice(3))),i.length===0){let re=x(v);re!==""&&(i.push(re),a=re.length),g();return}if(v.indexOf(`
|
|
35
|
-
|
|
36
|
-
`,b);for(;M!==-1;){if(b===M){d>0&&t({id:c,event:f,data:l}),c=void 0,l="",d=0,f=void 0,b=M+1,M=v.indexOf(`
|
|
37
|
-
|
|
38
|
-
`,
|
|
39
|
-
|
|
40
|
-
`,
|
|
41
|
-
`,
|
|
42
|
-
|
|
43
|
-
${b}`,d++;break;case"id":c=b.includes("\x00")?void 0:b;break;case"retry":/^\d+$/.test(b)?o(parseInt(b,10)):r(new ts(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:M}));break;default:r(new ts(`Unknown field "${v.length>20?`${v.slice(0,20)}…`:v}"`,{type:"unknown-field",field:v,value:b,line:M}));break}}function S(){d>0&&t({id:c,event:f,data:l}),c=void 0,l="",d=0,f=void 0}function N(v={}){if(v.consume&&i.length>0){let b=i.join("");w(b,0,b.length)}u=!0,c=void 0,l="",d=0,f=void 0,i.length=0,a=0,m=!1}return{feed:h,reset:N}}function Pg(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Eg(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class ga extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:o}={}){let n;super({start(s){n=Tg({onEvent:(i)=>{s.enqueue(i)},onError(i){typeof e=="function"&&e(i),(e==="terminate"||i.type==="max-buffer-size-exceeded")&&s.error(i)},onRetry:t,onComment:r,maxBufferSize:o})},transform(s){n.feed(s)}})}}var Ak={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};class Jt extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`);this.code=e}}class _a{constructor(e,t){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=dg(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??Ak}async _authThenStart(){if(!this._authProvider)throw new qt("No auth provider");let e;try{e=await fo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(t){throw this.onerror?.(t),t}if(e!=="AUTHORIZED")throw new qt;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let r=await this._authProvider.tokens();if(r)e.Authorization=`Bearer ${r.access_token}`}if(this._sessionId)e["mcp-session-id"]=this._sessionId;if(this._protocolVersion)e["mcp-protocol-version"]=this._protocolVersion;let t=Un(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let r=await this._commonHeaders();if(r.set("Accept","text/event-stream"),t)r.set("last-event-id",t);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:r,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new Jt(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(r){throw this.onerror?.(r),r}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),o)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let o=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch((n)=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${n instanceof Error?n.message:String(n)}`)),this._scheduleReconnection(e,t+1)})},o)}_handleSseStream(e,t,r){if(!e)return;let{onresumptiontoken:o,replayMessageId:n}=t,s,i=!1,a=!1;(async()=>{try{let c=e.pipeThrough(new TextDecoderStream).pipeThrough(new ga({onRetry:(f)=>{this._serverRetryMs=f}})).getReader();while(!0){let{value:f,done:m}=await c.read();if(m)break;if(f.id)s=f.id,i=!0,o?.(f.id);if(!f.data)continue;if(!f.event||f.event==="message")try{let h=nr.parse(JSON.parse(f.data));if(Lt(h)){if(a=!0,n!==void 0)h.id=n}this.onmessage?.(h)}catch(h){this.onerror?.(h)}}if((r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)this._scheduleReconnection({resumptionToken:s,onresumptiontoken:o,replayMessageId:n},0)}catch(c){if(this.onerror?.(Error(`SSE stream disconnected: ${c}`)),(r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:o,replayMessageId:n},0)}catch(f){this.onerror?.(Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new qt("No auth provider");if(await fo(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qt("Failed to authorize")}async close(){if(this._reconnectionTimeout)clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0;this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:r,onresumptiontoken:o}=t||{};if(r){this._startOrAuthSse({resumptionToken:r,replayMessageId:Dr(e)?e.id:void 0}).catch((d)=>this.onerror?.(d));return}let n=await this._commonHeaders();n.set("content-type","application/json"),n.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:n,body:JSON.stringify(e),signal:this._abortController?.signal},i=await(this._fetch??fetch)(this._url,s),a=i.headers.get("mcp-session-id");if(a)this._sessionId=a;if(!i.ok){let d=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Jt(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:m}=fa(i);if(this._resourceMetadataUrl=f,this._scope=m,await fo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new qt;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:m,error:h}=fa(i);if(h==="insufficient_scope"){let g=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===g)throw new Jt(403,"Server returned 403 after trying upscoping");if(m)this._scope=m;if(f)this._resourceMetadataUrl=f;if(this._lastUpscopingHeader=g??void 0,await fo(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new qt;return this.send(e)}}throw new Jt(i.status,`Error POSTing to endpoint: ${d}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){if(await i.body?.cancel(),Gl(e))this._startOrAuthSse({resumptionToken:void 0}).catch((d)=>this.onerror?.(d));return}let c=(Array.isArray(e)?e:[e]).filter((d)=>("method"in d)&&("id"in d)&&d.id!==void 0).length>0,l=i.headers.get("content-type");if(c)if(l?.includes("text/event-stream"))this._handleSseStream(i.body,{onresumptiontoken:o},!1);else if(l?.includes("application/json")){let d=await i.json(),f=Array.isArray(d)?d.map((m)=>nr.parse(m)):[nr.parse(d)];for(let m of f)this.onmessage?.(m)}else throw await i.body?.cancel(),new Jt(-1,`Unexpected content type: ${l}`);else await i.body?.cancel()}catch(r){throw this.onerror?.(r),r}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await(this._fetch??fetch)(this._url,t);if(await r.body?.cancel(),!r.ok&&r.status!==405)throw new Jt(r.status,`Failed to terminate session: ${r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}class ya{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some((c)=>c.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],u=a.some((c)=>c.type==="tool_use");if(s){if(n.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!u)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let c=new Set(a.filter((d)=>d.type==="tool_use").map((d)=>d.id)),l=new Set(n.filter((d)=>d.type==="tool_result").map((d)=>d.toolUseId));if(c.size!==l.size||![...c].every((d)=>l.has(d)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Ut,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},gt,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class va extends Qr{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Jr.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let n=this._loggingLevels.get(o);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new po,this.setRequestHandler(Us,(r)=>this._oninitialize(r)),this.setNotificationHandler(Lo,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(si,async(r,o)=>{let n=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Jr.safeParse(s);if(i.success)this._loggingLevels.set(n,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new ya(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Go(this._capabilities,e)}setRequestHandler(e,t){let o=rr(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(pt(o)){let i=o;n=i._zod?.def?.value??i.value}else{let i=o;n=i._def?.value??i.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let i=async(a,u)=>{let c=ze(Br,a);if(!c.success){let m=c.error instanceof Error?c.error.message:String(c.error);throw new j(Z.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let m=ze(nt,d);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new j(Z.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=ze(ht,d);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new j(Z.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw 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 Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Dn(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Mn(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Zo.includes(t)?t:ft,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"},ot)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],n=o.some((u)=>u.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((u)=>u.type==="tool_use");if(n){if(o.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let u=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),c=new Set(o.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(u.size!==c.size||![...u].every((l)=>c.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},Gr,t);return this.request({method:"sampling/createMessage",params:e},Ut,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},gt,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:o},gt,t);if(n.action==="accept"&&n.content&&o.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(o.requestedSchema)(n.content);if(!i.valid)throw new j(Z.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof j)throw s;throw new j(Z.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},ui,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import Ig from"node:process";class $a{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
44
|
-
|
|
45
|
-
`}class wa{constructor(e=Ig.stdin,t=Ig.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new $a,this._started=!1,this._ondata=(r)=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=(r)=>{this.onerror?.(r)}}async start(){if(this._started)throw 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(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise((t)=>{let r=Rg(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var xa={name:"@stophy/mcp",version:"1.2.0",description:"Web scraping API for AI agents. One API to search the web, read what people say, and look up products, places, jobs and homes. Pay only for answers.",type:"module",bin:{"stophy-mcp":"dist/index.js"},files:["dist"],scripts:{build:"bun build ./src/index.ts --outfile ./dist/index.js --target node --minify && chmod +x ./dist/index.js",prepare:"bun run build",start:"node ./dist/index.js",dev:"bun run ./src/index.ts","check-types":"tsc --noEmit",changeset:"changeset",version:"changeset version"},publishConfig:{access:"public"},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0"},devDependencies:{"@changesets/cli":"^2.31.0","@types/node":"^22.0.0",typescript:"^5.8.3"},engines:{node:">=18"},keywords:["stophy","mcp","mcp-server","ai-agent","ai-agents","llm","web-data","web-search","google-search","linkedin","youtube","reddit","google-maps","transcripts","ads"],mcpName:"io.github.stophydotdev/mcp",homepage:"https://stophy.dev",license:"MIT",repository:{type:"git",url:"git+https://github.com/stophydotdev/mcp.git"},bugs:{url:"https://github.com/stophydotdev/mcp/issues"}};var Mk="https://api.stophy.dev/mcp",Dk=()=>{let e=process.env.STOPHY_MCP_URL??Mk;try{return new URL(e)}catch{throw Error(`STOPHY_MCP_URL is not a valid URL: ${e}`)}},Lk=()=>{let e=process.env.STOPHY_API_KEY?.trim();return e?{Authorization:`Bearer ${e}`}:{}},Uk=async(e)=>{let t=new sa({name:"stophy-mcp",version:xa.version}),r=new _a(e,{requestInit:{headers:Lk()}});return await t.connect(r),t},Vk=async()=>{let e=Dk(),t;try{t=await Uk(e)}catch(o){let n=o instanceof Error?o.message:String(o),s=/401|unauthorized/iu.test(n)?" Check STOPHY_API_KEY, or unset it to use the free endpoints only.":"";throw Error(`Could not connect to Stophy at ${e.origin}: ${n}.${s}`)}let r=new va({name:"stophy",version:xa.version},{capabilities:{tools:{listChanged:!0}},instructions:t.getInstructions()});r.setRequestHandler(oi,(o)=>t.listTools(o.params)),r.setRequestHandler(Br,(o)=>t.callTool(o.params)),t.setNotificationHandler(Wr,()=>r.sendToolListChanged()),r.onclose=()=>{t.close()},await r.connect(new wa)};Vk().catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
63
|
+
`)}return _.write("payload.value = newResult;"),_.write("return payload;"),_.compile()},i,a=yr,u=!Re.jitless,l=u&&su.value,d=t.catchall,m;e._zod.parse=(f,p)=>{m??(m=n.value);let g=f.value;if(!a(g))return f.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),f;if(u&&l&&p?.async===!1&&p.jitless!==!0){if(!i)i=s(t.shape);if(f=i(f,p),!d)return f;return ld([],g,f,p,m,e,p?.abortEarly===!0)}return r(f,p)}});function bl(e,t,r,n){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter((s)=>!Qe(s));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>et(i,n,Oe())))}),t}var xi=v("$ZodUnion",(e,t)=>{ee.init(e,t),J(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),J(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),J(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),J(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((s)=>s._zod.pattern);return new RegExp(`^(${o.map((s)=>Vn(s.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1,i=[];for(let a of t.options){let u=a._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)i.push(u),s=!0;else{if(u.issues.length===0)return u;i.push(u)}}if(!s)return bl(i,n,e,o);return Promise.all(i).then((a)=>bl(a,n,e,o))}});function jb(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var fd=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,xi.init(e,t);let r=e._zod.parse;J(e,"propValues",(o)=>{let s={},i=0;for(let a of o.def.options){let u=a._zod.propValues;if(!u||Object.keys(u).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(u[o.def.discriminator]?.has(void 0))i++;for(let[c,l]of Object.entries(u)){if(!Object.prototype.hasOwnProperty.call(s,c))Le(s,c,new Set);for(let d of l)s[c].add(d)}}if(!o.def.unionFallback&&i>1)s[o.def.discriminator]?.delete(void 0);return s}),t.options.forEach((o,s)=>{let i=nn(o._zod.def);if(i&&!Object.prototype.hasOwnProperty.call(i,t.discriminator))throw Error(`Invalid discriminated union option at index "${s}"`)});let n=rn(()=>jb(t));e._zod.parse=(o,s)=>{let i=o.value;if(!yr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=i?.[t.discriminator],u=n.value.get(a);if(u&&(a!==void 0||s.direction!=="backward"))return u._zod.run(o,s);if(t.unionFallback||s.direction==="backward")return r(o,s);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((c)=>n.value.get(c)!==null),input:i,path:[t.discriminator],inst:e}),o}}),pd=v("$ZodIntersection",(e,t)=>{ee.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,s=t.left._zod.run({value:o,issues:[]},n),i=t.right._zod.run({value:o,issues:[]},n);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([u,c])=>wl(r,u,c));return wl(r,s,i)}});function yi(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(or(e)&&or(t)){let r=Object.keys(t),n=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let s of n){if(s==="__proto__")continue;let i=yi(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],s=t[n],i=yi(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 wl(e,t,r){let n=new Map,o,s=new Map,i=(c,l)=>{let d;if(c.code==="unrecognized_keys"&&!c.path?.length)o??(o=c),d=c.keys;else if(c.code==="invalid_key"&&c.origin==="record"&&c.path?.length===1){let m=String(c.path[0]);if(!s.has(m))s.set(m,c);d=[m]}else return!1;for(let m of d){if(!n.has(m))n.set(m,{});n.get(m)[l]=!0}return!0};for(let c of t.issues)if(!i(c,"l"))e.issues.push(c);for(let c of r.issues)if(!i(c,"r"))e.issues.push(c);let a=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(a.length){let c=o?a.filter((l)=>o.keys.includes(l)):[];if(c.length)e.issues.push({...o,keys:c});for(let l of a)if(!c.includes(l)&&s.has(l))e.issues.push(s.get(l))}let u=yi(t.value,r.value);if(!u.valid){if(Qe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var md=v("$ZodRecord",(e,t)=>{ee.init(e,t);let r=Re.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let s=n.value;if(!or(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;let i=[],a=t.keyType._zod.values;if(a&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let u=new Set;for(let l of a)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(u.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let d=t.keyType._zod.run({value:l,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((p)=>et(p,o,Oe())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:s[l],issues:[]},o);if(f instanceof Promise)i.push(f.then((p)=>{if(p.issues.length)n.issues.push(...Pt(l,p.issues));n.value[m]=p.value}));else{if(f.issues.length)n.issues.push(...Pt(l,f.issues));n.value[m]=f.value}}let c;for(let l in s)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=s[l]}else c=c??[],c.push(l);if(c&&c.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:c,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let c of Reflect.ownKeys(s)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(s,c))continue;let l=t.keyType._zod.run({value:c,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&an.test(c)&&l.issues.length){let p=t.keyType._zod.run({value:Number(c),issues:[]},o);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length===0)l=p}if(l.issues.length){if(t.mode==="loose")n.value[c]=s[c];else if(a)u=u??[],u.push(c);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((p)=>et(p,o,Oe())),input:c,path:[c],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let f=t.valueType._zod.run({value:s[c],issues:[]},o);if(f instanceof Promise)i.push(f.then((p)=>{if(p.issues.length)n.issues.push(...Pt(c,p.issues));n.value[m]=p.value}));else{if(f.issues.length)n.issues.push(...Pt(c,f.issues));n.value[m]=f.value}}if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:u,continue:!0})}if(i.length)return Promise.all(i).then(()=>n);return n}});var hd=v("$ZodEnum",(e,t)=>{ee.init(e,t);let r=en(t.entries),n=new Set(r);e._zod.values=n,J(e,"pattern",(o)=>{let s=en(o.def.entries).filter((i)=>iu.has(typeof i));return new RegExp(s.length?`^(${s.map((i)=>kt(i.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,s)=>{let i=o.value;if(n.has(i))return o;return o.issues.push({code:"invalid_value",values:r,input:i,inst:e}),o}}),gd=v("$ZodLiteral",(e,t)=>{ee.init(e,t);let r=new Set(t.values);e._zod.values=r,J(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((s)=>typeof s==="string"?kt(s):s?kt(s.toString()):String(s)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let s=n.value;if(r.has(s))return n;return n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}});var _d=v("$ZodTransform",(e,t)=>{ee.init(e,t),e._zod.optin="optional",Re.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new on(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((i)=>(r.value=i,r));if(o instanceof Promise)throw new tt;return r.value=o,r}});function xl(e,t){return e.value=t.issues.length?void 0:t.value,e}var $i=v("$ZodOptional",(e,t)=>{ee.init(e,t),J(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",J(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),J(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Vn(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>xl(r,s));return xl(r,o)}return t.innerType._zod.run(r,n)}}),yd=v("$ZodExactOptional",(e,t)=>{$i.init(e,t),J(e,"values",(r)=>r.def.innerType._zod.values),J(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),vd=v("$ZodNullable",(e,t)=>{ee.init(e,t),J(e,"optin",(r)=>r.def.innerType._zod.optin),J(e,"optout",(r)=>r.def.innerType._zod.optout),J(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Vn(n.source)}|null)$`):void 0}),J(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),bd=v("$ZodDefault",(e,t)=>{ee.init(e,t),e._zod.optin="defaulted",J(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>$l(s,t));return $l(o,t)}});function $l(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var wd=v("$ZodPrefault",(e,t)=>{ee.init(e,t),e._zod.optin="defaulted",J(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),xd=v("$ZodNonOptional",(e,t)=>{ee.init(e,t),J(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>zl(s,e));return zl(o,e)}});function zl(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function Sl(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>et(o,n,Oe()))},input:e.value}),e}var $d=v("$ZodCatch",(e,t)=>{ee.init(e,t),J(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),J(e,"optout",(r)=>r.def.innerType._zod.optout),J(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((s)=>Sl(r,s,t,n));return Sl(r,o,t,n)}});var zi=v("$ZodPipe",(e,t)=>{ee.init(e,t),J(e,"values",(r)=>r.def.in._zod.values),J(e,"optin",(r)=>r.def.in._zod.optin),J(e,"optout",(r)=>r.def.out._zod.optout),J(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let s=t.out._zod.run(r,n);if(s instanceof Promise)return s.then((i)=>oo(i,t.in,n));return oo(s,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((s)=>oo(s,t.out,n));return oo(o,t.out,n)}});function oo(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var zd=v("$ZodPreprocess",(e,t)=>{zi.init(e,t)}),Sd=v("$ZodReadonly",(e,t)=>{ee.init(e,t),J(e,"propValues",(r)=>r.def.innerType._zod.propValues),J(e,"values",(r)=>r.def.innerType._zod.values),J(e,"optin",(r)=>r.def.innerType?._zod?.optin),J(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(kl);return kl(o)}});function kl(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var kd=v("$ZodCustom",(e,t)=>{we.init(e,t),ee.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((s)=>Pl(s,r,n,e));Pl(o,r,n,e);return}});function Pl(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(sr(o))}}class Ed extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var ki="~memo",Pd=[];function Td(e){return e!==null&&typeof e==="object"}function Si(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var Rd=new WeakMap,un=0,fo=1,ln=2;function po(e,t,r){let n=Rd.get(e);if(n!==void 0)return n?ln:un;if(t.has(e))return ln;t.add(e);let o=un,s=(l)=>{if(o!==ln&&l?._zod){let d=po(l,t,r);if(d>o)o=d}},i=(l,d)=>{let m=un;for(let f of Reflect.ownKeys(l)){let p=Object.getOwnPropertyDescriptor(l,f);if(d&&!p.enumerable)continue;let g=p.get?fo:p.value?._zod?po(p.value,t,r):un;if(g>m)m=g}return m},a=(l)=>{if(l>o)o=l},u=e._zod.def,c=u.type;switch(c){case"object":{let l=nn(u);a(l?i(l,!0):fo),s(u.catchall);break}case"array":s(u.element);break;case"tuple":for(let l of u.items)s(l);s(u.rest);break;case"record":case"map":s(u.keyType),s(u.valueType);break;case"set":s(u.valueType);break;case"union":for(let l of u.options)s(l);break;case"intersection":s(u.left),s(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":s(u.innerType);break;case"pipe":s(u.in),s(u.out);break;case"function":s(u.input),s(u.output);break;case"lazy":{let l=u._cachedInner??(r?e._zod.innerType:void 0);a(l?po(l,t,!1):fo);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in u){let d=Object.getOwnPropertyDescriptor(u,l);if(!d||d.get)continue;let m=d.value;if(!m||typeof m!=="object")continue;if(m._zod)s(m);else if(Array.isArray(m))for(let f of m)s(f)}}return t.delete(e),Zb(e,o)}function Zb(e,t){if(t!==fo)Rd.set(e,t===ln);return t}function Db(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var uo,lo=[],Mb={alloc(e,t,r){let n=uo;if(!n)return r;uo=void 0;let o={value:r,issues:null};return n.set(t.value,o),lo.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,s)=>{if(s.direction!=="backward"&&qb(s,o.value))throw new Ed;return r(o,s)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,s;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,a=(u,c)=>{if(r===void 0){let y=po(e,new Set,!1);if(y===un){if(e._zod.parse=i,e._zod.run===a)e._zod.run=i;return i(u,c)}if(y===ln||n)r=!0;else n=!0}let l=u.value;if(!Td(l))return i(u,c);let d=c[ki];if(!d)d={buckets:new WeakMap,backEdges:void 0},c[ki]=d;let m;if(o===c)m=s;else m=Db(d,e),o=c,s=m;let f=m.get(l);if(f){if(u.value=f.value,f.issues){if(f.issues.length)u.issues.push(...Si(f.issues))}else u.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value);return u}uo=m;let p=lo.length,g=i(u,c);uo=void 0;let _=lo.length>p?lo.pop():void 0;if(g instanceof Promise)return g.then((y)=>{if(_)_.issues=y.issues.length?Si(y.issues):Pd;return y});if(_)_.issues=g.issues.length?Si(g.issues):Pd;return g};if(e._zod.parse=a,e._zod.run===i)e._zod.run=a})}};function Pi(){return Mb}function qb(e,t){let r=e[ki]?.backEdges;return r!==void 0&&Td(t)&&r.has(t)}var Lb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(s){return e[s]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(s,i){if(s==="number"&&typeof i==="number"&&!Number.isFinite(i))return String(i);return n[s]??s}return(s)=>{switch(s.code){case"invalid_type":{let i=o(s.expected),a=du(s.input),u=o(a,s.input);return`Invalid input: expected ${i}, received ${u}`}case"invalid_value":if(s.values.length===1)return`Invalid input: expected ${ti(s.values[0])}`;return`Invalid option: expected one of ${Ys(s.values,"|")}`;case"too_big":{let i=s.exact?"exactly ":s.inclusive?"<=":"<",a=t(s.origin);if(a)return`Too big: expected ${s.origin??"value"} to have ${i}${s.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${s.origin??"value"} to be ${i}${s.maximum.toString()}`}case"too_small":{let i=s.exact?"exactly ":s.inclusive?">=":">",a=t(s.origin);if(a)return`Too small: expected ${s.origin} to have ${i}${s.minimum.toString()} ${a.unit}`;return`Too small: expected ${s.origin} to be ${i}${s.minimum.toString()}`}case"invalid_format":{let i=s;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??s.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${s.divisor}`;case"unrecognized_keys":return`Unrecognized key${s.keys.length>1?"s":""}: ${Ys(s.keys,", ")}`;case"invalid_key":return`Invalid key in ${s.origin}`;case"invalid_union":if(s.options&&Array.isArray(s.options)&&s.options.length>0)return`Invalid discriminator value. Expected ${s.options.map((a)=>`'${a}'`).join(" | ")}`;if(s.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${s.origin}`;default:return"Invalid input"}}};function Ei(){return{localeError:Lb()}}var Od;class Id{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Cd(){return new Id}(Od=globalThis).__zod_globalRegistry??(Od.__zod_globalRegistry=Cd());var Et=globalThis.__zod_globalRegistry;function Ti(e){if(e.checks)e.checks=[...e.checks];return e}function Ad(e,t){return new e(Ti({type:"string",...O(t)}))}function Nd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...O(t)})}function jd(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...O(t)})}function Zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...O(t)})}function Dd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...O(t)})}function Md(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...O(t)})}function qd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...O(t)})}function Ri(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...O(t)})}function Ld(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...O(t)})}function Ud(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...O(t)})}function Fd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...O(t)})}function Vd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...O(t)})}function Hd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...O(t)})}function Bd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...O(t)})}function Jd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...O(t)})}function Kd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...O(t)})}function Wd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...O(t)})}function Gd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...O(t)})}function Xd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...O(t)})}function Yd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...O(t)})}function Qd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...O(t)})}function ef(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...O(t)})}function tf(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...O(t)})}function mo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...O(t)})}function Oi(e,t){return new e({type:"string",format:"date",check:"string_format",...O(t)})}function Ii(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...O(t)})}function Ci(e,t){return new e({type:"string",format:"duration",check:"string_format",...O(t)})}function rf(e,t){return new e(Ti({type:"number",checks:[],...O(t)}))}function nf(e,t){return new e(Ti({type:"number",coerce:!0,checks:[],...O(t)}))}function of(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...O(t)})}function sf(e,t){return new e({type:"boolean",...O(t)})}function af(e,t){return new e({type:"null",...O(t)})}function cf(e){return new e({type:"any"})}function uf(e){return new e({type:"unknown"})}function lf(e,t){return new e({type:"never",...O(t)})}function ho(e,t){return new hi({check:"less_than",...O(t),value:e,inclusive:!1})}function dn(e,t){return new hi({check:"less_than",...O(t),value:e,inclusive:!0})}function go(e,t){return new gi({check:"greater_than",...O(t),value:e,inclusive:!1})}function fn(e,t){return new gi({check:"greater_than",...O(t),value:e,inclusive:!0})}function _o(e,t){return new ol({check:"multiple_of",...O(t),value:e})}function yo(e,t){return new il({check:"max_length",...O(t),maximum:e})}function br(e,t){return new al({check:"min_length",...O(t),minimum:e})}function vo(e,t){return new cl({check:"length_equals",...O(t),length:e})}function Ai(e,t){return new ul({check:"string_format",format:"regex",...O(t),pattern:e})}function Ni(e){return new ll({check:"string_format",format:"lowercase",...O(e)})}function ji(e){return new dl({check:"string_format",format:"uppercase",...O(e)})}function Zi(e,t){return new fl({check:"string_format",format:"includes",...O(t),includes:e})}function Di(e,t){return new pl({check:"string_format",format:"starts_with",...O(t),prefix:e})}function Mi(e,t){return new ml({check:"string_format",format:"ends_with",...O(t),suffix:e})}function Tt(e){return new hl({check:"overwrite",tx:e})}function qi(e){return Tt((t)=>t.normalize(e))}function Li(){return Tt((e)=>e.trim())}function Ui(){return Tt((e)=>e.toLowerCase())}function Fi(){return Tt((e)=>e.toUpperCase())}function Vi(){return Tt((e)=>ou(e))}function df(e,t,r){return new e({type:"array",element:t,...O(r)})}function ff(e,t,r){let n=O(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function pf(e,t,r){return new e({type:"custom",check:"custom",fn:t,...O(r)})}function mf(e,t){let r=Ub((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(sr(o,n.value,r._zod.def));else{let s=o;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(sr(s))}},e(n.value,n)),t);return r}function Ub(e,t){let r=new we({check:"custom",...O(t)});return r._zod.check=e,r}function pn(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))Le(e,n,r[n]);return e}function Bi(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Et,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function _t(e,t,r,n,o){let s=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(s==="any")return!1;if(s===void 0||s==="throw")throw Error(o);return Object.assign(r,s),!0}function he(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let m=i.schema,f=t.processors[o.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,m,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;he(d,t,l),t.seen.get(d).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)pn(i.schema,u);if(t.io==="input"&&Pe(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&"_prefault"in i.schema)(n=i.schema).default??(n.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function hf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ji(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let u=n.get(a);if(u&&u!==i[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,i[0])}}let o=(i)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,m=e.external.uri??((p)=>p);if(d)return{ref:m(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${m("__shared")}#/${a}/${hf(f)}`}}let u="#",c=`${u}/${a}/`;if(i[1]===r&&!i[1].schema.id)return{ref:u};let l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+hf(l)}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:u,defId:c}=o(i);if(a.def={...a.schema},c)a.defId=c;let l=a.schema;for(let d in l)delete l[d];l.$ref=u};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
64
|
+
|
|
65
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref")s(i)}}if(e.external)e.sharedDefsExtractedFor=e.external}function yf(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;yf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let s=n.type;for(let i of Array.isArray(s)?s:[s]){if(typeof i!=="string")return;if(!r.includes(i))r.push(i)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var vf=new Set(["type","properties","required","additionalProperties"]),gf=["oneOf","anyOf"];function _f(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Hi(e){let t=[];for(let s of e){if(typeof s!=="object"||s.type!=="object")return null;for(let i in s)if(!vf.has(i))return null;t.push(s)}let r={},n=new Set;for(let s of t){for(let i in s.properties){if(Object.prototype.hasOwnProperty.call(r,i))continue;let a=[];for(let c of t){let l=c.properties?.[i]??_f(c);if(l===null||l===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(l)))a.push(l)}let u=a.length===1?a[0]:Hi(a)??{allOf:a};Le(r,i,u)}for(let i of s.required??[])n.add(i)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((s)=>s.additionalProperties===!1))o.additionalProperties=!1;else{let s=[];for(let i of t){let a=_f(i);if(a&&!s.some((u)=>JSON.stringify(u)===JSON.stringify(a)))s.push(a)}if(s.length===1)o.additionalProperties=s[0];else if(s.length>1)o.additionalProperties={allOf:s}}return o}function Fb(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of vf)if(o in e)return;let r=t.filter((o)=>gf.some((s)=>Array.isArray(o[s]))),n=null;if(!r.length)n=Hi(t);else{let o=r[0],s=gf.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let i=t.filter((u)=>u!==o),a=o[s].map((u)=>Hi([...i,u]));if(a.some((u)=>!u))return;n={[s]:a}}if(!n)return;delete e.allOf,pn(e,n)}function Ki(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(a)=>{let u=e.seen.get(a);if(u.ref===null)return;let c=u.def??u.schema,l={...c},d=u.ref;if(u.ref=null,d){n(d);let f=e.seen.get(d),p=f.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))c.allOf=c.allOf??[],c.allOf.push(p);else pn(c,p);if(pn(c,l),a._zod.parent===d)for(let _ in c){if(_==="$ref"||_==="allOf")continue;if(!(_ in l))delete c[_]}if(p.$ref&&f.def)for(let _ in c){if(_==="$ref"||_==="allOf")continue;if(_ in f.def&&JSON.stringify(c[_])===JSON.stringify(f.def[_]))delete c[_]}}let m=a._zod.parent;if(m&&m!==d){n(m);let f=e.seen.get(m);if(f?.schema.$ref){if(c.$ref=f.schema.$ref,f.def)for(let p in c){if(p==="$ref"||p==="allOf")continue;if(p in f.def&&JSON.stringify(c[p])===JSON.stringify(f.def[p]))delete c[p]}}}e.override({zodSchema:a,jsonSchema:c,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())yf(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let u of e.seen.values())for(let c of[u.schema,u.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=a.get(l);if(d)d.push(c);else a.set(l,[c])}for(let u of e.intersections)for(let c of a.get(u)??[])Fb(c)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}pn(o,r.defId?r.schema:r.def??r.schema);let s=e.metadataRegistry.get(t)?.id;if(s!==void 0&&o.id===s)delete o.id;let i=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let u=a[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;Le(i,u.defId,u.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(i).length>0)if(e.target==="draft-2020-12")o.$defs=i;else o.definitions=i;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:mn(t,"input",e.processors),output:mn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Pe(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Pe(n.element,r);if(n.type==="set")return Pe(n.valueType,r);if(n.type==="lazy")return Pe(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return Pe(n.innerType,r);if(n.type==="intersection")return Pe(n.left,r)||Pe(n.right,r);if(n.type==="record"||n.type==="map")return Pe(n.keyType,r)||Pe(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Pe(n.in,r)||Pe(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(Pe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Pe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Pe(o,r))return!0;if(n.rest&&Pe(n.rest,r))return!0;return!1}return!1}var bf=(e,t={})=>(r)=>{let n=Bi({...r,processors:t});return he(e,n),Ji(n,e),Ki(n,e)},mn=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:s}=n??{},i=Bi({...o??{},target:s,io:t,processors:r});return he(e,i),Ji(i,e),Ki(i,e)};var wr=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},xr=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},wf=(e,t)=>{wr(e,"minimum",t),xr(e,"maximum",t)},Sf=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},kf=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Pf=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},Ef=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},xf=(e,t)=>wr(e,"minimum",t.minimum),$f=(e,t)=>xr(e,"maximum",t.maximum),zf=(e)=>(t,r)=>{Ef(t,r.format);let[n,o]=e[r.format];wr(t,"minimum",n),xr(t,"maximum",o)},Vb={greater_than:(e,t)=>wr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>xr(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Sf(e,t.value),number_format:zf(Hn),bigint_format:zf(ri),min_length:xf,max_length:$f,length_equals:(e,t)=>wf(e,t.length),min_size:xf,max_size:$f,size_equals:(e,t)=>wf(e,t.size),string_format:(e,t)=>{if(Ef(e,t.format),t.pattern)kf(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>Pf(e,t.mime)};function Fe(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let s of n)Vb[s._zod.def.check]?.(t,s._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)wr(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)wr(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)xr(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)xr(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)Sf(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)Pf(t,o.mime);for(let s of o.patterns??[])kf(t,s);return t}var Hb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bb=new Map([[bi,Hu],[co,Bu]]),Tf=(e)=>Bb.get(e)??e,Rf=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:s,maximum:i,format:a,patterns:u,contentEncoding:c,laxFormat:l}=Fe(e);if(typeof s==="number")o.minLength=s;if(typeof i==="number")o.maxLength=i;if(a){if(o.format=Hb[a]??a,o.format==="")delete o.format;if(a==="time"||l)delete o.format}if(c)o.contentEncoding=c;if(u&&u.size>0){let d=[...u].map(Tf);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((m)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))]}},Of=(e,t,r,n)=>{let o=r,{minimum:s,maximum:i,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:c,isInt:l}=Fe(e);o.type=l?"integer":"number";let d=typeof c==="number"&&c>=(s??Number.NEGATIVE_INFINITY),m=typeof u==="number"&&u<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(f)o.minimum=c,o.exclusiveMinimum=!0;else o.exclusiveMinimum=c;else if(typeof s==="number")o.minimum=s;if(m)if(f)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof i==="number")o.maximum=i;if(a){let p=new Set;for(let y of a)if(Number.isFinite(y)&&y!==0)p.add(Math.abs(y));else _t(e,t,o,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[g,..._]=p;if(g!==void 0)o.multipleOf=g;if(_.length)o.allOf=[...o.allOf??[],..._.map((y)=>({multipleOf:y}))]}},If=(e,t,r,n)=>{r.type="boolean"};var Cf=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var Af=(e,t,r,n)=>{r.not={}},Nf=(e,t,r,n)=>{},jf=(e,t,r,n)=>{};var Zf=(e,t,r,n)=>{let o=e._zod.def,s=en(o.entries);if(s.length===0){r.not={};return}if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},Df=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let s=[];for(let i of o.values)if(i===void 0){if(_t(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof i==="bigint"){if(_t(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;s.push(Number(i))}else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}};var Mf=(e,t,r,n)=>{_t(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var qf=(e,t,r,n)=>{_t(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var Lf=(e,t,r,n)=>{let o=r,s=e._zod.def,{minimum:i,maximum:a}=Fe(e);if(typeof i==="number")o.minItems=i;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=he(s.element,t,{...n,path:[...n.path,"items"]})};function bo(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return bo(t.out);if(t.type==="catch")return bo(t.innerType);return e._zod.optin}var Uf=(e,t,r,n)=>{let o=r,s=e._zod.def,i=s.shape;if(Object.getOwnPropertySymbols(i).length&&_t(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let c in i)Le(o.properties,c,he(i[c],t,{...n,path:[...n.path,"properties",c]}));let u=[];for(let c of Object.keys(i)){let l=s.shape[c];if(t.io==="input"?bo(l)===void 0:l._zod.optout===void 0)u.push(c)}if(u.length>0)o.required=u;if(s.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")o.additionalProperties=!1}else if(s.catchall)o.additionalProperties=he(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},Ff=(e,t,r,n)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,u)=>he(a,t,{...n,path:[...n.path,s?"oneOf":"anyOf",u]}));if(s)r.oneOf=i;else r.anyOf=i},Vf=(e,t,r,n)=>{let o=e._zod.def,s=he(o.left,t,{...n,path:[...n.path,"allOf",0]}),i=he(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=(c)=>("allOf"in c)&&Object.keys(c).length===1,u=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=u,t.intersections.push(u)};function Wi(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let p=e.get(t)?.def;if(!p)return t;let g=Wi(e,p,r);return g===p?t:g}for(let p of["anyOf","oneOf"]){let g=t[p];if(!Array.isArray(g))continue;let _=g.map((y)=>Wi(e,y,r));if(_.some((y,k)=>y!==g[k]))t={...t,[p]:_}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((p)=>p==="number"||p==="integer"),s=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!s?.some((p)=>typeof p==="number"))return t;let{minimum:i,maximum:a,exclusiveMinimum:u,exclusiveMaximum:c,multipleOf:l,format:d,id:m,...f}=t;if(f.enum)f.enum=f.enum.map((p)=>typeof p==="number"?String(p):p);else if(typeof f.const==="number")f.const=String(f.const);if(!o)return f;if(f.type="string",!s)f.pattern=(n.includes("number")?an:pi).source;return f}var Gi=new WeakMap;function Jb(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of Gi.get(e)??[]){let o=e.seen.get(n),s=(o?.def??o?.schema)?.propertyNames;if(!s||s===!0||r.has(s))continue;let i=Wi(t,s,new Set);if(i!==s)r.set(s,i)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let s=o&&r.get(o.propertyNames);if(s)o.propertyNames=s}}var Hf=(e,t,r,n)=>{let o=r,s=e._zod.def;o.type="object";let i=s.keyType,a=Fe(i).patterns;if(s.mode==="loose"&&a&&a.size>0){let l=he(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)Le(o.patternProperties,Tf(d).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=he(s.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=Gi.get(t);if(!l)l=[],Gi.set(t,l),t.deferred.push(()=>Jb(t));l.push(e)}o.additionalProperties=he(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=i._zod.values,c=t.io==="input"&&bo(s.valueType)!==void 0;if(u&&!s.partial&&!c){let l=[...u].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)o.required=l.map(String)}},Bf=(e,t,r,n)=>{let o=e._zod.def,s=he(o.innerType,t,n),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=o.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},Jf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType},Xi=Symbol();function Kf(e,t,r,n,o){let s=!1,i=JSON.stringify(e,(a,u)=>{if(typeof u!=="bigint")return u;return s=!0,null});if(!s)return JSON.parse(i);return _t(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),Xi}var Wf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i=Kf(o.defaultValue,e,t,r,n);if(i!==Xi)r.default=i},Gf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);if(s.ref=o.innerType,t.io!=="input")return;let i=Kf(o.defaultValue,e,t,r,n);if(i!==Xi)r._prefault=i},Xf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{_t(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=i},Yf=(e,t,r,n)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;he(i,t,n);let a=t.seen.get(e);a.ref=i},Qf=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType,r.readOnly=!0};var Yi=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let s=t.seen.get(e);s.ref=o.innerType};function wo(e){return!!e._zod}function Ee(e,t){if(wo(e))return li(e,t);return e.safeParse(t)}function zr(e){if(!e)return;let t;if(wo(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Sr(e){if(wo(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n;return}var ep=new WeakSet([Object.prototype,Error.prototype]);function xo(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var n0=(e,t)=>{vu.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(ep.has(r))return;ep.add(r),xo(r,"format",(n)=>(o)=>ui(n,o)),xo(r,"flatten",(n)=>(o)=>ci(n,o)),xo(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,tn,2)}),xo(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,tn,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var Me=v("ZodError",n0,void 0,{Parent:Error});var tp=Yn(Me),rp=Qn(Me),np=sn(Me),op=eo(Me),sp=xu(Me),ip=$u(Me),ap=zu(Me),cp=Su(Me),up=ku(Me),lp=Pu(Me),dp=Eu(Me),fp=Tu(Me);function s0(){if(!Re.localeError)Oe(Ei())}function zo(){if(!Re.memoizer)Oe({memoizer:Pi()})}var ne=v("ZodType",(e,t)=>(s0(),ee.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(De(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Xe(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(B0(e,t))},superRefine(e,t){return this.check(J0(e,t))},overwrite(e){return this.check(Tt(e))},optional(){return ae(this)},exactOptional(){return A0(this)},nullable(){return hp(this)},nullish(){return ae(hp(this))},nonoptional(e){return q0(this,e)},array(){return S(this)},or(e){return oe([this,e])},and(e){return ko(this,e)},transform(e){return gp(this,Tp(e))},default(e){return Z0(this,e)},prefault(e){return M0(this,e)},catch(e){return U0(this,e)},pipe(e){return gp(this,e)},readonly(){return H0(this)},describe(e){let t=this.clone();return Et.add(t,{description:e}),t},meta(...e){if(e.length===0)return Et.get(this);let t=this.clone();return Et.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return Gn(this,"~standard",{...vi(this),jsonSchema:{input:mn(this,"input"),output:mn(this,"output")}})},set "~standard"(e){gt(this,"~standard",e)},parse:function e(t,r){return tp(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await rp(this,t,r,{callee:e})},safeParse(e,t){return np(this,e,t)},async safeParseAsync(e,t){return op(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){gt(this,"spa",e)},validate(e,t){return to(this,e,t)},validateAsync(e,t){return ro(this,e,t)},encode:function e(t,r){return sp(this,t,r,{callee:e})},decode:function e(t,r){return ip(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await ap(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await cp(this,t,r,{callee:e})},safeEncode(e,t){return up(this,e,t)},safeDecode(e,t){return lp(this,e,t)},async safeEncodeAsync(e,t){return dp(this,e,t)},async safeDecodeAsync(e,t){return fp(this,e,t)},toJSONSchema(e){return bf(this,{})(e)},get description(){return Et.get(this)?.description},get _def(){return this._zod.def}}),_p=v("_ZodString",(e,t)=>{ao.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rf(e,r,n,o)},pu({format:(e)=>Fe(e).format??null,minLength:(e)=>Fe(e).minimum??null,maxLength:(e)=>Fe(e).maximum??null},{regex(...e){return this.check(Ai(...e))},includes(...e){return this.check(Zi(...e))},startsWith(...e){return this.check(Di(...e))},endsWith(...e){return this.check(Mi(...e))},min(...e){return this.check(br(...e))},max(...e){return this.check(yo(...e))},length(...e){return this.check(vo(...e))},nonempty(...e){return this.check(br(1,...e))},lowercase(e){return this.check(Ni(e))},uppercase(e){return this.check(ji(e))},trim(){return this.check(Li())},normalize(...e){return this.check(qi(...e))},toLowerCase(){return this.check(Ui())},toUpperCase(){return this.check(Fi())},slugify(){return this.check(Vi())}})),yp=v("ZodString",(e,t)=>{ao.init(e,t),_p.init(e,t)},{email(e){return this.check(Nd(i0,e))},url(e){return this.check(Ri(xp,e))},jwt(e){return this.check(tf(x0,e))},emoji(e){return this.check(Ld(c0,e))},guid(e){return this.check(jd(a0,e))},uuid(e){return this.check(Zd($o,e))},uuidv4(e){return this.check(Dd($o,e))},uuidv6(e){return this.check(Md($o,e))},uuidv7(e){return this.check(qd($o,e))},nanoid(e){return this.check(Ud(u0,e))},cuid(e){return this.check(Fd(l0,e))},cuid2(e){return this.check(Vd(d0,e))},ulid(e){return this.check(Hd(f0,e))},base64(e){return this.check(Yd(v0,e))},base64url(e){return this.check(Qd(b0,e))},xid(e){return this.check(Bd(p0,e))},ksuid(e){return this.check(Jd(m0,e))},ipv4(e){return this.check(Kd(h0,e))},ipv6(e){return this.check(Wd(g0,e))},cidrv4(e){return this.check(Gd(_0,e))},cidrv6(e){return this.check(Xd(y0,e))},e164(e){return this.check(ef(w0,e))},datetime(e){return this.check(mo(ea,e))},date(e){return this.check(Oi(vp,e))},time(e){return this.check(Ii(bp,e))},duration(e){return this.check(Ci(wp,e))}});function h(e){return Ad(yp,e)}var ue=v("ZodStringFormat",(e,t)=>{re.init(e,t),_p.init(e,t)}),ea=v("ZodISODateTime",(e,t)=>{Ul.init(e,t),ue.init(e,t)}),vp=v("ZodISODate",(e,t)=>{Fl.init(e,t),ue.init(e,t)}),bp=v("ZodISOTime",(e,t)=>{Vl.init(e,t),ue.init(e,t)}),wp=v("ZodISODuration",(e,t)=>{Hl.init(e,t),ue.init(e,t)}),i0=v("ZodEmail",(e,t)=>{Ol.init(e,t),ue.init(e,t)});var a0=v("ZodGUID",(e,t)=>{Tl.init(e,t),ue.init(e,t)});var $o=v("ZodUUID",(e,t)=>{Rl.init(e,t),ue.init(e,t)});var xp=v("ZodURL",(e,t)=>{Al.init(e,t),ue.init(e,t)});function $p(e){return Ri(xp,e)}var c0=v("ZodEmoji",(e,t)=>{Nl.init(e,t),ue.init(e,t)});var u0=v("ZodNanoID",(e,t)=>{jl.init(e,t),ue.init(e,t)});var l0=v("ZodCUID",(e,t)=>{Zl.init(e,t),ue.init(e,t)});var d0=v("ZodCUID2",(e,t)=>{Dl.init(e,t),ue.init(e,t)});var f0=v("ZodULID",(e,t)=>{Ml.init(e,t),ue.init(e,t)});var p0=v("ZodXID",(e,t)=>{ql.init(e,t),ue.init(e,t)});var m0=v("ZodKSUID",(e,t)=>{Ll.init(e,t),ue.init(e,t)});var h0=v("ZodIPv4",(e,t)=>{Bl.init(e,t),ue.init(e,t)});var g0=v("ZodIPv6",(e,t)=>{Kl.init(e,t),ue.init(e,t)});var _0=v("ZodCIDRv4",(e,t)=>{Wl.init(e,t),ue.init(e,t)});var y0=v("ZodCIDRv6",(e,t)=>{Gl.init(e,t),ue.init(e,t)});var v0=v("ZodBase64",(e,t)=>{Yl.init(e,t),ue.init(e,t)});var b0=v("ZodBase64URL",(e,t)=>{Ql.init(e,t),ue.init(e,t)});var w0=v("ZodE164",(e,t)=>{ed.init(e,t),ue.init(e,t)});var x0=v("ZodJWT",(e,t)=>{td.init(e,t),ue.init(e,t)});var So=v("ZodNumber",(e,t)=>{wi.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Of(e,r,n,o),e.isFinite=!0},pu({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=Fe(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=Fe(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=Fe(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>Fe(e).format??null},{gt(e,t){return this.check(go(e,t))},gte(e,t){return this.check(fn(e,t))},min(e,t){return this.check(fn(e,t))},lt(e,t){return this.check(ho(e,t))},lte(e,t){return this.check(dn(e,t))},max(e,t){return this.check(dn(e,t))},int(e){return this.check(pp(e))},safe(e){return this.check(pp(e))},positive(e){return this.check(go(0,e))},nonnegative(e){return this.check(fn(0,e))},negative(e){return this.check(ho(0,e))},nonpositive(e){return this.check(dn(0,e))},multipleOf(e,t){return this.check(_o(e,t))},step(e,t){return this.check(_o(e,t))},finite(){return this}}));function B(e){return rf(So,e)}var $0=v("ZodNumberFormat",(e,t)=>{rd.init(e,t),So.init(e,t)});function pp(e){return of($0,e)}var zp=v("ZodBoolean",(e,t)=>{nd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>If(e,r,n,o)});function Q(e){return sf(zp,e)}var z0=v("ZodNull",(e,t)=>{od.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cf(e,r,n,o)});function Sp(e){return af(z0,e)}var S0=v("ZodAny",(e,t)=>{sd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nf(e,r,n,o)});function kp(){return cf(S0)}var k0=v("ZodUnknown",(e,t)=>{id.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jf(e,r,n,o)});function ie(){return uf(k0)}var P0=v("ZodNever",(e,t)=>{ad.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Af(e,r,n,o)});function E0(e){return lf(P0,e)}var T0=v("ZodArray",(e,t)=>{zo(),cd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lf(e,r,n,o),e.element=t.element},{min(e,t){return this.check(br(e,t))},nonempty(e){return this.check(br(1,e))},max(e,t){return this.check(yo(e,t))},length(e,t){return this.check(vo(e,t))},unwrap(){return this.element}});function S(e,t){return df(T0,e,t)}var Pp=v("ZodObject",(e,t)=>{zo(),dd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uf(e,r,n,o),ub(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Ie(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(De(this._zod.def,{catchall:e}))},passthrough(){return this.clone(De(this._zod.def,{catchall:ie()}))},loose(){return this.clone(De(this._zod.def,{catchall:ie()}))},strict(){return this.clone(De(this._zod.def,{catchall:E0()}))},strip(){return this.clone(De(this._zod.def,{catchall:void 0}))},extend(e){return tb(this,e)},safeExtend(e){return rb(this,e)},merge(e){return nb(this,e)},pick(e){return Qv(this,e)},omit(e){return eb(this,e)},partial(...e){return uu(Rp,this,e[0])},exactPartial(...e){return uu(Op,this,e[0],"exactPartial")},required(...e){return ob(Ip,this,e[0])}});function P(e,t){let r={type:"object",shape:e??{},...O(t)};return new Pp(r)}function ye(e,t){return new Pp({type:"object",shape:e,catchall:ie(),...O(t)})}var Ep=v("ZodUnion",(e,t)=>{xi.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ff(e,r,n,o),e.options=t.options});function oe(e,t){return new Ep({type:"union",options:e,...O(t)})}var R0=v("ZodDiscriminatedUnion",(e,t)=>{Ep.init(e,t),fd.init(e,t)});function ta(e,t,r){return new R0({type:"union",options:t,discriminator:e,...O(r)})}var O0=v("ZodIntersection",(e,t)=>{pd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vf(e,r,n,o)});function ko(e,t){return new O0({type:"intersection",left:e,right:t})}var mp=v("ZodRecord",(e,t)=>{zo(),md.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hf(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function te(e,t,r){if(!t||!t._zod)return new mp({type:"record",keyType:h(),valueType:e,...O(t)});return new mp({type:"record",keyType:e,valueType:t,...O(r)})}var Qi=v("ZodEnum",(e,t)=>{hd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(n,o,s)=>Zf(e,n,o,s),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Qi({...t,checks:[],...O(o),entries:s})},e.exclude=(n,o)=>{let s={...t.entries};for(let i of n)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new Qi({...t,checks:[],...O(o),entries:s})}});function Ie(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Qi({type:"enum",entries:r,...O(t)})}var I0=v("ZodLiteral",(e,t)=>{gd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Df(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function A(e,t){return new I0({type:"literal",values:Array.isArray(e)?e:[e],...O(t)})}var C0=v("ZodTransform",(e,t)=>{zo(),_d.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qf(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new on(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(sr(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=e),r.issues.push(sr(i))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((s)=>(r.value=s,r));return r.value=o,r}});function Tp(e){return new C0({type:"transform",transform:e})}var Rp=v("ZodOptional",(e,t)=>{$i.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ae(e){return new Rp({type:"optional",innerType:e})}var Op=v("ZodExactOptional",(e,t)=>{yd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function A0(e){return new Op({type:"optional",innerType:e})}var N0=v("ZodNullable",(e,t)=>{vd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hp(e){return new N0({type:"nullable",innerType:e})}var j0=v("ZodDefault",(e,t)=>{bd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Z0(e,t){return new j0({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ei(t)}})}var D0=v("ZodPrefault",(e,t)=>{wd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function M0(e,t){return new D0({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ei(t)}})}var Ip=v("ZodNonOptional",(e,t)=>{xd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function q0(e,t){return new Ip({type:"nonoptional",innerType:e,...O(t)})}var L0=v("ZodCatch",(e,t)=>{$d.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function U0(e,t){return new L0({type:"catch",innerType:e,catchValue:typeof t==="function"?t:mu(t)})}var Cp=v("ZodPipe",(e,t)=>{zi.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yf(e,r,n,o),e.in=t.in,e.out=t.out});function gp(e,t){return new Cp({type:"pipe",in:e,out:t})}var F0=v("ZodPreprocess",(e,t)=>{Cp.init(e,t),zd.init(e,t)}),V0=v("ZodReadonly",(e,t)=>{Sd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qf(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function H0(e){return new V0({type:"readonly",innerType:e})}var Ap=v("ZodCustom",(e,t)=>{kd.init(e,t),ne.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mf(e,r,n,o)});function Np(e,t){return ff(Ap,e??(()=>!0),t)}function B0(e,t={}){return pf(Ap,e,t)}function J0(e,t){return mf(e,t)}function ra(e,t){return new F0({type:"pipe",in:Tp(e),out:t})}var Zp={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var jp;(function(e){})(jp||(jp={}));function W0(e){return mo(ea,e)}function G0(e){return nf(So,e)}var Rt="2025-11-25";var Eo=[Rt,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ot="io.modelcontextprotocol/related-task",To="2.0",ve=Np((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),qp=oe([h(),B().int()]),Lp=h(),p1=ye({ttl:B().optional(),pollInterval:B().optional()}),Y0=P({ttl:B().optional()}),Q0=P({taskId:h()}),na=ye({progressToken:qp.optional(),[Ot]:Q0.optional()}),qe=P({_meta:na.optional()}),hn=qe.extend({task:Y0.optional()}),Up=(e)=>hn.safeParse(e).success,xe=P({method:h(),params:qe.loose().optional()}),Ve=P({_meta:na.optional()}),He=P({method:h(),params:Ve.loose().optional()}),$e=ye({_meta:na.optional()}),Ro=oe([h(),B().int()]),Fp=P({jsonrpc:A(To),id:Ro,...xe.shape}).strict(),gn=(e)=>Fp.safeParse(e).success,Vp=P({jsonrpc:A(To),...He.shape}).strict(),Hp=(e)=>Vp.safeParse(e).success,oa=P({jsonrpc:A(To),id:Ro,result:$e}).strict(),ir=(e)=>oa.safeParse(e).success;var j;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(j||(j={}));var sa=P({jsonrpc:A(To),id:Ro.optional(),error:P({code:B().int(),message:h(),data:ie().optional()})}).strict();var Bp=(e)=>sa.safeParse(e).success;var Pr=oe([Fp,Vp,oa,sa]),m1=oe([oa,sa]),yt=$e.strict(),ew=Ve.extend({requestId:Ro.optional(),reason:h().optional()}),Oo=He.extend({method:A("notifications/cancelled"),params:ew}),tw=P({src:h(),mimeType:h().optional(),sizes:S(h()).optional(),theme:Ie(["light","dark"]).optional()}),_n=P({icons:S(tw).optional()}),kr=P({name:h(),title:h().optional()}),Jp=kr.extend({...kr.shape,..._n.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),rw=ko(P({applyDefaults:Q().optional()}),te(h(),ie())),nw=ra((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},ko(P({form:rw.optional(),url:ve.optional()}),te(h(),ie()).optional())),ow=ye({list:ve.optional(),cancel:ve.optional(),requests:ye({sampling:ye({createMessage:ve.optional()}).optional(),elicitation:ye({create:ve.optional()}).optional()}).optional()}),sw=ye({list:ve.optional(),cancel:ve.optional(),requests:ye({tools:ye({call:ve.optional()}).optional()}).optional()}),iw=P({experimental:te(h(),ve).optional(),sampling:P({context:ve.optional(),tools:ve.optional()}).optional(),elicitation:nw.optional(),roots:P({listChanged:Q().optional()}).optional(),tasks:ow.optional(),extensions:te(h(),ve).optional()}),aw=qe.extend({protocolVersion:h(),capabilities:iw,clientInfo:Jp}),ia=xe.extend({method:A("initialize"),params:aw});var cw=P({experimental:te(h(),ve).optional(),logging:ve.optional(),completions:ve.optional(),prompts:P({listChanged:Q().optional()}).optional(),resources:P({subscribe:Q().optional(),listChanged:Q().optional()}).optional(),tools:P({listChanged:Q().optional()}).optional(),tasks:sw.optional(),extensions:te(h(),ve).optional()}),aa=$e.extend({protocolVersion:h(),capabilities:cw,serverInfo:Jp,instructions:h().optional()}),Io=He.extend({method:A("notifications/initialized"),params:Ve.optional()}),Kp=(e)=>Io.safeParse(e).success,Co=xe.extend({method:A("ping"),params:qe.optional()}),uw=P({progress:B(),total:ae(B()),message:ae(h())}),lw=P({...Ve.shape,...uw.shape,progressToken:qp}),Ao=He.extend({method:A("notifications/progress"),params:lw}),dw=qe.extend({cursor:Lp.optional()}),yn=xe.extend({params:dw.optional()}),vn=$e.extend({nextCursor:Lp.optional()}),fw=Ie(["working","input_required","completed","failed","cancelled"]),bn=P({taskId:h(),status:fw,ttl:oe([B(),Sp()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ae(B()),statusMessage:ae(h())}),vt=$e.extend({task:bn}),pw=Ve.merge(bn),wn=He.extend({method:A("notifications/tasks/status"),params:pw}),No=xe.extend({method:A("tasks/get"),params:qe.extend({taskId:h()})}),jo=$e.merge(bn),Zo=xe.extend({method:A("tasks/result"),params:qe.extend({taskId:h()})}),h1=$e.loose(),Do=yn.extend({method:A("tasks/list")}),Mo=vn.extend({tasks:S(bn)}),qo=xe.extend({method:A("tasks/cancel"),params:qe.extend({taskId:h()})}),Wp=$e.merge(bn),Gp=P({uri:h(),mimeType:ae(h()),_meta:te(h(),ie()).optional()}),Xp=Gp.extend({text:h()}),ca=h().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Yp=Gp.extend({blob:ca}),xn=Ie(["user","assistant"]),Er=P({audience:S(xn).optional(),priority:B().min(0).max(1).optional(),lastModified:W0({offset:!0}).optional()}),Qp=P({...kr.shape,..._n.shape,uri:h(),description:ae(h()),mimeType:ae(h()),size:ae(B()),annotations:Er.optional(),_meta:ae(ye({}))}),mw=P({...kr.shape,..._n.shape,uriTemplate:h(),description:ae(h()),mimeType:ae(h()),annotations:Er.optional(),_meta:ae(ye({}))}),hw=yn.extend({method:A("resources/list")}),ua=vn.extend({resources:S(Qp)}),gw=yn.extend({method:A("resources/templates/list")}),la=vn.extend({resourceTemplates:S(mw)}),da=qe.extend({uri:h()}),_w=da,yw=xe.extend({method:A("resources/read"),params:_w}),fa=$e.extend({contents:S(oe([Xp,Yp]))}),pa=He.extend({method:A("notifications/resources/list_changed"),params:Ve.optional()}),vw=da,bw=xe.extend({method:A("resources/subscribe"),params:vw}),ww=da,xw=xe.extend({method:A("resources/unsubscribe"),params:ww}),$w=Ve.extend({uri:h()}),zw=He.extend({method:A("notifications/resources/updated"),params:$w}),Sw=P({name:h(),description:ae(h()),required:ae(Q())}),kw=P({...kr.shape,..._n.shape,description:ae(h()),arguments:ae(S(Sw)),_meta:ae(ye({}))}),Pw=yn.extend({method:A("prompts/list")}),ma=vn.extend({prompts:S(kw)}),Ew=qe.extend({name:h(),arguments:te(h(),h()).optional()}),Tw=xe.extend({method:A("prompts/get"),params:Ew}),ha=P({type:A("text"),text:h(),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),ga=P({type:A("image"),data:ca,mimeType:h(),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),_a=P({type:A("audio"),data:ca,mimeType:h(),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),Rw=P({type:A("tool_use"),name:h(),id:h(),input:te(h(),ie()),_meta:te(h(),ie()).optional()}),Ow=P({type:A("resource"),resource:oe([Xp,Yp]),annotations:Er.optional(),_meta:te(h(),ie()).optional()}),Iw=Qp.extend({type:A("resource_link")}),ya=oe([ha,ga,_a,Iw,Ow]),Cw=P({role:xn,content:ya}),va=$e.extend({description:h().optional(),messages:S(Cw)}),ba=He.extend({method:A("notifications/prompts/list_changed"),params:Ve.optional()}),Aw=P({title:h().optional(),readOnlyHint:Q().optional(),destructiveHint:Q().optional(),idempotentHint:Q().optional(),openWorldHint:Q().optional()}),Nw=P({taskSupport:Ie(["required","optional","forbidden"]).optional()}),em=P({...kr.shape,..._n.shape,description:h().optional(),inputSchema:P({type:A("object"),properties:te(h(),ve).optional(),required:S(h()).optional()}).catchall(ie()),outputSchema:P({type:A("object"),properties:te(h(),ve).optional(),required:S(h()).optional()}).catchall(ie()).optional(),annotations:Aw.optional(),execution:Nw.optional(),_meta:te(h(),ie()).optional()}),wa=yn.extend({method:A("tools/list")}),xa=vn.extend({tools:S(em)}),It=$e.extend({content:S(ya).default([]),structuredContent:te(h(),ie()).optional(),isError:Q().optional()}),g1=It.or($e.extend({toolResult:ie()})),jw=hn.extend({name:h(),arguments:te(h(),ie()).optional()}),$n=xe.extend({method:A("tools/call"),params:jw}),zn=He.extend({method:A("notifications/tools/list_changed"),params:Ve.optional()}),tm=P({autoRefresh:Q().default(!0),debounceMs:B().int().nonnegative().default(300)}),Sn=Ie(["debug","info","notice","warning","error","critical","alert","emergency"]),Zw=qe.extend({level:Sn}),$a=xe.extend({method:A("logging/setLevel"),params:Zw}),Dw=Ve.extend({level:Sn,logger:h().optional(),data:ie()}),Mw=He.extend({method:A("notifications/message"),params:Dw}),qw=P({name:h().optional()}),Lw=P({hints:S(qw).optional(),costPriority:B().min(0).max(1).optional(),speedPriority:B().min(0).max(1).optional(),intelligencePriority:B().min(0).max(1).optional()}),Uw=P({mode:Ie(["auto","required","none"]).optional()}),Fw=P({type:A("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:S(ya).default([]),structuredContent:P({}).loose().optional(),isError:Q().optional(),_meta:te(h(),ie()).optional()}),Vw=ta("type",[ha,ga,_a]),Po=ta("type",[ha,ga,_a,Rw,Fw]),Hw=P({role:xn,content:oe([Po,S(Po)]),_meta:te(h(),ie()).optional()}),Bw=hn.extend({messages:S(Hw),modelPreferences:Lw.optional(),systemPrompt:h().optional(),includeContext:Ie(["none","thisServer","allServers"]).optional(),temperature:B().optional(),maxTokens:B().int(),stopSequences:S(h()).optional(),metadata:ve.optional(),tools:S(em).optional(),toolChoice:Uw.optional()}),za=xe.extend({method:A("sampling/createMessage"),params:Bw}),ar=$e.extend({model:h(),stopReason:ae(Ie(["endTurn","stopSequence","maxTokens"]).or(h())),role:xn,content:Vw}),kn=$e.extend({model:h(),stopReason:ae(Ie(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:xn,content:oe([Po,S(Po)])}),Jw=P({type:A("boolean"),title:h().optional(),description:h().optional(),default:Q().optional()}),Kw=P({type:A("string"),title:h().optional(),description:h().optional(),minLength:B().optional(),maxLength:B().optional(),format:Ie(["email","uri","date","date-time"]).optional(),default:h().optional()}),Ww=P({type:Ie(["number","integer"]),title:h().optional(),description:h().optional(),minimum:B().optional(),maximum:B().optional(),default:B().optional()}),Gw=P({type:A("string"),title:h().optional(),description:h().optional(),enum:S(h()),default:h().optional()}),Xw=P({type:A("string"),title:h().optional(),description:h().optional(),oneOf:S(P({const:h(),title:h()})),default:h().optional()}),Yw=P({type:A("string"),title:h().optional(),description:h().optional(),enum:S(h()),enumNames:S(h()).optional(),default:h().optional()}),Qw=oe([Gw,Xw]),ex=P({type:A("array"),title:h().optional(),description:h().optional(),minItems:B().optional(),maxItems:B().optional(),items:P({type:A("string"),enum:S(h())}),default:S(h()).optional()}),tx=P({type:A("array"),title:h().optional(),description:h().optional(),minItems:B().optional(),maxItems:B().optional(),items:P({anyOf:S(P({const:h(),title:h()}))}),default:S(h()).optional()}),rx=oe([ex,tx]),nx=oe([Yw,Qw,rx]),ox=oe([nx,Jw,Kw,Ww]),sx=hn.extend({mode:A("form").optional(),message:h(),requestedSchema:P({type:A("object"),properties:te(h(),ox),required:S(h()).optional()})}),ix=hn.extend({mode:A("url"),message:h(),elicitationId:h(),url:h().url()}),ax=oe([sx,ix]),Sa=xe.extend({method:A("elicitation/create"),params:ax}),cx=Ve.extend({elicitationId:h()}),ux=He.extend({method:A("notifications/elicitation/complete"),params:cx}),Ct=$e.extend({action:Ie(["accept","decline","cancel"]),content:ra((e)=>e===null?void 0:e,te(h(),oe([h(),B(),Q(),S(h())])).optional())}),lx=P({type:A("ref/resource"),uri:h()});var dx=P({type:A("ref/prompt"),name:h()}),fx=qe.extend({ref:oe([dx,lx]),argument:P({name:h(),value:h()}),context:P({arguments:te(h(),h()).optional()}).optional()}),px=xe.extend({method:A("completion/complete"),params:fx});var ka=$e.extend({completion:ye({values:S(h()).max(100),total:ae(B().int()),hasMore:ae(Q())})}),mx=P({uri:h().startsWith("file://"),name:h().optional(),_meta:te(h(),ie()).optional()}),hx=xe.extend({method:A("roots/list"),params:qe.optional()}),Pa=$e.extend({roots:S(mx)}),gx=He.extend({method:A("notifications/roots/list_changed"),params:Ve.optional()}),_1=oe([Co,ia,px,$a,Tw,Pw,hw,gw,yw,bw,xw,$n,wa,No,Zo,Do,qo]),y1=oe([Oo,Ao,Io,gx,wn]),v1=oe([yt,ar,kn,Ct,Pa,jo,Mo,vt]),b1=oe([Co,za,Sa,hx,No,Zo,Do,qo]),w1=oe([Oo,Ao,Mw,zw,pa,zn,ba,wn,ux]),x1=oe([yt,aa,ka,va,ma,ua,la,fa,It,xa,jo,Mo,vt]);class I extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===j.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new rm(n.elicitations,t)}return new I(e,t,r)}}class rm extends I{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(j.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function At(e){return e==="completed"||e==="failed"||e==="cancelled"}var _x=Symbol("Let zodToJsonSchema decide on which parser to use");var tA=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ea(e){let r=zr(e)?.method;if(!r)throw Error("Schema is missing a method literal");let n=Sr(r);if(typeof n!=="string")throw Error("Schema method literal must be a string");return n}function Ta(e,t){let r=Ee(e,t);if(!r.success)throw r.error;return r.data}var $x=60000;class En{constructor(e){if(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._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Oo,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Ao,(t)=>{this._onprogress(t)}),this.setRequestHandler(Co,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(No,async(t,r)=>{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new I(j.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Zo,async(t,r)=>{let n=async()=>{let o=t.params.taskId;if(!await this._taskStore.getTask(o,r.sessionId))throw new I(j.InvalidParams,`Task not found: ${o}`);if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(o,r.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,u=a.id,c=this._requestResolvers.get(u);if(c)if(this._requestResolvers.delete(u),i.type==="response")c(a);else{let l=a,d=new I(l.error.code,l.error.message,l.error.data);c(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${u}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(o,r.sessionId);if(!s)throw new I(j.InvalidParams,`Task not found: ${o}`);if(!At(s.status))return await this._waitForTaskUpdate(o,r.signal,r.sessionId),await n();if(At(s.status)){let i=await this._taskStore.getTaskResult(o,r.sessionId);return this._clearTaskQueue(o,r.sessionId),{...i,_meta:{...i._meta,[Ot]:{taskId:o}}}}return await n()};return await n()}),this.setRequestHandler(Do,async(t,r)=>{try{let{tasks:n,nextCursor:o}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:n,nextCursor:o,_meta:{}}}catch(n){throw new I(j.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(qo,async(t,r)=>{try{let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new I(j.InvalidParams,`Task not found: ${t.params.taskId}`);if(At(n.status))throw new I(j.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId,r.sessionId);let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new I(j.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...o}}catch(n){if(n instanceof I)throw n;throw new I(j.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),I.fromError(j.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(o)=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,s)=>{if(n?.(o,s),ir(o)||Bp(o))this._onresponse(o);else if(gn(o))this._onrequest(o,s);else if(Hp(o))this._onnotification(o);else this._onerror(Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=I.fromError(j.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[Ot]?.taskId,s=n?.sessionId,i=this._taskStore,a=!0,u;if(o&&i&&this._taskMessageQueue&&s!==void 0)a=!1,u=(async()=>{if(!await i.getTask(o,s))throw new I(j.InvalidParams,`Task not found: ${o}`);a=!0})();if(r===void 0){let f={jsonrpc:"2.0",id:e.id,error:{code:j.MethodNotFound,message:"Method not found"}};if(o&&u){let p={type:"error",message:f,timestamp:Date.now()};u.then(()=>this._enqueueTaskMessage(o,p,s),()=>n?.send(f)).catch((g)=>this._onerror(Error(`Failed to send an error response: ${g}`)))}else if(o&&this._taskMessageQueue)this._enqueueTaskMessage(o,{type:"error",message:f,timestamp:Date.now()},n?.sessionId).catch((p)=>this._onerror(Error(`Failed to enqueue error response: ${p}`)));else n?.send(f).catch((p)=>this._onerror(Error(`Failed to send an error response: ${p}`)));return}let c=new AbortController;this._requestHandlerAbortControllers.set(e.id,c);let l=Up(e.params)?e.params.task:void 0,d=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,m={signal:c.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async(f)=>{if(c.signal.aborted)return;let p={relatedRequestId:e.id};if(o)p.relatedTask={taskId:o};await this.notification(f,p)},sendRequest:async(f,p,g)=>{if(c.signal.aborted)throw new I(j.ConnectionClosed,"Request was cancelled");let _={...g,relatedRequestId:e.id};if(o&&!_.relatedTask)_.relatedTask={taskId:o};let y=_.relatedTask?.taskId??o;if(y&&d)await d.updateTaskStatus(y,"input_required");return await this.request(f,p,_)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:d,taskRequestedTtl:l?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};(u??Promise.resolve()).then(()=>{if(u&&c.signal.aborted)throw new I(j.ConnectionClosed,"Request was cancelled");if(l)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,m)).then(async(f)=>{if(c.signal.aborted)return;let p={result:f,jsonrpc:"2.0",id:e.id};if(o&&this._taskMessageQueue)await this._enqueueTaskMessage(o,{type:"response",message:p,timestamp:Date.now()},n?.sessionId);else await n?.send(p)},async(f)=>{if(c.signal.aborted)return;let p={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:j.InternalError,message:f.message??"Internal error",...f.data!==void 0&&{data:f.data}}};if(o&&this._taskMessageQueue&&a)await this._enqueueTaskMessage(o,{type:"error",message:p,timestamp:Date.now()},n?.sessionId);else await n?.send(p)}).catch((f)=>this._onerror(Error(`Failed to send response: ${f}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===c)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(n),i=this._timeoutInfo.get(n);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(a){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),s(a);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),ir(e))r(e);else{let s=new I(e.error.code,e.error.message,e.error.data);r(s)}return}let n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(ir(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")o=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!o)this._progressHandlers.delete(t);if(ir(e))n(e);else{let s=I.fromError(e.error.code,e.error.message,e.error.data);n(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:n}=r??{};if(!n){try{yield{type:"result",result:await this.request(e,t,r)}}catch(s){yield{type:"error",error:s instanceof I?s:new I(j.InternalError,String(s))}}return}let o;try{let s=await this.request(e,vt,r);if(s.task)o=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new I(j.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:i},At(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};else if(i.status==="failed")yield{type:"error",error:new I(j.InternalError,`Task ${o} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new I(j.InternalError,`Task ${o} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},t,r)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((u)=>setTimeout(u,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof I?s:new I(j.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((u,c)=>{let l=(y)=>{c(y)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(y){l(y);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)m.params={...m.params,task:i};if(a)m.params={...m.params,_meta:{...m.params?._meta||{},[Ot]:a}};let f=(y)=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(y)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((C)=>this._onerror(Error(`Failed to send cancellation: ${C}`)));let k=y instanceof I?y:new I(j.RequestTimeout,String(y));c(k)};this._responseHandlers.set(d,(y)=>{if(r?.signal?.aborted)return;if(y instanceof Error)return c(y);try{let k=Ee(t,y.result);if(!k.success)c(k.error);else u(k.data)}catch(k){c(k)}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let p=r?.timeout??$x,g=()=>f(I.fromError(j.RequestTimeout,"Request timed out",{timeout:p}));this._setupTimeout(d,p,r?.maxTotalTimeout,g,r?.resetTimeoutOnProgress??!1);let _=a?.taskId;if(_){let y=(k)=>{let C=this._responseHandlers.get(d);if(C)C(k);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,y),this._enqueueTaskMessage(_,{type:"request",message:m,timestamp:Date.now()}).catch((k)=>{this._cleanupTimeout(d),c(k)})}else this._transport.send(m,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch((y)=>{this._cleanupTimeout(d),c(y)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},jo,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Mo,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Wp,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Ot]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Ot]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Ot]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=Ea(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(n,o)=>{let s=Ta(e,n);return Promise.resolve(t(s,o))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=Ea(e);this._notificationHandlers.set(r,(n)=>{let o=Ta(e,n);return Promise.resolve(t(o))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r??this._transport?.sessionId,n)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let n of r)if(n.type==="request"&&gn(n.message)){let o=n.message.id,s=this._requestResolvers.get(o);if(s)s(new I(j.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o);else this._onerror(Error(`Resolver missing for request ${o} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t,r){let n=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e,r);if(o?.pollInterval)n=o.pollInterval}catch{}return new Promise((o,s)=>{if(t.aborted){s(new I(j.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);t.addEventListener("abort",()=>{clearTimeout(i),s(new I(j.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(n)=>{if(!e)throw Error("No request provided");return await r.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async(n)=>{let o=await r.getTask(n,t);if(!o)throw new I(j.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(n,o,s)=>{await r.storeTaskResult(n,o,s,t);let i=await r.getTask(n,t);if(i){let a=wn.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),At(i.status))this._cleanupTaskProgressHandler(n)}},getTaskResult:(n)=>r.getTaskResult(n,t),updateTaskStatus:async(n,o,s)=>{let i=await r.getTask(n,t);if(!i)throw new I(j.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(At(i.status))throw new I(j.InvalidParams,`Cannot update task "${n}" from terminal status "${i.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(n,o,s,t);let a=await r.getTask(n,t);if(a){let u=wn.parse({method:"notifications/tasks/status",params:a});if(await this.notification(u),At(a.status))this._cleanupTaskProgressHandler(n)}},listTasks:(n)=>r.listTasks(n,t)}}}function nm(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Lo(e,t){let r={...e};for(let n in t){let o=n,s=t[o];if(s===void 0)continue;let i=r[o];if(nm(i)&&nm(s))r[o]={...i,...s};else r[o]=s}return r}var gv=Xc(yc(),1),_v=Xc(hv(),1);function _R(){let e=new gv.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return _v.default(e),e}class Un{constructor(e){this._ajv=e??_R()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class Pc{constructor(e){this._client=e}async*callToolStream(e,t=It,r){let n=this._client,o={...r,task:r?.task??(n.isToolTask(e.name)?{}:void 0)},s=n.requestStream({method:"tools/call",params:e},t,o),i=n.getToolOutputValidator(e.name);for await(let a of s){if(a.type==="result"&&i){let u=a.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new I(j.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let c=i(u.structuredContent);if(!c.valid){yield{type:"error",error:new I(j.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)};return}}catch(c){if(c instanceof I){yield{type:"error",error:c};return}yield{type:"error",error:new I(j.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)};return}}yield a}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function Is(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Cs(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function As(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,n=e.properties;for(let o of Object.keys(n)){let s=n[o];if(r[o]===void 0&&Object.prototype.hasOwnProperty.call(s,"default"))r[o]=s.default;if(r[o]!==void 0)As(s,r[o])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")As(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")As(r,t)}}function yR(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}class Ec extends En{constructor(e,t){super(t);if(this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Un,t?.listChanged)this._pendingListChangedConfig=t.listChanged}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",zn,e.tools,async()=>(await this.listTools()).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",ba,e.prompts,async()=>(await this.listPrompts()).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",pa,e.resources,async()=>(await this.listResources()).resources)}get experimental(){if(!this._experimental)this._experimental={tasks:new Pc(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Lo(this._capabilities,e)}setRequestHandler(e,t){let n=zr(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=Sr(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");let s=o;if(s==="elicitation/create"){let i=async(a,u)=>{let c=Ee(Sa,a);if(!c.success){let y=c.error instanceof Error?c.error.message:String(c.error);throw new I(j.InvalidParams,`Invalid elicitation request: ${y}`)}let{params:l}=c.data;l.mode=l.mode??"form";let{supportsFormMode:d,supportsUrlMode:m}=yR(this._capabilities.elicitation);if(l.mode==="form"&&!d)throw new I(j.InvalidParams,"Client does not support form-mode elicitation requests");if(l.mode==="url"&&!m)throw new I(j.InvalidParams,"Client does not support URL-mode elicitation requests");let f=await Promise.resolve(t(a,u));if(l.task){let y=Ee(vt,f);if(!y.success){let k=y.error instanceof Error?y.error.message:String(y.error);throw new I(j.InvalidParams,`Invalid task creation result: ${k}`)}return y.data}let p=Ee(Ct,f);if(!p.success){let y=p.error instanceof Error?p.error.message:String(p.error);throw new I(j.InvalidParams,`Invalid elicitation result: ${y}`)}let g=p.data,_=l.mode==="form"?l.requestedSchema:void 0;if(l.mode==="form"&&g.action==="accept"&&g.content&&_){if(this._capabilities.elicitation?.form?.applyDefaults)try{As(_,g.content)}catch{}}return g};return super.setRequestHandler(e,i)}if(s==="sampling/createMessage"){let i=async(a,u)=>{let c=Ee(za,a);if(!c.success){let g=c.error instanceof Error?c.error.message:String(c.error);throw new I(j.InvalidParams,`Invalid sampling request: ${g}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let g=Ee(vt,d);if(!g.success){let _=g.error instanceof Error?g.error.message:String(g.error);throw new I(j.InvalidParams,`Invalid task creation result: ${_}`)}return g.data}let f=l.tools||l.toolChoice?kn:ar,p=Ee(f,d);if(!p.success){let g=p.error instanceof Error?p.error.message:String(p.error);throw new I(j.InvalidParams,`Invalid sampling result: ${g}`)}return p.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId!==void 0)return;try{let r=await this.request({method:"initialize",params:{protocolVersion:Rt,capabilities:this._capabilities,clientInfo:this._clientInfo}},aa,t);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);if(!Eo.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);if(this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion)e.setProtocolVersion(r.protocolVersion);if(this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){Is(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Cs(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},yt,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},ka,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},yt,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},va,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},ma,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},ua,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},la,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},fa,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},yt,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},yt,t)}async callTool(e,t=It,r){if(this.isToolTaskRequired(e.name))throw new I(j.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:e},t,r),o=this.getToolOutputValidator(e.name);if(o){if(!n.structuredContent&&!n.isError)throw new I(j.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let s=o(n.structuredContent);if(!s.valid)throw new I(j.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){if(s instanceof I)throw s;throw new I(j.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return n}isToolTask(e){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let t of e){if(t.outputSchema){let n=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,n)}let r=t.execution?.taskSupport;if(r==="required"||r==="optional")this._cachedKnownTaskTools.add(t.name);if(r==="required")this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},xa,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,n){let o=tm.safeParse(r);if(!o.success)throw Error(`Invalid ${e} listChanged options: ${o.error.message}`);if(typeof r.onChanged!=="function")throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=o.data,{onChanged:a}=r,u=async()=>{if(!s){a(null,null);return}try{let l=await n();a(null,l)}catch(l){let d=l instanceof Error?l:Error(String(l));a(d,null)}},c=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);if(l)clearTimeout(l);let d=setTimeout(u,i);this._listChangedDebounceTimers.set(e,d)}else u()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}/*!
|
|
66
|
+
* content-type
|
|
67
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
68
|
+
* MIT Licensed
|
|
69
|
+
*/var yv=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;var vR=/\\([\u000b\u0020-\u00ff])/g;var bR=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;var vv=wR;function wR(e){if(!e)throw TypeError("argument string is required");var t=typeof e==="object"?xR(e):e;if(typeof t!=="string")throw TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=r!==-1?t.slice(0,r).trim():t.trim();if(!bR.test(n))throw TypeError("invalid media type");var o=new $R(n.toLowerCase());if(r!==-1){var s,i,a;yv.lastIndex=r;while(i=yv.exec(t)){if(i.index!==r)throw TypeError("invalid parameter format");if(r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34){if(a=a.slice(1,-1),a.indexOf("\\")!==-1)a=a.replace(vR,"$1")}o.parameters[s]=a}if(r!==t.length)throw TypeError("invalid parameter format")}return o}function xR(e){var t;if(typeof e.getHeader==="function")t=e.getHeader("content-type");else if(typeof e.headers==="object")t=e.headers&&e.headers["content-type"];if(typeof t!=="string")throw TypeError("content-type header is missing from object");return t}function $R(e){this.parameters=Object.create(null),this.type=e}function bv(e){if(!e)return;try{return vv(e).type}catch{let t=(e.split(";",1)[0]??"").trim().toLowerCase();if(t===""||e.slice(t.length).includes(","))return;return t}}function Ns(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function wv(e=fetch,t){if(!t)return e;return async(r,n)=>{let o={...t,...n,headers:n?.headers?{...Ns(t.headers),...Ns(n.headers)}:t.headers};return e(r,o)}}var SR=5,kR=[301,302,303,307,308];function PR(e,t){if(e.protocol===t.protocol&&e.hostname===t.hostname&&e.port===t.port)return!0;return e.hostname===t.hostname&&e.protocol==="http:"&&e.port===""&&t.protocol==="https:"&&t.port===""}function xv(e,t){let r=kR.includes(e.status)?e.headers.get("location"):null;try{return r?new URL(r,t):void 0}catch{return}}function js(e,t,r,n,o=0){let s=xv(n,t),i=n.status===307||n.status===308||(r?.method??"GET").toUpperCase()==="GET";if(!s||o===SR||!i)return;let a=new URL(t);if((s.username||s.password)&&(s.username!==a.username||s.password!==a.password)||!PR(a,s))return;return Promise.resolve(n.body?.cancel()).then(()=>e(s,{...r,redirect:"manual"})).then((c)=>js(e,s,r,c,o+1)??c)}var $v=new WeakSet;function Tc(e){let t=(r,n)=>(e??fetch)(r,n);return $v.add(t),t}function mr(e=fetch){if($v.has(e))return e;return(t,r)=>{if(r?.redirect==="error"||r?.redirect==="manual")return e(t,r);return Promise.resolve(e(t,{...r,redirect:"manual"})).then((n)=>js(e,t,r,n)??n)}}function Zs(e,t){if(e.type==="opaqueredirect")return"Redirect not followed: this runtime does not expose the redirect target";let r=e.url||t,n=xv(e,r);if(!n)return;if(n.username=n.password=n.search=n.hash="",n.protocol==="http:"&&new URL(r).protocol==="https:")return n.protocol="https:",`Redirect to plain http not followed; try ${n.href} instead`;return`Redirect to ${n.href} not followed`}var Rc;Rc=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then((e)=>e.webcrypto);async function ER(e){return(await Rc).getRandomValues(new Uint8Array(e))}async function TR(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,n="";while(n.length<e){let o=await ER(e-n.length);for(let s of o)if(s<r)n+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[s%66]}return n}async function RR(e){return await TR(e)}async function OR(e){let t=await(await Rc).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Oc(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await RR(e),r=await OR(t);return{code_verifier:t,code_challenge:r}}var Se=$p().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Zp.custom,message:"URL must be parseable",fatal:!0}),si}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Sv=ye({resource:h().url(),authorization_servers:S(Se).optional(),jwks_uri:h().url().optional(),scopes_supported:S(h()).optional(),bearer_methods_supported:S(h()).optional(),resource_signing_alg_values_supported:S(h()).optional(),resource_name:h().optional(),resource_documentation:h().optional(),resource_policy_uri:h().url().optional(),resource_tos_uri:h().url().optional(),tls_client_certificate_bound_access_tokens:Q().optional(),authorization_details_types_supported:S(h()).optional(),dpop_signing_alg_values_supported:S(h()).optional(),dpop_bound_access_tokens_required:Q().optional()}),Ic=ye({issuer:h(),authorization_endpoint:Se,token_endpoint:Se,registration_endpoint:Se.optional(),scopes_supported:S(h()).optional(),response_types_supported:S(h()),response_modes_supported:S(h()).optional(),grant_types_supported:S(h()).optional(),token_endpoint_auth_methods_supported:S(h()).optional(),token_endpoint_auth_signing_alg_values_supported:S(h()).optional(),service_documentation:Se.optional(),revocation_endpoint:Se.optional(),revocation_endpoint_auth_methods_supported:S(h()).optional(),revocation_endpoint_auth_signing_alg_values_supported:S(h()).optional(),introspection_endpoint:h().optional(),introspection_endpoint_auth_methods_supported:S(h()).optional(),introspection_endpoint_auth_signing_alg_values_supported:S(h()).optional(),code_challenge_methods_supported:S(h()).optional(),client_id_metadata_document_supported:Q().optional()}),IR=ye({issuer:h(),authorization_endpoint:Se,token_endpoint:Se,userinfo_endpoint:Se.optional(),jwks_uri:Se,registration_endpoint:Se.optional(),scopes_supported:S(h()).optional(),response_types_supported:S(h()),response_modes_supported:S(h()).optional(),grant_types_supported:S(h()).optional(),acr_values_supported:S(h()).optional(),subject_types_supported:S(h()),id_token_signing_alg_values_supported:S(h()),id_token_encryption_alg_values_supported:S(h()).optional(),id_token_encryption_enc_values_supported:S(h()).optional(),userinfo_signing_alg_values_supported:S(h()).optional(),userinfo_encryption_alg_values_supported:S(h()).optional(),userinfo_encryption_enc_values_supported:S(h()).optional(),request_object_signing_alg_values_supported:S(h()).optional(),request_object_encryption_alg_values_supported:S(h()).optional(),request_object_encryption_enc_values_supported:S(h()).optional(),token_endpoint_auth_methods_supported:S(h()).optional(),token_endpoint_auth_signing_alg_values_supported:S(h()).optional(),display_values_supported:S(h()).optional(),claim_types_supported:S(h()).optional(),claims_supported:S(h()).optional(),service_documentation:h().optional(),claims_locales_supported:S(h()).optional(),ui_locales_supported:S(h()).optional(),claims_parameter_supported:Q().optional(),request_parameter_supported:Q().optional(),request_uri_parameter_supported:Q().optional(),require_request_uri_registration:Q().optional(),op_policy_uri:Se.optional(),op_tos_uri:Se.optional(),client_id_metadata_document_supported:Q().optional()}),kv=P({...IR.shape,...Ic.pick({code_challenge_methods_supported:!0}).shape}),Pv=P({access_token:h(),id_token:h().optional(),token_type:h(),expires_in:G0().optional(),scope:h().optional(),refresh_token:h().optional(),issuer:h().optional().catch(void 0)}).strip(),Ev=P({error:h(),error_description:h().optional(),error_uri:h().optional()}),zv=Se.optional().or(A("").transform(()=>{return})),CR=P({redirect_uris:S(Se),token_endpoint_auth_method:h().optional(),grant_types:S(h()).optional(),response_types:S(h()).optional(),client_name:h().optional(),client_uri:Se.optional(),logo_uri:zv,scope:h().optional(),contacts:S(h()).optional(),tos_uri:zv,policy_uri:h().optional(),jwks_uri:Se.optional(),jwks:kp().optional(),software_id:h().optional(),software_version:h().optional(),software_statement:h().optional()}).strip(),AR=P({client_id:h(),client_secret:h().optional(),client_id_issued_at:B().optional(),client_secret_expires_at:B().optional(),issuer:h().optional().catch(void 0)}).strip(),Tv=CR.merge(AR),tM=P({error:h(),error_description:h().optional()}).strip(),rM=P({token:h(),token_type_hint:h().optional()}).strip();function Rv(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Ov({requestedResource:e,configuredResource:t}){let r=typeof e==="string"?new URL(e):new URL(e.href),n=typeof t==="string"?new URL(t):new URL(t.href);if(r.origin!==n.origin)return!1;if(r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}class _e extends Error{constructor(e,t){super(e);this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};if(this.errorUri)e.error_uri=this.errorUri;return e}get errorCode(){return this.constructor.errorCode}}class Ds extends _e{}Ds.errorCode="invalid_request";class Wr extends _e{}Wr.errorCode="invalid_client";class Gr extends _e{}Gr.errorCode="invalid_grant";class Xr extends _e{}Xr.errorCode="unauthorized_client";class Ms extends _e{}Ms.errorCode="unsupported_grant_type";class qs extends _e{}qs.errorCode="invalid_scope";class Ls extends _e{}Ls.errorCode="access_denied";class er extends _e{}er.errorCode="server_error";class Us extends _e{}Us.errorCode="temporarily_unavailable";class Fs extends _e{}Fs.errorCode="unsupported_response_type";class Vs extends _e{}Vs.errorCode="unsupported_token_type";class Hs extends _e{}Hs.errorCode="invalid_token";class Bs extends _e{}Bs.errorCode="method_not_allowed";class Js extends _e{}Js.errorCode="too_many_requests";class Yr extends _e{}Yr.errorCode="invalid_client_metadata";class Ks extends _e{}Ks.errorCode="insufficient_scope";class Ws extends _e{}Ws.errorCode="invalid_target";var Iv={[Ds.errorCode]:Ds,[Wr.errorCode]:Wr,[Gr.errorCode]:Gr,[Xr.errorCode]:Xr,[Ms.errorCode]:Ms,[qs.errorCode]:qs,[Ls.errorCode]:Ls,[er.errorCode]:er,[Us.errorCode]:Us,[Fs.errorCode]:Fs,[Vs.errorCode]:Vs,[Hs.errorCode]:Hs,[Bs.errorCode]:Bs,[Js.errorCode]:Js,[Yr.errorCode]:Yr,[Ks.errorCode]:Ks,[Ws.errorCode]:Ws};class tr extends Error{constructor(e){super(e??"Unauthorized")}}function NR(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var Cc="code",Ac="S256";function jR(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&NR(e.token_endpoint_auth_method)&&(t.length===0||t.includes(e.token_endpoint_auth_method)))return e.token_endpoint_auth_method;if(t.length===0)return r?"client_secret_basic":"none";if(r&&t.includes("client_secret_basic"))return"client_secret_basic";if(r&&t.includes("client_secret_post"))return"client_secret_post";if(t.includes("none"))return"none";return r?"client_secret_post":"none"}function ZR(e,t,r,n){let{client_id:o,client_secret:s}=t;switch(e){case"client_secret_basic":DR(o,s,r);return;case"client_secret_post":MR(o,s,n);return;case"none":qR(o,n);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function DR(e,t,r){if(!t)throw Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${n}`)}function MR(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function qR(e,t){t.set("client_id",e)}async function Av(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let n=Ev.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n;return new(Iv[o]||er)(s||"",i)}catch(n){let o=e instanceof Response?Zs(e,e.url):void 0,s=`${t?`HTTP ${t}: `:""}${o??`Invalid OAuth error response: ${n}. Raw body: ${r}`}`;return new er(s)}}function LR(e,t){let[r,n]=[e,t];try{[r,n]=[new URL(e).href,new URL(t).href]}catch{}return r===n||r.endsWith("/")&&r.slice(0,-1)===n||n.endsWith("/")&&n.slice(0,-1)===r}function Zc(e,t){if(!e)return;if(typeof e.issuer!=="string")return e.issuer==null?e:{...e,issuer:void 0};return LR(e.issuer,t)?e:void 0}var UR=Pv.omit({issuer:!0}),FR=Tv.omit({issuer:!0});function Nv(e,t){return Error(`OAuth client information is bound to authorization server ${e.issuer} and is not presented to ${t}. Clear the stored client information, or correct \`expectedIssuer\`, if the authorization server has moved.`)}async function Fn(e,t){try{return await Nc(e,t)}catch(r){if(r instanceof Wr||r instanceof Xr)return await e.invalidateCredentials?.("all"),await Nc(e,t);else if(r instanceof Gr)return await e.invalidateCredentials?.("tokens"),await Nc(e,t);throw r}}async function Nc(e,{serverUrl:t,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await e.discoveryState?.(),a,u,c,l=o;if(!l&&i?.resourceMetadataUrl)l=new URL(i.resourceMetadataUrl);if(i?.authorizationServerUrl){if(u=i.authorizationServerUrl,a=i.resourceMetadata,c=i.authorizationServerMetadata??await Zv(u,{fetchFn:s}),!a)try{a=await jv(t,{resourceMetadataUrl:l},s)}catch{}if(c!==i.authorizationServerMetadata||a!==i.resourceMetadata)await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}else{let F=await GR(t,{resourceMetadataUrl:l,fetchFn:s});u=F.authorizationServerUrl,c=F.authorizationServerMetadata,a=F.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=String(u),m=await HR(t,e,a),f=m&&a&&!e.validateResourceURL?a.resource:m,p=n||a?.scopes_supported?.join(" ")||e.clientMetadata.scope,g=await Promise.resolve(e.clientInformation()),_=Zc(g,d),y=e.saveClientInformation!==void 0&&!!e.redirectUrl;if(g&&!_&&!y)throw Nv(g,d);let k=_?.issuer==null?_:void 0,C=async()=>{try{if(k)await e.saveClientInformation?.({...k,issuer:d})}catch{}};if(!_){if(r!==void 0)throw Error("Existing OAuth client information is required when exchanging an authorization code");let F=c?.client_id_metadata_document_supported===!0,se=e.clientMetadataUrl;if(se&&!VR(se))throw new Yr(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${se}`);if(F&&se)_={client_id:se,issuer:d},await e.saveClientInformation?.(_);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");_={...await tO(u,{metadata:c,clientMetadata:e.clientMetadata,scope:p,fetchFn:s}),issuer:d},await e.saveClientInformation(_)}}let U=!e.redirectUrl;if(r!==void 0||U){let F=await eO(e,u,{metadata:c,resource:f,authorizationCode:r,fetchFn:s});return await C(),await e.saveTokens({...F,issuer:d}),"AUTHORIZED"}let b=Zc(await e.tokens(),d);if(b?.refresh_token&&b.issuer==null)console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and saveClientInformation() receive unchanged.");if(b?.refresh_token)try{let F=await QR(u,{metadata:c,clientInformation:_,refreshToken:b.refresh_token,resource:f,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await C(),await e.saveTokens({...F,issuer:d}),"AUTHORIZED"}catch(F){if(!(F instanceof _e)||F instanceof er);else throw F}let x=e.state?await e.state():void 0,{authorizationUrl:N,codeVerifier:Y}=await XR(u,{metadata:c,clientInformation:_,state:x,redirectUrl:e.redirectUrl,scope:p,resource:f});return await e.saveCodeVerifier(Y),await e.redirectToAuthorization(N),"REDIRECT"}function VR(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function HR(e,t,r){let n=Rv(e);if(t.validateResourceURL)return await t.validateResourceURL(n,r?.resource);if(!r)return;if(!Ov({requestedResource:n,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}function Dc(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,n]=t.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=jc(e,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=jc(e,"scope")||void 0,a=jc(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function jc(e,t){let r=e.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${t}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);if(o)return o[1]||o[2];return null}async function jv(e,t,r=fetch){let n=await KR(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Sv.parse(await n.json())}async function Mc(e,t,r=fetch){try{return await mr(r)(e,{headers:t})}catch(n){if(n instanceof TypeError)if(t)return Mc(e,void 0,r);else return;throw n}}function BR(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Cv(e,t,r=fetch){return await Mc(e,{"MCP-Protocol-Version":t},r)}function JR(e,t){return!e||!e.ok&&e.status<500&&t!=="/"}async function KR(e,t,r,n){let o=new URL(e),s=n?.protocolVersion??Rt,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let u=BR(t,o.pathname);i=new URL(u,n?.metadataServerUrl??o),i.search=o.search}let a=await Cv(i,s,r);if(!n?.metadataUrl&&JR(a,o.pathname)){let u=new URL(`/.well-known/${t}`,o);a=await Cv(u,s,r)}return a}function WR(e){let t=typeof e==="string"?new URL(e):e,r=t.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),n;let o=t.pathname;if(o.endsWith("/"))o=o.slice(0,-1);return n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,t.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,t.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,t.origin),type:"oidc"}),n}async function Zv(e,{fetchFn:t=fetch,protocolVersion:r=Rt}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=WR(e);for(let{url:s,type:i}of o){let a=await Mc(s,n,t);if(!a)continue;if(!a.ok){if(await a.body?.cancel(),a.status<500)continue;throw Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}if(i==="oauth")return Ic.parse(await a.json());else return kv.parse(await a.json())}return}async function GR(e,t){let r,n;try{if(r=await jv(e,{resourceMetadataUrl:t?.resourceMetadataUrl},t?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0)n=r.authorization_servers[0]}catch{}if(!n)n=String(new URL("/",e));let o=await Zv(n,{fetchFn:t?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}function Dv(e){return typeof e==="string"?e:e.href}async function XR(e,{metadata:t,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(t){if(a=new URL(t.authorization_endpoint),!t.response_types_supported.includes(Cc))throw Error(`Incompatible auth server: does not support response type ${Cc}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Ac))throw Error(`Incompatible auth server: does not support code challenge method ${Ac}`)}else a=new URL("/authorize",e);let u=await Oc(),{code_verifier:c,code_challenge:l}=u;if(a.searchParams.set("response_type",Cc),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",Ac),a.searchParams.set("redirect_uri",String(n)),s)a.searchParams.set("state",s);if(o)a.searchParams.set("scope",o);if(o?.includes("offline_access"))a.searchParams.append("prompt","consent");if(i)a.searchParams.set("resource",Dv(i));return{authorizationUrl:a,codeVerifier:c}}function YR(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Mv(e,{metadata:t,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:i}){let a=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s)r.set("resource",Dv(s));if(o)await o(u,r,a,t);else if(n){let l=t?.token_endpoint_auth_methods_supported??[],d=jR(n,l);ZR(d,n,u,r)}let c=await mr(i??fetch)(a,{method:"POST",headers:u,body:r});if(!c.ok)throw await Av(c);return UR.parse(await c.json())}async function QR(e,{metadata:t,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),u=await Mv(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...u}}async function eO(e,t,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=async()=>{let l=await e.clientInformation(),d=Zc(l,String(t));if(l&&!d)throw Nv(l,String(t));return d},a=await i(),u=e.clientMetadata.scope,c;if(e.prepareTokenRequest)c=await e.prepareTokenRequest(u);if(!c){if(!o)throw Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!e.redirectUrl)throw Error("redirectUrl is required for authorization_code flow");let l=await e.codeVerifier();c=YR(o,l,e.redirectUrl)}return a??(a=await i()),Mv(t,{metadata:r,tokenRequestParams:c,clientInformation:a,addClientAuthentication:e.addClientAuthentication,resource:n,fetchFn:s})}async function tO(e,{metadata:t,clientMetadata:r,scope:n,fetchFn:o}){let s;if(t){if(!t.registration_endpoint)throw Error("Incompatible auth server: does not support dynamic client registration");s=new URL(t.registration_endpoint)}else s=new URL("/register",e);let i=await mr(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await Av(i);return FR.parse(await i.json())}class Gs extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}}var qv=10,rO=13,hr=32;function qc(e){}function Fv(e){if(typeof e=="function")throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=qc,onError:r=qc,onRetry:n=qc,onComment:o,maxBufferSize:s}=e,i=[],a=0,u=!0,c,l="",d=0,m,f=!1;function p(b){if(f)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(u&&(u=!1,b.charCodeAt(0)===239&&b.charCodeAt(1)===187&&b.charCodeAt(2)===191&&(b=b.slice(3))),i.length===0){let Y=_(b);Y!==""&&(i.push(Y),a=Y.length),g();return}if(b.indexOf(`
|
|
70
|
+
`)===-1&&b.indexOf("\r")===-1){i.push(b),a+=b.length,g();return}i.push(b);let x=i.join("");i.length=0,a=0;let N=_(x);N!==""&&(i.push(N),a=N.length),g()}function g(){s!==void 0&&(a+l.length<=s||(f=!0,i.length=0,a=0,c=void 0,l="",d=0,m=void 0,r(new Gs(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function _(b){let x=0;if(b.indexOf("\r")===-1){let N=b.indexOf(`
|
|
71
|
+
`,x);for(;N!==-1;){if(x===N){d>0&&t({id:c,event:m,data:l}),c=void 0,l="",d=0,m=void 0,x=N+1,N=b.indexOf(`
|
|
72
|
+
`,x);continue}let Y=b.charCodeAt(x);if(Lv(b,x,Y)){let F=b.charCodeAt(x+5)===hr?x+6:x+5,se=b.slice(F,N);if(d===0&&b.charCodeAt(N+1)===qv){t({id:c,event:m,data:se}),c=void 0,l="",m=void 0,x=N+2,N=b.indexOf(`
|
|
73
|
+
`,x);continue}l=d===0?se:`${l}
|
|
74
|
+
${se}`,d++}else Uv(b,x,Y)?m=b.slice(b.charCodeAt(x+6)===hr?x+7:x+6,N)||void 0:y(b,x,N);x=N+1,N=b.indexOf(`
|
|
75
|
+
`,x)}return b.slice(x)}for(;x<b.length;){let N=b.indexOf("\r",x),Y=b.indexOf(`
|
|
76
|
+
`,x),F=-1;if(N!==-1&&Y!==-1?F=N<Y?N:Y:N!==-1?N===b.length-1?F=-1:F=N:Y!==-1&&(F=Y),F===-1)break;y(b,x,F),x=F+1,b.charCodeAt(x-1)===rO&&b.charCodeAt(x)===qv&&x++}return b.slice(x)}function y(b,x,N){if(x===N){C();return}let Y=b.charCodeAt(x);if(Lv(b,x,Y)){let zt=b.charCodeAt(x+5)===hr?x+6:x+5,Kc=b.slice(zt,N);l=d===0?Kc:`${l}
|
|
77
|
+
${Kc}`,d++;return}if(Uv(b,x,Y)){m=b.slice(b.charCodeAt(x+6)===hr?x+7:x+6,N)||void 0;return}if(Y===105&&b.charCodeAt(x+1)===100&&b.charCodeAt(x+2)===58){let zt=b.slice(b.charCodeAt(x+3)===hr?x+4:x+3,N);zt.includes("\x00")||(c=zt);return}if(Y===58){if(o){let zt=b.slice(x,N);o(zt.slice(b.charCodeAt(x+1)===hr?2:1))}return}let F=b.slice(x,N),se=F.indexOf(":");if(se===-1){k(F,"",F);return}let mt=F.slice(0,se),rr=F.charCodeAt(se+1)===hr?2:1,_r=F.slice(se+rr);k(mt,_r,F)}function k(b,x,N){switch(b){case"event":m=x||void 0;break;case"data":l=d===0?x:`${l}
|
|
78
|
+
${x}`,d++;break;case"id":x.includes("\x00")||(c=x);break;case"retry":/^\d+$/.test(x)?n(parseInt(x,10)):r(new Gs(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:N}));break;default:r(new Gs(`Unknown field "${b.length>20?`${b.slice(0,20)}…`:b}"`,{type:"unknown-field",field:b,value:x,line:N}));break}}function C(){d>0&&t({id:c,event:m,data:l}),c=void 0,l="",d=0,m=void 0}function U(b={}){if(b.consume&&i.length>0){let x=i.join("");y(x,0,x.length)}u=!0,c=void 0,l="",d=0,m=void 0,i.length=0,a=0,f=!1}return{feed:p,reset:U}}function Lv(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Uv(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class Lc extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:n}={}){let o;super({start(s){o=Fv({onEvent:(i)=>{s.enqueue(i)},onError(i){typeof e=="function"&&e(i),(e==="terminate"||i.type==="max-buffer-size-exceeded")&&s.error(i)},onRetry:t,onComment:r,maxBufferSize:n})},transform(s){o.feed(s)}})}}var nO={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};class gr extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`);this.code=e}}class Uc{constructor(e,t){if(this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=t?.requestInit,this._authProvider=t?.authProvider,this._fetch=t?.fetch,this._fetchWithInit=wv(t?.fetch,t?.requestInit),this._followRedirects=t?.redirectPolicy==="follow",this._followRedirects)this._fetch=Tc(this._fetch),this._fetchWithInit=Tc(this._fetchWithInit);this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??nO}_unfollowedRedirect(e,t){let r=Zs(e,t);return r&&!this._followRedirects?`${r} (redirectPolicy: 'same-origin')`:r}async _authThenStart(){if(!this._authProvider)throw new tr("No auth provider");let e;try{e=await Fn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(t){throw this.onerror?.(t),t}if(e!=="AUTHORIZED")throw new tr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let r=await this._authProvider.tokens();if(r)e.Authorization=`Bearer ${r.access_token}`}if(this._sessionId)e["mcp-session-id"]=this._sessionId;if(this._protocolVersion)e["mcp-protocol-version"]=this._protocolVersion;let t=Ns(this._requestInit?.headers);return new Headers({...e,...t})}async _startOrAuthSse(e){let{resumptionToken:t}=e;try{let r=await this._commonHeaders();if(r.set("Accept","text/event-stream"),t)r.set("last-event-id",t);let n=this._fetch??fetch,o={method:"GET",headers:r,signal:this._abortController?.signal},s=await n(this._url,this._followRedirects?o:{...o,redirect:"manual"}),i=this._followRedirects?void 0:js(n,this._url,o,s);if(i)s=await i;if(!s.ok){if(await s.body?.cancel(),s.status===401&&this._authProvider)return await this._authThenStart();if(s.status===405)return;throw new gr(s.status,`Failed to open SSE stream: ${this._unfollowedRedirect(s,this._url)??s.statusText}`)}this._handleSseStream(s.body,e,!0)}catch(r){throw this.onerror?.(r),r}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let t=this._reconnectionOptions.initialReconnectionDelay,r=this._reconnectionOptions.reconnectionDelayGrowFactor,n=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(r,e),n)}_scheduleReconnection(e,t=0){let r=this._reconnectionOptions.maxRetries;if(t>=r){this.onerror?.(Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let n=this._getNextReconnectionDelay(t);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch((o)=>{this.onerror?.(Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},n)}_handleSseStream(e,t,r){if(!e)return;let{onresumptiontoken:n,replayMessageId:o}=t,s,i=!1,a=!1;(async()=>{try{let c=e.pipeThrough(new TextDecoderStream).pipeThrough(new Lc({onRetry:(m)=>{this._serverRetryMs=m}})).getReader();while(!0){let{value:m,done:f}=await c.read();if(f)break;if(m.id)s=m.id,i=!0,n?.(m.id);if(!m.data)continue;if(!m.event||m.event==="message")try{let p=Pr.parse(JSON.parse(m.data));if(ir(p)){if(a=!0,o!==void 0)p.id=o}this.onmessage?.(p)}catch(p){this.onerror?.(p)}}if((r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(c){if(this.onerror?.(Error(`SSE stream disconnected: ${c}`)),(r||i)&&!a&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:s,onresumptiontoken:n,replayMessageId:o},0)}catch(m){this.onerror?.(Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new tr("No auth provider");if(await Fn(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tr("Failed to authorize")}async close(){if(this._reconnectionTimeout)clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0;this._abortController?.abort(),this.onclose?.()}async send(e,t){try{let{resumptionToken:r,onresumptiontoken:n}=t||{};if(r){this._startOrAuthSse({resumptionToken:r,replayMessageId:gn(e)?e.id:void 0}).catch((m)=>this.onerror?.(m));return}let o=await this._commonHeaders();o.set("content-type","application/json"),o.set("accept","application/json, text/event-stream");let s={...this._requestInit,method:"POST",headers:o,body:JSON.stringify(e),signal:this._abortController?.signal},i=await mr(this._fetch??fetch)(this._url,s),a=i.headers.get("mcp-session-id");if(a)this._sessionId=a;if(!i.ok){let m=await i.text().catch(()=>null);if(i.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new gr(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:p}=Dc(i);if(this._resourceMetadataUrl=f,this._scope=p,await Fn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new tr;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:p,error:g}=Dc(i);if(g==="insufficient_scope"){let _=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===_)throw new gr(403,"Server returned 403 after trying upscoping");if(p)this._scope=p;if(f)this._resourceMetadataUrl=f;if(this._lastUpscopingHeader=_??void 0,await Fn(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new tr;return this.send(e)}}throw new gr(i.status,`Error POSTing to endpoint: ${this._unfollowedRedirect(i,this._url)??m}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){if(await i.body?.cancel(),Kp(e))this._startOrAuthSse({resumptionToken:void 0}).catch((m)=>this.onerror?.(m));return}let c=(Array.isArray(e)?e:[e]).filter((m)=>("method"in m)&&("id"in m)&&m.id!==void 0).length>0,l=i.headers.get("content-type"),d=bv(l);if(c)if(d==="text/event-stream")this._handleSseStream(i.body,{onresumptiontoken:n},!1);else if(d==="application/json"){let m=await i.json(),f=Array.isArray(m)?m.map((p)=>Pr.parse(p)):[Pr.parse(m)];for(let p of f)this.onmessage?.(p)}else throw await i.body?.cancel(),new gr(-1,`Unexpected content type: ${l}`);else await i.body?.cancel()}catch(r){throw this.onerror?.(r),r}}get sessionId(){return this._sessionId}async terminateSession(){if(!this._sessionId)return;try{let e=await this._commonHeaders(),t={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},r=await mr(this._fetch??fetch)(this._url,t);if(await r.body?.cancel(),!r.ok&&r.status!==405)throw new gr(r.status,`Failed to terminate session: ${this._unfollowedRedirect(r,this._url)??r.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,t){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:t?.onresumptiontoken})}}class Fc{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some((c)=>c.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],u=a.some((c)=>c.type==="tool_use");if(s){if(o.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!u)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let c=new Set(a.filter((d)=>d.type==="tool_use").map((d)=>d.id)),l=new Set(o.filter((d)=>d.type==="tool_result").map((d)=>d.toolUseId));if(c.size!==l.size||![...c].every((d)=>l.has(d)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},ar,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let o=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Ct,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class Vc extends En{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Sn.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Un,this.setRequestHandler(ia,(r)=>this._oninitialize(r)),this.setNotificationHandler(Io,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler($a,async(r,n)=>{let o=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Sn.safeParse(s);if(i.success)this._loggingLevels.set(o,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Fc(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Lo(this._capabilities,e)}setRequestHandler(e,t){let n=zr(e)?.method;if(!n)throw Error("Schema is missing a method literal");let o=Sr(n);if(typeof o!=="string")throw Error("Schema method literal must be a string");if(o==="tools/call"){let i=async(a,u)=>{let c=Ee($n,a);if(!c.success){let f=c.error instanceof Error?c.error.message:String(c.error);throw new I(j.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let f=Ee(vt,d);if(!f.success){let p=f.error instanceof Error?f.error.message:String(f.error);throw new I(j.InvalidParams,`Invalid task creation result: ${p}`)}return f.data}let m=Ee(It,d);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new I(j.InvalidParams,`Invalid tools/call result: ${f}`)}return m.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw 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 Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Cs(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Is(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Eo.includes(t)?t:Rt,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"},yt)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],n=Array.isArray(r.content)?r.content:[r.content],o=n.some((u)=>u.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((u)=>u.type==="tool_use");if(o){if(n.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let u=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),c=new Set(n.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(u.size!==c.size||![...u].every((l)=>c.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},kn,t);return this.request({method:"sampling/createMessage",params:e},ar,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},Ct,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:n},Ct,t);if(o.action==="accept"&&o.content&&n.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!i.valid)throw new I(j.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof I)throw s;throw new I(j.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return o}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},Pa,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import Hv from"node:process";var oO=10485760;class Hc{constructor(e){this._maxBufferSize=e?.maxBufferSize??oO}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
79
|
+
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),sO(t)}clear(){this._buffer=void 0}}function sO(e){return Pr.parse(JSON.parse(e))}function Vv(e){return JSON.stringify(e)+`
|
|
80
|
+
`}class Bc{constructor(e=Hv.stdin,t=Hv.stdout,r){this._stdin=e,this._stdout=t,this._started=!1,this._ondata=(n)=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}},this._onerror=(n)=>{this.onerror?.(n)},this._readBuffer=new Hc({maxBufferSize:r?.maxBufferSize})}async start(){if(this._started)throw 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(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise((t)=>{let r=Vv(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var Jc={name:"@stophy/mcp",version:"2.1.0",description:"Give your agents the live web. One API to search the web, read what people say, and look up products, places, jobs and homes.",keywords:["ads","ai-agent","ai-agents","google-maps","google-search","linkedin","llm","mcp","mcp-server","reddit","stophy","transcripts","web-data","web-search","youtube"],homepage:"https://stophy.dev",bugs:{url:"https://github.com/stophydotdev/stophy/issues"},license:"MIT",repository:{type:"git",url:"git+https://github.com/stophydotdev/stophy.git",directory:"mcp"},bin:{"stophy-mcp":"dist/index.js"},files:["dist"],type:"module",publishConfig:{access:"public"},scripts:{build:"bun build ./src/index.ts --outfile ./dist/index.js --target node --minify --banner '#!/usr/bin/env node' && chmod +x ./dist/index.js",prepare:"bun run build",start:"node ./dist/index.js",dev:"bun run ./src/index.ts","check-types":"tsc --noEmit"},dependencies:{"@modelcontextprotocol/sdk":"^1.29.0"},devDependencies:{"@types/node":"^22.0.0",typescript:"^5.8.3"},engines:{node:">=18"},mcpName:"io.github.stophydotdev/mcp"};var aO="https://api.stophy.dev/mcp",cO=()=>{let e=process.env.STOPHY_MCP_URL??aO;try{return new URL(e)}catch{throw Error(`STOPHY_MCP_URL is not a valid URL: ${e}`)}},uO=()=>{let e=process.env.STOPHY_API_KEY?.trim();return e?{Authorization:`Bearer ${e}`}:{}},lO=async(e)=>{let t=new Ec({name:"stophy-mcp",version:Jc.version}),r=new Uc(e,{requestInit:{headers:uO()}});return await t.connect(r),t},dO=async()=>{let e=cO(),t;try{t=await lO(e)}catch(n){let o=n instanceof Error?n.message:String(n),s=/401|unauthorized/iu.test(o)?" Check STOPHY_API_KEY, or unset it to use the free endpoints only.":"";throw Error(`Could not connect to Stophy at ${e.origin}: ${o}.${s}`,{cause:n})}let r=new Vc({name:"stophy",version:Jc.version},{capabilities:{tools:{listChanged:!0}},instructions:t.getInstructions()});r.setRequestHandler(wa,(n)=>t.listTools(n.params)),r.setRequestHandler($n,(n)=>t.callTool(n.params)),t.setNotificationHandler(zn,()=>r.sendToolListChanged()),r.onclose=()=>{t.close()},await r.connect(new Bc)};dO().catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
|
|
46
81
|
`),process.exit(1)});
|