@stophy/mcp 1.0.5 → 2.0.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/dist/index.js CHANGED
@@ -1,42 +1,46 @@
1
1
  #!/usr/bin/env node
2
- var TB=Object.create;var{getPrototypeOf:ZB,defineProperty:S8,getOwnPropertyNames:vB}=Object;var kB=Object.prototype.hasOwnProperty;function _B(Q){return this[Q]}var xB,gB,SW=(Q,X,Y)=>{var W=Q!=null&&typeof Q==="object";if(W){var $=X?xB??=new WeakMap:gB??=new WeakMap,J=$.get(Q);if(J)return J}Y=Q!=null?TB(ZB(Q)):{};let G=X||!Q||!Q.__esModule?S8(Y,"default",{value:Q,enumerable:!0}):Y;for(let H of vB(Q))if(!kB.call(G,H))S8(G,H,{get:_B.bind(Q,H),enumerable:!0});if(W)$.set(Q,G);return G};var P=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var yB=(Q)=>Q;function hB(Q,X){this[Q]=yB.bind(null,X)}var P8=(Q,X)=>{for(var Y in X)S8(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:hB.bind(X,Y)})};var w4=P((P7)=>{Object.defineProperty(P7,"__esModule",{value:!0});P7.regexpCode=P7.getEsmExportName=P7.getProperty=P7.safeStringify=P7.stringify=P7.strConcat=P7.addCodeArg=P7.str=P7._=P7.nil=P7._Code=P7.Name=P7.IDENTIFIER=P7._CodeOrName=void 0;class l9{}P7._CodeOrName=l9;P7.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class P6 extends l9{constructor(Q){super();if(!P7.IDENTIFIER.test(Q))throw Error("CodeGen: name must be a valid identifier");this.str=Q}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}P7.Name=P6;class a0 extends l9{constructor(Q){super();this._items=typeof Q==="string"?[Q]:Q}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let Q=this._items[0];return Q===""||Q==='""'}get str(){var Q;return(Q=this._str)!==null&&Q!==void 0?Q:this._str=this._items.reduce((X,Y)=>`${X}${Y}`,"")}get names(){var Q;return(Q=this._names)!==null&&Q!==void 0?Q:this._names=this._items.reduce((X,Y)=>{if(Y instanceof P6)X[Y.str]=(X[Y.str]||0)+1;return X},{})}}P7._Code=a0;P7.nil=new a0("");function E7(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)DY(Y,X[W]),Y.push(Q[++W]);return new a0(Y)}P7._=E7;var KY=new a0("+");function S7(Q,...X){let Y=[N4(Q[0])],W=0;while(W<X.length)Y.push(KY),DY(Y,X[W]),Y.push(KY,N4(Q[++W]));return hL(Y),new a0(Y)}P7.str=S7;function DY(Q,X){if(X instanceof a0)Q.push(...X._items);else if(X instanceof P6)Q.push(X);else Q.push(lL(X))}P7.addCodeArg=DY;function hL(Q){let X=1;while(X<Q.length-1){if(Q[X]===KY){let Y=fL(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function fL(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof P6||Q[Q.length-1]!=='"')return;if(typeof X!="string")return`${Q.slice(0,-1)}${X}"`;if(X[0]==='"')return Q.slice(0,-1)+X.slice(1);return}if(typeof X=="string"&&X[0]==='"'&&!(Q instanceof P6))return`"${Q}${X.slice(1)}`;return}function uL(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:S7`${Q}${X}`}P7.strConcat=uL;function lL(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:N4(Array.isArray(Q)?Q.join(","):Q)}function mL(Q){return new a0(N4(Q))}P7.stringify=mL;function N4(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}P7.safeStringify=N4;function cL(Q){return typeof Q=="string"&&P7.IDENTIFIER.test(Q)?new a0(`.${Q}`):E7`[${Q}]`}P7.getProperty=cL;function pL(Q){if(typeof Q=="string"&&P7.IDENTIFIER.test(Q))return new a0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}P7.getEsmExportName=pL;function iL(Q){return new a0(Q.toString())}P7.regexpCode=iL});var VY=P((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});T7.ValueScope=T7.ValueScopeName=T7.Scope=T7.varKinds=T7.UsedValueState=void 0;var C0=w4();class R7 extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var c9;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(c9||(T7.UsedValueState=c9={}));T7.varKinds={const:new C0.Name("const"),let:new C0.Name("let"),var:new C0.Name("var")};class qY{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof C0.Name?Q:this.name(Q)}name(Q){return new C0.Name(this._newName(Q))}_newName(Q){let X=this._names[Q]||this._nameGroup(Q);return`${Q}${X.index++}`}_nameGroup(Q){var X,Y;if(((Y=(X=this._parent)===null||X===void 0?void 0:X._prefixes)===null||Y===void 0?void 0:Y.has(Q))||this._prefixes&&!this._prefixes.has(Q))throw Error(`CodeGen: prefix "${Q}" is not allowed in this scope`);return this._names[Q]={prefix:Q,index:0}}}T7.Scope=qY;class FY extends C0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:Y}){this.value=Q,this.scopePath=C0._`.${new C0.Name(X)}[${Y}]`}}T7.ValueScopeName=FY;var $q=C0._`\n`;class C7 extends qY{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?$q:C0.nil}}get(){return this._scope}name(Q){return new FY(Q,this._newName(Q))}value(Q,X){var Y;if(X.ref===void 0)throw Error("CodeGen: ref must be passed in value");let W=this.toName(Q),{prefix:$}=W,J=(Y=X.key)!==null&&Y!==void 0?Y:X.ref,G=this._values[$];if(G){let z=G.get(J);if(z)return z}else G=this._values[$]=new Map;G.set(J,W);let H=this._scope[$]||(this._scope[$]=[]),B=H.length;return H[B]=X.ref,W.setValue(X,{property:$,itemIndex:B}),W}getValue(Q,X){let Y=this._values[Q];if(!Y)return;return Y.get(X)}scopeRefs(Q,X=this._values){return this._reduceValues(X,(Y)=>{if(Y.scopePath===void 0)throw Error(`CodeGen: name "${Y}" has no value`);return C0._`${Q}${Y.scopePath}`})}scopeCode(Q=this._values,X,Y){return this._reduceValues(Q,(W)=>{if(W.value===void 0)throw Error(`CodeGen: name "${W}" has no value`);return W.value.code},X,Y)}_reduceValues(Q,X,Y={},W){let $=C0.nil;for(let J in Q){let G=Q[J];if(!G)continue;let H=Y[J]=Y[J]||new Map;G.forEach((B)=>{if(H.has(B))return;H.set(B,c9.Started);let z=X(B);if(z){let A=this.opts.es5?T7.varKinds.var:T7.varKinds.const;$=C0._`${$}${A} ${B} = ${z};${this.opts._n}`}else if(z=W===null||W===void 0?void 0:W(B))$=C0._`${$}${z}${this.opts._n}`;else throw new R7(B);H.set(B,c9.Completed)})}return $}}T7.ValueScope=C7});var l=P((T0)=>{Object.defineProperty(T0,"__esModule",{value:!0});T0.or=T0.and=T0.not=T0.CodeGen=T0.operators=T0.varKinds=T0.ValueScopeName=T0.ValueScope=T0.Scope=T0.Name=T0.regexpCode=T0.stringify=T0.getProperty=T0.nil=T0.strConcat=T0.str=T0._=void 0;var d=w4(),s0=VY(),R1=w4();Object.defineProperty(T0,"_",{enumerable:!0,get:function(){return R1._}});Object.defineProperty(T0,"str",{enumerable:!0,get:function(){return R1.str}});Object.defineProperty(T0,"strConcat",{enumerable:!0,get:function(){return R1.strConcat}});Object.defineProperty(T0,"nil",{enumerable:!0,get:function(){return R1.nil}});Object.defineProperty(T0,"getProperty",{enumerable:!0,get:function(){return R1.getProperty}});Object.defineProperty(T0,"stringify",{enumerable:!0,get:function(){return R1.stringify}});Object.defineProperty(T0,"regexpCode",{enumerable:!0,get:function(){return R1.regexpCode}});Object.defineProperty(T0,"Name",{enumerable:!0,get:function(){return R1.Name}});var r9=VY();Object.defineProperty(T0,"Scope",{enumerable:!0,get:function(){return r9.Scope}});Object.defineProperty(T0,"ValueScope",{enumerable:!0,get:function(){return r9.ValueScope}});Object.defineProperty(T0,"ValueScopeName",{enumerable:!0,get:function(){return r9.ValueScopeName}});Object.defineProperty(T0,"varKinds",{enumerable:!0,get:function(){return r9.varKinds}});T0.operators={GT:new d._Code(">"),GTE:new d._Code(">="),LT:new d._Code("<"),LTE:new d._Code("<="),EQ:new d._Code("==="),NEQ:new d._Code("!=="),NOT:new d._Code("!"),OR:new d._Code("||"),AND:new d._Code("&&"),ADD:new d._Code("+")};class C1{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class v7 extends C1{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?s0.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${Y} ${this.name}${W};`+X}optimizeNames(Q,X){if(!Q[this.name.str])return;if(this.rhs)this.rhs=R6(this.rhs,Q,X);return this}get names(){return this.rhs instanceof d._CodeOrName?this.rhs.names:{}}}class NY extends C1{constructor(Q,X,Y){super();this.lhs=Q,this.rhs=X,this.sideEffects=Y}render({_n:Q}){return`${this.lhs} = ${this.rhs};`+Q}optimizeNames(Q,X){if(this.lhs instanceof d.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=R6(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof d.Name?{}:{...this.lhs.names};return o9(Q,this.rhs)}}class k7 extends NY{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class _7 extends C1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class x7 extends C1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class g7 extends C1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class y7 extends C1{constructor(Q){super();this.code=Q}render({_n:Q}){return`${this.code};`+Q}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Q,X){return this.code=R6(this.code,Q,X),this}get names(){return this.code instanceof d._CodeOrName?this.code.names:{}}}class t9 extends C1{constructor(Q=[]){super();this.nodes=Q}render(Q){return this.nodes.reduce((X,Y)=>X+Y.render(Q),"")}optimizeNodes(){let{nodes:Q}=this,X=Q.length;while(X--){let Y=Q[X].optimizeNodes();if(Array.isArray(Y))Q.splice(X,1,...Y);else if(Y)Q[X]=Y;else Q.splice(X,1)}return Q.length>0?this:void 0}optimizeNames(Q,X){let{nodes:Y}=this,W=Y.length;while(W--){let $=Y[W];if($.optimizeNames(Q,X))continue;Bq(Q,$.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>o1(Q,X.names),{})}}class T1 extends t9{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class h7 extends t9{}class M4 extends T1{}M4.kind="else";class D1 extends T1{constructor(Q,X){super(X);this.condition=Q}render(Q){let X=`if(${this.condition})`+super.render(Q);if(this.else)X+="else "+this.else.render(Q);return X}optimizeNodes(){super.optimizeNodes();let Q=this.condition;if(Q===!0)return this.nodes;let X=this.else;if(X){let Y=X.optimizeNodes();X=this.else=Array.isArray(Y)?new M4(Y):Y}if(X){if(Q===!1)return X instanceof D1?X:X.nodes;if(this.nodes.length)return this;return new D1(c7(Q),X instanceof D1?[X]:X.nodes)}if(Q===!1||!this.nodes.length)return;return this}optimizeNames(Q,X){var Y;if(this.else=(Y=this.else)===null||Y===void 0?void 0:Y.optimizeNames(Q,X),!(super.optimizeNames(Q,X)||this.else))return;return this.condition=R6(this.condition,Q,X),this}get names(){let Q=super.names;if(o9(Q,this.condition),this.else)o1(Q,this.else.names);return Q}}D1.kind="if";class I6 extends T1{}I6.kind="for";class f7 extends I6{constructor(Q){super();this.iteration=Q}render(Q){return`for(${this.iteration})`+super.render(Q)}optimizeNames(Q,X){if(!super.optimizeNames(Q,X))return;return this.iteration=R6(this.iteration,Q,X),this}get names(){return o1(super.names,this.iteration.names)}}class u7 extends I6{constructor(Q,X,Y,W){super();this.varKind=Q,this.name=X,this.from=Y,this.to=W}render(Q){let X=Q.es5?s0.varKinds.var:this.varKind,{name:Y,from:W,to:$}=this;return`for(${X} ${Y}=${W}; ${Y}<${$}; ${Y}++)`+super.render(Q)}get names(){let Q=o9(super.names,this.from);return o9(Q,this.to)}}class UY extends I6{constructor(Q,X,Y,W){super();this.loop=Q,this.varKind=X,this.name=Y,this.iterable=W}render(Q){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(Q)}optimizeNames(Q,X){if(!super.optimizeNames(Q,X))return;return this.iterable=R6(this.iterable,Q,X),this}get names(){return o1(super.names,this.iterable.names)}}class p9 extends T1{constructor(Q,X,Y){super();this.name=Q,this.args=X,this.async=Y}render(Q){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Q)}}p9.kind="func";class i9 extends t9{render(Q){return"return "+super.render(Q)}}i9.kind="return";class l7 extends T1{render(Q){let X="try"+super.render(Q);if(this.catch)X+=this.catch.render(Q);if(this.finally)X+=this.finally.render(Q);return X}optimizeNodes(){var Q,X;return super.optimizeNodes(),(Q=this.catch)===null||Q===void 0||Q.optimizeNodes(),(X=this.finally)===null||X===void 0||X.optimizeNodes(),this}optimizeNames(Q,X){var Y,W;return super.optimizeNames(Q,X),(Y=this.catch)===null||Y===void 0||Y.optimizeNames(Q,X),(W=this.finally)===null||W===void 0||W.optimizeNames(Q,X),this}get names(){let Q=super.names;if(this.catch)o1(Q,this.catch.names);if(this.finally)o1(Q,this.finally.names);return Q}}class n9 extends T1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}n9.kind="catch";class d9 extends T1{render(Q){return"finally"+super.render(Q)}}d9.kind="finally";class m7{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
3
- `:""},this._extScope=Q,this._scope=new s0.Scope({parent:Q}),this._nodes=[new h7]}toString(){return this._root.render(this.opts)}name(Q){return this._scope.name(Q)}scopeName(Q){return this._extScope.name(Q)}scopeValue(Q,X){let Y=this._extScope.value(Q,X);return(this._values[Y.prefix]||(this._values[Y.prefix]=new Set)).add(Y),Y}getScopeValue(Q,X){return this._extScope.getValue(Q,X)}scopeRefs(Q){return this._extScope.scopeRefs(Q,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(Q,X,Y,W){let $=this._scope.toName(X);if(Y!==void 0&&W)this._constants[$.str]=Y;return this._leafNode(new v7(Q,$,Y)),$}const(Q,X,Y){return this._def(s0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(s0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(s0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new NY(Q,X,Y))}add(Q,X){return this._leafNode(new k7(Q,T0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==d.nil)this._leafNode(new y7(Q));return this}object(...Q){let X=["{"];for(let[Y,W]of Q){if(X.length>1)X.push(",");if(X.push(Y),Y!==W||this.opts.es5)X.push(":"),(0,d.addCodeArg)(X,W)}return X.push("}"),new d._Code(X)}if(Q,X,Y){if(this._blockNode(new D1(Q)),X&&Y)this.code(X).else().code(Y).endIf();else if(X)this.code(X).endIf();else if(Y)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(Q){return this._elseNode(new D1(Q))}else(){return this._elseNode(new M4)}endIf(){return this._endBlockNode(D1,M4)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new f7(Q),X)}forRange(Q,X,Y,W,$=this.opts.es5?s0.varKinds.var:s0.varKinds.let){let J=this._scope.toName(Q);return this._for(new u7($,J,X,Y),()=>W(J))}forOf(Q,X,Y,W=s0.varKinds.const){let $=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof d.Name?X:this.var("_arr",X);return this.forRange("_i",0,d._`${J}.length`,(G)=>{this.var($,d._`${J}[${G}]`),Y($)})}return this._for(new UY("of",W,$,X),()=>Y($))}forIn(Q,X,Y,W=this.opts.es5?s0.varKinds.var:s0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,d._`Object.keys(${X})`,Y);let $=this._scope.toName(Q);return this._for(new UY("in",W,$,X),()=>Y($))}endFor(){return this._endBlockNode(I6)}label(Q){return this._leafNode(new _7(Q))}break(Q){return this._leafNode(new x7(Q))}return(Q){let X=new i9;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(i9)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new l7;if(this._blockNode(W),this.code(Q),X){let $=this.name("e");this._currNode=W.catch=new n9($),X($)}if(Y)this._currNode=W.finally=new d9,this.code(Y);return this._endBlockNode(n9,d9)}throw(Q){return this._leafNode(new g7(Q))}block(Q,X){if(this._blockStarts.push(this._nodes.length),Q)this.code(Q).endBlock(X);return this}endBlock(Q){let X=this._blockStarts.pop();if(X===void 0)throw Error("CodeGen: not in self-balancing block");let Y=this._nodes.length-X;if(Y<0||Q!==void 0&&Y!==Q)throw Error(`CodeGen: wrong number of nodes: ${Y} vs ${Q} expected`);return this._nodes.length=X,this}func(Q,X=d.nil,Y,W){if(this._blockNode(new p9(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(p9)}optimize(Q=1){while(Q-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(Q){return this._currNode.nodes.push(Q),this}_blockNode(Q){this._currNode.nodes.push(Q),this._nodes.push(Q)}_endBlockNode(Q,X){let Y=this._currNode;if(Y instanceof Q||X&&Y instanceof X)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${X?`${Q.kind}/${X.kind}`:Q.kind}"`)}_elseNode(Q){let X=this._currNode;if(!(X instanceof D1))throw Error('CodeGen: "else" without "if"');return this._currNode=X.else=Q,this}get _root(){return this._nodes[0]}get _currNode(){let Q=this._nodes;return Q[Q.length-1]}set _currNode(Q){let X=this._nodes;X[X.length-1]=Q}}T0.CodeGen=m7;function o1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function o9(Q,X){return X instanceof d._CodeOrName?o1(Q,X.names):Q}function R6(Q,X,Y){if(Q instanceof d.Name)return W(Q);if(!$(Q))return Q;return new d._Code(Q._items.reduce((J,G)=>{if(G instanceof d.Name)G=W(G);if(G instanceof d._Code)J.push(...G._items);else J.push(G);return J},[]));function W(J){let G=Y[J.str];if(G===void 0||X[J.str]!==1)return J;return delete X[J.str],G}function $(J){return J instanceof d._Code&&J._items.some((G)=>G instanceof d.Name&&X[G.str]===1&&Y[G.str]!==void 0)}}function Bq(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function c7(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:d._`!${OY(Q)}`}T0.not=c7;var zq=p7(T0.operators.AND);function Aq(...Q){return Q.reduce(zq)}T0.and=Aq;var Kq=p7(T0.operators.OR);function Dq(...Q){return Q.reduce(Kq)}T0.or=Dq;function p7(Q){return(X,Y)=>X===d.nil?Y:Y===d.nil?X:d._`${OY(X)} ${Q} ${OY(Y)}`}function OY(Q){return Q instanceof d.Name?Q:d._`(${Q})`}});var o=P((e7)=>{Object.defineProperty(e7,"__esModule",{value:!0});e7.checkStrictMode=e7.getErrorPath=e7.Type=e7.useFunc=e7.setEvaluated=e7.evaluatedPropsToName=e7.mergeEvaluated=e7.eachItem=e7.unescapeJsonPointer=e7.escapeJsonPointer=e7.escapeFragment=e7.unescapeFragment=e7.schemaRefOrVal=e7.schemaHasRulesButRef=e7.schemaHasRules=e7.checkUnknownRules=e7.alwaysValidSchema=e7.toHash=void 0;var e=l(),Vq=w4();function Uq(Q){let X={};for(let Y of Q)X[Y]=!0;return X}e7.toHash=Uq;function Oq(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return o7(Q,X),!r7(X,Q.self.RULES.all)}e7.alwaysValidSchema=Oq;function o7(Q,X=Q.schema){let{opts:Y,self:W}=Q;if(!Y.strictSchema)return;if(typeof X==="boolean")return;let $=W.RULES.keywords;for(let J in X)if(!$[J])s7(Q,`unknown keyword: "${J}"`)}e7.checkUnknownRules=o7;function r7(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}e7.schemaHasRules=r7;function Nq(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}e7.schemaHasRulesButRef=Nq;function wq({topSchemaRef:Q,schemaPath:X},Y,W,$){if(!$){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return e._`${Y}`}return e._`${Q}${X}${(0,e.getProperty)(W)}`}e7.schemaRefOrVal=wq;function Mq(Q){return t7(decodeURIComponent(Q))}e7.unescapeFragment=Mq;function jq(Q){return encodeURIComponent(MY(Q))}e7.escapeFragment=jq;function MY(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}e7.escapeJsonPointer=MY;function t7(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}e7.unescapeJsonPointer=t7;function bq(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}e7.eachItem=bq;function n7({mergeNames:Q,mergeToName:X,mergeValues:Y,resultToName:W}){return($,J,G,H)=>{let B=G===void 0?J:G instanceof e.Name?(J instanceof e.Name?Q($,J,G):X($,J,G),G):J instanceof e.Name?(X($,G,J),J):Y(J,G);return H===e.Name&&!(B instanceof e.Name)?W($,B):B}}e7.mergeEvaluated={props:n7({mergeNames:(Q,X,Y)=>Q.if(e._`${Y} !== true && ${X} !== undefined`,()=>{Q.if(e._`${X} === true`,()=>Q.assign(Y,!0),()=>Q.assign(Y,e._`${Y} || {}`).code(e._`Object.assign(${Y}, ${X})`))}),mergeToName:(Q,X,Y)=>Q.if(e._`${Y} !== true`,()=>{if(X===!0)Q.assign(Y,!0);else Q.assign(Y,e._`${Y} || {}`),jY(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:a7}),items:n7({mergeNames:(Q,X,Y)=>Q.if(e._`${Y} !== true && ${X} !== undefined`,()=>Q.assign(Y,e._`${X} === true ? true : ${Y} > ${X} ? ${Y} : ${X}`)),mergeToName:(Q,X,Y)=>Q.if(e._`${Y} !== true`,()=>Q.assign(Y,X===!0?!0:e._`${Y} > ${X} ? ${Y} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function a7(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",e._`{}`);if(X!==void 0)jY(Q,Y,X);return Y}e7.evaluatedPropsToName=a7;function jY(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(e._`${X}${(0,e.getProperty)(W)}`,!0))}e7.setEvaluated=jY;var d7={};function Eq(Q,X){return Q.scopeValue("func",{ref:X,code:d7[X.code]||(d7[X.code]=new Vq._Code(X.code))})}e7.useFunc=Eq;var wY;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(wY||(e7.Type=wY={}));function Sq(Q,X,Y){if(Q instanceof e.Name){let W=X===wY.Num;return Y?W?e._`"[" + ${Q} + "]"`:e._`"['" + ${Q} + "']"`:W?e._`"/" + ${Q}`:e._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,e.getProperty)(Q).toString():"/"+MY(Q)}e7.getErrorPath=Sq;function s7(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}e7.checkStrictMode=s7});var L1=P((XG)=>{Object.defineProperty(XG,"__esModule",{value:!0});var M0=l(),cq={data:new M0.Name("data"),valCxt:new M0.Name("valCxt"),instancePath:new M0.Name("instancePath"),parentData:new M0.Name("parentData"),parentDataProperty:new M0.Name("parentDataProperty"),rootData:new M0.Name("rootData"),dynamicAnchors:new M0.Name("dynamicAnchors"),vErrors:new M0.Name("vErrors"),errors:new M0.Name("errors"),this:new M0.Name("this"),self:new M0.Name("self"),scope:new M0.Name("scope"),json:new M0.Name("json"),jsonPos:new M0.Name("jsonPos"),jsonLen:new M0.Name("jsonLen"),jsonPart:new M0.Name("jsonPart")};XG.default=cq});var j4=P((JG)=>{Object.defineProperty(JG,"__esModule",{value:!0});JG.extendErrors=JG.resetErrorsCount=JG.reportExtraError=JG.reportError=JG.keyword$DataError=JG.keywordError=void 0;var r=l(),s9=o(),S0=L1();JG.keywordError={message:({keyword:Q})=>r.str`must pass "${Q}" keyword validation`};JG.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?r.str`"${Q}" keyword must be ${X} ($data)`:r.str`"${Q}" keyword is invalid ($data)`};function iq(Q,X=JG.keywordError,Y,W){let{it:$}=Q,{gen:J,compositeRule:G,allErrors:H}=$,B=$G(Q,X,Y);if(W!==null&&W!==void 0?W:G||H)YG(J,B);else WG($,r._`[${B}]`)}JG.reportError=iq;function nq(Q,X=JG.keywordError,Y){let{it:W}=Q,{gen:$,compositeRule:J,allErrors:G}=W,H=$G(Q,X,Y);if(YG($,H),!(J||G))WG(W,S0.default.vErrors)}JG.reportExtraError=nq;function dq(Q,X){Q.assign(S0.default.errors,X),Q.if(r._`${S0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(r._`${S0.default.vErrors}.length`,X),()=>Q.assign(S0.default.vErrors,null)))}JG.resetErrorsCount=dq;function oq({gen:Q,keyword:X,schemaValue:Y,data:W,errsCount:$,it:J}){if($===void 0)throw Error("ajv implementation error");let G=Q.name("err");Q.forRange("i",$,S0.default.errors,(H)=>{if(Q.const(G,r._`${S0.default.vErrors}[${H}]`),Q.if(r._`${G}.instancePath === undefined`,()=>Q.assign(r._`${G}.instancePath`,(0,r.strConcat)(S0.default.instancePath,J.errorPath))),Q.assign(r._`${G}.schemaPath`,r.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(r._`${G}.schema`,Y),Q.assign(r._`${G}.data`,W)})}JG.extendErrors=oq;function YG(Q,X){let Y=Q.const("err",X);Q.if(r._`${S0.default.vErrors} === null`,()=>Q.assign(S0.default.vErrors,r._`[${Y}]`),r._`${S0.default.vErrors}.push(${Y})`),Q.code(r._`${S0.default.errors}++`)}function WG(Q,X){let{gen:Y,validateName:W,schemaEnv:$}=Q;if($.$async)Y.throw(r._`new ${Q.ValidationError}(${X})`);else Y.assign(r._`${W}.errors`,X),Y.return(!1)}var r1={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 $G(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return r._`{}`;return rq(Q,X,Y)}function rq(Q,X,Y={}){let{gen:W,it:$}=Q,J=[tq($,Y),aq(Q,Y)];return sq(Q,X,J),W.object(...J)}function tq({errorPath:Q},{instancePath:X}){let Y=X?r.str`${Q}${(0,s9.getErrorPath)(X,s9.Type.Str)}`:Q;return[S0.default.instancePath,(0,r.strConcat)(S0.default.instancePath,Y)]}function aq({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let $=W?X:r.str`${X}/${Q}`;if(Y)$=r.str`${$}${(0,s9.getErrorPath)(Y,s9.Type.Str)}`;return[r1.schemaPath,$]}function sq(Q,{params:X,message:Y},W){let{keyword:$,data:J,schemaValue:G,it:H}=Q,{opts:B,propertyName:z,topSchemaRef:A,schemaPath:D}=H;if(W.push([r1.keyword,$],[r1.params,typeof X=="function"?X(Q):X||r._`{}`]),B.messages)W.push([r1.message,typeof Y=="function"?Y(Q):Y]);if(B.verbose)W.push([r1.schema,G],[r1.parentSchema,r._`${A}${D}`],[S0.default.data,J]);if(z)W.push([r1.propertyName,z])}});var AG=P((BG)=>{Object.defineProperty(BG,"__esModule",{value:!0});BG.boolOrEmptySchema=BG.topBoolOrEmptySchema=void 0;var WF=j4(),$F=l(),JF=L1(),GF={message:"boolean schema is false"};function HF(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)HG(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(JF.default.data);else X.assign($F._`${W}.errors`,null),X.return(!0)}BG.topBoolOrEmptySchema=HF;function BF(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),HG(Q);else Y.var(X,!0)}BG.boolOrEmptySchema=BF;function HG(Q,X){let{gen:Y,data:W}=Q,$={gen:Y,keyword:"false schema",data:W,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:Q};(0,WF.reportError)($,GF,void 0,X)}});var EY=P((KG)=>{Object.defineProperty(KG,"__esModule",{value:!0});KG.getRules=KG.isJSONType=void 0;var AF=["string","number","integer","boolean","null","object","array"],KF=new Set(AF);function DF(Q){return typeof Q=="string"&&KF.has(Q)}KG.isJSONType=DF;function LF(){let Q={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...Q,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},Q.number,Q.string,Q.array,Q.object],post:{rules:[]},all:{},keywords:{}}}KG.getRules=LF});var SY=P((FG)=>{Object.defineProperty(FG,"__esModule",{value:!0});FG.shouldUseRule=FG.shouldUseGroup=FG.schemaHasRulesForType=void 0;function FF({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&LG(Q,W)}FG.schemaHasRulesForType=FF;function LG(Q,X){return X.rules.some((Y)=>qG(Q,Y))}FG.shouldUseGroup=LG;function qG(Q,X){var Y;return Q[X.keyword]!==void 0||((Y=X.definition.implements)===null||Y===void 0?void 0:Y.some((W)=>Q[W]!==void 0))}FG.shouldUseRule=qG});var b4=P((wG)=>{Object.defineProperty(wG,"__esModule",{value:!0});wG.reportTypeError=wG.checkDataTypes=wG.checkDataType=wG.coerceAndCheckDataType=wG.getJSONTypes=wG.getSchemaTypes=wG.DataType=void 0;var OF=EY(),NF=SY(),wF=j4(),u=l(),UG=o(),C6;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(C6||(wG.DataType=C6={}));function MF(Q){let X=OG(Q.type);if(X.includes("null")){if(Q.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!X.length&&Q.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(Q.nullable===!0)X.push("null")}return X}wG.getSchemaTypes=MF;function OG(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(OF.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}wG.getJSONTypes=OG;function jF(Q,X){let{gen:Y,data:W,opts:$}=Q,J=bF(X,$.coerceTypes),G=X.length>0&&!(J.length===0&&X.length===1&&(0,NF.schemaHasRulesForType)(Q,X[0]));if(G){let H=IY(X,W,$.strictNumbers,C6.Wrong);Y.if(H,()=>{if(J.length)EF(Q,X,J);else RY(Q)})}return G}wG.coerceAndCheckDataType=jF;var NG=new Set(["string","number","integer","boolean","null"]);function bF(Q,X){return X?Q.filter((Y)=>NG.has(Y)||X==="array"&&Y==="array"):[]}function EF(Q,X,Y){let{gen:W,data:$,opts:J}=Q,G=W.let("dataType",u._`typeof ${$}`),H=W.let("coerced",u._`undefined`);if(J.coerceTypes==="array")W.if(u._`${G} == 'object' && Array.isArray(${$}) && ${$}.length == 1`,()=>W.assign($,u._`${$}[0]`).assign(G,u._`typeof ${$}`).if(IY(X,$,J.strictNumbers),()=>W.assign(H,$)));W.if(u._`${H} !== undefined`);for(let z of Y)if(NG.has(z)||z==="array"&&J.coerceTypes==="array")B(z);W.else(),RY(Q),W.endIf(),W.if(u._`${H} !== undefined`,()=>{W.assign($,H),SF(Q,H)});function B(z){switch(z){case"string":W.elseIf(u._`${G} == "number" || ${G} == "boolean"`).assign(H,u._`"" + ${$}`).elseIf(u._`${$} === null`).assign(H,u._`""`);return;case"number":W.elseIf(u._`${G} == "boolean" || ${$} === null
4
- || (${G} == "string" && ${$} && ${$} == +${$})`).assign(H,u._`+${$}`);return;case"integer":W.elseIf(u._`${G} === "boolean" || ${$} === null
5
- || (${G} === "string" && ${$} && ${$} == +${$} && !(${$} % 1))`).assign(H,u._`+${$}`);return;case"boolean":W.elseIf(u._`${$} === "false" || ${$} === 0 || ${$} === null`).assign(H,!1).elseIf(u._`${$} === "true" || ${$} === 1`).assign(H,!0);return;case"null":W.elseIf(u._`${$} === "" || ${$} === 0 || ${$} === false`),W.assign(H,null);return;case"array":W.elseIf(u._`${G} === "string" || ${G} === "number"
6
- || ${G} === "boolean" || ${$} === null`).assign(H,u._`[${$}]`)}}}function SF({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(u._`${X} !== undefined`,()=>Q.assign(u._`${X}[${Y}]`,W))}function PY(Q,X,Y,W=C6.Correct){let $=W===C6.Correct?u.operators.EQ:u.operators.NEQ,J;switch(Q){case"null":return u._`${X} ${$} null`;case"array":J=u._`Array.isArray(${X})`;break;case"object":J=u._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=G(u._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=G();break;default:return u._`typeof ${X} ${$} ${Q}`}return W===C6.Correct?J:(0,u.not)(J);function G(H=u.nil){return(0,u.and)(u._`typeof ${X} == "number"`,H,Y?u._`isFinite(${X})`:u.nil)}}wG.checkDataType=PY;function IY(Q,X,Y,W){if(Q.length===1)return PY(Q[0],X,Y,W);let $,J=(0,UG.toHash)(Q);if(J.array&&J.object){let G=u._`typeof ${X} != "object"`;$=J.null?G:u._`!${X} || ${G}`,delete J.null,delete J.array,delete J.object}else $=u.nil;if(J.number)delete J.integer;for(let G in J)$=(0,u.and)($,PY(G,X,Y,W));return $}wG.checkDataTypes=IY;var PF={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?u._`{type: ${Q}}`:u._`{type: ${X}}`};function RY(Q){let X=IF(Q);(0,wF.reportError)(X,PF)}wG.reportTypeError=RY;function IF(Q){let{gen:X,data:Y,schema:W}=Q,$=(0,UG.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:$,schemaValue:$,parentSchema:W,params:{},it:Q}}});var SG=P((bG)=>{Object.defineProperty(bG,"__esModule",{value:!0});bG.assignDefaults=void 0;var T6=l(),_F=o();function xF(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let $ in Y)jG(Q,$,Y[$].default);else if(X==="array"&&Array.isArray(W))W.forEach(($,J)=>jG(Q,J,$.default))}bG.assignDefaults=xF;function jG(Q,X,Y){let{gen:W,compositeRule:$,data:J,opts:G}=Q;if(Y===void 0)return;let H=T6._`${J}${(0,T6.getProperty)(X)}`;if($){(0,_F.checkStrictMode)(Q,`default is ignored for: ${H}`);return}let B=T6._`${H} === undefined`;if(G.useDefaults==="empty")B=T6._`${B} || ${H} === null || ${H} === ""`;W.if(B,T6._`${H} = ${(0,T6.stringify)(Y)}`)}});var l0=P((RG)=>{Object.defineProperty(RG,"__esModule",{value:!0});RG.validateUnion=RG.validateArray=RG.usePattern=RG.callValidateCode=RG.schemaProperties=RG.allSchemaProperties=RG.noPropertyInData=RG.propertyInData=RG.isOwnProperty=RG.hasPropFunc=RG.reportMissingProp=RG.checkMissingProp=RG.checkReportMissingProp=void 0;var $0=l(),CY=o(),Z1=L1(),gF=o();function yF(Q,X){let{gen:Y,data:W,it:$}=Q;Y.if(ZY(Y,W,X,$.opts.ownProperties),()=>{Q.setParams({missingProperty:$0._`${X}`},!0),Q.error()})}RG.checkReportMissingProp=yF;function hF({gen:Q,data:X,it:{opts:Y}},W,$){return(0,$0.or)(...W.map((J)=>(0,$0.and)(ZY(Q,X,J,Y.ownProperties),$0._`${$} = ${J}`)))}RG.checkMissingProp=hF;function fF(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}RG.reportMissingProp=fF;function PG(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:$0._`Object.prototype.hasOwnProperty`})}RG.hasPropFunc=PG;function TY(Q,X,Y){return $0._`${PG(Q)}.call(${X}, ${Y})`}RG.isOwnProperty=TY;function uF(Q,X,Y,W){let $=$0._`${X}${(0,$0.getProperty)(Y)} !== undefined`;return W?$0._`${$} && ${TY(Q,X,Y)}`:$}RG.propertyInData=uF;function ZY(Q,X,Y,W){let $=$0._`${X}${(0,$0.getProperty)(Y)} === undefined`;return W?(0,$0.or)($,(0,$0.not)(TY(Q,X,Y))):$}RG.noPropertyInData=ZY;function IG(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}RG.allSchemaProperties=IG;function lF(Q,X){return IG(X).filter((Y)=>!(0,CY.alwaysValidSchema)(Q,X[Y]))}RG.schemaProperties=lF;function mF({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:$,errorPath:J},it:G},H,B,z){let A=z?$0._`${Q}, ${X}, ${W}${$}`:X,D=[[Z1.default.instancePath,(0,$0.strConcat)(Z1.default.instancePath,J)],[Z1.default.parentData,G.parentData],[Z1.default.parentDataProperty,G.parentDataProperty],[Z1.default.rootData,Z1.default.rootData]];if(G.opts.dynamicRef)D.push([Z1.default.dynamicAnchors,Z1.default.dynamicAnchors]);let L=$0._`${A}, ${Y.object(...D)}`;return B!==$0.nil?$0._`${H}.call(${B}, ${L})`:$0._`${H}(${L})`}RG.callValidateCode=mF;var cF=$0._`new RegExp`;function pF({gen:Q,it:{opts:X}},Y){let W=X.unicodeRegExp?"u":"",{regExp:$}=X.code,J=$(Y,W);return Q.scopeValue("pattern",{key:J.toString(),ref:J,code:$0._`${$.code==="new RegExp"?cF:(0,gF.useFunc)(Q,$)}(${Y}, ${W})`})}RG.usePattern=pF;function iF(Q){let{gen:X,data:Y,keyword:W,it:$}=Q,J=X.name("valid");if($.allErrors){let H=X.let("valid",!0);return G(()=>X.assign(H,!1)),H}return X.var(J,!0),G(()=>X.break()),J;function G(H){let B=X.const("len",$0._`${Y}.length`);X.forRange("i",0,B,(z)=>{Q.subschema({keyword:W,dataProp:z,dataPropType:CY.Type.Num},J),X.if((0,$0.not)(J),H)})}}RG.validateArray=iF;function nF(Q){let{gen:X,schema:Y,keyword:W,it:$}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((B)=>(0,CY.alwaysValidSchema)($,B))&&!$.opts.unevaluated)return;let G=X.let("valid",!1),H=X.name("_valid");X.block(()=>Y.forEach((B,z)=>{let A=Q.subschema({keyword:W,schemaProp:z,compositeRule:!0},H);if(X.assign(G,$0._`${G} || ${H}`),!Q.mergeValidEvaluated(A,H))X.if((0,$0.not)(G))})),Q.result(G,()=>Q.reset(),()=>Q.error(!0))}RG.validateUnion=nF});var _G=P((vG)=>{Object.defineProperty(vG,"__esModule",{value:!0});vG.validateKeywordUsage=vG.validSchemaType=vG.funcKeywordCode=vG.macroKeywordCode=void 0;var P0=l(),t1=L1(),JV=l0(),GV=j4();function HV(Q,X){let{gen:Y,keyword:W,schema:$,parentSchema:J,it:G}=Q,H=X.macro.call(G.self,$,J,G),B=ZG(Y,W,H);if(G.opts.validateSchema!==!1)G.self.validateSchema(H,!0);let z=Y.name("valid");Q.subschema({schema:H,schemaPath:P0.nil,errSchemaPath:`${G.errSchemaPath}/${W}`,topSchemaRef:B,compositeRule:!0},z),Q.pass(z,()=>Q.error(!0))}vG.macroKeywordCode=HV;function BV(Q,X){var Y;let{gen:W,keyword:$,schema:J,parentSchema:G,$data:H,it:B}=Q;AV(B,X);let z=!H&&X.compile?X.compile.call(B.self,J,G,B):X.validate,A=ZG(W,$,z),D=W.let("valid");Q.block$data(D,L),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:D);function L(){if(X.errors===!1){if(F(),X.modifying)TG(Q);N(()=>Q.error())}else{let O=X.async?K():q();if(X.modifying)TG(Q);N(()=>zV(Q,O))}}function K(){let O=W.let("ruleErrs",null);return W.try(()=>F(P0._`await `),(b)=>W.assign(D,!1).if(P0._`${b} instanceof ${B.ValidationError}`,()=>W.assign(O,P0._`${b}.errors`),()=>W.throw(b))),O}function q(){let O=P0._`${A}.errors`;return W.assign(O,null),F(P0.nil),O}function F(O=X.async?P0._`await `:P0.nil){let b=B.opts.passContext?t1.default.this:t1.default.self,E=!(("compile"in X)&&!H||X.schema===!1);W.assign(D,P0._`${O}${(0,JV.callValidateCode)(Q,A,b,E)}`,X.modifying)}function N(O){var b;W.if((0,P0.not)((b=X.valid)!==null&&b!==void 0?b:D),O)}}vG.funcKeywordCode=BV;function TG(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,P0._`${W.parentData}[${W.parentDataProperty}]`))}function zV(Q,X){let{gen:Y}=Q;Y.if(P0._`Array.isArray(${X})`,()=>{Y.assign(t1.default.vErrors,P0._`${t1.default.vErrors} === null ? ${X} : ${t1.default.vErrors}.concat(${X})`).assign(t1.default.errors,P0._`${t1.default.vErrors}.length`),(0,GV.extendErrors)(Q)},()=>Q.error())}function AV({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function ZG(Q,X,Y){if(Y===void 0)throw Error(`keyword "${X}" failed to compile`);return Q.scopeValue("keyword",typeof Y=="function"?{ref:Y}:{ref:Y,code:(0,P0.stringify)(Y)})}function KV(Q,X,Y=!1){return!X.length||X.some((W)=>W==="array"?Array.isArray(Q):W==="object"?Q&&typeof Q=="object"&&!Array.isArray(Q):typeof Q==W||Y&&typeof Q>"u")}vG.validSchemaType=KV;function DV({schema:Q,opts:X,self:Y,errSchemaPath:W},$,J){if(Array.isArray($.keyword)?!$.keyword.includes(J):$.keyword!==J)throw Error("ajv implementation error");let G=$.dependencies;if(G===null||G===void 0?void 0:G.some((H)=>!Object.prototype.hasOwnProperty.call(Q,H)))throw Error(`parent schema must have dependencies of ${J}: ${G.join(",")}`);if($.validateSchema){if(!$.validateSchema(Q[J])){let B=`keyword "${J}" value is invalid at path "${W}": `+Y.errorsText($.validateSchema.errors);if(X.validateSchema==="log")Y.logger.error(B);else throw Error(B)}}}vG.validateKeywordUsage=DV});var hG=P((gG)=>{Object.defineProperty(gG,"__esModule",{value:!0});gG.extendSubschemaMode=gG.extendSubschemaData=gG.getSubschema=void 0;var H1=l(),xG=o();function VV(Q,{keyword:X,schemaProp:Y,schema:W,schemaPath:$,errSchemaPath:J,topSchemaRef:G}){if(X!==void 0&&W!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(X!==void 0){let H=Q.schema[X];return Y===void 0?{schema:H,schemaPath:H1._`${Q.schemaPath}${(0,H1.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:H[Y],schemaPath:H1._`${Q.schemaPath}${(0,H1.getProperty)(X)}${(0,H1.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,xG.escapeFragment)(Y)}`}}if(W!==void 0){if($===void 0||J===void 0||G===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:$,topSchemaRef:G,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}gG.getSubschema=VV;function UV(Q,X,{dataProp:Y,dataPropType:W,data:$,dataTypes:J,propertyName:G}){if($!==void 0&&Y!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:H}=X;if(Y!==void 0){let{errorPath:z,dataPathArr:A,opts:D}=X,L=H.let("data",H1._`${X.data}${(0,H1.getProperty)(Y)}`,!0);B(L),Q.errorPath=H1.str`${z}${(0,xG.getErrorPath)(Y,W,D.jsPropertySyntax)}`,Q.parentDataProperty=H1._`${Y}`,Q.dataPathArr=[...A,Q.parentDataProperty]}if($!==void 0){let z=$ instanceof H1.Name?$:H.let("data",$,!0);if(B(z),G!==void 0)Q.propertyName=G}if(J)Q.dataTypes=J;function B(z){Q.data=z,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,z]}}gG.extendSubschemaData=UV;function OV(Q,{jtdDiscriminator:X,jtdMetadata:Y,compositeRule:W,createErrors:$,allErrors:J}){if(W!==void 0)Q.compositeRule=W;if($!==void 0)Q.createErrors=$;if(J!==void 0)Q.allErrors=J;Q.jtdDiscriminator=X,Q.jtdMetadata=Y}gG.extendSubschemaMode=OV});var vY=P((dI,fG)=>{fG.exports=function Q(X,Y){if(X===Y)return!0;if(X&&Y&&typeof X=="object"&&typeof Y=="object"){if(X.constructor!==Y.constructor)return!1;var W,$,J;if(Array.isArray(X)){if(W=X.length,W!=Y.length)return!1;for($=W;$--!==0;)if(!Q(X[$],Y[$]))return!1;return!0}if(X.constructor===RegExp)return X.source===Y.source&&X.flags===Y.flags;if(X.valueOf!==Object.prototype.valueOf)return X.valueOf()===Y.valueOf();if(X.toString!==Object.prototype.toString)return X.toString()===Y.toString();if(J=Object.keys(X),W=J.length,W!==Object.keys(Y).length)return!1;for($=W;$--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,J[$]))return!1;for($=W;$--!==0;){var G=J[$];if(!Q(X[G],Y[G]))return!1}return!0}return X!==X&&Y!==Y}});var lG=P((oI,uG)=>{var v1=uG.exports=function(Q,X,Y){if(typeof X=="function")Y=X,X={};Y=X.cb||Y;var W=typeof Y=="function"?Y:Y.pre||function(){},$=Y.post||function(){};e9(X,W,$,Q,"",Q)};v1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};v1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};v1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};v1.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 e9(Q,X,Y,W,$,J,G,H,B,z){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,$,J,G,H,B,z);for(var A in W){var D=W[A];if(Array.isArray(D)){if(A in v1.arrayKeywords)for(var L=0;L<D.length;L++)e9(Q,X,Y,D[L],$+"/"+A+"/"+L,J,$,A,W,L)}else if(A in v1.propsKeywords){if(D&&typeof D=="object")for(var K in D)e9(Q,X,Y,D[K],$+"/"+A+"/"+MV(K),J,$,A,W,K)}else if(A in v1.keywords||Q.allKeys&&!(A in v1.skipKeywords))e9(Q,X,Y,D,$+"/"+A,J,$,A,W)}Y(W,$,J,G,H,B,z)}}function MV(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var E4=P((iG)=>{Object.defineProperty(iG,"__esModule",{value:!0});iG.getSchemaRefs=iG.resolveUrl=iG.normalizeId=iG._getFullPath=iG.getFullPath=iG.inlineRef=void 0;var jV=o(),bV=vY(),EV=lG(),SV=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function PV(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!kY(Q);if(!X)return!1;return mG(Q)<=X}iG.inlineRef=PV;var IV=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function kY(Q){for(let X in Q){if(IV.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(kY))return!0;if(typeof Y=="object"&&kY(Y))return!0}return!1}function mG(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,SV.has(Y))continue;if(typeof Q[Y]=="object")(0,jV.eachItem)(Q[Y],(W)=>X+=mG(W));if(X===1/0)return 1/0}return X}function cG(Q,X="",Y){if(Y!==!1)X=Z6(X);let W=Q.parse(X);return pG(Q,W)}iG.getFullPath=cG;function pG(Q,X){return Q.serialize(X).split("#")[0]+"#"}iG._getFullPath=pG;var RV=/#\/?$/;function Z6(Q){return Q?Q.replace(RV,""):""}iG.normalizeId=Z6;function CV(Q,X,Y){return Y=Z6(Y),Q.resolve(X,Y)}iG.resolveUrl=CV;var TV=/^[a-z_][-a-z0-9._]*$/i;function ZV(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,$=Z6(Q[Y]||X),J={"":$},G=cG(W,$,!1),H={},B=new Set;return EV(Q,{allKeys:!0},(D,L,K,q)=>{if(q===void 0)return;let F=G+L,N=J[q];if(typeof D[Y]=="string")N=O.call(this,D[Y]);b.call(this,D.$anchor),b.call(this,D.$dynamicAnchor),J[L]=N;function O(E){let y=this.opts.uriResolver.resolve;if(E=Z6(N?y(N,E):E),B.has(E))throw A(E);B.add(E);let x=this.refs[E];if(typeof x=="string")x=this.refs[x];if(typeof x=="object")z(D,x.schema,E);else if(E!==Z6(F))if(E[0]==="#")z(D,H[E],E),H[E]=D;else this.refs[E]=F;return E}function b(E){if(typeof E=="string"){if(!TV.test(E))throw Error(`invalid anchor "${E}"`);O.call(this,`#${E}`)}}}),H;function z(D,L,K){if(L!==void 0&&!bV(D,L))throw A(K)}function A(D){return Error(`reference "${D}" resolves to more than one schema`)}}iG.getSchemaRefs=ZV});var I4=P((H5)=>{Object.defineProperty(H5,"__esModule",{value:!0});H5.getData=H5.KeywordCxt=H5.validateFunctionCode=void 0;var aG=AG(),dG=b4(),xY=SY(),Q8=b4(),yV=SG(),P4=_G(),_Y=hG(),Z=l(),h=L1(),hV=E4(),q1=o(),S4=j4();function fV(Q){if(Q5(Q)){if(X5(Q),eG(Q)){mV(Q);return}}sG(Q,()=>(0,aG.topBoolOrEmptySchema)(Q))}H5.validateFunctionCode=fV;function sG({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:$},J){if($.code.es5)Q.func(X,Z._`${h.default.data}, ${h.default.valCxt}`,W.$async,()=>{Q.code(Z._`"use strict"; ${oG(Y,$)}`),lV(Q,$),Q.code(J)});else Q.func(X,Z._`${h.default.data}, ${uV($)}`,W.$async,()=>Q.code(oG(Y,$)).code(J))}function uV(Q){return Z._`{${h.default.instancePath}="", ${h.default.parentData}, ${h.default.parentDataProperty}, ${h.default.rootData}=${h.default.data}${Q.dynamicRef?Z._`, ${h.default.dynamicAnchors}={}`:Z.nil}}={}`}function lV(Q,X){Q.if(h.default.valCxt,()=>{if(Q.var(h.default.instancePath,Z._`${h.default.valCxt}.${h.default.instancePath}`),Q.var(h.default.parentData,Z._`${h.default.valCxt}.${h.default.parentData}`),Q.var(h.default.parentDataProperty,Z._`${h.default.valCxt}.${h.default.parentDataProperty}`),Q.var(h.default.rootData,Z._`${h.default.valCxt}.${h.default.rootData}`),X.dynamicRef)Q.var(h.default.dynamicAnchors,Z._`${h.default.valCxt}.${h.default.dynamicAnchors}`)},()=>{if(Q.var(h.default.instancePath,Z._`""`),Q.var(h.default.parentData,Z._`undefined`),Q.var(h.default.parentDataProperty,Z._`undefined`),Q.var(h.default.rootData,h.default.data),X.dynamicRef)Q.var(h.default.dynamicAnchors,Z._`{}`)})}function mV(Q){let{schema:X,opts:Y,gen:W}=Q;sG(Q,()=>{if(Y.$comment&&X.$comment)W5(Q);if(dV(Q),W.let(h.default.vErrors,null),W.let(h.default.errors,0),Y.unevaluated)cV(Q);Y5(Q),tV(Q)});return}function cV(Q){let{gen:X,validateName:Y}=Q;Q.evaluated=X.const("evaluated",Z._`${Y}.evaluated`),X.if(Z._`${Q.evaluated}.dynamicProps`,()=>X.assign(Z._`${Q.evaluated}.props`,Z._`undefined`)),X.if(Z._`${Q.evaluated}.dynamicItems`,()=>X.assign(Z._`${Q.evaluated}.items`,Z._`undefined`))}function oG(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?Z._`/*# sourceURL=${Y} */`:Z.nil}function pV(Q,X){if(Q5(Q)){if(X5(Q),eG(Q)){iV(Q,X);return}}(0,aG.boolOrEmptySchema)(Q,X)}function eG({schema:Q,self:X}){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X.RULES.all[Y])return!0;return!1}function Q5(Q){return typeof Q.schema!="boolean"}function iV(Q,X){let{schema:Y,gen:W,opts:$}=Q;if($.$comment&&Y.$comment)W5(Q);oV(Q),rV(Q);let J=W.const("_errs",h.default.errors);Y5(Q,J),W.var(X,Z._`${J} === ${h.default.errors}`)}function X5(Q){(0,q1.checkUnknownRules)(Q),nV(Q)}function Y5(Q,X){if(Q.opts.jtd)return rG(Q,[],!1,X);let Y=(0,dG.getSchemaTypes)(Q.schema),W=(0,dG.coerceAndCheckDataType)(Q,Y);rG(Q,Y,!W,X)}function nV(Q){let{schema:X,errSchemaPath:Y,opts:W,self:$}=Q;if(X.$ref&&W.ignoreKeywordsWithRef&&(0,q1.schemaHasRulesButRef)(X,$.RULES))$.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function dV(Q){let{schema:X,opts:Y}=Q;if(X.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,q1.checkStrictMode)(Q,"default is ignored in the schema root")}function oV(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,hV.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function rV(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function W5({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:$}){let J=Y.$comment;if($.$comment===!0)Q.code(Z._`${h.default.self}.logger.log(${J})`);else if(typeof $.$comment=="function"){let G=Z.str`${W}/$comment`,H=Q.scopeValue("root",{ref:X.root});Q.code(Z._`${h.default.self}.opts.$comment(${J}, ${G}, ${H}.schema)`)}}function tV(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:$,opts:J}=Q;if(Y.$async)X.if(Z._`${h.default.errors} === 0`,()=>X.return(h.default.data),()=>X.throw(Z._`new ${$}(${h.default.vErrors})`));else{if(X.assign(Z._`${W}.errors`,h.default.vErrors),J.unevaluated)aV(Q);X.return(Z._`${h.default.errors} === 0`)}}function aV({gen:Q,evaluated:X,props:Y,items:W}){if(Y instanceof Z.Name)Q.assign(Z._`${X}.props`,Y);if(W instanceof Z.Name)Q.assign(Z._`${X}.items`,W)}function rG(Q,X,Y,W){let{gen:$,schema:J,data:G,allErrors:H,opts:B,self:z}=Q,{RULES:A}=z;if(J.$ref&&(B.ignoreKeywordsWithRef||!(0,q1.schemaHasRulesButRef)(J,A))){$.block(()=>J5(Q,"$ref",A.all.$ref.definition));return}if(!B.jtd)sV(Q,X);$.block(()=>{for(let L of A.rules)D(L);D(A.post)});function D(L){if(!(0,xY.shouldUseGroup)(J,L))return;if(L.type){if($.if((0,Q8.checkDataType)(L.type,G,B.strictNumbers)),tG(Q,L),X.length===1&&X[0]===L.type&&Y)$.else(),(0,Q8.reportTypeError)(Q);$.endIf()}else tG(Q,L);if(!H)$.if(Z._`${h.default.errors} === ${W||0}`)}}function tG(Q,X){let{gen:Y,schema:W,opts:{useDefaults:$}}=Q;if($)(0,yV.assignDefaults)(Q,X.type);Y.block(()=>{for(let J of X.rules)if((0,xY.shouldUseRule)(W,J))J5(Q,J.keyword,J.definition,X.type)})}function sV(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(eV(Q,X),!Q.opts.allowUnionTypes)QU(Q,X);XU(Q,Q.dataTypes)}function eV(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!$5(Q.dataTypes,Y))gY(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),WU(Q,X)}function QU(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))gY(Q,"use allowUnionTypes to allow union type keyword")}function XU(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let $=Y[W];if(typeof $=="object"&&(0,xY.shouldUseRule)(Q.schema,$)){let{type:J}=$.definition;if(J.length&&!J.some((G)=>YU(X,G)))gY(Q,`missing type "${J.join(",")}" for keyword "${W}"`)}}}function YU(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function $5(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function WU(Q,X){let Y=[];for(let W of Q.dataTypes)if($5(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function gY(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,q1.checkStrictMode)(Q,X,Q.opts.strictTypes)}class yY{constructor(Q,X,Y){if((0,P4.validateKeywordUsage)(Q,X,Y),this.gen=Q.gen,this.allErrors=Q.allErrors,this.keyword=Y,this.data=Q.data,this.schema=Q.schema[Y],this.$data=X.$data&&Q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,q1.schemaRefOrVal)(Q,this.schema,Y,this.$data),this.schemaType=X.schemaType,this.parentSchema=Q.schema,this.params={},this.it=Q,this.def=X,this.$data)this.schemaCode=Q.gen.const("vSchema",G5(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,P4.validSchemaType)(this.schema,X.schemaType,X.allowUndefined))throw Error(`${Y} value must be ${JSON.stringify(X.schemaType)}`);if("code"in X?X.trackErrors:X.errors!==!1)this.errsCount=Q.gen.const("_errs",h.default.errors)}result(Q,X,Y){this.failResult((0,Z.not)(Q),X,Y)}failResult(Q,X,Y){if(this.gen.if(Q),Y)Y();else this.error();if(X){if(this.gen.else(),X(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(Q,X){this.failResult((0,Z.not)(Q),void 0,X)}fail(Q){if(Q===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(Q),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(Q){if(!this.$data)return this.fail(Q);let{schemaCode:X}=this;this.fail(Z._`${X} !== undefined && (${(0,Z.or)(this.invalid$data(),Q)})`)}error(Q,X,Y){if(X){this.setParams(X),this._error(Q,Y),this.setParams({});return}this._error(Q,Y)}_error(Q,X){(Q?S4.reportExtraError:S4.reportError)(this,this.def.error,X)}$dataError(){(0,S4.reportError)(this,this.def.$dataError||S4.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,S4.resetErrorsCount)(this.gen,this.errsCount)}ok(Q){if(!this.allErrors)this.gen.if(Q)}setParams(Q,X){if(X)Object.assign(this.params,Q);else this.params=Q}block$data(Q,X,Y=Z.nil){this.gen.block(()=>{this.check$data(Q,Y),X()})}check$data(Q=Z.nil,X=Z.nil){if(!this.$data)return;let{gen:Y,schemaCode:W,schemaType:$,def:J}=this;if(Y.if((0,Z.or)(Z._`${W} === undefined`,X)),Q!==Z.nil)Y.assign(Q,!0);if($.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),Q!==Z.nil)Y.assign(Q,!1)}Y.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:Y,def:W,it:$}=this;return(0,Z.or)(J(),G());function J(){if(Y.length){if(!(X instanceof Z.Name))throw Error("ajv implementation error");let H=Array.isArray(Y)?Y:[Y];return Z._`${(0,Q8.checkDataTypes)(H,X,$.opts.strictNumbers,Q8.DataType.Wrong)}`}return Z.nil}function G(){if(W.validateSchema){let H=Q.scopeValue("validate$data",{ref:W.validateSchema});return Z._`!${H}(${X})`}return Z.nil}}subschema(Q,X){let Y=(0,_Y.getSubschema)(this.it,Q);(0,_Y.extendSubschemaData)(Y,this.it,Q),(0,_Y.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return pV(W,X),W}mergeEvaluated(Q,X){let{it:Y,gen:W}=this;if(!Y.opts.unevaluated)return;if(Y.props!==!0&&Q.props!==void 0)Y.props=q1.mergeEvaluated.props(W,Q.props,Y.props,X);if(Y.items!==!0&&Q.items!==void 0)Y.items=q1.mergeEvaluated.items(W,Q.items,Y.items,X)}mergeValidEvaluated(Q,X){let{it:Y,gen:W}=this;if(Y.opts.unevaluated&&(Y.props!==!0||Y.items!==!0))return W.if(X,()=>this.mergeEvaluated(Q,Z.Name)),!0}}H5.KeywordCxt=yY;function J5(Q,X,Y,W){let $=new yY(Q,Y,X);if("code"in Y)Y.code($,W);else if($.$data&&Y.validate)(0,P4.funcKeywordCode)($,Y);else if("macro"in Y)(0,P4.macroKeywordCode)($,Y);else if(Y.compile||Y.validate)(0,P4.funcKeywordCode)($,Y)}var $U=/^\/(?:[^~]|~0|~1)*$/,JU=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function G5(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let $,J;if(Q==="")return h.default.rootData;if(Q[0]==="/"){if(!$U.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);$=Q,J=h.default.rootData}else{let z=JU.exec(Q);if(!z)throw Error(`Invalid JSON-pointer: ${Q}`);let A=+z[1];if($=z[2],$==="#"){if(A>=X)throw Error(B("property/index",A));return W[X-A]}if(A>X)throw Error(B("data",A));if(J=Y[X-A],!$)return J}let G=J,H=$.split("/");for(let z of H)if(z)J=Z._`${J}${(0,Z.getProperty)((0,q1.unescapeJsonPointer)(z))}`,G=Z._`${G} && ${J}`;return G;function B(z,A){return`Cannot access ${z} ${A} levels up, current level is ${X}`}}H5.getData=G5});var X8=P((A5)=>{Object.defineProperty(A5,"__esModule",{value:!0});class z5 extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}A5.default=z5});var R4=P((D5)=>{Object.defineProperty(D5,"__esModule",{value:!0});var hY=E4();class K5 extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,hY.resolveUrl)(Q,X,Y),this.missingSchema=(0,hY.normalizeId)((0,hY.getFullPath)(Q,this.missingRef))}}D5.default=K5});var W8=P((F5)=>{Object.defineProperty(F5,"__esModule",{value:!0});F5.resolveSchema=F5.getCompilingSchema=F5.resolveRef=F5.compileSchema=F5.SchemaEnv=void 0;var e0=l(),AU=X8(),a1=L1(),Q1=E4(),L5=o(),KU=I4();class C4{constructor(Q){var X;this.refs={},this.dynamicAnchors={};let Y;if(typeof Q.schema=="object")Y=Q.schema;this.schema=Q.schema,this.schemaId=Q.schemaId,this.root=Q.root||this,this.baseId=(X=Q.baseId)!==null&&X!==void 0?X:(0,Q1.normalizeId)(Y===null||Y===void 0?void 0:Y[Q.schemaId||"$id"]),this.schemaPath=Q.schemaPath,this.localRefs=Q.localRefs,this.meta=Q.meta,this.$async=Y===null||Y===void 0?void 0:Y.$async,this.refs={}}}F5.SchemaEnv=C4;function uY(Q){let X=q5.call(this,Q);if(X)return X;let Y=(0,Q1.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:$}=this.opts.code,{ownProperties:J}=this.opts,G=new e0.CodeGen(this.scope,{es5:W,lines:$,ownProperties:J}),H;if(Q.$async)H=G.scopeValue("Error",{ref:AU.default,code:e0._`require("ajv/dist/runtime/validation_error").default`});let B=G.scopeName("validate");Q.validateName=B;let z={gen:G,allErrors:this.opts.allErrors,data:a1.default.data,parentData:a1.default.parentData,parentDataProperty:a1.default.parentDataProperty,dataNames:[a1.default.data],dataPathArr:[e0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:G.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,e0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:B,ValidationError:H,schema:Q.schema,schemaEnv:Q,rootId:Y,baseId:Q.baseId||Y,schemaPath:e0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:e0._`""`,opts:this.opts,self:this},A;try{this._compilations.add(Q),(0,KU.validateFunctionCode)(z),G.optimize(this.opts.code.optimize);let D=G.toString();if(A=`${G.scopeRefs(a1.default.scope)}return ${D}`,this.opts.code.process)A=this.opts.code.process(A,Q);let K=Function(`${a1.default.self}`,`${a1.default.scope}`,A)(this,this.scope.get());if(this.scope.value(B,{ref:K}),K.errors=null,K.schema=Q.schema,K.schemaEnv=Q,Q.$async)K.$async=!0;if(this.opts.code.source===!0)K.source={validateName:B,validateCode:D,scopeValues:G._values};if(this.opts.unevaluated){let{props:q,items:F}=z;if(K.evaluated={props:q instanceof e0.Name?void 0:q,items:F instanceof e0.Name?void 0:F,dynamicProps:q instanceof e0.Name,dynamicItems:F instanceof e0.Name},K.source)K.source.evaluated=(0,e0.stringify)(K.evaluated)}return Q.validate=K,Q}catch(D){if(delete Q.validate,delete Q.validateName,A)this.logger.error("Error compiling schema, function code:",A);throw D}finally{this._compilations.delete(Q)}}F5.compileSchema=uY;function DU(Q,X,Y){var W;Y=(0,Q1.resolveUrl)(this.opts.uriResolver,X,Y);let $=Q.refs[Y];if($)return $;let J=FU.call(this,Q,Y);if(J===void 0){let G=(W=Q.localRefs)===null||W===void 0?void 0:W[Y],{schemaId:H}=this.opts;if(G)J=new C4({schema:G,schemaId:H,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[Y]=LU.call(this,J)}F5.resolveRef=DU;function LU(Q){if((0,Q1.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:uY.call(this,Q)}function q5(Q){for(let X of this._compilations)if(qU(X,Q))return X}F5.getCompilingSchema=q5;function qU(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function FU(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||Y8.call(this,Q,X)}function Y8(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,Q1._getFullPath)(this.opts.uriResolver,Y),$=(0,Q1.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===$)return fY.call(this,Y,Q);let J=(0,Q1.normalizeId)(W),G=this.refs[J]||this.schemas[J];if(typeof G=="string"){let H=Y8.call(this,Q,G);if(typeof(H===null||H===void 0?void 0:H.schema)!=="object")return;return fY.call(this,Y,H)}if(typeof(G===null||G===void 0?void 0:G.schema)!=="object")return;if(!G.validate)uY.call(this,G);if(J===(0,Q1.normalizeId)(X)){let{schema:H}=G,{schemaId:B}=this.opts,z=H[B];if(z)$=(0,Q1.resolveUrl)(this.opts.uriResolver,$,z);return new C4({schema:H,schemaId:B,root:Q,baseId:$})}return fY.call(this,Y,G)}F5.resolveSchema=Y8;var VU=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function fY(Q,{baseId:X,schema:Y,root:W}){var $;if((($=Q.fragment)===null||$===void 0?void 0:$[0])!=="/")return;for(let H of Q.fragment.slice(1).split("/")){if(typeof Y==="boolean")return;let B=Y[(0,L5.unescapeFragment)(H)];if(B===void 0)return;Y=B;let z=typeof Y==="object"&&Y[this.opts.schemaId];if(!VU.has(H)&&z)X=(0,Q1.resolveUrl)(this.opts.uriResolver,X,z)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,L5.schemaHasRulesButRef)(Y,this.RULES)){let H=(0,Q1.resolveUrl)(this.opts.uriResolver,X,Y.$ref);J=Y8.call(this,W,H)}let{schemaId:G}=this.opts;if(J=J||new C4({schema:Y,schemaId:G,root:W,baseId:X}),J.schema!==J.root.schema)return J;return}});var U5=P((QR,MU)=>{MU.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 cY=P((XR,b5)=>{var jU=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),N5=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),lY=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),w5=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),bU=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function mY(Q){let X="",Y=0,W=0;for(W=0;W<Q.length;W++){if(Y=Q[W].charCodeAt(0),Y===48)continue;if(!(Y>=48&&Y<=57||Y>=65&&Y<=70||Y>=97&&Y<=102))return"";X+=Q[W];break}for(W+=1;W<Q.length;W++){if(Y=Q[W].charCodeAt(0),!(Y>=48&&Y<=57||Y>=65&&Y<=70||Y>=97&&Y<=102))return"";X+=Q[W]}return X}var EU=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function O5(Q){return Q.length=0,!0}function SU(Q,X,Y){if(Q.length){let W=mY(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function PU(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],$=[],J=!1,G=!1,H=SU;for(let B=0;B<Q.length;B++){let z=Q[B];if(z==="["||z==="]")continue;if(z===":"){if(J===!0)G=!0;if(!H($,W,Y))break;if(++X>7){Y.error=!0;break}if(B>0&&Q[B-1]===":")J=!0;W.push(":");continue}else if(z==="%"){if(!H($,W,Y))break;H=O5}else{$.push(z);continue}}if($.length)if(H===O5)Y.zone=$.join("");else if(G)W.push($.join(""));else W.push(mY($));return Y.address=W.join(""),Y}function M5(Q){if(IU(Q,":")<2)return{host:Q,isIPV6:!1};let X=PU(Q);if(!X.error){let{address:Y,address:W}=X;if(X.zone)Y+="%"+X.zone,W+="%25"+X.zone;return{host:Y,isIPV6:!0,escapedHost:W}}else return{host:Q,isIPV6:!1}}function IU(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function RU(Q){let X=Q,Y=[],W=-1,$=0;while($=X.length){if($===1)if(X===".")break;else if(X==="/"){Y.push("/");break}else{Y.push(X);break}else if($===2){if(X[0]==="."){if(X[1]===".")break;else if(X[1]==="/"){X=X.slice(2);continue}}else if(X[0]==="/"){if(X[1]==="."||X[1]==="/"){Y.push("/");break}}}else if($===3){if(X==="/.."){if(Y.length!==0)Y.pop();Y.push("/");break}}if(X[0]==="."){if(X[1]==="."){if(X[2]==="/"){X=X.slice(3);continue}}else if(X[1]==="/"){X=X.slice(2);continue}}else if(X[0]==="/"){if(X[1]==="."){if(X[2]==="/"){X=X.slice(2);continue}else if(X[2]==="."){if(X[3]==="/"){if(X=X.slice(3),Y.length!==0)Y.pop();continue}}}}if((W=X.indexOf("/",1))===-1){Y.push(X);break}else Y.push(X.slice(0,W)),X=X.slice(W)}return Y.join("")}var CU={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},TU=/[@/?#:]/g,ZU=/[@/?#]/g;function j5(Q,X){let Y=X?ZU:TU;return Y.lastIndex=0,Q.replace(Y,(W)=>CU[W])}function vU(Q,X=!1){if(Q.indexOf("%")===-1)return Q;let Y="";for(let W=0;W<Q.length;W++){if(Q[W]==="%"&&W+2<Q.length){let $=Q.slice(W+1,W+3);if(lY($)){let J=$.toUpperCase(),G=String.fromCharCode(parseInt(J,16));if(X&&w5(G))Y+=G;else Y+="%"+J;W+=2;continue}}Y+=Q[W]}return Y}function kU(Q){let X="";for(let Y=0;Y<Q.length;Y++){if(Q[Y]==="%"&&Y+2<Q.length){let W=Q.slice(Y+1,Y+3);if(lY(W)){let $=W.toUpperCase(),J=String.fromCharCode(parseInt($,16));if(J!=="."&&w5(J))X+=J;else X+="%"+$;Y+=2;continue}}if(bU(Q[Y]))X+=Q[Y];else X+=escape(Q[Y])}return X}function _U(Q){let X="";for(let Y=0;Y<Q.length;Y++){if(Q[Y]==="%"&&Y+2<Q.length){let W=Q.slice(Y+1,Y+3);if(lY(W)){X+="%"+W.toUpperCase(),Y+=2;continue}}X+=escape(Q[Y])}return X}function xU(Q){let X=[];if(Q.userinfo!==void 0)X.push(Q.userinfo),X.push("@");if(Q.host!==void 0){let Y=unescape(Q.host);if(!N5(Y)){let W=M5(Y);if(W.isIPV6===!0)Y=`[${W.escapedHost}]`;else Y=j5(Y,!1)}X.push(Y)}if(typeof Q.port==="number"||typeof Q.port==="string")X.push(":"),X.push(String(Q.port));return X.length?X.join(""):void 0}b5.exports={nonSimpleDomain:EU,recomposeAuthority:xU,reescapeHostDelimiters:j5,normalizePercentEncoding:vU,normalizePathEncoding:kU,escapePreservingEscapes:_U,removeDotSegments:RU,isIPv4:N5,isUUID:jU,normalizeIPv6:M5,stringArrayToHexStripped:mY}});var R5=P((YR,I5)=>{var{isUUID:gU}=cY(),yU=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,hU=["http","https","ws","wss","urn","urn:uuid"];function fU(Q){return hU.indexOf(Q)!==-1}function pY(Q){if(Q.secure===!0)return!0;else if(Q.secure===!1)return!1;else if(Q.scheme)return Q.scheme.length===3&&(Q.scheme[0]==="w"||Q.scheme[0]==="W")&&(Q.scheme[1]==="s"||Q.scheme[1]==="S")&&(Q.scheme[2]==="s"||Q.scheme[2]==="S");else return!1}function E5(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function S5(Q){let X=String(Q.scheme).toLowerCase()==="https";if(Q.port===(X?443:80)||Q.port==="")Q.port=void 0;if(!Q.path)Q.path="/";return Q}function uU(Q){return Q.secure=pY(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function lU(Q){if(Q.port===(pY(Q)?443:80)||Q.port==="")Q.port=void 0;if(typeof Q.secure==="boolean")Q.scheme=Q.secure?"wss":"ws",Q.secure=void 0;if(Q.resourceName){let[X,Y]=Q.resourceName.split("?");Q.path=X&&X!=="/"?X:void 0,Q.query=Y,Q.resourceName=void 0}return Q.fragment=void 0,Q}function mU(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(yU);if(Y){let W=X.scheme||Q.scheme||"urn";Q.nid=Y[1].toLowerCase(),Q.nss=Y[2];let $=`${W}:${X.nid||Q.nid}`,J=iY($);if(Q.path=void 0,J)Q=J.parse(Q,X)}else Q.error=Q.error||"URN can not be parsed.";return Q}function cU(Q,X){if(Q.nid===void 0)throw Error("URN without nid cannot be serialized");let Y=X.scheme||Q.scheme||"urn",W=Q.nid.toLowerCase(),$=`${Y}:${X.nid||W}`,J=iY($);if(J)Q=J.serialize(Q,X);let G=Q,H=Q.nss;return G.path=`${W||X.nid}:${H}`,X.skipEscape=!0,G}function pU(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!gU(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function iU(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var P5={scheme:"http",domainHost:!0,parse:E5,serialize:S5},nU={scheme:"https",domainHost:P5.domainHost,parse:E5,serialize:S5},$8={scheme:"ws",domainHost:!0,parse:uU,serialize:lU},dU={scheme:"wss",domainHost:$8.domainHost,parse:$8.parse,serialize:$8.serialize},oU={scheme:"urn",parse:mU,serialize:cU,skipNormalize:!0},rU={scheme:"urn:uuid",parse:pU,serialize:iU,skipNormalize:!0},J8={http:P5,https:nU,ws:$8,wss:dU,urn:oU,"urn:uuid":rU};Object.setPrototypeOf(J8,null);function iY(Q){return Q&&(J8[Q]||J8[Q.toLowerCase()])||void 0}I5.exports={wsIsSecure:pY,SCHEMES:J8,isValidSchemeName:fU,getSchemeHandler:iY}});var _5=P((WR,G8)=>{var{normalizeIPv6:tU,removeDotSegments:T4,recomposeAuthority:aU,normalizePercentEncoding:sU,normalizePathEncoding:eU,escapePreservingEscapes:QO,reescapeHostDelimiters:XO,isIPv4:YO,nonSimpleDomain:WO}=cY(),{SCHEMES:$O,getSchemeHandler:T5}=R5();function JO(Q,X){if(typeof Q==="string")Q=AO(Q,X);else if(typeof Q==="object")Q=v6(s1(Q,X),X);return Q}function GO(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},$=Z5(v6(Q,W),v6(X,W),W,!0);return W.skipEscape=!0,s1($,W)}function Z5(Q,X,Y,W){let $={};if(!W)Q=v6(s1(Q,Y),Y),X=v6(s1(X,Y),Y);if(Y=Y||{},!Y.tolerant&&X.scheme)$.scheme=X.scheme,$.userinfo=X.userinfo,$.host=X.host,$.port=X.port,$.path=T4(X.path||""),$.query=X.query;else{if(X.userinfo!==void 0||X.host!==void 0||X.port!==void 0)$.userinfo=X.userinfo,$.host=X.host,$.port=X.port,$.path=T4(X.path||""),$.query=X.query;else{if(!X.path)if($.path=Q.path,X.query!==void 0)$.query=X.query;else $.query=Q.query;else{if(X.path[0]==="/")$.path=T4(X.path);else{if((Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)&&!Q.path)$.path="/"+X.path;else if(!Q.path)$.path=X.path;else $.path=Q.path.slice(0,Q.path.lastIndexOf("/")+1)+X.path;$.path=T4($.path)}$.query=X.query}$.userinfo=Q.userinfo,$.host=Q.host,$.port=Q.port}$.scheme=Q.scheme}return $.fragment=X.fragment,$}function HO(Q,X,Y){let W=C5(Q,Y),$=C5(X,Y);return W!==void 0&&$!==void 0&&W.toLowerCase()===$.toLowerCase()}function s1(Q,X){let Y={host:Q.host,scheme:Q.scheme,userinfo:Q.userinfo,port:Q.port,path:Q.path,query:Q.query,nid:Q.nid,nss:Q.nss,uuid:Q.uuid,fragment:Q.fragment,reference:Q.reference,resourceName:Q.resourceName,secure:Q.secure,error:""},W=Object.assign({},X),$=[],J=T5(W.scheme||Y.scheme);if(J&&J.serialize)J.serialize(Y,W);if(Y.path!==void 0)if(!W.skipEscape){if(Y.path=QO(Y.path),Y.scheme!==void 0)Y.path=Y.path.split("%3A").join(":")}else Y.path=sU(Y.path);if(W.reference!=="suffix"&&Y.scheme)$.push(Y.scheme,":");let G=aU(Y);if(G!==void 0){if(W.reference!=="suffix")$.push("//");if($.push(G),Y.path&&Y.path[0]!=="/")$.push("/")}if(Y.path!==void 0){let H=Y.path;if(!W.absolutePath&&(!J||!J.absolutePath))H=T4(H);if(G===void 0&&H[0]==="/"&&H[1]==="/")H="/%2F"+H.slice(2);$.push(H)}if(Y.query!==void 0)$.push("?",Y.query);if(Y.fragment!==void 0)$.push("#",Y.fragment);return $.join("")}var BO=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function zO(Q,X){if(X[2]!==void 0&&Q.path&&Q.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof Q.port==="number"&&(Q.port<0||Q.port>65535))return"URI port is malformed.";return}function v5(Q,X){let Y=Object.assign({},X),W={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},$=!1,J=!1;if(Y.reference==="suffix")if(Y.scheme)Q=Y.scheme+":"+Q;else Q="//"+Q;let G=Q.match(BO);if(G){if(W.scheme=G[1],W.userinfo=G[3],W.host=G[4],W.port=parseInt(G[5],10),W.path=G[6]||"",W.query=G[7],W.fragment=G[8],isNaN(W.port))W.port=G[5];let H=zO(W,G);if(H!==void 0)W.error=W.error||H,$=!0;if(W.host)if(YO(W.host)===!1){let A=tU(W.host);W.host=A.host.toLowerCase(),J=A.isIPV6}else J=!0;if(W.scheme===void 0&&W.userinfo===void 0&&W.host===void 0&&W.port===void 0&&W.query===void 0&&!W.path)W.reference="same-document";else if(W.scheme===void 0)W.reference="relative";else if(W.fragment===void 0)W.reference="absolute";else W.reference="uri";if(Y.reference&&Y.reference!=="suffix"&&Y.reference!==W.reference)W.error=W.error||"URI is not a "+Y.reference+" reference.";let B=T5(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!B||!B.unicodeSupport)){if(W.host&&(Y.domainHost||B&&B.domainHost)&&J===!1&&WO(W.host))try{W.host=URL.domainToASCII(W.host.toLowerCase())}catch(z){W.error=W.error||"Host's domain name can not be converted to ASCII: "+z}}if(!B||B&&!B.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=XO(unescape(W.host),J)}if(W.path)W.path=eU(W.path);if(W.fragment)try{W.fragment=encodeURI(decodeURIComponent(W.fragment))}catch{W.error=W.error||"URI malformed"}}if(B&&B.parse)B.parse(W,Y)}else W.error=W.error||"URI can not be parsed.";return{parsed:W,malformedAuthorityOrPort:$}}function v6(Q,X){return v5(Q,X).parsed}function AO(Q,X){return k5(Q,X).normalized}function k5(Q,X){let{parsed:Y,malformedAuthorityOrPort:W}=v5(Q,X);return{normalized:W?Q:s1(Y,X),malformedAuthorityOrPort:W}}function C5(Q,X){if(typeof Q==="string"){let{normalized:Y,malformedAuthorityOrPort:W}=k5(Q,X);return W?void 0:Y}if(typeof Q==="object")return s1(Q,X)}var nY={SCHEMES:$O,normalize:JO,resolve:GO,resolveComponent:Z5,equal:HO,serialize:s1,parse:v6};G8.exports=nY;G8.exports.default=nY;G8.exports.fastUri=nY});var y5=P((g5)=>{Object.defineProperty(g5,"__esModule",{value:!0});var x5=_5();x5.code='require("ajv/dist/runtime/uri").default';g5.default=x5});var i5=P((F1)=>{Object.defineProperty(F1,"__esModule",{value:!0});F1.CodeGen=F1.Name=F1.nil=F1.stringify=F1.str=F1._=F1.KeywordCxt=void 0;var DO=I4();Object.defineProperty(F1,"KeywordCxt",{enumerable:!0,get:function(){return DO.KeywordCxt}});var k6=l();Object.defineProperty(F1,"_",{enumerable:!0,get:function(){return k6._}});Object.defineProperty(F1,"str",{enumerable:!0,get:function(){return k6.str}});Object.defineProperty(F1,"stringify",{enumerable:!0,get:function(){return k6.stringify}});Object.defineProperty(F1,"nil",{enumerable:!0,get:function(){return k6.nil}});Object.defineProperty(F1,"Name",{enumerable:!0,get:function(){return k6.Name}});Object.defineProperty(F1,"CodeGen",{enumerable:!0,get:function(){return k6.CodeGen}});var LO=X8(),m5=R4(),qO=EY(),Z4=W8(),FO=l(),v4=E4(),H8=b4(),oY=o(),h5=U5(),VO=y5(),c5=(Q,X)=>new RegExp(Q,X);c5.code="new RegExp";var UO=["removeAdditional","useDefaults","coerceTypes"],OO=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),NO={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."},wO={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},f5=200;function MO(Q){var X,Y,W,$,J,G,H,B,z,A,D,L,K,q,F,N,O,b,E,y,x,j0,y0,X6,b8;let l6=Q.strict,E8=(X=Q.code)===null||X===void 0?void 0:X.optimize,bW=E8===!0||E8===void 0?1:E8||0,EW=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:c5,CB=($=Q.uriResolver)!==null&&$!==void 0?$:VO.default;return{strictSchema:(G=(J=Q.strictSchema)!==null&&J!==void 0?J:l6)!==null&&G!==void 0?G:!0,strictNumbers:(B=(H=Q.strictNumbers)!==null&&H!==void 0?H:l6)!==null&&B!==void 0?B:!0,strictTypes:(A=(z=Q.strictTypes)!==null&&z!==void 0?z:l6)!==null&&A!==void 0?A:"log",strictTuples:(L=(D=Q.strictTuples)!==null&&D!==void 0?D:l6)!==null&&L!==void 0?L:"log",strictRequired:(q=(K=Q.strictRequired)!==null&&K!==void 0?K:l6)!==null&&q!==void 0?q:!1,code:Q.code?{...Q.code,optimize:bW,regExp:EW}:{optimize:bW,regExp:EW},loopRequired:(F=Q.loopRequired)!==null&&F!==void 0?F:f5,loopEnum:(N=Q.loopEnum)!==null&&N!==void 0?N:f5,meta:(O=Q.meta)!==null&&O!==void 0?O:!0,messages:(b=Q.messages)!==null&&b!==void 0?b:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(y=Q.schemaId)!==null&&y!==void 0?y:"$id",addUsedSchema:(x=Q.addUsedSchema)!==null&&x!==void 0?x:!0,validateSchema:(j0=Q.validateSchema)!==null&&j0!==void 0?j0:!0,validateFormats:(y0=Q.validateFormats)!==null&&y0!==void 0?y0:!0,unicodeRegExp:(X6=Q.unicodeRegExp)!==null&&X6!==void 0?X6:!0,int32range:(b8=Q.int32range)!==null&&b8!==void 0?b8:!0,uriResolver:CB}}class B8{constructor(Q={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...MO(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new FO.ValueScope({scope:{},prefixes:OO,es5:X,lines:Y}),this.logger=IO(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,qO.getRules)(),u5.call(this,NO,Q,"NOT SUPPORTED"),u5.call(this,wO,Q,"DEPRECATED","warn"),this._metaOpts=SO.call(this),Q.formats)bO.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)EO.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);jO.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=h5;if(Y==="id")W={...h5},W.id=W.$id,delete W.$id;if(X&&Q)this.addMetaSchema(W,W[Y],!1)}defaultMeta(){let{meta:Q,schemaId:X}=this.opts;return this.opts.defaultMeta=typeof Q=="object"?Q[X]||Q:void 0}validate(Q,X){let Y;if(typeof Q=="string"){if(Y=this.getSchema(Q),!Y)throw Error(`no schema with key or ref "${Q}"`)}else Y=this.compile(Q);let W=Y(X);if(!("$async"in Y))this.errors=Y.errors;return W}compile(Q,X){let Y=this._addSchema(Q,X);return Y.validate||this._compileSchemaEnv(Y)}compileAsync(Q,X){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:Y}=this.opts;return W.call(this,Q,X);async function W(z,A){await $.call(this,z.$schema);let D=this._addSchema(z,A);return D.validate||J.call(this,D)}async function $(z){if(z&&!this.getSchema(z))await W.call(this,{$ref:z},!0)}async function J(z){try{return this._compileSchemaEnv(z)}catch(A){if(!(A instanceof m5.default))throw A;return G.call(this,A),await H.call(this,A.missingSchema),J.call(this,z)}}function G({missingSchema:z,missingRef:A}){if(this.refs[z])throw Error(`AnySchema ${z} is loaded but ${A} cannot be resolved`)}async function H(z){let A=await B.call(this,z);if(!this.refs[z])await $.call(this,A.$schema);if(!this.refs[z])this.addSchema(A,z,X)}async function B(z){let A=this._loading[z];if(A)return A;try{return await(this._loading[z]=Y(z))}finally{delete this._loading[z]}}}addSchema(Q,X,Y,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let J of Q)this.addSchema(J,void 0,Y,W);return this}let $;if(typeof Q==="object"){let{schemaId:J}=this.opts;if($=Q[J],$!==void 0&&typeof $!="string")throw Error(`schema ${J} must be string`)}return X=(0,v4.normalizeId)(X||$),this._checkUnique(X),this.schemas[X]=this._addSchema(Q,Y,X,W,!0),this}addMetaSchema(Q,X,Y=this.opts.validateSchema){return this.addSchema(Q,X,!0,Y),this}validateSchema(Q,X){if(typeof Q=="boolean")return!0;let Y;if(Y=Q.$schema,Y!==void 0&&typeof Y!="string")throw Error("$schema must be a string");if(Y=Y||this.opts.defaultMeta||this.defaultMeta(),!Y)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let W=this.validate(Y,Q);if(!W&&X){let $="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error($);else throw Error($)}return W}getSchema(Q){let X;while(typeof(X=l5.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new Z4.SchemaEnv({schema:{},schemaId:Y});if(X=Z4.resolveSchema.call(this,W,Q),!X)return;this.refs[Q]=X}return X.validate||this._compileSchemaEnv(X)}removeSchema(Q){if(Q instanceof RegExp)return this._removeAllSchemas(this.schemas,Q),this._removeAllSchemas(this.refs,Q),this;switch(typeof Q){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let X=l5.call(this,Q);if(typeof X=="object")this._cache.delete(X.schema);return delete this.schemas[Q],delete this.refs[Q],this}case"object":{let X=Q;this._cache.delete(X);let Y=Q[this.opts.schemaId];if(Y)Y=(0,v4.normalizeId)(Y),delete this.schemas[Y],delete this.refs[Y];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(Q){for(let X of Q)this.addKeyword(X);return this}addKeyword(Q,X){let Y;if(typeof Q=="string"){if(Y=Q,typeof X=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),X.keyword=Y}else if(typeof Q=="object"&&X===void 0){if(X=Q,Y=X.keyword,Array.isArray(Y)&&!Y.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(CO.call(this,Y,X),!X)return(0,oY.eachItem)(Y,($)=>dY.call(this,$)),this;ZO.call(this,X);let W={...X,type:(0,H8.getJSONTypes)(X.type),schemaType:(0,H8.getJSONTypes)(X.schemaType)};return(0,oY.eachItem)(Y,W.type.length===0?($)=>dY.call(this,$,W):($)=>W.type.forEach((J)=>dY.call(this,$,W,J))),this}getKeyword(Q){let X=this.RULES.all[Q];return typeof X=="object"?X.definition:!!X}removeKeyword(Q){let{RULES:X}=this;delete X.keywords[Q],delete X.all[Q];for(let Y of X.rules){let W=Y.rules.findIndex(($)=>$.keyword===Q);if(W>=0)Y.rules.splice(W,1)}return this}addFormat(Q,X){if(typeof X=="string")X=new RegExp(X);return this.formats[Q]=X,this}errorsText(Q=this.errors,{separator:X=", ",dataVar:Y="data"}={}){if(!Q||Q.length===0)return"No errors";return Q.map((W)=>`${Y}${W.instancePath} ${W.message}`).reduce((W,$)=>W+X+$)}$dataMetaSchema(Q,X){let Y=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let W of X){let $=W.split("/").slice(1),J=Q;for(let G of $)J=J[G];for(let G in Y){let H=Y[G];if(typeof H!="object")continue;let{$data:B}=H.definition,z=J[G];if(B&&z)J[G]=p5(z)}}return Q}_removeAllSchemas(Q,X){for(let Y in Q){let W=Q[Y];if(!X||X.test(Y)){if(typeof W=="string")delete Q[Y];else if(W&&!W.meta)this._cache.delete(W.schema),delete Q[Y]}}}_addSchema(Q,X,Y,W=this.opts.validateSchema,$=this.opts.addUsedSchema){let J,{schemaId:G}=this.opts;if(typeof Q=="object")J=Q[G];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof Q!="boolean")throw Error("schema must be object or boolean");let H=this._cache.get(Q);if(H!==void 0)return H;Y=(0,v4.normalizeId)(J||Y);let B=v4.getSchemaRefs.call(this,Q,Y);if(H=new Z4.SchemaEnv({schema:Q,schemaId:G,meta:X,baseId:Y,localRefs:B}),this._cache.set(H.schema,H),$&&!Y.startsWith("#")){if(Y)this._checkUnique(Y);this.refs[Y]=H}if(W)this.validateSchema(Q,!0);return H}_checkUnique(Q){if(this.schemas[Q]||this.refs[Q])throw Error(`schema with key or id "${Q}" already exists`)}_compileSchemaEnv(Q){if(Q.meta)this._compileMetaSchema(Q);else Z4.compileSchema.call(this,Q);if(!Q.validate)throw Error("ajv implementation error");return Q.validate}_compileMetaSchema(Q){let X=this.opts;this.opts=this._metaOpts;try{Z4.compileSchema.call(this,Q)}finally{this.opts=X}}}B8.ValidationError=LO.default;B8.MissingRefError=m5.default;F1.default=B8;function u5(Q,X,Y,W="error"){for(let $ in Q){let J=$;if(J in X)this.logger[W](`${Y}: option ${$}. ${Q[J]}`)}}function l5(Q){return Q=(0,v4.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function jO(){let Q=this.opts.schemas;if(!Q)return;if(Array.isArray(Q))this.addSchema(Q);else for(let X in Q)this.addSchema(Q[X],X)}function bO(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function EO(Q){if(Array.isArray(Q)){this.addVocabulary(Q);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let X in Q){let Y=Q[X];if(!Y.keyword)Y.keyword=X;this.addKeyword(Y)}}function SO(){let Q={...this.opts};for(let X of UO)delete Q[X];return Q}var PO={log(){},warn(){},error(){}};function IO(Q){if(Q===!1)return PO;if(Q===void 0)return console;if(Q.log&&Q.warn&&Q.error)return Q;throw Error("logger must implement log, warn and error methods")}var RO=/^[a-z_$][a-z0-9_$:-]*$/i;function CO(Q,X){let{RULES:Y}=this;if((0,oY.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!RO.test(W))throw Error(`Keyword ${W} has invalid name`)}),!X)return;if(X.$data&&!(("code"in X)||("validate"in X)))throw Error('$data keyword must have "code" or "validate" function')}function dY(Q,X,Y){var W;let $=X===null||X===void 0?void 0:X.post;if(Y&&$)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,G=$?J.post:J.rules.find(({type:B})=>B===Y);if(!G)G={type:Y,rules:[]},J.rules.push(G);if(J.keywords[Q]=!0,!X)return;let H={keyword:Q,definition:{...X,type:(0,H8.getJSONTypes)(X.type),schemaType:(0,H8.getJSONTypes)(X.schemaType)}};if(X.before)TO.call(this,G,H,X.before);else G.rules.push(H);J.all[Q]=H,(W=X.implements)===null||W===void 0||W.forEach((B)=>this.addKeyword(B))}function TO(Q,X,Y){let W=Q.rules.findIndex(($)=>$.keyword===Y);if(W>=0)Q.rules.splice(W,0,X);else Q.rules.push(X),this.logger.warn(`rule ${Y} is not defined`)}function ZO(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=p5(X);Q.validateSchema=this.compile(X,!0)}var vO={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function p5(Q){return{anyOf:[Q,vO]}}});var d5=P((n5)=>{Object.defineProperty(n5,"__esModule",{value:!0});var xO={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};n5.default=xO});var e5=P((a5)=>{Object.defineProperty(a5,"__esModule",{value:!0});a5.callRef=a5.getValidate=void 0;var yO=R4(),o5=l0(),Z0=l(),_6=L1(),r5=W8(),z8=o(),hO={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:Y,it:W}=Q,{baseId:$,schemaEnv:J,validateName:G,opts:H,self:B}=W,{root:z}=J;if((Y==="#"||Y==="#/")&&$===z.baseId)return D();let A=r5.resolveRef.call(B,z,$,Y);if(A===void 0)throw new yO.default(W.opts.uriResolver,$,Y);if(A instanceof r5.SchemaEnv)return L(A);return K(A);function D(){if(J===z)return A8(Q,G,J,J.$async);let q=X.scopeValue("root",{ref:z});return A8(Q,Z0._`${q}.validate`,z,z.$async)}function L(q){let F=t5(Q,q);A8(Q,F,q,q.$async)}function K(q){let F=X.scopeValue("schema",H.code.source===!0?{ref:q,code:(0,Z0.stringify)(q)}:{ref:q}),N=X.name("valid"),O=Q.subschema({schema:q,dataTypes:[],schemaPath:Z0.nil,topSchemaRef:F,errSchemaPath:Y},N);Q.mergeEvaluated(O),Q.ok(N)}}};function t5(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):Z0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}a5.getValidate=t5;function A8(Q,X,Y,W){let{gen:$,it:J}=Q,{allErrors:G,schemaEnv:H,opts:B}=J,z=B.passContext?_6.default.this:Z0.nil;if(W)A();else D();function A(){if(!H.$async)throw Error("async schema referenced by sync schema");let q=$.let("valid");$.try(()=>{if($.code(Z0._`await ${(0,o5.callValidateCode)(Q,X,z)}`),K(X),!G)$.assign(q,!0)},(F)=>{if($.if(Z0._`!(${F} instanceof ${J.ValidationError})`,()=>$.throw(F)),L(F),!G)$.assign(q,!1)}),Q.ok(q)}function D(){Q.result((0,o5.callValidateCode)(Q,X,z),()=>K(X),()=>L(X))}function L(q){let F=Z0._`${q}.errors`;$.assign(_6.default.vErrors,Z0._`${_6.default.vErrors} === null ? ${F} : ${_6.default.vErrors}.concat(${F})`),$.assign(_6.default.errors,Z0._`${_6.default.vErrors}.length`)}function K(q){var F;if(!J.opts.unevaluated)return;let N=(F=Y===null||Y===void 0?void 0:Y.validate)===null||F===void 0?void 0:F.evaluated;if(J.props!==!0)if(N&&!N.dynamicProps){if(N.props!==void 0)J.props=z8.mergeEvaluated.props($,N.props,J.props)}else{let O=$.var("props",Z0._`${q}.evaluated.props`);J.props=z8.mergeEvaluated.props($,O,J.props,Z0.Name)}if(J.items!==!0)if(N&&!N.dynamicItems){if(N.items!==void 0)J.items=z8.mergeEvaluated.items($,N.items,J.items)}else{let O=$.var("items",Z0._`${q}.evaluated.items`);J.items=z8.mergeEvaluated.items($,O,J.items,Z0.Name)}}}a5.callRef=A8;a5.default=hO});var XH=P((QH)=>{Object.defineProperty(QH,"__esModule",{value:!0});var lO=d5(),mO=e5(),cO=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",lO.default,mO.default];QH.default=cO});var WH=P((YH)=>{Object.defineProperty(YH,"__esModule",{value:!0});var K8=l(),k1=K8.operators,D8={maximum:{okStr:"<=",ok:k1.LTE,fail:k1.GT},minimum:{okStr:">=",ok:k1.GTE,fail:k1.LT},exclusiveMaximum:{okStr:"<",ok:k1.LT,fail:k1.GTE},exclusiveMinimum:{okStr:">",ok:k1.GT,fail:k1.LTE}},iO={message:({keyword:Q,schemaCode:X})=>K8.str`must be ${D8[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>K8._`{comparison: ${D8[Q].okStr}, limit: ${X}}`},nO={keyword:Object.keys(D8),type:"number",schemaType:"number",$data:!0,error:iO,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(K8._`${Y} ${D8[X].fail} ${W} || isNaN(${Y})`)}};YH.default=nO});var JH=P(($H)=>{Object.defineProperty($H,"__esModule",{value:!0});var k4=l(),oO={message:({schemaCode:Q})=>k4.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>k4._`{multipleOf: ${Q}}`},rO={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:oO,code(Q){let{gen:X,data:Y,schemaCode:W,it:$}=Q,J=$.opts.multipleOfPrecision,G=X.let("res"),H=J?k4._`Math.abs(Math.round(${G}) - ${G}) > 1e-${J}`:k4._`${G} !== parseInt(${G})`;Q.fail$data(k4._`(${W} === 0 || (${G} = ${Y}/${W}, ${H}))`)}};$H.default=rO});var BH=P((HH)=>{Object.defineProperty(HH,"__esModule",{value:!0});function GH(Q){let X=Q.length,Y=0,W=0,$;while(W<X)if(Y++,$=Q.charCodeAt(W++),$>=55296&&$<=56319&&W<X){if($=Q.charCodeAt(W),($&64512)===56320)W++}return Y}HH.default=GH;GH.code='require("ajv/dist/runtime/ucs2length").default'});var AH=P((zH)=>{Object.defineProperty(zH,"__esModule",{value:!0});var e1=l(),sO=o(),eO=BH(),QN={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return e1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>e1._`{limit: ${Q}}`},XN={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:QN,code(Q){let{keyword:X,data:Y,schemaCode:W,it:$}=Q,J=X==="maxLength"?e1.operators.GT:e1.operators.LT,G=$.opts.unicode===!1?e1._`${Y}.length`:e1._`${(0,sO.useFunc)(Q.gen,eO.default)}(${Y})`;Q.fail$data(e1._`${G} ${J} ${W}`)}};zH.default=XN});var DH=P((KH)=>{Object.defineProperty(KH,"__esModule",{value:!0});var WN=l0(),$N=o(),x6=l(),JN={message:({schemaCode:Q})=>x6.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>x6._`{pattern: ${Q}}`},GN={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:JN,code(Q){let{gen:X,data:Y,$data:W,schema:$,schemaCode:J,it:G}=Q,H=G.opts.unicodeRegExp?"u":"";if(W){let{regExp:B}=G.opts.code,z=B.code==="new RegExp"?x6._`new RegExp`:(0,$N.useFunc)(X,B),A=X.let("valid");X.try(()=>X.assign(A,x6._`${z}(${J}, ${H}).test(${Y})`),()=>X.assign(A,!1)),Q.fail$data(x6._`!${A}`)}else{let B=(0,WN.usePattern)(Q,$);Q.fail$data(x6._`!${B}.test(${Y})`)}}};KH.default=GN});var qH=P((LH)=>{Object.defineProperty(LH,"__esModule",{value:!0});var _4=l(),BN={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return _4.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>_4._`{limit: ${Q}}`},zN={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:BN,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,$=X==="maxProperties"?_4.operators.GT:_4.operators.LT;Q.fail$data(_4._`Object.keys(${Y}).length ${$} ${W}`)}};LH.default=zN});var VH=P((FH)=>{Object.defineProperty(FH,"__esModule",{value:!0});var x4=l0(),g4=l(),KN=o(),DN={message:({params:{missingProperty:Q}})=>g4.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>g4._`{missingProperty: ${Q}}`},LN={keyword:"required",type:"object",schemaType:"array",$data:!0,error:DN,code(Q){let{gen:X,schema:Y,schemaCode:W,data:$,$data:J,it:G}=Q,{opts:H}=G;if(!J&&Y.length===0)return;let B=Y.length>=H.loopRequired;if(G.allErrors)z();else A();if(H.strictRequired){let K=Q.parentSchema.properties,{definedProperties:q}=Q.it;for(let F of Y)if((K===null||K===void 0?void 0:K[F])===void 0&&!q.has(F)){let N=G.schemaEnv.baseId+G.errSchemaPath,O=`required property "${F}" is not defined at "${N}" (strictRequired)`;(0,KN.checkStrictMode)(G,O,G.opts.strictRequired)}}function z(){if(B||J)Q.block$data(g4.nil,D);else for(let K of Y)(0,x4.checkReportMissingProp)(Q,K)}function A(){let K=X.let("missing");if(B||J){let q=X.let("valid",!0);Q.block$data(q,()=>L(K,q)),Q.ok(q)}else X.if((0,x4.checkMissingProp)(Q,Y,K)),(0,x4.reportMissingProp)(Q,K),X.else()}function D(){X.forOf("prop",W,(K)=>{Q.setParams({missingProperty:K}),X.if((0,x4.noPropertyInData)(X,$,K,H.ownProperties),()=>Q.error())})}function L(K,q){Q.setParams({missingProperty:K}),X.forOf(K,W,()=>{X.assign(q,(0,x4.propertyInData)(X,$,K,H.ownProperties)),X.if((0,g4.not)(q),()=>{Q.error(),X.break()})},g4.nil)}}};FH.default=LN});var OH=P((UH)=>{Object.defineProperty(UH,"__esModule",{value:!0});var y4=l(),FN={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return y4.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>y4._`{limit: ${Q}}`},VN={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:FN,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,$=X==="maxItems"?y4.operators.GT:y4.operators.LT;Q.fail$data(y4._`${Y}.length ${$} ${W}`)}};UH.default=VN});var L8=P((wH)=>{Object.defineProperty(wH,"__esModule",{value:!0});var NH=vY();NH.code='require("ajv/dist/runtime/equal").default';wH.default=NH});var jH=P((MH)=>{Object.defineProperty(MH,"__esModule",{value:!0});var rY=b4(),N0=l(),NN=o(),wN=L8(),MN={message:({params:{i:Q,j:X}})=>N0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>N0._`{i: ${Q}, j: ${X}}`},jN={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:MN,code(Q){let{gen:X,data:Y,$data:W,schema:$,parentSchema:J,schemaCode:G,it:H}=Q;if(!W&&!$)return;let B=X.let("valid"),z=J.items?(0,rY.getSchemaTypes)(J.items):[];Q.block$data(B,A,N0._`${G} === false`),Q.ok(B);function A(){let q=X.let("i",N0._`${Y}.length`),F=X.let("j");Q.setParams({i:q,j:F}),X.assign(B,!0),X.if(N0._`${q} > 1`,()=>(D()?L:K)(q,F))}function D(){return z.length>0&&!z.some((q)=>q==="object"||q==="array")}function L(q,F){let N=X.name("item"),O=(0,rY.checkDataTypes)(z,N,H.opts.strictNumbers,rY.DataType.Wrong),b=X.const("indices",N0._`{}`);X.for(N0._`;${q}--;`,()=>{if(X.let(N,N0._`${Y}[${q}]`),X.if(O,N0._`continue`),z.length>1)X.if(N0._`typeof ${N} == "string"`,N0._`${N} += "_"`);X.if(N0._`typeof ${b}[${N}] == "number"`,()=>{X.assign(F,N0._`${b}[${N}]`),Q.error(),X.assign(B,!1).break()}).code(N0._`${b}[${N}] = ${q}`)})}function K(q,F){let N=(0,NN.useFunc)(X,wN.default),O=X.name("outer");X.label(O).for(N0._`;${q}--;`,()=>X.for(N0._`${F} = ${q}; ${F}--;`,()=>X.if(N0._`${N}(${Y}[${q}], ${Y}[${F}])`,()=>{Q.error(),X.assign(B,!1).break(O)})))}}};MH.default=jN});var EH=P((bH)=>{Object.defineProperty(bH,"__esModule",{value:!0});var tY=l(),EN=o(),SN=L8(),PN={message:"must be equal to constant",params:({schemaCode:Q})=>tY._`{allowedValue: ${Q}}`},IN={keyword:"const",$data:!0,error:PN,code(Q){let{gen:X,data:Y,$data:W,schemaCode:$,schema:J}=Q;if(W||J&&typeof J=="object")Q.fail$data(tY._`!${(0,EN.useFunc)(X,SN.default)}(${Y}, ${$})`);else Q.fail(tY._`${J} !== ${Y}`)}};bH.default=IN});var PH=P((SH)=>{Object.defineProperty(SH,"__esModule",{value:!0});var h4=l(),CN=o(),TN=L8(),ZN={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>h4._`{allowedValues: ${Q}}`},vN={keyword:"enum",schemaType:"array",$data:!0,error:ZN,code(Q){let{gen:X,data:Y,$data:W,schema:$,schemaCode:J,it:G}=Q;if(!W&&$.length===0)throw Error("enum must have non-empty array");let H=$.length>=G.opts.loopEnum,B,z=()=>B!==null&&B!==void 0?B:B=(0,CN.useFunc)(X,TN.default),A;if(H||W)A=X.let("valid"),Q.block$data(A,D);else{if(!Array.isArray($))throw Error("ajv implementation error");let K=X.const("vSchema",J);A=(0,h4.or)(...$.map((q,F)=>L(K,F)))}Q.pass(A);function D(){X.assign(A,!1),X.forOf("v",J,(K)=>X.if(h4._`${z()}(${Y}, ${K})`,()=>X.assign(A,!0).break()))}function L(K,q){let F=$[q];return typeof F==="object"&&F!==null?h4._`${z()}(${Y}, ${K}[${q}])`:h4._`${Y} === ${F}`}}};SH.default=vN});var RH=P((IH)=>{Object.defineProperty(IH,"__esModule",{value:!0});var _N=WH(),xN=JH(),gN=AH(),yN=DH(),hN=qH(),fN=VH(),uN=OH(),lN=jH(),mN=EH(),cN=PH(),pN=[_N.default,xN.default,gN.default,yN.default,hN.default,fN.default,uN.default,lN.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},mN.default,cN.default];IH.default=pN});var sY=P((TH)=>{Object.defineProperty(TH,"__esModule",{value:!0});TH.validateAdditionalItems=void 0;var Q6=l(),aY=o(),nN={message:({params:{len:Q}})=>Q6.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>Q6._`{limit: ${Q}}`},dN={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:nN,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,aY.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}CH(Q,W)}};function CH(Q,X){let{gen:Y,schema:W,data:$,keyword:J,it:G}=Q;G.items=!0;let H=Y.const("len",Q6._`${$}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(Q6._`${H} <= ${X.length}`);else if(typeof W=="object"&&!(0,aY.alwaysValidSchema)(G,W)){let z=Y.var("valid",Q6._`${H} <= ${X.length}`);Y.if((0,Q6.not)(z),()=>B(z)),Q.ok(z)}function B(z){Y.forRange("i",X.length,H,(A)=>{if(Q.subschema({keyword:J,dataProp:A,dataPropType:aY.Type.Num},z),!G.allErrors)Y.if((0,Q6.not)(z),()=>Y.break())})}}TH.validateAdditionalItems=CH;TH.default=dN});var eY=P((_H)=>{Object.defineProperty(_H,"__esModule",{value:!0});_H.validateTuple=void 0;var vH=l(),q8=o(),rN=l0(),tN={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return kH(Q,"additionalItems",X);if(Y.items=!0,(0,q8.alwaysValidSchema)(Y,X))return;Q.ok((0,rN.validateArray)(Q))}};function kH(Q,X,Y=Q.schema){let{gen:W,parentSchema:$,data:J,keyword:G,it:H}=Q;if(A($),H.opts.unevaluated&&Y.length&&H.items!==!0)H.items=q8.mergeEvaluated.items(W,Y.length,H.items);let B=W.name("valid"),z=W.const("len",vH._`${J}.length`);Y.forEach((D,L)=>{if((0,q8.alwaysValidSchema)(H,D))return;W.if(vH._`${z} > ${L}`,()=>Q.subschema({keyword:G,schemaProp:L,dataProp:L},B)),Q.ok(B)});function A(D){let{opts:L,errSchemaPath:K}=H,q=Y.length,F=q===D.minItems&&(q===D.maxItems||D[X]===!1);if(L.strictTuples&&!F){let N=`"${G}" is ${q}-tuple, but minItems or maxItems/${X} are not specified or different at path "${K}"`;(0,q8.checkStrictMode)(H,N,L.strictTuples)}}}_H.validateTuple=kH;_H.default=tN});var yH=P((gH)=>{Object.defineProperty(gH,"__esModule",{value:!0});var sN=eY(),eN={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,sN.validateTuple)(Q,"items")};gH.default=eN});var uH=P((fH)=>{Object.defineProperty(fH,"__esModule",{value:!0});var hH=l(),Xw=o(),Yw=l0(),Ww=sY(),$w={message:({params:{len:Q}})=>hH.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>hH._`{limit: ${Q}}`},Jw={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:$w,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:$}=Y;if(W.items=!0,(0,Xw.alwaysValidSchema)(W,X))return;if($)(0,Ww.validateAdditionalItems)(Q,$);else Q.ok((0,Yw.validateArray)(Q))}};fH.default=Jw});var mH=P((lH)=>{Object.defineProperty(lH,"__esModule",{value:!0});var m0=l(),F8=o(),Hw={message:({params:{min:Q,max:X}})=>X===void 0?m0.str`must contain at least ${Q} valid item(s)`:m0.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?m0._`{minContains: ${Q}}`:m0._`{minContains: ${Q}, maxContains: ${X}}`},Bw={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Hw,code(Q){let{gen:X,schema:Y,parentSchema:W,data:$,it:J}=Q,G,H,{minContains:B,maxContains:z}=W;if(J.opts.next)G=B===void 0?1:B,H=z;else G=1;let A=X.const("len",m0._`${$}.length`);if(Q.setParams({min:G,max:H}),H===void 0&&G===0){(0,F8.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&G>H){(0,F8.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,F8.alwaysValidSchema)(J,Y)){let F=m0._`${A} >= ${G}`;if(H!==void 0)F=m0._`${F} && ${A} <= ${H}`;Q.pass(F);return}J.items=!0;let D=X.name("valid");if(H===void 0&&G===1)K(D,()=>X.if(D,()=>X.break()));else if(G===0){if(X.let(D,!0),H!==void 0)X.if(m0._`${$}.length > 0`,L)}else X.let(D,!1),L();Q.result(D,()=>Q.reset());function L(){let F=X.name("_valid"),N=X.let("count",0);K(F,()=>X.if(F,()=>q(N)))}function K(F,N){X.forRange("i",0,A,(O)=>{Q.subschema({keyword:"contains",dataProp:O,dataPropType:F8.Type.Num,compositeRule:!0},F),N()})}function q(F){if(X.code(m0._`${F}++`),H===void 0)X.if(m0._`${F} >= ${G}`,()=>X.assign(D,!0).break());else if(X.if(m0._`${F} > ${H}`,()=>X.assign(D,!1).break()),G===1)X.assign(D,!0);else X.if(m0._`${F} >= ${G}`,()=>X.assign(D,!0))}}};lH.default=Bw});var oH=P((iH)=>{Object.defineProperty(iH,"__esModule",{value:!0});iH.validateSchemaDeps=iH.validatePropertyDeps=iH.error=void 0;var QW=l(),Aw=o(),f4=l0();iH.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return QW.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>QW._`{property: ${Q},
7
- missingProperty: ${W},
8
- depsCount: ${X},
9
- deps: ${Y}}`};var Kw={keyword:"dependencies",type:"object",schemaType:"object",error:iH.error,code(Q){let[X,Y]=Dw(Q);cH(Q,X),pH(Q,Y)}};function Dw({schema:Q}){let X={},Y={};for(let W in Q){if(W==="__proto__")continue;let $=Array.isArray(Q[W])?X:Y;$[W]=Q[W]}return[X,Y]}function cH(Q,X=Q.schema){let{gen:Y,data:W,it:$}=Q;if(Object.keys(X).length===0)return;let J=Y.let("missing");for(let G in X){let H=X[G];if(H.length===0)continue;let B=(0,f4.propertyInData)(Y,W,G,$.opts.ownProperties);if(Q.setParams({property:G,depsCount:H.length,deps:H.join(", ")}),$.allErrors)Y.if(B,()=>{for(let z of H)(0,f4.checkReportMissingProp)(Q,z)});else Y.if(QW._`${B} && (${(0,f4.checkMissingProp)(Q,H,J)})`),(0,f4.reportMissingProp)(Q,J),Y.else()}}iH.validatePropertyDeps=cH;function pH(Q,X=Q.schema){let{gen:Y,data:W,keyword:$,it:J}=Q,G=Y.name("valid");for(let H in X){if((0,Aw.alwaysValidSchema)(J,X[H]))continue;Y.if((0,f4.propertyInData)(Y,W,H,J.opts.ownProperties),()=>{let B=Q.subschema({keyword:$,schemaProp:H},G);Q.mergeValidEvaluated(B,G)},()=>Y.var(G,!0)),Q.ok(G)}}iH.validateSchemaDeps=pH;iH.default=Kw});var aH=P((tH)=>{Object.defineProperty(tH,"__esModule",{value:!0});var rH=l(),Fw=o(),Vw={message:"property name must be valid",params:({params:Q})=>rH._`{propertyName: ${Q.propertyName}}`},Uw={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Vw,code(Q){let{gen:X,schema:Y,data:W,it:$}=Q;if((0,Fw.alwaysValidSchema)($,Y))return;let J=X.name("valid");X.forIn("key",W,(G)=>{Q.setParams({propertyName:G}),Q.subschema({keyword:"propertyNames",data:G,dataTypes:["string"],propertyName:G,compositeRule:!0},J),X.if((0,rH.not)(J),()=>{if(Q.error(!0),!$.allErrors)X.break()})}),Q.ok(J)}};tH.default=Uw});var XW=P((sH)=>{Object.defineProperty(sH,"__esModule",{value:!0});var V8=l0(),X1=l(),Nw=L1(),U8=o(),ww={message:"must NOT have additional properties",params:({params:Q})=>X1._`{additionalProperty: ${Q.additionalProperty}}`},Mw={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ww,code(Q){let{gen:X,schema:Y,parentSchema:W,data:$,errsCount:J,it:G}=Q;if(!J)throw Error("ajv implementation error");let{allErrors:H,opts:B}=G;if(G.props=!0,B.removeAdditional!=="all"&&(0,U8.alwaysValidSchema)(G,Y))return;let z=(0,V8.allSchemaProperties)(W.properties),A=(0,V8.allSchemaProperties)(W.patternProperties);D(),Q.ok(X1._`${J} === ${Nw.default.errors}`);function D(){X.forIn("key",$,(N)=>{if(!z.length&&!A.length)q(N);else X.if(L(N),()=>q(N))})}function L(N){let O;if(z.length>8){let b=(0,U8.schemaRefOrVal)(G,W.properties,"properties");O=(0,V8.isOwnProperty)(X,b,N)}else if(z.length)O=(0,X1.or)(...z.map((b)=>X1._`${N} === ${b}`));else O=X1.nil;if(A.length)O=(0,X1.or)(O,...A.map((b)=>X1._`${(0,V8.usePattern)(Q,b)}.test(${N})`));return(0,X1.not)(O)}function K(N){X.code(X1._`delete ${$}[${N}]`)}function q(N){if(B.removeAdditional==="all"||B.removeAdditional&&Y===!1){K(N);return}if(Y===!1){if(Q.setParams({additionalProperty:N}),Q.error(),!H)X.break();return}if(typeof Y=="object"&&!(0,U8.alwaysValidSchema)(G,Y)){let O=X.name("valid");if(B.removeAdditional==="failing")F(N,O,!1),X.if((0,X1.not)(O),()=>{Q.reset(),K(N)});else if(F(N,O),!H)X.if((0,X1.not)(O),()=>X.break())}}function F(N,O,b){let E={keyword:"additionalProperties",dataProp:N,dataPropType:U8.Type.Str};if(b===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,O)}}};sH.default=Mw});var Y3=P((X3)=>{Object.defineProperty(X3,"__esModule",{value:!0});var bw=I4(),eH=l0(),YW=o(),Q3=XW(),Ew={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,parentSchema:W,data:$,it:J}=Q;if(J.opts.removeAdditional==="all"&&W.additionalProperties===void 0)Q3.default.code(new bw.KeywordCxt(J,Q3.default,"additionalProperties"));let G=(0,eH.allSchemaProperties)(Y);for(let D of G)J.definedProperties.add(D);if(J.opts.unevaluated&&G.length&&J.props!==!0)J.props=YW.mergeEvaluated.props(X,(0,YW.toHash)(G),J.props);let H=G.filter((D)=>!(0,YW.alwaysValidSchema)(J,Y[D]));if(H.length===0)return;let B=X.name("valid");for(let D of H){if(z(D))A(D);else{if(X.if((0,eH.propertyInData)(X,$,D,J.opts.ownProperties)),A(D),!J.allErrors)X.else().var(B,!0);X.endIf()}Q.it.definedProperties.add(D),Q.ok(B)}function z(D){return J.opts.useDefaults&&!J.compositeRule&&Y[D].default!==void 0}function A(D){Q.subschema({keyword:"properties",schemaProp:D,dataProp:D},B)}}};X3.default=Ew});var H3=P((G3)=>{Object.defineProperty(G3,"__esModule",{value:!0});var W3=l0(),O8=l(),$3=o(),J3=o(),Pw={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:$,it:J}=Q,{opts:G}=J,H=(0,W3.allSchemaProperties)(Y),B=H.filter((F)=>(0,$3.alwaysValidSchema)(J,Y[F]));if(H.length===0||B.length===H.length&&(!J.opts.unevaluated||J.props===!0))return;let z=G.strictSchema&&!G.allowMatchingProperties&&$.properties,A=X.name("valid");if(J.props!==!0&&!(J.props instanceof O8.Name))J.props=(0,J3.evaluatedPropsToName)(X,J.props);let{props:D}=J;L();function L(){for(let F of H){if(z)K(F);if(J.allErrors)q(F);else X.var(A,!0),q(F),X.if(A)}}function K(F){for(let N in z)if(new RegExp(F).test(N))(0,$3.checkStrictMode)(J,`property ${N} matches pattern ${F} (use allowMatchingProperties)`)}function q(F){X.forIn("key",W,(N)=>{X.if(O8._`${(0,W3.usePattern)(Q,F)}.test(${N})`,()=>{let O=B.includes(F);if(!O)Q.subschema({keyword:"patternProperties",schemaProp:F,dataProp:N,dataPropType:J3.Type.Str},A);if(J.opts.unevaluated&&D!==!0)X.assign(O8._`${D}[${N}]`,!0);else if(!O&&!J.allErrors)X.if((0,O8.not)(A),()=>X.break())})})}}};G3.default=Pw});var z3=P((B3)=>{Object.defineProperty(B3,"__esModule",{value:!0});var Rw=o(),Cw={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,Rw.alwaysValidSchema)(W,Y)){Q.fail();return}let $=X.name("valid");Q.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},$),Q.failResult($,()=>Q.reset(),()=>Q.error())},error:{message:"must NOT be valid"}};B3.default=Cw});var K3=P((A3)=>{Object.defineProperty(A3,"__esModule",{value:!0});var Zw=l0(),vw={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Zw.validateUnion,error:{message:"must match a schema in anyOf"}};A3.default=vw});var L3=P((D3)=>{Object.defineProperty(D3,"__esModule",{value:!0});var N8=l(),_w=o(),xw={message:"must match exactly one schema in oneOf",params:({params:Q})=>N8._`{passingSchemas: ${Q.passing}}`},gw={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:xw,code(Q){let{gen:X,schema:Y,parentSchema:W,it:$}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if($.opts.discriminator&&W.discriminator)return;let J=Y,G=X.let("valid",!1),H=X.let("passing",null),B=X.name("_valid");Q.setParams({passing:H}),X.block(z),Q.result(G,()=>Q.reset(),()=>Q.error(!0));function z(){J.forEach((A,D)=>{let L;if((0,_w.alwaysValidSchema)($,A))X.var(B,!0);else L=Q.subschema({keyword:"oneOf",schemaProp:D,compositeRule:!0},B);if(D>0)X.if(N8._`${B} && ${G}`).assign(G,!1).assign(H,N8._`[${H}, ${D}]`).else();X.if(B,()=>{if(X.assign(G,!0),X.assign(H,D),L)Q.mergeEvaluated(L,N8.Name)})})}}};D3.default=gw});var F3=P((q3)=>{Object.defineProperty(q3,"__esModule",{value:!0});var hw=o(),fw={keyword:"allOf",schemaType:"array",code(Q){let{gen:X,schema:Y,it:W}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");let $=X.name("valid");Y.forEach((J,G)=>{if((0,hw.alwaysValidSchema)(W,J))return;let H=Q.subschema({keyword:"allOf",schemaProp:G},$);Q.ok($),Q.mergeEvaluated(H)})}};q3.default=fw});var N3=P((O3)=>{Object.defineProperty(O3,"__esModule",{value:!0});var w8=l(),U3=o(),lw={message:({params:Q})=>w8.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>w8._`{failingKeyword: ${Q.ifClause}}`},mw={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:lw,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,U3.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let $=V3(W,"then"),J=V3(W,"else");if(!$&&!J)return;let G=X.let("valid",!0),H=X.name("_valid");if(B(),Q.reset(),$&&J){let A=X.let("ifClause");Q.setParams({ifClause:A}),X.if(H,z("then",A),z("else",A))}else if($)X.if(H,z("then"));else X.if((0,w8.not)(H),z("else"));Q.pass(G,()=>Q.error(!0));function B(){let A=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},H);Q.mergeEvaluated(A)}function z(A,D){return()=>{let L=Q.subschema({keyword:A},H);if(X.assign(G,H),Q.mergeValidEvaluated(L,G),D)X.assign(D,w8._`${A}`);else Q.setParams({ifClause:A})}}}};function V3(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,U3.alwaysValidSchema)(Q,Y)}O3.default=mw});var M3=P((w3)=>{Object.defineProperty(w3,"__esModule",{value:!0});var pw=o(),iw={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,pw.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};w3.default=iw});var b3=P((j3)=>{Object.defineProperty(j3,"__esModule",{value:!0});var dw=sY(),ow=yH(),rw=eY(),tw=uH(),aw=mH(),sw=oH(),ew=aH(),QM=XW(),XM=Y3(),YM=H3(),WM=z3(),$M=K3(),JM=L3(),GM=F3(),HM=N3(),BM=M3();function zM(Q=!1){let X=[WM.default,$M.default,JM.default,GM.default,HM.default,BM.default,ew.default,QM.default,sw.default,XM.default,YM.default];if(Q)X.push(ow.default,tw.default);else X.push(dw.default,rw.default);return X.push(aw.default),X}j3.default=zM});var S3=P((E3)=>{Object.defineProperty(E3,"__esModule",{value:!0});var K0=l(),KM={message:({schemaCode:Q})=>K0.str`must match format "${Q}"`,params:({schemaCode:Q})=>K0._`{format: ${Q}}`},DM={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:KM,code(Q,X){let{gen:Y,data:W,$data:$,schema:J,schemaCode:G,it:H}=Q,{opts:B,errSchemaPath:z,schemaEnv:A,self:D}=H;if(!B.validateFormats)return;if($)L();else K();function L(){let q=Y.scopeValue("formats",{ref:D.formats,code:B.code.formats}),F=Y.const("fDef",K0._`${q}[${G}]`),N=Y.let("fType"),O=Y.let("format");Y.if(K0._`typeof ${F} == "object" && !(${F} instanceof RegExp)`,()=>Y.assign(N,K0._`${F}.type || "string"`).assign(O,K0._`${F}.validate`),()=>Y.assign(N,K0._`"string"`).assign(O,F)),Q.fail$data((0,K0.or)(b(),E()));function b(){if(B.strictSchema===!1)return K0.nil;return K0._`${G} && !${O}`}function E(){let y=A.$async?K0._`(${F}.async ? await ${O}(${W}) : ${O}(${W}))`:K0._`${O}(${W})`,x=K0._`(typeof ${O} == "function" ? ${y} : ${O}.test(${W}))`;return K0._`${O} && ${O} !== true && ${N} === ${X} && !${x}`}}function K(){let q=D.formats[J];if(!q){b();return}if(q===!0)return;let[F,N,O]=E(q);if(F===X)Q.pass(y());function b(){if(B.strictSchema===!1){D.logger.warn(x());return}throw Error(x());function x(){return`unknown format "${J}" ignored in schema at path "${z}"`}}function E(x){let j0=x instanceof RegExp?(0,K0.regexpCode)(x):B.code.formats?K0._`${B.code.formats}${(0,K0.getProperty)(J)}`:void 0,y0=Y.scopeValue("formats",{key:J,ref:x,code:j0});if(typeof x=="object"&&!(x instanceof RegExp))return[x.type||"string",x.validate,K0._`${y0}.validate`];return["string",x,y0]}function y(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!A.$async)throw Error("async format in sync schema");return K0._`await ${O}(${W})`}return typeof N=="function"?K0._`${O}(${W})`:K0._`${O}.test(${W})`}}}};E3.default=DM});var I3=P((P3)=>{Object.defineProperty(P3,"__esModule",{value:!0});var qM=S3(),FM=[qM.default];P3.default=FM});var T3=P((R3)=>{Object.defineProperty(R3,"__esModule",{value:!0});R3.contentVocabulary=R3.metadataVocabulary=void 0;R3.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];R3.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var k3=P((v3)=>{Object.defineProperty(v3,"__esModule",{value:!0});var OM=XH(),NM=RH(),wM=b3(),MM=I3(),Z3=T3(),jM=[OM.default,NM.default,(0,wM.default)(),MM.default,Z3.metadataVocabulary,Z3.contentVocabulary];v3.default=jM});var y3=P((x3)=>{Object.defineProperty(x3,"__esModule",{value:!0});x3.DiscrError=void 0;var _3;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(_3||(x3.DiscrError=_3={}))});var u3=P((f3)=>{Object.defineProperty(f3,"__esModule",{value:!0});var g6=l(),WW=y3(),h3=W8(),EM=R4(),SM=o(),PM={message:({params:{discrError:Q,tagName:X}})=>Q===WW.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:Y}})=>g6._`{error: ${Q}, tag: ${Y}, tagValue: ${X}}`},IM={keyword:"discriminator",type:"object",schemaType:"object",error:PM,code(Q){let{gen:X,data:Y,schema:W,parentSchema:$,it:J}=Q,{oneOf:G}=$;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let H=W.propertyName;if(typeof H!="string")throw Error("discriminator: requires propertyName");if(W.mapping)throw Error("discriminator: mapping is not supported");if(!G)throw Error("discriminator: requires oneOf keyword");let B=X.let("valid",!1),z=X.const("tag",g6._`${Y}${(0,g6.getProperty)(H)}`);X.if(g6._`typeof ${z} == "string"`,()=>A(),()=>Q.error(!1,{discrError:WW.DiscrError.Tag,tag:z,tagName:H})),Q.ok(B);function A(){let K=L();X.if(!1);for(let q in K)X.elseIf(g6._`${z} === ${q}`),X.assign(B,D(K[q]));X.else(),Q.error(!1,{discrError:WW.DiscrError.Mapping,tag:z,tagName:H}),X.endIf()}function D(K){let q=X.name("valid"),F=Q.subschema({keyword:"oneOf",schemaProp:K},q);return Q.mergeEvaluated(F,g6.Name),q}function L(){var K;let q={},F=O($),N=!0;for(let y=0;y<G.length;y++){let x=G[y];if((x===null||x===void 0?void 0:x.$ref)&&!(0,SM.schemaHasRulesButRef)(x,J.self.RULES)){let y0=x.$ref;if(x=h3.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,y0),x instanceof h3.SchemaEnv)x=x.schema;if(x===void 0)throw new EM.default(J.opts.uriResolver,J.baseId,y0)}let j0=(K=x===null||x===void 0?void 0:x.properties)===null||K===void 0?void 0:K[H];if(typeof j0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${H}"`);N=N&&(F||O(x)),b(j0,y)}if(!N)throw Error(`discriminator: "${H}" must be required`);return q;function O({required:y}){return Array.isArray(y)&&y.includes(H)}function b(y,x){if(y.const)E(y.const,x);else if(y.enum)for(let j0 of y.enum)E(j0,x);else throw Error(`discriminator: "properties/${H}" must have "const" or "enum"`)}function E(y,x){if(typeof y!="string"||y in q)throw Error(`discriminator: "${H}" values must be unique strings`);q[y]=x}}}};f3.default=IM});var l3=P((aR,CM)=>{CM.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 JW=P((v0,$W)=>{Object.defineProperty(v0,"__esModule",{value:!0});v0.MissingRefError=v0.ValidationError=v0.CodeGen=v0.Name=v0.nil=v0.stringify=v0.str=v0._=v0.KeywordCxt=v0.Ajv=void 0;var TM=i5(),ZM=k3(),vM=u3(),m3=l3(),kM=["/properties"],M8="http://json-schema.org/draft-07/schema";class u4 extends TM.default{_addVocabularies(){if(super._addVocabularies(),ZM.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(vM.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(m3,kM):m3;this.addMetaSchema(Q,M8,!1),this.refs["http://json-schema.org/schema"]=M8}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(M8)?M8:void 0)}}v0.Ajv=u4;$W.exports=v0=u4;$W.exports.Ajv=u4;Object.defineProperty(v0,"__esModule",{value:!0});v0.default=u4;var _M=I4();Object.defineProperty(v0,"KeywordCxt",{enumerable:!0,get:function(){return _M.KeywordCxt}});var y6=l();Object.defineProperty(v0,"_",{enumerable:!0,get:function(){return y6._}});Object.defineProperty(v0,"str",{enumerable:!0,get:function(){return y6.str}});Object.defineProperty(v0,"stringify",{enumerable:!0,get:function(){return y6.stringify}});Object.defineProperty(v0,"nil",{enumerable:!0,get:function(){return y6.nil}});Object.defineProperty(v0,"Name",{enumerable:!0,get:function(){return y6.Name}});Object.defineProperty(v0,"CodeGen",{enumerable:!0,get:function(){return y6.CodeGen}});var xM=X8();Object.defineProperty(v0,"ValidationError",{enumerable:!0,get:function(){return xM.default}});var gM=R4();Object.defineProperty(v0,"MissingRefError",{enumerable:!0,get:function(){return gM.default}})});var s3=P((t3)=>{Object.defineProperty(t3,"__esModule",{value:!0});t3.formatNames=t3.fastFormats=t3.fullFormats=void 0;function B1(Q,X){return{validate:Q,compare:X}}t3.fullFormats={date:B1(n3,zW),time:B1(HW(!0),AW),"date-time":B1(c3(!0),o3),"iso-time":B1(HW(),d3),"iso-date-time":B1(c3(),r3),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:pM,"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:aM,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:iM,int32:{type:"number",validate:oM},int64:{type:"number",validate:rM},float:{type:"number",validate:i3},double:{type:"number",validate:i3},password:!0,binary:!0};t3.fastFormats={...t3.fullFormats,date:B1(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,zW),time:B1(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,AW),"date-time":B1(/^\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,o3),"iso-time":B1(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,d3),"iso-date-time":B1(/^\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,r3),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};t3.formatNames=Object.keys(t3.fullFormats);function fM(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var uM=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,lM=[0,31,28,31,30,31,30,31,31,30,31,30,31];function n3(Q){let X=uM.exec(Q);if(!X)return!1;let Y=+X[1],W=+X[2],$=+X[3];return W>=1&&W<=12&&$>=1&&$<=(W===2&&fM(Y)?29:lM[W])}function zW(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var GW=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function HW(Q){return function(Y){let W=GW.exec(Y);if(!W)return!1;let $=+W[1],J=+W[2],G=+W[3],H=W[4],B=W[5]==="-"?-1:1,z=+(W[6]||0),A=+(W[7]||0);if(z>23||A>59||Q&&!H)return!1;if($<=23&&J<=59&&G<60)return!0;let D=J-A*B,L=$-z*B-(D<0?1:0);return(L===23||L===-1)&&(D===59||D===-1)&&G<61}}function AW(Q,X){if(!(Q&&X))return;let Y=new Date("2020-01-01T"+Q).valueOf(),W=new Date("2020-01-01T"+X).valueOf();if(!(Y&&W))return;return Y-W}function d3(Q,X){if(!(Q&&X))return;let Y=GW.exec(Q),W=GW.exec(X);if(!(Y&&W))return;if(Q=Y[1]+Y[2]+Y[3],X=W[1]+W[2]+W[3],Q>X)return 1;if(Q<X)return-1;return 0}var BW=/t|\s/i;function c3(Q){let X=HW(Q);return function(W){let $=W.split(BW);return $.length===2&&n3($[0])&&X($[1])}}function o3(Q,X){if(!(Q&&X))return;let Y=new Date(Q).valueOf(),W=new Date(X).valueOf();if(!(Y&&W))return;return Y-W}function r3(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(BW),[$,J]=X.split(BW),G=zW(Y,$);if(G===void 0)return;return G||AW(W,J)}var mM=/\/|:/,cM=/^(?:[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 pM(Q){return mM.test(Q)&&cM.test(Q)}var p3=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function iM(Q){return p3.lastIndex=0,p3.test(Q)}var nM=-2147483648,dM=2147483647;function oM(Q){return Number.isInteger(Q)&&Q<=dM&&Q>=nM}function rM(Q){return Number.isInteger(Q)}function i3(){return!0}var tM=/[^\\]\\Z/;function aM(Q){if(tM.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var QB=P((e3)=>{Object.defineProperty(e3,"__esModule",{value:!0});e3.formatLimitDefinition=void 0;var eM=JW(),Y1=l(),_1=Y1.operators,j8={formatMaximum:{okStr:"<=",ok:_1.LTE,fail:_1.GT},formatMinimum:{okStr:">=",ok:_1.GTE,fail:_1.LT},formatExclusiveMaximum:{okStr:"<",ok:_1.LT,fail:_1.GTE},formatExclusiveMinimum:{okStr:">",ok:_1.GT,fail:_1.LTE}},Qj={message:({keyword:Q,schemaCode:X})=>Y1.str`should be ${j8[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>Y1._`{comparison: ${j8[Q].okStr}, limit: ${X}}`};e3.formatLimitDefinition={keyword:Object.keys(j8),type:"string",schemaType:"string",$data:!0,error:Qj,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:$,it:J}=Q,{opts:G,self:H}=J;if(!G.validateFormats)return;let B=new eM.KeywordCxt(J,H.RULES.all.format.definition,"format");if(B.$data)z();else A();function z(){let L=X.scopeValue("formats",{ref:H.formats,code:G.code.formats}),K=X.const("fmt",Y1._`${L}[${B.schemaCode}]`);Q.fail$data((0,Y1.or)(Y1._`typeof ${K} != "object"`,Y1._`${K} instanceof RegExp`,Y1._`typeof ${K}.compare != "function"`,D(K)))}function A(){let L=B.schema,K=H.formats[L];if(!K||K===!0)return;if(typeof K!="object"||K instanceof RegExp||typeof K.compare!="function")throw Error(`"${$}": format "${L}" does not define "compare" function`);let q=X.scopeValue("formats",{key:L,ref:K,code:G.code.formats?Y1._`${G.code.formats}${(0,Y1.getProperty)(L)}`:void 0});Q.fail$data(D(q))}function D(L){return Y1._`${L}.compare(${Y}, ${W}) ${j8[$].fail} 0`}},dependencies:["format"]};var Xj=(Q)=>{return Q.addKeyword(e3.formatLimitDefinition),Q};e3.default=Xj});var $B=P((l4,WB)=>{Object.defineProperty(l4,"__esModule",{value:!0});var h6=s3(),Wj=QB(),LW=l(),XB=new LW.Name("fullFormats"),$j=new LW.Name("fastFormats"),qW=(Q,X={keywords:!0})=>{if(Array.isArray(X))return YB(Q,X,h6.fullFormats,XB),Q;let[Y,W]=X.mode==="fast"?[h6.fastFormats,$j]:[h6.fullFormats,XB],$=X.formats||h6.formatNames;if(YB(Q,$,Y,W),X.keywords)(0,Wj.default)(Q);return Q};qW.get=(Q,X="full")=>{let W=(X==="fast"?h6.fastFormats:h6.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function YB(Q,X,Y,W){var $,J;($=(J=Q.opts.code).formats)!==null&&$!==void 0||(J.formats=LW._`require("ajv-formats/dist/formats").${W}`);for(let G of X)Q.addFormat(G,Y[G])}WB.exports=l4=qW;Object.defineProperty(l4,"__esModule",{value:!0});l4.default=qW});import TJ from"node:process";var fB=Object.freeze({status:"aborted"});function U(Q,X,Y){function W(H,B){var z;Object.defineProperty(H,"_zod",{value:H._zod??{},enumerable:!1}),(z=H._zod).traits??(z.traits=new Set),H._zod.traits.add(Q),X(H,B);for(let A in G.prototype)if(!(A in H))Object.defineProperty(H,A,{value:G.prototype[A].bind(H)});H._zod.constr=G,H._zod.def=B}let $=Y?.Parent??Object;class J extends ${}Object.defineProperty(J,"name",{value:Q});function G(H){var B;let z=Y?.Parent?new J:this;W(z,H),(B=z._zod).deferred??(B.deferred=[]);for(let A of z._zod.deferred)A();return z}return Object.defineProperty(G,"init",{value:W}),Object.defineProperty(G,Symbol.hasInstance,{value:(H)=>{if(Y?.Parent&&H instanceof Y.Parent)return!0;return H?._zod?.traits?.has(Q)}}),Object.defineProperty(G,"name",{value:Q}),G}var uB=Symbol("zod_brand");class V1 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var p4={};function k0(Q){if(Q)Object.assign(p4,Q);return p4}var p={};P8(p,{unwrapMessage:()=>m6,stringifyPrimitive:()=>d4,required:()=>Wz,randomString:()=>oB,propertyKeyTypes:()=>v8,promiseAllObject:()=>dB,primitiveTypes:()=>PW,prefixIssues:()=>W1,pick:()=>sB,partial:()=>Yz,optionalKeys:()=>k8,omit:()=>eB,numKeys:()=>rB,nullish:()=>i6,normalizeParams:()=>k,merge:()=>Xz,jsonStringifyReplacer:()=>R8,joinValues:()=>i4,issue:()=>x8,isPlainObject:()=>W6,isObject:()=>Y6,getSizableOrigin:()=>RW,getParsedType:()=>tB,getLengthableOrigin:()=>d6,getEnumValues:()=>c6,getElementAtPath:()=>nB,floatSafeRemainder:()=>C8,finalizeIssue:()=>p0,extend:()=>Qz,escapeRegex:()=>U1,esc:()=>g1,defineLazy:()=>Q0,createTransparentProxy:()=>aB,clone:()=>_0,cleanRegex:()=>n6,cleanEnum:()=>$z,captureStackTrace:()=>n4,cached:()=>p6,assignProp:()=>T8,assertNotEqual:()=>mB,assertNever:()=>pB,assertIs:()=>cB,assertEqual:()=>lB,assert:()=>iB,allowsEval:()=>Z8,aborted:()=>y1,NUMBER_FORMAT_RANGES:()=>_8,Class:()=>CW,BIGINT_FORMAT_RANGES:()=>IW});function lB(Q){return Q}function mB(Q){return Q}function cB(Q){}function pB(Q){throw Error()}function iB(Q){}function c6(Q){let X=Object.values(Q).filter((W)=>typeof W==="number");return Object.entries(Q).filter(([W,$])=>X.indexOf(+W)===-1).map(([W,$])=>$)}function i4(Q,X="|"){return Q.map((Y)=>d4(Y)).join(X)}function R8(Q,X){if(typeof X==="bigint")return X.toString();return X}function p6(Q){return{get value(){{let Y=Q();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function i6(Q){return Q===null||Q===void 0}function n6(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function C8(Q,X){let Y=(Q.toString().split(".")[1]||"").length,W=(X.toString().split(".")[1]||"").length,$=Y>W?Y:W,J=Number.parseInt(Q.toFixed($).replace(".","")),G=Number.parseInt(X.toFixed($).replace(".",""));return J%G/10**$}function Q0(Q,X,Y){Object.defineProperty(Q,X,{get(){{let $=Y();return Q[X]=$,$}throw Error("cached value already set")},set($){Object.defineProperty(Q,X,{value:$})},configurable:!0})}function T8(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function nB(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function dB(Q){let X=Object.keys(Q),Y=X.map((W)=>Q[W]);return Promise.all(Y).then((W)=>{let $={};for(let J=0;J<X.length;J++)$[X[J]]=W[J];return $})}function oB(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function g1(Q){return JSON.stringify(Q)}var n4=Error.captureStackTrace?Error.captureStackTrace:(...Q)=>{};function Y6(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var Z8=p6(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function W6(Q){if(Y6(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;let Y=X.prototype;if(Y6(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function rB(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var tB=(Q)=>{let X=typeof Q;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(Q)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Q.then&&typeof Q.then==="function"&&Q.catch&&typeof Q.catch==="function")return"promise";if(typeof Map<"u"&&Q instanceof Map)return"map";if(typeof Set<"u"&&Q instanceof Set)return"set";if(typeof Date<"u"&&Q instanceof Date)return"date";if(typeof File<"u"&&Q instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},v8=new Set(["string","number","symbol"]),PW=new Set(["string","number","bigint","boolean","symbol","undefined"]);function U1(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function k(Q){let X=Q;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function aB(Q){let X;return new Proxy({},{get(Y,W,$){return X??(X=Q()),Reflect.get(X,W,$)},set(Y,W,$,J){return X??(X=Q()),Reflect.set(X,W,$,J)},has(Y,W){return X??(X=Q()),Reflect.has(X,W)},deleteProperty(Y,W){return X??(X=Q()),Reflect.deleteProperty(X,W)},ownKeys(Y){return X??(X=Q()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(Y,W){return X??(X=Q()),Reflect.getOwnPropertyDescriptor(X,W)},defineProperty(Y,W,$){return X??(X=Q()),Reflect.defineProperty(X,W,$)}})}function d4(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function k8(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var _8={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]},IW={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function sB(Q,X){let Y={},W=Q._zod.def;for(let $ in X){if(!($ in W.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;Y[$]=W.shape[$]}return _0(Q,{...Q._zod.def,shape:Y,checks:[]})}function eB(Q,X){let Y={...Q._zod.def.shape},W=Q._zod.def;for(let $ in X){if(!($ in W.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;delete Y[$]}return _0(Q,{...Q._zod.def,shape:Y,checks:[]})}function Qz(Q,X){if(!W6(X))throw Error("Invalid input to extend: expected a plain object");let Y={...Q._zod.def,get shape(){let W={...Q._zod.def.shape,...X};return T8(this,"shape",W),W},checks:[]};return _0(Q,Y)}function Xz(Q,X){return _0(Q,{...Q._zod.def,get shape(){let Y={...Q._zod.def.shape,...X._zod.def.shape};return T8(this,"shape",Y),Y},catchall:X._zod.def.catchall,checks:[]})}function Yz(Q,X,Y){let W=X._zod.def.shape,$={...W};if(Y)for(let J in Y){if(!(J in W))throw Error(`Unrecognized key: "${J}"`);if(!Y[J])continue;$[J]=Q?new Q({type:"optional",innerType:W[J]}):W[J]}else for(let J in W)$[J]=Q?new Q({type:"optional",innerType:W[J]}):W[J];return _0(X,{...X._zod.def,shape:$,checks:[]})}function Wz(Q,X,Y){let W=X._zod.def.shape,$={...W};if(Y)for(let J in Y){if(!(J in $))throw Error(`Unrecognized key: "${J}"`);if(!Y[J])continue;$[J]=new Q({type:"nonoptional",innerType:W[J]})}else for(let J in W)$[J]=new Q({type:"nonoptional",innerType:W[J]});return _0(X,{...X._zod.def,shape:$,checks:[]})}function y1(Q,X=0){for(let Y=X;Y<Q.issues.length;Y++)if(Q.issues[Y]?.continue!==!0)return!0;return!1}function W1(Q,X){return X.map((Y)=>{var W;return(W=Y).path??(W.path=[]),Y.path.unshift(Q),Y})}function m6(Q){return typeof Q==="string"?Q:Q?.message}function p0(Q,X,Y){let W={...Q,path:Q.path??[]};if(!Q.message){let $=m6(Q.inst?._zod.def?.error?.(Q))??m6(X?.error?.(Q))??m6(Y.customError?.(Q))??m6(Y.localeError?.(Q))??"Invalid input";W.message=$}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function RW(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function d6(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function x8(...Q){let[X,Y,W]=Q;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function $z(Q){return Object.entries(Q).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}class CW{constructor(...Q){}}var TW=(Q,X)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:X,enumerable:!1}),Object.defineProperty(Q,"message",{get(){return JSON.stringify(X,R8,2)},enumerable:!0}),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},o4=U("$ZodError",TW),o6=U("$ZodError",TW,{Parent:Error});function g8(Q,X=(Y)=>Y.message){let Y={},W=[];for(let $ of Q.issues)if($.path.length>0)Y[$.path[0]]=Y[$.path[0]]||[],Y[$.path[0]].push(X($));else W.push(X($));return{formErrors:W,fieldErrors:Y}}function y8(Q,X){let Y=X||function(J){return J.message},W={_errors:[]},$=(J)=>{for(let G of J.issues)if(G.code==="invalid_union"&&G.errors.length)G.errors.map((H)=>$({issues:H}));else if(G.code==="invalid_key")$({issues:G.issues});else if(G.code==="invalid_element")$({issues:G.issues});else if(G.path.length===0)W._errors.push(Y(G));else{let H=W,B=0;while(B<G.path.length){let z=G.path[B];if(B!==G.path.length-1)H[z]=H[z]||{_errors:[]};else H[z]=H[z]||{_errors:[]},H[z]._errors.push(Y(G));H=H[z],B++}}};return $(Q),W}var h8=(Q)=>(X,Y,W,$)=>{let J=W?Object.assign(W,{async:!1}):{async:!1},G=X._zod.run({value:Y,issues:[]},J);if(G instanceof Promise)throw new V1;if(G.issues.length){let H=new($?.Err??Q)(G.issues.map((B)=>p0(B,J,k0())));throw n4(H,$?.callee),H}return G.value},f8=h8(o6),u8=(Q)=>async(X,Y,W,$)=>{let J=W?Object.assign(W,{async:!0}):{async:!0},G=X._zod.run({value:Y,issues:[]},J);if(G instanceof Promise)G=await G;if(G.issues.length){let H=new($?.Err??Q)(G.issues.map((B)=>p0(B,J,k0())));throw n4(H,$?.callee),H}return G.value},l8=u8(o6),m8=(Q)=>(X,Y,W)=>{let $=W?{...W,async:!1}:{async:!1},J=X._zod.run({value:Y,issues:[]},$);if(J instanceof Promise)throw new V1;return J.issues.length?{success:!1,error:new(Q??o4)(J.issues.map((G)=>p0(G,$,k0())))}:{success:!0,data:J.value}},h1=m8(o6),c8=(Q)=>async(X,Y,W)=>{let $=W?Object.assign(W,{async:!0}):{async:!0},J=X._zod.run({value:Y,issues:[]},$);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new Q(J.issues.map((G)=>p0(G,$,k0())))}:{success:!0,data:J.value}},f1=c8(o6);var ZW=/^[cC][^\s-]{8,}$/,vW=/^[0-9a-z]+$/,kW=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_W=/^[0-9a-vA-V]{20}$/,xW=/^[A-Za-z0-9]{27}$/,gW=/^[a-zA-Z0-9_-]{21}$/,yW=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var hW=/^([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})$/,p8=(Q)=>{if(!Q)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}-${Q}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var fW=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function uW(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var lW=/^(?:(?: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])$/,mW=/^(([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})$/,cW=/^((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])$/,pW=/^(([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])$/,iW=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,i8=/^[A-Za-z0-9_-]*$/,nW=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var dW=/^\+(?:[0-9]){6,14}[0-9]$/,oW="(?:(?:\\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])))",rW=new RegExp(`^${oW}$`);function tW(Q){return typeof Q.precision==="number"?Q.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":Q.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{${Q.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function aW(Q){return new RegExp(`^${tW(Q)}$`)}function sW(Q){let X=tW({precision:Q.precision}),Y=["Z"];if(Q.local)Y.push("");if(Q.offset)Y.push("([+-]\\d{2}:\\d{2})");let W=`${X}(?:${Y.join("|")})`;return new RegExp(`^${oW}T(?:${W})$`)}var eW=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var Q$=/^\d+$/,X$=/^-?\d+(?:\.\d+)?/i,Y$=/true|false/i,W$=/null/i;var $$=/^[^A-Z]*$/,J$=/^[^a-z]*$/;var F0=U("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),G$={number:"number",bigint:"bigint",object:"date"},n8=U("$ZodCheckLessThan",(Q,X)=>{F0.init(Q,X);let Y=G$[typeof X.value];Q._zod.onattach.push((W)=>{let $=W._zod.bag,J=(X.inclusive?$.maximum:$.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<J)if(X.inclusive)$.maximum=X.value;else $.exclusiveMaximum=X.value}),Q._zod.check=(W)=>{if(X.inclusive?W.value<=X.value:W.value<X.value)return;W.issues.push({origin:Y,code:"too_big",maximum:X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),d8=U("$ZodCheckGreaterThan",(Q,X)=>{F0.init(Q,X);let Y=G$[typeof X.value];Q._zod.onattach.push((W)=>{let $=W._zod.bag,J=(X.inclusive?$.minimum:$.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>J)if(X.inclusive)$.minimum=X.value;else $.exclusiveMinimum=X.value}),Q._zod.check=(W)=>{if(X.inclusive?W.value>=X.value:W.value>X.value)return;W.issues.push({origin:Y,code:"too_small",minimum:X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),H$=U("$ZodCheckMultipleOf",(Q,X)=>{F0.init(Q,X),Q._zod.onattach.push((Y)=>{var W;(W=Y._zod.bag).multipleOf??(W.multipleOf=X.value)}),Q._zod.check=(Y)=>{if(typeof Y.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof Y.value==="bigint"?Y.value%X.value===BigInt(0):C8(Y.value,X.value)===0)return;Y.issues.push({origin:typeof Y.value,code:"not_multiple_of",divisor:X.value,input:Y.value,inst:Q,continue:!X.abort})}}),B$=U("$ZodCheckNumberFormat",(Q,X)=>{F0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[$,J]=_8[X.format];Q._zod.onattach.push((G)=>{let H=G._zod.bag;if(H.format=X.format,H.minimum=$,H.maximum=J,Y)H.pattern=Q$}),Q._zod.check=(G)=>{let H=G.value;if(Y){if(!Number.isInteger(H)){G.issues.push({expected:W,format:X.format,code:"invalid_type",input:H,inst:Q});return}if(!Number.isSafeInteger(H)){if(H>0)G.issues.push({input:H,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!X.abort});else G.issues.push({input:H,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,continue:!X.abort});return}}if(H<$)G.issues.push({origin:"number",input:H,code:"too_small",minimum:$,inclusive:!0,inst:Q,continue:!X.abort});if(H>J)G.issues.push({origin:"number",input:H,code:"too_big",maximum:J,inst:Q})}});var z$=U("$ZodCheckMaxLength",(Q,X)=>{var Y;F0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let $=W.value;return!i6($)&&$.length!==void 0}),Q._zod.onattach.push((W)=>{let $=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<$)W._zod.bag.maximum=X.maximum}),Q._zod.check=(W)=>{let $=W.value;if($.length<=X.maximum)return;let G=d6($);W.issues.push({origin:G,code:"too_big",maximum:X.maximum,inclusive:!0,input:$,inst:Q,continue:!X.abort})}}),A$=U("$ZodCheckMinLength",(Q,X)=>{var Y;F0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let $=W.value;return!i6($)&&$.length!==void 0}),Q._zod.onattach.push((W)=>{let $=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>$)W._zod.bag.minimum=X.minimum}),Q._zod.check=(W)=>{let $=W.value;if($.length>=X.minimum)return;let G=d6($);W.issues.push({origin:G,code:"too_small",minimum:X.minimum,inclusive:!0,input:$,inst:Q,continue:!X.abort})}}),K$=U("$ZodCheckLengthEquals",(Q,X)=>{var Y;F0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let $=W.value;return!i6($)&&$.length!==void 0}),Q._zod.onattach.push((W)=>{let $=W._zod.bag;$.minimum=X.length,$.maximum=X.length,$.length=X.length}),Q._zod.check=(W)=>{let $=W.value,J=$.length;if(J===X.length)return;let G=d6($),H=J>X.length;W.issues.push({origin:G,...H?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:W.value,inst:Q,continue:!X.abort})}}),r6=U("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(F0.init(Q,X),Q._zod.onattach.push(($)=>{let J=$._zod.bag;if(J.format=X.format,X.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(X.pattern)}),X.pattern)(Y=Q._zod).check??(Y.check=($)=>{if(X.pattern.lastIndex=0,X.pattern.test($.value))return;$.issues.push({origin:"string",code:"invalid_format",format:X.format,input:$.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:Q,continue:!X.abort})});else(W=Q._zod).check??(W.check=()=>{})}),D$=U("$ZodCheckRegex",(Q,X)=>{r6.init(Q,X),Q._zod.check=(Y)=>{if(X.pattern.lastIndex=0,X.pattern.test(Y.value))return;Y.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Y.value,pattern:X.pattern.toString(),inst:Q,continue:!X.abort})}}),L$=U("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=$$),r6.init(Q,X)}),q$=U("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=J$),r6.init(Q,X)}),F$=U("$ZodCheckIncludes",(Q,X)=>{F0.init(Q,X);let Y=U1(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=W,Q._zod.onattach.push(($)=>{let J=$._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(W)}),Q._zod.check=($)=>{if($.value.includes(X.includes,X.position))return;$.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:$.value,inst:Q,continue:!X.abort})}}),V$=U("$ZodCheckStartsWith",(Q,X)=>{F0.init(Q,X);let Y=new RegExp(`^${U1(X.prefix)}.*`);X.pattern??(X.pattern=Y),Q._zod.onattach.push((W)=>{let $=W._zod.bag;$.patterns??($.patterns=new Set),$.patterns.add(Y)}),Q._zod.check=(W)=>{if(W.value.startsWith(X.prefix))return;W.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:W.value,inst:Q,continue:!X.abort})}}),U$=U("$ZodCheckEndsWith",(Q,X)=>{F0.init(Q,X);let Y=new RegExp(`.*${U1(X.suffix)}$`);X.pattern??(X.pattern=Y),Q._zod.onattach.push((W)=>{let $=W._zod.bag;$.patterns??($.patterns=new Set),$.patterns.add(Y)}),Q._zod.check=(W)=>{if(W.value.endsWith(X.suffix))return;W.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:W.value,inst:Q,continue:!X.abort})}});var O$=U("$ZodCheckOverwrite",(Q,X)=>{F0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class o8{constructor(Q=[]){if(this.content=[],this.indent=0,this)this.args=Q}indented(Q){this.indent+=1,Q(this),this.indent-=1}write(Q){if(typeof Q==="function"){Q(this,{execution:"sync"}),Q(this,{execution:"async"});return}let Y=Q.split(`
10
- `).filter((J)=>J),W=Math.min(...Y.map((J)=>J.length-J.trimStart().length)),$=Y.map((J)=>J.slice(W)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of $)this.content.push(J)}compile(){let Q=Function,X=this?.args,W=[...(this?.content??[""]).map(($)=>` ${$}`)];return new Q(...X,W.join(`
11
- `))}}var w$={major:4,minor:0,patch:0};var a=U("$ZodType",(Q,X)=>{var Y;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=w$;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let $ of W)for(let J of $._zod.onattach)J(Q);if(W.length===0)(Y=Q._zod).deferred??(Y.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let $=(J,G,H)=>{let B=y1(J),z;for(let A of G){if(A._zod.def.when){if(!A._zod.def.when(J))continue}else if(B)continue;let D=J.issues.length,L=A._zod.check(J);if(L instanceof Promise&&H?.async===!1)throw new V1;if(z||L instanceof Promise)z=(z??Promise.resolve()).then(async()=>{if(await L,J.issues.length===D)return;if(!B)B=y1(J,D)});else{if(J.issues.length===D)continue;if(!B)B=y1(J,D)}}if(z)return z.then(()=>{return J});return J};Q._zod.run=(J,G)=>{let H=Q._zod.parse(J,G);if(H instanceof Promise){if(G.async===!1)throw new V1;return H.then((B)=>$(B,W,G))}return $(H,W,G)}}Q["~standard"]={validate:($)=>{try{let J=h1(Q,$);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return f1(Q,$).then((G)=>G.success?{value:G.data}:{issues:G.error?.issues})}},vendor:"zod",version:1}}),t6=U("$ZodString",(Q,X)=>{a.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??eW(Q._zod.bag),Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=String(Y.value)}catch($){}if(typeof Y.value==="string")return Y;return Y.issues.push({expected:"string",code:"invalid_type",input:Y.value,inst:Q}),Y}}),X0=U("$ZodStringFormat",(Q,X)=>{r6.init(Q,X),t6.init(Q,X)}),t8=U("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=hW),X0.init(Q,X)}),a8=U("$ZodUUID",(Q,X)=>{if(X.version){let W={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(W===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=p8(W))}else X.pattern??(X.pattern=p8());X0.init(Q,X)}),s8=U("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=fW),X0.init(Q,X)}),e8=U("$ZodURL",(Q,X)=>{X0.init(Q,X),Q._zod.check=(Y)=>{try{let W=Y.value,$=new URL(W),J=$.href;if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test($.hostname))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:nW.source,input:Y.value,inst:Q,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test($.protocol.endsWith(":")?$.protocol.slice(0,-1):$.protocol))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:Y.value,inst:Q,continue:!X.abort})}if(!W.endsWith("/")&&J.endsWith("/"))Y.value=J.slice(0,-1);else Y.value=J;return}catch(W){Y.issues.push({code:"invalid_format",format:"url",input:Y.value,inst:Q,continue:!X.abort})}}}),QQ=U("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=uW()),X0.init(Q,X)}),XQ=U("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=gW),X0.init(Q,X)}),YQ=U("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=ZW),X0.init(Q,X)}),WQ=U("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=vW),X0.init(Q,X)}),$Q=U("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=kW),X0.init(Q,X)}),JQ=U("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=_W),X0.init(Q,X)}),GQ=U("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=xW),X0.init(Q,X)}),T$=U("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=sW(X)),X0.init(Q,X)}),Z$=U("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=rW),X0.init(Q,X)}),v$=U("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=aW(X)),X0.init(Q,X)}),k$=U("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=yW),X0.init(Q,X)}),HQ=U("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=lW),X0.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv4"})}),BQ=U("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=mW),X0.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv6"}),Q._zod.check=(Y)=>{try{new URL(`http://[${Y.value}]`)}catch{Y.issues.push({code:"invalid_format",format:"ipv6",input:Y.value,inst:Q,continue:!X.abort})}}}),zQ=U("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=cW),X0.init(Q,X)}),AQ=U("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=pW),X0.init(Q,X),Q._zod.check=(Y)=>{let[W,$]=Y.value.split("/");try{if(!$)throw Error();let J=Number($);if(`${J}`!==$)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${W}]`)}catch{Y.issues.push({code:"invalid_format",format:"cidrv6",input:Y.value,inst:Q,continue:!X.abort})}}});function _$(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var KQ=U("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=iW),X0.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64"}),Q._zod.check=(Y)=>{if(_$(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:Q,continue:!X.abort})}});function Gz(Q){if(!i8.test(Q))return!1;let X=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return _$(Y)}var DQ=U("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=i8),X0.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64url"}),Q._zod.check=(Y)=>{if(Gz(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:Q,continue:!X.abort})}}),LQ=U("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=dW),X0.init(Q,X)});function Hz(Q,X=null){try{let Y=Q.split(".");if(Y.length!==3)return!1;let[W]=Y;if(!W)return!1;let $=JSON.parse(atob(W));if("typ"in $&&$?.typ!=="JWT")return!1;if(!$.alg)return!1;if(X&&(!("alg"in $)||$.alg!==X))return!1;return!0}catch{return!1}}var qQ=U("$ZodJWT",(Q,X)=>{X0.init(Q,X),Q._zod.check=(Y)=>{if(Hz(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:Q,continue:!X.abort})}});var a4=U("$ZodNumber",(Q,X)=>{a.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??X$,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch(G){}let $=Y.value;if(typeof $==="number"&&!Number.isNaN($)&&Number.isFinite($))return Y;let J=typeof $==="number"?Number.isNaN($)?"NaN":!Number.isFinite($)?"Infinity":void 0:void 0;return Y.issues.push({expected:"number",code:"invalid_type",input:$,inst:Q,...J?{received:J}:{}}),Y}}),FQ=U("$ZodNumber",(Q,X)=>{B$.init(Q,X),a4.init(Q,X)}),VQ=U("$ZodBoolean",(Q,X)=>{a.init(Q,X),Q._zod.pattern=Y$,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch(J){}let $=Y.value;if(typeof $==="boolean")return Y;return Y.issues.push({expected:"boolean",code:"invalid_type",input:$,inst:Q}),Y}});var UQ=U("$ZodNull",(Q,X)=>{a.init(Q,X),Q._zod.pattern=W$,Q._zod.values=new Set([null]),Q._zod.parse=(Y,W)=>{let $=Y.value;if($===null)return Y;return Y.issues.push({expected:"null",code:"invalid_type",input:$,inst:Q}),Y}});var OQ=U("$ZodUnknown",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y)=>Y}),NQ=U("$ZodNever",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:Q}),Y}});function M$(Q,X,Y){if(Q.issues.length)X.issues.push(...W1(Y,Q.issues));X.value[Y]=Q.value}var wQ=U("$ZodArray",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{let $=Y.value;if(!Array.isArray($))return Y.issues.push({expected:"array",code:"invalid_type",input:$,inst:Q}),Y;Y.value=Array($.length);let J=[];for(let G=0;G<$.length;G++){let H=$[G],B=X.element._zod.run({value:H,issues:[]},W);if(B instanceof Promise)J.push(B.then((z)=>M$(z,Y,G)));else M$(B,Y,G)}if(J.length)return Promise.all(J).then(()=>Y);return Y}});function t4(Q,X,Y){if(Q.issues.length)X.issues.push(...W1(Y,Q.issues));X.value[Y]=Q.value}function j$(Q,X,Y,W){if(Q.issues.length)if(W[Y]===void 0)if(Y in W)X.value[Y]=void 0;else X.value[Y]=Q.value;else X.issues.push(...W1(Y,Q.issues));else if(Q.value===void 0){if(Y in W)X.value[Y]=void 0}else X.value[Y]=Q.value}var s4=U("$ZodObject",(Q,X)=>{a.init(Q,X);let Y=p6(()=>{let D=Object.keys(X.shape);for(let K of D)if(!(X.shape[K]instanceof a))throw Error(`Invalid element at key "${K}": expected a Zod schema`);let L=k8(X.shape);return{shape:X.shape,keys:D,keySet:new Set(D),numKeys:D.length,optionalKeys:new Set(L)}});Q0(Q._zod,"propValues",()=>{let D=X.shape,L={};for(let K in D){let q=D[K]._zod;if(q.values){L[K]??(L[K]=new Set);for(let F of q.values)L[K].add(F)}}return L});let W=(D)=>{let L=new o8(["shape","payload","ctx"]),K=Y.value,q=(b)=>{let E=g1(b);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};L.write("const input = payload.value;");let F=Object.create(null),N=0;for(let b of K.keys)F[b]=`key_${N++}`;L.write("const newResult = {}");for(let b of K.keys)if(K.optionalKeys.has(b)){let E=F[b];L.write(`const ${E} = ${q(b)};`);let y=g1(b);L.write(`
12
- if (${E}.issues.length) {
13
- if (input[${y}] === undefined) {
14
- if (${y} in input) {
15
- newResult[${y}] = undefined;
2
+ var Wh=Object.create;var{getPrototypeOf:Jh,defineProperty:aa,getOwnPropertyNames:Gh}=Object;var ca=Object.prototype.hasOwnProperty;function Yh(e){return this[e]}var Qh,Xh,ua=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?Qh??=new WeakMap:Xh??=new WeakMap,s=n.get(e);if(s)return s}r=e!=null?Wh(Jh(e)):{};let i=t||!e||!e.__esModule||!ca.call(e,"default")?aa(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Gh(e))if(!ca.call(i,a))aa(i,a,{get:Yh.bind(e,a),enumerable:!0})}if(o)n.set(e,i);return i};var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var vr=P(function(Hl){Object.defineProperty(Hl,"__esModule",{value:!0});Hl.regexpCode=Hl.getEsmExportName=Hl.getProperty=Hl.safeStringify=Hl.stringify=Hl.strConcat=Hl.addCodeArg=Hl.str=Hl._=Hl.nil=Hl._Code=Hl.Name=Hl.IDENTIFIER=Hl._CodeOrName=void 0;class Po{}Hl._CodeOrName=Po;Hl.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Ot extends Po{constructor(e){super();if(!Hl.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}}}Hl.Name=Ot;class Te extends Po{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 Ot)t[r.str]=(t[r.str]||0)+1;return t},{})}}Hl._Code=Te;Hl.nil=new Te("");function Vl(e,...t){let r=[e[0]],o=0;while(o<t.length)qs(r,t[o]),r.push(e[++o]);return new Te(r)}Hl._=Vl;var Zs=new Te("+");function Fl(e,...t){let r=[yr(e[0])],o=0;while(o<t.length)r.push(Zs),qs(r,t[o]),r.push(Zs,yr(e[++o]));return Ly(r),new Te(r)}Hl.str=Fl;function qs(e,t){if(t instanceof Te)e.push(...t._items);else if(t instanceof Ot)e.push(t);else e.push(Fy(t))}Hl.addCodeArg=qs;function Ly(e){let t=1;while(t<e.length-1){if(e[t]===Zs){let r=Uy(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Uy(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Ot||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 Ot))return`"${e}${t.slice(1)}`;return}function Vy(e,t){return t.emptyStr()?e:e.emptyStr()?t:Fl`${e}${t}`}Hl.strConcat=Vy;function Fy(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:yr(Array.isArray(e)?e.join(","):e)}function Hy(e){return new Te(yr(e))}Hl.stringify=Hy;function yr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Hl.safeStringify=yr;function Ky(e){return typeof e=="string"&&Hl.IDENTIFIER.test(e)?new Te(`.${e}`):Vl`[${e}]`}Hl.getProperty=Ky;function By(e){if(typeof e=="string"&&Hl.IDENTIFIER.test(e))return new Te(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Hl.getEsmExportName=By;function Wy(e){return new Te(e.toString())}Hl.regexpCode=Wy});var Us=P(function(Jl){Object.defineProperty(Jl,"__esModule",{value:!0});Jl.ValueScope=Jl.ValueScopeName=Jl.Scope=Jl.varKinds=Jl.UsedValueState=void 0;var ye=vr();class Bl extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Eo;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Eo||(Jl.UsedValueState=Eo={}));Jl.varKinds={const:new ye.Name("const"),let:new ye.Name("let"),var:new ye.Name("var")};class Ds{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof ye.Name?e:this.name(e)}name(e){return new ye.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}}}Jl.Scope=Ds;class Ls extends ye.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=ye._`.${new ye.Name(t)}[${r}]`}}Jl.ValueScopeName=Ls;var av=ye._`\n`;class Wl extends Ds{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?av:ye.nil}}get(){return this._scope}name(e){return new Ls(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 ye._`${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=ye.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,Eo.Started);let c=t(u);if(c){let l=this.opts.es5?Jl.varKinds.var:Jl.varKinds.const;n=ye._`${n}${l} ${u} = ${c};${this.opts._n}`}else if(c=o===null||o===void 0?void 0:o(u))n=ye._`${n}${c}${this.opts._n}`;else throw new Bl(u);a.set(u,Eo.Completed)})}return n}}Jl.ValueScope=Wl});var Z=P(function(ve){Object.defineProperty(ve,"__esModule",{value:!0});ve.or=ve.and=ve.not=ve.CodeGen=ve.operators=ve.varKinds=ve.ValueScopeName=ve.ValueScope=ve.Scope=ve.Name=ve.regexpCode=ve.stringify=ve.getProperty=ve.nil=ve.strConcat=ve.str=ve._=void 0;var q=vr(),Ee=Us(),tt=vr();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return tt._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return tt.str}});Object.defineProperty(ve,"strConcat",{enumerable:!0,get:function(){return tt.strConcat}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return tt.nil}});Object.defineProperty(ve,"getProperty",{enumerable:!0,get:function(){return tt.getProperty}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return tt.stringify}});Object.defineProperty(ve,"regexpCode",{enumerable:!0,get:function(){return tt.regexpCode}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return tt.Name}});var No=Us();Object.defineProperty(ve,"Scope",{enumerable:!0,get:function(){return No.Scope}});Object.defineProperty(ve,"ValueScope",{enumerable:!0,get:function(){return No.ValueScope}});Object.defineProperty(ve,"ValueScopeName",{enumerable:!0,get:function(){return No.ValueScopeName}});Object.defineProperty(ve,"varKinds",{enumerable:!0,get:function(){return No.varKinds}});ve.operators={GT:new q._Code(">"),GTE:new q._Code(">="),LT:new q._Code("<"),LTE:new q._Code("<="),EQ:new q._Code("==="),NEQ:new q._Code("!=="),NOT:new q._Code("!"),OR:new q._Code("||"),AND:new q._Code("&&"),ADD:new q._Code("+")};class rt{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Yl extends rt{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?Ee.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=Nt(this.rhs,e,t);return this}get names(){return this.rhs instanceof q._CodeOrName?this.rhs.names:{}}}class Hs extends rt{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 q.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Nt(this.rhs,e,t),this}get names(){let e=this.lhs instanceof q.Name?{}:{...this.lhs.names};return jo(e,this.rhs)}}class Ql extends Hs{constructor(e,t,r,o){super(e,r,o);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Xl extends rt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class ed extends rt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class td extends rt{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class rd extends rt{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=Nt(this.code,e,t),this}get names(){return this.code instanceof q._CodeOrName?this.code.names:{}}}class Ao extends rt{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;dv(e,n.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>mt(e,t.names),{})}}class ot extends Ao{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class od extends Ao{}class $r extends ot{}$r.kind="else";class Ue extends ot{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 $r(r):r}if(t){if(e===!1)return t instanceof Ue?t:t.nodes;if(this.nodes.length)return this;return new Ue(cd(e),t instanceof Ue?[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=Nt(this.condition,e,t),this}get names(){let e=super.names;if(jo(e,this.condition),this.else)mt(e,this.else.names);return e}}Ue.kind="if";class jt extends ot{}jt.kind="for";class nd extends jt{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=Nt(this.iteration,e,t),this}get names(){return mt(super.names,this.iteration.names)}}class sd extends jt{constructor(e,t,r,o){super();this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?Ee.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=jo(super.names,this.from);return jo(e,this.to)}}class Vs extends jt{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=Nt(this.iterable,e,t),this}get names(){return mt(super.names,this.iterable.names)}}class Ro extends ot{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)}}Ro.kind="func";class Io extends Ao{render(e){return"return "+super.render(e)}}Io.kind="return";class id extends ot{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)mt(e,this.catch.names);if(this.finally)mt(e,this.finally.names);return e}}class Co extends ot{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}Co.kind="catch";class Oo extends ot{render(e){return"finally"+super.render(e)}}Oo.kind="finally";class ad{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
3
+ `:""},this._extScope=e,this._scope=new Ee.Scope({parent:e}),this._nodes=[new od]}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 Yl(e,n,r)),n}const(e,t,r){return this._def(Ee.varKinds.const,e,t,r)}let(e,t,r){return this._def(Ee.varKinds.let,e,t,r)}var(e,t,r){return this._def(Ee.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Hs(e,t,r))}add(e,t){return this._leafNode(new Ql(e,ve.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==q.nil)this._leafNode(new rd(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(":"),q.addCodeArg(t,o)}return t.push("}"),new q._Code(t)}if(e,t,r){if(this._blockNode(new Ue(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 Ue(e))}else(){return this._elseNode(new $r)}endIf(){return this._endBlockNode(Ue,$r)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new nd(e),t)}forRange(e,t,r,o,n=this.opts.es5?Ee.varKinds.var:Ee.varKinds.let){let s=this._scope.toName(e);return this._for(new sd(n,s,t,r),()=>o(s))}forOf(e,t,r,o=Ee.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let s=t instanceof q.Name?t:this.var("_arr",t);return this.forRange("_i",0,q._`${s}.length`,(i)=>{this.var(n,q._`${s}[${i}]`),r(n)})}return this._for(new Vs("of",o,n,t),()=>r(n))}forIn(e,t,r,o=this.opts.es5?Ee.varKinds.var:Ee.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,q._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new Vs("in",o,n,t),()=>r(n))}endFor(){return this._endBlockNode(jt)}label(e){return this._leafNode(new Xl(e))}break(e){return this._leafNode(new ed(e))}return(e){let t=new Io;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Io)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new id;if(this._blockNode(o),this.code(e),t){let n=this.name("e");this._currNode=o.catch=new Co(n),t(n)}if(r)this._currNode=o.finally=new Oo,this.code(r);return this._endBlockNode(Co,Oo)}throw(e){return this._leafNode(new td(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=q.nil,r,o){if(this._blockNode(new Ro(e,t,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(Ro)}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 Ue))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}}ve.CodeGen=ad;function mt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function jo(e,t){return t instanceof q._CodeOrName?mt(e,t.names):e}function Nt(e,t,r){if(e instanceof q.Name)return o(e);if(!n(e))return e;return new q._Code(e._items.reduce((s,i)=>{if(i instanceof q.Name)i=o(i);if(i instanceof q._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 q._Code&&s._items.some((i)=>i instanceof q.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function dv(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function cd(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:q._`!${Fs(e)}`}ve.not=cd;var pv=ud(ve.operators.AND);function fv(...e){return e.reduce(pv)}ve.and=fv;var mv=ud(ve.operators.OR);function hv(...e){return e.reduce(mv)}ve.or=hv;function ud(e){return(t,r)=>t===q.nil?r:r===q.nil?t:q._`${Fs(t)} ${e} ${Fs(r)}`}function Fs(e){return e instanceof q.Name?e:q._`(${e})`}});var M=P(function(yd){Object.defineProperty(yd,"__esModule",{value:!0});yd.checkStrictMode=yd.getErrorPath=yd.Type=yd.useFunc=yd.setEvaluated=yd.evaluatedPropsToName=yd.mergeEvaluated=yd.eachItem=yd.unescapeJsonPointer=yd.escapeJsonPointer=yd.escapeFragment=yd.unescapeFragment=yd.schemaRefOrVal=yd.schemaHasRulesButRef=yd.schemaHasRules=yd.checkUnknownRules=yd.alwaysValidSchema=yd.toHash=void 0;var F=Z(),vv=vr();function $v(e){let t={};for(let r of e)t[r]=!0;return t}yd.toHash=$v;function wv(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return fd(e,t),!md(t,e.self.RULES.all)}yd.alwaysValidSchema=wv;function fd(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])gd(e,`unknown keyword: "${s}"`)}yd.checkUnknownRules=fd;function md(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}yd.schemaHasRules=md;function xv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}yd.schemaHasRulesButRef=xv;function bv({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return F._`${r}`}return F._`${e}${t}${F.getProperty(o)}`}yd.schemaRefOrVal=bv;function zv(e){return hd(decodeURIComponent(e))}yd.unescapeFragment=zv;function Sv(e){return encodeURIComponent(Bs(e))}yd.escapeFragment=Sv;function Bs(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}yd.escapeJsonPointer=Bs;function hd(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}yd.unescapeJsonPointer=hd;function kv(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}yd.eachItem=kv;function dd({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let u=i===void 0?s:i instanceof F.Name?(s instanceof F.Name?e(n,s,i):t(n,s,i),i):s instanceof F.Name?(t(n,i,s),s):r(s,i);return a===F.Name&&!(u instanceof F.Name)?o(n,u):u}}yd.mergeEvaluated={props:dd({mergeNames:(e,t,r)=>e.if(F._`${r} !== true && ${t} !== undefined`,()=>{e.if(F._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,F._`${r} || {}`).code(F._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(F._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,F._`${r} || {}`),Ws(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:_d}),items:dd({mergeNames:(e,t,r)=>e.if(F._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,F._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(F._`${r} !== true`,()=>e.assign(r,t===!0?!0:F._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function _d(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",F._`{}`);if(t!==void 0)Ws(e,r,t);return r}yd.evaluatedPropsToName=_d;function Ws(e,t,r){Object.keys(r).forEach((o)=>e.assign(F._`${t}${F.getProperty(o)}`,!0))}yd.setEvaluated=Ws;var pd={};function Pv(e,t){return e.scopeValue("func",{ref:t,code:pd[t.code]||(pd[t.code]=new vv._Code(t.code))})}yd.useFunc=Pv;var Ks;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ks||(yd.Type=Ks={}));function Tv(e,t,r){if(e instanceof F.Name){let o=t===Ks.Num;return r?o?F._`"[" + ${e} + "]"`:F._`"['" + ${e} + "']"`:o?F._`"/" + ${e}`:F._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?F.getProperty(e).toString():"/"+Bs(e)}yd.getErrorPath=Tv;function gd(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}yd.checkStrictMode=gd});var Ve=P(function($d){Object.defineProperty($d,"__esModule",{value:!0});var pe=Z(),Kv={data:new pe.Name("data"),valCxt:new pe.Name("valCxt"),instancePath:new pe.Name("instancePath"),parentData:new pe.Name("parentData"),parentDataProperty:new pe.Name("parentDataProperty"),rootData:new pe.Name("rootData"),dynamicAnchors:new pe.Name("dynamicAnchors"),vErrors:new pe.Name("vErrors"),errors:new pe.Name("errors"),this:new pe.Name("this"),self:new pe.Name("self"),scope:new pe.Name("scope"),json:new pe.Name("json"),jsonPos:new pe.Name("jsonPos"),jsonLen:new pe.Name("jsonLen"),jsonPart:new pe.Name("jsonPart")};$d.default=Kv});var wr=P(function(zd){Object.defineProperty(zd,"__esModule",{value:!0});zd.extendErrors=zd.resetErrorsCount=zd.reportExtraError=zd.reportError=zd.keyword$DataError=zd.keywordError=void 0;var D=Z(),qo=M(),me=Ve();zd.keywordError={message:({keyword:e})=>D.str`must pass "${e}" keyword validation`};zd.keyword$DataError={message:({keyword:e,schemaType:t})=>t?D.str`"${e}" keyword must be ${t} ($data)`:D.str`"${e}" keyword is invalid ($data)`};function Wv(e,t=zd.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,u=bd(e,t,r);if(o!==null&&o!==void 0?o:i||a)wd(s,u);else xd(n,D._`[${u}]`)}zd.reportError=Wv;function Jv(e,t=zd.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=bd(e,t,r);if(wd(n,a),!(s||i))xd(o,me.default.vErrors)}zd.reportExtraError=Jv;function Gv(e,t){e.assign(me.default.errors,t),e.if(D._`${me.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(D._`${me.default.vErrors}.length`,t),()=>e.assign(me.default.vErrors,null)))}zd.resetErrorsCount=Gv;function Yv({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,me.default.errors,(a)=>{if(e.const(i,D._`${me.default.vErrors}[${a}]`),e.if(D._`${i}.instancePath === undefined`,()=>e.assign(D._`${i}.instancePath`,D.strConcat(me.default.instancePath,s.errorPath))),e.assign(D._`${i}.schemaPath`,D.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(D._`${i}.schema`,r),e.assign(D._`${i}.data`,o)})}zd.extendErrors=Yv;function wd(e,t){let r=e.const("err",t);e.if(D._`${me.default.vErrors} === null`,()=>e.assign(me.default.vErrors,D._`[${r}]`),D._`${me.default.vErrors}.push(${r})`),e.code(D._`${me.default.errors}++`)}function xd(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;if(n.$async)r.throw(D._`new ${e.ValidationError}(${t})`);else r.assign(D._`${o}.errors`,t),r.return(!1)}var ht={keyword:new D.Name("keyword"),schemaPath:new D.Name("schemaPath"),params:new D.Name("params"),propertyName:new D.Name("propertyName"),message:new D.Name("message"),schema:new D.Name("schema"),parentSchema:new D.Name("parentSchema")};function bd(e,t,r){let{createErrors:o}=e.it;if(o===!1)return D._`{}`;return Qv(e,t,r)}function Qv(e,t,r={}){let{gen:o,it:n}=e,s=[Xv(n,r),e$(e,r)];return t$(e,t,s),o.object(...s)}function Xv({errorPath:e},{instancePath:t}){let r=t?D.str`${e}${qo.getErrorPath(t,qo.Type.Str)}`:e;return[me.default.instancePath,D.strConcat(me.default.instancePath,r)]}function e$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:D.str`${t}/${e}`;if(r)n=D.str`${n}${qo.getErrorPath(r,qo.Type.Str)}`;return[ht.schemaPath,n]}function t$(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([ht.keyword,n],[ht.params,typeof t=="function"?t(e):t||D._`{}`]),u.messages)o.push([ht.message,typeof r=="function"?r(e):r]);if(u.verbose)o.push([ht.schema,i],[ht.parentSchema,D._`${l}${d}`],[me.default.data,s]);if(c)o.push([ht.propertyName,c])}});var Ed=P(function(Pd){Object.defineProperty(Pd,"__esModule",{value:!0});Pd.boolOrEmptySchema=Pd.topBoolOrEmptySchema=void 0;var i$=wr(),a$=Z(),c$=Ve(),u$={message:"boolean schema is false"};function l$(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(c$.default.data);else t.assign(a$._`${o}.errors`,null),t.return(!0)}Pd.topBoolOrEmptySchema=l$;function d$(e,t){let{gen:r,schema:o}=e;if(o===!1)r.var(t,!1),kd(e);else r.var(t,!0)}Pd.boolOrEmptySchema=d$;function kd(e,t){let{gen:r,data:o}=e;i$.reportError({gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},u$,void 0,t)}});var Gs=P(function(Rd){Object.defineProperty(Rd,"__esModule",{value:!0});Rd.getRules=Rd.isJSONType=void 0;var f$=["string","number","integer","boolean","null","object","array"],m$=new Set(f$);function h$(e){return typeof e=="string"&&m$.has(e)}Rd.isJSONType=h$;function _$(){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:{}}}Rd.getRules=_$});var Ys=P(function(jd){Object.defineProperty(jd,"__esModule",{value:!0});jd.shouldUseRule=jd.shouldUseGroup=jd.schemaHasRulesForType=void 0;function y$({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&Cd(e,o)}jd.schemaHasRulesForType=y$;function Cd(e,t){return t.rules.some((r)=>Od(e,r))}jd.shouldUseGroup=Cd;function Od(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))}jd.shouldUseRule=Od});var xr=P(function(Md){Object.defineProperty(Md,"__esModule",{value:!0});Md.reportTypeError=Md.checkDataTypes=Md.checkDataType=Md.coerceAndCheckDataType=Md.getJSONTypes=Md.getSchemaTypes=Md.DataType=void 0;var w$=Gs(),x$=Ys(),b$=wr(),A=Z(),Ad=M(),At;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(At||(Md.DataType=At={}));function z$(e){let t=Zd(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}Md.getSchemaTypes=z$;function Zd(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(w$.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Md.getJSONTypes=Zd;function S$(e,t){let{gen:r,data:o,opts:n}=e,s=k$(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&x$.schemaHasRulesForType(e,t[0]));if(i){let a=Xs(t,o,n.strictNumbers,At.Wrong);r.if(a,()=>{if(s.length)P$(e,t,s);else ei(e)})}return i}Md.coerceAndCheckDataType=S$;var qd=new Set(["string","number","integer","boolean","null"]);function k$(e,t){return t?e.filter((r)=>qd.has(r)||t==="array"&&r==="array"):[]}function P$(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",A._`typeof ${n}`),a=o.let("coerced",A._`undefined`);if(s.coerceTypes==="array")o.if(A._`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,A._`${n}[0]`).assign(i,A._`typeof ${n}`).if(Xs(t,n,s.strictNumbers),()=>o.assign(a,n)));o.if(A._`${a} !== undefined`);for(let c of r)if(qd.has(c)||c==="array"&&s.coerceTypes==="array")u(c);o.else(),ei(e),o.endIf(),o.if(A._`${a} !== undefined`,()=>{o.assign(n,a),T$(e,a)});function u(c){switch(c){case"string":o.elseIf(A._`${i} == "number" || ${i} == "boolean"`).assign(a,A._`"" + ${n}`).elseIf(A._`${n} === null`).assign(a,A._`""`);return;case"number":o.elseIf(A._`${i} == "boolean" || ${n} === null
4
+ || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,A._`+${n}`);return;case"integer":o.elseIf(A._`${i} === "boolean" || ${n} === null
5
+ || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,A._`+${n}`);return;case"boolean":o.elseIf(A._`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf(A._`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf(A._`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf(A._`${i} === "string" || ${i} === "number"
6
+ || ${i} === "boolean" || ${n} === null`).assign(a,A._`[${n}]`)}}}function T$({gen:e,parentData:t,parentDataProperty:r},o){e.if(A._`${t} !== undefined`,()=>e.assign(A._`${t}[${r}]`,o))}function Qs(e,t,r,o=At.Correct){let n=o===At.Correct?A.operators.EQ:A.operators.NEQ,s;switch(e){case"null":return A._`${t} ${n} null`;case"array":s=A._`Array.isArray(${t})`;break;case"object":s=A._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(A._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return A._`typeof ${t} ${n} ${e}`}return o===At.Correct?s:A.not(s);function i(a=A.nil){return A.and(A._`typeof ${t} == "number"`,a,r?A._`isFinite(${t})`:A.nil)}}Md.checkDataType=Qs;function Xs(e,t,r,o){if(e.length===1)return Qs(e[0],t,r,o);let n,s=Ad.toHash(e);if(s.array&&s.object){let i=A._`typeof ${t} != "object"`;n=s.null?i:A._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=A.nil;if(s.number)delete s.integer;for(let i in s)n=A.and(n,Qs(i,t,r,o));return n}Md.checkDataTypes=Xs;var E$={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?A._`{type: ${e}}`:A._`{type: ${t}}`};function ei(e){let t=R$(e);b$.reportError(t,E$)}Md.reportTypeError=ei;function R$(e){let{gen:t,data:r,schema:o}=e,n=Ad.schemaRefOrVal(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var Fd=P(function(Ud){Object.defineProperty(Ud,"__esModule",{value:!0});Ud.assignDefaults=void 0;var Zt=Z(),Z$=M();function q$(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)Ld(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,s)=>Ld(e,s,n.default))}Ud.assignDefaults=q$;function Ld(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=Zt._`${s}${Zt.getProperty(t)}`;if(n){Z$.checkStrictMode(e,`default is ignored for: ${a}`);return}let u=Zt._`${a} === undefined`;if(i.useDefaults==="empty")u=Zt._`${u} || ${a} === null || ${a} === ""`;o.if(u,Zt._`${a} = ${Zt.stringify(r)}`)}});var ke=P(function(Bd){Object.defineProperty(Bd,"__esModule",{value:!0});Bd.validateUnion=Bd.validateArray=Bd.usePattern=Bd.callValidateCode=Bd.schemaProperties=Bd.allSchemaProperties=Bd.noPropertyInData=Bd.propertyInData=Bd.isOwnProperty=Bd.hasPropFunc=Bd.reportMissingProp=Bd.checkMissingProp=Bd.checkReportMissingProp=void 0;var J=Z(),ti=M(),nt=Ve(),M$=M();function D$(e,t){let{gen:r,data:o,it:n}=e;r.if(oi(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:J._`${t}`},!0),e.error()})}Bd.checkReportMissingProp=D$;function L$({gen:e,data:t,it:{opts:r}},o,n){return J.or(...o.map((s)=>J.and(oi(e,t,s,r.ownProperties),J._`${n} = ${s}`)))}Bd.checkMissingProp=L$;function U$(e,t){e.setParams({missingProperty:t},!0),e.error()}Bd.reportMissingProp=U$;function Hd(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:J._`Object.prototype.hasOwnProperty`})}Bd.hasPropFunc=Hd;function ri(e,t,r){return J._`${Hd(e)}.call(${t}, ${r})`}Bd.isOwnProperty=ri;function V$(e,t,r,o){let n=J._`${t}${J.getProperty(r)} !== undefined`;return o?J._`${n} && ${ri(e,t,r)}`:n}Bd.propertyInData=V$;function oi(e,t,r,o){let n=J._`${t}${J.getProperty(r)} === undefined`;return o?J.or(n,J.not(ri(e,t,r))):n}Bd.noPropertyInData=oi;function Kd(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Bd.allSchemaProperties=Kd;function F$(e,t){return Kd(t).filter((r)=>!ti.alwaysValidSchema(e,t[r]))}Bd.schemaProperties=F$;function H$({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,u,c){let l=c?J._`${e}, ${t}, ${o}${n}`:t,d=[[nt.default.instancePath,J.strConcat(nt.default.instancePath,s)],[nt.default.parentData,i.parentData],[nt.default.parentDataProperty,i.parentDataProperty],[nt.default.rootData,nt.default.rootData]];if(i.opts.dynamicRef)d.push([nt.default.dynamicAnchors,nt.default.dynamicAnchors]);let f=J._`${l}, ${r.object(...d)}`;return u!==J.nil?J._`${a}.call(${u}, ${f})`:J._`${a}(${f})`}Bd.callValidateCode=H$;var K$=J._`new RegExp`;function B$({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:J._`${n.code==="new RegExp"?K$:M$.useFunc(e,n)}(${r}, ${o})`})}Bd.usePattern=B$;function W$(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",J._`${r}.length`);t.forRange("i",0,u,(c)=>{e.subschema({keyword:o,dataProp:c,dataPropType:ti.Type.Num},s),t.if(J.not(s),a)})}}Bd.validateArray=W$;function J$(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((u)=>ti.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,J._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(J.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Bd.validateUnion=J$});var Xd=P(function(Yd){Object.defineProperty(Yd,"__esModule",{value:!0});Yd.validateKeywordUsage=Yd.validSchemaType=Yd.funcKeywordCode=Yd.macroKeywordCode=void 0;var he=Z(),_t=Ve(),cw=ke(),uw=wr();function lw(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),u=Gd(r,o,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:he.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}Yd.macroKeywordCode=lw;function dw(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:u}=e;fw(u,t);let c=!a&&t.compile?t.compile.call(u.self,s,i,u):t.validate,l=Gd(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(_(),t.modifying)Jd(e);w(()=>e.error())}else{let v=t.async?m():h();if(t.modifying)Jd(e);w(()=>pw(e,v))}}function m(){let v=o.let("ruleErrs",null);return o.try(()=>_(he._`await `),(k)=>o.assign(d,!1).if(he._`${k} instanceof ${u.ValidationError}`,()=>o.assign(v,he._`${k}.errors`),()=>o.throw(k))),v}function h(){let v=he._`${l}.errors`;return o.assign(v,null),_(he.nil),v}function _(v=t.async?he._`await `:he.nil){let k=u.opts.passContext?_t.default.this:_t.default.self,b=!(("compile"in t)&&!a||t.schema===!1);o.assign(d,he._`${v}${cw.callValidateCode(e,l,k,b)}`,t.modifying)}function w(v){var k;o.if(he.not((k=t.valid)!==null&&k!==void 0?k:d),v)}}Yd.funcKeywordCode=dw;function Jd(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,he._`${o.parentData}[${o.parentDataProperty}]`))}function pw(e,t){let{gen:r}=e;r.if(he._`Array.isArray(${t})`,()=>{r.assign(_t.default.vErrors,he._`${_t.default.vErrors} === null ? ${t} : ${_t.default.vErrors}.concat(${t})`).assign(_t.default.errors,he._`${_t.default.vErrors}.length`),uw.extendErrors(e)},()=>e.error())}function fw({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Gd(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:he.stringify(r)})}function mw(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")}Yd.validSchemaType=mw;function hw({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)}}}Yd.validateKeywordUsage=hw});var op=P(function(tp){Object.defineProperty(tp,"__esModule",{value:!0});tp.extendSubschemaMode=tp.extendSubschemaData=tp.getSubschema=void 0;var Ae=Z(),ep=M();function vw(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:Ae._`${e.schemaPath}${Ae.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Ae._`${e.schemaPath}${Ae.getProperty(t)}${Ae.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${ep.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')}tp.getSubschema=vw;function $w(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",Ae._`${t.data}${Ae.getProperty(r)}`,!0);u(f),e.errorPath=Ae.str`${c}${ep.getErrorPath(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=Ae._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let c=n instanceof Ae.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]}}tp.extendSubschemaData=$w;function ww(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}tp.extendSubschemaMode=ww});var ni=P(function(eC,np){np.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=P(function(tC,sp){var st=sp.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(){};Mo(t,o,n,e,"",e)};st.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};st.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};st.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};st.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 Mo(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 st.arrayKeywords)for(var f=0;f<d.length;f++)Mo(e,t,r,d[f],n+"/"+l+"/"+f,s,n,l,o,f)}else if(l in st.propsKeywords){if(d&&typeof d=="object")for(var m in d)Mo(e,t,r,d[m],n+"/"+l+"/"+zw(m),s,n,l,o,m)}else if(l in st.keywords||e.allKeys&&!(l in st.skipKeywords))Mo(e,t,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,u,c)}}function zw(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var br=P(function(lp){Object.defineProperty(lp,"__esModule",{value:!0});lp.getSchemaRefs=lp.resolveUrl=lp.normalizeId=lp._getFullPath=lp.getFullPath=lp.inlineRef=void 0;var Sw=M(),kw=ni(),Pw=ip(),Tw=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Ew(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!si(e);if(!t)return!1;return ap(e)<=t}lp.inlineRef=Ew;var Rw=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function si(e){for(let t in e){if(Rw.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(si))return!0;if(typeof r=="object"&&si(r))return!0}return!1}function ap(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,Tw.has(r))continue;if(typeof e[r]=="object")Sw.eachItem(e[r],(o)=>t+=ap(o));if(t===1/0)return 1/0}return t}function cp(e,t="",r){if(r!==!1)t=qt(t);let o=e.parse(t);return up(e,o)}lp.getFullPath=cp;function up(e,t){return e.serialize(t).split("#")[0]+"#"}lp._getFullPath=up;var Iw=/#\/?$/;function qt(e){return e?e.replace(Iw,""):""}lp.normalizeId=qt;function Cw(e,t,r){return r=qt(r),e.resolve(t,r)}lp.resolveUrl=Cw;var Ow=/^[a-z_][-a-z0-9._]*$/i;function jw(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=qt(e[r]||t),s={"":n},i=cp(o,n,!1),a={},u=new Set;return Pw(e,{allKeys:!0},(d,f,m,h)=>{if(h===void 0)return;let _=i+f,w=s[h];if(typeof d[r]=="string")w=v.call(this,d[r]);k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),s[f]=w;function v(b){let C=this.opts.uriResolver.resolve;if(b=qt(w?C(w,b):b),u.has(b))throw l(b);u.add(b);let y=this.refs[b];if(typeof y=="string")y=this.refs[y];if(typeof y=="object")c(d,y.schema,b);else if(b!==qt(_))if(b[0]==="#")c(d,a[b],b),a[b]=d;else this.refs[b]=_;return b}function k(b){if(typeof b=="string"){if(!Ow.test(b))throw Error(`invalid anchor "${b}"`);v.call(this,`#${b}`)}}}),a;function c(d,f,m){if(f!==void 0&&!kw(d,f))throw l(m)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}lp.getSchemaRefs=jw});var kr=P(function(kp){Object.defineProperty(kp,"__esModule",{value:!0});kp.getData=kp.KeywordCxt=kp.validateFunctionCode=void 0;var hp=Ed(),_p=xr(),ii=Ys(),Do=xr(),Dw=Fd(),zr=Xd(),ai=op(),I=Z(),N=Ve(),Lw=br(),Fe=M(),Sr=wr();function Uw(e){if(vp(e)){if($p(e),yp(e)){Hw(e);return}}gp(e,()=>hp.topBoolOrEmptySchema(e))}kp.validateFunctionCode=Uw;function gp({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){if(n.code.es5)e.func(t,I._`${N.default.data}, ${N.default.valCxt}`,o.$async,()=>{e.code(I._`"use strict"; ${pp(r,n)}`),Fw(e,n),e.code(s)});else e.func(t,I._`${N.default.data}, ${Vw(n)}`,o.$async,()=>e.code(pp(r,n)).code(s))}function Vw(e){return I._`{${N.default.instancePath}="", ${N.default.parentData}, ${N.default.parentDataProperty}, ${N.default.rootData}=${N.default.data}${e.dynamicRef?I._`, ${N.default.dynamicAnchors}={}`:I.nil}}={}`}function Fw(e,t){e.if(N.default.valCxt,()=>{if(e.var(N.default.instancePath,I._`${N.default.valCxt}.${N.default.instancePath}`),e.var(N.default.parentData,I._`${N.default.valCxt}.${N.default.parentData}`),e.var(N.default.parentDataProperty,I._`${N.default.valCxt}.${N.default.parentDataProperty}`),e.var(N.default.rootData,I._`${N.default.valCxt}.${N.default.rootData}`),t.dynamicRef)e.var(N.default.dynamicAnchors,I._`${N.default.valCxt}.${N.default.dynamicAnchors}`)},()=>{if(e.var(N.default.instancePath,I._`""`),e.var(N.default.parentData,I._`undefined`),e.var(N.default.parentDataProperty,I._`undefined`),e.var(N.default.rootData,N.default.data),t.dynamicRef)e.var(N.default.dynamicAnchors,I._`{}`)})}function Hw(e){let{schema:t,opts:r,gen:o}=e;gp(e,()=>{if(r.$comment&&t.$comment)xp(e);if(Gw(e),o.let(N.default.vErrors,null),o.let(N.default.errors,0),r.unevaluated)Kw(e);wp(e),Xw(e)});return}function Kw(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",I._`${r}.evaluated`),t.if(I._`${e.evaluated}.dynamicProps`,()=>t.assign(I._`${e.evaluated}.props`,I._`undefined`)),t.if(I._`${e.evaluated}.dynamicItems`,()=>t.assign(I._`${e.evaluated}.items`,I._`undefined`))}function pp(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?I._`/*# sourceURL=${r} */`:I.nil}function Bw(e,t){if(vp(e)){if($p(e),yp(e)){Ww(e,t);return}}hp.boolOrEmptySchema(e,t)}function yp({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 vp(e){return typeof e.schema!="boolean"}function Ww(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)xp(e);Yw(e),Qw(e);let s=o.const("_errs",N.default.errors);wp(e,s),o.var(t,I._`${s} === ${N.default.errors}`)}function $p(e){Fe.checkUnknownRules(e),Jw(e)}function wp(e,t){if(e.opts.jtd)return fp(e,[],!1,t);let r=_p.getSchemaTypes(e.schema),o=_p.coerceAndCheckDataType(e,r);fp(e,r,!o,t)}function Jw(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&Fe.schemaHasRulesButRef(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Gw(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)Fe.checkStrictMode(e,"default is ignored in the schema root")}function Yw(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=Lw.resolveUrl(e.opts.uriResolver,e.baseId,t)}function Qw(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function xp({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code(I._`${N.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=I.str`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(I._`${N.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Xw(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;if(r.$async)t.if(I._`${N.default.errors} === 0`,()=>t.return(N.default.data),()=>t.throw(I._`new ${n}(${N.default.vErrors})`));else{if(t.assign(I._`${o}.errors`,N.default.vErrors),s.unevaluated)ex(e);t.return(I._`${N.default.errors} === 0`)}}function ex({gen:e,evaluated:t,props:r,items:o}){if(r instanceof I.Name)e.assign(I._`${t}.props`,r);if(o instanceof I.Name)e.assign(I._`${t}.items`,o)}function fp(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||!Fe.schemaHasRulesButRef(s,l))){n.block(()=>zp(e,"$ref",l.all.$ref.definition));return}if(!u.jtd)tx(e,t);n.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){if(!ii.shouldUseGroup(s,f))return;if(f.type){if(n.if(Do.checkDataType(f.type,i,u.strictNumbers)),mp(e,f),t.length===1&&t[0]===f.type&&r)n.else(),Do.reportTypeError(e);n.endIf()}else mp(e,f);if(!a)n.if(I._`${N.default.errors} === ${o||0}`)}}function mp(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)Dw.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(ii.shouldUseRule(o,s))zp(e,s.keyword,s.definition,t.type)})}function tx(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(rx(e,t),!e.opts.allowUnionTypes)ox(e,t);nx(e,e.dataTypes)}function rx(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!bp(e.dataTypes,r))ci(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),ix(e,t)}function ox(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))ci(e,"use allowUnionTypes to allow union type keyword")}function nx(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&ii.shouldUseRule(e.schema,n)){let{type:s}=n.definition;if(s.length&&!s.some((i)=>sx(t,i)))ci(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function sx(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function bp(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function ix(e,t){let r=[];for(let o of e.dataTypes)if(bp(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function ci(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,Fe.checkStrictMode(e,t,e.opts.strictTypes)}class ui{constructor(e,t,r){if(zr.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=Fe.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",Sp(this.$data,e));else if(this.schemaCode=this.schemaValue,!zr.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",N.default.errors)}result(e,t,r){this.failResult(I.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(I.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(I._`${t} !== undefined && (${I.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?Sr.reportExtraError:Sr.reportError)(this,this.def.error,t)}$dataError(){Sr.reportError(this,this.def.$dataError||Sr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Sr.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=I.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=I.nil,t=I.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:s}=this;if(r.if(I.or(I._`${o} === undefined`,t)),e!==I.nil)r.assign(e,!0);if(n.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==I.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return I.or(s(),i());function s(){if(r.length){if(!(t instanceof I.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return I._`${Do.checkDataTypes(a,t,n.opts.strictNumbers,Do.DataType.Wrong)}`}return I.nil}function i(){if(o.validateSchema){let a=e.scopeValue("validate$data",{ref:o.validateSchema});return I._`!${a}(${t})`}return I.nil}}subschema(e,t){let r=ai.getSubschema(this.it,e);ai.extendSubschemaData(r,this.it,e),ai.extendSubschemaMode(r,e);let o={...this.it,...r,items:void 0,props:void 0};return Bw(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=Fe.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Fe.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,I.Name)),!0}}kp.KeywordCxt=ui;function zp(e,t,r,o){let n=new ui(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)zr.funcKeywordCode(n,r);else if("macro"in r)zr.macroKeywordCode(n,r);else if(r.compile||r.validate)zr.funcKeywordCode(n,r)}var ax=/^\/(?:[^~]|~0|~1)*$/,cx=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Sp(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return N.default.rootData;if(e[0]==="/"){if(!ax.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,s=N.default.rootData}else{let c=cx.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=I._`${s}${I.getProperty(Fe.unescapeJsonPointer(c))}`,i=I._`${i} && ${s}`;return i;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}kp.getData=Sp});var Lo=P(function(Ep){Object.defineProperty(Ep,"__esModule",{value:!0});class Tp extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}Ep.default=Tp});var Pr=P(function(Ip){Object.defineProperty(Ip,"__esModule",{value:!0});var li=br();class Rp extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=li.resolveUrl(e,t,r),this.missingSchema=li.normalizeId(li.getFullPath(e,this.missingRef))}}Ip.default=Rp});var Vo=P(function(jp){Object.defineProperty(jp,"__esModule",{value:!0});jp.resolveSchema=jp.getCompilingSchema=jp.resolveRef=jp.compileSchema=jp.SchemaEnv=void 0;var Re=Z(),fx=Lo(),gt=Ve(),Ie=br(),Cp=M(),mx=kr();class Tr{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:Ie.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={}}}jp.SchemaEnv=Tr;function pi(e){let t=Op.call(this,e);if(t)return t;let r=Ie.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Re.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:fx.default,code:Re._`require("ajv/dist/runtime/validation_error").default`});let u=i.scopeName("validate");e.validateName=u;let c={gen:i,allErrors:this.opts.allErrors,data:gt.default.data,parentData:gt.default.parentData,parentDataProperty:gt.default.parentDataProperty,dataNames:[gt.default.data],dataPathArr:[Re.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:Re.stringify(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Re.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Re._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),mx.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs(gt.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let m=Function(`${gt.default.self}`,`${gt.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:_}=c;if(m.evaluated={props:h instanceof Re.Name?void 0:h,items:_ instanceof Re.Name?void 0:_,dynamicProps:h instanceof Re.Name,dynamicItems:_ instanceof Re.Name},m.source)m.source.evaluated=Re.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)}}jp.compileSchema=pi;function hx(e,t,r){var o;r=Ie.resolveUrl(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=yx.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 Tr({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=_x.call(this,s)}jp.resolveRef=hx;function _x(e){if(Ie.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:pi.call(this,e)}function Op(e){for(let t of this._compilations)if(gx(t,e))return t}jp.getCompilingSchema=Op;function gx(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function yx(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Uo.call(this,e,t)}function Uo(e,t){let r=this.opts.uriResolver.parse(t),o=Ie._getFullPath(this.opts.uriResolver,r),n=Ie.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return di.call(this,r,e);let s=Ie.normalizeId(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Uo.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return di.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)pi.call(this,i);if(s===Ie.normalizeId(t)){let{schema:a}=i,{schemaId:u}=this.opts,c=a[u];if(c)n=Ie.resolveUrl(this.opts.uriResolver,n,c);return new Tr({schema:a,schemaId:u,root:e,baseId:n})}return di.call(this,r,i)}jp.resolveSchema=Uo;var vx=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function di(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[Cp.unescapeFragment(a)];if(u===void 0)return;r=u;let c=typeof r==="object"&&r[this.opts.schemaId];if(!vx.has(a)&&c)t=Ie.resolveUrl(this.opts.uriResolver,t,c)}let s;if(typeof r!="boolean"&&r.$ref&&!Cp.schemaHasRulesButRef(r,this.RULES)){let a=Ie.resolveUrl(this.opts.uriResolver,t,r.$ref);s=Uo.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Tr({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s;return}});var Ap=P(function(aC,zx){zx.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 hi=P(function(cC,Up){var Sx=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),qp=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),fi=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Mp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),kx=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 Px=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Zp(e){return e.length=0,!0}function Tx(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 Ex(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Tx;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=Zp}else{n.push(c);continue}}if(n.length)if(a===Zp)r.zone=n.join("");else if(i)o.push(n.join(""));else o.push(mi(n));return r.address=o.join(""),r}function Dp(e){if(Rx(e,":")<2)return{host:e,isIPV6:!1};let t=Ex(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 Rx(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function Ix(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 Cx={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Ox=/[@/?#:]/g,jx=/[@/?#]/g;function Lp(e,t){let r=t?jx:Ox;return r.lastIndex=0,e.replace(r,(o)=>Cx[o])}function Nx(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(fi(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));if(t&&Mp(i))r+=i;else r+="%"+s;o+=2;continue}}r+=e[o]}return r}function Ax(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(fi(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));if(s!=="."&&Mp(s))t+=s;else t+="%"+n;r+=2;continue}}if(kx(e[r]))t+=e[r];else t+=escape(e[r])}return t}function Zx(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(fi(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function qx(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(!qp(r)){let o=Dp(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=Lp(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}Up.exports={nonSimpleDomain:Px,recomposeAuthority:qx,reescapeHostDelimiters:Lp,normalizePercentEncoding:Nx,normalizePathEncoding:Ax,escapePreservingEscapes:Zx,removeDotSegments:Ix,isIPv4:qp,isUUID:Sx,normalizeIPv6:Dp,stringArrayToHexStripped:mi}});var Bp=P(function(uC,Kp){var{isUUID:Mx}=hi(),Dx=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Lx=["http","https","ws","wss","urn","urn:uuid"];function Ux(e){return Lx.indexOf(e)!==-1}function _i(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 Vp(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function Fp(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 Vx(e){return e.secure=_i(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Fx(e){if(e.port===(_i(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 Hx(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Dx);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=gi(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 Kx(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=gi(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 Bx(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Mx(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function Wx(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Hp={scheme:"http",domainHost:!0,parse:Vp,serialize:Fp},Jx={scheme:"https",domainHost:Hp.domainHost,parse:Vp,serialize:Fp},Fo={scheme:"ws",domainHost:!0,parse:Vx,serialize:Fx},Gx={scheme:"wss",domainHost:Fo.domainHost,parse:Fo.parse,serialize:Fo.serialize},Yx={scheme:"urn",parse:Hx,serialize:Kx,skipNormalize:!0},Qx={scheme:"urn:uuid",parse:Bx,serialize:Wx,skipNormalize:!0},Ho={http:Hp,https:Jx,ws:Fo,wss:Gx,urn:Yx,"urn:uuid":Qx};Object.setPrototypeOf(Ho,null);function gi(e){return e&&(Ho[e]||Ho[e.toLowerCase()])||void 0}Kp.exports={wsIsSecure:_i,SCHEMES:Ho,isValidSchemeName:Ux,getSchemeHandler:gi}});var Xp=P(function(lC,Ko){var{normalizeIPv6:Xx,removeDotSegments:Er,recomposeAuthority:eb,normalizePercentEncoding:tb,normalizePathEncoding:rb,escapePreservingEscapes:ob,reescapeHostDelimiters:nb,isIPv4:sb,nonSimpleDomain:ib}=hi(),{SCHEMES:ab,getSchemeHandler:Jp}=Bp();function cb(e,t){if(typeof e==="string")e=fb(e,t);else if(typeof e==="object")e=Mt(yt(e,t),t);return e}function ub(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=Gp(Mt(e,o),Mt(t,o),o,!0);return o.skipEscape=!0,yt(n,o)}function Gp(e,t,r,o){let n={};if(!o)e=Mt(yt(e,r),r),t=Mt(yt(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=Er(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=Er(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=Er(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=Er(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 lb(e,t,r){let o=Wp(e,r),n=Wp(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function yt(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=Jp(o.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=ob(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=tb(r.path);if(o.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let i=eb(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=Er(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 db=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function pb(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 Yp(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(db);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=pb(o,i);if(a!==void 0)o.error=o.error||a,n=!0;if(o.host)if(sb(o.host)===!1){let l=Xx(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=Jp(r.scheme||o.scheme);if(!r.unicodeSupport&&(!u||!u.unicodeSupport)){if(o.host&&(r.domainHost||u&&u.domainHost)&&s===!1&&ib(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=nb(unescape(o.host),s)}if(o.path)o.path=rb(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 Mt(e,t){return Yp(e,t).parsed}function fb(e,t){return Qp(e,t).normalized}function Qp(e,t){let{parsed:r,malformedAuthorityOrPort:o}=Yp(e,t);return{normalized:o?e:yt(r,t),malformedAuthorityOrPort:o}}function Wp(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:o}=Qp(e,t);return o?void 0:r}if(typeof e==="object")return yt(e,t)}var yi={SCHEMES:ab,normalize:cb,resolve:ub,resolveComponent:Gp,equal:lb,serialize:yt,parse:Mt};Ko.exports=yi;Ko.exports.default=yi;Ko.exports.fastUri=yi});var rf=P(function(tf){Object.defineProperty(tf,"__esModule",{value:!0});var ef=Xp();ef.code='require("ajv/dist/runtime/uri").default';tf.default=ef});var df=P(function(He){Object.defineProperty(He,"__esModule",{value:!0});He.CodeGen=He.Name=He.nil=He.stringify=He.str=He._=He.KeywordCxt=void 0;var hb=kr();Object.defineProperty(He,"KeywordCxt",{enumerable:!0,get:function(){return hb.KeywordCxt}});var Dt=Z();Object.defineProperty(He,"_",{enumerable:!0,get:function(){return Dt._}});Object.defineProperty(He,"str",{enumerable:!0,get:function(){return Dt.str}});Object.defineProperty(He,"stringify",{enumerable:!0,get:function(){return Dt.stringify}});Object.defineProperty(He,"nil",{enumerable:!0,get:function(){return Dt.nil}});Object.defineProperty(He,"Name",{enumerable:!0,get:function(){return Dt.Name}});Object.defineProperty(He,"CodeGen",{enumerable:!0,get:function(){return Dt.CodeGen}});var _b=Lo(),cf=Pr(),gb=Gs(),Ir=Vo(),yb=Z(),Rr=br(),Bo=xr(),$i=M(),of=Ap(),vb=rf(),uf=(e,t)=>new RegExp(e,t);uf.code="new RegExp";var $b=["removeAdditional","useDefaults","coerceTypes"],wb=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),xb={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."},bb={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},nf=200;function zb(e){var t,r,o,n,s,i,a,u,c,l,d,f,m,h,_,w,v,k,b,C,y,x,j,G,te;let _e=e.strict,Gt=(t=e.code)===null||t===void 0?void 0:t.optimize,Vr=Gt===!0||Gt===void 0?1:Gt||0,Fr=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:uf,Ke=(n=e.uriResolver)!==null&&n!==void 0?n:vb.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:_e)!==null&&i!==void 0?i:!0,strictNumbers:(u=(a=e.strictNumbers)!==null&&a!==void 0?a:_e)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:_e)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:_e)!==null&&f!==void 0?f:"log",strictRequired:(h=(m=e.strictRequired)!==null&&m!==void 0?m:_e)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:Vr,regExp:Fr}:{optimize:Vr,regExp:Fr},loopRequired:(_=e.loopRequired)!==null&&_!==void 0?_:nf,loopEnum:(w=e.loopEnum)!==null&&w!==void 0?w:nf,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(C=e.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(y=e.addUsedSchema)!==null&&y!==void 0?y:!0,validateSchema:(x=e.validateSchema)!==null&&x!==void 0?x:!0,validateFormats:(j=e.validateFormats)!==null&&j!==void 0?j:!0,unicodeRegExp:(G=e.unicodeRegExp)!==null&&G!==void 0?G:!0,int32range:(te=e.int32range)!==null&&te!==void 0?te:!0,uriResolver:Ke}}class Wo{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,...zb(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new yb.ValueScope({scope:{},prefixes:wb,es5:t,lines:r}),this.logger=Rb(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=gb.getRules(),sf.call(this,xb,e,"NOT SUPPORTED"),sf.call(this,bb,e,"DEPRECATED","warn"),this._metaOpts=Tb.call(this),e.formats)kb.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)Pb.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);Sb.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=of;if(r==="id")o={...of},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 cf.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=Rr.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=af.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new Ir.SchemaEnv({schema:{},schemaId:r});if(t=Ir.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=af.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=Rr.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(Cb.call(this,r,t),!t)return $i.eachItem(r,(n)=>vi.call(this,n)),this;jb.call(this,t);let o={...t,type:Bo.getJSONTypes(t.type),schemaType:Bo.getJSONTypes(t.schemaType)};return $i.eachItem(r,o.type.length===0?(n)=>vi.call(this,n,o):(n)=>o.type.forEach((s)=>vi.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]=lf(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=Rr.normalizeId(s||r);let u=Rr.getSchemaRefs.call(this,e,r);if(a=new Ir.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 Ir.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{Ir.compileSchema.call(this,e)}finally{this.opts=t}}}Wo.ValidationError=_b.default;Wo.MissingRefError=cf.default;He.default=Wo;function sf(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 af(e){return e=Rr.normalizeId(e),this.schemas[e]||this.refs[e]}function Sb(){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 kb(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function Pb(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 Tb(){let e={...this.opts};for(let t of $b)delete e[t];return e}var Eb={log(){},warn(){},error(){}};function Rb(e){if(e===!1)return Eb;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 Ib=/^[a-z_$][a-z0-9_$:-]*$/i;function Cb(e,t){let{RULES:r}=this;if($i.eachItem(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!Ib.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 vi(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:Bo.getJSONTypes(t.type),schemaType:Bo.getJSONTypes(t.schemaType)}};if(t.before)Ob.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 Ob(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 jb(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=lf(t);e.validateSchema=this.compile(t,!0)}var Nb={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function lf(e){return{anyOf:[e,Nb]}}});var ff=P(function(pf){Object.defineProperty(pf,"__esModule",{value:!0});var qb={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};pf.default=qb});var vf=P(function(gf){Object.defineProperty(gf,"__esModule",{value:!0});gf.callRef=gf.getValidate=void 0;var Db=Pr(),mf=ke(),$e=Z(),Lt=Ve(),hf=Vo(),Jo=M(),Lb={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=hf.resolveRef.call(u,c,n,r);if(l===void 0)throw new Db.default(o.opts.uriResolver,n,r);if(l instanceof hf.SchemaEnv)return f(l);return m(l);function d(){if(s===c)return Go(e,i,s,s.$async);let h=t.scopeValue("root",{ref:c});return Go(e,$e._`${h}.validate`,c,c.$async)}function f(h){let _=_f(e,h);Go(e,_,h,h.$async)}function m(h){let _=t.scopeValue("schema",a.code.source===!0?{ref:h,code:$e.stringify(h)}:{ref:h}),w=t.name("valid"),v=e.subschema({schema:h,dataTypes:[],schemaPath:$e.nil,topSchemaRef:_,errSchemaPath:r},w);e.mergeEvaluated(v),e.ok(w)}}};function _f(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):$e._`${r.scopeValue("wrapper",{ref:t})}.validate`}gf.getValidate=_f;function Go(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:u}=s,c=u.passContext?Lt.default.this:$e.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($e._`await ${mf.callValidateCode(e,t,c)}`),m(t),!i)n.assign(h,!0)},(_)=>{if(n.if($e._`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),f(_),!i)n.assign(h,!1)}),e.ok(h)}function d(){e.result(mf.callValidateCode(e,t,c),()=>m(t),()=>f(t))}function f(h){let _=$e._`${h}.errors`;n.assign(Lt.default.vErrors,$e._`${Lt.default.vErrors} === null ? ${_} : ${Lt.default.vErrors}.concat(${_})`),n.assign(Lt.default.errors,$e._`${Lt.default.vErrors}.length`)}function m(h){var _;if(!s.opts.unevaluated)return;let w=(_=r===null||r===void 0?void 0:r.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(w&&!w.dynamicProps){if(w.props!==void 0)s.props=Jo.mergeEvaluated.props(n,w.props,s.props)}else{let v=n.var("props",$e._`${h}.evaluated.props`);s.props=Jo.mergeEvaluated.props(n,v,s.props,$e.Name)}if(s.items!==!0)if(w&&!w.dynamicItems){if(w.items!==void 0)s.items=Jo.mergeEvaluated.items(n,w.items,s.items)}else{let v=n.var("items",$e._`${h}.evaluated.items`);s.items=Jo.mergeEvaluated.items(n,v,s.items,$e.Name)}}}gf.callRef=Go;gf.default=Lb});var wf=P(function($f){Object.defineProperty($f,"__esModule",{value:!0});var Fb=ff(),Hb=vf(),Kb=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Fb.default,Hb.default];$f.default=Kb});var bf=P(function(xf){Object.defineProperty(xf,"__esModule",{value:!0});var Qo=Z(),it=Qo.operators,Yo={maximum:{okStr:"<=",ok:it.LTE,fail:it.GT},minimum:{okStr:">=",ok:it.GTE,fail:it.LT},exclusiveMaximum:{okStr:"<",ok:it.LT,fail:it.GTE},exclusiveMinimum:{okStr:">",ok:it.GT,fail:it.LTE}},Wb={message:({keyword:e,schemaCode:t})=>Qo.str`must be ${Yo[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Qo._`{comparison: ${Yo[e].okStr}, limit: ${t}}`},Jb={keyword:Object.keys(Yo),type:"number",schemaType:"number",$data:!0,error:Wb,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(Qo._`${r} ${Yo[t].fail} ${o} || isNaN(${r})`)}};xf.default=Jb});var Sf=P(function(zf){Object.defineProperty(zf,"__esModule",{value:!0});var Cr=Z(),Yb={message:({schemaCode:e})=>Cr.str`must be multiple of ${e}`,params:({schemaCode:e})=>Cr._`{multipleOf: ${e}}`},Qb={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Yb,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?Cr._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:Cr._`${i} !== parseInt(${i})`;e.fail$data(Cr._`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};zf.default=Qb});var Tf=P(function(Pf){Object.defineProperty(Pf,"__esModule",{value:!0});function kf(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}Pf.default=kf;kf.code='require("ajv/dist/runtime/ucs2length").default'});var Rf=P(function(Ef){Object.defineProperty(Ef,"__esModule",{value:!0});var vt=Z(),t0=M(),r0=Tf(),o0={message({keyword:e,schemaCode:t}){return vt.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>vt._`{limit: ${e}}`},n0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:o0,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?vt.operators.GT:vt.operators.LT,i=n.opts.unicode===!1?vt._`${r}.length`:vt._`${t0.useFunc(e.gen,r0.default)}(${r})`;e.fail$data(vt._`${i} ${s} ${o}`)}};Ef.default=n0});var Cf=P(function(If){Object.defineProperty(If,"__esModule",{value:!0});var i0=ke(),a0=M(),Ut=Z(),c0={message:({schemaCode:e})=>Ut.str`must match pattern "${e}"`,params:({schemaCode:e})=>Ut._`{pattern: ${e}}`},u0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:c0,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"?Ut._`new RegExp`:a0.useFunc(t,u),l=t.let("valid");t.try(()=>t.assign(l,Ut._`${c}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(Ut._`!${l}`)}else{let u=i0.usePattern(e,n);e.fail$data(Ut._`!${u}.test(${r})`)}}};If.default=u0});var jf=P(function(Of){Object.defineProperty(Of,"__esModule",{value:!0});var Or=Z(),d0={message({keyword:e,schemaCode:t}){return Or.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Or._`{limit: ${e}}`},p0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:d0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?Or.operators.GT:Or.operators.LT;e.fail$data(Or._`Object.keys(${r}).length ${n} ${o}`)}};Of.default=p0});var Af=P(function(Nf){Object.defineProperty(Nf,"__esModule",{value:!0});var Nr=ke(),jr=Z(),m0=M(),h0={message:({params:{missingProperty:e}})=>jr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>jr._`{missingProperty: ${e}}`},_0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:h0,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 _ of r)if((m===null||m===void 0?void 0:m[_])===void 0&&!h.has(_)){let w=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${_}" is not defined at "${w}" (strictRequired)`;m0.checkStrictMode(i,v,i.opts.strictRequired)}}function c(){if(u||s)e.block$data(jr.nil,d);else for(let m of r)Nr.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(Nr.checkMissingProp(e,r,m)),Nr.reportMissingProp(e,m),t.else()}function d(){t.forOf("prop",o,(m)=>{e.setParams({missingProperty:m}),t.if(Nr.noPropertyInData(t,n,m,a.ownProperties),()=>e.error())})}function f(m,h){e.setParams({missingProperty:m}),t.forOf(m,o,()=>{t.assign(h,Nr.propertyInData(t,n,m,a.ownProperties)),t.if(jr.not(h),()=>{e.error(),t.break()})},jr.nil)}}};Nf.default=_0});var qf=P(function(Zf){Object.defineProperty(Zf,"__esModule",{value:!0});var Ar=Z(),y0={message({keyword:e,schemaCode:t}){return Ar.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Ar._`{limit: ${e}}`},v0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:y0,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?Ar.operators.GT:Ar.operators.LT;e.fail$data(Ar._`${r}.length ${n} ${o}`)}};Zf.default=v0});var Xo=P(function(Df){Object.defineProperty(Df,"__esModule",{value:!0});var Mf=ni();Mf.code='require("ajv/dist/runtime/equal").default';Df.default=Mf});var Uf=P(function(Lf){Object.defineProperty(Lf,"__esModule",{value:!0});var wi=xr(),ue=Z(),x0=M(),b0=Xo(),z0={message:({params:{i:e,j:t}})=>ue.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>ue._`{i: ${e}, j: ${t}}`},S0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:z0,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?wi.getSchemaTypes(s.items):[];e.block$data(u,l,ue._`${i} === false`),e.ok(u);function l(){let h=t.let("i",ue._`${r}.length`),_=t.let("j");e.setParams({i:h,j:_}),t.assign(u,!0),t.if(ue._`${h} > 1`,()=>(d()?f:m)(h,_))}function d(){return c.length>0&&!c.some((h)=>h==="object"||h==="array")}function f(h,_){let w=t.name("item"),v=wi.checkDataTypes(c,w,a.opts.strictNumbers,wi.DataType.Wrong),k=t.const("indices",ue._`{}`);t.for(ue._`;${h}--;`,()=>{if(t.let(w,ue._`${r}[${h}]`),t.if(v,ue._`continue`),c.length>1)t.if(ue._`typeof ${w} == "string"`,ue._`${w} += "_"`);t.if(ue._`typeof ${k}[${w}] == "number"`,()=>{t.assign(_,ue._`${k}[${w}]`),e.error(),t.assign(u,!1).break()}).code(ue._`${k}[${w}] = ${h}`)})}function m(h,_){let w=x0.useFunc(t,b0.default),v=t.name("outer");t.label(v).for(ue._`;${h}--;`,()=>t.for(ue._`${_} = ${h}; ${_}--;`,()=>t.if(ue._`${w}(${r}[${h}], ${r}[${_}])`,()=>{e.error(),t.assign(u,!1).break(v)})))}}};Lf.default=S0});var Ff=P(function(Vf){Object.defineProperty(Vf,"__esModule",{value:!0});var xi=Z(),P0=M(),T0=Xo(),E0={message:"must be equal to constant",params:({schemaCode:e})=>xi._`{allowedValue: ${e}}`},R0={keyword:"const",$data:!0,error:E0,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;if(o||s&&typeof s=="object")e.fail$data(xi._`!${P0.useFunc(t,T0.default)}(${r}, ${n})`);else e.fail(xi._`${s} !== ${r}`)}};Vf.default=R0});var Kf=P(function(Hf){Object.defineProperty(Hf,"__esModule",{value:!0});var Zr=Z(),C0=M(),O0=Xo(),j0={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Zr._`{allowedValues: ${e}}`},N0={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=C0.useFunc(t,O0.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=Zr.or(...n.map((h,_)=>f(m,_)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(m)=>t.if(Zr._`${c()}(${r}, ${m})`,()=>t.assign(l,!0).break()))}function f(m,h){let _=n[h];return typeof _==="object"&&_!==null?Zr._`${c()}(${r}, ${m}[${h}])`:Zr._`${r} === ${_}`}}};Hf.default=N0});var Wf=P(function(Bf){Object.defineProperty(Bf,"__esModule",{value:!0});var Z0=bf(),q0=Sf(),M0=Rf(),D0=Cf(),L0=jf(),U0=Af(),V0=qf(),F0=Uf(),H0=Ff(),K0=Kf(),B0=[Z0.default,q0.default,M0.default,D0.default,L0.default,U0.default,V0.default,F0.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},H0.default,K0.default];Bf.default=B0});var zi=P(function(Gf){Object.defineProperty(Gf,"__esModule",{value:!0});Gf.validateAdditionalItems=void 0;var $t=Z(),bi=M(),J0={message:({params:{len:e}})=>$t.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>$t._`{limit: ${e}}`},G0={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:J0,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){bi.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Jf(e,o)}};function Jf(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",$t._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass($t._`${a} <= ${t.length}`);else if(typeof o=="object"&&!bi.alwaysValidSchema(i,o)){let c=r.var("valid",$t._`${a} <= ${t.length}`);r.if($t.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:bi.Type.Num},c),!i.allErrors)r.if($t.not(c),()=>r.break())})}}Gf.validateAdditionalItems=Jf;Gf.default=G0});var Si=P(function(em){Object.defineProperty(em,"__esModule",{value:!0});em.validateTuple=void 0;var Qf=Z(),en=M(),Q0=ke(),X0={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Xf(e,"additionalItems",t);if(r.items=!0,en.alwaysValidSchema(r,t))return;e.ok(Q0.validateArray(e))}};function Xf(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=en.mergeEvaluated.items(o,r.length,a.items);let u=o.name("valid"),c=o.const("len",Qf._`${s}.length`);r.forEach((d,f)=>{if(en.alwaysValidSchema(a,d))return;o.if(Qf._`${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,_=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(f.strictTuples&&!_){let w=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${m}"`;en.checkStrictMode(a,w,f.strictTuples)}}}em.validateTuple=Xf;em.default=X0});var om=P(function(rm){Object.defineProperty(rm,"__esModule",{value:!0});var tz=Si(),rz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>tz.validateTuple(e,"items")};rm.default=rz});var im=P(function(sm){Object.defineProperty(sm,"__esModule",{value:!0});var nm=Z(),nz=M(),sz=ke(),iz=zi(),az={message:({params:{len:e}})=>nm.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>nm._`{limit: ${e}}`},cz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:az,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,nz.alwaysValidSchema(o,t))return;if(n)iz.validateAdditionalItems(e,n);else e.ok(sz.validateArray(e))}};sm.default=cz});var cm=P(function(am){Object.defineProperty(am,"__esModule",{value:!0});var Pe=Z(),tn=M(),lz={message:({params:{min:e,max:t}})=>t===void 0?Pe.str`must contain at least ${e} valid item(s)`:Pe.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?Pe._`{minContains: ${e}}`:Pe._`{minContains: ${e}, maxContains: ${t}}`},dz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:lz,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",Pe._`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){tn.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){tn.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(tn.alwaysValidSchema(s,r)){let _=Pe._`${l} >= ${i}`;if(a!==void 0)_=Pe._`${_} && ${l} <= ${a}`;e.pass(_);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(Pe._`${n}.length > 0`,f)}else t.let(d,!1),f();e.result(d,()=>e.reset());function f(){let _=t.name("_valid"),w=t.let("count",0);m(_,()=>t.if(_,()=>h(w)))}function m(_,w){t.forRange("i",0,l,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:tn.Type.Num,compositeRule:!0},_),w()})}function h(_){if(t.code(Pe._`${_}++`),a===void 0)t.if(Pe._`${_} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(Pe._`${_} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(Pe._`${_} >= ${i}`,()=>t.assign(d,!0))}}};am.default=dz});var mm=P(function(dm){Object.defineProperty(dm,"__esModule",{value:!0});dm.validateSchemaDeps=dm.validatePropertyDeps=dm.error=void 0;var ki=Z(),fz=M(),qr=ke();dm.error={message:({params:{property:e,depsCount:t,deps:r}})=>ki.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>ki._`{property: ${e},
7
+ missingProperty: ${o},
8
+ depsCount: ${t},
9
+ deps: ${r}}`};var mz={keyword:"dependencies",type:"object",schemaType:"object",error:dm.error,code(e){let[t,r]=hz(e);um(e,t),lm(e,r)}};function hz({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 um(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=qr.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)qr.checkReportMissingProp(e,c)});else r.if(ki._`${u} && (${qr.checkMissingProp(e,a,s)})`),qr.reportMissingProp(e,s),r.else()}}dm.validatePropertyDeps=um;function lm(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t){if(fz.alwaysValidSchema(s,t[a]))continue;r.if(qr.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)}}dm.validateSchemaDeps=lm;dm.default=mz});var gm=P(function(_m){Object.defineProperty(_m,"__esModule",{value:!0});var hm=Z(),yz=M(),vz={message:"property name must be valid",params:({params:e})=>hm._`{propertyName: ${e.propertyName}}`},$z={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:vz,code(e){let{gen:t,schema:r,data:o,it:n}=e;if(yz.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(hm.not(s),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(s)}};_m.default=$z});var Pi=P(function(ym){Object.defineProperty(ym,"__esModule",{value:!0});var rn=ke(),Ce=Z(),xz=Ve(),on=M(),bz={message:"must NOT have additional properties",params:({params:e})=>Ce._`{additionalProperty: ${e.additionalProperty}}`},zz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:bz,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"&&on.alwaysValidSchema(i,r))return;let c=rn.allSchemaProperties(o.properties),l=rn.allSchemaProperties(o.patternProperties);d(),e.ok(Ce._`${s} === ${xz.default.errors}`);function d(){t.forIn("key",n,(w)=>{if(!c.length&&!l.length)h(w);else t.if(f(w),()=>h(w))})}function f(w){let v;if(c.length>8){let k=on.schemaRefOrVal(i,o.properties,"properties");v=rn.isOwnProperty(t,k,w)}else if(c.length)v=Ce.or(...c.map((k)=>Ce._`${w} === ${k}`));else v=Ce.nil;if(l.length)v=Ce.or(v,...l.map((k)=>Ce._`${rn.usePattern(e,k)}.test(${w})`));return Ce.not(v)}function m(w){t.code(Ce._`delete ${n}[${w}]`)}function h(w){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){m(w);return}if(r===!1){if(e.setParams({additionalProperty:w}),e.error(),!a)t.break();return}if(typeof r=="object"&&!on.alwaysValidSchema(i,r)){let v=t.name("valid");if(u.removeAdditional==="failing")_(w,v,!1),t.if(Ce.not(v),()=>{e.reset(),m(w)});else if(_(w,v),!a)t.if(Ce.not(v),()=>t.break())}}function _(w,v,k){let b={keyword:"additionalProperties",dataProp:w,dataPropType:on.Type.Str};if(k===!1)Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(b,v)}}};ym.default=zz});var xm=P(function(wm){Object.defineProperty(wm,"__esModule",{value:!0});var kz=kr(),$m=ke(),Ti=M(),vm=Pi(),Pz={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)vm.default.code(new kz.KeywordCxt(s,vm.default,"additionalProperties"));let i=$m.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=Ti.mergeEvaluated.props(t,Ti.toHash(i),s.props);let a=i.filter((d)=>!Ti.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($m.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)}}};wm.default=Pz});var Pm=P(function(km){Object.defineProperty(km,"__esModule",{value:!0});var bm=ke(),nn=Z(),zm=M(),Sm=M(),Ez={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=bm.allSchemaProperties(r),u=a.filter((_)=>zm.alwaysValidSchema(s,r[_]));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 nn.Name))s.props=Sm.evaluatedPropsToName(t,s.props);let{props:d}=s;f();function f(){for(let _ of a){if(c)m(_);if(s.allErrors)h(_);else t.var(l,!0),h(_),t.if(l)}}function m(_){for(let w in c)if(new RegExp(_).test(w))zm.checkStrictMode(s,`property ${w} matches pattern ${_} (use allowMatchingProperties)`)}function h(_){t.forIn("key",o,(w)=>{t.if(nn._`${bm.usePattern(e,_)}.test(${w})`,()=>{let v=u.includes(_);if(!v)e.subschema({keyword:"patternProperties",schemaProp:_,dataProp:w,dataPropType:Sm.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(nn._`${d}[${w}]`,!0);else if(!v&&!s.allErrors)t.if(nn.not(l),()=>t.break())})})}}};km.default=Ez});var Em=P(function(Tm){Object.defineProperty(Tm,"__esModule",{value:!0});var Iz=M(),Cz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if(Iz.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"}};Tm.default=Cz});var Im=P(function(Rm){Object.defineProperty(Rm,"__esModule",{value:!0});var jz=ke(),Nz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:jz.validateUnion,error:{message:"must match a schema in anyOf"}};Rm.default=Nz});var Om=P(function(Cm){Object.defineProperty(Cm,"__esModule",{value:!0});var sn=Z(),Zz=M(),qz={message:"must match exactly one schema in oneOf",params:({params:e})=>sn._`{passingSchemas: ${e.passing}}`},Mz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:qz,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(Zz.alwaysValidSchema(n,l))t.var(u,!0);else f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u);if(d>0)t.if(sn._`${u} && ${i}`).assign(i,!1).assign(a,sn._`[${a}, ${d}]`).else();t.if(u,()=>{if(t.assign(i,!0),t.assign(a,d),f)e.mergeEvaluated(f,sn.Name)})})}}};Cm.default=Mz});var Nm=P(function(jm){Object.defineProperty(jm,"__esModule",{value:!0});var Lz=M(),Uz={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(Lz.alwaysValidSchema(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};jm.default=Uz});var Mm=P(function(qm){Object.defineProperty(qm,"__esModule",{value:!0});var an=Z(),Zm=M(),Fz={message:({params:e})=>an.str`must match "${e.ifClause}" schema`,params:({params:e})=>an._`{failingKeyword: ${e.ifClause}}`},Hz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Fz,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)Zm.checkStrictMode(o,'"if" without "then" and "else" is ignored');let n=Am(o,"then"),s=Am(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(an.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,an._`${l}`);else e.setParams({ifClause:l})}}}};function Am(e,t){let r=e.schema[t];return r!==void 0&&!Zm.alwaysValidSchema(e,r)}qm.default=Hz});var Lm=P(function(Dm){Object.defineProperty(Dm,"__esModule",{value:!0});var Bz=M(),Wz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)Bz.checkStrictMode(r,`"${e}" without "if" is ignored`)}};Dm.default=Wz});var Vm=P(function(Um){Object.defineProperty(Um,"__esModule",{value:!0});var Gz=zi(),Yz=om(),Qz=Si(),Xz=im(),e1=cm(),t1=mm(),r1=gm(),o1=Pi(),n1=xm(),s1=Pm(),i1=Em(),a1=Im(),c1=Om(),u1=Nm(),l1=Mm(),d1=Lm();function p1(e=!1){let t=[i1.default,a1.default,c1.default,u1.default,l1.default,d1.default,r1.default,o1.default,t1.default,n1.default,s1.default];if(e)t.push(Yz.default,Xz.default);else t.push(Gz.default,Qz.default);return t.push(e1.default),t}Um.default=p1});var Hm=P(function(Fm){Object.defineProperty(Fm,"__esModule",{value:!0});var re=Z(),m1={message:({schemaCode:e})=>re.str`must match format "${e}"`,params:({schemaCode:e})=>re._`{format: ${e}}`},h1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:m1,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}),_=r.const("fDef",re._`${h}[${i}]`),w=r.let("fType"),v=r.let("format");r.if(re._`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(w,re._`${_}.type || "string"`).assign(v,re._`${_}.validate`),()=>r.assign(w,re._`"string"`).assign(v,_)),e.fail$data(re.or(k(),b()));function k(){if(u.strictSchema===!1)return re.nil;return re._`${i} && !${v}`}function b(){let C=l.$async?re._`(${_}.async ? await ${v}(${o}) : ${v}(${o}))`:re._`${v}(${o})`,y=re._`(typeof ${v} == "function" ? ${C} : ${v}.test(${o}))`;return re._`${v} && ${v} !== true && ${w} === ${t} && !${y}`}}function m(){let h=d.formats[s];if(!h){k();return}if(h===!0)return;let[_,w,v]=b(h);if(_===t)e.pass(C());function k(){if(u.strictSchema===!1){d.logger.warn(y());return}throw Error(y());function y(){return`unknown format "${s}" ignored in schema at path "${c}"`}}function b(y){let x=y instanceof RegExp?re.regexpCode(y):u.code.formats?re._`${u.code.formats}${re.getProperty(s)}`:void 0,j=r.scopeValue("formats",{key:s,ref:y,code:x});if(typeof y=="object"&&!(y instanceof RegExp))return[y.type||"string",y.validate,re._`${j}.validate`];return["string",y,j]}function C(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw Error("async format in sync schema");return re._`await ${v}(${o})`}return typeof w=="function"?re._`${v}(${o})`:re._`${v}.test(${o})`}}}};Fm.default=h1});var Bm=P(function(Km){Object.defineProperty(Km,"__esModule",{value:!0});var g1=Hm(),y1=[g1.default];Km.default=y1});var Gm=P(function(Wm){Object.defineProperty(Wm,"__esModule",{value:!0});Wm.contentVocabulary=Wm.metadataVocabulary=void 0;Wm.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Wm.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Xm=P(function(Qm){Object.defineProperty(Qm,"__esModule",{value:!0});var w1=wf(),x1=Wf(),b1=Vm(),z1=Bm(),Ym=Gm(),S1=[w1.default,x1.default,(0,b1.default)(),z1.default,Ym.metadataVocabulary,Ym.contentVocabulary];Qm.default=S1});var oh=P(function(th){Object.defineProperty(th,"__esModule",{value:!0});th.DiscrError=void 0;var eh;(function(e){e.Tag="tag",e.Mapping="mapping"})(eh||(th.DiscrError=eh={}))});var ih=P(function(sh){Object.defineProperty(sh,"__esModule",{value:!0});var Vt=Z(),Ei=oh(),nh=Vo(),P1=Pr(),T1=M(),E1={message:({params:{discrError:e,tagName:t}})=>e===Ei.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Vt._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},R1={keyword:"discriminator",type:"object",schemaType:"object",error:E1,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",Vt._`${r}${Vt.getProperty(a)}`);t.if(Vt._`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:Ei.DiscrError.Tag,tag:c,tagName:a})),e.ok(u);function l(){let m=f();t.if(!1);for(let h in m)t.elseIf(Vt._`${c} === ${h}`),t.assign(u,d(m[h]));t.else(),e.error(!1,{discrError:Ei.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(m){let h=t.name("valid"),_=e.subschema({keyword:"oneOf",schemaProp:m},h);return e.mergeEvaluated(_,Vt.Name),h}function f(){var m;let h={},_=v(n),w=!0;for(let C=0;C<i.length;C++){let y=i[C];if((y===null||y===void 0?void 0:y.$ref)&&!T1.schemaHasRulesButRef(y,s.self.RULES)){let j=y.$ref;if(y=nh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,j),y instanceof nh.SchemaEnv)y=y.schema;if(y===void 0)throw new P1.default(s.opts.uriResolver,s.baseId,j)}let x=(m=y===null||y===void 0?void 0:y.properties)===null||m===void 0?void 0:m[a];if(typeof x!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);w=w&&(_||v(y)),k(x,C)}if(!w)throw Error(`discriminator: "${a}" must be required`);return h;function v({required:C}){return Array.isArray(C)&&C.includes(a)}function k(C,y){if(C.const)b(C.const,y);else if(C.enum)for(let x of C.enum)b(x,y);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function b(C,y){if(typeof C!="string"||C in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[C]=y}}}};sh.default=R1});var ah=P(function(nO,C1){C1.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 Ii=P(function(we,Ri){Object.defineProperty(we,"__esModule",{value:!0});we.MissingRefError=we.ValidationError=we.CodeGen=we.Name=we.nil=we.stringify=we.str=we._=we.KeywordCxt=we.Ajv=void 0;var O1=df(),j1=Xm(),N1=ih(),ch=ah(),A1=["/properties"],cn="http://json-schema.org/draft-07/schema";class Mr extends O1.default{_addVocabularies(){if(super._addVocabularies(),j1.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(N1.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(ch,A1):ch;this.addMetaSchema(e,cn,!1),this.refs["http://json-schema.org/schema"]=cn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(cn)?cn:void 0)}}we.Ajv=Mr;Ri.exports=we=Mr;Ri.exports.Ajv=Mr;Object.defineProperty(we,"__esModule",{value:!0});we.default=Mr;var Z1=kr();Object.defineProperty(we,"KeywordCxt",{enumerable:!0,get:function(){return Z1.KeywordCxt}});var Ft=Z();Object.defineProperty(we,"_",{enumerable:!0,get:function(){return Ft._}});Object.defineProperty(we,"str",{enumerable:!0,get:function(){return Ft.str}});Object.defineProperty(we,"stringify",{enumerable:!0,get:function(){return Ft.stringify}});Object.defineProperty(we,"nil",{enumerable:!0,get:function(){return Ft.nil}});Object.defineProperty(we,"Name",{enumerable:!0,get:function(){return Ft.Name}});Object.defineProperty(we,"CodeGen",{enumerable:!0,get:function(){return Ft.CodeGen}});var q1=Lo();Object.defineProperty(we,"ValidationError",{enumerable:!0,get:function(){return q1.default}});var M1=Pr();Object.defineProperty(we,"MissingRefError",{enumerable:!0,get:function(){return M1.default}})});var yh=P(function(_h){Object.defineProperty(_h,"__esModule",{value:!0});_h.formatNames=_h.fastFormats=_h.fullFormats=void 0;function Ze(e,t){return{validate:e,compare:t}}_h.fullFormats={date:Ze(ph,Ni),time:Ze(Oi(!0),Ai),"date-time":Ze(uh(!0),mh),"iso-time":Ze(Oi(),fh),"iso-date-time":Ze(uh(),hh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:B1,"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:eS,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:W1,int32:{type:"number",validate:Y1},int64:{type:"number",validate:Q1},float:{type:"number",validate:dh},double:{type:"number",validate:dh},password:!0,binary:!0};_h.fastFormats={..._h.fullFormats,date:Ze(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ni),time:Ze(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ai),"date-time":Ze(/^\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,mh),"iso-time":Ze(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,fh),"iso-date-time":Ze(/^\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,hh),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};_h.formatNames=Object.keys(_h.fullFormats);function U1(e){return e%4===0&&(e%100!==0||e%400===0)}var V1=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,F1=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ph(e){let t=V1.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&&U1(r)?29:F1[o])}function Ni(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var Ci=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Oi(e){return function(r){let o=Ci.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 Ai(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 fh(e,t){if(!(e&&t))return;let r=Ci.exec(e),o=Ci.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 ji=/t|\s/i;function uh(e){let t=Oi(e);return function(o){let n=o.split(ji);return n.length===2&&ph(n[0])&&t(n[1])}}function mh(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 hh(e,t){if(!(e&&t))return;let[r,o]=e.split(ji),[n,s]=t.split(ji),i=Ni(r,n);if(i===void 0)return;return i||Ai(o,s)}var H1=/\/|:/,K1=/^(?:[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 B1(e){return H1.test(e)&&K1.test(e)}var lh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function W1(e){return lh.lastIndex=0,lh.test(e)}var J1=-2147483648,G1=2147483647;function Y1(e){return Number.isInteger(e)&&e<=G1&&e>=J1}function Q1(e){return Number.isInteger(e)}function dh(){return!0}var X1=/[^\\]\\Z/;function eS(e){if(X1.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var $h=P(function(vh){Object.defineProperty(vh,"__esModule",{value:!0});vh.formatLimitDefinition=void 0;var rS=Ii(),Oe=Z(),at=Oe.operators,un={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}},oS={message:({keyword:e,schemaCode:t})=>Oe.str`should be ${un[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Oe._`{comparison: ${un[e].okStr}, limit: ${t}}`};vh.formatLimitDefinition={keyword:Object.keys(un),type:"string",schemaType:"string",$data:!0,error:oS,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 rS.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",Oe._`${f}[${u.schemaCode}]`);e.fail$data(Oe.or(Oe._`typeof ${m} != "object"`,Oe._`${m} instanceof RegExp`,Oe._`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?Oe._`${i.code.formats}${Oe.getProperty(f)}`:void 0});e.fail$data(d(h))}function d(f){return Oe._`${f}.compare(${r}, ${o}) ${un[n].fail} 0`}},dependencies:["format"]};var nS=(e)=>(e.addKeyword(vh.formatLimitDefinition),e);vh.default=nS});var zh=P(function(Dr,bh){Object.defineProperty(Dr,"__esModule",{value:!0});var Ht=yh(),iS=$h(),Mi=Z(),wh=new Mi.Name("fullFormats"),aS=new Mi.Name("fastFormats"),Di=(e,t={keywords:!0})=>{if(Array.isArray(t))return xh(e,t,Ht.fullFormats,wh),e;let[r,o]=t.mode==="fast"?[Ht.fastFormats,aS]:[Ht.fullFormats,wh],n=t.formats||Ht.formatNames;if(xh(e,n,r,o),t.keywords)(0,iS.default)(e);return e};Di.get=(e,t="full")=>{let o=(t==="fast"?Ht.fastFormats:Ht.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function xh(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=Mi._`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}bh.exports=Dr=Di;Object.defineProperty(Dr,"__esModule",{value:!0});Dr.default=Di});var Pn=Object.freeze({status:"aborted"});function g(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 e_=Symbol("zod_brand");class Be extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var Hr={};function xe(e){if(e)Object.assign(Hr,e);return Hr}function la(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 En(e,t="|"){return e.map((r)=>In(r)).join(t)}function da(e,t){if(typeof t==="bigint")return t.toString();return t}function Br(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Wr(e){return e===null||e===void 0}function Jr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function pa(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 H(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 Gr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function bt(e){return JSON.stringify(e)}var Rn=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Yt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var fa=Br(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Qt(e){if(Yt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let r=t.prototype;if(Yt(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}var ma=new Set(["string","number","symbol"]);function lt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function je(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function T(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 In(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ha(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var _a={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 t_(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 je(e,{...e._zod.def,shape:r,checks:[]})}function r_(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 je(e,{...e._zod.def,shape:r,checks:[]})}function o_(e,t){if(!Qt(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 Gr(this,"shape",o),o},checks:[]};return je(e,r)}function n_(e,t){return je(e,{...e._zod.def,get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return Gr(this,"shape",r),r},catchall:t._zod.def.catchall,checks:[]})}function s_(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 je(t,{...t._zod.def,shape:n,checks:[]})}function i_(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 je(t,{...t._zod.def,shape:n,checks:[]})}function zt(e,t=0){for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function qe(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Kr(e){return typeof e==="string"?e:e?.message}function Ne(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=Kr(e.inst?._zod.def?.error?.(e))??Kr(t?.error?.(e))??Kr(r.customError?.(e))??Kr(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function Yr(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function St(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var ga=(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,da,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Qr=g("$ZodError",ga),Cn=g("$ZodError",ga,{Parent:Error});function On(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 jn(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 ya=(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 Be;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((u)=>Ne(u,s,xe())));throw Rn(a,n?.callee),a}return i.value};var va=(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)=>Ne(u,s,xe())));throw Rn(a,n?.callee),a}return i.value};var Nn=(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 Be;return s.issues.length?{success:!1,error:new(e??Qr)(s.issues.map((i)=>Ne(i,n,xe())))}:{success:!0,data:s.value}},Xt=Nn(Cn),An=(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)=>Ne(i,n,xe())))}:{success:!0,data:s.value}},Xr=An(Cn);var $a=/^[cC][^\s-]{8,}$/,wa=/^[0-9a-z]+$/,xa=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ba=/^[0-9a-vA-V]{20}$/,za=/^[A-Za-z0-9]{27}$/,Sa=/^[a-zA-Z0-9_-]{21}$/,ka=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Pa=/^([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})$/,Zn=(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 Ta=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Ea(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var Ra=/^(?:(?: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])$/,Ia=/^(([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})$/,Ca=/^((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])$/,Oa=/^(([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])$/,ja=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,qn=/^[A-Za-z0-9_-]*$/,Na=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Aa=/^\+(?:[0-9]){6,14}[0-9]$/,Za="(?:(?:\\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])))",qa=new RegExp(`^${Za}$`);function Ma(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 Da(e){return new RegExp(`^${Ma(e)}$`)}function La(e){let t=Ma({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(`^${Za}T(?:${o})$`)}var Ua=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Va=/^\d+$/,Fa=/^-?\d+(?:\.\d+)?/i,Ha=/true|false/i,Ka=/null/i;var Ba=/^[^A-Z]*$/,Wa=/^[^a-z]*$/;var de=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ja={number:"number",bigint:"bigint",object:"date"},Mn=g("$ZodCheckLessThan",(e,t)=>{de.init(e,t);let r=Ja[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})}}),Dn=g("$ZodCheckGreaterThan",(e,t)=>{de.init(e,t);let r=Ja[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})}}),Ga=g("$ZodCheckMultipleOf",(e,t)=>{de.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):pa(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})}}),Ya=g("$ZodCheckNumberFormat",(e,t)=>{de.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=_a[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=Va}),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 Qa=g("$ZodCheckMaxLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Wr(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=Yr(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Xa=g("$ZodCheckMinLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Wr(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=Yr(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ec=g("$ZodCheckLengthEquals",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Wr(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=Yr(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})}}),er=g("$ZodCheckStringFormat",(e,t)=>{var r,o;if(de.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=()=>{})}),tc=g("$ZodCheckRegex",(e,t)=>{er.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})}}),rc=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ba),er.init(e,t)}),oc=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Wa),er.init(e,t)}),nc=g("$ZodCheckIncludes",(e,t)=>{de.init(e,t);let r=lt(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})}}),sc=g("$ZodCheckStartsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`^${lt(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})}}),ic=g("$ZodCheckEndsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`.*${lt(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 ac=g("$ZodCheckOverwrite",(e,t)=>{de.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Ln{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),o=Math.min(...r.map((s)=>s.length-s.trimStart().length)),n=r.map((s)=>s.slice(o)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of n)this.content.push(s)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,o.join(`
11
+ `))}}var uc={major:4,minor:0,patch:0};var U=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=uc;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(s,i,a)=>{let u=zt(s),c;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(u)continue;let d=s.issues.length,f=l._zod.check(s);if(f instanceof Promise&&a?.async===!1)throw new Be;if(c||f instanceof Promise)c=(c??Promise.resolve()).then(async()=>{if(await f,s.issues.length===d)return;if(!u)u=zt(s,d)});else{if(s.issues.length===d)continue;if(!u)u=zt(s,d)}}if(c)return c.then(()=>s);return s};e._zod.run=(s,i)=>{let a=e._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new Be;return a.then((u)=>n(u,o,i))}return n(a,o,i)}}e["~standard"]={validate:(n)=>{try{let s=Xt(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return Xr(e,n).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),ro=g("$ZodString",(e,t)=>{U.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ua(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),B=g("$ZodStringFormat",(e,t)=>{er.init(e,t),ro.init(e,t)}),vc=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Pa),B.init(e,t)}),$c=g("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Zn(o))}else t.pattern??(t.pattern=Zn());B.init(e,t)}),wc=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ta),B.init(e,t)}),xc=g("$ZodURL",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{try{let o=r.value,n=new URL(o),s=n.href;if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Na.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(!o.endsWith("/")&&s.endsWith("/"))r.value=s.slice(0,-1);else r.value=s;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),bc=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ea()),B.init(e,t)}),zc=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Sa),B.init(e,t)}),Sc=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=$a),B.init(e,t)}),kc=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=wa),B.init(e,t)}),Pc=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=xa),B.init(e,t)}),Tc=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ba),B.init(e,t)}),Ec=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=za),B.init(e,t)}),Rc=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=La(t)),B.init(e,t)}),Ic=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=qa),B.init(e,t)}),Cc=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Da(t)),B.init(e,t)}),Oc=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ka),B.init(e,t)}),jc=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ra),B.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv4"})}),Nc=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ia),B.init(e,t),e._zod.onattach.push((r)=>{let o=r._zod.bag;o.format="ipv6"}),e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ac=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ca),B.init(e,t)}),Zc=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Oa),B.init(e,t),e._zod.check=(r)=>{let[o,n]=r.value.split("/");try{if(!n)throw Error();let s=Number(n);if(`${s}`!==n)throw Error();if(s<0||s>128)throw Error();new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function qc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Mc=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ja),B.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=(r)=>{if(qc(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function c_(e){if(!qn.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return qc(r)}var Dc=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=qn),B.init(e,t),e._zod.onattach.push((r)=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=(r)=>{if(c_(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Lc=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Aa),B.init(e,t)});function u_(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var Uc=g("$ZodJWT",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{if(u_(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Vn=g("$ZodNumber",(e,t)=>{U.init(e,t),e._zod.pattern=e._zod.bag.pattern??Fa,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),Vc=g("$ZodNumber",(e,t)=>{Ya.init(e,t),Vn.init(e,t)}),Fc=g("$ZodBoolean",(e,t)=>{U.init(e,t),e._zod.pattern=Ha,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var Hc=g("$ZodNull",(e,t)=>{U.init(e,t),e._zod.pattern=Ka,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),Kc=g("$ZodAny",(e,t)=>{U.init(e,t),e._zod.parse=(r)=>r}),Bc=g("$ZodUnknown",(e,t)=>{U.init(e,t),e._zod.parse=(r)=>r}),Wc=g("$ZodNever",(e,t)=>{U.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function lc(e,t,r){if(e.issues.length)t.issues.push(...qe(r,e.issues));t.value[r]=e.value}var Jc=g("$ZodArray",(e,t)=>{U.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],u=t.element._zod.run({value:a,issues:[]},o);if(u instanceof Promise)s.push(u.then((c)=>lc(c,r,i)));else lc(u,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function to(e,t,r){if(e.issues.length)t.issues.push(...qe(r,e.issues));t.value[r]=e.value}function dc(e,t,r,o){if(e.issues.length)if(o[r]===void 0)if(r in o)t.value[r]=void 0;else t.value[r]=e.value;else t.issues.push(...qe(r,e.issues));else if(e.value===void 0){if(r in o)t.value[r]=void 0}else t.value[r]=e.value}var Gc=g("$ZodObject",(e,t)=>{U.init(e,t);let r=Br(()=>{let d=Object.keys(t.shape);for(let m of d)if(!(t.shape[m]instanceof U))throw Error(`Invalid element at key "${m}": expected a Zod schema`);let f=ha(t.shape);return{shape:t.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(f)}});H(e._zod,"propValues",()=>{let d=t.shape,f={};for(let m in d){let h=d[m]._zod;if(h.values){f[m]??(f[m]=new Set);for(let _ of h.values)f[m].add(_)}}return f});let o=(d)=>{let f=new Ln(["shape","payload","ctx"]),m=r.value,h=(k)=>{let b=bt(k);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};f.write("const input = payload.value;");let _=Object.create(null),w=0;for(let k of m.keys)_[k]=`key_${w++}`;f.write("const newResult = {}");for(let k of m.keys)if(m.optionalKeys.has(k)){let b=_[k];f.write(`const ${b} = ${h(k)};`);let C=bt(k);f.write(`
12
+ if (${b}.issues.length) {
13
+ if (input[${C}] === undefined) {
14
+ if (${C} in input) {
15
+ newResult[${C}] = undefined;
16
16
  }
17
17
  } else {
18
18
  payload.issues = payload.issues.concat(
19
- ${E}.issues.map((iss) => ({
19
+ ${b}.issues.map((iss) => ({
20
20
  ...iss,
21
- path: iss.path ? [${y}, ...iss.path] : [${y}],
21
+ path: iss.path ? [${C}, ...iss.path] : [${C}],
22
22
  }))
23
23
  );
24
24
  }
25
- } else if (${E}.value === undefined) {
26
- if (${y} in input) newResult[${y}] = undefined;
25
+ } else if (${b}.value === undefined) {
26
+ if (${C} in input) newResult[${C}] = undefined;
27
27
  } else {
28
- newResult[${y}] = ${E}.value;
28
+ newResult[${C}] = ${b}.value;
29
29
  }
30
- `)}else{let E=F[b];L.write(`const ${E} = ${q(b)};`),L.write(`
31
- if (${E}.issues.length) payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
30
+ `)}else{let b=_[k];f.write(`const ${b} = ${h(k)};`),f.write(`
31
+ if (${b}.issues.length) payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
32
32
  ...iss,
33
- path: iss.path ? [${g1(b)}, ...iss.path] : [${g1(b)}]
34
- })));`),L.write(`newResult[${g1(b)}] = ${E}.value`)}L.write("payload.value = newResult;"),L.write("return payload;");let O=L.compile();return(b,E)=>O(D,b,E)},$,J=Y6,G=!p4.jitless,B=G&&Z8.value,z=X.catchall,A;Q._zod.parse=(D,L)=>{A??(A=Y.value);let K=D.value;if(!J(K))return D.issues.push({expected:"object",code:"invalid_type",input:K,inst:Q}),D;let q=[];if(G&&B&&L?.async===!1&&L.jitless!==!0){if(!$)$=W(X.shape);D=$(D,L)}else{D.value={};let E=A.shape;for(let y of A.keys){let x=E[y],j0=x._zod.run({value:K[y],issues:[]},L),y0=x._zod.optin==="optional"&&x._zod.optout==="optional";if(j0 instanceof Promise)q.push(j0.then((X6)=>y0?j$(X6,D,y,K):t4(X6,D,y)));else if(y0)j$(j0,D,y,K);else t4(j0,D,y)}}if(!z)return q.length?Promise.all(q).then(()=>D):D;let F=[],N=A.keySet,O=z._zod,b=O.def.type;for(let E of Object.keys(K)){if(N.has(E))continue;if(b==="never"){F.push(E);continue}let y=O.run({value:K[E],issues:[]},L);if(y instanceof Promise)q.push(y.then((x)=>t4(x,D,E)));else t4(y,D,E)}if(F.length)D.issues.push({code:"unrecognized_keys",keys:F,input:K,inst:Q});if(!q.length)return D;return Promise.all(q).then(()=>{return D})}});function b$(Q,X,Y,W){for(let $ of Q)if($.issues.length===0)return X.value=$.value,X;return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:Q.map(($)=>$.issues.map((J)=>p0(J,W,k0())))}),X}var e4=U("$ZodUnion",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"optin",()=>X.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),Q0(Q._zod,"optout",()=>X.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),Q0(Q._zod,"values",()=>{if(X.options.every((Y)=>Y._zod.values))return new Set(X.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),Q0(Q._zod,"pattern",()=>{if(X.options.every((Y)=>Y._zod.pattern)){let Y=X.options.map((W)=>W._zod.pattern);return new RegExp(`^(${Y.map((W)=>n6(W.source)).join("|")})$`)}return}),Q._zod.parse=(Y,W)=>{let $=!1,J=[];for(let G of X.options){let H=G._zod.run({value:Y.value,issues:[]},W);if(H instanceof Promise)J.push(H),$=!0;else{if(H.issues.length===0)return H;J.push(H)}}if(!$)return b$(J,Y,Q,W);return Promise.all(J).then((G)=>{return b$(G,Y,Q,W)})}}),MQ=U("$ZodDiscriminatedUnion",(Q,X)=>{e4.init(Q,X);let Y=Q._zod.parse;Q0(Q._zod,"propValues",()=>{let $={};for(let J of X.options){let G=J._zod.propValues;if(!G||Object.keys(G).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let[H,B]of Object.entries(G)){if(!$[H])$[H]=new Set;for(let z of B)$[H].add(z)}}return $});let W=p6(()=>{let $=X.options,J=new Map;for(let G of $){let H=G._zod.propValues[X.discriminator];if(!H||H.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(G)}"`);for(let B of H){if(J.has(B))throw Error(`Duplicate discriminator value "${String(B)}"`);J.set(B,G)}}return J});Q._zod.parse=($,J)=>{let G=$.value;if(!Y6(G))return $.issues.push({code:"invalid_type",expected:"object",input:G,inst:Q}),$;let H=W.value.get(G?.[X.discriminator]);if(H)return H._zod.run($,J);if(X.unionFallback)return Y($,J);return $.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:G,path:[X.discriminator],inst:Q}),$}}),jQ=U("$ZodIntersection",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{let $=Y.value,J=X.left._zod.run({value:$,issues:[]},W),G=X.right._zod.run({value:$,issues:[]},W);if(J instanceof Promise||G instanceof Promise)return Promise.all([J,G]).then(([B,z])=>{return E$(Y,B,z)});return E$(Y,J,G)}});function r8(Q,X){if(Q===X)return{valid:!0,data:Q};if(Q instanceof Date&&X instanceof Date&&+Q===+X)return{valid:!0,data:Q};if(W6(Q)&&W6(X)){let Y=Object.keys(X),W=Object.keys(Q).filter((J)=>Y.indexOf(J)!==-1),$={...Q,...X};for(let J of W){let G=r8(Q[J],X[J]);if(!G.valid)return{valid:!1,mergeErrorPath:[J,...G.mergeErrorPath]};$[J]=G.data}return{valid:!0,data:$}}if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let W=0;W<Q.length;W++){let $=Q[W],J=X[W],G=r8($,J);if(!G.valid)return{valid:!1,mergeErrorPath:[W,...G.mergeErrorPath]};Y.push(G.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function E$(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(y1(Q))return Q;let W=r8(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var bQ=U("$ZodRecord",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{let $=Y.value;if(!W6($))return Y.issues.push({expected:"record",code:"invalid_type",input:$,inst:Q}),Y;let J=[];if(X.keyType._zod.values){let G=X.keyType._zod.values;Y.value={};for(let B of G)if(typeof B==="string"||typeof B==="number"||typeof B==="symbol"){let z=X.valueType._zod.run({value:$[B],issues:[]},W);if(z instanceof Promise)J.push(z.then((A)=>{if(A.issues.length)Y.issues.push(...W1(B,A.issues));Y.value[B]=A.value}));else{if(z.issues.length)Y.issues.push(...W1(B,z.issues));Y.value[B]=z.value}}let H;for(let B in $)if(!G.has(B))H=H??[],H.push(B);if(H&&H.length>0)Y.issues.push({code:"unrecognized_keys",input:$,inst:Q,keys:H})}else{Y.value={};for(let G of Reflect.ownKeys($)){if(G==="__proto__")continue;let H=X.keyType._zod.run({value:G,issues:[]},W);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(H.issues.length){Y.issues.push({origin:"record",code:"invalid_key",issues:H.issues.map((z)=>p0(z,W,k0())),input:G,path:[G],inst:Q}),Y.value[H.value]=H.value;continue}let B=X.valueType._zod.run({value:$[G],issues:[]},W);if(B instanceof Promise)J.push(B.then((z)=>{if(z.issues.length)Y.issues.push(...W1(G,z.issues));Y.value[H.value]=z.value}));else{if(B.issues.length)Y.issues.push(...W1(G,B.issues));Y.value[H.value]=B.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var EQ=U("$ZodEnum",(Q,X)=>{a.init(Q,X);let Y=c6(X.entries);Q._zod.values=new Set(Y),Q._zod.pattern=new RegExp(`^(${Y.filter((W)=>v8.has(typeof W)).map((W)=>typeof W==="string"?U1(W):W.toString()).join("|")})$`),Q._zod.parse=(W,$)=>{let J=W.value;if(Q._zod.values.has(J))return W;return W.issues.push({code:"invalid_value",values:Y,input:J,inst:Q}),W}}),SQ=U("$ZodLiteral",(Q,X)=>{a.init(Q,X),Q._zod.values=new Set(X.values),Q._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?U1(Y):Y?Y.toString():String(Y)).join("|")})$`),Q._zod.parse=(Y,W)=>{let $=Y.value;if(Q._zod.values.has($))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:$,inst:Q}),Y}});var PQ=U("$ZodTransform",(Q,X)=>{a.init(Q,X),Q._zod.parse=(Y,W)=>{let $=X.transform(Y.value,Y);if(W.async)return($ instanceof Promise?$:Promise.resolve($)).then((G)=>{return Y.value=G,Y});if($ instanceof Promise)throw new V1;return Y.value=$,Y}}),IQ=U("$ZodOptional",(Q,X)=>{a.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",Q0(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),Q0(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${n6(Y.source)})?$`):void 0}),Q._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional")return X.innerType._zod.run(Y,W);if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),RQ=U("$ZodNullable",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"optin",()=>X.innerType._zod.optin),Q0(Q._zod,"optout",()=>X.innerType._zod.optout),Q0(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${n6(Y.source)}|null)$`):void 0}),Q0(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),Q._zod.parse=(Y,W)=>{if(Y.value===null)return Y;return X.innerType._zod.run(Y,W)}}),CQ=U("$ZodDefault",(Q,X)=>{a.init(Q,X),Q._zod.optin="optional",Q0(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(Y.value===void 0)return Y.value=X.defaultValue,Y;let $=X.innerType._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>S$(J,X));return S$($,X)}});function S$(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var TQ=U("$ZodPrefault",(Q,X)=>{a.init(Q,X),Q._zod.optin="optional",Q0(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,W)}}),ZQ=U("$ZodNonOptional",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"values",()=>{let Y=X.innerType._zod.values;return Y?new Set([...Y].filter((W)=>W!==void 0)):void 0}),Q._zod.parse=(Y,W)=>{let $=X.innerType._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>P$(J,Q));return P$($,Q)}});function P$(Q,X){if(!Q.issues.length&&Q.value===void 0)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:Q.value,inst:X});return Q}var vQ=U("$ZodCatch",(Q,X)=>{a.init(Q,X),Q._zod.optin="optional",Q0(Q._zod,"optout",()=>X.innerType._zod.optout),Q0(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{let $=X.innerType._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>{if(Y.value=J.value,J.issues.length)Y.value=X.catchValue({...Y,error:{issues:J.issues.map((G)=>p0(G,W,k0()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=$.value,$.issues.length)Y.value=X.catchValue({...Y,error:{issues:$.issues.map((J)=>p0(J,W,k0()))},input:Y.value}),Y.issues=[];return Y}});var kQ=U("$ZodPipe",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"values",()=>X.in._zod.values),Q0(Q._zod,"optin",()=>X.in._zod.optin),Q0(Q._zod,"optout",()=>X.out._zod.optout),Q._zod.parse=(Y,W)=>{let $=X.in._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>I$(J,X,W));return I$($,X,W)}});function I$(Q,X,Y){if(y1(Q))return Q;return X.out._zod.run({value:Q.value,issues:Q.issues},Y)}var _Q=U("$ZodReadonly",(Q,X)=>{a.init(Q,X),Q0(Q._zod,"propValues",()=>X.innerType._zod.propValues),Q0(Q._zod,"values",()=>X.innerType._zod.values),Q0(Q._zod,"optin",()=>X.innerType._zod.optin),Q0(Q._zod,"optout",()=>X.innerType._zod.optout),Q._zod.parse=(Y,W)=>{let $=X.innerType._zod.run(Y,W);if($ instanceof Promise)return $.then(R$);return R$($)}});function R$(Q){return Q.value=Object.freeze(Q.value),Q}var xQ=U("$ZodCustom",(Q,X)=>{F0.init(Q,X),a.init(Q,X),Q._zod.parse=(Y,W)=>{return Y},Q._zod.check=(Y)=>{let W=Y.value,$=X.fn(W);if($ instanceof Promise)return $.then((J)=>C$(J,Y,W,Q));C$($,Y,W,Q);return}});function C$(Q,X,Y,W){if(!Q){let $={code:"custom",input:Y,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)$.params=W._zod.def.params;X.issues.push(x8($))}}var Bz=(Q)=>{let X=typeof Q;switch(X){case"number":return Number.isNaN(Q)?"NaN":"number";case"object":{if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Object.getPrototypeOf(Q)!==Object.prototype&&Q.constructor)return Q.constructor.name}}return X},zz=()=>{let Q={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 X(W){return Q[W]??null}let Y={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(W)=>{switch(W.code){case"invalid_type":return`Invalid input: expected ${W.expected}, received ${Bz(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${d4(W.values[0])}`;return`Invalid option: expected one of ${i4(W.values,"|")}`;case"too_big":{let $=W.inclusive?"<=":"<",J=X(W.origin);if(J)return`Too big: expected ${W.origin??"value"} to have ${$}${W.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${$}${W.maximum.toString()}`}case"too_small":{let $=W.inclusive?">=":">",J=X(W.origin);if(J)return`Too small: expected ${W.origin} to have ${$}${W.minimum.toString()} ${J.unit}`;return`Too small: expected ${W.origin} to be ${$}${W.minimum.toString()}`}case"invalid_format":{let $=W;if($.format==="starts_with")return`Invalid string: must start with "${$.prefix}"`;if($.format==="ends_with")return`Invalid string: must end with "${$.suffix}"`;if($.format==="includes")return`Invalid string: must include "${$.includes}"`;if($.format==="regex")return`Invalid string: must match pattern ${$.pattern}`;return`Invalid ${Y[$.format]??W.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${W.divisor}`;case"unrecognized_keys":return`Unrecognized key${W.keys.length>1?"s":""}: ${i4(W.keys,", ")}`;case"invalid_key":return`Invalid key in ${W.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${W.origin}`;default:return"Invalid input"}}};function gQ(){return{localeError:zz()}}var Az=Symbol("ZodOutput"),Kz=Symbol("ZodInput");class Q9{constructor(){this._map=new Map,this._idmap=new Map}add(Q,...X){let Y=X[0];if(this._map.set(Q,Y),Y&&typeof Y==="object"&&"id"in Y){if(this._idmap.has(Y.id))throw Error(`ID ${Y.id} already exists in the registry`);this._idmap.set(Y.id,Q)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(Q){let X=this._map.get(Q);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(Q),this}get(Q){let X=Q._zod.parent;if(X){let Y={...this.get(X)??{}};return delete Y.id,{...Y,...this._map.get(Q)}}return this._map.get(Q)}has(Q){return this._map.has(Q)}}function x$(){return new Q9}var O1=x$();function yQ(Q,X){return new Q({type:"string",...k(X)})}function hQ(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...k(X)})}function X9(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...k(X)})}function fQ(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...k(X)})}function uQ(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(X)})}function lQ(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(X)})}function mQ(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(X)})}function cQ(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...k(X)})}function pQ(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...k(X)})}function iQ(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(X)})}function nQ(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...k(X)})}function dQ(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(X)})}function oQ(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...k(X)})}function rQ(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...k(X)})}function tQ(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(X)})}function aQ(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(X)})}function sQ(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(X)})}function eQ(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(X)})}function QX(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(X)})}function XX(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...k(X)})}function YX(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...k(X)})}function WX(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...k(X)})}function $X(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...k(X)})}function g$(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(X)})}function y$(Q,X){return new Q({type:"string",format:"date",check:"string_format",...k(X)})}function h$(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...k(X)})}function f$(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...k(X)})}function JX(Q,X){return new Q({type:"number",checks:[],...k(X)})}function GX(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...k(X)})}function HX(Q,X){return new Q({type:"boolean",...k(X)})}function BX(Q,X){return new Q({type:"null",...k(X)})}function zX(Q){return new Q({type:"unknown"})}function AX(Q,X){return new Q({type:"never",...k(X)})}function Y9(Q,X){return new n8({check:"less_than",...k(X),value:Q,inclusive:!1})}function a6(Q,X){return new n8({check:"less_than",...k(X),value:Q,inclusive:!0})}function W9(Q,X){return new d8({check:"greater_than",...k(X),value:Q,inclusive:!1})}function s6(Q,X){return new d8({check:"greater_than",...k(X),value:Q,inclusive:!0})}function $9(Q,X){return new H$({check:"multiple_of",...k(X),value:Q})}function J9(Q,X){return new z$({check:"max_length",...k(X),maximum:Q})}function $6(Q,X){return new A$({check:"min_length",...k(X),minimum:Q})}function G9(Q,X){return new K$({check:"length_equals",...k(X),length:Q})}function KX(Q,X){return new D$({check:"string_format",format:"regex",...k(X),pattern:Q})}function DX(Q){return new L$({check:"string_format",format:"lowercase",...k(Q)})}function LX(Q){return new q$({check:"string_format",format:"uppercase",...k(Q)})}function qX(Q,X){return new F$({check:"string_format",format:"includes",...k(X),includes:Q})}function FX(Q,X){return new V$({check:"string_format",format:"starts_with",...k(X),prefix:Q})}function VX(Q,X){return new U$({check:"string_format",format:"ends_with",...k(X),suffix:Q})}function u1(Q){return new O$({check:"overwrite",tx:Q})}function UX(Q){return u1((X)=>X.normalize(Q))}function OX(){return u1((Q)=>Q.trim())}function NX(){return u1((Q)=>Q.toLowerCase())}function wX(){return u1((Q)=>Q.toUpperCase())}function u$(Q,X,Y){return new Q({type:"array",element:X,...k(Y)})}function MX(Q,X,Y){let W=k(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function jX(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...k(Y)})}class bX{constructor(Q){this.counter=0,this.metadataRegistry=Q?.metadata??O1,this.target=Q?.target??"draft-2020-12",this.unrepresentable=Q?.unrepresentable??"throw",this.override=Q?.override??(()=>{}),this.io=Q?.io??"output",this.seen=new Map}process(Q,X={path:[],schemaPath:[]}){var Y;let W=Q._zod.def,$={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},J=this.seen.get(Q);if(J){if(J.count++,X.schemaPath.includes(Q))J.cycle=X.path;return J.schema}let G={schema:{},count:1,cycle:void 0,path:X.path};this.seen.set(Q,G);let H=Q._zod.toJSONSchema?.();if(H)G.schema=H;else{let A={...X,schemaPath:[...X.schemaPath,Q],path:X.path},D=Q._zod.parent;if(D)G.ref=D,this.process(D,A),this.seen.get(D).isParent=!0;else{let L=G.schema;switch(W.type){case"string":{let K=L;K.type="string";let{minimum:q,maximum:F,format:N,patterns:O,contentEncoding:b}=Q._zod.bag;if(typeof q==="number")K.minLength=q;if(typeof F==="number")K.maxLength=F;if(N){if(K.format=$[N]??N,K.format==="")delete K.format}if(b)K.contentEncoding=b;if(O&&O.size>0){let E=[...O];if(E.length===1)K.pattern=E[0].source;else if(E.length>1)G.schema.allOf=[...E.map((y)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:y.source}))]}break}case"number":{let K=L,{minimum:q,maximum:F,format:N,multipleOf:O,exclusiveMaximum:b,exclusiveMinimum:E}=Q._zod.bag;if(typeof N==="string"&&N.includes("int"))K.type="integer";else K.type="number";if(typeof E==="number")K.exclusiveMinimum=E;if(typeof q==="number"){if(K.minimum=q,typeof E==="number")if(E>=q)delete K.minimum;else delete K.exclusiveMinimum}if(typeof b==="number")K.exclusiveMaximum=b;if(typeof F==="number"){if(K.maximum=F,typeof b==="number")if(b<=F)delete K.maximum;else delete K.exclusiveMaximum}if(typeof O==="number")K.multipleOf=O;break}case"boolean":{let K=L;K.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{L.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{L.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let K=L,{minimum:q,maximum:F}=Q._zod.bag;if(typeof q==="number")K.minItems=q;if(typeof F==="number")K.maxItems=F;K.type="array",K.items=this.process(W.element,{...A,path:[...A.path,"items"]});break}case"object":{let K=L;K.type="object",K.properties={};let q=W.shape;for(let O in q)K.properties[O]=this.process(q[O],{...A,path:[...A.path,"properties",O]});let F=new Set(Object.keys(q)),N=new Set([...F].filter((O)=>{let b=W.shape[O]._zod;if(this.io==="input")return b.optin===void 0;else return b.optout===void 0}));if(N.size>0)K.required=Array.from(N);if(W.catchall?._zod.def.type==="never")K.additionalProperties=!1;else if(!W.catchall){if(this.io==="output")K.additionalProperties=!1}else if(W.catchall)K.additionalProperties=this.process(W.catchall,{...A,path:[...A.path,"additionalProperties"]});break}case"union":{let K=L;K.anyOf=W.options.map((q,F)=>this.process(q,{...A,path:[...A.path,"anyOf",F]}));break}case"intersection":{let K=L,q=this.process(W.left,{...A,path:[...A.path,"allOf",0]}),F=this.process(W.right,{...A,path:[...A.path,"allOf",1]}),N=(b)=>("allOf"in b)&&Object.keys(b).length===1,O=[...N(q)?q.allOf:[q],...N(F)?F.allOf:[F]];K.allOf=O;break}case"tuple":{let K=L;K.type="array";let q=W.items.map((O,b)=>this.process(O,{...A,path:[...A.path,"prefixItems",b]}));if(this.target==="draft-2020-12")K.prefixItems=q;else K.items=q;if(W.rest){let O=this.process(W.rest,{...A,path:[...A.path,"items"]});if(this.target==="draft-2020-12")K.items=O;else K.additionalItems=O}if(W.rest)K.items=this.process(W.rest,{...A,path:[...A.path,"items"]});let{minimum:F,maximum:N}=Q._zod.bag;if(typeof F==="number")K.minItems=F;if(typeof N==="number")K.maxItems=N;break}case"record":{let K=L;K.type="object",K.propertyNames=this.process(W.keyType,{...A,path:[...A.path,"propertyNames"]}),K.additionalProperties=this.process(W.valueType,{...A,path:[...A.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let K=L,q=c6(W.entries);if(q.every((F)=>typeof F==="number"))K.type="number";if(q.every((F)=>typeof F==="string"))K.type="string";K.enum=q;break}case"literal":{let K=L,q=[];for(let F of W.values)if(F===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof F==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else q.push(Number(F));else q.push(F);if(q.length===0);else if(q.length===1){let F=q[0];K.type=F===null?"null":typeof F,K.const=F}else{if(q.every((F)=>typeof F==="number"))K.type="number";if(q.every((F)=>typeof F==="string"))K.type="string";if(q.every((F)=>typeof F==="boolean"))K.type="string";if(q.every((F)=>F===null))K.type="null";K.enum=q}break}case"file":{let K=L,q={type:"string",format:"binary",contentEncoding:"binary"},{minimum:F,maximum:N,mime:O}=Q._zod.bag;if(F!==void 0)q.minLength=F;if(N!==void 0)q.maxLength=N;if(O)if(O.length===1)q.contentMediaType=O[0],Object.assign(K,q);else K.anyOf=O.map((b)=>{return{...q,contentMediaType:b}});else Object.assign(K,q);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let K=this.process(W.innerType,A);L.anyOf=[K,{type:"null"}];break}case"nonoptional":{this.process(W.innerType,A),G.ref=W.innerType;break}case"success":{let K=L;K.type="boolean";break}case"default":{this.process(W.innerType,A),G.ref=W.innerType,L.default=JSON.parse(JSON.stringify(W.defaultValue));break}case"prefault":{if(this.process(W.innerType,A),G.ref=W.innerType,this.io==="input")L._prefault=JSON.parse(JSON.stringify(W.defaultValue));break}case"catch":{this.process(W.innerType,A),G.ref=W.innerType;let K;try{K=W.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}L.default=K;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let K=L,q=Q._zod.pattern;if(!q)throw Error("Pattern not found in template literal");K.type="string",K.pattern=q.source;break}case"pipe":{let K=this.io==="input"?W.in._zod.def.type==="transform"?W.out:W.in:W.out;this.process(K,A),G.ref=K;break}case"readonly":{this.process(W.innerType,A),G.ref=W.innerType,L.readOnly=!0;break}case"promise":{this.process(W.innerType,A),G.ref=W.innerType;break}case"optional":{this.process(W.innerType,A),G.ref=W.innerType;break}case"lazy":{let K=Q._zod.innerType;this.process(K,A),G.ref=K;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let B=this.metadataRegistry.get(Q);if(B)Object.assign(G.schema,B);if(this.io==="input"&&D0(Q))delete G.schema.examples,delete G.schema.default;if(this.io==="input"&&G.schema._prefault)(Y=G.schema).default??(Y.default=G.schema._prefault);return delete G.schema._prefault,this.seen.get(Q).schema}emit(Q,X){let Y={cycles:X?.cycles??"ref",reused:X?.reused??"inline",external:X?.external??void 0},W=this.seen.get(Q);if(!W)throw Error("Unprocessed schema. This is a bug in Zod.");let $=(z)=>{let A=this.target==="draft-2020-12"?"$defs":"definitions";if(Y.external){let q=Y.external.registry.get(z[0])?.id,F=Y.external.uri??((O)=>O);if(q)return{ref:F(q)};let N=z[1].defId??z[1].schema.id??`schema${this.counter++}`;return z[1].defId=N,{defId:N,ref:`${F("__shared")}#/${A}/${N}`}}if(z[1]===W)return{ref:"#"};let L=`${"#"}/${A}/`,K=z[1].schema.id??`__schema${this.counter++}`;return{defId:K,ref:L+K}},J=(z)=>{if(z[1].schema.$ref)return;let A=z[1],{ref:D,defId:L}=$(z);if(A.def={...A.schema},L)A.defId=L;let K=A.schema;for(let q in K)delete K[q];K.$ref=D};if(Y.cycles==="throw")for(let z of this.seen.entries()){let A=z[1];if(A.cycle)throw Error(`Cycle detected: #/${A.cycle?.join("/")}/<root>
35
-
36
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let z of this.seen.entries()){let A=z[1];if(Q===z[0]){J(z);continue}if(Y.external){let L=Y.external.registry.get(z[0])?.id;if(Q!==z[0]&&L){J(z);continue}}if(this.metadataRegistry.get(z[0])?.id){J(z);continue}if(A.cycle){J(z);continue}if(A.count>1){if(Y.reused==="ref"){J(z);continue}}}let G=(z,A)=>{let D=this.seen.get(z),L=D.def??D.schema,K={...L};if(D.ref===null)return;let q=D.ref;if(D.ref=null,q){G(q,A);let F=this.seen.get(q).schema;if(F.$ref&&A.target==="draft-7")L.allOf=L.allOf??[],L.allOf.push(F);else Object.assign(L,F),Object.assign(L,K)}if(!D.isParent)this.override({zodSchema:z,jsonSchema:L,path:D.path??[]})};for(let z of[...this.seen.entries()].reverse())G(z[0],{target:this.target});let H={};if(this.target==="draft-2020-12")H.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")H.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);if(Y.external?.uri){let z=Y.external.registry.get(Q)?.id;if(!z)throw Error("Schema is missing an `id` property");H.$id=Y.external.uri(z)}Object.assign(H,W.def);let B=Y.external?.defs??{};for(let z of this.seen.entries()){let A=z[1];if(A.def&&A.defId)B[A.defId]=A.def}if(Y.external);else if(Object.keys(B).length>0)if(this.target==="draft-2020-12")H.$defs=B;else H.definitions=B;try{return JSON.parse(JSON.stringify(H))}catch(z){throw Error("Error converting schema to JSON.")}}}function EX(Q,X){if(Q instanceof Q9){let W=new bX(X),$={};for(let H of Q._idmap.entries()){let[B,z]=H;W.process(z)}let J={},G={registry:Q,uri:X?.uri,defs:$};for(let H of Q._idmap.entries()){let[B,z]=H;J[B]=W.emit(z,{...X,external:G})}if(Object.keys($).length>0){let H=W.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[H]:$}}return{schemas:J}}let Y=new bX(X);return Y.process(Q),Y.emit(Q,X)}function D0(Q,X){let Y=X??{seen:new Set};if(Y.seen.has(Q))return!1;Y.seen.add(Q);let $=Q._zod.def;switch($.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return D0($.element,Y);case"object":{for(let J in $.shape)if(D0($.shape[J],Y))return!0;return!1}case"union":{for(let J of $.options)if(D0(J,Y))return!0;return!1}case"intersection":return D0($.left,Y)||D0($.right,Y);case"tuple":{for(let J of $.items)if(D0(J,Y))return!0;if($.rest&&D0($.rest,Y))return!0;return!1}case"record":return D0($.keyType,Y)||D0($.valueType,Y);case"map":return D0($.keyType,Y)||D0($.valueType,Y);case"set":return D0($.valueType,Y);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return D0($.innerType,Y);case"lazy":return D0($.getter(),Y);case"default":return D0($.innerType,Y);case"prefault":return D0($.innerType,Y);case"custom":return!1;case"transform":return!0;case"pipe":return D0($.in,Y)||D0($.out,Y);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${$.type}`)}var e6={};P8(e6,{time:()=>IX,duration:()=>RX,datetime:()=>SX,date:()=>PX,ZodISOTime:()=>p$,ZodISODuration:()=>i$,ZodISODateTime:()=>m$,ZodISODate:()=>c$});var m$=U("ZodISODateTime",(Q,X)=>{T$.init(Q,X),J0.init(Q,X)});function SX(Q){return g$(m$,Q)}var c$=U("ZodISODate",(Q,X)=>{Z$.init(Q,X),J0.init(Q,X)});function PX(Q){return y$(c$,Q)}var p$=U("ZodISOTime",(Q,X)=>{v$.init(Q,X),J0.init(Q,X)});function IX(Q){return h$(p$,Q)}var i$=U("ZodISODuration",(Q,X)=>{k$.init(Q,X),J0.init(Q,X)});function RX(Q){return f$(i$,Q)}var n$=(Q,X)=>{o4.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>y8(Q,Y)},flatten:{value:(Y)=>g8(Q,Y)},addIssue:{value:(Y)=>Q.issues.push(Y)},addIssues:{value:(Y)=>Q.issues.push(...Y)},isEmpty:{get(){return Q.issues.length===0}}})},$b=U("ZodError",n$),Q4=U("ZodError",n$,{Parent:Error});var d$=h8(Q4),o$=u8(Q4),r$=m8(Q4),t$=c8(Q4);var z0=U("ZodType",(Q,X)=>{return a.init(Q,X),Q.def=X,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...Y)=>{return Q.clone({...X,checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]})},Q.clone=(Y,W)=>_0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>d$(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>r$(Q,Y,W),Q.parseAsync=async(Y,W)=>o$(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>t$(Q,Y,W),Q.spa=Q.safeParseAsync,Q.refine=(Y,W)=>Q.check(uA(Y,W)),Q.superRefine=(Y)=>Q.check(lA(Y)),Q.overwrite=(Y)=>Q.check(u1(Y)),Q.optional=()=>H0(Q),Q.nullable=()=>e$(Q),Q.nullish=()=>H0(e$(Q)),Q.nonoptional=(Y)=>kA(Q,Y),Q.array=()=>i(Q),Q.or=(Y)=>W0([Q,Y]),Q.and=(Y)=>B9(Q,Y),Q.transform=(Y)=>TX(Q,JJ(Y)),Q.default=(Y)=>TA(Q,Y),Q.prefault=(Y)=>vA(Q,Y),Q.catch=(Y)=>xA(Q,Y),Q.pipe=(Y)=>TX(Q,Y),Q.readonly=()=>hA(Q),Q.describe=(Y)=>{let W=Q.clone();return O1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return O1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return O1.get(Q);let W=Q.clone();return O1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),QJ=U("_ZodString",(Q,X)=>{t6.init(Q,X),z0.init(Q,X);let Y=Q._zod.bag;Q.format=Y.format??null,Q.minLength=Y.minimum??null,Q.maxLength=Y.maximum??null,Q.regex=(...W)=>Q.check(KX(...W)),Q.includes=(...W)=>Q.check(qX(...W)),Q.startsWith=(...W)=>Q.check(FX(...W)),Q.endsWith=(...W)=>Q.check(VX(...W)),Q.min=(...W)=>Q.check($6(...W)),Q.max=(...W)=>Q.check(J9(...W)),Q.length=(...W)=>Q.check(G9(...W)),Q.nonempty=(...W)=>Q.check($6(1,...W)),Q.lowercase=(W)=>Q.check(DX(W)),Q.uppercase=(W)=>Q.check(LX(W)),Q.trim=()=>Q.check(OX()),Q.normalize=(...W)=>Q.check(UX(...W)),Q.toLowerCase=()=>Q.check(NX()),Q.toUpperCase=()=>Q.check(wX())}),sz=U("ZodString",(Q,X)=>{t6.init(Q,X),QJ.init(Q,X),Q.email=(Y)=>Q.check(hQ(ez,Y)),Q.url=(Y)=>Q.check(cQ(QA,Y)),Q.jwt=(Y)=>Q.check($X(FA,Y)),Q.emoji=(Y)=>Q.check(pQ(XA,Y)),Q.guid=(Y)=>Q.check(X9(a$,Y)),Q.uuid=(Y)=>Q.check(fQ(H9,Y)),Q.uuidv4=(Y)=>Q.check(uQ(H9,Y)),Q.uuidv6=(Y)=>Q.check(lQ(H9,Y)),Q.uuidv7=(Y)=>Q.check(mQ(H9,Y)),Q.nanoid=(Y)=>Q.check(iQ(YA,Y)),Q.guid=(Y)=>Q.check(X9(a$,Y)),Q.cuid=(Y)=>Q.check(nQ(WA,Y)),Q.cuid2=(Y)=>Q.check(dQ($A,Y)),Q.ulid=(Y)=>Q.check(oQ(JA,Y)),Q.base64=(Y)=>Q.check(XX(DA,Y)),Q.base64url=(Y)=>Q.check(YX(LA,Y)),Q.xid=(Y)=>Q.check(rQ(GA,Y)),Q.ksuid=(Y)=>Q.check(tQ(HA,Y)),Q.ipv4=(Y)=>Q.check(aQ(BA,Y)),Q.ipv6=(Y)=>Q.check(sQ(zA,Y)),Q.cidrv4=(Y)=>Q.check(eQ(AA,Y)),Q.cidrv6=(Y)=>Q.check(QX(KA,Y)),Q.e164=(Y)=>Q.check(WX(qA,Y)),Q.datetime=(Y)=>Q.check(SX(Y)),Q.date=(Y)=>Q.check(PX(Y)),Q.time=(Y)=>Q.check(IX(Y)),Q.duration=(Y)=>Q.check(RX(Y))});function V(Q){return yQ(sz,Q)}var J0=U("ZodStringFormat",(Q,X)=>{X0.init(Q,X),QJ.init(Q,X)}),ez=U("ZodEmail",(Q,X)=>{s8.init(Q,X),J0.init(Q,X)});var a$=U("ZodGUID",(Q,X)=>{t8.init(Q,X),J0.init(Q,X)});var H9=U("ZodUUID",(Q,X)=>{a8.init(Q,X),J0.init(Q,X)});var QA=U("ZodURL",(Q,X)=>{e8.init(Q,X),J0.init(Q,X)});var XA=U("ZodEmoji",(Q,X)=>{QQ.init(Q,X),J0.init(Q,X)});var YA=U("ZodNanoID",(Q,X)=>{XQ.init(Q,X),J0.init(Q,X)});var WA=U("ZodCUID",(Q,X)=>{YQ.init(Q,X),J0.init(Q,X)});var $A=U("ZodCUID2",(Q,X)=>{WQ.init(Q,X),J0.init(Q,X)});var JA=U("ZodULID",(Q,X)=>{$Q.init(Q,X),J0.init(Q,X)});var GA=U("ZodXID",(Q,X)=>{JQ.init(Q,X),J0.init(Q,X)});var HA=U("ZodKSUID",(Q,X)=>{GQ.init(Q,X),J0.init(Q,X)});var BA=U("ZodIPv4",(Q,X)=>{HQ.init(Q,X),J0.init(Q,X)});var zA=U("ZodIPv6",(Q,X)=>{BQ.init(Q,X),J0.init(Q,X)});var AA=U("ZodCIDRv4",(Q,X)=>{zQ.init(Q,X),J0.init(Q,X)});var KA=U("ZodCIDRv6",(Q,X)=>{AQ.init(Q,X),J0.init(Q,X)});var DA=U("ZodBase64",(Q,X)=>{KQ.init(Q,X),J0.init(Q,X)});var LA=U("ZodBase64URL",(Q,X)=>{DQ.init(Q,X),J0.init(Q,X)});var qA=U("ZodE164",(Q,X)=>{LQ.init(Q,X),J0.init(Q,X)});var FA=U("ZodJWT",(Q,X)=>{qQ.init(Q,X),J0.init(Q,X)});var XJ=U("ZodNumber",(Q,X)=>{a4.init(Q,X),z0.init(Q,X),Q.gt=(W,$)=>Q.check(W9(W,$)),Q.gte=(W,$)=>Q.check(s6(W,$)),Q.min=(W,$)=>Q.check(s6(W,$)),Q.lt=(W,$)=>Q.check(Y9(W,$)),Q.lte=(W,$)=>Q.check(a6(W,$)),Q.max=(W,$)=>Q.check(a6(W,$)),Q.int=(W)=>Q.check(s$(W)),Q.safe=(W)=>Q.check(s$(W)),Q.positive=(W)=>Q.check(W9(0,W)),Q.nonnegative=(W)=>Q.check(s6(0,W)),Q.negative=(W)=>Q.check(Y9(0,W)),Q.nonpositive=(W)=>Q.check(a6(0,W)),Q.multipleOf=(W,$)=>Q.check($9(W,$)),Q.step=(W,$)=>Q.check($9(W,$)),Q.finite=()=>Q;let Y=Q._zod.bag;Q.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),Q.isFinite=!0,Q.format=Y.format??null});function t(Q){return JX(XJ,Q)}var VA=U("ZodNumberFormat",(Q,X)=>{FQ.init(Q,X),XJ.init(Q,X)});function s$(Q){return GX(VA,Q)}var UA=U("ZodBoolean",(Q,X)=>{VQ.init(Q,X),z0.init(Q,X)});function q0(Q){return HX(UA,Q)}var OA=U("ZodNull",(Q,X)=>{UQ.init(Q,X),z0.init(Q,X)});function YJ(Q){return BX(OA,Q)}var NA=U("ZodUnknown",(Q,X)=>{OQ.init(Q,X),z0.init(Q,X)});function G0(){return zX(NA)}var wA=U("ZodNever",(Q,X)=>{NQ.init(Q,X),z0.init(Q,X)});function MA(Q){return AX(wA,Q)}var jA=U("ZodArray",(Q,X)=>{wQ.init(Q,X),z0.init(Q,X),Q.element=X.element,Q.min=(Y,W)=>Q.check($6(Y,W)),Q.nonempty=(Y)=>Q.check($6(1,Y)),Q.max=(Y,W)=>Q.check(J9(Y,W)),Q.length=(Y,W)=>Q.check(G9(Y,W)),Q.unwrap=()=>Q.element});function i(Q,X){return u$(jA,Q,X)}var WJ=U("ZodObject",(Q,X)=>{s4.init(Q,X),z0.init(Q,X),p.defineLazy(Q,"shape",()=>X.shape),Q.keyof=()=>I0(Object.keys(Q._zod.def.shape)),Q.catchall=(Y)=>Q.clone({...Q._zod.def,catchall:Y}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:G0()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:G0()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:MA()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return p.extend(Q,Y)},Q.merge=(Y)=>p.merge(Q,Y),Q.pick=(Y)=>p.pick(Q,Y),Q.omit=(Y)=>p.omit(Q,Y),Q.partial=(...Y)=>p.partial(GJ,Q,Y[0]),Q.required=(...Y)=>p.required(HJ,Q,Y[0])});function I(Q,X){let Y={type:"object",get shape(){return p.assignProp(this,"shape",{...Q}),this.shape},...p.normalizeParams(X)};return new WJ(Y)}function b0(Q,X){return new WJ({type:"object",get shape(){return p.assignProp(this,"shape",{...Q}),this.shape},catchall:G0(),...p.normalizeParams(X)})}var $J=U("ZodUnion",(Q,X)=>{e4.init(Q,X),z0.init(Q,X),Q.options=X.options});function W0(Q,X){return new $J({type:"union",options:Q,...p.normalizeParams(X)})}var bA=U("ZodDiscriminatedUnion",(Q,X)=>{$J.init(Q,X),MQ.init(Q,X)});function ZX(Q,X,Y){return new bA({type:"union",options:X,discriminator:Q,...p.normalizeParams(Y)})}var EA=U("ZodIntersection",(Q,X)=>{jQ.init(Q,X),z0.init(Q,X)});function B9(Q,X){return new EA({type:"intersection",left:Q,right:X})}var SA=U("ZodRecord",(Q,X)=>{bQ.init(Q,X),z0.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function Y0(Q,X,Y){return new SA({type:"record",keyType:Q,valueType:X,...p.normalizeParams(Y)})}var CX=U("ZodEnum",(Q,X)=>{EQ.init(Q,X),z0.init(Q,X),Q.enum=X.entries,Q.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));Q.extract=(W,$)=>{let J={};for(let G of W)if(Y.has(G))J[G]=X.entries[G];else throw Error(`Key ${G} not found in enum`);return new CX({...X,checks:[],...p.normalizeParams($),entries:J})},Q.exclude=(W,$)=>{let J={...X.entries};for(let G of W)if(Y.has(G))delete J[G];else throw Error(`Key ${G} not found in enum`);return new CX({...X,checks:[],...p.normalizeParams($),entries:J})}});function I0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new CX({type:"enum",entries:Y,...p.normalizeParams(X)})}var PA=U("ZodLiteral",(Q,X)=>{SQ.init(Q,X),z0.init(Q,X),Q.values=new Set(X.values),Object.defineProperty(Q,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function T(Q,X){return new PA({type:"literal",values:Array.isArray(Q)?Q:[Q],...p.normalizeParams(X)})}var IA=U("ZodTransform",(Q,X)=>{PQ.init(Q,X),z0.init(Q,X),Q._zod.parse=(Y,W)=>{Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(p.issue(J,Y.value,X));else{let G=J;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=Q),G.continue??(G.continue=!0),Y.issues.push(p.issue(G))}};let $=X.transform(Y.value,Y);if($ instanceof Promise)return $.then((J)=>{return Y.value=J,Y});return Y.value=$,Y}});function JJ(Q){return new IA({type:"transform",transform:Q})}var GJ=U("ZodOptional",(Q,X)=>{IQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function H0(Q){return new GJ({type:"optional",innerType:Q})}var RA=U("ZodNullable",(Q,X)=>{RQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function e$(Q){return new RA({type:"nullable",innerType:Q})}var CA=U("ZodDefault",(Q,X)=>{CQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function TA(Q,X){return new CA({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():X}})}var ZA=U("ZodPrefault",(Q,X)=>{TQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function vA(Q,X){return new ZA({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():X}})}var HJ=U("ZodNonOptional",(Q,X)=>{ZQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function kA(Q,X){return new HJ({type:"nonoptional",innerType:Q,...p.normalizeParams(X)})}var _A=U("ZodCatch",(Q,X)=>{vQ.init(Q,X),z0.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function xA(Q,X){return new _A({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var gA=U("ZodPipe",(Q,X)=>{kQ.init(Q,X),z0.init(Q,X),Q.in=X.in,Q.out=X.out});function TX(Q,X){return new gA({type:"pipe",in:Q,out:X})}var yA=U("ZodReadonly",(Q,X)=>{_Q.init(Q,X),z0.init(Q,X)});function hA(Q){return new yA({type:"readonly",innerType:Q})}var BJ=U("ZodCustom",(Q,X)=>{xQ.init(Q,X),z0.init(Q,X)});function fA(Q){let X=new F0({check:"custom"});return X._zod.check=Q,X}function zJ(Q,X){return MX(BJ,Q??(()=>!0),X)}function uA(Q,X={}){return jX(BJ,Q,X)}function lA(Q){let X=fA((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(p.issue(W,Y.value,X._zod.def));else{let $=W;if($.fatal)$.continue=!1;$.code??($.code="custom"),$.input??($.input=Y.value),$.inst??($.inst=X),$.continue??($.continue=!X._zod.def.abort),Y.issues.push(p.issue($))}},Q(Y.value,Y)});return X}function vX(Q,X){return TX(JJ(Q),X)}k0(gQ());var kX="2025-11-25";var AJ=[kX,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],N1="io.modelcontextprotocol/related-task",A9="2.0",L0=zJ((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),KJ=W0([V(),t().int()]),DJ=V(),Ob=b0({ttl:t().optional(),pollInterval:t().optional()}),mA=I({ttl:t().optional()}),cA=I({taskId:V()}),_X=b0({progressToken:KJ.optional(),[N1]:cA.optional()}),x0=I({_meta:_X.optional()}),X4=x0.extend({task:mA.optional()}),LJ=(Q)=>X4.safeParse(Q).success,V0=I({method:V(),params:x0.loose().optional()}),h0=I({_meta:_X.optional()}),f0=I({method:V(),params:h0.loose().optional()}),U0=b0({_meta:_X.optional()}),K9=W0([V(),t().int()]),qJ=I({jsonrpc:T(A9),id:K9,...V0.shape}).strict(),xX=(Q)=>qJ.safeParse(Q).success,FJ=I({jsonrpc:T(A9),...f0.shape}).strict(),VJ=(Q)=>FJ.safeParse(Q).success,gX=I({jsonrpc:T(A9),id:K9,result:U0}).strict(),Y4=(Q)=>gX.safeParse(Q).success;var v;(function(Q){Q[Q.ConnectionClosed=-32000]="ConnectionClosed",Q[Q.RequestTimeout=-32001]="RequestTimeout",Q[Q.ParseError=-32700]="ParseError",Q[Q.InvalidRequest=-32600]="InvalidRequest",Q[Q.MethodNotFound=-32601]="MethodNotFound",Q[Q.InvalidParams=-32602]="InvalidParams",Q[Q.InternalError=-32603]="InternalError",Q[Q.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(v||(v={}));var yX=I({jsonrpc:T(A9),id:K9.optional(),error:I({code:t().int(),message:V(),data:G0().optional()})}).strict();var UJ=(Q)=>yX.safeParse(Q).success;var OJ=W0([qJ,FJ,gX,yX]),Nb=W0([gX,yX]),D9=U0.strict(),pA=h0.extend({requestId:K9.optional(),reason:V().optional()}),L9=f0.extend({method:T("notifications/cancelled"),params:pA}),iA=I({src:V(),mimeType:V().optional(),sizes:i(V()).optional(),theme:I0(["light","dark"]).optional()}),W4=I({icons:i(iA).optional()}),J6=I({name:V(),title:V().optional()}),NJ=J6.extend({...J6.shape,...W4.shape,version:V(),websiteUrl:V().optional(),description:V().optional()}),nA=B9(I({applyDefaults:q0().optional()}),Y0(V(),G0())),dA=vX((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},B9(I({form:nA.optional(),url:L0.optional()}),Y0(V(),G0()).optional())),oA=b0({list:L0.optional(),cancel:L0.optional(),requests:b0({sampling:b0({createMessage:L0.optional()}).optional(),elicitation:b0({create:L0.optional()}).optional()}).optional()}),rA=b0({list:L0.optional(),cancel:L0.optional(),requests:b0({tools:b0({call:L0.optional()}).optional()}).optional()}),tA=I({experimental:Y0(V(),L0).optional(),sampling:I({context:L0.optional(),tools:L0.optional()}).optional(),elicitation:dA.optional(),roots:I({listChanged:q0().optional()}).optional(),tasks:oA.optional(),extensions:Y0(V(),L0).optional()}),aA=x0.extend({protocolVersion:V(),capabilities:tA,clientInfo:NJ}),hX=V0.extend({method:T("initialize"),params:aA});var sA=I({experimental:Y0(V(),L0).optional(),logging:L0.optional(),completions:L0.optional(),prompts:I({listChanged:q0().optional()}).optional(),resources:I({subscribe:q0().optional(),listChanged:q0().optional()}).optional(),tools:I({listChanged:q0().optional()}).optional(),tasks:rA.optional(),extensions:Y0(V(),L0).optional()}),eA=U0.extend({protocolVersion:V(),capabilities:sA,serverInfo:NJ,instructions:V().optional()}),fX=f0.extend({method:T("notifications/initialized"),params:h0.optional()});var q9=V0.extend({method:T("ping"),params:x0.optional()}),QK=I({progress:t(),total:H0(t()),message:H0(V())}),XK=I({...h0.shape,...QK.shape,progressToken:KJ}),F9=f0.extend({method:T("notifications/progress"),params:XK}),YK=x0.extend({cursor:DJ.optional()}),$4=V0.extend({params:YK.optional()}),J4=U0.extend({nextCursor:DJ.optional()}),WK=I0(["working","input_required","completed","failed","cancelled"]),G4=I({taskId:V(),status:WK,ttl:W0([t(),YJ()]),createdAt:V(),lastUpdatedAt:V(),pollInterval:H0(t()),statusMessage:H0(V())}),G6=U0.extend({task:G4}),$K=h0.merge(G4),H4=f0.extend({method:T("notifications/tasks/status"),params:$K}),V9=V0.extend({method:T("tasks/get"),params:x0.extend({taskId:V()})}),U9=U0.merge(G4),O9=V0.extend({method:T("tasks/result"),params:x0.extend({taskId:V()})}),wb=U0.loose(),N9=$4.extend({method:T("tasks/list")}),w9=J4.extend({tasks:i(G4)}),M9=V0.extend({method:T("tasks/cancel"),params:x0.extend({taskId:V()})}),wJ=U0.merge(G4),MJ=I({uri:V(),mimeType:H0(V()),_meta:Y0(V(),G0()).optional()}),jJ=MJ.extend({text:V()}),uX=V().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),bJ=MJ.extend({blob:uX}),B4=I0(["user","assistant"]),H6=I({audience:i(B4).optional(),priority:t().min(0).max(1).optional(),lastModified:e6.datetime({offset:!0}).optional()}),EJ=I({...J6.shape,...W4.shape,uri:V(),description:H0(V()),mimeType:H0(V()),size:H0(t()),annotations:H6.optional(),_meta:H0(b0({}))}),JK=I({...J6.shape,...W4.shape,uriTemplate:V(),description:H0(V()),mimeType:H0(V()),annotations:H6.optional(),_meta:H0(b0({}))}),j9=$4.extend({method:T("resources/list")}),GK=J4.extend({resources:i(EJ)}),b9=$4.extend({method:T("resources/templates/list")}),HK=J4.extend({resourceTemplates:i(JK)}),lX=x0.extend({uri:V()}),BK=lX,E9=V0.extend({method:T("resources/read"),params:BK}),zK=U0.extend({contents:i(W0([jJ,bJ]))}),AK=f0.extend({method:T("notifications/resources/list_changed"),params:h0.optional()}),KK=lX,DK=V0.extend({method:T("resources/subscribe"),params:KK}),LK=lX,qK=V0.extend({method:T("resources/unsubscribe"),params:LK}),FK=h0.extend({uri:V()}),VK=f0.extend({method:T("notifications/resources/updated"),params:FK}),UK=I({name:V(),description:H0(V()),required:H0(q0())}),OK=I({...J6.shape,...W4.shape,description:H0(V()),arguments:H0(i(UK)),_meta:H0(b0({}))}),S9=$4.extend({method:T("prompts/list")}),NK=J4.extend({prompts:i(OK)}),wK=x0.extend({name:V(),arguments:Y0(V(),V()).optional()}),P9=V0.extend({method:T("prompts/get"),params:wK}),mX=I({type:T("text"),text:V(),annotations:H6.optional(),_meta:Y0(V(),G0()).optional()}),cX=I({type:T("image"),data:uX,mimeType:V(),annotations:H6.optional(),_meta:Y0(V(),G0()).optional()}),pX=I({type:T("audio"),data:uX,mimeType:V(),annotations:H6.optional(),_meta:Y0(V(),G0()).optional()}),MK=I({type:T("tool_use"),name:V(),id:V(),input:Y0(V(),G0()),_meta:Y0(V(),G0()).optional()}),jK=I({type:T("resource"),resource:W0([jJ,bJ]),annotations:H6.optional(),_meta:Y0(V(),G0()).optional()}),bK=EJ.extend({type:T("resource_link")}),iX=W0([mX,cX,pX,bK,jK]),EK=I({role:B4,content:iX}),SK=U0.extend({description:V().optional(),messages:i(EK)}),PK=f0.extend({method:T("notifications/prompts/list_changed"),params:h0.optional()}),IK=I({title:V().optional(),readOnlyHint:q0().optional(),destructiveHint:q0().optional(),idempotentHint:q0().optional(),openWorldHint:q0().optional()}),RK=I({taskSupport:I0(["required","optional","forbidden"]).optional()}),SJ=I({...J6.shape,...W4.shape,description:V().optional(),inputSchema:I({type:T("object"),properties:Y0(V(),L0).optional(),required:i(V()).optional()}).catchall(G0()),outputSchema:I({type:T("object"),properties:Y0(V(),L0).optional(),required:i(V()).optional()}).catchall(G0()).optional(),annotations:IK.optional(),execution:RK.optional(),_meta:Y0(V(),G0()).optional()}),I9=$4.extend({method:T("tools/list")}),CK=J4.extend({tools:i(SJ)}),R9=U0.extend({content:i(iX).default([]),structuredContent:Y0(V(),G0()).optional(),isError:q0().optional()}),Mb=R9.or(U0.extend({toolResult:G0()})),TK=X4.extend({name:V(),arguments:Y0(V(),G0()).optional()}),B6=V0.extend({method:T("tools/call"),params:TK}),ZK=f0.extend({method:T("notifications/tools/list_changed"),params:h0.optional()}),jb=I({autoRefresh:q0().default(!0),debounceMs:t().int().nonnegative().default(300)}),z4=I0(["debug","info","notice","warning","error","critical","alert","emergency"]),vK=x0.extend({level:z4}),nX=V0.extend({method:T("logging/setLevel"),params:vK}),kK=h0.extend({level:z4,logger:V().optional(),data:G0()}),_K=f0.extend({method:T("notifications/message"),params:kK}),xK=I({name:V().optional()}),gK=I({hints:i(xK).optional(),costPriority:t().min(0).max(1).optional(),speedPriority:t().min(0).max(1).optional(),intelligencePriority:t().min(0).max(1).optional()}),yK=I({mode:I0(["auto","required","none"]).optional()}),hK=I({type:T("tool_result"),toolUseId:V().describe("The unique identifier for the corresponding tool call."),content:i(iX).default([]),structuredContent:I({}).loose().optional(),isError:q0().optional(),_meta:Y0(V(),G0()).optional()}),fK=ZX("type",[mX,cX,pX]),z9=ZX("type",[mX,cX,pX,MK,hK]),uK=I({role:B4,content:W0([z9,i(z9)]),_meta:Y0(V(),G0()).optional()}),lK=X4.extend({messages:i(uK),modelPreferences:gK.optional(),systemPrompt:V().optional(),includeContext:I0(["none","thisServer","allServers"]).optional(),temperature:t().optional(),maxTokens:t().int(),stopSequences:i(V()).optional(),metadata:L0.optional(),tools:i(SJ).optional(),toolChoice:yK.optional()}),mK=V0.extend({method:T("sampling/createMessage"),params:lK}),A4=U0.extend({model:V(),stopReason:H0(I0(["endTurn","stopSequence","maxTokens"]).or(V())),role:B4,content:fK}),dX=U0.extend({model:V(),stopReason:H0(I0(["endTurn","stopSequence","maxTokens","toolUse"]).or(V())),role:B4,content:W0([z9,i(z9)])}),cK=I({type:T("boolean"),title:V().optional(),description:V().optional(),default:q0().optional()}),pK=I({type:T("string"),title:V().optional(),description:V().optional(),minLength:t().optional(),maxLength:t().optional(),format:I0(["email","uri","date","date-time"]).optional(),default:V().optional()}),iK=I({type:I0(["number","integer"]),title:V().optional(),description:V().optional(),minimum:t().optional(),maximum:t().optional(),default:t().optional()}),nK=I({type:T("string"),title:V().optional(),description:V().optional(),enum:i(V()),default:V().optional()}),dK=I({type:T("string"),title:V().optional(),description:V().optional(),oneOf:i(I({const:V(),title:V()})),default:V().optional()}),oK=I({type:T("string"),title:V().optional(),description:V().optional(),enum:i(V()),enumNames:i(V()).optional(),default:V().optional()}),rK=W0([nK,dK]),tK=I({type:T("array"),title:V().optional(),description:V().optional(),minItems:t().optional(),maxItems:t().optional(),items:I({type:T("string"),enum:i(V())}),default:i(V()).optional()}),aK=I({type:T("array"),title:V().optional(),description:V().optional(),minItems:t().optional(),maxItems:t().optional(),items:I({anyOf:i(I({const:V(),title:V()}))}),default:i(V()).optional()}),sK=W0([tK,aK]),eK=W0([oK,rK,sK]),QD=W0([eK,cK,pK,iK]),XD=X4.extend({mode:T("form").optional(),message:V(),requestedSchema:I({type:T("object"),properties:Y0(V(),QD),required:i(V()).optional()})}),YD=X4.extend({mode:T("url"),message:V(),elicitationId:V(),url:V().url()}),WD=W0([XD,YD]),$D=V0.extend({method:T("elicitation/create"),params:WD}),JD=h0.extend({elicitationId:V()}),GD=f0.extend({method:T("notifications/elicitation/complete"),params:JD}),z6=U0.extend({action:I0(["accept","decline","cancel"]),content:vX((Q)=>Q===null?void 0:Q,Y0(V(),W0([V(),t(),q0(),i(V())])).optional())}),HD=I({type:T("ref/resource"),uri:V()});var BD=I({type:T("ref/prompt"),name:V()}),zD=x0.extend({ref:W0([BD,HD]),argument:I({name:V(),value:V()}),context:I({arguments:Y0(V(),V()).optional()}).optional()}),C9=V0.extend({method:T("completion/complete"),params:zD});function PJ(Q){if(Q.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${Q.params.ref.type}`)}function IJ(Q){if(Q.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${Q.params.ref.type}`)}var AD=U0.extend({completion:b0({values:i(V()).max(100),total:H0(t().int()),hasMore:H0(q0())})}),KD=I({uri:V().startsWith("file://"),name:V().optional(),_meta:Y0(V(),G0()).optional()}),DD=V0.extend({method:T("roots/list"),params:x0.optional()}),oX=U0.extend({roots:i(KD)}),LD=f0.extend({method:T("notifications/roots/list_changed"),params:h0.optional()}),bb=W0([q9,hX,C9,nX,P9,S9,j9,b9,E9,DK,qK,B6,I9,V9,O9,N9,M9]),Eb=W0([L9,F9,fX,LD,H4]),Sb=W0([D9,A4,dX,z6,oX,U9,w9,G6]),Pb=W0([q9,mK,$D,DD,V9,O9,N9,M9]),Ib=W0([L9,F9,_K,VK,AK,ZK,PK,H4,GD]),Rb=W0([D9,eA,AD,SK,NK,GK,HK,zK,R9,CK,U9,w9,G6]);class C extends Error{constructor(Q,X,Y){super(`MCP error ${Q}: ${X}`);this.code=Q,this.data=Y,this.name="McpError"}static fromError(Q,X,Y){if(Q===v.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new RJ(W.elicitations,X)}return new C(Q,X,Y)}}class RJ extends C{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(v.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}class rX{append(Q){this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
37
- `);if(Q===-1)return null;let X=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),qD(X)}clear(){this._buffer=void 0}}function qD(Q){return OJ.parse(JSON.parse(Q))}function CJ(Q){return JSON.stringify(Q)+`
38
- `}class tX{constructor(Q=TJ.stdin,X=TJ.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new rX,this._started=!1,this._ondata=(Y)=>{this._readBuffer.append(Y),this.processReadBuffer()},this._onerror=(Y)=>{this.onerror?.(Y)}}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 Q=this._readBuffer.readMessage();if(Q===null)break;this.onmessage?.(Q)}catch(Q){this.onerror?.(Q)}}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(Q){return new Promise((X)=>{let Y=CJ(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var s={};P8(s,{void:()=>sD,util:()=>c,unknown:()=>tD,union:()=>XL,undefined:()=>dD,tuple:()=>$L,transformer:()=>qL,symbol:()=>nD,string:()=>fJ,strictObject:()=>QL,setErrorMap:()=>UD,set:()=>HL,record:()=>JL,quotelessJson:()=>FD,promise:()=>LL,preprocess:()=>UL,pipeline:()=>OL,ostring:()=>NL,optional:()=>FL,onumber:()=>wL,oboolean:()=>ML,objectUtil:()=>aX,object:()=>QY,number:()=>uJ,nullable:()=>VL,null:()=>oD,never:()=>aD,nativeEnum:()=>DL,nan:()=>cD,map:()=>GL,makeIssue:()=>K4,literal:()=>AL,lazy:()=>zL,late:()=>lD,isValid:()=>w1,isDirty:()=>Z9,isAsync:()=>K6,isAborted:()=>T9,intersection:()=>WL,instanceof:()=>mD,getParsedType:()=>$1,getErrorMap:()=>A6,function:()=>BL,enum:()=>KL,effect:()=>qL,discriminatedUnion:()=>YL,defaultErrorMap:()=>z1,datetimeRegex:()=>gJ,date:()=>iD,custom:()=>hJ,coerce:()=>jL,boolean:()=>lJ,bigint:()=>pD,array:()=>eD,any:()=>rD,addIssueToContext:()=>S,ZodVoid:()=>L4,ZodUnknown:()=>M1,ZodUnion:()=>U6,ZodUndefined:()=>F6,ZodType:()=>m,ZodTuple:()=>G1,ZodTransformer:()=>o0,ZodSymbol:()=>D4,ZodString:()=>i0,ZodSet:()=>i1,ZodSchema:()=>m,ZodRecord:()=>q4,ZodReadonly:()=>E6,ZodPromise:()=>n1,ZodPipeline:()=>U4,ZodParsedType:()=>j,ZodOptional:()=>g0,ZodObject:()=>A0,ZodNumber:()=>j1,ZodNullable:()=>K1,ZodNull:()=>V6,ZodNever:()=>J1,ZodNativeEnum:()=>M6,ZodNaN:()=>V4,ZodMap:()=>F4,ZodLiteral:()=>w6,ZodLazy:()=>N6,ZodIssueCode:()=>w,ZodIntersection:()=>O6,ZodFunction:()=>L6,ZodFirstPartyTypeKind:()=>M,ZodError:()=>R0,ZodEnum:()=>E1,ZodEffects:()=>o0,ZodDiscriminatedUnion:()=>v9,ZodDefault:()=>j6,ZodDate:()=>c1,ZodCatch:()=>b6,ZodBranded:()=>k9,ZodBoolean:()=>q6,ZodBigInt:()=>b1,ZodArray:()=>n0,ZodAny:()=>p1,Schema:()=>m,ParseStatus:()=>O0,OK:()=>w0,NEVER:()=>bL,INVALID:()=>_,EMPTY_PATH:()=>OD,DIRTY:()=>m1,BRAND:()=>uD});var c;(function(Q){Q.assertEqual=($)=>{};function X($){}Q.assertIs=X;function Y($){throw Error()}Q.assertNever=Y,Q.arrayToEnum=($)=>{let J={};for(let G of $)J[G]=G;return J},Q.getValidEnumValues=($)=>{let J=Q.objectKeys($).filter((H)=>typeof $[$[H]]!=="number"),G={};for(let H of J)G[H]=$[H];return Q.objectValues(G)},Q.objectValues=($)=>{return Q.objectKeys($).map(function(J){return $[J]})},Q.objectKeys=typeof Object.keys==="function"?($)=>Object.keys($):($)=>{let J=[];for(let G in $)if(Object.prototype.hasOwnProperty.call($,G))J.push(G);return J},Q.find=($,J)=>{for(let G of $)if(J(G))return G;return},Q.isInteger=typeof Number.isInteger==="function"?($)=>Number.isInteger($):($)=>typeof $==="number"&&Number.isFinite($)&&Math.floor($)===$;function W($,J=" | "){return $.map((G)=>typeof G==="string"?`'${G}'`:G).join(J)}Q.joinValues=W,Q.jsonStringifyReplacer=($,J)=>{if(typeof J==="bigint")return J.toString();return J}})(c||(c={}));var aX;(function(Q){Q.mergeShapes=(X,Y)=>{return{...X,...Y}}})(aX||(aX={}));var j=c.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$1=(Q)=>{switch(typeof Q){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(Q)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":if(Array.isArray(Q))return j.array;if(Q===null)return j.null;if(Q.then&&typeof Q.then==="function"&&Q.catch&&typeof Q.catch==="function")return j.promise;if(typeof Map<"u"&&Q instanceof Map)return j.map;if(typeof Set<"u"&&Q instanceof Set)return j.set;if(typeof Date<"u"&&Q instanceof Date)return j.date;return j.object;default:return j.unknown}};var w=c.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),FD=(Q)=>{return JSON.stringify(Q,null,2).replace(/"([^"]+)":/g,"$1:")};class R0 extends Error{get errors(){return this.issues}constructor(Q){super();this.issues=[],this.addIssue=(Y)=>{this.issues=[...this.issues,Y]},this.addIssues=(Y=[])=>{this.issues=[...this.issues,...Y]};let X=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,X);else this.__proto__=X;this.name="ZodError",this.issues=Q}format(Q){let X=Q||function($){return $.message},Y={_errors:[]},W=($)=>{for(let J of $.issues)if(J.code==="invalid_union")J.unionErrors.map(W);else if(J.code==="invalid_return_type")W(J.returnTypeError);else if(J.code==="invalid_arguments")W(J.argumentsError);else if(J.path.length===0)Y._errors.push(X(J));else{let G=Y,H=0;while(H<J.path.length){let B=J.path[H];if(H!==J.path.length-1)G[B]=G[B]||{_errors:[]};else G[B]=G[B]||{_errors:[]},G[B]._errors.push(X(J));G=G[B],H++}}};return W(this),Y}static assert(Q){if(!(Q instanceof R0))throw Error(`Not a ZodError: ${Q}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,c.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(Q=(X)=>X.message){let X={},Y=[];for(let W of this.issues)if(W.path.length>0){let $=W.path[0];X[$]=X[$]||[],X[$].push(Q(W))}else Y.push(Q(W));return{formErrors:Y,fieldErrors:X}}get formErrors(){return this.flatten()}}R0.create=(Q)=>{return new R0(Q)};var VD=(Q,X)=>{let Y;switch(Q.code){case w.invalid_type:if(Q.received===j.undefined)Y="Required";else Y=`Expected ${Q.expected}, received ${Q.received}`;break;case w.invalid_literal:Y=`Invalid literal value, expected ${JSON.stringify(Q.expected,c.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:Y=`Unrecognized key(s) in object: ${c.joinValues(Q.keys,", ")}`;break;case w.invalid_union:Y="Invalid input";break;case w.invalid_union_discriminator:Y=`Invalid discriminator value. Expected ${c.joinValues(Q.options)}`;break;case w.invalid_enum_value:Y=`Invalid enum value. Expected ${c.joinValues(Q.options)}, received '${Q.received}'`;break;case w.invalid_arguments:Y="Invalid function arguments";break;case w.invalid_return_type:Y="Invalid function return type";break;case w.invalid_date:Y="Invalid date";break;case w.invalid_string:if(typeof Q.validation==="object")if("includes"in Q.validation){if(Y=`Invalid input: must include "${Q.validation.includes}"`,typeof Q.validation.position==="number")Y=`${Y} at one or more positions greater than or equal to ${Q.validation.position}`}else if("startsWith"in Q.validation)Y=`Invalid input: must start with "${Q.validation.startsWith}"`;else if("endsWith"in Q.validation)Y=`Invalid input: must end with "${Q.validation.endsWith}"`;else c.assertNever(Q.validation);else if(Q.validation!=="regex")Y=`Invalid ${Q.validation}`;else Y="Invalid";break;case w.too_small:if(Q.type==="array")Y=`Array must contain ${Q.exact?"exactly":Q.inclusive?"at least":"more than"} ${Q.minimum} element(s)`;else if(Q.type==="string")Y=`String must contain ${Q.exact?"exactly":Q.inclusive?"at least":"over"} ${Q.minimum} character(s)`;else if(Q.type==="number")Y=`Number must be ${Q.exact?"exactly equal to ":Q.inclusive?"greater than or equal to ":"greater than "}${Q.minimum}`;else if(Q.type==="bigint")Y=`Number must be ${Q.exact?"exactly equal to ":Q.inclusive?"greater than or equal to ":"greater than "}${Q.minimum}`;else if(Q.type==="date")Y=`Date must be ${Q.exact?"exactly equal to ":Q.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(Q.minimum))}`;else Y="Invalid input";break;case w.too_big:if(Q.type==="array")Y=`Array must contain ${Q.exact?"exactly":Q.inclusive?"at most":"less than"} ${Q.maximum} element(s)`;else if(Q.type==="string")Y=`String must contain ${Q.exact?"exactly":Q.inclusive?"at most":"under"} ${Q.maximum} character(s)`;else if(Q.type==="number")Y=`Number must be ${Q.exact?"exactly":Q.inclusive?"less than or equal to":"less than"} ${Q.maximum}`;else if(Q.type==="bigint")Y=`BigInt must be ${Q.exact?"exactly":Q.inclusive?"less than or equal to":"less than"} ${Q.maximum}`;else if(Q.type==="date")Y=`Date must be ${Q.exact?"exactly":Q.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(Q.maximum))}`;else Y="Invalid input";break;case w.custom:Y="Invalid input";break;case w.invalid_intersection_types:Y="Intersection results could not be merged";break;case w.not_multiple_of:Y=`Number must be a multiple of ${Q.multipleOf}`;break;case w.not_finite:Y="Number must be finite";break;default:Y=X.defaultError,c.assertNever(Q)}return{message:Y}},z1=VD;var ZJ=z1;function UD(Q){ZJ=Q}function A6(){return ZJ}var K4=(Q)=>{let{data:X,path:Y,errorMaps:W,issueData:$}=Q,J=[...Y,...$.path||[]],G={...$,path:J};if($.message!==void 0)return{...$,path:J,message:$.message};let H="",B=W.filter((z)=>!!z).slice().reverse();for(let z of B)H=z(G,{data:X,defaultError:H}).message;return{...$,path:J,message:H}},OD=[];function S(Q,X){let Y=A6(),W=K4({issueData:X,data:Q.data,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,Y,Y===z1?void 0:z1].filter(($)=>!!$)});Q.common.issues.push(W)}class O0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(Q,X){let Y=[];for(let W of X){if(W.status==="aborted")return _;if(W.status==="dirty")Q.dirty();Y.push(W.value)}return{status:Q.value,value:Y}}static async mergeObjectAsync(Q,X){let Y=[];for(let W of X){let $=await W.key,J=await W.value;Y.push({key:$,value:J})}return O0.mergeObjectSync(Q,Y)}static mergeObjectSync(Q,X){let Y={};for(let W of X){let{key:$,value:J}=W;if($.status==="aborted")return _;if(J.status==="aborted")return _;if($.status==="dirty")Q.dirty();if(J.status==="dirty")Q.dirty();if($.value!=="__proto__"&&(typeof J.value<"u"||W.alwaysSet))Y[$.value]=J.value}return{status:Q.value,value:Y}}}var _=Object.freeze({status:"aborted"}),m1=(Q)=>({status:"dirty",value:Q}),w0=(Q)=>({status:"valid",value:Q}),T9=(Q)=>Q.status==="aborted",Z9=(Q)=>Q.status==="dirty",w1=(Q)=>Q.status==="valid",K6=(Q)=>typeof Promise<"u"&&Q instanceof Promise;var R;(function(Q){Q.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},Q.toString=(X)=>typeof X==="string"?X:X?.message})(R||(R={}));class d0{constructor(Q,X,Y,W){this._cachedPath=[],this.parent=Q,this.data=X,this._path=Y,this._key=W}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var vJ=(Q,X)=>{if(w1(X))return{success:!0,data:X.value};else{if(!Q.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Y=new R0(Q.common.issues);return this._error=Y,this._error}}}};function f(Q){if(!Q)return{};let{errorMap:X,invalid_type_error:Y,required_error:W,description:$}=Q;if(X&&(Y||W))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:$};return{errorMap:(G,H)=>{let{message:B}=Q;if(G.code==="invalid_enum_value")return{message:B??H.defaultError};if(typeof H.data>"u")return{message:B??W??H.defaultError};if(G.code!=="invalid_type")return{message:H.defaultError};return{message:B??Y??H.defaultError}},description:$}}class m{get description(){return this._def.description}_getType(Q){return $1(Q.data)}_getOrReturnCtx(Q,X){return X||{common:Q.parent.common,data:Q.data,parsedType:$1(Q.data),schemaErrorMap:this._def.errorMap,path:Q.path,parent:Q.parent}}_processInputParams(Q){return{status:new O0,ctx:{common:Q.parent.common,data:Q.data,parsedType:$1(Q.data),schemaErrorMap:this._def.errorMap,path:Q.path,parent:Q.parent}}}_parseSync(Q){let X=this._parse(Q);if(K6(X))throw Error("Synchronous parse encountered promise.");return X}_parseAsync(Q){let X=this._parse(Q);return Promise.resolve(X)}parse(Q,X){let Y=this.safeParse(Q,X);if(Y.success)return Y.data;throw Y.error}safeParse(Q,X){let Y={common:{issues:[],async:X?.async??!1,contextualErrorMap:X?.errorMap},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:Q,parsedType:$1(Q)},W=this._parseSync({data:Q,path:Y.path,parent:Y});return vJ(Y,W)}"~validate"(Q){let X={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:Q,parsedType:$1(Q)};if(!this["~standard"].async)try{let Y=this._parseSync({data:Q,path:[],parent:X});return w1(Y)?{value:Y.value}:{issues:X.common.issues}}catch(Y){if(Y?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;X.common={issues:[],async:!0}}return this._parseAsync({data:Q,path:[],parent:X}).then((Y)=>w1(Y)?{value:Y.value}:{issues:X.common.issues})}async parseAsync(Q,X){let Y=await this.safeParseAsync(Q,X);if(Y.success)return Y.data;throw Y.error}async safeParseAsync(Q,X){let Y={common:{issues:[],contextualErrorMap:X?.errorMap,async:!0},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:Q,parsedType:$1(Q)},W=this._parse({data:Q,path:Y.path,parent:Y}),$=await(K6(W)?W:Promise.resolve(W));return vJ(Y,$)}refine(Q,X){let Y=(W)=>{if(typeof X==="string"||typeof X>"u")return{message:X};else if(typeof X==="function")return X(W);else return X};return this._refinement((W,$)=>{let J=Q(W),G=()=>$.addIssue({code:w.custom,...Y(W)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((H)=>{if(!H)return G(),!1;else return!0});if(!J)return G(),!1;else return!0})}refinement(Q,X){return this._refinement((Y,W)=>{if(!Q(Y))return W.addIssue(typeof X==="function"?X(Y,W):X),!1;else return!0})}_refinement(Q){return new o0({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:Q}})}superRefine(Q){return this._refinement(Q)}constructor(Q){this.spa=this.safeParseAsync,this._def=Q,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(X)=>this["~validate"](X)}}optional(){return g0.create(this,this._def)}nullable(){return K1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return n0.create(this)}promise(){return n1.create(this,this._def)}or(Q){return U6.create([this,Q],this._def)}and(Q){return O6.create(this,Q,this._def)}transform(Q){return new o0({...f(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:Q}})}default(Q){let X=typeof Q==="function"?Q:()=>Q;return new j6({...f(this._def),innerType:this,defaultValue:X,typeName:M.ZodDefault})}brand(){return new k9({typeName:M.ZodBranded,type:this,...f(this._def)})}catch(Q){let X=typeof Q==="function"?Q:()=>Q;return new b6({...f(this._def),innerType:this,catchValue:X,typeName:M.ZodCatch})}describe(Q){return new this.constructor({...this._def,description:Q})}pipe(Q){return U4.create(this,Q)}readonly(){return E6.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var ND=/^c[^\s-]{8,}$/i,wD=/^[0-9a-z]+$/,MD=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jD=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,bD=/^[a-z0-9_-]{21}$/i,ED=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,SD=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,PD=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ID="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",sX,RD=/^(?:(?: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])$/,CD=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TD=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ZD=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vD=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kD=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_J="((\\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])))",_D=new RegExp(`^${_J}$`);function xJ(Q){let X="[0-5]\\d";if(Q.precision)X=`${X}\\.\\d{${Q.precision}}`;else if(Q.precision==null)X=`${X}(\\.\\d+)?`;let Y=Q.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${X})${Y}`}function xD(Q){return new RegExp(`^${xJ(Q)}$`)}function gJ(Q){let X=`${_J}T${xJ(Q)}`,Y=[];if(Y.push(Q.local?"Z?":"Z"),Q.offset)Y.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Y.join("|")})`,new RegExp(`^${X}$`)}function gD(Q,X){if((X==="v4"||!X)&&RD.test(Q))return!0;if((X==="v6"||!X)&&TD.test(Q))return!0;return!1}function yD(Q,X){if(!ED.test(Q))return!1;try{let[Y]=Q.split(".");if(!Y)return!1;let W=Y.replace(/-/g,"+").replace(/_/g,"/").padEnd(Y.length+(4-Y.length%4)%4,"="),$=JSON.parse(atob(W));if(typeof $!=="object"||$===null)return!1;if("typ"in $&&$?.typ!=="JWT")return!1;if(!$.alg)return!1;if(X&&$.alg!==X)return!1;return!0}catch{return!1}}function hD(Q,X){if((X==="v4"||!X)&&CD.test(Q))return!0;if((X==="v6"||!X)&&ZD.test(Q))return!0;return!1}class i0 extends m{_parse(Q){if(this._def.coerce)Q.data=String(Q.data);if(this._getType(Q)!==j.string){let $=this._getOrReturnCtx(Q);return S($,{code:w.invalid_type,expected:j.string,received:$.parsedType}),_}let Y=new O0,W=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(Q.data.length<$.value)W=this._getOrReturnCtx(Q,W),S(W,{code:w.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),Y.dirty()}else if($.kind==="max"){if(Q.data.length>$.value)W=this._getOrReturnCtx(Q,W),S(W,{code:w.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!1,message:$.message}),Y.dirty()}else if($.kind==="length"){let J=Q.data.length>$.value,G=Q.data.length<$.value;if(J||G){if(W=this._getOrReturnCtx(Q,W),J)S(W,{code:w.too_big,maximum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});else if(G)S(W,{code:w.too_small,minimum:$.value,type:"string",inclusive:!0,exact:!0,message:$.message});Y.dirty()}}else if($.kind==="email"){if(!PD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"email",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="emoji"){if(!sX)sX=new RegExp(ID,"u");if(!sX.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"emoji",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="uuid"){if(!jD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"uuid",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="nanoid"){if(!bD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"nanoid",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="cuid"){if(!ND.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"cuid",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="cuid2"){if(!wD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"cuid2",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="ulid"){if(!MD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"ulid",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="url")try{new URL(Q.data)}catch{W=this._getOrReturnCtx(Q,W),S(W,{validation:"url",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="regex"){if($.regex.lastIndex=0,!$.regex.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"regex",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="trim")Q.data=Q.data.trim();else if($.kind==="includes"){if(!Q.data.includes($.value,$.position))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:{includes:$.value,position:$.position},message:$.message}),Y.dirty()}else if($.kind==="toLowerCase")Q.data=Q.data.toLowerCase();else if($.kind==="toUpperCase")Q.data=Q.data.toUpperCase();else if($.kind==="startsWith"){if(!Q.data.startsWith($.value))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:{startsWith:$.value},message:$.message}),Y.dirty()}else if($.kind==="endsWith"){if(!Q.data.endsWith($.value))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:{endsWith:$.value},message:$.message}),Y.dirty()}else if($.kind==="datetime"){if(!gJ($).test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:"datetime",message:$.message}),Y.dirty()}else if($.kind==="date"){if(!_D.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:"date",message:$.message}),Y.dirty()}else if($.kind==="time"){if(!xD($).test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{code:w.invalid_string,validation:"time",message:$.message}),Y.dirty()}else if($.kind==="duration"){if(!SD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"duration",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="ip"){if(!gD(Q.data,$.version))W=this._getOrReturnCtx(Q,W),S(W,{validation:"ip",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="jwt"){if(!yD(Q.data,$.alg))W=this._getOrReturnCtx(Q,W),S(W,{validation:"jwt",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="cidr"){if(!hD(Q.data,$.version))W=this._getOrReturnCtx(Q,W),S(W,{validation:"cidr",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="base64"){if(!vD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"base64",code:w.invalid_string,message:$.message}),Y.dirty()}else if($.kind==="base64url"){if(!kD.test(Q.data))W=this._getOrReturnCtx(Q,W),S(W,{validation:"base64url",code:w.invalid_string,message:$.message}),Y.dirty()}else c.assertNever($);return{status:Y.value,value:Q.data}}_regex(Q,X,Y){return this.refinement((W)=>Q.test(W),{validation:X,code:w.invalid_string,...R.errToObj(Y)})}_addCheck(Q){return new i0({...this._def,checks:[...this._def.checks,Q]})}email(Q){return this._addCheck({kind:"email",...R.errToObj(Q)})}url(Q){return this._addCheck({kind:"url",...R.errToObj(Q)})}emoji(Q){return this._addCheck({kind:"emoji",...R.errToObj(Q)})}uuid(Q){return this._addCheck({kind:"uuid",...R.errToObj(Q)})}nanoid(Q){return this._addCheck({kind:"nanoid",...R.errToObj(Q)})}cuid(Q){return this._addCheck({kind:"cuid",...R.errToObj(Q)})}cuid2(Q){return this._addCheck({kind:"cuid2",...R.errToObj(Q)})}ulid(Q){return this._addCheck({kind:"ulid",...R.errToObj(Q)})}base64(Q){return this._addCheck({kind:"base64",...R.errToObj(Q)})}base64url(Q){return this._addCheck({kind:"base64url",...R.errToObj(Q)})}jwt(Q){return this._addCheck({kind:"jwt",...R.errToObj(Q)})}ip(Q){return this._addCheck({kind:"ip",...R.errToObj(Q)})}cidr(Q){return this._addCheck({kind:"cidr",...R.errToObj(Q)})}datetime(Q){if(typeof Q==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:Q});return this._addCheck({kind:"datetime",precision:typeof Q?.precision>"u"?null:Q?.precision,offset:Q?.offset??!1,local:Q?.local??!1,...R.errToObj(Q?.message)})}date(Q){return this._addCheck({kind:"date",message:Q})}time(Q){if(typeof Q==="string")return this._addCheck({kind:"time",precision:null,message:Q});return this._addCheck({kind:"time",precision:typeof Q?.precision>"u"?null:Q?.precision,...R.errToObj(Q?.message)})}duration(Q){return this._addCheck({kind:"duration",...R.errToObj(Q)})}regex(Q,X){return this._addCheck({kind:"regex",regex:Q,...R.errToObj(X)})}includes(Q,X){return this._addCheck({kind:"includes",value:Q,position:X?.position,...R.errToObj(X?.message)})}startsWith(Q,X){return this._addCheck({kind:"startsWith",value:Q,...R.errToObj(X)})}endsWith(Q,X){return this._addCheck({kind:"endsWith",value:Q,...R.errToObj(X)})}min(Q,X){return this._addCheck({kind:"min",value:Q,...R.errToObj(X)})}max(Q,X){return this._addCheck({kind:"max",value:Q,...R.errToObj(X)})}length(Q,X){return this._addCheck({kind:"length",value:Q,...R.errToObj(X)})}nonempty(Q){return this.min(1,R.errToObj(Q))}trim(){return new i0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new i0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new i0({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((Q)=>Q.kind==="datetime")}get isDate(){return!!this._def.checks.find((Q)=>Q.kind==="date")}get isTime(){return!!this._def.checks.find((Q)=>Q.kind==="time")}get isDuration(){return!!this._def.checks.find((Q)=>Q.kind==="duration")}get isEmail(){return!!this._def.checks.find((Q)=>Q.kind==="email")}get isURL(){return!!this._def.checks.find((Q)=>Q.kind==="url")}get isEmoji(){return!!this._def.checks.find((Q)=>Q.kind==="emoji")}get isUUID(){return!!this._def.checks.find((Q)=>Q.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((Q)=>Q.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((Q)=>Q.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((Q)=>Q.kind==="cuid2")}get isULID(){return!!this._def.checks.find((Q)=>Q.kind==="ulid")}get isIP(){return!!this._def.checks.find((Q)=>Q.kind==="ip")}get isCIDR(){return!!this._def.checks.find((Q)=>Q.kind==="cidr")}get isBase64(){return!!this._def.checks.find((Q)=>Q.kind==="base64")}get isBase64url(){return!!this._def.checks.find((Q)=>Q.kind==="base64url")}get minLength(){let Q=null;for(let X of this._def.checks)if(X.kind==="min"){if(Q===null||X.value>Q)Q=X.value}return Q}get maxLength(){let Q=null;for(let X of this._def.checks)if(X.kind==="max"){if(Q===null||X.value<Q)Q=X.value}return Q}}i0.create=(Q)=>{return new i0({checks:[],typeName:M.ZodString,coerce:Q?.coerce??!1,...f(Q)})};function fD(Q,X){let Y=(Q.toString().split(".")[1]||"").length,W=(X.toString().split(".")[1]||"").length,$=Y>W?Y:W,J=Number.parseInt(Q.toFixed($).replace(".","")),G=Number.parseInt(X.toFixed($).replace(".",""));return J%G/10**$}class j1 extends m{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(Q){if(this._def.coerce)Q.data=Number(Q.data);if(this._getType(Q)!==j.number){let $=this._getOrReturnCtx(Q);return S($,{code:w.invalid_type,expected:j.number,received:$.parsedType}),_}let Y=void 0,W=new O0;for(let $ of this._def.checks)if($.kind==="int"){if(!c.isInteger(Q.data))Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.invalid_type,expected:"integer",received:"float",message:$.message}),W.dirty()}else if($.kind==="min"){if($.inclusive?Q.data<$.value:Q.data<=$.value)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.too_small,minimum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),W.dirty()}else if($.kind==="max"){if($.inclusive?Q.data>$.value:Q.data>=$.value)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.too_big,maximum:$.value,type:"number",inclusive:$.inclusive,exact:!1,message:$.message}),W.dirty()}else if($.kind==="multipleOf"){if(fD(Q.data,$.value)!==0)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.not_multiple_of,multipleOf:$.value,message:$.message}),W.dirty()}else if($.kind==="finite"){if(!Number.isFinite(Q.data))Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.not_finite,message:$.message}),W.dirty()}else c.assertNever($);return{status:W.value,value:Q.data}}gte(Q,X){return this.setLimit("min",Q,!0,R.toString(X))}gt(Q,X){return this.setLimit("min",Q,!1,R.toString(X))}lte(Q,X){return this.setLimit("max",Q,!0,R.toString(X))}lt(Q,X){return this.setLimit("max",Q,!1,R.toString(X))}setLimit(Q,X,Y,W){return new j1({...this._def,checks:[...this._def.checks,{kind:Q,value:X,inclusive:Y,message:R.toString(W)}]})}_addCheck(Q){return new j1({...this._def,checks:[...this._def.checks,Q]})}int(Q){return this._addCheck({kind:"int",message:R.toString(Q)})}positive(Q){return this._addCheck({kind:"min",value:0,inclusive:!1,message:R.toString(Q)})}negative(Q){return this._addCheck({kind:"max",value:0,inclusive:!1,message:R.toString(Q)})}nonpositive(Q){return this._addCheck({kind:"max",value:0,inclusive:!0,message:R.toString(Q)})}nonnegative(Q){return this._addCheck({kind:"min",value:0,inclusive:!0,message:R.toString(Q)})}multipleOf(Q,X){return this._addCheck({kind:"multipleOf",value:Q,message:R.toString(X)})}finite(Q){return this._addCheck({kind:"finite",message:R.toString(Q)})}safe(Q){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:R.toString(Q)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:R.toString(Q)})}get minValue(){let Q=null;for(let X of this._def.checks)if(X.kind==="min"){if(Q===null||X.value>Q)Q=X.value}return Q}get maxValue(){let Q=null;for(let X of this._def.checks)if(X.kind==="max"){if(Q===null||X.value<Q)Q=X.value}return Q}get isInt(){return!!this._def.checks.find((Q)=>Q.kind==="int"||Q.kind==="multipleOf"&&c.isInteger(Q.value))}get isFinite(){let Q=null,X=null;for(let Y of this._def.checks)if(Y.kind==="finite"||Y.kind==="int"||Y.kind==="multipleOf")return!0;else if(Y.kind==="min"){if(X===null||Y.value>X)X=Y.value}else if(Y.kind==="max"){if(Q===null||Y.value<Q)Q=Y.value}return Number.isFinite(X)&&Number.isFinite(Q)}}j1.create=(Q)=>{return new j1({checks:[],typeName:M.ZodNumber,coerce:Q?.coerce||!1,...f(Q)})};class b1 extends m{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(Q){if(this._def.coerce)try{Q.data=BigInt(Q.data)}catch{return this._getInvalidInput(Q)}if(this._getType(Q)!==j.bigint)return this._getInvalidInput(Q);let Y=void 0,W=new O0;for(let $ of this._def.checks)if($.kind==="min"){if($.inclusive?Q.data<$.value:Q.data<=$.value)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.too_small,type:"bigint",minimum:$.value,inclusive:$.inclusive,message:$.message}),W.dirty()}else if($.kind==="max"){if($.inclusive?Q.data>$.value:Q.data>=$.value)Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.too_big,type:"bigint",maximum:$.value,inclusive:$.inclusive,message:$.message}),W.dirty()}else if($.kind==="multipleOf"){if(Q.data%$.value!==BigInt(0))Y=this._getOrReturnCtx(Q,Y),S(Y,{code:w.not_multiple_of,multipleOf:$.value,message:$.message}),W.dirty()}else c.assertNever($);return{status:W.value,value:Q.data}}_getInvalidInput(Q){let X=this._getOrReturnCtx(Q);return S(X,{code:w.invalid_type,expected:j.bigint,received:X.parsedType}),_}gte(Q,X){return this.setLimit("min",Q,!0,R.toString(X))}gt(Q,X){return this.setLimit("min",Q,!1,R.toString(X))}lte(Q,X){return this.setLimit("max",Q,!0,R.toString(X))}lt(Q,X){return this.setLimit("max",Q,!1,R.toString(X))}setLimit(Q,X,Y,W){return new b1({...this._def,checks:[...this._def.checks,{kind:Q,value:X,inclusive:Y,message:R.toString(W)}]})}_addCheck(Q){return new b1({...this._def,checks:[...this._def.checks,Q]})}positive(Q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:R.toString(Q)})}negative(Q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:R.toString(Q)})}nonpositive(Q){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:R.toString(Q)})}nonnegative(Q){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:R.toString(Q)})}multipleOf(Q,X){return this._addCheck({kind:"multipleOf",value:Q,message:R.toString(X)})}get minValue(){let Q=null;for(let X of this._def.checks)if(X.kind==="min"){if(Q===null||X.value>Q)Q=X.value}return Q}get maxValue(){let Q=null;for(let X of this._def.checks)if(X.kind==="max"){if(Q===null||X.value<Q)Q=X.value}return Q}}b1.create=(Q)=>{return new b1({checks:[],typeName:M.ZodBigInt,coerce:Q?.coerce??!1,...f(Q)})};class q6 extends m{_parse(Q){if(this._def.coerce)Q.data=Boolean(Q.data);if(this._getType(Q)!==j.boolean){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.boolean,received:Y.parsedType}),_}return w0(Q.data)}}q6.create=(Q)=>{return new q6({typeName:M.ZodBoolean,coerce:Q?.coerce||!1,...f(Q)})};class c1 extends m{_parse(Q){if(this._def.coerce)Q.data=new Date(Q.data);if(this._getType(Q)!==j.date){let $=this._getOrReturnCtx(Q);return S($,{code:w.invalid_type,expected:j.date,received:$.parsedType}),_}if(Number.isNaN(Q.data.getTime())){let $=this._getOrReturnCtx(Q);return S($,{code:w.invalid_date}),_}let Y=new O0,W=void 0;for(let $ of this._def.checks)if($.kind==="min"){if(Q.data.getTime()<$.value)W=this._getOrReturnCtx(Q,W),S(W,{code:w.too_small,message:$.message,inclusive:!0,exact:!1,minimum:$.value,type:"date"}),Y.dirty()}else if($.kind==="max"){if(Q.data.getTime()>$.value)W=this._getOrReturnCtx(Q,W),S(W,{code:w.too_big,message:$.message,inclusive:!0,exact:!1,maximum:$.value,type:"date"}),Y.dirty()}else c.assertNever($);return{status:Y.value,value:new Date(Q.data.getTime())}}_addCheck(Q){return new c1({...this._def,checks:[...this._def.checks,Q]})}min(Q,X){return this._addCheck({kind:"min",value:Q.getTime(),message:R.toString(X)})}max(Q,X){return this._addCheck({kind:"max",value:Q.getTime(),message:R.toString(X)})}get minDate(){let Q=null;for(let X of this._def.checks)if(X.kind==="min"){if(Q===null||X.value>Q)Q=X.value}return Q!=null?new Date(Q):null}get maxDate(){let Q=null;for(let X of this._def.checks)if(X.kind==="max"){if(Q===null||X.value<Q)Q=X.value}return Q!=null?new Date(Q):null}}c1.create=(Q)=>{return new c1({checks:[],coerce:Q?.coerce||!1,typeName:M.ZodDate,...f(Q)})};class D4 extends m{_parse(Q){if(this._getType(Q)!==j.symbol){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.symbol,received:Y.parsedType}),_}return w0(Q.data)}}D4.create=(Q)=>{return new D4({typeName:M.ZodSymbol,...f(Q)})};class F6 extends m{_parse(Q){if(this._getType(Q)!==j.undefined){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.undefined,received:Y.parsedType}),_}return w0(Q.data)}}F6.create=(Q)=>{return new F6({typeName:M.ZodUndefined,...f(Q)})};class V6 extends m{_parse(Q){if(this._getType(Q)!==j.null){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.null,received:Y.parsedType}),_}return w0(Q.data)}}V6.create=(Q)=>{return new V6({typeName:M.ZodNull,...f(Q)})};class p1 extends m{constructor(){super(...arguments);this._any=!0}_parse(Q){return w0(Q.data)}}p1.create=(Q)=>{return new p1({typeName:M.ZodAny,...f(Q)})};class M1 extends m{constructor(){super(...arguments);this._unknown=!0}_parse(Q){return w0(Q.data)}}M1.create=(Q)=>{return new M1({typeName:M.ZodUnknown,...f(Q)})};class J1 extends m{_parse(Q){let X=this._getOrReturnCtx(Q);return S(X,{code:w.invalid_type,expected:j.never,received:X.parsedType}),_}}J1.create=(Q)=>{return new J1({typeName:M.ZodNever,...f(Q)})};class L4 extends m{_parse(Q){if(this._getType(Q)!==j.undefined){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.void,received:Y.parsedType}),_}return w0(Q.data)}}L4.create=(Q)=>{return new L4({typeName:M.ZodVoid,...f(Q)})};class n0 extends m{_parse(Q){let{ctx:X,status:Y}=this._processInputParams(Q),W=this._def;if(X.parsedType!==j.array)return S(X,{code:w.invalid_type,expected:j.array,received:X.parsedType}),_;if(W.exactLength!==null){let J=X.data.length>W.exactLength.value,G=X.data.length<W.exactLength.value;if(J||G)S(X,{code:J?w.too_big:w.too_small,minimum:G?W.exactLength.value:void 0,maximum:J?W.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:W.exactLength.message}),Y.dirty()}if(W.minLength!==null){if(X.data.length<W.minLength.value)S(X,{code:w.too_small,minimum:W.minLength.value,type:"array",inclusive:!0,exact:!1,message:W.minLength.message}),Y.dirty()}if(W.maxLength!==null){if(X.data.length>W.maxLength.value)S(X,{code:w.too_big,maximum:W.maxLength.value,type:"array",inclusive:!0,exact:!1,message:W.maxLength.message}),Y.dirty()}if(X.common.async)return Promise.all([...X.data].map((J,G)=>{return W.type._parseAsync(new d0(X,J,X.path,G))})).then((J)=>{return O0.mergeArray(Y,J)});let $=[...X.data].map((J,G)=>{return W.type._parseSync(new d0(X,J,X.path,G))});return O0.mergeArray(Y,$)}get element(){return this._def.type}min(Q,X){return new n0({...this._def,minLength:{value:Q,message:R.toString(X)}})}max(Q,X){return new n0({...this._def,maxLength:{value:Q,message:R.toString(X)}})}length(Q,X){return new n0({...this._def,exactLength:{value:Q,message:R.toString(X)}})}nonempty(Q){return this.min(1,Q)}}n0.create=(Q,X)=>{return new n0({type:Q,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...f(X)})};function D6(Q){if(Q instanceof A0){let X={};for(let Y in Q.shape){let W=Q.shape[Y];X[Y]=g0.create(D6(W))}return new A0({...Q._def,shape:()=>X})}else if(Q instanceof n0)return new n0({...Q._def,type:D6(Q.element)});else if(Q instanceof g0)return g0.create(D6(Q.unwrap()));else if(Q instanceof K1)return K1.create(D6(Q.unwrap()));else if(Q instanceof G1)return G1.create(Q.items.map((X)=>D6(X)));else return Q}class A0 extends m{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let Q=this._def.shape(),X=c.objectKeys(Q);return this._cached={shape:Q,keys:X},this._cached}_parse(Q){if(this._getType(Q)!==j.object){let B=this._getOrReturnCtx(Q);return S(B,{code:w.invalid_type,expected:j.object,received:B.parsedType}),_}let{status:Y,ctx:W}=this._processInputParams(Q),{shape:$,keys:J}=this._getCached(),G=[];if(!(this._def.catchall instanceof J1&&this._def.unknownKeys==="strip")){for(let B in W.data)if(!J.includes(B))G.push(B)}let H=[];for(let B of J){let z=$[B],A=W.data[B];H.push({key:{status:"valid",value:B},value:z._parse(new d0(W,A,W.path,B)),alwaysSet:B in W.data})}if(this._def.catchall instanceof J1){let B=this._def.unknownKeys;if(B==="passthrough")for(let z of G)H.push({key:{status:"valid",value:z},value:{status:"valid",value:W.data[z]}});else if(B==="strict"){if(G.length>0)S(W,{code:w.unrecognized_keys,keys:G}),Y.dirty()}else if(B==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let z of G){let A=W.data[z];H.push({key:{status:"valid",value:z},value:B._parse(new d0(W,A,W.path,z)),alwaysSet:z in W.data})}}if(W.common.async)return Promise.resolve().then(async()=>{let B=[];for(let z of H){let A=await z.key,D=await z.value;B.push({key:A,value:D,alwaysSet:z.alwaysSet})}return B}).then((B)=>{return O0.mergeObjectSync(Y,B)});else return O0.mergeObjectSync(Y,H)}get shape(){return this._def.shape()}strict(Q){return R.errToObj,new A0({...this._def,unknownKeys:"strict",...Q!==void 0?{errorMap:(X,Y)=>{let W=this._def.errorMap?.(X,Y).message??Y.defaultError;if(X.code==="unrecognized_keys")return{message:R.errToObj(Q).message??W};return{message:W}}}:{}})}strip(){return new A0({...this._def,unknownKeys:"strip"})}passthrough(){return new A0({...this._def,unknownKeys:"passthrough"})}extend(Q){return new A0({...this._def,shape:()=>({...this._def.shape(),...Q})})}merge(Q){return new A0({unknownKeys:Q._def.unknownKeys,catchall:Q._def.catchall,shape:()=>({...this._def.shape(),...Q._def.shape()}),typeName:M.ZodObject})}setKey(Q,X){return this.augment({[Q]:X})}catchall(Q){return new A0({...this._def,catchall:Q})}pick(Q){let X={};for(let Y of c.objectKeys(Q))if(Q[Y]&&this.shape[Y])X[Y]=this.shape[Y];return new A0({...this._def,shape:()=>X})}omit(Q){let X={};for(let Y of c.objectKeys(this.shape))if(!Q[Y])X[Y]=this.shape[Y];return new A0({...this._def,shape:()=>X})}deepPartial(){return D6(this)}partial(Q){let X={};for(let Y of c.objectKeys(this.shape)){let W=this.shape[Y];if(Q&&!Q[Y])X[Y]=W;else X[Y]=W.optional()}return new A0({...this._def,shape:()=>X})}required(Q){let X={};for(let Y of c.objectKeys(this.shape))if(Q&&!Q[Y])X[Y]=this.shape[Y];else{let $=this.shape[Y];while($ instanceof g0)$=$._def.innerType;X[Y]=$}return new A0({...this._def,shape:()=>X})}keyof(){return yJ(c.objectKeys(this.shape))}}A0.create=(Q,X)=>{return new A0({shape:()=>Q,unknownKeys:"strip",catchall:J1.create(),typeName:M.ZodObject,...f(X)})};A0.strictCreate=(Q,X)=>{return new A0({shape:()=>Q,unknownKeys:"strict",catchall:J1.create(),typeName:M.ZodObject,...f(X)})};A0.lazycreate=(Q,X)=>{return new A0({shape:Q,unknownKeys:"strip",catchall:J1.create(),typeName:M.ZodObject,...f(X)})};class U6 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q),Y=this._def.options;function W($){for(let G of $)if(G.result.status==="valid")return G.result;for(let G of $)if(G.result.status==="dirty")return X.common.issues.push(...G.ctx.common.issues),G.result;let J=$.map((G)=>new R0(G.ctx.common.issues));return S(X,{code:w.invalid_union,unionErrors:J}),_}if(X.common.async)return Promise.all(Y.map(async($)=>{let J={...X,common:{...X.common,issues:[]},parent:null};return{result:await $._parseAsync({data:X.data,path:X.path,parent:J}),ctx:J}})).then(W);else{let $=void 0,J=[];for(let H of Y){let B={...X,common:{...X.common,issues:[]},parent:null},z=H._parseSync({data:X.data,path:X.path,parent:B});if(z.status==="valid")return z;else if(z.status==="dirty"&&!$)$={result:z,ctx:B};if(B.common.issues.length)J.push(B.common.issues)}if($)return X.common.issues.push(...$.ctx.common.issues),$.result;let G=J.map((H)=>new R0(H));return S(X,{code:w.invalid_union,unionErrors:G}),_}}get options(){return this._def.options}}U6.create=(Q,X)=>{return new U6({options:Q,typeName:M.ZodUnion,...f(X)})};var A1=(Q)=>{if(Q instanceof N6)return A1(Q.schema);else if(Q instanceof o0)return A1(Q.innerType());else if(Q instanceof w6)return[Q.value];else if(Q instanceof E1)return Q.options;else if(Q instanceof M6)return c.objectValues(Q.enum);else if(Q instanceof j6)return A1(Q._def.innerType);else if(Q instanceof F6)return[void 0];else if(Q instanceof V6)return[null];else if(Q instanceof g0)return[void 0,...A1(Q.unwrap())];else if(Q instanceof K1)return[null,...A1(Q.unwrap())];else if(Q instanceof k9)return A1(Q.unwrap());else if(Q instanceof E6)return A1(Q.unwrap());else if(Q instanceof b6)return A1(Q._def.innerType);else return[]};class v9 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q);if(X.parsedType!==j.object)return S(X,{code:w.invalid_type,expected:j.object,received:X.parsedType}),_;let Y=this.discriminator,W=X.data[Y],$=this.optionsMap.get(W);if(!$)return S(X,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Y]}),_;if(X.common.async)return $._parseAsync({data:X.data,path:X.path,parent:X});else return $._parseSync({data:X.data,path:X.path,parent:X})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(Q,X,Y){let W=new Map;for(let $ of X){let J=A1($.shape[Q]);if(!J.length)throw Error(`A discriminator value for key \`${Q}\` could not be extracted from all schema options`);for(let G of J){if(W.has(G))throw Error(`Discriminator property ${String(Q)} has duplicate value ${String(G)}`);W.set(G,$)}}return new v9({typeName:M.ZodDiscriminatedUnion,discriminator:Q,options:X,optionsMap:W,...f(Y)})}}function eX(Q,X){let Y=$1(Q),W=$1(X);if(Q===X)return{valid:!0,data:Q};else if(Y===j.object&&W===j.object){let $=c.objectKeys(X),J=c.objectKeys(Q).filter((H)=>$.indexOf(H)!==-1),G={...Q,...X};for(let H of J){let B=eX(Q[H],X[H]);if(!B.valid)return{valid:!1};G[H]=B.data}return{valid:!0,data:G}}else if(Y===j.array&&W===j.array){if(Q.length!==X.length)return{valid:!1};let $=[];for(let J=0;J<Q.length;J++){let G=Q[J],H=X[J],B=eX(G,H);if(!B.valid)return{valid:!1};$.push(B.data)}return{valid:!0,data:$}}else if(Y===j.date&&W===j.date&&+Q===+X)return{valid:!0,data:Q};else return{valid:!1}}class O6 extends m{_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q),W=($,J)=>{if(T9($)||T9(J))return _;let G=eX($.value,J.value);if(!G.valid)return S(Y,{code:w.invalid_intersection_types}),_;if(Z9($)||Z9(J))X.dirty();return{status:X.value,value:G.data}};if(Y.common.async)return Promise.all([this._def.left._parseAsync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseAsync({data:Y.data,path:Y.path,parent:Y})]).then(([$,J])=>W($,J));else return W(this._def.left._parseSync({data:Y.data,path:Y.path,parent:Y}),this._def.right._parseSync({data:Y.data,path:Y.path,parent:Y}))}}O6.create=(Q,X,Y)=>{return new O6({left:Q,right:X,typeName:M.ZodIntersection,...f(Y)})};class G1 extends m{_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.parsedType!==j.array)return S(Y,{code:w.invalid_type,expected:j.array,received:Y.parsedType}),_;if(Y.data.length<this._def.items.length)return S(Y,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;if(!this._def.rest&&Y.data.length>this._def.items.length)S(Y,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let $=[...Y.data].map((J,G)=>{let H=this._def.items[G]||this._def.rest;if(!H)return null;return H._parse(new d0(Y,J,Y.path,G))}).filter((J)=>!!J);if(Y.common.async)return Promise.all($).then((J)=>{return O0.mergeArray(X,J)});else return O0.mergeArray(X,$)}get items(){return this._def.items}rest(Q){return new G1({...this._def,rest:Q})}}G1.create=(Q,X)=>{if(!Array.isArray(Q))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new G1({items:Q,typeName:M.ZodTuple,rest:null,...f(X)})};class q4 extends m{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.parsedType!==j.object)return S(Y,{code:w.invalid_type,expected:j.object,received:Y.parsedType}),_;let W=[],$=this._def.keyType,J=this._def.valueType;for(let G in Y.data)W.push({key:$._parse(new d0(Y,G,Y.path,G)),value:J._parse(new d0(Y,Y.data[G],Y.path,G)),alwaysSet:G in Y.data});if(Y.common.async)return O0.mergeObjectAsync(X,W);else return O0.mergeObjectSync(X,W)}get element(){return this._def.valueType}static create(Q,X,Y){if(X instanceof m)return new q4({keyType:Q,valueType:X,typeName:M.ZodRecord,...f(Y)});return new q4({keyType:i0.create(),valueType:Q,typeName:M.ZodRecord,...f(X)})}}class F4 extends m{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.parsedType!==j.map)return S(Y,{code:w.invalid_type,expected:j.map,received:Y.parsedType}),_;let W=this._def.keyType,$=this._def.valueType,J=[...Y.data.entries()].map(([G,H],B)=>{return{key:W._parse(new d0(Y,G,Y.path,[B,"key"])),value:$._parse(new d0(Y,H,Y.path,[B,"value"]))}});if(Y.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let H of J){let B=await H.key,z=await H.value;if(B.status==="aborted"||z.status==="aborted")return _;if(B.status==="dirty"||z.status==="dirty")X.dirty();G.set(B.value,z.value)}return{status:X.value,value:G}})}else{let G=new Map;for(let H of J){let{key:B,value:z}=H;if(B.status==="aborted"||z.status==="aborted")return _;if(B.status==="dirty"||z.status==="dirty")X.dirty();G.set(B.value,z.value)}return{status:X.value,value:G}}}}F4.create=(Q,X,Y)=>{return new F4({valueType:X,keyType:Q,typeName:M.ZodMap,...f(Y)})};class i1 extends m{_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.parsedType!==j.set)return S(Y,{code:w.invalid_type,expected:j.set,received:Y.parsedType}),_;let W=this._def;if(W.minSize!==null){if(Y.data.size<W.minSize.value)S(Y,{code:w.too_small,minimum:W.minSize.value,type:"set",inclusive:!0,exact:!1,message:W.minSize.message}),X.dirty()}if(W.maxSize!==null){if(Y.data.size>W.maxSize.value)S(Y,{code:w.too_big,maximum:W.maxSize.value,type:"set",inclusive:!0,exact:!1,message:W.maxSize.message}),X.dirty()}let $=this._def.valueType;function J(H){let B=new Set;for(let z of H){if(z.status==="aborted")return _;if(z.status==="dirty")X.dirty();B.add(z.value)}return{status:X.value,value:B}}let G=[...Y.data.values()].map((H,B)=>$._parse(new d0(Y,H,Y.path,B)));if(Y.common.async)return Promise.all(G).then((H)=>J(H));else return J(G)}min(Q,X){return new i1({...this._def,minSize:{value:Q,message:R.toString(X)}})}max(Q,X){return new i1({...this._def,maxSize:{value:Q,message:R.toString(X)}})}size(Q,X){return this.min(Q,X).max(Q,X)}nonempty(Q){return this.min(1,Q)}}i1.create=(Q,X)=>{return new i1({valueType:Q,minSize:null,maxSize:null,typeName:M.ZodSet,...f(X)})};class L6 extends m{constructor(){super(...arguments);this.validate=this.implement}_parse(Q){let{ctx:X}=this._processInputParams(Q);if(X.parsedType!==j.function)return S(X,{code:w.invalid_type,expected:j.function,received:X.parsedType}),_;function Y(G,H){return K4({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,A6(),z1].filter((B)=>!!B),issueData:{code:w.invalid_arguments,argumentsError:H}})}function W(G,H){return K4({data:G,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,A6(),z1].filter((B)=>!!B),issueData:{code:w.invalid_return_type,returnTypeError:H}})}let $={errorMap:X.common.contextualErrorMap},J=X.data;if(this._def.returns instanceof n1){let G=this;return w0(async function(...H){let B=new R0([]),z=await G._def.args.parseAsync(H,$).catch((L)=>{throw B.addIssue(Y(H,L)),B}),A=await Reflect.apply(J,this,z);return await G._def.returns._def.type.parseAsync(A,$).catch((L)=>{throw B.addIssue(W(A,L)),B})})}else{let G=this;return w0(function(...H){let B=G._def.args.safeParse(H,$);if(!B.success)throw new R0([Y(H,B.error)]);let z=Reflect.apply(J,this,B.data),A=G._def.returns.safeParse(z,$);if(!A.success)throw new R0([W(z,A.error)]);return A.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...Q){return new L6({...this._def,args:G1.create(Q).rest(M1.create())})}returns(Q){return new L6({...this._def,returns:Q})}implement(Q){return this.parse(Q)}strictImplement(Q){return this.parse(Q)}static create(Q,X,Y){return new L6({args:Q?Q:G1.create([]).rest(M1.create()),returns:X||M1.create(),typeName:M.ZodFunction,...f(Y)})}}class N6 extends m{get schema(){return this._def.getter()}_parse(Q){let{ctx:X}=this._processInputParams(Q);return this._def.getter()._parse({data:X.data,path:X.path,parent:X})}}N6.create=(Q,X)=>{return new N6({getter:Q,typeName:M.ZodLazy,...f(X)})};class w6 extends m{_parse(Q){if(Q.data!==this._def.value){let X=this._getOrReturnCtx(Q);return S(X,{received:X.data,code:w.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:Q.data}}get value(){return this._def.value}}w6.create=(Q,X)=>{return new w6({value:Q,typeName:M.ZodLiteral,...f(X)})};function yJ(Q,X){return new E1({values:Q,typeName:M.ZodEnum,...f(X)})}class E1 extends m{_parse(Q){if(typeof Q.data!=="string"){let X=this._getOrReturnCtx(Q),Y=this._def.values;return S(X,{expected:c.joinValues(Y),received:X.parsedType,code:w.invalid_type}),_}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(Q.data)){let X=this._getOrReturnCtx(Q),Y=this._def.values;return S(X,{received:X.data,code:w.invalid_enum_value,options:Y}),_}return w0(Q.data)}get options(){return this._def.values}get enum(){let Q={};for(let X of this._def.values)Q[X]=X;return Q}get Values(){let Q={};for(let X of this._def.values)Q[X]=X;return Q}get Enum(){let Q={};for(let X of this._def.values)Q[X]=X;return Q}extract(Q,X=this._def){return E1.create(Q,{...this._def,...X})}exclude(Q,X=this._def){return E1.create(this.options.filter((Y)=>!Q.includes(Y)),{...this._def,...X})}}E1.create=yJ;class M6 extends m{_parse(Q){let X=c.getValidEnumValues(this._def.values),Y=this._getOrReturnCtx(Q);if(Y.parsedType!==j.string&&Y.parsedType!==j.number){let W=c.objectValues(X);return S(Y,{expected:c.joinValues(W),received:Y.parsedType,code:w.invalid_type}),_}if(!this._cache)this._cache=new Set(c.getValidEnumValues(this._def.values));if(!this._cache.has(Q.data)){let W=c.objectValues(X);return S(Y,{received:Y.data,code:w.invalid_enum_value,options:W}),_}return w0(Q.data)}get enum(){return this._def.values}}M6.create=(Q,X)=>{return new M6({values:Q,typeName:M.ZodNativeEnum,...f(X)})};class n1 extends m{unwrap(){return this._def.type}_parse(Q){let{ctx:X}=this._processInputParams(Q);if(X.parsedType!==j.promise&&X.common.async===!1)return S(X,{code:w.invalid_type,expected:j.promise,received:X.parsedType}),_;let Y=X.parsedType===j.promise?X.data:Promise.resolve(X.data);return w0(Y.then((W)=>{return this._def.type.parseAsync(W,{path:X.path,errorMap:X.common.contextualErrorMap})}))}}n1.create=(Q,X)=>{return new n1({type:Q,typeName:M.ZodPromise,...f(X)})};class o0 extends m{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q),W=this._def.effect||null,$={addIssue:(J)=>{if(S(Y,J),J.fatal)X.abort();else X.dirty()},get path(){return Y.path}};if($.addIssue=$.addIssue.bind($),W.type==="preprocess"){let J=W.transform(Y.data,$);if(Y.common.async)return Promise.resolve(J).then(async(G)=>{if(X.value==="aborted")return _;let H=await this._def.schema._parseAsync({data:G,path:Y.path,parent:Y});if(H.status==="aborted")return _;if(H.status==="dirty")return m1(H.value);if(X.value==="dirty")return m1(H.value);return H});else{if(X.value==="aborted")return _;let G=this._def.schema._parseSync({data:J,path:Y.path,parent:Y});if(G.status==="aborted")return _;if(G.status==="dirty")return m1(G.value);if(X.value==="dirty")return m1(G.value);return G}}if(W.type==="refinement"){let J=(G)=>{let H=W.refinement(G,$);if(Y.common.async)return Promise.resolve(H);if(H instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(Y.common.async===!1){let G=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(G.status==="aborted")return _;if(G.status==="dirty")X.dirty();return J(G.value),{status:X.value,value:G.value}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((G)=>{if(G.status==="aborted")return _;if(G.status==="dirty")X.dirty();return J(G.value).then(()=>{return{status:X.value,value:G.value}})})}if(W.type==="transform")if(Y.common.async===!1){let J=this._def.schema._parseSync({data:Y.data,path:Y.path,parent:Y});if(!w1(J))return _;let G=W.transform(J.value,$);if(G instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:G}}else return this._def.schema._parseAsync({data:Y.data,path:Y.path,parent:Y}).then((J)=>{if(!w1(J))return _;return Promise.resolve(W.transform(J.value,$)).then((G)=>({status:X.value,value:G}))});c.assertNever(W)}}o0.create=(Q,X,Y)=>{return new o0({schema:Q,typeName:M.ZodEffects,effect:X,...f(Y)})};o0.createWithPreprocess=(Q,X,Y)=>{return new o0({schema:X,effect:{type:"preprocess",transform:Q},typeName:M.ZodEffects,...f(Y)})};class g0 extends m{_parse(Q){if(this._getType(Q)===j.undefined)return w0(void 0);return this._def.innerType._parse(Q)}unwrap(){return this._def.innerType}}g0.create=(Q,X)=>{return new g0({innerType:Q,typeName:M.ZodOptional,...f(X)})};class K1 extends m{_parse(Q){if(this._getType(Q)===j.null)return w0(null);return this._def.innerType._parse(Q)}unwrap(){return this._def.innerType}}K1.create=(Q,X)=>{return new K1({innerType:Q,typeName:M.ZodNullable,...f(X)})};class j6 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q),Y=X.data;if(X.parsedType===j.undefined)Y=this._def.defaultValue();return this._def.innerType._parse({data:Y,path:X.path,parent:X})}removeDefault(){return this._def.innerType}}j6.create=(Q,X)=>{return new j6({innerType:Q,typeName:M.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...f(X)})};class b6 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q),Y={...X,common:{...X.common,issues:[]}},W=this._def.innerType._parse({data:Y.data,path:Y.path,parent:{...Y}});if(K6(W))return W.then(($)=>{return{status:"valid",value:$.status==="valid"?$.value:this._def.catchValue({get error(){return new R0(Y.common.issues)},input:Y.data})}});else return{status:"valid",value:W.status==="valid"?W.value:this._def.catchValue({get error(){return new R0(Y.common.issues)},input:Y.data})}}removeCatch(){return this._def.innerType}}b6.create=(Q,X)=>{return new b6({innerType:Q,typeName:M.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...f(X)})};class V4 extends m{_parse(Q){if(this._getType(Q)!==j.nan){let Y=this._getOrReturnCtx(Q);return S(Y,{code:w.invalid_type,expected:j.nan,received:Y.parsedType}),_}return{status:"valid",value:Q.data}}}V4.create=(Q)=>{return new V4({typeName:M.ZodNaN,...f(Q)})};var uD=Symbol("zod_brand");class k9 extends m{_parse(Q){let{ctx:X}=this._processInputParams(Q),Y=X.data;return this._def.type._parse({data:Y,path:X.path,parent:X})}unwrap(){return this._def.type}}class U4 extends m{_parse(Q){let{status:X,ctx:Y}=this._processInputParams(Q);if(Y.common.async)return(async()=>{let $=await this._def.in._parseAsync({data:Y.data,path:Y.path,parent:Y});if($.status==="aborted")return _;if($.status==="dirty")return X.dirty(),m1($.value);else return this._def.out._parseAsync({data:$.value,path:Y.path,parent:Y})})();else{let W=this._def.in._parseSync({data:Y.data,path:Y.path,parent:Y});if(W.status==="aborted")return _;if(W.status==="dirty")return X.dirty(),{status:"dirty",value:W.value};else return this._def.out._parseSync({data:W.value,path:Y.path,parent:Y})}}static create(Q,X){return new U4({in:Q,out:X,typeName:M.ZodPipeline})}}class E6 extends m{_parse(Q){let X=this._def.innerType._parse(Q),Y=(W)=>{if(w1(W))W.value=Object.freeze(W.value);return W};return K6(X)?X.then((W)=>Y(W)):Y(X)}unwrap(){return this._def.innerType}}E6.create=(Q,X)=>{return new E6({innerType:Q,typeName:M.ZodReadonly,...f(X)})};function kJ(Q,X){let Y=typeof Q==="function"?Q(X):typeof Q==="string"?{message:Q}:Q;return typeof Y==="string"?{message:Y}:Y}function hJ(Q,X={},Y){if(Q)return p1.create().superRefine((W,$)=>{let J=Q(W);if(J instanceof Promise)return J.then((G)=>{if(!G){let H=kJ(X,W),B=H.fatal??Y??!0;$.addIssue({code:"custom",...H,fatal:B})}});if(!J){let G=kJ(X,W),H=G.fatal??Y??!0;$.addIssue({code:"custom",...G,fatal:H})}return});return p1.create()}var lD={object:A0.lazycreate},M;(function(Q){Q.ZodString="ZodString",Q.ZodNumber="ZodNumber",Q.ZodNaN="ZodNaN",Q.ZodBigInt="ZodBigInt",Q.ZodBoolean="ZodBoolean",Q.ZodDate="ZodDate",Q.ZodSymbol="ZodSymbol",Q.ZodUndefined="ZodUndefined",Q.ZodNull="ZodNull",Q.ZodAny="ZodAny",Q.ZodUnknown="ZodUnknown",Q.ZodNever="ZodNever",Q.ZodVoid="ZodVoid",Q.ZodArray="ZodArray",Q.ZodObject="ZodObject",Q.ZodUnion="ZodUnion",Q.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Q.ZodIntersection="ZodIntersection",Q.ZodTuple="ZodTuple",Q.ZodRecord="ZodRecord",Q.ZodMap="ZodMap",Q.ZodSet="ZodSet",Q.ZodFunction="ZodFunction",Q.ZodLazy="ZodLazy",Q.ZodLiteral="ZodLiteral",Q.ZodEnum="ZodEnum",Q.ZodEffects="ZodEffects",Q.ZodNativeEnum="ZodNativeEnum",Q.ZodOptional="ZodOptional",Q.ZodNullable="ZodNullable",Q.ZodDefault="ZodDefault",Q.ZodCatch="ZodCatch",Q.ZodPromise="ZodPromise",Q.ZodBranded="ZodBranded",Q.ZodPipeline="ZodPipeline",Q.ZodReadonly="ZodReadonly"})(M||(M={}));var mD=(Q,X={message:`Input not instance of ${Q.name}`})=>hJ((Y)=>Y instanceof Q,X),fJ=i0.create,uJ=j1.create,cD=V4.create,pD=b1.create,lJ=q6.create,iD=c1.create,nD=D4.create,dD=F6.create,oD=V6.create,rD=p1.create,tD=M1.create,aD=J1.create,sD=L4.create,eD=n0.create,QY=A0.create,QL=A0.strictCreate,XL=U6.create,YL=v9.create,WL=O6.create,$L=G1.create,JL=q4.create,GL=F4.create,HL=i1.create,BL=L6.create,zL=N6.create,AL=w6.create,KL=E1.create,DL=M6.create,LL=n1.create,qL=o0.create,FL=g0.create,VL=K1.create,UL=o0.createWithPreprocess,OL=U4.create,NL=()=>fJ().optional(),wL=()=>uJ().optional(),ML=()=>lJ().optional(),jL={string:(Q)=>i0.create({...Q,coerce:!0}),number:(Q)=>j1.create({...Q,coerce:!0}),boolean:(Q)=>q6.create({...Q,coerce:!0}),bigint:(Q)=>b1.create({...Q,coerce:!0}),date:(Q)=>c1.create({...Q,coerce:!0})};var bL=_;var SL=U("ZodMiniType",(Q,X)=>{if(!Q._zod)throw Error("Uninitialized schema in ZodMiniType.");a.init(Q,X),Q.def=X,Q.parse=(Y,W)=>f8(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>h1(Q,Y,W),Q.parseAsync=async(Y,W)=>l8(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>f1(Q,Y,W),Q.check=(...Y)=>{return Q.clone({...X,checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]})},Q.clone=(Y,W)=>_0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q}});var PL=U("ZodMiniObject",(Q,X)=>{s4.init(Q,X),SL.init(Q,X),p.defineLazy(Q,"shape",()=>X.shape)});function XY(Q,X){let Y={type:"object",get shape(){return p.assignProp(this,"shape",{...Q}),this.shape},...p.normalizeParams(X)};return new PL(Y)}function u0(Q){return!!Q._zod}function d1(Q){let X=Object.values(Q);if(X.length===0)return XY({});let Y=X.every(u0),W=X.every(($)=>!u0($));if(Y)return XY(Q);if(W)return QY(Q);throw Error("Mixed Zod versions detected in object shape.")}function S1(Q,X){if(u0(Q))return h1(Q,X);return Q.safeParse(X)}async function _9(Q,X){if(u0(Q))return await f1(Q,X);return await Q.safeParseAsync(X)}function P1(Q){if(!Q)return;let X;if(u0(Q))X=Q._zod?.def?.shape;else X=Q.shape;if(!X)return;if(typeof X==="function")try{return X()}catch{return}return X}function S6(Q){if(!Q)return;if(typeof Q==="object"){let X=Q,Y=Q;if(!X._def&&!Y._zod){let W=Object.values(Q);if(W.length>0&&W.every(($)=>typeof $==="object"&&$!==null&&($._def!==void 0||$._zod!==void 0||typeof $.parse==="function")))return d1(Q)}}if(u0(Q)){let Y=Q._zod?.def;if(Y&&(Y.type==="object"||Y.shape!==void 0))return Q}else if(Q.shape!==void 0)return Q;return}function x9(Q){if(Q&&typeof Q==="object"){if("message"in Q&&typeof Q.message==="string")return Q.message;if("issues"in Q&&Array.isArray(Q.issues)&&Q.issues.length>0){let X=Q.issues[0];if(X&&typeof X==="object"&&"message"in X)return String(X.message)}try{return JSON.stringify(Q)}catch{return String(Q)}}return String(Q)}function mJ(Q){return Q.description}function cJ(Q){if(u0(Q))return Q._zod?.def?.type==="optional";let X=Q;if(typeof Q.isOptional==="function")return Q.isOptional();return X._def?.typeName==="ZodOptional"}function g9(Q){if(u0(Q)){let J=Q._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let Y=Q._def;if(Y){if(Y.value!==void 0)return Y.value;if(Array.isArray(Y.values)&&Y.values.length>0)return Y.values[0]}let W=Q.value;if(W!==void 0)return W;return}function I1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var iJ=Symbol("Let zodToJsonSchema decide on which parser to use");var pJ={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},nJ=(Q)=>typeof Q==="string"?{...pJ,name:Q}:{...pJ,...Q};var dJ=(Q)=>{let X=nJ(Q),Y=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,flags:{hasReferencedOpenAiAnyType:!1},currentPath:Y,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([W,$])=>[$._def,{def:$._def,path:[...X.basePath,X.definitionPath,W],jsonSchema:void 0}]))}};function YY(Q,X,Y,W){if(!W?.errorMessages)return;if(Y)Q.errorMessage={...Q.errorMessage,[X]:Y}}function n(Q,X,Y,W,$){Q[X]=Y,YY(Q,X,W,$)}var y9=(Q,X)=>{let Y=0;for(;Y<Q.length&&Y<X.length;Y++)if(Q[Y]!==X[Y])break;return[(Q.length-Y).toString(),...X.slice(Y)].join("/")};function B0(Q){if(Q.target!=="openAi")return{};let X=[...Q.basePath,Q.definitionPath,Q.openAiAnyTypeName];return Q.flags.hasReferencedOpenAiAnyType=!0,{$ref:Q.$refStrategy==="relative"?y9(X,Q.currentPath):X.join("/")}}function oJ(Q,X){let Y={type:"array"};if(Q.type?._def&&Q.type?._def?.typeName!==M.ZodAny)Y.items=g(Q.type._def,{...X,currentPath:[...X.currentPath,"items"]});if(Q.minLength)n(Y,"minItems",Q.minLength.value,Q.minLength.message,X);if(Q.maxLength)n(Y,"maxItems",Q.maxLength.value,Q.maxLength.message,X);if(Q.exactLength)n(Y,"minItems",Q.exactLength.value,Q.exactLength.message,X),n(Y,"maxItems",Q.exactLength.value,Q.exactLength.message,X);return Y}function rJ(Q,X){let Y={type:"integer",format:"int64"};if(!Q.checks)return Y;for(let W of Q.checks)switch(W.kind){case"min":if(X.target==="jsonSchema7")if(W.inclusive)n(Y,"minimum",W.value,W.message,X);else n(Y,"exclusiveMinimum",W.value,W.message,X);else{if(!W.inclusive)Y.exclusiveMinimum=!0;n(Y,"minimum",W.value,W.message,X)}break;case"max":if(X.target==="jsonSchema7")if(W.inclusive)n(Y,"maximum",W.value,W.message,X);else n(Y,"exclusiveMaximum",W.value,W.message,X);else{if(!W.inclusive)Y.exclusiveMaximum=!0;n(Y,"maximum",W.value,W.message,X)}break;case"multipleOf":n(Y,"multipleOf",W.value,W.message,X);break}return Y}function tJ(){return{type:"boolean"}}function h9(Q,X){return g(Q.type._def,X)}var aJ=(Q,X)=>{return g(Q.innerType._def,X)};function WY(Q,X,Y){let W=Y??X.dateStrategy;if(Array.isArray(W))return{anyOf:W.map(($,J)=>WY(Q,X,$))};switch(W){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return RL(Q,X)}}var RL=(Q,X)=>{let Y={type:"integer",format:"unix-time"};if(X.target==="openApi3")return Y;for(let W of Q.checks)switch(W.kind){case"min":n(Y,"minimum",W.value,W.message,X);break;case"max":n(Y,"maximum",W.value,W.message,X);break}return Y};function sJ(Q,X){return{...g(Q.innerType._def,X),default:Q.defaultValue()}}function eJ(Q,X){return X.effectStrategy==="input"?g(Q.schema._def,X):B0(X)}function Q7(Q){return{type:"string",enum:Array.from(Q.values)}}var CL=(Q)=>{if("type"in Q&&Q.type==="string")return!1;return"allOf"in Q};function X7(Q,X){let Y=[g(Q.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),g(Q.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((J)=>!!J),W=X.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,$=[];return Y.forEach((J)=>{if(CL(J)){if($.push(...J.allOf),J.unevaluatedProperties===void 0)W=void 0}else{let G=J;if("additionalProperties"in J&&J.additionalProperties===!1){let{additionalProperties:H,...B}=J;G=B}else W=void 0;$.push(G)}}),$.length?{allOf:$,...W}:void 0}function Y7(Q,X){let Y=typeof Q.value;if(Y!=="bigint"&&Y!=="number"&&Y!=="boolean"&&Y!=="string")return{type:Array.isArray(Q.value)?"array":"object"};if(X.target==="openApi3")return{type:Y==="bigint"?"integer":Y,enum:[Q.value]};return{type:Y==="bigint"?"integer":Y,const:Q.value}}var $Y=void 0,r0={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if($Y===void 0)$Y=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return $Y},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function f9(Q,X){let Y={type:"string"};if(Q.checks)for(let W of Q.checks)switch(W.kind){case"min":n(Y,"minLength",typeof Y.minLength==="number"?Math.max(Y.minLength,W.value):W.value,W.message,X);break;case"max":n(Y,"maxLength",typeof Y.maxLength==="number"?Math.min(Y.maxLength,W.value):W.value,W.message,X);break;case"email":switch(X.emailStrategy){case"format:email":t0(Y,"email",W.message,X);break;case"format:idn-email":t0(Y,"idn-email",W.message,X);break;case"pattern:zod":E0(Y,r0.email,W.message,X);break}break;case"url":t0(Y,"uri",W.message,X);break;case"uuid":t0(Y,"uuid",W.message,X);break;case"regex":E0(Y,W.regex,W.message,X);break;case"cuid":E0(Y,r0.cuid,W.message,X);break;case"cuid2":E0(Y,r0.cuid2,W.message,X);break;case"startsWith":E0(Y,RegExp(`^${JY(W.value,X)}`),W.message,X);break;case"endsWith":E0(Y,RegExp(`${JY(W.value,X)}$`),W.message,X);break;case"datetime":t0(Y,"date-time",W.message,X);break;case"date":t0(Y,"date",W.message,X);break;case"time":t0(Y,"time",W.message,X);break;case"duration":t0(Y,"duration",W.message,X);break;case"length":n(Y,"minLength",typeof Y.minLength==="number"?Math.max(Y.minLength,W.value):W.value,W.message,X),n(Y,"maxLength",typeof Y.maxLength==="number"?Math.min(Y.maxLength,W.value):W.value,W.message,X);break;case"includes":{E0(Y,RegExp(JY(W.value,X)),W.message,X);break}case"ip":{if(W.version!=="v6")t0(Y,"ipv4",W.message,X);if(W.version!=="v4")t0(Y,"ipv6",W.message,X);break}case"base64url":E0(Y,r0.base64url,W.message,X);break;case"jwt":E0(Y,r0.jwt,W.message,X);break;case"cidr":{if(W.version!=="v6")E0(Y,r0.ipv4Cidr,W.message,X);if(W.version!=="v4")E0(Y,r0.ipv6Cidr,W.message,X);break}case"emoji":E0(Y,r0.emoji(),W.message,X);break;case"ulid":{E0(Y,r0.ulid,W.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{t0(Y,"binary",W.message,X);break}case"contentEncoding:base64":{n(Y,"contentEncoding","base64",W.message,X);break}case"pattern:zod":{E0(Y,r0.base64,W.message,X);break}}break}case"nanoid":E0(Y,r0.nanoid,W.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:(($)=>{})(W)}return Y}function JY(Q,X){return X.patternStrategy==="escape"?ZL(Q):Q}var TL=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ZL(Q){let X="";for(let Y=0;Y<Q.length;Y++){if(!TL.has(Q[Y]))X+="\\";X+=Q[Y]}return X}function t0(Q,X,Y,W){if(Q.format||Q.anyOf?.some(($)=>$.format)){if(!Q.anyOf)Q.anyOf=[];if(Q.format){if(Q.anyOf.push({format:Q.format,...Q.errorMessage&&W.errorMessages&&{errorMessage:{format:Q.errorMessage.format}}}),delete Q.format,Q.errorMessage){if(delete Q.errorMessage.format,Object.keys(Q.errorMessage).length===0)delete Q.errorMessage}}Q.anyOf.push({format:X,...Y&&W.errorMessages&&{errorMessage:{format:Y}}})}else n(Q,"format",X,Y,W)}function E0(Q,X,Y,W){if(Q.pattern||Q.allOf?.some(($)=>$.pattern)){if(!Q.allOf)Q.allOf=[];if(Q.pattern){if(Q.allOf.push({pattern:Q.pattern,...Q.errorMessage&&W.errorMessages&&{errorMessage:{pattern:Q.errorMessage.pattern}}}),delete Q.pattern,Q.errorMessage){if(delete Q.errorMessage.pattern,Object.keys(Q.errorMessage).length===0)delete Q.errorMessage}}Q.allOf.push({pattern:W7(X,W),...Y&&W.errorMessages&&{errorMessage:{pattern:Y}}})}else n(Q,"pattern",W7(X,W),Y,W)}function W7(Q,X){if(!X.applyRegexFlags||!Q.flags)return Q.source;let Y={i:Q.flags.includes("i"),m:Q.flags.includes("m"),s:Q.flags.includes("s")},W=Y.i?Q.source.toLowerCase():Q.source,$="",J=!1,G=!1,H=!1;for(let B=0;B<W.length;B++){if(J){$+=W[B],J=!1;continue}if(Y.i){if(G){if(W[B].match(/[a-z]/)){if(H)$+=W[B],$+=`${W[B-2]}-${W[B]}`.toUpperCase(),H=!1;else if(W[B+1]==="-"&&W[B+2]?.match(/[a-z]/))$+=W[B],H=!0;else $+=`${W[B]}${W[B].toUpperCase()}`;continue}}else if(W[B].match(/[a-z]/)){$+=`[${W[B]}${W[B].toUpperCase()}]`;continue}}if(Y.m){if(W[B]==="^"){$+=`(^|(?<=[\r
39
- ]))`;continue}else if(W[B]==="$"){$+=`($|(?=[\r
40
- ]))`;continue}}if(Y.s&&W[B]==="."){$+=G?`${W[B]}\r
41
- `:`[${W[B]}\r
42
- ]`;continue}if($+=W[B],W[B]==="\\")J=!0;else if(G&&W[B]==="]")G=!1;else if(!G&&W[B]==="[")G=!0}try{new RegExp($)}catch{return console.warn(`Could not convert regex pattern at ${X.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),Q.source}return $}function u9(Q,X){if(X.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(X.target==="openApi3"&&Q.keyType?._def.typeName===M.ZodEnum)return{type:"object",required:Q.keyType._def.values,properties:Q.keyType._def.values.reduce((W,$)=>({...W,[$]:g(Q.valueType._def,{...X,currentPath:[...X.currentPath,"properties",$]})??B0(X)}),{}),additionalProperties:X.rejectedAdditionalProperties};let Y={type:"object",additionalProperties:g(Q.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]})??X.allowedAdditionalProperties};if(X.target==="openApi3")return Y;if(Q.keyType?._def.typeName===M.ZodString&&Q.keyType._def.checks?.length){let{type:W,...$}=f9(Q.keyType._def,X);return{...Y,propertyNames:$}}else if(Q.keyType?._def.typeName===M.ZodEnum)return{...Y,propertyNames:{enum:Q.keyType._def.values}};else if(Q.keyType?._def.typeName===M.ZodBranded&&Q.keyType._def.type._def.typeName===M.ZodString&&Q.keyType._def.type._def.checks?.length){let{type:W,...$}=h9(Q.keyType._def,X);return{...Y,propertyNames:$}}return Y}function $7(Q,X){if(X.mapStrategy==="record")return u9(Q,X);let Y=g(Q.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||B0(X),W=g(Q.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||B0(X);return{type:"array",maxItems:125,items:{type:"array",items:[Y,W],minItems:2,maxItems:2}}}function J7(Q){let X=Q.values,W=Object.keys(Q.values).filter((J)=>{return typeof X[X[J]]!=="number"}).map((J)=>X[J]),$=Array.from(new Set(W.map((J)=>typeof J)));return{type:$.length===1?$[0]==="string"?"string":"number":["string","number"],enum:W}}function G7(Q){return Q.target==="openAi"?void 0:{not:B0({...Q,currentPath:[...Q.currentPath,"not"]})}}function H7(Q){return Q.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var O4={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function z7(Q,X){if(X.target==="openApi3")return B7(Q,X);let Y=Q.options instanceof Map?Array.from(Q.options.values()):Q.options;if(Y.every((W)=>(W._def.typeName in O4)&&(!W._def.checks||!W._def.checks.length))){let W=Y.reduce(($,J)=>{let G=O4[J._def.typeName];return G&&!$.includes(G)?[...$,G]:$},[]);return{type:W.length>1?W:W[0]}}else if(Y.every((W)=>W._def.typeName==="ZodLiteral"&&!W.description)){let W=Y.reduce(($,J)=>{let G=typeof J._def.value;switch(G){case"string":case"number":case"boolean":return[...$,G];case"bigint":return[...$,"integer"];case"object":if(J._def.value===null)return[...$,"null"];case"symbol":case"undefined":case"function":default:return $}},[]);if(W.length===Y.length){let $=W.filter((J,G,H)=>H.indexOf(J)===G);return{type:$.length>1?$:$[0],enum:Y.reduce((J,G)=>{return J.includes(G._def.value)?J:[...J,G._def.value]},[])}}}else if(Y.every((W)=>W._def.typeName==="ZodEnum"))return{type:"string",enum:Y.reduce((W,$)=>[...W,...$._def.values.filter((J)=>!W.includes(J))],[])};return B7(Q,X)}var B7=(Q,X)=>{let Y=(Q.options instanceof Map?Array.from(Q.options.values()):Q.options).map((W,$)=>g(W._def,{...X,currentPath:[...X.currentPath,"anyOf",`${$}`]})).filter((W)=>!!W&&(!X.strictUnions||typeof W==="object"&&Object.keys(W).length>0));return Y.length?{anyOf:Y}:void 0};function A7(Q,X){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(Q.innerType._def.typeName)&&(!Q.innerType._def.checks||!Q.innerType._def.checks.length)){if(X.target==="openApi3")return{type:O4[Q.innerType._def.typeName],nullable:!0};return{type:[O4[Q.innerType._def.typeName],"null"]}}if(X.target==="openApi3"){let W=g(Q.innerType._def,{...X,currentPath:[...X.currentPath]});if(W&&"$ref"in W)return{allOf:[W],nullable:!0};return W&&{...W,nullable:!0}}let Y=g(Q.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return Y&&{anyOf:[Y,{type:"null"}]}}function K7(Q,X){let Y={type:"number"};if(!Q.checks)return Y;for(let W of Q.checks)switch(W.kind){case"int":Y.type="integer",YY(Y,"type",W.message,X);break;case"min":if(X.target==="jsonSchema7")if(W.inclusive)n(Y,"minimum",W.value,W.message,X);else n(Y,"exclusiveMinimum",W.value,W.message,X);else{if(!W.inclusive)Y.exclusiveMinimum=!0;n(Y,"minimum",W.value,W.message,X)}break;case"max":if(X.target==="jsonSchema7")if(W.inclusive)n(Y,"maximum",W.value,W.message,X);else n(Y,"exclusiveMaximum",W.value,W.message,X);else{if(!W.inclusive)Y.exclusiveMaximum=!0;n(Y,"maximum",W.value,W.message,X)}break;case"multipleOf":n(Y,"multipleOf",W.value,W.message,X);break}return Y}function D7(Q,X){let Y=X.target==="openAi",W={type:"object",properties:{}},$=[],J=Q.shape();for(let H in J){let B=J[H];if(B===void 0||B._def===void 0)continue;let z=kL(B);if(z&&Y){if(B._def.typeName==="ZodOptional")B=B._def.innerType;if(!B.isNullable())B=B.nullable();z=!1}let A=g(B._def,{...X,currentPath:[...X.currentPath,"properties",H],propertyPath:[...X.currentPath,"properties",H]});if(A===void 0)continue;if(W.properties[H]=A,!z)$.push(H)}if($.length)W.required=$;let G=vL(Q,X);if(G!==void 0)W.additionalProperties=G;return W}function vL(Q,X){if(Q.catchall._def.typeName!=="ZodNever")return g(Q.catchall._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]});switch(Q.unknownKeys){case"passthrough":return X.allowedAdditionalProperties;case"strict":return X.rejectedAdditionalProperties;case"strip":return X.removeAdditionalStrategy==="strict"?X.allowedAdditionalProperties:X.rejectedAdditionalProperties}}function kL(Q){try{return Q.isOptional()}catch{return!0}}var L7=(Q,X)=>{if(X.currentPath.toString()===X.propertyPath?.toString())return g(Q.innerType._def,X);let Y=g(Q.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return Y?{anyOf:[{not:B0(X)},Y]}:B0(X)};var q7=(Q,X)=>{if(X.pipeStrategy==="input")return g(Q.in._def,X);else if(X.pipeStrategy==="output")return g(Q.out._def,X);let Y=g(Q.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),W=g(Q.out._def,{...X,currentPath:[...X.currentPath,"allOf",Y?"1":"0"]});return{allOf:[Y,W].filter(($)=>$!==void 0)}};function F7(Q,X){return g(Q.type._def,X)}function V7(Q,X){let W={type:"array",uniqueItems:!0,items:g(Q.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if(Q.minSize)n(W,"minItems",Q.minSize.value,Q.minSize.message,X);if(Q.maxSize)n(W,"maxItems",Q.maxSize.value,Q.maxSize.message,X);return W}function U7(Q,X){if(Q.rest)return{type:"array",minItems:Q.items.length,items:Q.items.map((Y,W)=>g(Y._def,{...X,currentPath:[...X.currentPath,"items",`${W}`]})).reduce((Y,W)=>W===void 0?Y:[...Y,W],[]),additionalItems:g(Q.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:Q.items.length,maxItems:Q.items.length,items:Q.items.map((Y,W)=>g(Y._def,{...X,currentPath:[...X.currentPath,"items",`${W}`]})).reduce((Y,W)=>W===void 0?Y:[...Y,W],[])}}function O7(Q){return{not:B0(Q)}}function N7(Q){return B0(Q)}var w7=(Q,X)=>{return g(Q.innerType._def,X)};var M7=(Q,X,Y)=>{switch(X){case M.ZodString:return f9(Q,Y);case M.ZodNumber:return K7(Q,Y);case M.ZodObject:return D7(Q,Y);case M.ZodBigInt:return rJ(Q,Y);case M.ZodBoolean:return tJ();case M.ZodDate:return WY(Q,Y);case M.ZodUndefined:return O7(Y);case M.ZodNull:return H7(Y);case M.ZodArray:return oJ(Q,Y);case M.ZodUnion:case M.ZodDiscriminatedUnion:return z7(Q,Y);case M.ZodIntersection:return X7(Q,Y);case M.ZodTuple:return U7(Q,Y);case M.ZodRecord:return u9(Q,Y);case M.ZodLiteral:return Y7(Q,Y);case M.ZodEnum:return Q7(Q);case M.ZodNativeEnum:return J7(Q);case M.ZodNullable:return A7(Q,Y);case M.ZodOptional:return L7(Q,Y);case M.ZodMap:return $7(Q,Y);case M.ZodSet:return V7(Q,Y);case M.ZodLazy:return()=>Q.getter()._def;case M.ZodPromise:return F7(Q,Y);case M.ZodNaN:case M.ZodNever:return G7(Y);case M.ZodEffects:return eJ(Q,Y);case M.ZodAny:return B0(Y);case M.ZodUnknown:return N7(Y);case M.ZodDefault:return sJ(Q,Y);case M.ZodBranded:return h9(Q,Y);case M.ZodReadonly:return w7(Q,Y);case M.ZodCatch:return aJ(Q,Y);case M.ZodPipeline:return q7(Q,Y);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return((W)=>{return})(X)}};function g(Q,X,Y=!1){let W=X.seen.get(Q);if(X.override){let H=X.override?.(Q,X,W,Y);if(H!==iJ)return H}if(W&&!Y){let H=_L(W,X);if(H!==void 0)return H}let $={def:Q,path:X.currentPath,jsonSchema:void 0};X.seen.set(Q,$);let J=M7(Q,Q.typeName,X),G=typeof J==="function"?g(J(),X):J;if(G)xL(Q,X,G);if(X.postProcess){let H=X.postProcess(G,Q,X);return $.jsonSchema=G,H}return $.jsonSchema=G,G}var _L=(Q,X)=>{switch(X.$refStrategy){case"root":return{$ref:Q.path.join("/")};case"relative":return{$ref:y9(X.currentPath,Q.path)};case"none":case"seen":{if(Q.path.length<X.currentPath.length&&Q.path.every((Y,W)=>X.currentPath[W]===Y))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),B0(X);return X.$refStrategy==="seen"?B0(X):void 0}}},xL=(Q,X,Y)=>{if(Q.description){if(Y.description=Q.description,X.markdownDescription)Y.markdownDescription=Q.description}return Y};var GY=(Q,X)=>{let Y=dJ(X),W=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((B,[z,A])=>({...B,[z]:g(A._def,{...Y,currentPath:[...Y.basePath,Y.definitionPath,z]},!0)??B0(Y)}),{}):void 0,$=typeof X==="string"?X:X?.nameStrategy==="title"?void 0:X?.name,J=g(Q._def,$===void 0?Y:{...Y,currentPath:[...Y.basePath,Y.definitionPath,$]},!1)??B0(Y),G=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(G!==void 0)J.title=G;if(Y.flags.hasReferencedOpenAiAnyType){if(!W)W={};if(!W[Y.openAiAnyTypeName])W[Y.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:Y.$refStrategy==="relative"?"1":[...Y.basePath,Y.definitionPath,Y.openAiAnyTypeName].join("/")}}}let H=$===void 0?W?{...J,[Y.definitionPath]:W}:J:{$ref:[...Y.$refStrategy==="relative"?[]:Y.basePath,Y.definitionPath,$].join("/"),[Y.definitionPath]:{...W,[$]:J}};if(Y.target==="jsonSchema7")H.$schema="http://json-schema.org/draft-07/schema#";else if(Y.target==="jsonSchema2019-09"||Y.target==="openAi")H.$schema="https://json-schema.org/draft/2019-09/schema#";if(Y.target==="openAi"&&(("anyOf"in H)||("oneOf"in H)||("allOf"in H)||("type"in H)&&Array.isArray(H.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return H};function gL(Q){if(!Q)return"draft-7";if(Q==="jsonSchema7"||Q==="draft-7")return"draft-7";if(Q==="jsonSchema2019-09"||Q==="draft-2020-12")return"draft-2020-12";return"draft-7"}function HY(Q,X){if(u0(Q))return EX(Q,{target:gL(X?.target),io:X?.pipeStrategy??"input"});return GY(Q,{strictUnions:X?.strictUnions??!0,pipeStrategy:X?.pipeStrategy??"input"})}function BY(Q){let Y=P1(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=g9(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function zY(Q,X){let Y=S1(Q,X);if(!Y.success)throw Y.error;return Y.data}var yL=60000;class AY{constructor(Q){if(this._options=Q,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(L9,(X)=>{this._oncancel(X)}),this.setNotificationHandler(F9,(X)=>{this._onprogress(X)}),this.setRequestHandler(q9,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(V9,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(v.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(O9,async(X,Y)=>{let W=async()=>{let $=X.params.taskId;if(this._taskMessageQueue){let G;while(G=await this._taskMessageQueue.dequeue($,Y.sessionId)){if(G.type==="response"||G.type==="error"){let H=G.message,B=H.id,z=this._requestResolvers.get(B);if(z)if(this._requestResolvers.delete(B),G.type==="response")z(H);else{let A=H,D=new C(A.error.code,A.error.message,A.error.data);z(D)}else{let A=G.type==="response"?"Response":"Error";this._onerror(Error(`${A} handler missing for request ${B}`))}continue}await this._transport?.send(G.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask($,Y.sessionId);if(!J)throw new C(v.InvalidParams,`Task not found: ${$}`);if(!I1(J.status))return await this._waitForTaskUpdate($,Y.signal),await W();if(I1(J.status)){let G=await this._taskStore.getTaskResult($,Y.sessionId);return this._clearTaskQueue($),{...G,_meta:{...G._meta,[N1]:{taskId:$}}}}return await W()};return await W()}),this.setRequestHandler(N9,async(X,Y)=>{try{let{tasks:W,nextCursor:$}=await this._taskStore.listTasks(X.params?.cursor,Y.sessionId);return{tasks:W,nextCursor:$,_meta:{}}}catch(W){throw new C(v.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(M9,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(v.InvalidParams,`Task not found: ${X.params.taskId}`);if(I1(W.status))throw new C(v.InvalidParams,`Cannot cancel task in terminal status: ${W.status}`);await this._taskStore.updateTaskStatus(X.params.taskId,"cancelled","Client cancelled task execution.",Y.sessionId),this._clearTaskQueue(X.params.taskId);let $=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!$)throw new C(v.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...$}}catch(W){if(W instanceof C)throw W;throw new C(v.InvalidRequest,`Failed to cancel task: ${W instanceof Error?W.message:String(W)}`)}})}async _oncancel(Q){if(!Q.params.requestId)return;this._requestHandlerAbortControllers.get(Q.params.requestId)?.abort(Q.params.reason)}_setupTimeout(Q,X,Y,W,$=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(W,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Y,resetTimeoutOnProgress:$,onTimeout:W})}_resetTimeout(Q){let X=this._timeoutInfo.get(Q);if(!X)return!1;let Y=Date.now()-X.startTime;if(X.maxTotalTimeout&&Y>=X.maxTotalTimeout)throw this._timeoutInfo.delete(Q),C.fromError(v.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:Y});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout(Q){let X=this._timeoutInfo.get(Q);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete(Q)}async connect(Q){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=Q;let X=this.transport?.onclose;this._transport.onclose=()=>{X?.(),this._onclose()};let Y=this.transport?.onerror;this._transport.onerror=($)=>{Y?.($),this._onerror($)};let W=this._transport?.onmessage;this._transport.onmessage=($,J)=>{if(W?.($,J),Y4($)||UJ($))this._onresponse($);else if(xX($))this._onrequest($,J);else if(VJ($))this._onnotification($);else this._onerror(Error(`Unknown message type: ${JSON.stringify($)}`))},await this._transport.start()}_onclose(){let Q=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();for(let Y of this._requestHandlerAbortControllers.values())Y.abort();this._requestHandlerAbortControllers.clear();let X=C.fromError(v.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let Y of Q.values())Y(X)}_onerror(Q){this.onerror?.(Q)}_onnotification(Q){let X=this._notificationHandlers.get(Q.method)??this.fallbackNotificationHandler;if(X===void 0)return;Promise.resolve().then(()=>X(Q)).catch((Y)=>this._onerror(Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest(Q,X){let Y=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,W=this._transport,$=Q.params?._meta?.[N1]?.taskId;if(Y===void 0){let z={jsonrpc:"2.0",id:Q.id,error:{code:v.MethodNotFound,message:"Method not found"}};if($&&this._taskMessageQueue)this._enqueueTaskMessage($,{type:"error",message:z,timestamp:Date.now()},W?.sessionId).catch((A)=>this._onerror(Error(`Failed to enqueue error response: ${A}`)));else W?.send(z).catch((A)=>this._onerror(Error(`Failed to send an error response: ${A}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let G=LJ(Q.params)?Q.params.task:void 0,H=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,B={signal:J.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(z)=>{if(J.signal.aborted)return;let A={relatedRequestId:Q.id};if($)A.relatedTask={taskId:$};await this.notification(z,A)},sendRequest:async(z,A,D)=>{if(J.signal.aborted)throw new C(v.ConnectionClosed,"Request was cancelled");let L={...D,relatedRequestId:Q.id};if($&&!L.relatedTask)L.relatedTask={taskId:$};let K=L.relatedTask?.taskId??$;if(K&&H)await H.updateTaskStatus(K,"input_required");return await this.request(z,A,L)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:$,taskStore:H,taskRequestedTtl:G?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(G)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,B)).then(async(z)=>{if(J.signal.aborted)return;let A={result:z,jsonrpc:"2.0",id:Q.id};if($&&this._taskMessageQueue)await this._enqueueTaskMessage($,{type:"response",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)},async(z)=>{if(J.signal.aborted)return;let A={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(z.code)?z.code:v.InternalError,message:z.message??"Internal error",...z.data!==void 0&&{data:z.data}}};if($&&this._taskMessageQueue)await this._enqueueTaskMessage($,{type:"error",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)}).catch((z)=>this._onerror(Error(`Failed to send response: ${z}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(Q.id)===J)this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:X,...Y}=Q.params,W=Number(X),$=this._progressHandlers.get(W);if(!$){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(Q)}`));return}let J=this._responseHandlers.get(W),G=this._timeoutInfo.get(W);if(G&&J&&G.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(H){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),J(H);return}$(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),Y4(Q))Y(Q);else{let J=new C(Q.error.code,Q.error.message,Q.error.data);Y(J)}return}let W=this._responseHandlers.get(X);if(W===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(X),this._cleanupTimeout(X);let $=!1;if(Y4(Q)&&Q.result&&typeof Q.result==="object"){let J=Q.result;if(J.task&&typeof J.task==="object"){let G=J.task;if(typeof G.taskId==="string")$=!0,this._taskProgressTokens.set(G.taskId,X)}}if(!$)this._progressHandlers.delete(X);if(Y4(Q))W(Q);else{let J=C.fromError(Q.error.code,Q.error.message,Q.error.data);W(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(Q,X,Y){let{task:W}=Y??{};if(!W){try{yield{type:"result",result:await this.request(Q,X,Y)}}catch(J){yield{type:"error",error:J instanceof C?J:new C(v.InternalError,String(J))}}return}let $;try{let J=await this.request(Q,G6,Y);if(J.task)$=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new C(v.InternalError,"Task creation did not return a task");while(!0){let G=await this.getTask({taskId:$},Y);if(yield{type:"taskStatus",task:G},I1(G.status)){if(G.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:$},X,Y)};else if(G.status==="failed")yield{type:"error",error:new C(v.InternalError,`Task ${$} failed`)};else if(G.status==="cancelled")yield{type:"error",error:new C(v.InternalError,`Task ${$} was cancelled`)};return}if(G.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:$},X,Y)};return}let H=G.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((B)=>setTimeout(B,H)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof C?J:new C(v.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:$,onresumptiontoken:J,task:G,relatedTask:H}=Y??{};return new Promise((B,z)=>{let A=(O)=>{z(O)};if(!this._transport){A(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),G)this.assertTaskCapability(Q.method)}catch(O){A(O);return}Y?.signal?.throwIfAborted();let D=this._requestMessageId++,L={...Q,jsonrpc:"2.0",id:D};if(Y?.onprogress)this._progressHandlers.set(D,Y.onprogress),L.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:D}};if(G)L.params={...L.params,task:G};if(H)L.params={...L.params,_meta:{...L.params?._meta||{},[N1]:H}};let K=(O)=>{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(O)}},{relatedRequestId:W,resumptionToken:$,onresumptiontoken:J}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let b=O instanceof C?O:new C(v.RequestTimeout,String(O));z(b)};this._responseHandlers.set(D,(O)=>{if(Y?.signal?.aborted)return;if(O instanceof Error)return z(O);try{let b=S1(X,O.result);if(!b.success)z(b.error);else B(b.data)}catch(b){z(b)}}),Y?.signal?.addEventListener("abort",()=>{K(Y?.signal?.reason)});let q=Y?.timeout??yL,F=()=>K(C.fromError(v.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(D,q,Y?.maxTotalTimeout,F,Y?.resetTimeoutOnProgress??!1);let N=H?.taskId;if(N){let O=(b)=>{let E=this._responseHandlers.get(D);if(E)E(b);else this._onerror(Error(`Response handler missing for side-channeled request ${D}`))};this._requestResolvers.set(D,O),this._enqueueTaskMessage(N,{type:"request",message:L,timestamp:Date.now()}).catch((b)=>{this._cleanupTimeout(D),z(b)})}else this._transport.send(L,{relatedRequestId:W,resumptionToken:$,onresumptiontoken:J}).catch((O)=>{this._cleanupTimeout(D),z(O)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},U9,X)}async getTaskResult(Q,X,Y){return this.request({method:"tasks/result",params:Q},X,Y)}async listTasks(Q,X){return this.request({method:"tasks/list",params:Q},w9,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},wJ,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let G={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[N1]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:G,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId&&!X?.relatedTask){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;let G={...Q,jsonrpc:"2.0"};if(X?.relatedTask)G={...G,params:{...G.params,_meta:{...G.params?._meta||{},[N1]:X.relatedTask}}};this._transport?.send(G,X).catch((H)=>this._onerror(H))});return}let J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[N1]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=BY(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,$)=>{let J=zY(Q,W);return Promise.resolve(X(J,$))})}removeRequestHandler(Q){this._requestHandlers.delete(Q)}assertCanSetRequestHandler(Q){if(this._requestHandlers.has(Q))throw Error(`A request handler for ${Q} already exists, which would be overridden`)}setNotificationHandler(Q,X){let Y=BY(Q);this._notificationHandlers.set(Y,(W)=>{let $=zY(Q,W);return Promise.resolve(X($))})}removeNotificationHandler(Q){this._notificationHandlers.delete(Q)}_cleanupTaskProgressHandler(Q){let X=this._taskProgressTokens.get(Q);if(X!==void 0)this._progressHandlers.delete(X),this._taskProgressTokens.delete(Q)}async _enqueueTaskMessage(Q,X,Y){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let W=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(Q,X,Y,W)}async _clearTaskQueue(Q,X){if(this._taskMessageQueue){let Y=await this._taskMessageQueue.dequeueAll(Q,X);for(let W of Y)if(W.type==="request"&&xX(W.message)){let $=W.message.id,J=this._requestResolvers.get($);if(J)J(new C(v.InternalError,"Task cancelled or completed")),this._requestResolvers.delete($);else this._onerror(Error(`Resolver missing for request ${$} during task ${Q} cleanup`))}}}async _waitForTaskUpdate(Q,X){let Y=this._options?.defaultTaskPollInterval??1000;try{let W=await this._taskStore?.getTask(Q);if(W?.pollInterval)Y=W.pollInterval}catch{}return new Promise((W,$)=>{if(X.aborted){$(new C(v.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),$(new C(v.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(Q,X){let Y=this._taskStore;if(!Y)throw Error("No task store configured");return{createTask:async(W)=>{if(!Q)throw Error("No request provided");return await Y.createTask(W,Q.id,{method:Q.method,params:Q.params},X)},getTask:async(W)=>{let $=await Y.getTask(W,X);if(!$)throw new C(v.InvalidParams,"Failed to retrieve task: Task not found");return $},storeTaskResult:async(W,$,J)=>{await Y.storeTaskResult(W,$,J,X);let G=await Y.getTask(W,X);if(G){let H=H4.parse({method:"notifications/tasks/status",params:G});if(await this.notification(H),I1(G.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,$,J)=>{let G=await Y.getTask(W,X);if(!G)throw new C(v.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(I1(G.status))throw new C(v.InvalidParams,`Cannot update task "${W}" from terminal status "${G.status}" to "${$}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(W,$,J,X);let H=await Y.getTask(W,X);if(H){let B=H4.parse({method:"notifications/tasks/status",params:H});if(await this.notification(B),I1(H.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function j7(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function b7(Q,X){let Y={...Q};for(let W in X){let $=W,J=X[$];if(J===void 0)continue;let G=Y[$];if(j7(G)&&j7(J))Y[$]={...G,...J};else Y[$]=J}return Y}var JB=SW(JW(),1),GB=SW($B(),1);function Jj(){let Q=new JB.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return GB.default(Q),Q}class FW{constructor(Q){this._ajv=Q??Jj()}getValidator(Q){let X="$id"in Q&&typeof Q.$id==="string"?this._ajv.getSchema(Q.$id)??this._ajv.compile(Q):this._ajv.compile(Q);return(Y)=>{if(X(Y))return{valid:!0,data:Y,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(X.errors)}}}}class VW{constructor(Q){this._server=Q}requestStream(Q,X,Y){return this._server.requestStream(Q,X,Y)}createMessageStream(Q,X){let Y=this._server.getClientCapabilities();if((Q.tools||Q.toolChoice)&&!Y?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(Q.messages.length>0){let W=Q.messages[Q.messages.length-1],$=Array.isArray(W.content)?W.content:[W.content],J=$.some((z)=>z.type==="tool_result"),G=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,H=G?Array.isArray(G.content)?G.content:[G.content]:[],B=H.some((z)=>z.type==="tool_use");if(J){if($.some((z)=>z.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!B)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(B){let z=new Set(H.filter((D)=>D.type==="tool_use").map((D)=>D.id)),A=new Set($.filter((D)=>D.type==="tool_result").map((D)=>D.toolUseId));if(z.size!==A.size||![...z].every((D)=>A.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:Q},A4,X)}elicitInputStream(Q,X){let Y=this._server.getClientCapabilities(),W=Q.mode??"form";switch(W){case"url":{if(!Y?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!Y?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let $=W==="form"&&Q.mode===void 0?{...Q,mode:"form"}:Q;return this.requestStream({method:"elicitation/create",params:$},z6,X)}async getTask(Q,X){return this._server.getTask({taskId:Q},X)}async getTaskResult(Q,X,Y){return this._server.getTaskResult({taskId:Q},X,Y)}async listTasks(Q,X){return this._server.listTasks(Q?{cursor:Q}:void 0,X)}async cancelTask(Q,X){return this._server.cancelTask({taskId:Q},X)}}function HB(Q,X,Y){if(!Q)throw Error(`${Y} does not support task creation (required for ${X})`);switch(X){case"tools/call":if(!Q.tools?.call)throw Error(`${Y} does not support task creation for tools/call (required for ${X})`);break;default:break}}function BB(Q,X,Y){if(!Q)throw Error(`${Y} does not support task creation (required for ${X})`);switch(X){case"sampling/createMessage":if(!Q.sampling?.createMessage)throw Error(`${Y} does not support task creation for sampling/createMessage (required for ${X})`);break;case"elicitation/create":if(!Q.elicitation?.create)throw Error(`${Y} does not support task creation for elicitation/create (required for ${X})`);break;default:break}}class UW extends AY{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(z4.options.map((Y,W)=>[Y,W])),this.isMessageIgnored=(Y,W)=>{let $=this._loggingLevels.get(W);return $?this.LOG_LEVEL_SEVERITY.get(Y)<this.LOG_LEVEL_SEVERITY.get($):!1},this._capabilities=X?.capabilities??{},this._instructions=X?.instructions,this._jsonSchemaValidator=X?.jsonSchemaValidator??new FW,this.setRequestHandler(hX,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(fX,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(nX,async(Y,W)=>{let $=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,G=z4.safeParse(J);if(G.success)this._loggingLevels.set($,G.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new VW(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=b7(this._capabilities,Q)}setRequestHandler(Q,X){let W=P1(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let $;if(u0(W)){let G=W;$=G._zod?.def?.value??G.value}else{let G=W;$=G._def?.value??G.value}if(typeof $!=="string")throw Error("Schema method literal must be a string");if($==="tools/call"){let G=async(H,B)=>{let z=S1(B6,H);if(!z.success){let K=z.error instanceof Error?z.error.message:String(z.error);throw new C(v.InvalidParams,`Invalid tools/call request: ${K}`)}let{params:A}=z.data,D=await Promise.resolve(X(H,B));if(A.task){let K=S1(G6,D);if(!K.success){let q=K.error instanceof Error?K.error.message:String(K.error);throw new C(v.InvalidParams,`Invalid task creation result: ${q}`)}return K.data}let L=S1(R9,D);if(!L.success){let K=L.error instanceof Error?L.error.message:String(L.error);throw new C(v.InvalidParams,`Invalid tools/call result: ${K}`)}return L.data};return super.setRequestHandler(Q,G)}return super.setRequestHandler(Q,X)}assertCapabilityForMethod(Q){switch(Q){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${Q})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${Q})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${Q})`);break;case"ping":break}}assertNotificationCapability(Q){switch(Q){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);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 ${Q})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${Q})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${Q})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${Q})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(Q){if(!this._capabilities)return;switch(Q){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${Q})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${Q})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${Q})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${Q})`);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 ${Q})`);break;case"ping":case"initialize":break}}assertTaskCapability(Q){BB(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;HB(this._capabilities.tasks?.requests,Q,"Server")}async _oninitialize(Q){let X=Q.params.protocolVersion;return this._clientCapabilities=Q.params.capabilities,this._clientVersion=Q.params.clientInfo,{protocolVersion:AJ.includes(X)?X:kX,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"},D9)}async createMessage(Q,X){if(Q.tools||Q.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(Q.messages.length>0){let Y=Q.messages[Q.messages.length-1],W=Array.isArray(Y.content)?Y.content:[Y.content],$=W.some((B)=>B.type==="tool_result"),J=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,G=J?Array.isArray(J.content)?J.content:[J.content]:[],H=G.some((B)=>B.type==="tool_use");if($){if(W.some((B)=>B.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!H)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(H){let B=new Set(G.filter((A)=>A.type==="tool_use").map((A)=>A.id)),z=new Set(W.filter((A)=>A.type==="tool_result").map((A)=>A.toolUseId));if(B.size!==z.size||![...B].every((A)=>z.has(A)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(Q.tools)return this.request({method:"sampling/createMessage",params:Q},dX,X);return this.request({method:"sampling/createMessage",params:Q},A4,X)}async elicitInput(Q,X){switch(Q.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let W=Q;return this.request({method:"elicitation/create",params:W},z6,X)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let W=Q.mode==="form"?Q:{...Q,mode:"form"},$=await this.request({method:"elicitation/create",params:W},z6,X);if($.action==="accept"&&$.content&&W.requestedSchema)try{let G=this._jsonSchemaValidator.getValidator(W.requestedSchema)($.content);if(!G.valid)throw new C(v.InvalidParams,`Elicitation response content does not match requested schema: ${G.errorMessage}`)}catch(J){if(J instanceof C)throw J;throw new C(v.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return $}}}createElicitationCompletionNotifier(Q,X){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:Q}},X)}async listRoots(Q,X){return this.request({method:"roots/list",params:Q},oX,X)}async sendLoggingMessage(Q,X){if(this._capabilities.logging){if(!this.isMessageIgnored(Q.level,X))return this.notification({method:"notifications/message",params:Q})}}async sendResourceUpdated(Q){return this.notification({method:"notifications/resources/updated",params:Q})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var AB=Symbol.for("mcp.completable");function OW(Q){return!!Q&&typeof Q==="object"&&AB in Q}function KB(Q){return Q[AB]?.complete}var zB;(function(Q){Q.Completable="McpCompletable"})(zB||(zB={}));var Gj=/^[A-Za-z0-9._-]{1,128}$/;function Hj(Q){let X=[];if(Q.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(Q.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${Q.length})`]};if(Q.includes(" "))X.push("Tool name contains spaces, which may cause parsing issues");if(Q.includes(","))X.push("Tool name contains commas, which may cause parsing issues");if(Q.startsWith("-")||Q.endsWith("-"))X.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(Q.startsWith(".")||Q.endsWith("."))X.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!Gj.test(Q)){let Y=Q.split("").filter((W)=>!/[A-Za-z0-9._-]/.test(W)).filter((W,$,J)=>J.indexOf(W)===$);return X.push(`Tool name contains invalid characters: ${Y.map((W)=>`"${W}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:X}}return{isValid:!0,warnings:X}}function Bj(Q,X){if(X.length>0){console.warn(`Tool name validation warning for "${Q}":`);for(let Y of X)console.warn(` - ${Y}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function NW(Q){let X=Hj(Q);return Bj(Q,X.warnings),X.isValid}class wW{constructor(Q){this._mcpServer=Q}registerToolTask(Q,X,Y){let W={taskSupport:"required",...X.execution};if(W.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${Q}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(Q,X.title,X.description,X.inputSchema,X.outputSchema,X.annotations,W,X._meta,Y)}}class jW{constructor(Q,X){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new UW(Q,X)}get experimental(){if(!this._experimental)this._experimental={tasks:new wW(this)};return this._experimental}async connect(Q){return await this.server.connect(Q)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(x1(I9)),this.server.assertCanSetRequestHandler(x1(B6)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(I9,()=>({tools:Object.entries(this._registeredTools).filter(([,Q])=>Q.enabled).map(([Q,X])=>{let Y={name:Q,title:X.title,description:X.description,inputSchema:(()=>{let W=S6(X.inputSchema);return W?HY(W,{strictUnions:!0,pipeStrategy:"input"}):zj})(),annotations:X.annotations,execution:X.execution,_meta:X._meta};if(X.outputSchema){let W=S6(X.outputSchema);if(W)Y.outputSchema=HY(W,{strictUnions:!0,pipeStrategy:"output"})}return Y})})),this.server.setRequestHandler(B6,async(Q,X)=>{try{let Y=this._registeredTools[Q.params.name];if(!Y)throw new C(v.InvalidParams,`Tool ${Q.params.name} not found`);if(!Y.enabled)throw new C(v.InvalidParams,`Tool ${Q.params.name} disabled`);let W=!!Q.params.task,$=Y.execution?.taskSupport,J="createTask"in Y.handler;if(($==="required"||$==="optional")&&!J)throw new C(v.InternalError,`Tool ${Q.params.name} has taskSupport '${$}' but was not registered with registerToolTask`);if($==="required"&&!W)throw new C(v.MethodNotFound,`Tool ${Q.params.name} requires task augmentation (taskSupport: 'required')`);if($==="optional"&&!W&&J)return await this.handleAutomaticTaskPolling(Y,Q,X);let G=await this.validateToolInput(Y,Q.params.arguments,Q.params.name),H=await this.executeToolHandler(Y,G,X);if(W)return H;return await this.validateToolOutput(Y,H,Q.params.name),H}catch(Y){if(Y instanceof C){if(Y.code===v.UrlElicitationRequired)throw Y}return this.createToolError(Y instanceof Error?Y.message:String(Y))}}),this._toolHandlersInitialized=!0}createToolError(Q){return{content:[{type:"text",text:Q}],isError:!0}}async validateToolInput(Q,X,Y){if(!Q.inputSchema)return;let $=S6(Q.inputSchema)??Q.inputSchema,J=await _9($,X);if(!J.success){let G="error"in J?J.error:"Unknown error",H=x9(G);throw new C(v.InvalidParams,`Input validation error: Invalid arguments for tool ${Y}: ${H}`)}return J.data}async validateToolOutput(Q,X,Y){if(!Q.outputSchema)return;if(!("content"in X))return;if(X.isError)return;if(!X.structuredContent)throw new C(v.InvalidParams,`Output validation error: Tool ${Y} has an output schema but no structured content was provided`);let W=S6(Q.outputSchema),$=await _9(W,X.structuredContent);if(!$.success){let J="error"in $?$.error:"Unknown error",G=x9(J);throw new C(v.InvalidParams,`Output validation error: Invalid structured content for tool ${Y}: ${G}`)}}async executeToolHandler(Q,X,Y){let W=Q.handler;if("createTask"in W){if(!Y.taskStore)throw Error("No task store provided.");let J={...Y,taskStore:Y.taskStore};if(Q.inputSchema)return await Promise.resolve(W.createTask(X,J));else return await Promise.resolve(W.createTask(J))}if(Q.inputSchema)return await Promise.resolve(W(X,Y));else return await Promise.resolve(W(Y))}async handleAutomaticTaskPolling(Q,X,Y){if(!Y.taskStore)throw Error("No task store provided for task-capable tool.");let W=await this.validateToolInput(Q,X.params.arguments,X.params.name),$=Q.handler,J={...Y,taskStore:Y.taskStore},G=W?await Promise.resolve($.createTask(W,J)):await Promise.resolve($.createTask(J)),H=G.task.taskId,B=G.task,z=B.pollInterval??5000;while(B.status!=="completed"&&B.status!=="failed"&&B.status!=="cancelled"){await new Promise((D)=>setTimeout(D,z));let A=await Y.taskStore.getTask(H);if(!A)throw new C(v.InternalError,`Task ${H} not found during polling`);B=A}return await Y.taskStore.getTaskResult(H)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(x1(C9)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(C9,async(Q)=>{switch(Q.params.ref.type){case"ref/prompt":return PJ(Q),this.handlePromptCompletion(Q,Q.params.ref);case"ref/resource":return IJ(Q),this.handleResourceCompletion(Q,Q.params.ref);default:throw new C(v.InvalidParams,`Invalid completion reference: ${Q.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(Q,X){let Y=this._registeredPrompts[X.name];if(!Y)throw new C(v.InvalidParams,`Prompt ${X.name} not found`);if(!Y.enabled)throw new C(v.InvalidParams,`Prompt ${X.name} disabled`);if(!Y.argsSchema)return m4;let $=P1(Y.argsSchema)?.[Q.params.argument.name];if(!OW($))return m4;let J=KB($);if(!J)return m4;let G=await J(Q.params.argument.value,Q.params.context);return LB(G)}async handleResourceCompletion(Q,X){let Y=Object.values(this._registeredResourceTemplates).find((J)=>J.resourceTemplate.uriTemplate.toString()===X.uri);if(!Y){if(this._registeredResources[X.uri])return m4;throw new C(v.InvalidParams,`Resource template ${Q.params.ref.uri} not found`)}let W=Y.resourceTemplate.completeCallback(Q.params.argument.name);if(!W)return m4;let $=await W(Q.params.argument.value,Q.params.context);return LB($)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(x1(j9)),this.server.assertCanSetRequestHandler(x1(b9)),this.server.assertCanSetRequestHandler(x1(E9)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(j9,async(Q,X)=>{let Y=Object.entries(this._registeredResources).filter(([$,J])=>J.enabled).map(([$,J])=>({uri:$,name:J.name,...J.metadata})),W=[];for(let $ of Object.values(this._registeredResourceTemplates)){if(!$.resourceTemplate.listCallback)continue;let J=await $.resourceTemplate.listCallback(X);for(let G of J.resources)W.push({...$.metadata,...G})}return{resources:[...Y,...W]}}),this.server.setRequestHandler(b9,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([X,Y])=>({name:X,uriTemplate:Y.resourceTemplate.uriTemplate.toString(),...Y.metadata}))}}),this.server.setRequestHandler(E9,async(Q,X)=>{let Y=new URL(Q.params.uri),W=this._registeredResources[Y.toString()];if(W){if(!W.enabled)throw new C(v.InvalidParams,`Resource ${Y} disabled`);return W.readCallback(Y,X)}for(let $ of Object.values(this._registeredResourceTemplates)){let J=$.resourceTemplate.uriTemplate.match(Y.toString());if(J)return $.readCallback(Y,J,X)}throw new C(v.InvalidParams,`Resource ${Y} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(x1(S9)),this.server.assertCanSetRequestHandler(x1(P9)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(S9,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,Q])=>Q.enabled).map(([Q,X])=>{return{name:Q,title:X.title,description:X.description,arguments:X.argsSchema?Aj(X.argsSchema):void 0}})})),this.server.setRequestHandler(P9,async(Q,X)=>{let Y=this._registeredPrompts[Q.params.name];if(!Y)throw new C(v.InvalidParams,`Prompt ${Q.params.name} not found`);if(!Y.enabled)throw new C(v.InvalidParams,`Prompt ${Q.params.name} disabled`);if(Y.argsSchema){let W=S6(Y.argsSchema),$=await _9(W,Q.params.arguments);if(!$.success){let H="error"in $?$.error:"Unknown error",B=x9(H);throw new C(v.InvalidParams,`Invalid arguments for prompt ${Q.params.name}: ${B}`)}let J=$.data,G=Y.callback;return await Promise.resolve(G(J,X))}else{let W=Y.callback;return await Promise.resolve(W(X))}}),this._promptHandlersInitialized=!0}resource(Q,X,...Y){let W;if(typeof Y[0]==="object")W=Y.shift();let $=Y[0];if(typeof X==="string"){if(this._registeredResources[X])throw Error(`Resource ${X} is already registered`);let J=this._createRegisteredResource(Q,void 0,X,W,$);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),J}else{if(this._registeredResourceTemplates[Q])throw Error(`Resource template ${Q} is already registered`);let J=this._createRegisteredResourceTemplate(Q,void 0,X,W,$);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),J}}registerResource(Q,X,Y,W){if(typeof X==="string"){if(this._registeredResources[X])throw Error(`Resource ${X} is already registered`);let $=this._createRegisteredResource(Q,Y.title,X,Y,W);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),$}else{if(this._registeredResourceTemplates[Q])throw Error(`Resource template ${Q} is already registered`);let $=this._createRegisteredResourceTemplate(Q,Y.title,X,Y,W);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),$}}_createRegisteredResource(Q,X,Y,W,$){let J={name:Q,title:X,metadata:W,readCallback:$,enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({uri:null}),update:(G)=>{if(typeof G.uri<"u"&&G.uri!==Y){if(delete this._registeredResources[Y],G.uri)this._registeredResources[G.uri]=J}if(typeof G.name<"u")J.name=G.name;if(typeof G.title<"u")J.title=G.title;if(typeof G.metadata<"u")J.metadata=G.metadata;if(typeof G.callback<"u")J.readCallback=G.callback;if(typeof G.enabled<"u")J.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResources[Y]=J,J}_createRegisteredResourceTemplate(Q,X,Y,W,$){let J={resourceTemplate:Y,title:X,metadata:W,readCallback:$,enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({name:null}),update:(B)=>{if(typeof B.name<"u"&&B.name!==Q){if(delete this._registeredResourceTemplates[Q],B.name)this._registeredResourceTemplates[B.name]=J}if(typeof B.title<"u")J.title=B.title;if(typeof B.template<"u")J.resourceTemplate=B.template;if(typeof B.metadata<"u")J.metadata=B.metadata;if(typeof B.callback<"u")J.readCallback=B.callback;if(typeof B.enabled<"u")J.enabled=B.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[Q]=J;let G=Y.uriTemplate.variableNames;if(Array.isArray(G)&&G.some((B)=>!!Y.completeCallback(B)))this.setCompletionRequestHandler();return J}_createRegisteredPrompt(Q,X,Y,W,$){let J={title:X,description:Y,argsSchema:W===void 0?void 0:d1(W),callback:$,enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({name:null}),update:(G)=>{if(typeof G.name<"u"&&G.name!==Q){if(delete this._registeredPrompts[Q],G.name)this._registeredPrompts[G.name]=J}if(typeof G.title<"u")J.title=G.title;if(typeof G.description<"u")J.description=G.description;if(typeof G.argsSchema<"u")J.argsSchema=d1(G.argsSchema);if(typeof G.callback<"u")J.callback=G.callback;if(typeof G.enabled<"u")J.enabled=G.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[Q]=J,W){if(Object.values(W).some((H)=>{let B=H instanceof g0?H._def?.innerType:H;return OW(B)}))this.setCompletionRequestHandler()}return J}_createRegisteredTool(Q,X,Y,W,$,J,G,H,B){NW(Q);let z={title:X,description:Y,inputSchema:DB(W),outputSchema:DB($),annotations:J,execution:G,_meta:H,handler:B,enabled:!0,disable:()=>z.update({enabled:!1}),enable:()=>z.update({enabled:!0}),remove:()=>z.update({name:null}),update:(A)=>{if(typeof A.name<"u"&&A.name!==Q){if(typeof A.name==="string")NW(A.name);if(delete this._registeredTools[Q],A.name)this._registeredTools[A.name]=z}if(typeof A.title<"u")z.title=A.title;if(typeof A.description<"u")z.description=A.description;if(typeof A.paramsSchema<"u")z.inputSchema=d1(A.paramsSchema);if(typeof A.outputSchema<"u")z.outputSchema=d1(A.outputSchema);if(typeof A.callback<"u")z.handler=A.callback;if(typeof A.annotations<"u")z.annotations=A.annotations;if(typeof A._meta<"u")z._meta=A._meta;if(typeof A.enabled<"u")z.enabled=A.enabled;this.sendToolListChanged()}};return this._registeredTools[Q]=z,this.setToolRequestHandlers(),this.sendToolListChanged(),z}tool(Q,...X){if(this._registeredTools[Q])throw Error(`Tool ${Q} is already registered`);let Y,W,$,J;if(typeof X[0]==="string")Y=X.shift();if(X.length>1){let H=X[0];if(MW(H)){if(W=X.shift(),X.length>1&&typeof X[0]==="object"&&X[0]!==null&&!MW(X[0]))J=X.shift()}else if(typeof H==="object"&&H!==null){if(Object.values(H).some((B)=>typeof B==="object"&&B!==null))throw Error(`Tool ${Q} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);J=X.shift()}}let G=X[0];return this._createRegisteredTool(Q,void 0,Y,W,$,J,{taskSupport:"forbidden"},void 0,G)}registerTool(Q,X,Y){if(this._registeredTools[Q])throw Error(`Tool ${Q} is already registered`);let{title:W,description:$,inputSchema:J,outputSchema:G,annotations:H,_meta:B}=X;return this._createRegisteredTool(Q,W,$,J,G,H,{taskSupport:"forbidden"},B,Y)}prompt(Q,...X){if(this._registeredPrompts[Q])throw Error(`Prompt ${Q} is already registered`);let Y;if(typeof X[0]==="string")Y=X.shift();let W;if(X.length>1)W=X.shift();let $=X[0],J=this._createRegisteredPrompt(Q,void 0,Y,W,$);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),J}registerPrompt(Q,X,Y){if(this._registeredPrompts[Q])throw Error(`Prompt ${Q} is already registered`);let{title:W,description:$,argsSchema:J}=X,G=this._createRegisteredPrompt(Q,W,$,J,Y);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),G}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(Q,X){return this.server.sendLoggingMessage(Q,X)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var zj={type:"object",properties:{}};function qB(Q){return Q!==null&&typeof Q==="object"&&"parse"in Q&&typeof Q.parse==="function"&&"safeParse"in Q&&typeof Q.safeParse==="function"}function FB(Q){return"_def"in Q||"_zod"in Q||qB(Q)}function MW(Q){if(typeof Q!=="object"||Q===null)return!1;if(FB(Q))return!1;if(Object.keys(Q).length===0)return!0;return Object.values(Q).some(qB)}function DB(Q){if(!Q)return;if(MW(Q))return d1(Q);if(!FB(Q))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return Q}function Aj(Q){let X=P1(Q);if(!X)return[];return Object.entries(X).map(([Y,W])=>{let $=mJ(W),J=cJ(W);return{name:Y,description:$,required:!J}})}function x1(Q){let Y=P1(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=g9(Y);if(typeof W==="string")return W;throw Error("Schema method literal must be a string")}function LB(Q){return{completion:{values:Q.slice(0,100),total:Q.length,hasMore:Q.length>100}}}var m4={completion:{values:[],hasMore:!1}};import{AsyncLocalStorage as Kj}from"node:async_hooks";var VB=new Kj;var Dj="https://api.stophy.dev/v1";class c4 extends Error{status;code;constructor(Q,X,Y){super(Y);this.status=Q;this.code=X;this.name="StophyError"}}async function c0(Q,X){let Y=VB.getStore()??process.env.STOPHY_API_KEY;if(!Y)throw new c4(0,"MISSING_API_KEY","No Stophy API key provided. Set STOPHY_API_KEY (stdio) or include your key in the URL path (hosted). Get a key at https://stophy.dev/dashboard.");let W=await fetch(`${Dj}${Q}`,{method:X!==void 0?"POST":"GET",headers:{Authorization:`Bearer ${Y}`,...X!==void 0?{"Content-Type":"application/json"}:{}},...X!==void 0?{body:JSON.stringify(X)}:{}}),$=await W.json();if(!$.success)throw new c4(W.status,$.code??"API_ERROR",$.error);return $.data}var UB={channelUrl:s.string().describe("YouTube channel URL. Accepts youtube.com/@handle or youtube.com/channel/UCxxx"),tab:s.enum(["video","short","playlist","about"]).optional().describe("Which tab to fetch. Defaults to video"),sortBy:s.enum(["latest","popular","oldest"]).optional().describe("Sort order for the video tab"),continuationToken:s.string().optional().describe("Pagination token from a previous channel response")};async function OB(Q){let X=await c0("/channel",Q);return{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}async function NB(){let Q=await c0("/credits");return{content:[{type:"text",text:JSON.stringify(Q,null,2)}]}}var wB={playlistUrl:s.string().describe("YouTube playlist URL (youtube.com/playlist?list=PLxxx)"),continuationToken:s.string().optional().describe("Pagination token from a previous playlist response")};async function MB(Q){let X=await c0("/playlist",Q);return{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}var jB={q:s.string().describe("Search query"),type:s.enum(["video","channel","playlist","short"]).optional().describe("Filter by content type"),uploadDate:s.enum(["hour","today","week","month","year"]).optional().describe("Filter by upload date"),duration:s.enum(["short","medium","long"]).optional().describe("short = under 4 min, medium = 4–20 min, long = over 20 min"),sortBy:s.enum(["relevance","popularity","date","rating"]).optional().describe("Sort order. Defaults to relevance"),continuationToken:s.string().optional().describe("Pagination token from a previous search response")};async function bB(Q){let X=await c0("/search",Q);return{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}var EB={q:s.string().describe("Partial query to get autocomplete suggestions for"),hl:s.string().optional().describe("Language code (e.g. en, fr). Defaults to en"),gl:s.string().optional().describe("Country code (e.g. US, GB). Defaults to US")};async function SB(Q){let X=new URLSearchParams({q:Q.q});if(Q.hl)X.set("hl",Q.hl);if(Q.gl)X.set("gl",Q.gl);let Y=await c0(`/suggest?${X.toString()}`);return{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}var PB={videoUrl:s.string().describe("YouTube video URL or ID (e.g. https://youtube.com/watch?v=VIDEO_ID)"),type:s.enum(["details","transcript","comments","livechat"]).describe("What to fetch: details = title/description/stats, transcript = timestamped captions, comments = threaded comments, livechat = live stream chat messages + status"),sortBy:s.enum(["latest","top"]).optional().describe("Sort order for comments. Defaults to top"),chatType:s.enum(["top","live"]).optional().describe("For livechat only: 'top' = Top chat (moderated, default), 'live' = Live chat (all messages). Applied on the first call; later polls keep the chosen mode."),continuationToken:s.string().optional().describe("Pagination token. For comments, pass a previous comments response token. For livechat, pass the continuationToken from a previous livechat response to poll for new messages.")};async function IB(Q){let X=await c0("/video",Q);return{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}function f6(Q){return async(X)=>{try{return await Q(X)}catch(Y){return{content:[{type:"text",text:Y instanceof c4?`Stophy error (${Y.code}): ${Y.message}`:`Unexpected error: ${String(Y)}`}]}}}}var u6={readOnlyHint:!0,destructiveHint:!1};function RB(){let Q=new jW({name:"stophy",version:"1.0.0"});return Q.tool("stophy_search_videos","Search YouTube for videos, channels, playlists, or Shorts. Filter by upload date, duration, and sort order. Returns items with title, author, view count, duration, and publish date. Paginate with continuationToken. When you already have a video URL, use stophy_get_video instead.",jB,u6,f6(bB)),Q.tool("stophy_get_video",`Get YouTube data for a specific video. type="details": title, description, stats, tags, and related videos. type="transcript": timestamped captions with language info and speaker segments. type="comments": threaded comments with author, likes, and reply count — pass a comment's repliesToken as continuationToken to fetch its replies. type="livechat": real-time chat from a live stream. Poll with continuationToken every pollIntervalMs until it returns null (stream ended). Set chatType="top" for moderated chat or "live" for all messages. When discovering videos, use stophy_search_videos instead.`,PB,u6,f6(IB)),Q.tool("stophy_get_channel",'Browse a YouTube channel. Every tab returns channel info (name, handle, subscriber count, video count). tab="video", "short", or "playlist" lists content with pagination. tab="about" returns the full profile: country, join date, total views, and links. When you have a specific video URL, use stophy_get_video instead.',UB,u6,f6(OB)),Q.tool("stophy_get_playlist","Get all videos in a YouTube playlist. Returns the playlist title, author, and every video. Paginate with continuationToken.",wB,u6,f6(MB)),Q.tool("stophy_get_suggestions","YouTube autocomplete suggestions for a partial query. Returns an array of completions. Useful for topic discovery and query expansion.",EB,u6,f6(SB)),Q.tool("stophy_get_credits","Check your Stophy credit balance. Free — does not cost a credit. Returns remaining credits.",{},u6,f6(NB)),Q}var Lj=RB(),qj=new tX;await Lj.connect(qj);
33
+ path: iss.path ? [${bt(k)}, ...iss.path] : [${bt(k)}]
34
+ })));`),f.write(`newResult[${bt(k)}] = ${b}.value`)}f.write("payload.value = newResult;"),f.write("return payload;");let v=f.compile();return(k,b)=>v(d,k,b)},n,s=Yt,i=!Hr.jitless,u=i&&fa.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 b=l.shape;for(let C of l.keys){let y=b[C],x=y._zod.run({value:m[C],issues:[]},f),j=y._zod.optin==="optional"&&y._zod.optout==="optional";if(x instanceof Promise)h.push(x.then((G)=>j?dc(G,d,C,m):to(G,d,C)));else if(j)dc(x,d,C,m);else to(x,d,C)}}if(!c)return h.length?Promise.all(h).then(()=>d):d;let _=[],w=l.keySet,v=c._zod,k=v.def.type;for(let b of Object.keys(m)){if(w.has(b))continue;if(k==="never"){_.push(b);continue}let C=v.run({value:m[b],issues:[]},f);if(C instanceof Promise)h.push(C.then((y)=>to(y,d,b)));else to(C,d,b)}if(_.length)d.issues.push({code:"unrecognized_keys",keys:_,input:m,inst:e});if(!h.length)return d;return Promise.all(h).then(()=>d)}});function pc(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)=>Ne(s,o,xe())))}),t}var Fn=g("$ZodUnion",(e,t)=>{U.init(e,t),H(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),H(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),H(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),H(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)=>Jr(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 pc(s,r,e,o);return Promise.all(s).then((i)=>pc(i,r,e,o))}}),Yc=g("$ZodDiscriminatedUnion",(e,t)=>{Fn.init(e,t);let r=e._zod.parse;H(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=Br(()=>{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(!Yt(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}}),Qc=g("$ZodIntersection",(e,t)=>{U.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])=>fc(r,u,c));return fc(r,s,i)}});function Un(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(Qt(e)&&Qt(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=Un(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=Un(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 fc(e,t,r){if(t.issues.length)e.issues.push(...t.issues);if(r.issues.length)e.issues.push(...r.issues);if(zt(e))return e;let o=Un(t.value,r.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Xc=g("$ZodRecord",(e,t)=>{U.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Qt(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(...qe(u,l.issues));r.value[u]=l.value}));else{if(c.issues.length)r.issues.push(...qe(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)=>Ne(c,o,xe())),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(...qe(i,c.issues));r.value[a.value]=c.value}));else{if(u.issues.length)r.issues.push(...qe(i,u.issues));r.value[a.value]=u.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var eu=g("$ZodEnum",(e,t)=>{U.init(e,t);let r=la(t.entries);e._zod.values=new Set(r),e._zod.pattern=new RegExp(`^(${r.filter((o)=>ma.has(typeof o)).map((o)=>typeof o==="string"?lt(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}}),tu=g("$ZodLiteral",(e,t)=>{U.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?lt(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 ru=g("$ZodTransform",(e,t)=>{U.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 Be;return r.value=n,r}}),ou=g("$ZodOptional",(e,t)=>{U.init(e,t),e._zod.optin="optional",e._zod.optout="optional",H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),H(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Jr(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)}}),nu=g("$ZodNullable",(e,t)=>{U.init(e,t),H(e._zod,"optin",()=>t.innerType._zod.optin),H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Jr(r.source)}|null)$`):void 0}),H(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)}}),su=g("$ZodDefault",(e,t)=>{U.init(e,t),e._zod.optin="optional",H(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)=>mc(s,t));return mc(n,t)}});function mc(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var iu=g("$ZodPrefault",(e,t)=>{U.init(e,t),e._zod.optin="optional",H(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)}}),au=g("$ZodNonOptional",(e,t)=>{U.init(e,t),H(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)=>hc(s,e));return hc(n,e)}});function hc(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 cu=g("$ZodCatch",(e,t)=>{U.init(e,t),e._zod.optin="optional",H(e._zod,"optout",()=>t.innerType._zod.optout),H(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)=>Ne(i,o,xe()))},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)=>Ne(s,o,xe()))},input:r.value}),r.issues=[];return r}});var uu=g("$ZodPipe",(e,t)=>{U.init(e,t),H(e._zod,"values",()=>t.in._zod.values),H(e._zod,"optin",()=>t.in._zod.optin),H(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)=>_c(s,t,o));return _c(n,t,o)}});function _c(e,t,r){if(zt(e))return e;return t.out._zod.run({value:e.value,issues:e.issues},r)}var lu=g("$ZodReadonly",(e,t)=>{U.init(e,t),H(e._zod,"propValues",()=>t.innerType._zod.propValues),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"optin",()=>t.innerType._zod.optin),H(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(gc);return gc(n)}});function gc(e){return e.value=Object.freeze(e.value),e}var du=g("$ZodCustom",(e,t)=>{de.init(e,t),U.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)=>yc(s,r,o,e));yc(n,r,o,e);return}});function yc(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(St(n))}}var l_=(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},d_=()=>{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 ${l_(o.input)}`;case"invalid_value":if(o.values.length===1)return`Invalid input: expected ${In(o.values[0])}`;return`Invalid option: expected one of ${En(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":""}: ${En(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 Hn(){return{localeError:d_()}}var p_=Symbol("ZodOutput"),f_=Symbol("ZodInput");class pu{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 fu(){return new pu}var kt=fu();function mu(e,t){return new e({type:"string",...T(t)})}function hu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...T(t)})}function Kn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...T(t)})}function _u(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...T(t)})}function gu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(t)})}function yu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(t)})}function vu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(t)})}function Bn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...T(t)})}function $u(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...T(t)})}function wu(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(t)})}function xu(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...T(t)})}function bu(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(t)})}function zu(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...T(t)})}function Su(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...T(t)})}function ku(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(t)})}function Pu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(t)})}function Tu(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(t)})}function Eu(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(t)})}function Ru(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(t)})}function Iu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...T(t)})}function Cu(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...T(t)})}function Ou(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...T(t)})}function ju(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...T(t)})}function Nu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(t)})}function Au(e,t){return new e({type:"string",format:"date",check:"string_format",...T(t)})}function Zu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...T(t)})}function qu(e,t){return new e({type:"string",format:"duration",check:"string_format",...T(t)})}function Mu(e,t){return new e({type:"number",checks:[],...T(t)})}function Du(e,t){return new e({type:"number",coerce:!0,checks:[],...T(t)})}function Lu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...T(t)})}function Uu(e,t){return new e({type:"boolean",...T(t)})}function Vu(e,t){return new e({type:"null",...T(t)})}function Fu(e){return new e({type:"any"})}function Hu(e){return new e({type:"unknown"})}function Ku(e,t){return new e({type:"never",...T(t)})}function oo(e,t){return new Mn({check:"less_than",...T(t),value:e,inclusive:!1})}function tr(e,t){return new Mn({check:"less_than",...T(t),value:e,inclusive:!0})}function no(e,t){return new Dn({check:"greater_than",...T(t),value:e,inclusive:!1})}function rr(e,t){return new Dn({check:"greater_than",...T(t),value:e,inclusive:!0})}function so(e,t){return new Ga({check:"multiple_of",...T(t),value:e})}function io(e,t){return new Qa({check:"max_length",...T(t),maximum:e})}function Pt(e,t){return new Xa({check:"min_length",...T(t),minimum:e})}function ao(e,t){return new ec({check:"length_equals",...T(t),length:e})}function Wn(e,t){return new tc({check:"string_format",format:"regex",...T(t),pattern:e})}function Jn(e){return new rc({check:"string_format",format:"lowercase",...T(e)})}function Gn(e){return new oc({check:"string_format",format:"uppercase",...T(e)})}function Yn(e,t){return new nc({check:"string_format",format:"includes",...T(t),includes:e})}function Qn(e,t){return new sc({check:"string_format",format:"starts_with",...T(t),prefix:e})}function Xn(e,t){return new ic({check:"string_format",format:"ends_with",...T(t),suffix:e})}function dt(e){return new ac({check:"overwrite",tx:e})}function es(e){return dt((t)=>t.normalize(e))}function ts(){return dt((e)=>e.trim())}function rs(){return dt((e)=>e.toLowerCase())}function os(){return dt((e)=>e.toUpperCase())}function Bu(e,t,r){return new e({type:"array",element:t,...T(r)})}function Wu(e,t,r){let o=T(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Ju(e,t,r){return new e({type:"custom",check:"custom",fn:t,...T(r)})}function Je(e){return!!e._zod}function fe(e,t){if(Je(e))return Xt(e,t);return e.safeParse(t)}function Et(e){if(!e)return;let t;if(Je(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 Gu(e){if(Je(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 $_=g("ZodISODateTime",(e,t)=>{Rc.init(e,t),Y.init(e,t)});function ns(e){return Nu($_,e)}var w_=g("ZodISODate",(e,t)=>{Ic.init(e,t),Y.init(e,t)});function Yu(e){return Au(w_,e)}var x_=g("ZodISOTime",(e,t)=>{Cc.init(e,t),Y.init(e,t)});function Qu(e){return Zu(x_,e)}var b_=g("ZodISODuration",(e,t)=>{Oc.init(e,t),Y.init(e,t)});function Xu(e){return qu(b_,e)}var tl=(e,t)=>{Qr.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>jn(e,r)},flatten:{value:(r)=>On(e,r)},addIssue:{value:(r)=>e.issues.push(r)},addIssues:{value:(r)=>e.issues.push(...r)},isEmpty:{get(){return e.issues.length===0}}})},Dk=g("ZodError",tl),or=g("ZodError",tl,{Parent:Error});var rl=ya(or),ol=va(or),nl=Nn(or),sl=An(or);var ee=g("ZodType",(e,t)=>(U.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)=>je(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.parse=(r,o)=>rl(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>nl(e,r,o),e.parseAsync=async(r,o)=>ol(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>sl(e,r,o),e.spa=e.safeParseAsync,e.refine=(r,o)=>e.check(dg(r,o)),e.superRefine=(r)=>e.check(pg(r)),e.overwrite=(r)=>e.check(dt(r)),e.optional=()=>X(e),e.nullable=()=>cl(e),e.nullish=()=>X(cl(e)),e.nonoptional=(r)=>ng(e,r),e.array=()=>z(e),e.or=(r)=>W([e,r]),e.and=(r)=>lo(e,r),e.transform=(r)=>as(e,yl(r)),e.default=(r)=>tg(e,r),e.prefault=(r)=>og(e,r),e.catch=(r)=>ig(e,r),e.pipe=(r)=>as(e,r),e.readonly=()=>ug(e),e.describe=(r)=>{let o=e.clone();return kt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return kt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return kt.get(e);let o=e.clone();return kt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ul=g("_ZodString",(e,t)=>{ro.init(e,t),ee.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(Wn(...o)),e.includes=(...o)=>e.check(Yn(...o)),e.startsWith=(...o)=>e.check(Qn(...o)),e.endsWith=(...o)=>e.check(Xn(...o)),e.min=(...o)=>e.check(Pt(...o)),e.max=(...o)=>e.check(io(...o)),e.length=(...o)=>e.check(ao(...o)),e.nonempty=(...o)=>e.check(Pt(1,...o)),e.lowercase=(o)=>e.check(Jn(o)),e.uppercase=(o)=>e.check(Gn(o)),e.trim=()=>e.check(ts()),e.normalize=(...o)=>e.check(es(...o)),e.toLowerCase=()=>e.check(rs()),e.toUpperCase=()=>e.check(os())}),ll=g("ZodString",(e,t)=>{ro.init(e,t),ul.init(e,t),e.email=(r)=>e.check(hu(S_,r)),e.url=(r)=>e.check(Bn(dl,r)),e.jwt=(r)=>e.check(ju(D_,r)),e.emoji=(r)=>e.check($u(k_,r)),e.guid=(r)=>e.check(Kn(il,r)),e.uuid=(r)=>e.check(_u(co,r)),e.uuidv4=(r)=>e.check(gu(co,r)),e.uuidv6=(r)=>e.check(yu(co,r)),e.uuidv7=(r)=>e.check(vu(co,r)),e.nanoid=(r)=>e.check(wu(P_,r)),e.guid=(r)=>e.check(Kn(il,r)),e.cuid=(r)=>e.check(xu(T_,r)),e.cuid2=(r)=>e.check(bu(E_,r)),e.ulid=(r)=>e.check(zu(R_,r)),e.base64=(r)=>e.check(Iu(Z_,r)),e.base64url=(r)=>e.check(Cu(q_,r)),e.xid=(r)=>e.check(Su(I_,r)),e.ksuid=(r)=>e.check(ku(C_,r)),e.ipv4=(r)=>e.check(Pu(O_,r)),e.ipv6=(r)=>e.check(Tu(j_,r)),e.cidrv4=(r)=>e.check(Eu(N_,r)),e.cidrv6=(r)=>e.check(Ru(A_,r)),e.e164=(r)=>e.check(Ou(M_,r)),e.datetime=(r)=>e.check(ns(r)),e.date=(r)=>e.check(Yu(r)),e.time=(r)=>e.check(Qu(r)),e.duration=(r)=>e.check(Xu(r))});function p(e){return mu(ll,e)}var Y=g("ZodStringFormat",(e,t)=>{B.init(e,t),ul.init(e,t)}),S_=g("ZodEmail",(e,t)=>{wc.init(e,t),Y.init(e,t)});var il=g("ZodGUID",(e,t)=>{vc.init(e,t),Y.init(e,t)});var co=g("ZodUUID",(e,t)=>{$c.init(e,t),Y.init(e,t)});var dl=g("ZodURL",(e,t)=>{xc.init(e,t),Y.init(e,t)});function pl(e){return Bn(dl,e)}var k_=g("ZodEmoji",(e,t)=>{bc.init(e,t),Y.init(e,t)});var P_=g("ZodNanoID",(e,t)=>{zc.init(e,t),Y.init(e,t)});var T_=g("ZodCUID",(e,t)=>{Sc.init(e,t),Y.init(e,t)});var E_=g("ZodCUID2",(e,t)=>{kc.init(e,t),Y.init(e,t)});var R_=g("ZodULID",(e,t)=>{Pc.init(e,t),Y.init(e,t)});var I_=g("ZodXID",(e,t)=>{Tc.init(e,t),Y.init(e,t)});var C_=g("ZodKSUID",(e,t)=>{Ec.init(e,t),Y.init(e,t)});var O_=g("ZodIPv4",(e,t)=>{jc.init(e,t),Y.init(e,t)});var j_=g("ZodIPv6",(e,t)=>{Nc.init(e,t),Y.init(e,t)});var N_=g("ZodCIDRv4",(e,t)=>{Ac.init(e,t),Y.init(e,t)});var A_=g("ZodCIDRv6",(e,t)=>{Zc.init(e,t),Y.init(e,t)});var Z_=g("ZodBase64",(e,t)=>{Mc.init(e,t),Y.init(e,t)});var q_=g("ZodBase64URL",(e,t)=>{Dc.init(e,t),Y.init(e,t)});var M_=g("ZodE164",(e,t)=>{Lc.init(e,t),Y.init(e,t)});var D_=g("ZodJWT",(e,t)=>{Uc.init(e,t),Y.init(e,t)});var uo=g("ZodNumber",(e,t)=>{Vn.init(e,t),ee.init(e,t),e.gt=(o,n)=>e.check(no(o,n)),e.gte=(o,n)=>e.check(rr(o,n)),e.min=(o,n)=>e.check(rr(o,n)),e.lt=(o,n)=>e.check(oo(o,n)),e.lte=(o,n)=>e.check(tr(o,n)),e.max=(o,n)=>e.check(tr(o,n)),e.int=(o)=>e.check(al(o)),e.safe=(o)=>e.check(al(o)),e.positive=(o)=>e.check(no(0,o)),e.nonnegative=(o)=>e.check(rr(0,o)),e.negative=(o)=>e.check(oo(0,o)),e.nonpositive=(o)=>e.check(tr(0,o)),e.multipleOf=(o,n)=>e.check(so(o,n)),e.step=(o,n)=>e.check(so(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 L(e){return Mu(uo,e)}var L_=g("ZodNumberFormat",(e,t)=>{Vc.init(e,t),uo.init(e,t)});function al(e){return Lu(L_,e)}var fl=g("ZodBoolean",(e,t)=>{Fc.init(e,t),ee.init(e,t)});function V(e){return Uu(fl,e)}var U_=g("ZodNull",(e,t)=>{Hc.init(e,t),ee.init(e,t)});function ml(e){return Vu(U_,e)}var V_=g("ZodAny",(e,t)=>{Kc.init(e,t),ee.init(e,t)});function hl(){return Fu(V_)}var F_=g("ZodUnknown",(e,t)=>{Bc.init(e,t),ee.init(e,t)});function Q(){return Hu(F_)}var H_=g("ZodNever",(e,t)=>{Wc.init(e,t),ee.init(e,t)});function K_(e){return Ku(H_,e)}var B_=g("ZodArray",(e,t)=>{Jc.init(e,t),ee.init(e,t),e.element=t.element,e.min=(r,o)=>e.check(Pt(r,o)),e.nonempty=(r)=>e.check(Pt(1,r)),e.max=(r,o)=>e.check(io(r,o)),e.length=(r,o)=>e.check(ao(r,o)),e.unwrap=()=>e.element});function z(e,t){return Bu(B_,e,t)}var _l=g("ZodObject",(e,t)=>{Gc.init(e,t),ee.init(e,t),H(e,"shape",()=>t.shape),e.keyof=()=>ge(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Q()}),e.loose=()=>e.clone({...e._zod.def,catchall:Q()}),e.strict=()=>e.clone({...e._zod.def,catchall:K_()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>o_(e,r),e.merge=(r)=>n_(e,r),e.pick=(r)=>t_(e,r),e.omit=(r)=>r_(e,r),e.partial=(...r)=>s_(vl,e,r[0]),e.required=(...r)=>i_($l,e,r[0])});function S(e,t){let r={type:"object",get shape(){return Gr(this,"shape",{...e}),this.shape},...T(t)};return new _l(r)}function ne(e,t){return new _l({type:"object",get shape(){return Gr(this,"shape",{...e}),this.shape},catchall:Q(),...T(t)})}var gl=g("ZodUnion",(e,t)=>{Fn.init(e,t),ee.init(e,t),e.options=t.options});function W(e,t){return new gl({type:"union",options:e,...T(t)})}var W_=g("ZodDiscriminatedUnion",(e,t)=>{gl.init(e,t),Yc.init(e,t)});function cs(e,t,r){return new W_({type:"union",options:t,discriminator:e,...T(r)})}var J_=g("ZodIntersection",(e,t)=>{Qc.init(e,t),ee.init(e,t)});function lo(e,t){return new J_({type:"intersection",left:e,right:t})}var G_=g("ZodRecord",(e,t)=>{Xc.init(e,t),ee.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function K(e,t,r){return new G_({type:"record",keyType:e,valueType:t,...T(r)})}var is=g("ZodEnum",(e,t)=>{eu.init(e,t),ee.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 is({...t,checks:[],...T(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 is({...t,checks:[],...T(n),entries:s})}});function ge(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new is({type:"enum",entries:r,...T(t)})}var Y_=g("ZodLiteral",(e,t)=>{tu.init(e,t),ee.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 E(e,t){return new Y_({type:"literal",values:Array.isArray(e)?e:[e],...T(t)})}var Q_=g("ZodTransform",(e,t)=>{ru.init(e,t),ee.init(e,t),e._zod.parse=(r,o)=>{r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(St(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(St(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 yl(e){return new Q_({type:"transform",transform:e})}var vl=g("ZodOptional",(e,t)=>{ou.init(e,t),ee.init(e,t),e.unwrap=()=>e._zod.def.innerType});function X(e){return new vl({type:"optional",innerType:e})}var X_=g("ZodNullable",(e,t)=>{nu.init(e,t),ee.init(e,t),e.unwrap=()=>e._zod.def.innerType});function cl(e){return new X_({type:"nullable",innerType:e})}var eg=g("ZodDefault",(e,t)=>{su.init(e,t),ee.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function tg(e,t){return new eg({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var rg=g("ZodPrefault",(e,t)=>{iu.init(e,t),ee.init(e,t),e.unwrap=()=>e._zod.def.innerType});function og(e,t){return new rg({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():t}})}var $l=g("ZodNonOptional",(e,t)=>{au.init(e,t),ee.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ng(e,t){return new $l({type:"nonoptional",innerType:e,...T(t)})}var sg=g("ZodCatch",(e,t)=>{cu.init(e,t),ee.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ig(e,t){return new sg({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var ag=g("ZodPipe",(e,t)=>{uu.init(e,t),ee.init(e,t),e.in=t.in,e.out=t.out});function as(e,t){return new ag({type:"pipe",in:e,out:t})}var cg=g("ZodReadonly",(e,t)=>{lu.init(e,t),ee.init(e,t)});function ug(e){return new cg({type:"readonly",innerType:e})}var wl=g("ZodCustom",(e,t)=>{du.init(e,t),ee.init(e,t)});function lg(e){let t=new de({check:"custom"});return t._zod.check=e,t}function xl(e,t){return Wu(wl,e??(()=>!0),t)}function dg(e,t={}){return Ju(wl,e,t)}function pg(e){let t=lg((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(St(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(St(n))}},e(r.value,r)));return t}function us(e,t){return as(yl(e),t)}var bl={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 fg(e){return Du(uo,e)}xe(Hn());var Ge="2025-11-25";var fo=[Ge,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Ye="io.modelcontextprotocol/related-task",mo="2.0",se=xl((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),Sl=W([p(),L().int()]),kl=p(),UP=ne({ttl:L().optional(),pollInterval:L().optional()}),hg=S({ttl:L().optional()}),_g=S({taskId:p()}),ls=ne({progressToken:Sl.optional(),[Ye]:_g.optional()}),be=S({_meta:ls.optional()}),nr=be.extend({task:hg.optional()}),Pl=(e)=>nr.safeParse(e).success,ie=S({method:p(),params:be.loose().optional()}),ze=S({_meta:ls.optional()}),Se=S({method:p(),params:ze.loose().optional()}),ae=ne({_meta:ls.optional()}),ho=W([p(),L().int()]),Tl=S({jsonrpc:E(mo),id:ho,...ie.shape}).strict(),sr=(e)=>Tl.safeParse(e).success,El=S({jsonrpc:E(mo),...Se.shape}).strict(),Rl=(e)=>El.safeParse(e).success,ds=S({jsonrpc:E(mo),id:ho,result:ae}).strict(),pt=(e)=>ds.safeParse(e).success;var O;(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"})(O||(O={}));var ps=S({jsonrpc:E(mo),id:ho.optional(),error:S({code:L().int(),message:p(),data:Q().optional()})}).strict();var Il=(e)=>ps.safeParse(e).success;var It=W([Tl,El,ds,ps]),VP=W([ds,ps]),Me=ae.strict(),gg=ze.extend({requestId:ho.optional(),reason:p().optional()}),_o=Se.extend({method:E("notifications/cancelled"),params:gg}),yg=S({src:p(),mimeType:p().optional(),sizes:z(p()).optional(),theme:ge(["light","dark"]).optional()}),ir=S({icons:z(yg).optional()}),Rt=S({name:p(),title:p().optional()}),Cl=Rt.extend({...Rt.shape,...ir.shape,version:p(),websiteUrl:p().optional(),description:p().optional()}),vg=lo(S({applyDefaults:V().optional()}),K(p(),Q())),$g=us((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},lo(S({form:vg.optional(),url:se.optional()}),K(p(),Q()).optional())),wg=ne({list:se.optional(),cancel:se.optional(),requests:ne({sampling:ne({createMessage:se.optional()}).optional(),elicitation:ne({create:se.optional()}).optional()}).optional()}),xg=ne({list:se.optional(),cancel:se.optional(),requests:ne({tools:ne({call:se.optional()}).optional()}).optional()}),bg=S({experimental:K(p(),se).optional(),sampling:S({context:se.optional(),tools:se.optional()}).optional(),elicitation:$g.optional(),roots:S({listChanged:V().optional()}).optional(),tasks:wg.optional(),extensions:K(p(),se).optional()}),zg=be.extend({protocolVersion:p(),capabilities:bg,clientInfo:Cl}),fs=ie.extend({method:E("initialize"),params:zg});var Sg=S({experimental:K(p(),se).optional(),logging:se.optional(),completions:se.optional(),prompts:S({listChanged:V().optional()}).optional(),resources:S({subscribe:V().optional(),listChanged:V().optional()}).optional(),tools:S({listChanged:V().optional()}).optional(),tasks:xg.optional(),extensions:K(p(),se).optional()}),ms=ae.extend({protocolVersion:p(),capabilities:Sg,serverInfo:Cl,instructions:p().optional()}),go=Se.extend({method:E("notifications/initialized"),params:ze.optional()}),Ol=(e)=>go.safeParse(e).success,yo=ie.extend({method:E("ping"),params:be.optional()}),kg=S({progress:L(),total:X(L()),message:X(p())}),Pg=S({...ze.shape,...kg.shape,progressToken:Sl}),vo=Se.extend({method:E("notifications/progress"),params:Pg}),Tg=be.extend({cursor:kl.optional()}),ar=ie.extend({params:Tg.optional()}),cr=ae.extend({nextCursor:kl.optional()}),Eg=ge(["working","input_required","completed","failed","cancelled"]),ur=S({taskId:p(),status:Eg,ttl:W([L(),ml()]),createdAt:p(),lastUpdatedAt:p(),pollInterval:X(L()),statusMessage:X(p())}),De=ae.extend({task:ur}),Rg=ze.merge(ur),lr=Se.extend({method:E("notifications/tasks/status"),params:Rg}),$o=ie.extend({method:E("tasks/get"),params:be.extend({taskId:p()})}),wo=ae.merge(ur),xo=ie.extend({method:E("tasks/result"),params:be.extend({taskId:p()})}),FP=ae.loose(),bo=ar.extend({method:E("tasks/list")}),zo=cr.extend({tasks:z(ur)}),So=ie.extend({method:E("tasks/cancel"),params:be.extend({taskId:p()})}),jl=ae.merge(ur),Nl=S({uri:p(),mimeType:X(p()),_meta:K(p(),Q()).optional()}),Al=Nl.extend({text:p()}),hs=p().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Zl=Nl.extend({blob:hs}),dr=ge(["user","assistant"]),Ct=S({audience:z(dr).optional(),priority:L().min(0).max(1).optional(),lastModified:ns({offset:!0}).optional()}),ql=S({...Rt.shape,...ir.shape,uri:p(),description:X(p()),mimeType:X(p()),size:X(L()),annotations:Ct.optional(),_meta:X(ne({}))}),Ig=S({...Rt.shape,...ir.shape,uriTemplate:p(),description:X(p()),mimeType:X(p()),annotations:Ct.optional(),_meta:X(ne({}))}),Cg=ar.extend({method:E("resources/list")}),_s=cr.extend({resources:z(ql)}),Og=ar.extend({method:E("resources/templates/list")}),gs=cr.extend({resourceTemplates:z(Ig)}),ys=be.extend({uri:p()}),jg=ys,Ng=ie.extend({method:E("resources/read"),params:jg}),vs=ae.extend({contents:z(W([Al,Zl]))}),$s=Se.extend({method:E("notifications/resources/list_changed"),params:ze.optional()}),Ag=ys,Zg=ie.extend({method:E("resources/subscribe"),params:Ag}),qg=ys,Mg=ie.extend({method:E("resources/unsubscribe"),params:qg}),Dg=ze.extend({uri:p()}),Lg=Se.extend({method:E("notifications/resources/updated"),params:Dg}),Ug=S({name:p(),description:X(p()),required:X(V())}),Vg=S({...Rt.shape,...ir.shape,description:X(p()),arguments:X(z(Ug)),_meta:X(ne({}))}),Fg=ar.extend({method:E("prompts/list")}),ws=cr.extend({prompts:z(Vg)}),Hg=be.extend({name:p(),arguments:K(p(),p()).optional()}),Kg=ie.extend({method:E("prompts/get"),params:Hg}),xs=S({type:E("text"),text:p(),annotations:Ct.optional(),_meta:K(p(),Q()).optional()}),bs=S({type:E("image"),data:hs,mimeType:p(),annotations:Ct.optional(),_meta:K(p(),Q()).optional()}),zs=S({type:E("audio"),data:hs,mimeType:p(),annotations:Ct.optional(),_meta:K(p(),Q()).optional()}),Bg=S({type:E("tool_use"),name:p(),id:p(),input:K(p(),Q()),_meta:K(p(),Q()).optional()}),Wg=S({type:E("resource"),resource:W([Al,Zl]),annotations:Ct.optional(),_meta:K(p(),Q()).optional()}),Jg=ql.extend({type:E("resource_link")}),Ss=W([xs,bs,zs,Jg,Wg]),Gg=S({role:dr,content:Ss}),ks=ae.extend({description:p().optional(),messages:z(Gg)}),Ps=Se.extend({method:E("notifications/prompts/list_changed"),params:ze.optional()}),Yg=S({title:p().optional(),readOnlyHint:V().optional(),destructiveHint:V().optional(),idempotentHint:V().optional(),openWorldHint:V().optional()}),Qg=S({taskSupport:ge(["required","optional","forbidden"]).optional()}),Ml=S({...Rt.shape,...ir.shape,description:p().optional(),inputSchema:S({type:E("object"),properties:K(p(),se).optional(),required:z(p()).optional()}).catchall(Q()),outputSchema:S({type:E("object"),properties:K(p(),se).optional(),required:z(p()).optional()}).catchall(Q()).optional(),annotations:Yg.optional(),execution:Qg.optional(),_meta:K(p(),Q()).optional()}),Ts=ar.extend({method:E("tools/list")}),Es=cr.extend({tools:z(Ml)}),Qe=ae.extend({content:z(Ss).default([]),structuredContent:K(p(),Q()).optional(),isError:V().optional()}),HP=Qe.or(ae.extend({toolResult:Q()})),Xg=nr.extend({name:p(),arguments:K(p(),Q()).optional()}),pr=ie.extend({method:E("tools/call"),params:Xg}),fr=Se.extend({method:E("notifications/tools/list_changed"),params:ze.optional()}),Dl=S({autoRefresh:V().default(!0),debounceMs:L().int().nonnegative().default(300)}),mr=ge(["debug","info","notice","warning","error","critical","alert","emergency"]),ey=be.extend({level:mr}),Rs=ie.extend({method:E("logging/setLevel"),params:ey}),ty=ze.extend({level:mr,logger:p().optional(),data:Q()}),ry=Se.extend({method:E("notifications/message"),params:ty}),oy=S({name:p().optional()}),ny=S({hints:z(oy).optional(),costPriority:L().min(0).max(1).optional(),speedPriority:L().min(0).max(1).optional(),intelligencePriority:L().min(0).max(1).optional()}),sy=S({mode:ge(["auto","required","none"]).optional()}),iy=S({type:E("tool_result"),toolUseId:p().describe("The unique identifier for the corresponding tool call."),content:z(Ss).default([]),structuredContent:S({}).loose().optional(),isError:V().optional(),_meta:K(p(),Q()).optional()}),ay=cs("type",[xs,bs,zs]),po=cs("type",[xs,bs,zs,Bg,iy]),cy=S({role:dr,content:W([po,z(po)]),_meta:K(p(),Q()).optional()}),uy=nr.extend({messages:z(cy),modelPreferences:ny.optional(),systemPrompt:p().optional(),includeContext:ge(["none","thisServer","allServers"]).optional(),temperature:L().optional(),maxTokens:L().int(),stopSequences:z(p()).optional(),metadata:se.optional(),tools:z(Ml).optional(),toolChoice:sy.optional()}),Is=ie.extend({method:E("sampling/createMessage"),params:uy}),ft=ae.extend({model:p(),stopReason:X(ge(["endTurn","stopSequence","maxTokens"]).or(p())),role:dr,content:ay}),hr=ae.extend({model:p(),stopReason:X(ge(["endTurn","stopSequence","maxTokens","toolUse"]).or(p())),role:dr,content:W([po,z(po)])}),ly=S({type:E("boolean"),title:p().optional(),description:p().optional(),default:V().optional()}),dy=S({type:E("string"),title:p().optional(),description:p().optional(),minLength:L().optional(),maxLength:L().optional(),format:ge(["email","uri","date","date-time"]).optional(),default:p().optional()}),py=S({type:ge(["number","integer"]),title:p().optional(),description:p().optional(),minimum:L().optional(),maximum:L().optional(),default:L().optional()}),fy=S({type:E("string"),title:p().optional(),description:p().optional(),enum:z(p()),default:p().optional()}),my=S({type:E("string"),title:p().optional(),description:p().optional(),oneOf:z(S({const:p(),title:p()})),default:p().optional()}),hy=S({type:E("string"),title:p().optional(),description:p().optional(),enum:z(p()),enumNames:z(p()).optional(),default:p().optional()}),_y=W([fy,my]),gy=S({type:E("array"),title:p().optional(),description:p().optional(),minItems:L().optional(),maxItems:L().optional(),items:S({type:E("string"),enum:z(p())}),default:z(p()).optional()}),yy=S({type:E("array"),title:p().optional(),description:p().optional(),minItems:L().optional(),maxItems:L().optional(),items:S({anyOf:z(S({const:p(),title:p()}))}),default:z(p()).optional()}),vy=W([gy,yy]),$y=W([hy,_y,vy]),wy=W([$y,ly,dy,py]),xy=nr.extend({mode:E("form").optional(),message:p(),requestedSchema:S({type:E("object"),properties:K(p(),wy),required:z(p()).optional()})}),by=nr.extend({mode:E("url"),message:p(),elicitationId:p(),url:p().url()}),zy=W([xy,by]),Cs=ie.extend({method:E("elicitation/create"),params:zy}),Sy=ze.extend({elicitationId:p()}),ky=Se.extend({method:E("notifications/elicitation/complete"),params:Sy}),Xe=ae.extend({action:ge(["accept","decline","cancel"]),content:us((e)=>e===null?void 0:e,K(p(),W([p(),L(),V(),z(p())])).optional())}),Py=S({type:E("ref/resource"),uri:p()});var Ty=S({type:E("ref/prompt"),name:p()}),Ey=be.extend({ref:W([Ty,Py]),argument:S({name:p(),value:p()}),context:S({arguments:K(p(),p()).optional()}).optional()}),Ry=ie.extend({method:E("completion/complete"),params:Ey});var Os=ae.extend({completion:ne({values:z(p()).max(100),total:X(L().int()),hasMore:X(V())})}),Iy=S({uri:p().startsWith("file://"),name:p().optional(),_meta:K(p(),Q()).optional()}),Cy=ie.extend({method:E("roots/list"),params:be.optional()}),js=ae.extend({roots:z(Iy)}),Oy=Se.extend({method:E("notifications/roots/list_changed"),params:ze.optional()}),KP=W([yo,fs,Ry,Rs,Kg,Fg,Cg,Og,Ng,Zg,Mg,pr,Ts,$o,xo,bo,So]),BP=W([_o,vo,go,Oy,lr]),WP=W([Me,ft,hr,Xe,js,wo,zo,De]),JP=W([yo,Is,Cs,Cy,$o,xo,bo,So]),GP=W([_o,vo,ry,Lg,$s,fr,Ps,lr,ky]),YP=W([Me,ms,Os,ks,ws,_s,gs,vs,Qe,Es,wo,zo,De]);class R 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===O.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new Ll(o.elicitations,t)}return new R(e,t,r)}}class Ll extends R{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(O.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function et(e){return e==="completed"||e==="failed"||e==="cancelled"}var jy=Symbol("Let zodToJsonSchema decide on which parser to use");var RT=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ns(e){let r=Et(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=Gu(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function As(e,t){let r=fe(e,t);if(!r.success)throw r.error;return r.data}var Dy=60000;class gr{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(_o,(t)=>{this._oncancel(t)}),this.setNotificationHandler(vo,(t)=>{this._onprogress(t)}),this.setRequestHandler(yo,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler($o,async(t,r)=>{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new R(O.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(xo,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 R(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 R(O.InvalidParams,`Task not found: ${n}`);if(!et(s.status))return await this._waitForTaskUpdate(n,r.signal),await o();if(et(s.status)){let i=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...i,_meta:{...i._meta,[Ye]:{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 R(O.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(So,async(t,r)=>{try{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new R(O.InvalidParams,`Task not found: ${t.params.taskId}`);if(et(o.status))throw new R(O.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 R(O.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(o){if(o instanceof R)throw o;throw new R(O.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),R.fromError(O.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),pt(n)||Il(n))this._onresponse(n);else if(sr(n))this._onrequest(n,s);else if(Rl(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=R.fromError(O.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?.[Ye]?.taskId;if(r===void 0){let c={jsonrpc:"2.0",id:e.id,error:{code:O.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=Pl(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 R(O.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:O.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),pt(e))r(e);else{let s=new R(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(pt(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(pt(e))o(e);else{let s=R.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 R?s:new R(O.InternalError,String(s))}}return}let n;try{let s=await this.request(e,De,r);if(s.task)n=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new R(O.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:i},et(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 R(O.InternalError,`Task ${n} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new R(O.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 R?s:new R(O.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=(v)=>{c(v)};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(v){l(v);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||{},[Ye]:a}};let m=(v)=>{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(v)}},{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((b)=>this._onerror(Error(`Failed to send cancellation: ${b}`)));let k=v instanceof R?v:new R(O.RequestTimeout,String(v));c(k)};this._responseHandlers.set(d,(v)=>{if(r?.signal?.aborted)return;if(v instanceof Error)return c(v);try{let k=fe(t,v.result);if(!k.success)c(k.error);else u(k.data)}catch(k){c(k)}}),r?.signal?.addEventListener("abort",()=>{m(r?.signal?.reason)});let h=r?.timeout??Dy,_=()=>m(R.fromError(O.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(d,h,r?.maxTotalTimeout,_,r?.resetTimeoutOnProgress??!1);let w=a?.taskId;if(w){let v=(k)=>{let b=this._responseHandlers.get(d);if(b)b(k);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,v),this._enqueueTaskMessage(w,{type:"request",message:f,timestamp:Date.now()}).catch((k)=>{this._cleanupTimeout(d),c(k)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((v)=>{this._cleanupTimeout(d),c(v)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},wo,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},zo,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},jl,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||{},[Ye]: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||{},[Ye]: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||{},[Ye]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=Ns(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,n)=>{let s=As(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=Ns(e);this._notificationHandlers.set(r,(o)=>{let n=As(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"&&sr(o.message)){let n=o.message.id,s=this._requestResolvers.get(n);if(s)s(new R(O.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 R(O.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(s),n(new R(O.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 R(O.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=lr.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),et(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 R(O.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(et(i.status))throw new R(O.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=lr.parse({method:"notifications/tasks/status",params:a});if(await this.notification(u),et(a.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>r.listTasks(o,t)}}}function Ul(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ko(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(Ul(i)&&Ul(s))r[n]={...i,...s};else r[n]=s}return r}var Sh=ua(Ii(),1),kh=ua(zh(),1);function cS(){let e=new Sh.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return kh.default(e),e}class Lr{constructor(e){this._ajv=e??cS()}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 Li{constructor(e){this._client=e}async*callToolStream(e,t=Qe,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 R(O.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 R(O.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)};return}}catch(c){if(c instanceof R){yield{type:"error",error:c};return}yield{type:"error",error:new R(O.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 ln(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 pn(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)pn(s,r[n])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")pn(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")pn(r,t)}}function uS(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 Ui extends gr{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 Lr,t?.listChanged)this._pendingListChangedConfig=t.listChanged}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",fr,e.tools,async()=>(await this.listTools()).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",Ps,e.prompts,async()=>(await this.listPrompts()).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",$s,e.resources,async()=>(await this.listResources()).resources)}get experimental(){if(!this._experimental)this._experimental={tasks:new Li(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=ko(this._capabilities,e)}setRequestHandler(e,t){let o=Et(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(Je(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=fe(Cs,a);if(!c.success){let v=c.error instanceof Error?c.error.message:String(c.error);throw new R(O.InvalidParams,`Invalid elicitation request: ${v}`)}let{params:l}=c.data;l.mode=l.mode??"form";let{supportsFormMode:d,supportsUrlMode:f}=uS(this._capabilities.elicitation);if(l.mode==="form"&&!d)throw new R(O.InvalidParams,"Client does not support form-mode elicitation requests");if(l.mode==="url"&&!f)throw new R(O.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(t(a,u));if(l.task){let v=fe(De,m);if(!v.success){let k=v.error instanceof Error?v.error.message:String(v.error);throw new R(O.InvalidParams,`Invalid task creation result: ${k}`)}return v.data}let h=fe(Xe,m);if(!h.success){let v=h.error instanceof Error?h.error.message:String(h.error);throw new R(O.InvalidParams,`Invalid elicitation result: ${v}`)}let _=h.data,w=l.mode==="form"?l.requestedSchema:void 0;if(l.mode==="form"&&_.action==="accept"&&_.content&&w){if(this._capabilities.elicitation?.form?.applyDefaults)try{pn(w,_.content)}catch{}}return _};return super.setRequestHandler(e,i)}if(s==="sampling/createMessage"){let i=async(a,u)=>{let c=fe(Is,a);if(!c.success){let _=c.error instanceof Error?c.error.message:String(c.error);throw new R(O.InvalidParams,`Invalid sampling request: ${_}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let _=fe(De,d);if(!_.success){let w=_.error instanceof Error?_.error.message:String(_.error);throw new R(O.InvalidParams,`Invalid task creation result: ${w}`)}return _.data}let m=l.tools||l.toolChoice?hr:ft,h=fe(m,d);if(!h.success){let _=h.error instanceof Error?h.error.message:String(h.error);throw new R(O.InvalidParams,`Invalid sampling result: ${_}`)}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:Ge,capabilities:this._capabilities,clientInfo:this._clientInfo}},ms,t);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);if(!fo.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){ln(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"},Me,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Os,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},Me,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},ks,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},ws,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},_s,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},gs,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},vs,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},Me,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},Me,t)}async callTool(e,t=Qe,r){if(this.isToolTaskRequired(e.name))throw new R(O.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 R(O.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 R(O.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){if(s instanceof R)throw s;throw new R(O.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},Es,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,o){let n=Dl.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 fn(e){if(!e)return{};if(e instanceof Headers)return Object.fromEntries(e.entries());if(Array.isArray(e))return Object.fromEntries(e);return{...e}}function Ph(e=fetch,t){if(!t)return e;return async(r,o)=>{let n={...t,...o,headers:o?.headers?{...fn(t.headers),...fn(o.headers)}:t.headers};return e(r,n)}}var Vi;Vi=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then((e)=>e.webcrypto);async function lS(e){return(await Vi).getRandomValues(new Uint8Array(e))}async function dS(e){let r=Math.pow(2,8)-Math.pow(2,8)%66,o="";while(o.length<e){let n=await lS(e-o.length);for(let s of n)if(s<r)o+="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"[s%66]}return o}async function pS(e){return await dS(e)}async function fS(e){let t=await(await Vi).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function Fi(e){if(!e)e=43;if(e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await pS(e),r=await fS(t);return{code_verifier:t,code_challenge:r}}var le=pl().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:bl.custom,message:"URL must be parseable",fatal:!0}),Pn}).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"}),Eh=ne({resource:p().url(),authorization_servers:z(le).optional(),jwks_uri:p().url().optional(),scopes_supported:z(p()).optional(),bearer_methods_supported:z(p()).optional(),resource_signing_alg_values_supported:z(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:V().optional(),authorization_details_types_supported:z(p()).optional(),dpop_signing_alg_values_supported:z(p()).optional(),dpop_bound_access_tokens_required:V().optional()}),Hi=ne({issuer:p(),authorization_endpoint:le,token_endpoint:le,registration_endpoint:le.optional(),scopes_supported:z(p()).optional(),response_types_supported:z(p()),response_modes_supported:z(p()).optional(),grant_types_supported:z(p()).optional(),token_endpoint_auth_methods_supported:z(p()).optional(),token_endpoint_auth_signing_alg_values_supported:z(p()).optional(),service_documentation:le.optional(),revocation_endpoint:le.optional(),revocation_endpoint_auth_methods_supported:z(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:z(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:z(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:z(p()).optional(),code_challenge_methods_supported:z(p()).optional(),client_id_metadata_document_supported:V().optional()}),mS=ne({issuer:p(),authorization_endpoint:le,token_endpoint:le,userinfo_endpoint:le.optional(),jwks_uri:le,registration_endpoint:le.optional(),scopes_supported:z(p()).optional(),response_types_supported:z(p()),response_modes_supported:z(p()).optional(),grant_types_supported:z(p()).optional(),acr_values_supported:z(p()).optional(),subject_types_supported:z(p()),id_token_signing_alg_values_supported:z(p()),id_token_encryption_alg_values_supported:z(p()).optional(),id_token_encryption_enc_values_supported:z(p()).optional(),userinfo_signing_alg_values_supported:z(p()).optional(),userinfo_encryption_alg_values_supported:z(p()).optional(),userinfo_encryption_enc_values_supported:z(p()).optional(),request_object_signing_alg_values_supported:z(p()).optional(),request_object_encryption_alg_values_supported:z(p()).optional(),request_object_encryption_enc_values_supported:z(p()).optional(),token_endpoint_auth_methods_supported:z(p()).optional(),token_endpoint_auth_signing_alg_values_supported:z(p()).optional(),display_values_supported:z(p()).optional(),claim_types_supported:z(p()).optional(),claims_supported:z(p()).optional(),service_documentation:p().optional(),claims_locales_supported:z(p()).optional(),ui_locales_supported:z(p()).optional(),claims_parameter_supported:V().optional(),request_parameter_supported:V().optional(),request_uri_parameter_supported:V().optional(),require_request_uri_registration:V().optional(),op_policy_uri:le.optional(),op_tos_uri:le.optional(),client_id_metadata_document_supported:V().optional()}),Rh=S({...mS.shape,...Hi.pick({code_challenge_methods_supported:!0}).shape}),Ih=S({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:fg().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),Ch=S({error:p(),error_description:p().optional(),error_uri:p().optional()}),Th=le.optional().or(E("").transform(()=>{return})),hS=S({redirect_uris:z(le),token_endpoint_auth_method:p().optional(),grant_types:z(p()).optional(),response_types:z(p()).optional(),client_name:p().optional(),client_uri:le.optional(),logo_uri:Th,scope:p().optional(),contacts:z(p()).optional(),tos_uri:Th,policy_uri:p().optional(),jwks_uri:le.optional(),jwks:hl().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),_S=S({client_id:p(),client_secret:p().optional(),client_id_issued_at:L().optional(),client_secret_expires_at:L().optional()}).strip(),Oh=hS.merge(_S),TO=S({error:p(),error_description:p().optional()}).strip(),EO=S({token:p(),token_type_hint:p().optional()}).strip();function jh(e){let t=typeof e==="string"?new URL(e):new URL(e.href);return t.hash="",t}function Nh({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 oe 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 mn extends oe{}mn.errorCode="invalid_request";class Kt extends oe{}Kt.errorCode="invalid_client";class Bt extends oe{}Bt.errorCode="invalid_grant";class Wt extends oe{}Wt.errorCode="unauthorized_client";class hn extends oe{}hn.errorCode="unsupported_grant_type";class _n extends oe{}_n.errorCode="invalid_scope";class gn extends oe{}gn.errorCode="access_denied";class ct extends oe{}ct.errorCode="server_error";class yn extends oe{}yn.errorCode="temporarily_unavailable";class vn extends oe{}vn.errorCode="unsupported_response_type";class $n extends oe{}$n.errorCode="unsupported_token_type";class wn extends oe{}wn.errorCode="invalid_token";class xn extends oe{}xn.errorCode="method_not_allowed";class bn extends oe{}bn.errorCode="too_many_requests";class Jt extends oe{}Jt.errorCode="invalid_client_metadata";class zn extends oe{}zn.errorCode="insufficient_scope";class Sn extends oe{}Sn.errorCode="invalid_target";var Ah={[mn.errorCode]:mn,[Kt.errorCode]:Kt,[Bt.errorCode]:Bt,[Wt.errorCode]:Wt,[hn.errorCode]:hn,[_n.errorCode]:_n,[gn.errorCode]:gn,[ct.errorCode]:ct,[yn.errorCode]:yn,[vn.errorCode]:vn,[$n.errorCode]:$n,[wn.errorCode]:wn,[xn.errorCode]:xn,[bn.errorCode]:bn,[Jt.errorCode]:Jt,[zn.errorCode]:zn,[Sn.errorCode]:Sn};class ut extends Error{constructor(e){super(e??"Unauthorized")}}function gS(e){return["client_secret_basic","client_secret_post","none"].includes(e)}var Ki="code",Bi="S256";function yS(e,t){let r=e.client_secret!==void 0;if("token_endpoint_auth_method"in e&&e.token_endpoint_auth_method&&gS(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 vS(e,t,r,o){let{client_id:n,client_secret:s}=t;switch(e){case"client_secret_basic":$S(n,s,r);return;case"client_secret_post":wS(n,s,o);return;case"none":xS(n,o);return;default:throw Error(`Unsupported client authentication method: ${e}`)}}function $S(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 wS(e,t,r){if(r.set("client_id",e),t)r.set("client_secret",t)}function xS(e,t){t.set("client_id",e)}async function qh(e){let t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{let o=Ch.parse(JSON.parse(r)),{error:n,error_description:s,error_uri:i}=o;return new(Ah[n]||ct)(s||"",i)}catch(o){let n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new ct(n)}}async function Ur(e,t){try{return await Wi(e,t)}catch(r){if(r instanceof Kt||r instanceof Wt)return await e.invalidateCredentials?.("all"),await Wi(e,t);else if(r instanceof Bt)return await e.invalidateCredentials?.("tokens"),await Wi(e,t);throw r}}async function Wi(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 Dh(u,{fetchFn:s}),!a)try{a=await Mh(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 b=await ES(t,{resourceMetadataUrl:l,fetchFn:s});u=b.authorizationServerUrl,c=b.authorizationServerMetadata,a=b.resourceMetadata,await e.saveDiscoveryState?.({authorizationServerUrl:String(u),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:c})}let d=await zS(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 b=c?.client_id_metadata_document_supported===!0,C=e.clientMetadataUrl;if(C&&!bS(C))throw new Jt(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${C}`);if(b&&C)m={client_id:C},await e.saveClientInformation?.(m);else{if(!e.saveClientInformation)throw Error("OAuth client information must be saveable for dynamic registration");let x=await jS(u,{metadata:c,clientMetadata:e.clientMetadata,scope:f,fetchFn:s});await e.saveClientInformation(x),m=x}}let h=!e.redirectUrl;if(r!==void 0||h){let b=await OS(e,u,{metadata:c,resource:d,authorizationCode:r,fetchFn:s});return await e.saveTokens(b),"AUTHORIZED"}let _=await e.tokens();if(_?.refresh_token)try{let b=await CS(u,{metadata:c,clientInformation:m,refreshToken:_.refresh_token,resource:d,addClientAuthentication:e.addClientAuthentication,fetchFn:s});return await e.saveTokens(b),"AUTHORIZED"}catch(b){if(!(b instanceof oe)||b instanceof ct);else throw b}let w=e.state?await e.state():void 0,{authorizationUrl:v,codeVerifier:k}=await RS(u,{metadata:c,clientInformation:m,state:w,redirectUrl:e.redirectUrl,scope:f,resource:d});return await e.saveCodeVerifier(k),await e.redirectToAuthorization(v),"REDIRECT"}function bS(e){if(!e)return!1;try{let t=new URL(e);return t.protocol==="https:"&&t.pathname!=="/"}catch{return!1}}async function zS(e,t,r){let o=jh(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(!r)return;if(!Nh({requestedResource:o,configuredResource:r.resource}))throw Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}function Gi(e){let t=e.headers.get("WWW-Authenticate");if(!t)return{};let[r,o]=t.split(" ");if(r.toLowerCase()!=="bearer"||!o)return{};let n=Ji(e,"resource_metadata")||void 0,s;if(n)try{s=new URL(n)}catch{}let i=Ji(e,"scope")||void 0,a=Ji(e,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function Ji(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 Mh(e,t,r=fetch){let o=await PS(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 Eh.parse(await o.json())}async function Yi(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)if(t)return Yi(e,void 0,r);else return;throw o}}function SS(e,t="",r={}){if(t.endsWith("/"))t=t.slice(0,-1);return r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function Zh(e,t,r=fetch){return await Yi(e,{"MCP-Protocol-Version":t},r)}function kS(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function PS(e,t,r,o){let n=new URL(e),s=o?.protocolVersion??Ge,i;if(o?.metadataUrl)i=new URL(o.metadataUrl);else{let u=SS(t,n.pathname);i=new URL(u,o?.metadataServerUrl??n),i.search=n.search}let a=await Zh(i,s,r);if(!o?.metadataUrl&&kS(a,n.pathname)){let u=new URL(`/.well-known/${t}`,n);a=await Zh(u,s,r)}return a}function TS(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 Dh(e,{fetchFn:t=fetch,protocolVersion:r=Ge}={}){let o={"MCP-Protocol-Version":r,Accept:"application/json"},n=TS(e);for(let{url:s,type:i}of n){let a=await Yi(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 Hi.parse(await a.json());else return Rh.parse(await a.json())}return}async function ES(e,t){let r,o;try{if(r=await Mh(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 Dh(o,{fetchFn:t?.fetchFn});return{authorizationServerUrl:o,authorizationServerMetadata:n,resourceMetadata:r}}async function RS(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(Ki))throw Error(`Incompatible auth server: does not support response type ${Ki}`);if(t.code_challenge_methods_supported&&!t.code_challenge_methods_supported.includes(Bi))throw Error(`Incompatible auth server: does not support code challenge method ${Bi}`)}else a=new URL("/authorize",e);let u=await Fi(),{code_verifier:c,code_challenge:l}=u;if(a.searchParams.set("response_type",Ki),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",Bi),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 IS(e,t,r){return new URLSearchParams({grant_type:"authorization_code",code:e,code_verifier:t,redirect_uri:String(r)})}async function Lh(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=yS(o,l);vS(d,o,u,r)}let c=await(i??fetch)(a,{method:"POST",headers:u,body:r});if(!c.ok)throw await qh(c);return Ih.parse(await c.json())}async function CS(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 Lh(e,{metadata:t,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:n,fetchFn:i});return{refresh_token:o,...u}}async function OS(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=IS(n,c,e.redirectUrl)}let u=await e.clientInformation();return Lh(t,{metadata:r,tokenRequestParams:a,clientInformation:u??void 0,addClientAuthentication:e.addClientAuthentication,resource:o,fetchFn:s})}async function jS(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 qh(i);return Oh.parse(await i.json())}class kn 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 Uh=10,NS=13,wt=32;function Qi(e){}function Hh(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=Qi,onError:r=Qi,onRetry:o=Qi,onComment:n,maxBufferSize:s}=e,i=[],a=0,u=!0,c,l="",d=0,f,m=!1;function h(y){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,y.charCodeAt(0)===239&&y.charCodeAt(1)===187&&y.charCodeAt(2)===191&&(y=y.slice(3))),i.length===0){let G=w(y);G!==""&&(i.push(G),a=G.length),_();return}if(y.indexOf(`
35
+ `)===-1&&y.indexOf("\r")===-1){i.push(y),a+=y.length,_();return}i.push(y);let x=i.join("");i.length=0,a=0;let j=w(x);j!==""&&(i.push(j),a=j.length),_()}function _(){s!==void 0&&(a+l.length<=s||(m=!0,i.length=0,a=0,c=void 0,l="",d=0,f=void 0,r(new kn(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function w(y){let x=0;if(y.indexOf("\r")===-1){let j=y.indexOf(`
36
+ `,x);for(;j!==-1;){if(x===j){d>0&&t({id:c,event:f,data:l}),c=void 0,l="",d=0,f=void 0,x=j+1,j=y.indexOf(`
37
+ `,x);continue}let G=y.charCodeAt(x);if(Vh(y,x,G)){let te=y.charCodeAt(x+5)===wt?x+6:x+5,_e=y.slice(te,j);if(d===0&&y.charCodeAt(j+1)===Uh){t({id:c,event:f,data:_e}),c=void 0,l="",f=void 0,x=j+2,j=y.indexOf(`
38
+ `,x);continue}l=d===0?_e:`${l}
39
+ ${_e}`,d++}else Fh(y,x,G)?f=y.slice(y.charCodeAt(x+6)===wt?x+7:x+6,j)||void 0:v(y,x,j);x=j+1,j=y.indexOf(`
40
+ `,x)}return y.slice(x)}for(;x<y.length;){let j=y.indexOf("\r",x),G=y.indexOf(`
41
+ `,x),te=-1;if(j!==-1&&G!==-1?te=j<G?j:G:j!==-1?j===y.length-1?te=-1:te=j:G!==-1&&(te=G),te===-1)break;v(y,x,te),x=te+1,y.charCodeAt(x-1)===NS&&y.charCodeAt(x)===Uh&&x++}return y.slice(x)}function v(y,x,j){if(x===j){b();return}let G=y.charCodeAt(x);if(Vh(y,x,G)){let Ke=y.charCodeAt(x+5)===wt?x+6:x+5,ia=y.slice(Ke,j);l=d===0?ia:`${l}
42
+ ${ia}`,d++;return}if(Fh(y,x,G)){f=y.slice(y.charCodeAt(x+6)===wt?x+7:x+6,j)||void 0;return}if(G===105&&y.charCodeAt(x+1)===100&&y.charCodeAt(x+2)===58){let Ke=y.slice(y.charCodeAt(x+3)===wt?x+4:x+3,j);c=Ke.includes("\x00")?void 0:Ke;return}if(G===58){if(n){let Ke=y.slice(x,j);n(Ke.slice(y.charCodeAt(x+1)===wt?2:1))}return}let te=y.slice(x,j),_e=te.indexOf(":");if(_e===-1){k(te,"",te);return}let Gt=te.slice(0,_e),Vr=te.charCodeAt(_e+1)===wt?2:1,Fr=te.slice(_e+Vr);k(Gt,Fr,te)}function k(y,x,j){switch(y){case"event":f=x||void 0;break;case"data":l=d===0?x:`${l}
43
+ ${x}`,d++;break;case"id":c=x.includes("\x00")?void 0:x;break;case"retry":/^\d+$/.test(x)?o(parseInt(x,10)):r(new kn(`Invalid \`retry\` value: "${x}"`,{type:"invalid-retry",value:x,line:j}));break;default:r(new kn(`Unknown field "${y.length>20?`${y.slice(0,20)}…`:y}"`,{type:"unknown-field",field:y,value:x,line:j}));break}}function b(){d>0&&t({id:c,event:f,data:l}),c=void 0,l="",d=0,f=void 0}function C(y={}){if(y.consume&&i.length>0){let x=i.join("");v(x,0,x.length)}u=!0,c=void 0,l="",d=0,f=void 0,i.length=0,a=0,m=!1}return{feed:h,reset:C}}function Vh(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 Fh(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 Xi extends TransformStream{constructor({onError:e,onRetry:t,onComment:r,maxBufferSize:o}={}){let n;super({start(s){n=Hh({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 AS={initialReconnectionDelay:1000,maxReconnectionDelay:30000,reconnectionDelayGrowFactor:1.5,maxRetries:2};class xt extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`);this.code=e}}class ea{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=Ph(t?.fetch,t?.requestInit),this._sessionId=t?.sessionId,this._reconnectionOptions=t?.reconnectionOptions??AS}async _authThenStart(){if(!this._authProvider)throw new ut("No auth provider");let e;try{e=await Ur(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 ut;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=fn(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 xt(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 Xi({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=It.parse(JSON.parse(f.data));if(pt(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 ut("No auth provider");if(await Ur(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ut("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:sr(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 xt(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:f,scope:m}=Gi(i);if(this._resourceMetadataUrl=f,this._scope=m,await Ur(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ut;return this._hasCompletedAuthFlow=!0,this.send(e)}if(i.status===403&&this._authProvider){let{resourceMetadataUrl:f,scope:m,error:h}=Gi(i);if(h==="insufficient_scope"){let _=i.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===_)throw new xt(403,"Server returned 403 after trying upscoping");if(m)this._scope=m;if(f)this._resourceMetadataUrl=f;if(this._lastUpscopingHeader=_??void 0,await Ur(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new ut;return this.send(e)}}throw new xt(i.status,`Error POSTing to endpoint: ${d}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,i.status===202){if(await i.body?.cancel(),Ol(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)=>It.parse(m)):[It.parse(d)];for(let m of f)this.onmessage?.(m)}else throw await i.body?.cancel(),new xt(-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 xt(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 ta{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},ft,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},Xe,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 ra extends gr{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(mr.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 Lr,this.setRequestHandler(fs,(r)=>this._oninitialize(r)),this.setNotificationHandler(go,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(Rs,async(r,o)=>{let n=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=mr.safeParse(s);if(i.success)this._loggingLevels.set(n,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new ta(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=ko(this._capabilities,e)}setRequestHandler(e,t){let o=Et(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(Je(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=fe(pr,a);if(!c.success){let m=c.error instanceof Error?c.error.message:String(c.error);throw new R(O.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let m=fe(De,d);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new R(O.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=fe(Qe,d);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(O.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;ln(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:fo.includes(t)?t:Ge,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"},Me)}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},hr,t);return this.request({method:"sampling/createMessage",params:e},ft,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},Xe,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},Xe,t);if(n.action==="accept"&&n.content&&o.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(o.requestedSchema)(n.content);if(!i.valid)throw new R(O.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof R)throw s;throw new R(O.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},js,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 Bh from"node:process";class oa{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
44
+ `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),ZS(t)}clear(){this._buffer=void 0}}function ZS(e){return It.parse(JSON.parse(e))}function Kh(e){return JSON.stringify(e)+`
45
+ `}class na{constructor(e=Bh.stdin,t=Bh.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new oa,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=Kh(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var sa={name:"@stophy/mcp",version:"2.0.0",description:"Public web data for AI agents. Connects your MCP app to the hosted Stophy server.",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","youtube","reddit","scraping"],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 MS="https://api.stophy.dev/mcp",DS=()=>{let e=process.env.STOPHY_MCP_URL??MS;try{return new URL(e)}catch{throw Error(`STOPHY_MCP_URL is not a valid URL: ${e}`)}},LS=()=>{let e=process.env.STOPHY_API_KEY?.trim();return e?{Authorization:`Bearer ${e}`}:{}},US=async(e)=>{let t=new Ui({name:"stophy-mcp",version:sa.version}),r=new ea(e,{requestInit:{headers:LS()}});return await t.connect(r),t},VS=async()=>{let e=DS(),t;try{t=await US(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 tools.":"";throw Error(`Could not connect to Stophy at ${e.origin}: ${n}.${s}`)}let r=new ra({name:"stophy",version:sa.version},{capabilities:{tools:{listChanged:!0}},instructions:t.getInstructions()});r.setRequestHandler(Ts,(o)=>t.listTools(o.params)),r.setRequestHandler(pr,(o)=>t.callTool(o.params)),t.setNotificationHandler(fr,()=>r.sendToolListChanged()),r.onclose=()=>{t.close()},await r.connect(new na)};VS().catch((e)=>{process.stderr.write(`${e instanceof Error?e.message:String(e)}
46
+ `),process.exit(1)});