@sequenzy/mcp 0.0.1
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 +104 -0
- package/package.json +48 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var o$=Object.create;var{getPrototypeOf:t$,defineProperty:t4,getOwnPropertyNames:a$}=Object;var s$=Object.prototype.hasOwnProperty;var UX=(Q,X,Y)=>{Y=Q!=null?o$(t$(Q)):{};let W=X||!Q||!Q.__esModule?t4(Y,"default",{value:Q,enumerable:!0}):Y;for(let G of a$(Q))if(!s$.call(W,G))t4(W,G,{get:()=>Q[G],enumerable:!0});return W};var N=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var OX=(Q,X)=>{for(var Y in X)t4(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:(W)=>X[Y]=()=>W})};var G6=N((HG)=>{Object.defineProperty(HG,"__esModule",{value:!0});HG.regexpCode=HG.getEsmExportName=HG.getProperty=HG.safeStringify=HG.stringify=HG.strConcat=HG.addCodeArg=HG.str=HG._=HG.nil=HG._Code=HG.Name=HG.IDENTIFIER=HG._CodeOrName=void 0;class K4{}HG._CodeOrName=K4;HG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class N1 extends K4{constructor(Q){super();if(!HG.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}}}HG.Name=N1;class P0 extends K4{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 N1)X[Y.str]=(X[Y.str]||0)+1;return X},{})}}HG._Code=P0;HG.nil=new P0("");function $G(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)GQ(Y,X[W]),Y.push(Q[++W]);return new P0(Y)}HG._=$G;var WQ=new P0("+");function zG(Q,...X){let Y=[W6(Q[0])],W=0;while(W<X.length)Y.push(WQ),GQ(Y,X[W]),Y.push(WQ,W6(Q[++W]));return LK(Y),new P0(Y)}HG.str=zG;function GQ(Q,X){if(X instanceof P0)Q.push(...X._items);else if(X instanceof N1)Q.push(X);else Q.push(VK(X))}HG.addCodeArg=GQ;function LK(Q){let X=1;while(X<Q.length-1){if(Q[X]===WQ){let Y=UK(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function UK(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof N1||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 N1))return`"${Q}${X.slice(1)}`;return}function OK(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:zG`${Q}${X}`}HG.strConcat=OK;function VK(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:W6(Array.isArray(Q)?Q.join(","):Q)}function MK(Q){return new P0(W6(Q))}HG.stringify=MK;function W6(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}HG.safeStringify=W6;function ZK(Q){return typeof Q=="string"&&HG.IDENTIFIER.test(Q)?new P0(`.${Q}`):$G`[${Q}]`}HG.getProperty=ZK;function NK(Q){if(typeof Q=="string"&&HG.IDENTIFIER.test(Q))return new P0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}HG.getEsmExportName=NK;function qK(Q){return new P0(Q.toString())}HG.regexpCode=qK});var HQ=N((FG)=>{Object.defineProperty(FG,"__esModule",{value:!0});FG.ValueScope=FG.ValueScopeName=FG.Scope=FG.varKinds=FG.UsedValueState=void 0;var A0=G6();class BG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var A4;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(A4||(FG.UsedValueState=A4={}));FG.varKinds={const:new A0.Name("const"),let:new A0.Name("let"),var:new A0.Name("var")};class $Q{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof A0.Name?Q:this.name(Q)}name(Q){return new A0.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}}}FG.Scope=$Q;class zQ extends A0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:Y}){this.value=Q,this.scopePath=A0._`.${new A0.Name(X)}[${Y}]`}}FG.ValueScopeName=zQ;var xK=A0._`\n`;class AG extends $Q{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?xK:A0.nil}}get(){return this._scope}name(Q){return new zQ(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:G}=W,J=(Y=X.key)!==null&&Y!==void 0?Y:X.ref,$=this._values[G];if($){let H=$.get(J);if(H)return H}else $=this._values[G]=new Map;$.set(J,W);let z=this._scope[G]||(this._scope[G]=[]),K=z.length;return z[K]=X.ref,W.setValue(X,{property:G,itemIndex:K}),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 A0._`${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 G=A0.nil;for(let J in Q){let $=Q[J];if(!$)continue;let z=Y[J]=Y[J]||new Map;$.forEach((K)=>{if(z.has(K))return;z.set(K,A4.Started);let H=X(K);if(H){let B=this.opts.es5?FG.varKinds.var:FG.varKinds.const;G=A0._`${G}${B} ${K} = ${H};${this.opts._n}`}else if(H=W===null||W===void 0?void 0:W(K))G=A0._`${G}${H}${this.opts._n}`;else throw new BG(K);z.set(K,A4.Completed)})}return G}}FG.ValueScope=AG});var k=N((F0)=>{Object.defineProperty(F0,"__esModule",{value:!0});F0.or=F0.and=F0.not=F0.CodeGen=F0.operators=F0.varKinds=F0.ValueScopeName=F0.ValueScope=F0.Scope=F0.Name=F0.regexpCode=F0.stringify=F0.getProperty=F0.nil=F0.strConcat=F0.str=F0._=void 0;var y=G6(),b0=HQ(),a0=G6();Object.defineProperty(F0,"_",{enumerable:!0,get:function(){return a0._}});Object.defineProperty(F0,"str",{enumerable:!0,get:function(){return a0.str}});Object.defineProperty(F0,"strConcat",{enumerable:!0,get:function(){return a0.strConcat}});Object.defineProperty(F0,"nil",{enumerable:!0,get:function(){return a0.nil}});Object.defineProperty(F0,"getProperty",{enumerable:!0,get:function(){return a0.getProperty}});Object.defineProperty(F0,"stringify",{enumerable:!0,get:function(){return a0.stringify}});Object.defineProperty(F0,"regexpCode",{enumerable:!0,get:function(){return a0.regexpCode}});Object.defineProperty(F0,"Name",{enumerable:!0,get:function(){return a0.Name}});var V4=HQ();Object.defineProperty(F0,"Scope",{enumerable:!0,get:function(){return V4.Scope}});Object.defineProperty(F0,"ValueScope",{enumerable:!0,get:function(){return V4.ValueScope}});Object.defineProperty(F0,"ValueScopeName",{enumerable:!0,get:function(){return V4.ValueScopeName}});Object.defineProperty(F0,"varKinds",{enumerable:!0,get:function(){return V4.varKinds}});F0.operators={GT:new y._Code(">"),GTE:new y._Code(">="),LT:new y._Code("<"),LTE:new y._Code("<="),EQ:new y._Code("==="),NEQ:new y._Code("!=="),NOT:new y._Code("!"),OR:new y._Code("||"),AND:new y._Code("&&"),ADD:new y._Code("+")};class s0{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class LG extends s0{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?b0.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=w1(this.rhs,Q,X);return this}get names(){return this.rhs instanceof y._CodeOrName?this.rhs.names:{}}}class AQ extends s0{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 y.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=w1(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof y.Name?{}:{...this.lhs.names};return O4(Q,this.rhs)}}class UG extends AQ{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class OG extends s0{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class VG extends s0{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class MG extends s0{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class ZG extends s0{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=w1(this.code,Q,X),this}get names(){return this.code instanceof y._CodeOrName?this.code.names:{}}}class M4 extends s0{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 G=Y[W];if(G.optimizeNames(Q,X))continue;hK(Q,G.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>$1(Q,X.names),{})}}class e0 extends M4{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class NG extends M4{}class J6 extends e0{}J6.kind="else";class u0 extends e0{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 J6(Y):Y}if(X){if(Q===!1)return X instanceof u0?X:X.nodes;if(this.nodes.length)return this;return new u0(bG(Q),X instanceof u0?[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=w1(this.condition,Q,X),this}get names(){let Q=super.names;if(O4(Q,this.condition),this.else)$1(Q,this.else.names);return Q}}u0.kind="if";class q1 extends e0{}q1.kind="for";class qG extends q1{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=w1(this.iteration,Q,X),this}get names(){return $1(super.names,this.iteration.names)}}class wG extends q1{constructor(Q,X,Y,W){super();this.varKind=Q,this.name=X,this.from=Y,this.to=W}render(Q){let X=Q.es5?b0.varKinds.var:this.varKind,{name:Y,from:W,to:G}=this;return`for(${X} ${Y}=${W}; ${Y}<${G}; ${Y}++)`+super.render(Q)}get names(){let Q=O4(super.names,this.from);return O4(Q,this.to)}}class KQ extends q1{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=w1(this.iterable,Q,X),this}get names(){return $1(super.names,this.iterable.names)}}class F4 extends e0{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)}}F4.kind="func";class D4 extends M4{render(Q){return"return "+super.render(Q)}}D4.kind="return";class jG extends e0{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)$1(Q,this.catch.names);if(this.finally)$1(Q,this.finally.names);return Q}}class L4 extends e0{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}L4.kind="catch";class U4 extends e0{render(Q){return"finally"+super.render(Q)}}U4.kind="finally";class PG{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
|
|
3
|
+
`:""},this._extScope=Q,this._scope=new b0.Scope({parent:Q}),this._nodes=[new NG]}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 G=this._scope.toName(X);if(Y!==void 0&&W)this._constants[G.str]=Y;return this._leafNode(new LG(Q,G,Y)),G}const(Q,X,Y){return this._def(b0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(b0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(b0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new AQ(Q,X,Y))}add(Q,X){return this._leafNode(new UG(Q,F0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==y.nil)this._leafNode(new ZG(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,y.addCodeArg)(X,W)}return X.push("}"),new y._Code(X)}if(Q,X,Y){if(this._blockNode(new u0(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 u0(Q))}else(){return this._elseNode(new J6)}endIf(){return this._endBlockNode(u0,J6)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new qG(Q),X)}forRange(Q,X,Y,W,G=this.opts.es5?b0.varKinds.var:b0.varKinds.let){let J=this._scope.toName(Q);return this._for(new wG(G,J,X,Y),()=>W(J))}forOf(Q,X,Y,W=b0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof y.Name?X:this.var("_arr",X);return this.forRange("_i",0,y._`${J}.length`,($)=>{this.var(G,y._`${J}[${$}]`),Y(G)})}return this._for(new KQ("of",W,G,X),()=>Y(G))}forIn(Q,X,Y,W=this.opts.es5?b0.varKinds.var:b0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,y._`Object.keys(${X})`,Y);let G=this._scope.toName(Q);return this._for(new KQ("in",W,G,X),()=>Y(G))}endFor(){return this._endBlockNode(q1)}label(Q){return this._leafNode(new OG(Q))}break(Q){return this._leafNode(new VG(Q))}return(Q){let X=new D4;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(D4)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new jG;if(this._blockNode(W),this.code(Q),X){let G=this.name("e");this._currNode=W.catch=new L4(G),X(G)}if(Y)this._currNode=W.finally=new U4,this.code(Y);return this._endBlockNode(L4,U4)}throw(Q){return this._leafNode(new MG(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=y.nil,Y,W){if(this._blockNode(new F4(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(F4)}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 u0))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}}F0.CodeGen=PG;function $1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function O4(Q,X){return X instanceof y._CodeOrName?$1(Q,X.names):Q}function w1(Q,X,Y){if(Q instanceof y.Name)return W(Q);if(!G(Q))return Q;return new y._Code(Q._items.reduce((J,$)=>{if($ instanceof y.Name)$=W($);if($ instanceof y._Code)J.push(...$._items);else J.push($);return J},[]));function W(J){let $=Y[J.str];if($===void 0||X[J.str]!==1)return J;return delete X[J.str],$}function G(J){return J instanceof y._Code&&J._items.some(($)=>$ instanceof y.Name&&X[$.str]===1&&Y[$.str]!==void 0)}}function hK(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function bG(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:y._`!${BQ(Q)}`}F0.not=bG;var uK=EG(F0.operators.AND);function fK(...Q){return Q.reduce(uK)}F0.and=fK;var mK=EG(F0.operators.OR);function lK(...Q){return Q.reduce(mK)}F0.or=lK;function EG(Q){return(X,Y)=>X===y.nil?Y:Y===y.nil?X:y._`${BQ(X)} ${Q} ${BQ(Y)}`}function BQ(Q){return Q instanceof y.Name?Q:y._`(${Q})`}});var u=N((_G)=>{Object.defineProperty(_G,"__esModule",{value:!0});_G.checkStrictMode=_G.getErrorPath=_G.Type=_G.useFunc=_G.setEvaluated=_G.evaluatedPropsToName=_G.mergeEvaluated=_G.eachItem=_G.unescapeJsonPointer=_G.escapeJsonPointer=_G.escapeFragment=_G.unescapeFragment=_G.schemaRefOrVal=_G.schemaHasRulesButRef=_G.schemaHasRules=_G.checkUnknownRules=_G.alwaysValidSchema=_G.toHash=void 0;var l=k(),dK=G6();function rK(Q){let X={};for(let Y of Q)X[Y]=!0;return X}_G.toHash=rK;function nK(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return RG(Q,X),!CG(X,Q.self.RULES.all)}_G.alwaysValidSchema=nK;function RG(Q,X=Q.schema){let{opts:Y,self:W}=Q;if(!Y.strictSchema)return;if(typeof X==="boolean")return;let G=W.RULES.keywords;for(let J in X)if(!G[J])xG(Q,`unknown keyword: "${J}"`)}_G.checkUnknownRules=RG;function CG(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}_G.schemaHasRules=CG;function oK(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}_G.schemaHasRulesButRef=oK;function tK({topSchemaRef:Q,schemaPath:X},Y,W,G){if(!G){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return l._`${Y}`}return l._`${Q}${X}${(0,l.getProperty)(W)}`}_G.schemaRefOrVal=tK;function aK(Q){return kG(decodeURIComponent(Q))}_G.unescapeFragment=aK;function sK(Q){return encodeURIComponent(DQ(Q))}_G.escapeFragment=sK;function DQ(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}_G.escapeJsonPointer=DQ;function kG(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}_G.unescapeJsonPointer=kG;function eK(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}_G.eachItem=eK;function TG({mergeNames:Q,mergeToName:X,mergeValues:Y,resultToName:W}){return(G,J,$,z)=>{let K=$===void 0?J:$ instanceof l.Name?(J instanceof l.Name?Q(G,J,$):X(G,J,$),$):J instanceof l.Name?(X(G,$,J),J):Y(J,$);return z===l.Name&&!(K instanceof l.Name)?W(G,K):K}}_G.mergeEvaluated={props:TG({mergeNames:(Q,X,Y)=>Q.if(l._`${Y} !== true && ${X} !== undefined`,()=>{Q.if(l._`${X} === true`,()=>Q.assign(Y,!0),()=>Q.assign(Y,l._`${Y} || {}`).code(l._`Object.assign(${Y}, ${X})`))}),mergeToName:(Q,X,Y)=>Q.if(l._`${Y} !== true`,()=>{if(X===!0)Q.assign(Y,!0);else Q.assign(Y,l._`${Y} || {}`),LQ(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:vG}),items:TG({mergeNames:(Q,X,Y)=>Q.if(l._`${Y} !== true && ${X} !== undefined`,()=>Q.assign(Y,l._`${X} === true ? true : ${Y} > ${X} ? ${Y} : ${X}`)),mergeToName:(Q,X,Y)=>Q.if(l._`${Y} !== true`,()=>Q.assign(Y,X===!0?!0:l._`${Y} > ${X} ? ${Y} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function vG(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",l._`{}`);if(X!==void 0)LQ(Q,Y,X);return Y}_G.evaluatedPropsToName=vG;function LQ(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(l._`${X}${(0,l.getProperty)(W)}`,!0))}_G.setEvaluated=LQ;var SG={};function QB(Q,X){return Q.scopeValue("func",{ref:X,code:SG[X.code]||(SG[X.code]=new dK._Code(X.code))})}_G.useFunc=QB;var FQ;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(FQ||(_G.Type=FQ={}));function XB(Q,X,Y){if(Q instanceof l.Name){let W=X===FQ.Num;return Y?W?l._`"[" + ${Q} + "]"`:l._`"['" + ${Q} + "']"`:W?l._`"/" + ${Q}`:l._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,l.getProperty)(Q).toString():"/"+DQ(Q)}_G.getErrorPath=XB;function xG(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}_G.checkStrictMode=xG});var f0=N((gG)=>{Object.defineProperty(gG,"__esModule",{value:!0});var $0=k(),ZB={data:new $0.Name("data"),valCxt:new $0.Name("valCxt"),instancePath:new $0.Name("instancePath"),parentData:new $0.Name("parentData"),parentDataProperty:new $0.Name("parentDataProperty"),rootData:new $0.Name("rootData"),dynamicAnchors:new $0.Name("dynamicAnchors"),vErrors:new $0.Name("vErrors"),errors:new $0.Name("errors"),this:new $0.Name("this"),self:new $0.Name("self"),scope:new $0.Name("scope"),json:new $0.Name("json"),jsonPos:new $0.Name("jsonPos"),jsonLen:new $0.Name("jsonLen"),jsonPart:new $0.Name("jsonPart")};gG.default=ZB});var $6=N((mG)=>{Object.defineProperty(mG,"__esModule",{value:!0});mG.extendErrors=mG.resetErrorsCount=mG.reportExtraError=mG.reportError=mG.keyword$DataError=mG.keywordError=void 0;var g=k(),N4=u(),H0=f0();mG.keywordError={message:({keyword:Q})=>g.str`must pass "${Q}" keyword validation`};mG.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?g.str`"${Q}" keyword must be ${X} ($data)`:g.str`"${Q}" keyword is invalid ($data)`};function qB(Q,X=mG.keywordError,Y,W){let{it:G}=Q,{gen:J,compositeRule:$,allErrors:z}=G,K=fG(Q,X,Y);if(W!==null&&W!==void 0?W:$||z)hG(J,K);else uG(G,g._`[${K}]`)}mG.reportError=qB;function wB(Q,X=mG.keywordError,Y){let{it:W}=Q,{gen:G,compositeRule:J,allErrors:$}=W,z=fG(Q,X,Y);if(hG(G,z),!(J||$))uG(W,H0.default.vErrors)}mG.reportExtraError=wB;function jB(Q,X){Q.assign(H0.default.errors,X),Q.if(g._`${H0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(g._`${H0.default.vErrors}.length`,X),()=>Q.assign(H0.default.vErrors,null)))}mG.resetErrorsCount=jB;function PB({gen:Q,keyword:X,schemaValue:Y,data:W,errsCount:G,it:J}){if(G===void 0)throw Error("ajv implementation error");let $=Q.name("err");Q.forRange("i",G,H0.default.errors,(z)=>{if(Q.const($,g._`${H0.default.vErrors}[${z}]`),Q.if(g._`${$}.instancePath === undefined`,()=>Q.assign(g._`${$}.instancePath`,(0,g.strConcat)(H0.default.instancePath,J.errorPath))),Q.assign(g._`${$}.schemaPath`,g.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(g._`${$}.schema`,Y),Q.assign(g._`${$}.data`,W)})}mG.extendErrors=PB;function hG(Q,X){let Y=Q.const("err",X);Q.if(g._`${H0.default.vErrors} === null`,()=>Q.assign(H0.default.vErrors,g._`[${Y}]`),g._`${H0.default.vErrors}.push(${Y})`),Q.code(g._`${H0.default.errors}++`)}function uG(Q,X){let{gen:Y,validateName:W,schemaEnv:G}=Q;if(G.$async)Y.throw(g._`new ${Q.ValidationError}(${X})`);else Y.assign(g._`${W}.errors`,X),Y.return(!1)}var z1={keyword:new g.Name("keyword"),schemaPath:new g.Name("schemaPath"),params:new g.Name("params"),propertyName:new g.Name("propertyName"),message:new g.Name("message"),schema:new g.Name("schema"),parentSchema:new g.Name("parentSchema")};function fG(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return g._`{}`;return bB(Q,X,Y)}function bB(Q,X,Y={}){let{gen:W,it:G}=Q,J=[EB(G,Y),IB(Q,Y)];return TB(Q,X,J),W.object(...J)}function EB({errorPath:Q},{instancePath:X}){let Y=X?g.str`${Q}${(0,N4.getErrorPath)(X,N4.Type.Str)}`:Q;return[H0.default.instancePath,(0,g.strConcat)(H0.default.instancePath,Y)]}function IB({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let G=W?X:g.str`${X}/${Q}`;if(Y)G=g.str`${G}${(0,N4.getErrorPath)(Y,N4.Type.Str)}`;return[z1.schemaPath,G]}function TB(Q,{params:X,message:Y},W){let{keyword:G,data:J,schemaValue:$,it:z}=Q,{opts:K,propertyName:H,topSchemaRef:B,schemaPath:A}=z;if(W.push([z1.keyword,G],[z1.params,typeof X=="function"?X(Q):X||g._`{}`]),K.messages)W.push([z1.message,typeof Y=="function"?Y(Q):Y]);if(K.verbose)W.push([z1.schema,$],[z1.parentSchema,g._`${B}${A}`],[H0.default.data,J]);if(H)W.push([z1.propertyName,H])}});var dG=N((pG)=>{Object.defineProperty(pG,"__esModule",{value:!0});pG.boolOrEmptySchema=pG.topBoolOrEmptySchema=void 0;var vB=$6(),xB=k(),_B=f0(),yB={message:"boolean schema is false"};function gB(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)cG(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(_B.default.data);else X.assign(xB._`${W}.errors`,null),X.return(!0)}pG.topBoolOrEmptySchema=gB;function hB(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),cG(Q);else Y.var(X,!0)}pG.boolOrEmptySchema=hB;function cG(Q,X){let{gen:Y,data:W}=Q,G={gen:Y,keyword:"false schema",data:W,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:Q};(0,vB.reportError)(G,yB,void 0,X)}});var OQ=N((rG)=>{Object.defineProperty(rG,"__esModule",{value:!0});rG.getRules=rG.isJSONType=void 0;var fB=["string","number","integer","boolean","null","object","array"],mB=new Set(fB);function lB(Q){return typeof Q=="string"&&mB.has(Q)}rG.isJSONType=lB;function cB(){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:{}}}rG.getRules=cB});var VQ=N((aG)=>{Object.defineProperty(aG,"__esModule",{value:!0});aG.shouldUseRule=aG.shouldUseGroup=aG.schemaHasRulesForType=void 0;function iB({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&oG(Q,W)}aG.schemaHasRulesForType=iB;function oG(Q,X){return X.rules.some((Y)=>tG(Q,Y))}aG.shouldUseGroup=oG;function tG(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))}aG.shouldUseRule=tG});var z6=N((YJ)=>{Object.defineProperty(YJ,"__esModule",{value:!0});YJ.reportTypeError=YJ.checkDataTypes=YJ.checkDataType=YJ.coerceAndCheckDataType=YJ.getJSONTypes=YJ.getSchemaTypes=YJ.DataType=void 0;var nB=OQ(),oB=VQ(),tB=$6(),R=k(),eG=u(),j1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(j1||(YJ.DataType=j1={}));function aB(Q){let X=QJ(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}YJ.getSchemaTypes=aB;function QJ(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(nB.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}YJ.getJSONTypes=QJ;function sB(Q,X){let{gen:Y,data:W,opts:G}=Q,J=eB(X,G.coerceTypes),$=X.length>0&&!(J.length===0&&X.length===1&&(0,oB.schemaHasRulesForType)(Q,X[0]));if($){let z=ZQ(X,W,G.strictNumbers,j1.Wrong);Y.if(z,()=>{if(J.length)QA(Q,X,J);else NQ(Q)})}return $}YJ.coerceAndCheckDataType=sB;var XJ=new Set(["string","number","integer","boolean","null"]);function eB(Q,X){return X?Q.filter((Y)=>XJ.has(Y)||X==="array"&&Y==="array"):[]}function QA(Q,X,Y){let{gen:W,data:G,opts:J}=Q,$=W.let("dataType",R._`typeof ${G}`),z=W.let("coerced",R._`undefined`);if(J.coerceTypes==="array")W.if(R._`${$} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,R._`${G}[0]`).assign($,R._`typeof ${G}`).if(ZQ(X,G,J.strictNumbers),()=>W.assign(z,G)));W.if(R._`${z} !== undefined`);for(let H of Y)if(XJ.has(H)||H==="array"&&J.coerceTypes==="array")K(H);W.else(),NQ(Q),W.endIf(),W.if(R._`${z} !== undefined`,()=>{W.assign(G,z),XA(Q,z)});function K(H){switch(H){case"string":W.elseIf(R._`${$} == "number" || ${$} == "boolean"`).assign(z,R._`"" + ${G}`).elseIf(R._`${G} === null`).assign(z,R._`""`);return;case"number":W.elseIf(R._`${$} == "boolean" || ${G} === null
|
|
4
|
+
|| (${$} == "string" && ${G} && ${G} == +${G})`).assign(z,R._`+${G}`);return;case"integer":W.elseIf(R._`${$} === "boolean" || ${G} === null
|
|
5
|
+
|| (${$} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign(z,R._`+${G}`);return;case"boolean":W.elseIf(R._`${G} === "false" || ${G} === 0 || ${G} === null`).assign(z,!1).elseIf(R._`${G} === "true" || ${G} === 1`).assign(z,!0);return;case"null":W.elseIf(R._`${G} === "" || ${G} === 0 || ${G} === false`),W.assign(z,null);return;case"array":W.elseIf(R._`${$} === "string" || ${$} === "number"
|
|
6
|
+
|| ${$} === "boolean" || ${G} === null`).assign(z,R._`[${G}]`)}}}function XA({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(R._`${X} !== undefined`,()=>Q.assign(R._`${X}[${Y}]`,W))}function MQ(Q,X,Y,W=j1.Correct){let G=W===j1.Correct?R.operators.EQ:R.operators.NEQ,J;switch(Q){case"null":return R._`${X} ${G} null`;case"array":J=R._`Array.isArray(${X})`;break;case"object":J=R._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=$(R._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=$();break;default:return R._`typeof ${X} ${G} ${Q}`}return W===j1.Correct?J:(0,R.not)(J);function $(z=R.nil){return(0,R.and)(R._`typeof ${X} == "number"`,z,Y?R._`isFinite(${X})`:R.nil)}}YJ.checkDataType=MQ;function ZQ(Q,X,Y,W){if(Q.length===1)return MQ(Q[0],X,Y,W);let G,J=(0,eG.toHash)(Q);if(J.array&&J.object){let $=R._`typeof ${X} != "object"`;G=J.null?$:R._`!${X} || ${$}`,delete J.null,delete J.array,delete J.object}else G=R.nil;if(J.number)delete J.integer;for(let $ in J)G=(0,R.and)(G,MQ($,X,Y,W));return G}YJ.checkDataTypes=ZQ;var YA={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?R._`{type: ${Q}}`:R._`{type: ${X}}`};function NQ(Q){let X=WA(Q);(0,tB.reportError)(X,YA)}YJ.reportTypeError=NQ;function WA(Q){let{gen:X,data:Y,schema:W}=Q,G=(0,eG.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var zJ=N((JJ)=>{Object.defineProperty(JJ,"__esModule",{value:!0});JJ.assignDefaults=void 0;var P1=k(),BA=u();function AA(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let G in Y)GJ(Q,G,Y[G].default);else if(X==="array"&&Array.isArray(W))W.forEach((G,J)=>GJ(Q,J,G.default))}JJ.assignDefaults=AA;function GJ(Q,X,Y){let{gen:W,compositeRule:G,data:J,opts:$}=Q;if(Y===void 0)return;let z=P1._`${J}${(0,P1.getProperty)(X)}`;if(G){(0,BA.checkStrictMode)(Q,`default is ignored for: ${z}`);return}let K=P1._`${z} === undefined`;if($.useDefaults==="empty")K=P1._`${K} || ${z} === null || ${z} === ""`;W.if(K,P1._`${z} = ${(0,P1.stringify)(Y)}`)}});var N0=N((BJ)=>{Object.defineProperty(BJ,"__esModule",{value:!0});BJ.validateUnion=BJ.validateArray=BJ.usePattern=BJ.callValidateCode=BJ.schemaProperties=BJ.allSchemaProperties=BJ.noPropertyInData=BJ.propertyInData=BJ.isOwnProperty=BJ.hasPropFunc=BJ.reportMissingProp=BJ.checkMissingProp=BJ.checkReportMissingProp=void 0;var d=k(),qQ=u(),Q1=f0(),FA=u();function DA(Q,X){let{gen:Y,data:W,it:G}=Q;Y.if(jQ(Y,W,X,G.opts.ownProperties),()=>{Q.setParams({missingProperty:d._`${X}`},!0),Q.error()})}BJ.checkReportMissingProp=DA;function LA({gen:Q,data:X,it:{opts:Y}},W,G){return(0,d.or)(...W.map((J)=>(0,d.and)(jQ(Q,X,J,Y.ownProperties),d._`${G} = ${J}`)))}BJ.checkMissingProp=LA;function UA(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}BJ.reportMissingProp=UA;function HJ(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:d._`Object.prototype.hasOwnProperty`})}BJ.hasPropFunc=HJ;function wQ(Q,X,Y){return d._`${HJ(Q)}.call(${X}, ${Y})`}BJ.isOwnProperty=wQ;function OA(Q,X,Y,W){let G=d._`${X}${(0,d.getProperty)(Y)} !== undefined`;return W?d._`${G} && ${wQ(Q,X,Y)}`:G}BJ.propertyInData=OA;function jQ(Q,X,Y,W){let G=d._`${X}${(0,d.getProperty)(Y)} === undefined`;return W?(0,d.or)(G,(0,d.not)(wQ(Q,X,Y))):G}BJ.noPropertyInData=jQ;function KJ(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}BJ.allSchemaProperties=KJ;function VA(Q,X){return KJ(X).filter((Y)=>!(0,qQ.alwaysValidSchema)(Q,X[Y]))}BJ.schemaProperties=VA;function MA({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:G,errorPath:J},it:$},z,K,H){let B=H?d._`${Q}, ${X}, ${W}${G}`:X,A=[[Q1.default.instancePath,(0,d.strConcat)(Q1.default.instancePath,J)],[Q1.default.parentData,$.parentData],[Q1.default.parentDataProperty,$.parentDataProperty],[Q1.default.rootData,Q1.default.rootData]];if($.opts.dynamicRef)A.push([Q1.default.dynamicAnchors,Q1.default.dynamicAnchors]);let L=d._`${B}, ${Y.object(...A)}`;return K!==d.nil?d._`${z}.call(${K}, ${L})`:d._`${z}(${L})`}BJ.callValidateCode=MA;var ZA=d._`new RegExp`;function NA({gen:Q,it:{opts:X}},Y){let W=X.unicodeRegExp?"u":"",{regExp:G}=X.code,J=G(Y,W);return Q.scopeValue("pattern",{key:J.toString(),ref:J,code:d._`${G.code==="new RegExp"?ZA:(0,FA.useFunc)(Q,G)}(${Y}, ${W})`})}BJ.usePattern=NA;function qA(Q){let{gen:X,data:Y,keyword:W,it:G}=Q,J=X.name("valid");if(G.allErrors){let z=X.let("valid",!0);return $(()=>X.assign(z,!1)),z}return X.var(J,!0),$(()=>X.break()),J;function $(z){let K=X.const("len",d._`${Y}.length`);X.forRange("i",0,K,(H)=>{Q.subschema({keyword:W,dataProp:H,dataPropType:qQ.Type.Num},J),X.if((0,d.not)(J),z)})}}BJ.validateArray=qA;function wA(Q){let{gen:X,schema:Y,keyword:W,it:G}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((K)=>(0,qQ.alwaysValidSchema)(G,K))&&!G.opts.unevaluated)return;let $=X.let("valid",!1),z=X.name("_valid");X.block(()=>Y.forEach((K,H)=>{let B=Q.subschema({keyword:W,schemaProp:H,compositeRule:!0},z);if(X.assign($,d._`${$} || ${z}`),!Q.mergeValidEvaluated(B,z))X.if((0,d.not)($))})),Q.result($,()=>Q.reset(),()=>Q.error(!0))}BJ.validateUnion=wA});var OJ=N((LJ)=>{Object.defineProperty(LJ,"__esModule",{value:!0});LJ.validateKeywordUsage=LJ.validSchemaType=LJ.funcKeywordCode=LJ.macroKeywordCode=void 0;var K0=k(),H1=f0(),_A=N0(),yA=$6();function gA(Q,X){let{gen:Y,keyword:W,schema:G,parentSchema:J,it:$}=Q,z=X.macro.call($.self,G,J,$),K=DJ(Y,W,z);if($.opts.validateSchema!==!1)$.self.validateSchema(z,!0);let H=Y.name("valid");Q.subschema({schema:z,schemaPath:K0.nil,errSchemaPath:`${$.errSchemaPath}/${W}`,topSchemaRef:K,compositeRule:!0},H),Q.pass(H,()=>Q.error(!0))}LJ.macroKeywordCode=gA;function hA(Q,X){var Y;let{gen:W,keyword:G,schema:J,parentSchema:$,$data:z,it:K}=Q;fA(K,X);let H=!z&&X.compile?X.compile.call(K.self,J,$,K):X.validate,B=DJ(W,G,H),A=W.let("valid");Q.block$data(A,L),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:A);function L(){if(X.errors===!1){if(V(),X.modifying)FJ(Q);Z(()=>Q.error())}else{let M=X.async?U():O();if(X.modifying)FJ(Q);Z(()=>uA(Q,M))}}function U(){let M=W.let("ruleErrs",null);return W.try(()=>V(K0._`await `),(T)=>W.assign(A,!1).if(K0._`${T} instanceof ${K.ValidationError}`,()=>W.assign(M,K0._`${T}.errors`),()=>W.throw(T))),M}function O(){let M=K0._`${B}.errors`;return W.assign(M,null),V(K0.nil),M}function V(M=X.async?K0._`await `:K0.nil){let T=K.opts.passContext?H1.default.this:H1.default.self,E=!(("compile"in X)&&!z||X.schema===!1);W.assign(A,K0._`${M}${(0,_A.callValidateCode)(Q,B,T,E)}`,X.modifying)}function Z(M){var T;W.if((0,K0.not)((T=X.valid)!==null&&T!==void 0?T:A),M)}}LJ.funcKeywordCode=hA;function FJ(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,K0._`${W.parentData}[${W.parentDataProperty}]`))}function uA(Q,X){let{gen:Y}=Q;Y.if(K0._`Array.isArray(${X})`,()=>{Y.assign(H1.default.vErrors,K0._`${H1.default.vErrors} === null ? ${X} : ${H1.default.vErrors}.concat(${X})`).assign(H1.default.errors,K0._`${H1.default.vErrors}.length`),(0,yA.extendErrors)(Q)},()=>Q.error())}function fA({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function DJ(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,K0.stringify)(Y)})}function mA(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")}LJ.validSchemaType=mA;function lA({schema:Q,opts:X,self:Y,errSchemaPath:W},G,J){if(Array.isArray(G.keyword)?!G.keyword.includes(J):G.keyword!==J)throw Error("ajv implementation error");let $=G.dependencies;if($===null||$===void 0?void 0:$.some((z)=>!Object.prototype.hasOwnProperty.call(Q,z)))throw Error(`parent schema must have dependencies of ${J}: ${$.join(",")}`);if(G.validateSchema){if(!G.validateSchema(Q[J])){let K=`keyword "${J}" value is invalid at path "${W}": `+Y.errorsText(G.validateSchema.errors);if(X.validateSchema==="log")Y.logger.error(K);else throw Error(K)}}}LJ.validateKeywordUsage=lA});var NJ=N((MJ)=>{Object.defineProperty(MJ,"__esModule",{value:!0});MJ.extendSubschemaMode=MJ.extendSubschemaData=MJ.getSubschema=void 0;var C0=k(),VJ=u();function dA(Q,{keyword:X,schemaProp:Y,schema:W,schemaPath:G,errSchemaPath:J,topSchemaRef:$}){if(X!==void 0&&W!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(X!==void 0){let z=Q.schema[X];return Y===void 0?{schema:z,schemaPath:C0._`${Q.schemaPath}${(0,C0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:z[Y],schemaPath:C0._`${Q.schemaPath}${(0,C0.getProperty)(X)}${(0,C0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,VJ.escapeFragment)(Y)}`}}if(W!==void 0){if(G===void 0||J===void 0||$===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:$,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}MJ.getSubschema=dA;function rA(Q,X,{dataProp:Y,dataPropType:W,data:G,dataTypes:J,propertyName:$}){if(G!==void 0&&Y!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:z}=X;if(Y!==void 0){let{errorPath:H,dataPathArr:B,opts:A}=X,L=z.let("data",C0._`${X.data}${(0,C0.getProperty)(Y)}`,!0);K(L),Q.errorPath=C0.str`${H}${(0,VJ.getErrorPath)(Y,W,A.jsPropertySyntax)}`,Q.parentDataProperty=C0._`${Y}`,Q.dataPathArr=[...B,Q.parentDataProperty]}if(G!==void 0){let H=G instanceof C0.Name?G:z.let("data",G,!0);if(K(H),$!==void 0)Q.propertyName=$}if(J)Q.dataTypes=J;function K(H){Q.data=H,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,H]}}MJ.extendSubschemaData=rA;function nA(Q,{jtdDiscriminator:X,jtdMetadata:Y,compositeRule:W,createErrors:G,allErrors:J}){if(W!==void 0)Q.compositeRule=W;if(G!==void 0)Q.createErrors=G;if(J!==void 0)Q.allErrors=J;Q.jtdDiscriminator=X,Q.jtdMetadata=Y}MJ.extendSubschemaMode=nA});var PQ=N((yj,qJ)=>{qJ.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,G,J;if(Array.isArray(X)){if(W=X.length,W!=Y.length)return!1;for(G=W;G--!==0;)if(!Q(X[G],Y[G]))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(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,J[G]))return!1;for(G=W;G--!==0;){var $=J[G];if(!Q(X[$],Y[$]))return!1}return!0}return X!==X&&Y!==Y}});var jJ=N((gj,wJ)=>{var X1=wJ.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(){},G=Y.post||function(){};q4(X,W,G,Q,"",Q)};X1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};X1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};X1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};X1.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 q4(Q,X,Y,W,G,J,$,z,K,H){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,G,J,$,z,K,H);for(var B in W){var A=W[B];if(Array.isArray(A)){if(B in X1.arrayKeywords)for(var L=0;L<A.length;L++)q4(Q,X,Y,A[L],G+"/"+B+"/"+L,J,G,B,W,L)}else if(B in X1.propsKeywords){if(A&&typeof A=="object")for(var U in A)q4(Q,X,Y,A[U],G+"/"+B+"/"+aA(U),J,G,B,W,U)}else if(B in X1.keywords||Q.allKeys&&!(B in X1.skipKeywords))q4(Q,X,Y,A,G+"/"+B,J,G,B,W)}Y(W,G,J,$,z,K,H)}}function aA(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var H6=N((IJ)=>{Object.defineProperty(IJ,"__esModule",{value:!0});IJ.getSchemaRefs=IJ.resolveUrl=IJ.normalizeId=IJ._getFullPath=IJ.getFullPath=IJ.inlineRef=void 0;var sA=u(),eA=PQ(),QF=jJ(),XF=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function YF(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!bQ(Q);if(!X)return!1;return PJ(Q)<=X}IJ.inlineRef=YF;var WF=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function bQ(Q){for(let X in Q){if(WF.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(bQ))return!0;if(typeof Y=="object"&&bQ(Y))return!0}return!1}function PJ(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,XF.has(Y))continue;if(typeof Q[Y]=="object")(0,sA.eachItem)(Q[Y],(W)=>X+=PJ(W));if(X===1/0)return 1/0}return X}function bJ(Q,X="",Y){if(Y!==!1)X=b1(X);let W=Q.parse(X);return EJ(Q,W)}IJ.getFullPath=bJ;function EJ(Q,X){return Q.serialize(X).split("#")[0]+"#"}IJ._getFullPath=EJ;var GF=/#\/?$/;function b1(Q){return Q?Q.replace(GF,""):""}IJ.normalizeId=b1;function JF(Q,X,Y){return Y=b1(Y),Q.resolve(X,Y)}IJ.resolveUrl=JF;var $F=/^[a-z_][-a-z0-9._]*$/i;function zF(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,G=b1(Q[Y]||X),J={"":G},$=bJ(W,G,!1),z={},K=new Set;return QF(Q,{allKeys:!0},(A,L,U,O)=>{if(O===void 0)return;let V=$+L,Z=J[O];if(typeof A[Y]=="string")Z=M.call(this,A[Y]);T.call(this,A.$anchor),T.call(this,A.$dynamicAnchor),J[L]=Z;function M(E){let v=this.opts.uriResolver.resolve;if(E=b1(Z?v(Z,E):E),K.has(E))throw B(E);K.add(E);let I=this.refs[E];if(typeof I=="string")I=this.refs[I];if(typeof I=="object")H(A,I.schema,E);else if(E!==b1(V))if(E[0]==="#")H(A,z[E],E),z[E]=A;else this.refs[E]=V;return E}function T(E){if(typeof E=="string"){if(!$F.test(E))throw Error(`invalid anchor "${E}"`);M.call(this,`#${E}`)}}}),z;function H(A,L,U){if(L!==void 0&&!eA(A,L))throw B(U)}function B(A){return Error(`reference "${A}" resolves to more than one schema`)}}IJ.getSchemaRefs=zF});var A6=N((cJ)=>{Object.defineProperty(cJ,"__esModule",{value:!0});cJ.getData=cJ.KeywordCxt=cJ.validateFunctionCode=void 0;var vJ=dG(),SJ=z6(),IQ=VQ(),w4=z6(),DF=zJ(),B6=OJ(),EQ=NJ(),P=k(),S=f0(),LF=H6(),m0=u(),K6=$6();function UF(Q){if(yJ(Q)){if(gJ(Q),_J(Q)){MF(Q);return}}xJ(Q,()=>(0,vJ.topBoolOrEmptySchema)(Q))}cJ.validateFunctionCode=UF;function xJ({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:G},J){if(G.code.es5)Q.func(X,P._`${S.default.data}, ${S.default.valCxt}`,W.$async,()=>{Q.code(P._`"use strict"; ${RJ(Y,G)}`),VF(Q,G),Q.code(J)});else Q.func(X,P._`${S.default.data}, ${OF(G)}`,W.$async,()=>Q.code(RJ(Y,G)).code(J))}function OF(Q){return P._`{${S.default.instancePath}="", ${S.default.parentData}, ${S.default.parentDataProperty}, ${S.default.rootData}=${S.default.data}${Q.dynamicRef?P._`, ${S.default.dynamicAnchors}={}`:P.nil}}={}`}function VF(Q,X){Q.if(S.default.valCxt,()=>{if(Q.var(S.default.instancePath,P._`${S.default.valCxt}.${S.default.instancePath}`),Q.var(S.default.parentData,P._`${S.default.valCxt}.${S.default.parentData}`),Q.var(S.default.parentDataProperty,P._`${S.default.valCxt}.${S.default.parentDataProperty}`),Q.var(S.default.rootData,P._`${S.default.valCxt}.${S.default.rootData}`),X.dynamicRef)Q.var(S.default.dynamicAnchors,P._`${S.default.valCxt}.${S.default.dynamicAnchors}`)},()=>{if(Q.var(S.default.instancePath,P._`""`),Q.var(S.default.parentData,P._`undefined`),Q.var(S.default.parentDataProperty,P._`undefined`),Q.var(S.default.rootData,S.default.data),X.dynamicRef)Q.var(S.default.dynamicAnchors,P._`{}`)})}function MF(Q){let{schema:X,opts:Y,gen:W}=Q;xJ(Q,()=>{if(Y.$comment&&X.$comment)uJ(Q);if(jF(Q),W.let(S.default.vErrors,null),W.let(S.default.errors,0),Y.unevaluated)ZF(Q);hJ(Q),EF(Q)});return}function ZF(Q){let{gen:X,validateName:Y}=Q;Q.evaluated=X.const("evaluated",P._`${Y}.evaluated`),X.if(P._`${Q.evaluated}.dynamicProps`,()=>X.assign(P._`${Q.evaluated}.props`,P._`undefined`)),X.if(P._`${Q.evaluated}.dynamicItems`,()=>X.assign(P._`${Q.evaluated}.items`,P._`undefined`))}function RJ(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?P._`/*# sourceURL=${Y} */`:P.nil}function NF(Q,X){if(yJ(Q)){if(gJ(Q),_J(Q)){qF(Q,X);return}}(0,vJ.boolOrEmptySchema)(Q,X)}function _J({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 yJ(Q){return typeof Q.schema!="boolean"}function qF(Q,X){let{schema:Y,gen:W,opts:G}=Q;if(G.$comment&&Y.$comment)uJ(Q);PF(Q),bF(Q);let J=W.const("_errs",S.default.errors);hJ(Q,J),W.var(X,P._`${J} === ${S.default.errors}`)}function gJ(Q){(0,m0.checkUnknownRules)(Q),wF(Q)}function hJ(Q,X){if(Q.opts.jtd)return CJ(Q,[],!1,X);let Y=(0,SJ.getSchemaTypes)(Q.schema),W=(0,SJ.coerceAndCheckDataType)(Q,Y);CJ(Q,Y,!W,X)}function wF(Q){let{schema:X,errSchemaPath:Y,opts:W,self:G}=Q;if(X.$ref&&W.ignoreKeywordsWithRef&&(0,m0.schemaHasRulesButRef)(X,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function jF(Q){let{schema:X,opts:Y}=Q;if(X.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,m0.checkStrictMode)(Q,"default is ignored in the schema root")}function PF(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,LF.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function bF(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function uJ({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:G}){let J=Y.$comment;if(G.$comment===!0)Q.code(P._`${S.default.self}.logger.log(${J})`);else if(typeof G.$comment=="function"){let $=P.str`${W}/$comment`,z=Q.scopeValue("root",{ref:X.root});Q.code(P._`${S.default.self}.opts.$comment(${J}, ${$}, ${z}.schema)`)}}function EF(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:G,opts:J}=Q;if(Y.$async)X.if(P._`${S.default.errors} === 0`,()=>X.return(S.default.data),()=>X.throw(P._`new ${G}(${S.default.vErrors})`));else{if(X.assign(P._`${W}.errors`,S.default.vErrors),J.unevaluated)IF(Q);X.return(P._`${S.default.errors} === 0`)}}function IF({gen:Q,evaluated:X,props:Y,items:W}){if(Y instanceof P.Name)Q.assign(P._`${X}.props`,Y);if(W instanceof P.Name)Q.assign(P._`${X}.items`,W)}function CJ(Q,X,Y,W){let{gen:G,schema:J,data:$,allErrors:z,opts:K,self:H}=Q,{RULES:B}=H;if(J.$ref&&(K.ignoreKeywordsWithRef||!(0,m0.schemaHasRulesButRef)(J,B))){G.block(()=>mJ(Q,"$ref",B.all.$ref.definition));return}if(!K.jtd)TF(Q,X);G.block(()=>{for(let L of B.rules)A(L);A(B.post)});function A(L){if(!(0,IQ.shouldUseGroup)(J,L))return;if(L.type){if(G.if((0,w4.checkDataType)(L.type,$,K.strictNumbers)),kJ(Q,L),X.length===1&&X[0]===L.type&&Y)G.else(),(0,w4.reportTypeError)(Q);G.endIf()}else kJ(Q,L);if(!z)G.if(P._`${S.default.errors} === ${W||0}`)}}function kJ(Q,X){let{gen:Y,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,DF.assignDefaults)(Q,X.type);Y.block(()=>{for(let J of X.rules)if((0,IQ.shouldUseRule)(W,J))mJ(Q,J.keyword,J.definition,X.type)})}function TF(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(SF(Q,X),!Q.opts.allowUnionTypes)RF(Q,X);CF(Q,Q.dataTypes)}function SF(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!fJ(Q.dataTypes,Y))TQ(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),vF(Q,X)}function RF(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))TQ(Q,"use allowUnionTypes to allow union type keyword")}function CF(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let G=Y[W];if(typeof G=="object"&&(0,IQ.shouldUseRule)(Q.schema,G)){let{type:J}=G.definition;if(J.length&&!J.some(($)=>kF(X,$)))TQ(Q,`missing type "${J.join(",")}" for keyword "${W}"`)}}}function kF(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function fJ(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function vF(Q,X){let Y=[];for(let W of Q.dataTypes)if(fJ(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function TQ(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,m0.checkStrictMode)(Q,X,Q.opts.strictTypes)}class SQ{constructor(Q,X,Y){if((0,B6.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,m0.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",lJ(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,B6.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",S.default.errors)}result(Q,X,Y){this.failResult((0,P.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,P.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(P._`${X} !== undefined && (${(0,P.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?K6.reportExtraError:K6.reportError)(this,this.def.error,X)}$dataError(){(0,K6.reportError)(this,this.def.$dataError||K6.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,K6.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=P.nil){this.gen.block(()=>{this.check$data(Q,Y),X()})}check$data(Q=P.nil,X=P.nil){if(!this.$data)return;let{gen:Y,schemaCode:W,schemaType:G,def:J}=this;if(Y.if((0,P.or)(P._`${W} === undefined`,X)),Q!==P.nil)Y.assign(Q,!0);if(G.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),Q!==P.nil)Y.assign(Q,!1)}Y.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:Y,def:W,it:G}=this;return(0,P.or)(J(),$());function J(){if(Y.length){if(!(X instanceof P.Name))throw Error("ajv implementation error");let z=Array.isArray(Y)?Y:[Y];return P._`${(0,w4.checkDataTypes)(z,X,G.opts.strictNumbers,w4.DataType.Wrong)}`}return P.nil}function $(){if(W.validateSchema){let z=Q.scopeValue("validate$data",{ref:W.validateSchema});return P._`!${z}(${X})`}return P.nil}}subschema(Q,X){let Y=(0,EQ.getSubschema)(this.it,Q);(0,EQ.extendSubschemaData)(Y,this.it,Q),(0,EQ.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return NF(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=m0.mergeEvaluated.props(W,Q.props,Y.props,X);if(Y.items!==!0&&Q.items!==void 0)Y.items=m0.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,P.Name)),!0}}cJ.KeywordCxt=SQ;function mJ(Q,X,Y,W){let G=new SQ(Q,Y,X);if("code"in Y)Y.code(G,W);else if(G.$data&&Y.validate)(0,B6.funcKeywordCode)(G,Y);else if("macro"in Y)(0,B6.macroKeywordCode)(G,Y);else if(Y.compile||Y.validate)(0,B6.funcKeywordCode)(G,Y)}var xF=/^\/(?:[^~]|~0|~1)*$/,_F=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function lJ(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let G,J;if(Q==="")return S.default.rootData;if(Q[0]==="/"){if(!xF.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,J=S.default.rootData}else{let H=_F.exec(Q);if(!H)throw Error(`Invalid JSON-pointer: ${Q}`);let B=+H[1];if(G=H[2],G==="#"){if(B>=X)throw Error(K("property/index",B));return W[X-B]}if(B>X)throw Error(K("data",B));if(J=Y[X-B],!G)return J}let $=J,z=G.split("/");for(let H of z)if(H)J=P._`${J}${(0,P.getProperty)((0,m0.unescapeJsonPointer)(H))}`,$=P._`${$} && ${J}`;return $;function K(H,B){return`Cannot access ${H} ${B} levels up, current level is ${X}`}}cJ.getData=lJ});var j4=N((dJ)=>{Object.defineProperty(dJ,"__esModule",{value:!0});class iJ extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}dJ.default=iJ});var F6=N((nJ)=>{Object.defineProperty(nJ,"__esModule",{value:!0});var RQ=H6();class rJ extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,RQ.resolveUrl)(Q,X,Y),this.missingSchema=(0,RQ.normalizeId)((0,RQ.getFullPath)(Q,this.missingRef))}}nJ.default=rJ});var b4=N((aJ)=>{Object.defineProperty(aJ,"__esModule",{value:!0});aJ.resolveSchema=aJ.getCompilingSchema=aJ.resolveRef=aJ.compileSchema=aJ.SchemaEnv=void 0;var E0=k(),fF=j4(),K1=f0(),I0=H6(),oJ=u(),mF=A6();class D6{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,I0.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={}}}aJ.SchemaEnv=D6;function kQ(Q){let X=tJ.call(this,Q);if(X)return X;let Y=(0,I0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:J}=this.opts,$=new E0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:J}),z;if(Q.$async)z=$.scopeValue("Error",{ref:fF.default,code:E0._`require("ajv/dist/runtime/validation_error").default`});let K=$.scopeName("validate");Q.validateName=K;let H={gen:$,allErrors:this.opts.allErrors,data:K1.default.data,parentData:K1.default.parentData,parentDataProperty:K1.default.parentDataProperty,dataNames:[K1.default.data],dataPathArr:[E0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:$.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,E0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:K,ValidationError:z,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},B;try{this._compilations.add(Q),(0,mF.validateFunctionCode)(H),$.optimize(this.opts.code.optimize);let A=$.toString();if(B=`${$.scopeRefs(K1.default.scope)}return ${A}`,this.opts.code.process)B=this.opts.code.process(B,Q);let U=Function(`${K1.default.self}`,`${K1.default.scope}`,B)(this,this.scope.get());if(this.scope.value(K,{ref:U}),U.errors=null,U.schema=Q.schema,U.schemaEnv=Q,Q.$async)U.$async=!0;if(this.opts.code.source===!0)U.source={validateName:K,validateCode:A,scopeValues:$._values};if(this.opts.unevaluated){let{props:O,items:V}=H;if(U.evaluated={props:O instanceof E0.Name?void 0:O,items:V instanceof E0.Name?void 0:V,dynamicProps:O instanceof E0.Name,dynamicItems:V instanceof E0.Name},U.source)U.source.evaluated=(0,E0.stringify)(U.evaluated)}return Q.validate=U,Q}catch(A){if(delete Q.validate,delete Q.validateName,B)this.logger.error("Error compiling schema, function code:",B);throw A}finally{this._compilations.delete(Q)}}aJ.compileSchema=kQ;function lF(Q,X,Y){var W;Y=(0,I0.resolveUrl)(this.opts.uriResolver,X,Y);let G=Q.refs[Y];if(G)return G;let J=iF.call(this,Q,Y);if(J===void 0){let $=(W=Q.localRefs)===null||W===void 0?void 0:W[Y],{schemaId:z}=this.opts;if($)J=new D6({schema:$,schemaId:z,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[Y]=cF.call(this,J)}aJ.resolveRef=lF;function cF(Q){if((0,I0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:kQ.call(this,Q)}function tJ(Q){for(let X of this._compilations)if(pF(X,Q))return X}aJ.getCompilingSchema=tJ;function pF(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function iF(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||P4.call(this,Q,X)}function P4(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,I0._getFullPath)(this.opts.uriResolver,Y),G=(0,I0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return CQ.call(this,Y,Q);let J=(0,I0.normalizeId)(W),$=this.refs[J]||this.schemas[J];if(typeof $=="string"){let z=P4.call(this,Q,$);if(typeof(z===null||z===void 0?void 0:z.schema)!=="object")return;return CQ.call(this,Y,z)}if(typeof($===null||$===void 0?void 0:$.schema)!=="object")return;if(!$.validate)kQ.call(this,$);if(J===(0,I0.normalizeId)(X)){let{schema:z}=$,{schemaId:K}=this.opts,H=z[K];if(H)G=(0,I0.resolveUrl)(this.opts.uriResolver,G,H);return new D6({schema:z,schemaId:K,root:Q,baseId:G})}return CQ.call(this,Y,$)}aJ.resolveSchema=P4;var dF=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function CQ(Q,{baseId:X,schema:Y,root:W}){var G;if(((G=Q.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let z of Q.fragment.slice(1).split("/")){if(typeof Y==="boolean")return;let K=Y[(0,oJ.unescapeFragment)(z)];if(K===void 0)return;Y=K;let H=typeof Y==="object"&&Y[this.opts.schemaId];if(!dF.has(z)&&H)X=(0,I0.resolveUrl)(this.opts.uriResolver,X,H)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,oJ.schemaHasRulesButRef)(Y,this.RULES)){let z=(0,I0.resolveUrl)(this.opts.uriResolver,X,Y.$ref);J=P4.call(this,W,z)}let{schemaId:$}=this.opts;if(J=J||new D6({schema:Y,schemaId:$,root:W,baseId:X}),J.schema!==J.root.schema)return J;return}});var eJ=N((cj,aF)=>{aF.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 xQ=N((pj,W7)=>{var sF=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),X7=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function vQ(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 eF=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Q7(Q){return Q.length=0,!0}function QD(Q,X,Y){if(Q.length){let W=vQ(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function XD(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],G=[],J=!1,$=!1,z=QD;for(let K=0;K<Q.length;K++){let H=Q[K];if(H==="["||H==="]")continue;if(H===":"){if(J===!0)$=!0;if(!z(G,W,Y))break;if(++X>7){Y.error=!0;break}if(K>0&&Q[K-1]===":")J=!0;W.push(":");continue}else if(H==="%"){if(!z(G,W,Y))break;z=Q7}else{G.push(H);continue}}if(G.length)if(z===Q7)Y.zone=G.join("");else if($)W.push(G.join(""));else W.push(vQ(G));return Y.address=W.join(""),Y}function Y7(Q){if(YD(Q,":")<2)return{host:Q,isIPV6:!1};let X=XD(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 YD(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function WD(Q){let X=Q,Y=[],W=-1,G=0;while(G=X.length){if(G===1)if(X===".")break;else if(X==="/"){Y.push("/");break}else{Y.push(X);break}else if(G===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(G===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("")}function GD(Q,X){let Y=X!==!0?escape:unescape;if(Q.scheme!==void 0)Q.scheme=Y(Q.scheme);if(Q.userinfo!==void 0)Q.userinfo=Y(Q.userinfo);if(Q.host!==void 0)Q.host=Y(Q.host);if(Q.path!==void 0)Q.path=Y(Q.path);if(Q.query!==void 0)Q.query=Y(Q.query);if(Q.fragment!==void 0)Q.fragment=Y(Q.fragment);return Q}function JD(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(!X7(Y)){let W=Y7(Y);if(W.isIPV6===!0)Y=`[${W.escapedHost}]`;else Y=Q.host}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}W7.exports={nonSimpleDomain:eF,recomposeAuthority:JD,normalizeComponentEncoding:GD,removeDotSegments:WD,isIPv4:X7,isUUID:sF,normalizeIPv6:Y7,stringArrayToHexStripped:vQ}});var H7=N((ij,z7)=>{var{isUUID:$D}=xQ(),zD=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,HD=["http","https","ws","wss","urn","urn:uuid"];function KD(Q){return HD.indexOf(Q)!==-1}function _Q(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 G7(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function J7(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 BD(Q){return Q.secure=_Q(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function AD(Q){if(Q.port===(_Q(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 FD(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(zD);if(Y){let W=X.scheme||Q.scheme||"urn";Q.nid=Y[1].toLowerCase(),Q.nss=Y[2];let G=`${W}:${X.nid||Q.nid}`,J=yQ(G);if(Q.path=void 0,J)Q=J.parse(Q,X)}else Q.error=Q.error||"URN can not be parsed.";return Q}function DD(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(),G=`${Y}:${X.nid||W}`,J=yQ(G);if(J)Q=J.serialize(Q,X);let $=Q,z=Q.nss;return $.path=`${W||X.nid}:${z}`,X.skipEscape=!0,$}function LD(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!$D(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function UD(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var $7={scheme:"http",domainHost:!0,parse:G7,serialize:J7},OD={scheme:"https",domainHost:$7.domainHost,parse:G7,serialize:J7},E4={scheme:"ws",domainHost:!0,parse:BD,serialize:AD},VD={scheme:"wss",domainHost:E4.domainHost,parse:E4.parse,serialize:E4.serialize},MD={scheme:"urn",parse:FD,serialize:DD,skipNormalize:!0},ZD={scheme:"urn:uuid",parse:LD,serialize:UD,skipNormalize:!0},I4={http:$7,https:OD,ws:E4,wss:VD,urn:MD,"urn:uuid":ZD};Object.setPrototypeOf(I4,null);function yQ(Q){return Q&&(I4[Q]||I4[Q.toLowerCase()])||void 0}z7.exports={wsIsSecure:_Q,SCHEMES:I4,isValidSchemeName:KD,getSchemeHandler:yQ}});var A7=N((dj,S4)=>{var{normalizeIPv6:ND,removeDotSegments:L6,recomposeAuthority:qD,normalizeComponentEncoding:T4,isIPv4:wD,nonSimpleDomain:jD}=xQ(),{SCHEMES:PD,getSchemeHandler:K7}=H7();function bD(Q,X){if(typeof Q==="string")Q=k0(l0(Q,X),X);else if(typeof Q==="object")Q=l0(k0(Q,X),X);return Q}function ED(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},G=B7(l0(Q,W),l0(X,W),W,!0);return W.skipEscape=!0,k0(G,W)}function B7(Q,X,Y,W){let G={};if(!W)Q=l0(k0(Q,Y),Y),X=l0(k0(X,Y),Y);if(Y=Y||{},!Y.tolerant&&X.scheme)G.scheme=X.scheme,G.userinfo=X.userinfo,G.host=X.host,G.port=X.port,G.path=L6(X.path||""),G.query=X.query;else{if(X.userinfo!==void 0||X.host!==void 0||X.port!==void 0)G.userinfo=X.userinfo,G.host=X.host,G.port=X.port,G.path=L6(X.path||""),G.query=X.query;else{if(!X.path)if(G.path=Q.path,X.query!==void 0)G.query=X.query;else G.query=Q.query;else{if(X.path[0]==="/")G.path=L6(X.path);else{if((Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)&&!Q.path)G.path="/"+X.path;else if(!Q.path)G.path=X.path;else G.path=Q.path.slice(0,Q.path.lastIndexOf("/")+1)+X.path;G.path=L6(G.path)}G.query=X.query}G.userinfo=Q.userinfo,G.host=Q.host,G.port=Q.port}G.scheme=Q.scheme}return G.fragment=X.fragment,G}function ID(Q,X,Y){if(typeof Q==="string")Q=unescape(Q),Q=k0(T4(l0(Q,Y),!0),{...Y,skipEscape:!0});else if(typeof Q==="object")Q=k0(T4(Q,!0),{...Y,skipEscape:!0});if(typeof X==="string")X=unescape(X),X=k0(T4(l0(X,Y),!0),{...Y,skipEscape:!0});else if(typeof X==="object")X=k0(T4(X,!0),{...Y,skipEscape:!0});return Q.toLowerCase()===X.toLowerCase()}function k0(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),G=[],J=K7(W.scheme||Y.scheme);if(J&&J.serialize)J.serialize(Y,W);if(Y.path!==void 0)if(!W.skipEscape){if(Y.path=escape(Y.path),Y.scheme!==void 0)Y.path=Y.path.split("%3A").join(":")}else Y.path=unescape(Y.path);if(W.reference!=="suffix"&&Y.scheme)G.push(Y.scheme,":");let $=qD(Y);if($!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push($),Y.path&&Y.path[0]!=="/")G.push("/")}if(Y.path!==void 0){let z=Y.path;if(!W.absolutePath&&(!J||!J.absolutePath))z=L6(z);if($===void 0&&z[0]==="/"&&z[1]==="/")z="/%2F"+z.slice(2);G.push(z)}if(Y.query!==void 0)G.push("?",Y.query);if(Y.fragment!==void 0)G.push("#",Y.fragment);return G.join("")}var TD=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function l0(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},G=!1;if(Y.reference==="suffix")if(Y.scheme)Q=Y.scheme+":"+Q;else Q="//"+Q;let J=Q.match(TD);if(J){if(W.scheme=J[1],W.userinfo=J[3],W.host=J[4],W.port=parseInt(J[5],10),W.path=J[6]||"",W.query=J[7],W.fragment=J[8],isNaN(W.port))W.port=J[5];if(W.host)if(wD(W.host)===!1){let K=ND(W.host);W.host=K.host.toLowerCase(),G=K.isIPV6}else G=!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 $=K7(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!$||!$.unicodeSupport)){if(W.host&&(Y.domainHost||$&&$.domainHost)&&G===!1&&jD(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(!$||$&&!$.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=unescape(W.host)}if(W.path)W.path=escape(unescape(W.path));if(W.fragment)W.fragment=encodeURI(decodeURIComponent(W.fragment))}if($&&$.parse)$.parse(W,Y)}else W.error=W.error||"URI can not be parsed.";return W}var gQ={SCHEMES:PD,normalize:bD,resolve:ED,resolveComponent:B7,equal:ID,serialize:k0,parse:l0};S4.exports=gQ;S4.exports.default=gQ;S4.exports.fastUri=gQ});var L7=N((D7)=>{Object.defineProperty(D7,"__esModule",{value:!0});var F7=A7();F7.code='require("ajv/dist/runtime/uri").default';D7.default=F7});var w7=N((c0)=>{Object.defineProperty(c0,"__esModule",{value:!0});c0.CodeGen=c0.Name=c0.nil=c0.stringify=c0.str=c0._=c0.KeywordCxt=void 0;var RD=A6();Object.defineProperty(c0,"KeywordCxt",{enumerable:!0,get:function(){return RD.KeywordCxt}});var E1=k();Object.defineProperty(c0,"_",{enumerable:!0,get:function(){return E1._}});Object.defineProperty(c0,"str",{enumerable:!0,get:function(){return E1.str}});Object.defineProperty(c0,"stringify",{enumerable:!0,get:function(){return E1.stringify}});Object.defineProperty(c0,"nil",{enumerable:!0,get:function(){return E1.nil}});Object.defineProperty(c0,"Name",{enumerable:!0,get:function(){return E1.Name}});Object.defineProperty(c0,"CodeGen",{enumerable:!0,get:function(){return E1.CodeGen}});var CD=j4(),Z7=F6(),kD=OQ(),U6=b4(),vD=k(),O6=H6(),R4=z6(),uQ=u(),U7=eJ(),xD=L7(),N7=(Q,X)=>new RegExp(Q,X);N7.code="new RegExp";var _D=["removeAdditional","useDefaults","coerceTypes"],yD=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),gD={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."},hD={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},O7=200;function uD(Q){var X,Y,W,G,J,$,z,K,H,B,A,L,U,O,V,Z,M,T,E,v,I,R0,x0,r4,n4;let C1=Q.strict,o4=(X=Q.code)===null||X===void 0?void 0:X.optimize,DX=o4===!0||o4===void 0?1:o4||0,LX=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:N7,n$=(G=Q.uriResolver)!==null&&G!==void 0?G:xD.default;return{strictSchema:($=(J=Q.strictSchema)!==null&&J!==void 0?J:C1)!==null&&$!==void 0?$:!0,strictNumbers:(K=(z=Q.strictNumbers)!==null&&z!==void 0?z:C1)!==null&&K!==void 0?K:!0,strictTypes:(B=(H=Q.strictTypes)!==null&&H!==void 0?H:C1)!==null&&B!==void 0?B:"log",strictTuples:(L=(A=Q.strictTuples)!==null&&A!==void 0?A:C1)!==null&&L!==void 0?L:"log",strictRequired:(O=(U=Q.strictRequired)!==null&&U!==void 0?U:C1)!==null&&O!==void 0?O:!1,code:Q.code?{...Q.code,optimize:DX,regExp:LX}:{optimize:DX,regExp:LX},loopRequired:(V=Q.loopRequired)!==null&&V!==void 0?V:O7,loopEnum:(Z=Q.loopEnum)!==null&&Z!==void 0?Z:O7,meta:(M=Q.meta)!==null&&M!==void 0?M:!0,messages:(T=Q.messages)!==null&&T!==void 0?T:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(v=Q.schemaId)!==null&&v!==void 0?v:"$id",addUsedSchema:(I=Q.addUsedSchema)!==null&&I!==void 0?I:!0,validateSchema:(R0=Q.validateSchema)!==null&&R0!==void 0?R0:!0,validateFormats:(x0=Q.validateFormats)!==null&&x0!==void 0?x0:!0,unicodeRegExp:(r4=Q.unicodeRegExp)!==null&&r4!==void 0?r4:!0,int32range:(n4=Q.int32range)!==null&&n4!==void 0?n4:!0,uriResolver:n$}}class C4{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...uD(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new vD.ValueScope({scope:{},prefixes:yD,es5:X,lines:Y}),this.logger=iD(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,kD.getRules)(),V7.call(this,gD,Q,"NOT SUPPORTED"),V7.call(this,hD,Q,"DEPRECATED","warn"),this._metaOpts=cD.call(this),Q.formats)mD.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)lD.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);fD.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=U7;if(Y==="id")W={...U7},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(H,B){await G.call(this,H.$schema);let A=this._addSchema(H,B);return A.validate||J.call(this,A)}async function G(H){if(H&&!this.getSchema(H))await W.call(this,{$ref:H},!0)}async function J(H){try{return this._compileSchemaEnv(H)}catch(B){if(!(B instanceof Z7.default))throw B;return $.call(this,B),await z.call(this,B.missingSchema),J.call(this,H)}}function $({missingSchema:H,missingRef:B}){if(this.refs[H])throw Error(`AnySchema ${H} is loaded but ${B} cannot be resolved`)}async function z(H){let B=await K.call(this,H);if(!this.refs[H])await G.call(this,B.$schema);if(!this.refs[H])this.addSchema(B,H,X)}async function K(H){let B=this._loading[H];if(B)return B;try{return await(this._loading[H]=Y(H))}finally{delete this._loading[H]}}}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 G;if(typeof Q==="object"){let{schemaId:J}=this.opts;if(G=Q[J],G!==void 0&&typeof G!="string")throw Error(`schema ${J} must be string`)}return X=(0,O6.normalizeId)(X||G),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 G="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(G);else throw Error(G)}return W}getSchema(Q){let X;while(typeof(X=M7.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new U6.SchemaEnv({schema:{},schemaId:Y});if(X=U6.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=M7.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,O6.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(rD.call(this,Y,X),!X)return(0,uQ.eachItem)(Y,(G)=>hQ.call(this,G)),this;oD.call(this,X);let W={...X,type:(0,R4.getJSONTypes)(X.type),schemaType:(0,R4.getJSONTypes)(X.schemaType)};return(0,uQ.eachItem)(Y,W.type.length===0?(G)=>hQ.call(this,G,W):(G)=>W.type.forEach((J)=>hQ.call(this,G,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((G)=>G.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,G)=>W+X+G)}$dataMetaSchema(Q,X){let Y=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let W of X){let G=W.split("/").slice(1),J=Q;for(let $ of G)J=J[$];for(let $ in Y){let z=Y[$];if(typeof z!="object")continue;let{$data:K}=z.definition,H=J[$];if(K&&H)J[$]=q7(H)}}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,G=this.opts.addUsedSchema){let J,{schemaId:$}=this.opts;if(typeof Q=="object")J=Q[$];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 z=this._cache.get(Q);if(z!==void 0)return z;Y=(0,O6.normalizeId)(J||Y);let K=O6.getSchemaRefs.call(this,Q,Y);if(z=new U6.SchemaEnv({schema:Q,schemaId:$,meta:X,baseId:Y,localRefs:K}),this._cache.set(z.schema,z),G&&!Y.startsWith("#")){if(Y)this._checkUnique(Y);this.refs[Y]=z}if(W)this.validateSchema(Q,!0);return z}_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 U6.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{U6.compileSchema.call(this,Q)}finally{this.opts=X}}}C4.ValidationError=CD.default;C4.MissingRefError=Z7.default;c0.default=C4;function V7(Q,X,Y,W="error"){for(let G in Q){let J=G;if(J in X)this.logger[W](`${Y}: option ${G}. ${Q[J]}`)}}function M7(Q){return Q=(0,O6.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function fD(){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 mD(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function lD(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 cD(){let Q={...this.opts};for(let X of _D)delete Q[X];return Q}var pD={log(){},warn(){},error(){}};function iD(Q){if(Q===!1)return pD;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 dD=/^[a-z_$][a-z0-9_$:-]*$/i;function rD(Q,X){let{RULES:Y}=this;if((0,uQ.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!dD.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 hQ(Q,X,Y){var W;let G=X===null||X===void 0?void 0:X.post;if(Y&&G)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,$=G?J.post:J.rules.find(({type:K})=>K===Y);if(!$)$={type:Y,rules:[]},J.rules.push($);if(J.keywords[Q]=!0,!X)return;let z={keyword:Q,definition:{...X,type:(0,R4.getJSONTypes)(X.type),schemaType:(0,R4.getJSONTypes)(X.schemaType)}};if(X.before)nD.call(this,$,z,X.before);else $.rules.push(z);J.all[Q]=z,(W=X.implements)===null||W===void 0||W.forEach((K)=>this.addKeyword(K))}function nD(Q,X,Y){let W=Q.rules.findIndex((G)=>G.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 oD(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=q7(X);Q.validateSchema=this.compile(X,!0)}var tD={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function q7(Q){return{anyOf:[Q,tD]}}});var P7=N((j7)=>{Object.defineProperty(j7,"__esModule",{value:!0});var eD={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};j7.default=eD});var R7=N((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});T7.callRef=T7.getValidate=void 0;var XL=F6(),b7=N0(),D0=k(),I1=f0(),E7=b4(),k4=u(),YL={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:Y,it:W}=Q,{baseId:G,schemaEnv:J,validateName:$,opts:z,self:K}=W,{root:H}=J;if((Y==="#"||Y==="#/")&&G===H.baseId)return A();let B=E7.resolveRef.call(K,H,G,Y);if(B===void 0)throw new XL.default(W.opts.uriResolver,G,Y);if(B instanceof E7.SchemaEnv)return L(B);return U(B);function A(){if(J===H)return v4(Q,$,J,J.$async);let O=X.scopeValue("root",{ref:H});return v4(Q,D0._`${O}.validate`,H,H.$async)}function L(O){let V=I7(Q,O);v4(Q,V,O,O.$async)}function U(O){let V=X.scopeValue("schema",z.code.source===!0?{ref:O,code:(0,D0.stringify)(O)}:{ref:O}),Z=X.name("valid"),M=Q.subschema({schema:O,dataTypes:[],schemaPath:D0.nil,topSchemaRef:V,errSchemaPath:Y},Z);Q.mergeEvaluated(M),Q.ok(Z)}}};function I7(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):D0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}T7.getValidate=I7;function v4(Q,X,Y,W){let{gen:G,it:J}=Q,{allErrors:$,schemaEnv:z,opts:K}=J,H=K.passContext?I1.default.this:D0.nil;if(W)B();else A();function B(){if(!z.$async)throw Error("async schema referenced by sync schema");let O=G.let("valid");G.try(()=>{if(G.code(D0._`await ${(0,b7.callValidateCode)(Q,X,H)}`),U(X),!$)G.assign(O,!0)},(V)=>{if(G.if(D0._`!(${V} instanceof ${J.ValidationError})`,()=>G.throw(V)),L(V),!$)G.assign(O,!1)}),Q.ok(O)}function A(){Q.result((0,b7.callValidateCode)(Q,X,H),()=>U(X),()=>L(X))}function L(O){let V=D0._`${O}.errors`;G.assign(I1.default.vErrors,D0._`${I1.default.vErrors} === null ? ${V} : ${I1.default.vErrors}.concat(${V})`),G.assign(I1.default.errors,D0._`${I1.default.vErrors}.length`)}function U(O){var V;if(!J.opts.unevaluated)return;let Z=(V=Y===null||Y===void 0?void 0:Y.validate)===null||V===void 0?void 0:V.evaluated;if(J.props!==!0)if(Z&&!Z.dynamicProps){if(Z.props!==void 0)J.props=k4.mergeEvaluated.props(G,Z.props,J.props)}else{let M=G.var("props",D0._`${O}.evaluated.props`);J.props=k4.mergeEvaluated.props(G,M,J.props,D0.Name)}if(J.items!==!0)if(Z&&!Z.dynamicItems){if(Z.items!==void 0)J.items=k4.mergeEvaluated.items(G,Z.items,J.items)}else{let M=G.var("items",D0._`${O}.evaluated.items`);J.items=k4.mergeEvaluated.items(G,M,J.items,D0.Name)}}}T7.callRef=v4;T7.default=YL});var k7=N((C7)=>{Object.defineProperty(C7,"__esModule",{value:!0});var JL=P7(),$L=R7(),zL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",JL.default,$L.default];C7.default=zL});var x7=N((v7)=>{Object.defineProperty(v7,"__esModule",{value:!0});var x4=k(),Y1=x4.operators,_4={maximum:{okStr:"<=",ok:Y1.LTE,fail:Y1.GT},minimum:{okStr:">=",ok:Y1.GTE,fail:Y1.LT},exclusiveMaximum:{okStr:"<",ok:Y1.LT,fail:Y1.GTE},exclusiveMinimum:{okStr:">",ok:Y1.GT,fail:Y1.LTE}},KL={message:({keyword:Q,schemaCode:X})=>x4.str`must be ${_4[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>x4._`{comparison: ${_4[Q].okStr}, limit: ${X}}`},BL={keyword:Object.keys(_4),type:"number",schemaType:"number",$data:!0,error:KL,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(x4._`${Y} ${_4[X].fail} ${W} || isNaN(${Y})`)}};v7.default=BL});var y7=N((_7)=>{Object.defineProperty(_7,"__esModule",{value:!0});var V6=k(),FL={message:({schemaCode:Q})=>V6.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>V6._`{multipleOf: ${Q}}`},DL={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:FL,code(Q){let{gen:X,data:Y,schemaCode:W,it:G}=Q,J=G.opts.multipleOfPrecision,$=X.let("res"),z=J?V6._`Math.abs(Math.round(${$}) - ${$}) > 1e-${J}`:V6._`${$} !== parseInt(${$})`;Q.fail$data(V6._`(${W} === 0 || (${$} = ${Y}/${W}, ${z}))`)}};_7.default=DL});var u7=N((h7)=>{Object.defineProperty(h7,"__esModule",{value:!0});function g7(Q){let X=Q.length,Y=0,W=0,G;while(W<X)if(Y++,G=Q.charCodeAt(W++),G>=55296&&G<=56319&&W<X){if(G=Q.charCodeAt(W),(G&64512)===56320)W++}return Y}h7.default=g7;g7.code='require("ajv/dist/runtime/ucs2length").default'});var m7=N((f7)=>{Object.defineProperty(f7,"__esModule",{value:!0});var B1=k(),OL=u(),VL=u7(),ML={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return B1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>B1._`{limit: ${Q}}`},ZL={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:ML,code(Q){let{keyword:X,data:Y,schemaCode:W,it:G}=Q,J=X==="maxLength"?B1.operators.GT:B1.operators.LT,$=G.opts.unicode===!1?B1._`${Y}.length`:B1._`${(0,OL.useFunc)(Q.gen,VL.default)}(${Y})`;Q.fail$data(B1._`${$} ${J} ${W}`)}};f7.default=ZL});var c7=N((l7)=>{Object.defineProperty(l7,"__esModule",{value:!0});var qL=N0(),y4=k(),wL={message:({schemaCode:Q})=>y4.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>y4._`{pattern: ${Q}}`},jL={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:wL,code(Q){let{data:X,$data:Y,schema:W,schemaCode:G,it:J}=Q,$=J.opts.unicodeRegExp?"u":"",z=Y?y4._`(new RegExp(${G}, ${$}))`:(0,qL.usePattern)(Q,W);Q.fail$data(y4._`!${z}.test(${X})`)}};l7.default=jL});var i7=N((p7)=>{Object.defineProperty(p7,"__esModule",{value:!0});var M6=k(),bL={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return M6.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>M6._`{limit: ${Q}}`},EL={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:bL,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxProperties"?M6.operators.GT:M6.operators.LT;Q.fail$data(M6._`Object.keys(${Y}).length ${G} ${W}`)}};p7.default=EL});var r7=N((d7)=>{Object.defineProperty(d7,"__esModule",{value:!0});var Z6=N0(),N6=k(),TL=u(),SL={message:({params:{missingProperty:Q}})=>N6.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>N6._`{missingProperty: ${Q}}`},RL={keyword:"required",type:"object",schemaType:"array",$data:!0,error:SL,code(Q){let{gen:X,schema:Y,schemaCode:W,data:G,$data:J,it:$}=Q,{opts:z}=$;if(!J&&Y.length===0)return;let K=Y.length>=z.loopRequired;if($.allErrors)H();else B();if(z.strictRequired){let U=Q.parentSchema.properties,{definedProperties:O}=Q.it;for(let V of Y)if((U===null||U===void 0?void 0:U[V])===void 0&&!O.has(V)){let Z=$.schemaEnv.baseId+$.errSchemaPath,M=`required property "${V}" is not defined at "${Z}" (strictRequired)`;(0,TL.checkStrictMode)($,M,$.opts.strictRequired)}}function H(){if(K||J)Q.block$data(N6.nil,A);else for(let U of Y)(0,Z6.checkReportMissingProp)(Q,U)}function B(){let U=X.let("missing");if(K||J){let O=X.let("valid",!0);Q.block$data(O,()=>L(U,O)),Q.ok(O)}else X.if((0,Z6.checkMissingProp)(Q,Y,U)),(0,Z6.reportMissingProp)(Q,U),X.else()}function A(){X.forOf("prop",W,(U)=>{Q.setParams({missingProperty:U}),X.if((0,Z6.noPropertyInData)(X,G,U,z.ownProperties),()=>Q.error())})}function L(U,O){Q.setParams({missingProperty:U}),X.forOf(U,W,()=>{X.assign(O,(0,Z6.propertyInData)(X,G,U,z.ownProperties)),X.if((0,N6.not)(O),()=>{Q.error(),X.break()})},N6.nil)}}};d7.default=RL});var o7=N((n7)=>{Object.defineProperty(n7,"__esModule",{value:!0});var q6=k(),kL={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return q6.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>q6._`{limit: ${Q}}`},vL={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:kL,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxItems"?q6.operators.GT:q6.operators.LT;Q.fail$data(q6._`${Y}.length ${G} ${W}`)}};n7.default=vL});var g4=N((a7)=>{Object.defineProperty(a7,"__esModule",{value:!0});var t7=PQ();t7.code='require("ajv/dist/runtime/equal").default';a7.default=t7});var e7=N((s7)=>{Object.defineProperty(s7,"__esModule",{value:!0});var fQ=z6(),J0=k(),yL=u(),gL=g4(),hL={message:({params:{i:Q,j:X}})=>J0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>J0._`{i: ${Q}, j: ${X}}`},uL={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:hL,code(Q){let{gen:X,data:Y,$data:W,schema:G,parentSchema:J,schemaCode:$,it:z}=Q;if(!W&&!G)return;let K=X.let("valid"),H=J.items?(0,fQ.getSchemaTypes)(J.items):[];Q.block$data(K,B,J0._`${$} === false`),Q.ok(K);function B(){let O=X.let("i",J0._`${Y}.length`),V=X.let("j");Q.setParams({i:O,j:V}),X.assign(K,!0),X.if(J0._`${O} > 1`,()=>(A()?L:U)(O,V))}function A(){return H.length>0&&!H.some((O)=>O==="object"||O==="array")}function L(O,V){let Z=X.name("item"),M=(0,fQ.checkDataTypes)(H,Z,z.opts.strictNumbers,fQ.DataType.Wrong),T=X.const("indices",J0._`{}`);X.for(J0._`;${O}--;`,()=>{if(X.let(Z,J0._`${Y}[${O}]`),X.if(M,J0._`continue`),H.length>1)X.if(J0._`typeof ${Z} == "string"`,J0._`${Z} += "_"`);X.if(J0._`typeof ${T}[${Z}] == "number"`,()=>{X.assign(V,J0._`${T}[${Z}]`),Q.error(),X.assign(K,!1).break()}).code(J0._`${T}[${Z}] = ${O}`)})}function U(O,V){let Z=(0,yL.useFunc)(X,gL.default),M=X.name("outer");X.label(M).for(J0._`;${O}--;`,()=>X.for(J0._`${V} = ${O}; ${V}--;`,()=>X.if(J0._`${Z}(${Y}[${O}], ${Y}[${V}])`,()=>{Q.error(),X.assign(K,!1).break(M)})))}}};s7.default=uL});var X5=N((Q5)=>{Object.defineProperty(Q5,"__esModule",{value:!0});var mQ=k(),mL=u(),lL=g4(),cL={message:"must be equal to constant",params:({schemaCode:Q})=>mQ._`{allowedValue: ${Q}}`},pL={keyword:"const",$data:!0,error:cL,code(Q){let{gen:X,data:Y,$data:W,schemaCode:G,schema:J}=Q;if(W||J&&typeof J=="object")Q.fail$data(mQ._`!${(0,mL.useFunc)(X,lL.default)}(${Y}, ${G})`);else Q.fail(mQ._`${J} !== ${Y}`)}};Q5.default=pL});var W5=N((Y5)=>{Object.defineProperty(Y5,"__esModule",{value:!0});var w6=k(),dL=u(),rL=g4(),nL={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>w6._`{allowedValues: ${Q}}`},oL={keyword:"enum",schemaType:"array",$data:!0,error:nL,code(Q){let{gen:X,data:Y,$data:W,schema:G,schemaCode:J,it:$}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let z=G.length>=$.opts.loopEnum,K,H=()=>K!==null&&K!==void 0?K:K=(0,dL.useFunc)(X,rL.default),B;if(z||W)B=X.let("valid"),Q.block$data(B,A);else{if(!Array.isArray(G))throw Error("ajv implementation error");let U=X.const("vSchema",J);B=(0,w6.or)(...G.map((O,V)=>L(U,V)))}Q.pass(B);function A(){X.assign(B,!1),X.forOf("v",J,(U)=>X.if(w6._`${H()}(${Y}, ${U})`,()=>X.assign(B,!0).break()))}function L(U,O){let V=G[O];return typeof V==="object"&&V!==null?w6._`${H()}(${Y}, ${U}[${O}])`:w6._`${Y} === ${V}`}}};Y5.default=oL});var J5=N((G5)=>{Object.defineProperty(G5,"__esModule",{value:!0});var aL=x7(),sL=y7(),eL=m7(),QU=c7(),XU=i7(),YU=r7(),WU=o7(),GU=e7(),JU=X5(),$U=W5(),zU=[aL.default,sL.default,eL.default,QU.default,XU.default,YU.default,WU.default,GU.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},JU.default,$U.default];G5.default=zU});var cQ=N((z5)=>{Object.defineProperty(z5,"__esModule",{value:!0});z5.validateAdditionalItems=void 0;var A1=k(),lQ=u(),KU={message:({params:{len:Q}})=>A1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>A1._`{limit: ${Q}}`},BU={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:KU,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,lQ.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}$5(Q,W)}};function $5(Q,X){let{gen:Y,schema:W,data:G,keyword:J,it:$}=Q;$.items=!0;let z=Y.const("len",A1._`${G}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(A1._`${z} <= ${X.length}`);else if(typeof W=="object"&&!(0,lQ.alwaysValidSchema)($,W)){let H=Y.var("valid",A1._`${z} <= ${X.length}`);Y.if((0,A1.not)(H),()=>K(H)),Q.ok(H)}function K(H){Y.forRange("i",X.length,z,(B)=>{if(Q.subschema({keyword:J,dataProp:B,dataPropType:lQ.Type.Num},H),!$.allErrors)Y.if((0,A1.not)(H),()=>Y.break())})}}z5.validateAdditionalItems=$5;z5.default=BU});var pQ=N((A5)=>{Object.defineProperty(A5,"__esModule",{value:!0});A5.validateTuple=void 0;var K5=k(),h4=u(),FU=N0(),DU={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return B5(Q,"additionalItems",X);if(Y.items=!0,(0,h4.alwaysValidSchema)(Y,X))return;Q.ok((0,FU.validateArray)(Q))}};function B5(Q,X,Y=Q.schema){let{gen:W,parentSchema:G,data:J,keyword:$,it:z}=Q;if(B(G),z.opts.unevaluated&&Y.length&&z.items!==!0)z.items=h4.mergeEvaluated.items(W,Y.length,z.items);let K=W.name("valid"),H=W.const("len",K5._`${J}.length`);Y.forEach((A,L)=>{if((0,h4.alwaysValidSchema)(z,A))return;W.if(K5._`${H} > ${L}`,()=>Q.subschema({keyword:$,schemaProp:L,dataProp:L},K)),Q.ok(K)});function B(A){let{opts:L,errSchemaPath:U}=z,O=Y.length,V=O===A.minItems&&(O===A.maxItems||A[X]===!1);if(L.strictTuples&&!V){let Z=`"${$}" is ${O}-tuple, but minItems or maxItems/${X} are not specified or different at path "${U}"`;(0,h4.checkStrictMode)(z,Z,L.strictTuples)}}}A5.validateTuple=B5;A5.default=DU});var L5=N((D5)=>{Object.defineProperty(D5,"__esModule",{value:!0});var UU=pQ(),OU={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,UU.validateTuple)(Q,"items")};D5.default=OU});var V5=N((O5)=>{Object.defineProperty(O5,"__esModule",{value:!0});var U5=k(),MU=u(),ZU=N0(),NU=cQ(),qU={message:({params:{len:Q}})=>U5.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>U5._`{limit: ${Q}}`},wU={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:qU,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:G}=Y;if(W.items=!0,(0,MU.alwaysValidSchema)(W,X))return;if(G)(0,NU.validateAdditionalItems)(Q,G);else Q.ok((0,ZU.validateArray)(Q))}};O5.default=wU});var Z5=N((M5)=>{Object.defineProperty(M5,"__esModule",{value:!0});var q0=k(),u4=u(),PU={message:({params:{min:Q,max:X}})=>X===void 0?q0.str`must contain at least ${Q} valid item(s)`:q0.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?q0._`{minContains: ${Q}}`:q0._`{minContains: ${Q}, maxContains: ${X}}`},bU={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:PU,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:J}=Q,$,z,{minContains:K,maxContains:H}=W;if(J.opts.next)$=K===void 0?1:K,z=H;else $=1;let B=X.const("len",q0._`${G}.length`);if(Q.setParams({min:$,max:z}),z===void 0&&$===0){(0,u4.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(z!==void 0&&$>z){(0,u4.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,u4.alwaysValidSchema)(J,Y)){let V=q0._`${B} >= ${$}`;if(z!==void 0)V=q0._`${V} && ${B} <= ${z}`;Q.pass(V);return}J.items=!0;let A=X.name("valid");if(z===void 0&&$===1)U(A,()=>X.if(A,()=>X.break()));else if($===0){if(X.let(A,!0),z!==void 0)X.if(q0._`${G}.length > 0`,L)}else X.let(A,!1),L();Q.result(A,()=>Q.reset());function L(){let V=X.name("_valid"),Z=X.let("count",0);U(V,()=>X.if(V,()=>O(Z)))}function U(V,Z){X.forRange("i",0,B,(M)=>{Q.subschema({keyword:"contains",dataProp:M,dataPropType:u4.Type.Num,compositeRule:!0},V),Z()})}function O(V){if(X.code(q0._`${V}++`),z===void 0)X.if(q0._`${V} >= ${$}`,()=>X.assign(A,!0).break());else if(X.if(q0._`${V} > ${z}`,()=>X.assign(A,!1).break()),$===1)X.assign(A,!0);else X.if(q0._`${V} >= ${$}`,()=>X.assign(A,!0))}}};M5.default=bU});var b5=N((w5)=>{Object.defineProperty(w5,"__esModule",{value:!0});w5.validateSchemaDeps=w5.validatePropertyDeps=w5.error=void 0;var iQ=k(),IU=u(),j6=N0();w5.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return iQ.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>iQ._`{property: ${Q},
|
|
7
|
+
missingProperty: ${W},
|
|
8
|
+
depsCount: ${X},
|
|
9
|
+
deps: ${Y}}`};var TU={keyword:"dependencies",type:"object",schemaType:"object",error:w5.error,code(Q){let[X,Y]=SU(Q);N5(Q,X),q5(Q,Y)}};function SU({schema:Q}){let X={},Y={};for(let W in Q){if(W==="__proto__")continue;let G=Array.isArray(Q[W])?X:Y;G[W]=Q[W]}return[X,Y]}function N5(Q,X=Q.schema){let{gen:Y,data:W,it:G}=Q;if(Object.keys(X).length===0)return;let J=Y.let("missing");for(let $ in X){let z=X[$];if(z.length===0)continue;let K=(0,j6.propertyInData)(Y,W,$,G.opts.ownProperties);if(Q.setParams({property:$,depsCount:z.length,deps:z.join(", ")}),G.allErrors)Y.if(K,()=>{for(let H of z)(0,j6.checkReportMissingProp)(Q,H)});else Y.if(iQ._`${K} && (${(0,j6.checkMissingProp)(Q,z,J)})`),(0,j6.reportMissingProp)(Q,J),Y.else()}}w5.validatePropertyDeps=N5;function q5(Q,X=Q.schema){let{gen:Y,data:W,keyword:G,it:J}=Q,$=Y.name("valid");for(let z in X){if((0,IU.alwaysValidSchema)(J,X[z]))continue;Y.if((0,j6.propertyInData)(Y,W,z,J.opts.ownProperties),()=>{let K=Q.subschema({keyword:G,schemaProp:z},$);Q.mergeValidEvaluated(K,$)},()=>Y.var($,!0)),Q.ok($)}}w5.validateSchemaDeps=q5;w5.default=TU});var T5=N((I5)=>{Object.defineProperty(I5,"__esModule",{value:!0});var E5=k(),kU=u(),vU={message:"property name must be valid",params:({params:Q})=>E5._`{propertyName: ${Q.propertyName}}`},xU={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:vU,code(Q){let{gen:X,schema:Y,data:W,it:G}=Q;if((0,kU.alwaysValidSchema)(G,Y))return;let J=X.name("valid");X.forIn("key",W,($)=>{Q.setParams({propertyName:$}),Q.subschema({keyword:"propertyNames",data:$,dataTypes:["string"],propertyName:$,compositeRule:!0},J),X.if((0,E5.not)(J),()=>{if(Q.error(!0),!G.allErrors)X.break()})}),Q.ok(J)}};I5.default=xU});var dQ=N((S5)=>{Object.defineProperty(S5,"__esModule",{value:!0});var f4=N0(),T0=k(),yU=f0(),m4=u(),gU={message:"must NOT have additional properties",params:({params:Q})=>T0._`{additionalProperty: ${Q.additionalProperty}}`},hU={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:gU,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,errsCount:J,it:$}=Q;if(!J)throw Error("ajv implementation error");let{allErrors:z,opts:K}=$;if($.props=!0,K.removeAdditional!=="all"&&(0,m4.alwaysValidSchema)($,Y))return;let H=(0,f4.allSchemaProperties)(W.properties),B=(0,f4.allSchemaProperties)(W.patternProperties);A(),Q.ok(T0._`${J} === ${yU.default.errors}`);function A(){X.forIn("key",G,(Z)=>{if(!H.length&&!B.length)O(Z);else X.if(L(Z),()=>O(Z))})}function L(Z){let M;if(H.length>8){let T=(0,m4.schemaRefOrVal)($,W.properties,"properties");M=(0,f4.isOwnProperty)(X,T,Z)}else if(H.length)M=(0,T0.or)(...H.map((T)=>T0._`${Z} === ${T}`));else M=T0.nil;if(B.length)M=(0,T0.or)(M,...B.map((T)=>T0._`${(0,f4.usePattern)(Q,T)}.test(${Z})`));return(0,T0.not)(M)}function U(Z){X.code(T0._`delete ${G}[${Z}]`)}function O(Z){if(K.removeAdditional==="all"||K.removeAdditional&&Y===!1){U(Z);return}if(Y===!1){if(Q.setParams({additionalProperty:Z}),Q.error(),!z)X.break();return}if(typeof Y=="object"&&!(0,m4.alwaysValidSchema)($,Y)){let M=X.name("valid");if(K.removeAdditional==="failing")V(Z,M,!1),X.if((0,T0.not)(M),()=>{Q.reset(),U(Z)});else if(V(Z,M),!z)X.if((0,T0.not)(M),()=>X.break())}}function V(Z,M,T){let E={keyword:"additionalProperties",dataProp:Z,dataPropType:m4.Type.Str};if(T===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,M)}}};S5.default=hU});var v5=N((k5)=>{Object.defineProperty(k5,"__esModule",{value:!0});var fU=A6(),R5=N0(),rQ=u(),C5=dQ(),mU={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:J}=Q;if(J.opts.removeAdditional==="all"&&W.additionalProperties===void 0)C5.default.code(new fU.KeywordCxt(J,C5.default,"additionalProperties"));let $=(0,R5.allSchemaProperties)(Y);for(let A of $)J.definedProperties.add(A);if(J.opts.unevaluated&&$.length&&J.props!==!0)J.props=rQ.mergeEvaluated.props(X,(0,rQ.toHash)($),J.props);let z=$.filter((A)=>!(0,rQ.alwaysValidSchema)(J,Y[A]));if(z.length===0)return;let K=X.name("valid");for(let A of z){if(H(A))B(A);else{if(X.if((0,R5.propertyInData)(X,G,A,J.opts.ownProperties)),B(A),!J.allErrors)X.else().var(K,!0);X.endIf()}Q.it.definedProperties.add(A),Q.ok(K)}function H(A){return J.opts.useDefaults&&!J.compositeRule&&Y[A].default!==void 0}function B(A){Q.subschema({keyword:"properties",schemaProp:A,dataProp:A},K)}}};k5.default=mU});var h5=N((g5)=>{Object.defineProperty(g5,"__esModule",{value:!0});var x5=N0(),l4=k(),_5=u(),y5=u(),cU={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:G,it:J}=Q,{opts:$}=J,z=(0,x5.allSchemaProperties)(Y),K=z.filter((V)=>(0,_5.alwaysValidSchema)(J,Y[V]));if(z.length===0||K.length===z.length&&(!J.opts.unevaluated||J.props===!0))return;let H=$.strictSchema&&!$.allowMatchingProperties&&G.properties,B=X.name("valid");if(J.props!==!0&&!(J.props instanceof l4.Name))J.props=(0,y5.evaluatedPropsToName)(X,J.props);let{props:A}=J;L();function L(){for(let V of z){if(H)U(V);if(J.allErrors)O(V);else X.var(B,!0),O(V),X.if(B)}}function U(V){for(let Z in H)if(new RegExp(V).test(Z))(0,_5.checkStrictMode)(J,`property ${Z} matches pattern ${V} (use allowMatchingProperties)`)}function O(V){X.forIn("key",W,(Z)=>{X.if(l4._`${(0,x5.usePattern)(Q,V)}.test(${Z})`,()=>{let M=K.includes(V);if(!M)Q.subschema({keyword:"patternProperties",schemaProp:V,dataProp:Z,dataPropType:y5.Type.Str},B);if(J.opts.unevaluated&&A!==!0)X.assign(l4._`${A}[${Z}]`,!0);else if(!M&&!J.allErrors)X.if((0,l4.not)(B),()=>X.break())})})}}};g5.default=cU});var f5=N((u5)=>{Object.defineProperty(u5,"__esModule",{value:!0});var iU=u(),dU={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,iU.alwaysValidSchema)(W,Y)){Q.fail();return}let G=X.name("valid");Q.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},G),Q.failResult(G,()=>Q.reset(),()=>Q.error())},error:{message:"must NOT be valid"}};u5.default=dU});var l5=N((m5)=>{Object.defineProperty(m5,"__esModule",{value:!0});var nU=N0(),oU={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nU.validateUnion,error:{message:"must match a schema in anyOf"}};m5.default=oU});var p5=N((c5)=>{Object.defineProperty(c5,"__esModule",{value:!0});var c4=k(),aU=u(),sU={message:"must match exactly one schema in oneOf",params:({params:Q})=>c4._`{passingSchemas: ${Q.passing}}`},eU={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:sU,code(Q){let{gen:X,schema:Y,parentSchema:W,it:G}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(G.opts.discriminator&&W.discriminator)return;let J=Y,$=X.let("valid",!1),z=X.let("passing",null),K=X.name("_valid");Q.setParams({passing:z}),X.block(H),Q.result($,()=>Q.reset(),()=>Q.error(!0));function H(){J.forEach((B,A)=>{let L;if((0,aU.alwaysValidSchema)(G,B))X.var(K,!0);else L=Q.subschema({keyword:"oneOf",schemaProp:A,compositeRule:!0},K);if(A>0)X.if(c4._`${K} && ${$}`).assign($,!1).assign(z,c4._`[${z}, ${A}]`).else();X.if(K,()=>{if(X.assign($,!0),X.assign(z,A),L)Q.mergeEvaluated(L,c4.Name)})})}}};c5.default=eU});var d5=N((i5)=>{Object.defineProperty(i5,"__esModule",{value:!0});var XO=u(),YO={keyword:"allOf",schemaType:"array",code(Q){let{gen:X,schema:Y,it:W}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");let G=X.name("valid");Y.forEach((J,$)=>{if((0,XO.alwaysValidSchema)(W,J))return;let z=Q.subschema({keyword:"allOf",schemaProp:$},G);Q.ok(G),Q.mergeEvaluated(z)})}};i5.default=YO});var t5=N((o5)=>{Object.defineProperty(o5,"__esModule",{value:!0});var p4=k(),n5=u(),GO={message:({params:Q})=>p4.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>p4._`{failingKeyword: ${Q.ifClause}}`},JO={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:GO,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,n5.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=r5(W,"then"),J=r5(W,"else");if(!G&&!J)return;let $=X.let("valid",!0),z=X.name("_valid");if(K(),Q.reset(),G&&J){let B=X.let("ifClause");Q.setParams({ifClause:B}),X.if(z,H("then",B),H("else",B))}else if(G)X.if(z,H("then"));else X.if((0,p4.not)(z),H("else"));Q.pass($,()=>Q.error(!0));function K(){let B=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},z);Q.mergeEvaluated(B)}function H(B,A){return()=>{let L=Q.subschema({keyword:B},z);if(X.assign($,z),Q.mergeValidEvaluated(L,$),A)X.assign(A,p4._`${B}`);else Q.setParams({ifClause:B})}}}};function r5(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,n5.alwaysValidSchema)(Q,Y)}o5.default=JO});var s5=N((a5)=>{Object.defineProperty(a5,"__esModule",{value:!0});var zO=u(),HO={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,zO.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};a5.default=HO});var Q$=N((e5)=>{Object.defineProperty(e5,"__esModule",{value:!0});var BO=cQ(),AO=L5(),FO=pQ(),DO=V5(),LO=Z5(),UO=b5(),OO=T5(),VO=dQ(),MO=v5(),ZO=h5(),NO=f5(),qO=l5(),wO=p5(),jO=d5(),PO=t5(),bO=s5();function EO(Q=!1){let X=[NO.default,qO.default,wO.default,jO.default,PO.default,bO.default,OO.default,VO.default,UO.default,MO.default,ZO.default];if(Q)X.push(AO.default,DO.default);else X.push(BO.default,FO.default);return X.push(LO.default),X}e5.default=EO});var Y$=N((X$)=>{Object.defineProperty(X$,"__esModule",{value:!0});var s=k(),TO={message:({schemaCode:Q})=>s.str`must match format "${Q}"`,params:({schemaCode:Q})=>s._`{format: ${Q}}`},SO={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:TO,code(Q,X){let{gen:Y,data:W,$data:G,schema:J,schemaCode:$,it:z}=Q,{opts:K,errSchemaPath:H,schemaEnv:B,self:A}=z;if(!K.validateFormats)return;if(G)L();else U();function L(){let O=Y.scopeValue("formats",{ref:A.formats,code:K.code.formats}),V=Y.const("fDef",s._`${O}[${$}]`),Z=Y.let("fType"),M=Y.let("format");Y.if(s._`typeof ${V} == "object" && !(${V} instanceof RegExp)`,()=>Y.assign(Z,s._`${V}.type || "string"`).assign(M,s._`${V}.validate`),()=>Y.assign(Z,s._`"string"`).assign(M,V)),Q.fail$data((0,s.or)(T(),E()));function T(){if(K.strictSchema===!1)return s.nil;return s._`${$} && !${M}`}function E(){let v=B.$async?s._`(${V}.async ? await ${M}(${W}) : ${M}(${W}))`:s._`${M}(${W})`,I=s._`(typeof ${M} == "function" ? ${v} : ${M}.test(${W}))`;return s._`${M} && ${M} !== true && ${Z} === ${X} && !${I}`}}function U(){let O=A.formats[J];if(!O){T();return}if(O===!0)return;let[V,Z,M]=E(O);if(V===X)Q.pass(v());function T(){if(K.strictSchema===!1){A.logger.warn(I());return}throw Error(I());function I(){return`unknown format "${J}" ignored in schema at path "${H}"`}}function E(I){let R0=I instanceof RegExp?(0,s.regexpCode)(I):K.code.formats?s._`${K.code.formats}${(0,s.getProperty)(J)}`:void 0,x0=Y.scopeValue("formats",{key:J,ref:I,code:R0});if(typeof I=="object"&&!(I instanceof RegExp))return[I.type||"string",I.validate,s._`${x0}.validate`];return["string",I,x0]}function v(){if(typeof O=="object"&&!(O instanceof RegExp)&&O.async){if(!B.$async)throw Error("async format in sync schema");return s._`await ${M}(${W})`}return typeof Z=="function"?s._`${M}(${W})`:s._`${M}.test(${W})`}}}};X$.default=SO});var G$=N((W$)=>{Object.defineProperty(W$,"__esModule",{value:!0});var CO=Y$(),kO=[CO.default];W$.default=kO});var z$=N((J$)=>{Object.defineProperty(J$,"__esModule",{value:!0});J$.contentVocabulary=J$.metadataVocabulary=void 0;J$.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];J$.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var B$=N((K$)=>{Object.defineProperty(K$,"__esModule",{value:!0});var _O=k7(),yO=J5(),gO=Q$(),hO=G$(),H$=z$(),uO=[_O.default,yO.default,(0,gO.default)(),hO.default,H$.metadataVocabulary,H$.contentVocabulary];K$.default=uO});var L$=N((F$)=>{Object.defineProperty(F$,"__esModule",{value:!0});F$.DiscrError=void 0;var A$;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(A$||(F$.DiscrError=A$={}))});var V$=N((O$)=>{Object.defineProperty(O$,"__esModule",{value:!0});var T1=k(),nQ=L$(),U$=b4(),mO=F6(),lO=u(),cO={message:({params:{discrError:Q,tagName:X}})=>Q===nQ.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:Y}})=>T1._`{error: ${Q}, tag: ${Y}, tagValue: ${X}}`},pO={keyword:"discriminator",type:"object",schemaType:"object",error:cO,code(Q){let{gen:X,data:Y,schema:W,parentSchema:G,it:J}=Q,{oneOf:$}=G;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let z=W.propertyName;if(typeof z!="string")throw Error("discriminator: requires propertyName");if(W.mapping)throw Error("discriminator: mapping is not supported");if(!$)throw Error("discriminator: requires oneOf keyword");let K=X.let("valid",!1),H=X.const("tag",T1._`${Y}${(0,T1.getProperty)(z)}`);X.if(T1._`typeof ${H} == "string"`,()=>B(),()=>Q.error(!1,{discrError:nQ.DiscrError.Tag,tag:H,tagName:z})),Q.ok(K);function B(){let U=L();X.if(!1);for(let O in U)X.elseIf(T1._`${H} === ${O}`),X.assign(K,A(U[O]));X.else(),Q.error(!1,{discrError:nQ.DiscrError.Mapping,tag:H,tagName:z}),X.endIf()}function A(U){let O=X.name("valid"),V=Q.subschema({keyword:"oneOf",schemaProp:U},O);return Q.mergeEvaluated(V,T1.Name),O}function L(){var U;let O={},V=M(G),Z=!0;for(let v=0;v<$.length;v++){let I=$[v];if((I===null||I===void 0?void 0:I.$ref)&&!(0,lO.schemaHasRulesButRef)(I,J.self.RULES)){let x0=I.$ref;if(I=U$.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,x0),I instanceof U$.SchemaEnv)I=I.schema;if(I===void 0)throw new mO.default(J.opts.uriResolver,J.baseId,x0)}let R0=(U=I===null||I===void 0?void 0:I.properties)===null||U===void 0?void 0:U[z];if(typeof R0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${z}"`);Z=Z&&(V||M(I)),T(R0,v)}if(!Z)throw Error(`discriminator: "${z}" must be required`);return O;function M({required:v}){return Array.isArray(v)&&v.includes(z)}function T(v,I){if(v.const)E(v.const,I);else if(v.enum)for(let R0 of v.enum)E(R0,I);else throw Error(`discriminator: "properties/${z}" must have "const" or "enum"`)}function E(v,I){if(typeof v!="string"||v in O)throw Error(`discriminator: "${z}" values must be unique strings`);O[v]=I}}}};O$.default=pO});var M$=N((fP,dO)=>{dO.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 tQ=N((L0,oQ)=>{Object.defineProperty(L0,"__esModule",{value:!0});L0.MissingRefError=L0.ValidationError=L0.CodeGen=L0.Name=L0.nil=L0.stringify=L0.str=L0._=L0.KeywordCxt=L0.Ajv=void 0;var rO=w7(),nO=B$(),oO=V$(),Z$=M$(),tO=["/properties"],i4="http://json-schema.org/draft-07/schema";class P6 extends rO.default{_addVocabularies(){if(super._addVocabularies(),nO.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(oO.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(Z$,tO):Z$;this.addMetaSchema(Q,i4,!1),this.refs["http://json-schema.org/schema"]=i4}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i4)?i4:void 0)}}L0.Ajv=P6;oQ.exports=L0=P6;oQ.exports.Ajv=P6;Object.defineProperty(L0,"__esModule",{value:!0});L0.default=P6;var aO=A6();Object.defineProperty(L0,"KeywordCxt",{enumerable:!0,get:function(){return aO.KeywordCxt}});var S1=k();Object.defineProperty(L0,"_",{enumerable:!0,get:function(){return S1._}});Object.defineProperty(L0,"str",{enumerable:!0,get:function(){return S1.str}});Object.defineProperty(L0,"stringify",{enumerable:!0,get:function(){return S1.stringify}});Object.defineProperty(L0,"nil",{enumerable:!0,get:function(){return S1.nil}});Object.defineProperty(L0,"Name",{enumerable:!0,get:function(){return S1.Name}});Object.defineProperty(L0,"CodeGen",{enumerable:!0,get:function(){return S1.CodeGen}});var sO=j4();Object.defineProperty(L0,"ValidationError",{enumerable:!0,get:function(){return sO.default}});var eO=F6();Object.defineProperty(L0,"MissingRefError",{enumerable:!0,get:function(){return eO.default}})});var S$=N((I$)=>{Object.defineProperty(I$,"__esModule",{value:!0});I$.formatNames=I$.fastFormats=I$.fullFormats=void 0;function v0(Q,X){return{validate:Q,compare:X}}I$.fullFormats={date:v0(j$,QX),time:v0(sQ(!0),XX),"date-time":v0(N$(!0),b$),"iso-time":v0(sQ(),P$),"iso-date-time":v0(N$(),E$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:zV,"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:LV,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:HV,int32:{type:"number",validate:AV},int64:{type:"number",validate:FV},float:{type:"number",validate:w$},double:{type:"number",validate:w$},password:!0,binary:!0};I$.fastFormats={...I$.fullFormats,date:v0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,QX),time:v0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,XX),"date-time":v0(/^\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,b$),"iso-time":v0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,P$),"iso-date-time":v0(/^\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,E$),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};I$.formatNames=Object.keys(I$.fullFormats);function YV(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var WV=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,GV=[0,31,28,31,30,31,30,31,31,30,31,30,31];function j$(Q){let X=WV.exec(Q);if(!X)return!1;let Y=+X[1],W=+X[2],G=+X[3];return W>=1&&W<=12&&G>=1&&G<=(W===2&&YV(Y)?29:GV[W])}function QX(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var aQ=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function sQ(Q){return function(Y){let W=aQ.exec(Y);if(!W)return!1;let G=+W[1],J=+W[2],$=+W[3],z=W[4],K=W[5]==="-"?-1:1,H=+(W[6]||0),B=+(W[7]||0);if(H>23||B>59||Q&&!z)return!1;if(G<=23&&J<=59&&$<60)return!0;let A=J-B*K,L=G-H*K-(A<0?1:0);return(L===23||L===-1)&&(A===59||A===-1)&&$<61}}function XX(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 P$(Q,X){if(!(Q&&X))return;let Y=aQ.exec(Q),W=aQ.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 eQ=/t|\s/i;function N$(Q){let X=sQ(Q);return function(W){let G=W.split(eQ);return G.length===2&&j$(G[0])&&X(G[1])}}function b$(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 E$(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(eQ),[G,J]=X.split(eQ),$=QX(Y,G);if($===void 0)return;return $||XX(W,J)}var JV=/\/|:/,$V=/^(?:[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 zV(Q){return JV.test(Q)&&$V.test(Q)}var q$=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function HV(Q){return q$.lastIndex=0,q$.test(Q)}var KV=-2147483648,BV=2147483647;function AV(Q){return Number.isInteger(Q)&&Q<=BV&&Q>=KV}function FV(Q){return Number.isInteger(Q)}function w$(){return!0}var DV=/[^\\]\\Z/;function LV(Q){if(DV.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var C$=N((R$)=>{Object.defineProperty(R$,"__esModule",{value:!0});R$.formatLimitDefinition=void 0;var OV=tQ(),S0=k(),W1=S0.operators,d4={formatMaximum:{okStr:"<=",ok:W1.LTE,fail:W1.GT},formatMinimum:{okStr:">=",ok:W1.GTE,fail:W1.LT},formatExclusiveMaximum:{okStr:"<",ok:W1.LT,fail:W1.GTE},formatExclusiveMinimum:{okStr:">",ok:W1.GT,fail:W1.LTE}},VV={message:({keyword:Q,schemaCode:X})=>S0.str`should be ${d4[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>S0._`{comparison: ${d4[Q].okStr}, limit: ${X}}`};R$.formatLimitDefinition={keyword:Object.keys(d4),type:"string",schemaType:"string",$data:!0,error:VV,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:G,it:J}=Q,{opts:$,self:z}=J;if(!$.validateFormats)return;let K=new OV.KeywordCxt(J,z.RULES.all.format.definition,"format");if(K.$data)H();else B();function H(){let L=X.scopeValue("formats",{ref:z.formats,code:$.code.formats}),U=X.const("fmt",S0._`${L}[${K.schemaCode}]`);Q.fail$data((0,S0.or)(S0._`typeof ${U} != "object"`,S0._`${U} instanceof RegExp`,S0._`typeof ${U}.compare != "function"`,A(U)))}function B(){let L=K.schema,U=z.formats[L];if(!U||U===!0)return;if(typeof U!="object"||U instanceof RegExp||typeof U.compare!="function")throw Error(`"${G}": format "${L}" does not define "compare" function`);let O=X.scopeValue("formats",{key:L,ref:U,code:$.code.formats?S0._`${$.code.formats}${(0,S0.getProperty)(L)}`:void 0});Q.fail$data(A(O))}function A(L){return S0._`${L}.compare(${Y}, ${W}) ${d4[G].fail} 0`}},dependencies:["format"]};var MV=(Q)=>{return Q.addKeyword(R$.formatLimitDefinition),Q};R$.default=MV});var _$=N((b6,x$)=>{Object.defineProperty(b6,"__esModule",{value:!0});var R1=S$(),NV=C$(),GX=k(),k$=new GX.Name("fullFormats"),qV=new GX.Name("fastFormats"),JX=(Q,X={keywords:!0})=>{if(Array.isArray(X))return v$(Q,X,R1.fullFormats,k$),Q;let[Y,W]=X.mode==="fast"?[R1.fastFormats,qV]:[R1.fullFormats,k$],G=X.formats||R1.formatNames;if(v$(Q,G,Y,W),X.keywords)(0,NV.default)(Q);return Q};JX.get=(Q,X="full")=>{let W=(X==="fast"?R1.fastFormats:R1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function v$(Q,X,Y,W){var G,J;(G=(J=Q.opts.code).formats)!==null&&G!==void 0||(J.formats=GX._`require("ajv-formats/dist/formats").${W}`);for(let $ of X)Q.addFormat($,Y[$])}x$.exports=b6=JX;Object.defineProperty(b6,"__esModule",{value:!0});b6.default=JX});var IV=Object.freeze({status:"aborted"});function D(Q,X,Y){function W(z,K){var H;Object.defineProperty(z,"_zod",{value:z._zod??{},enumerable:!1}),(H=z._zod).traits??(H.traits=new Set),z._zod.traits.add(Q),X(z,K);for(let B in $.prototype)if(!(B in z))Object.defineProperty(z,B,{value:$.prototype[B].bind(z)});z._zod.constr=$,z._zod.def=K}let G=Y?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:Q});function $(z){var K;let H=Y?.Parent?new J:this;W(H,z),(K=H._zod).deferred??(K.deferred=[]);for(let B of H._zod.deferred)B();return H}return Object.defineProperty($,"init",{value:W}),Object.defineProperty($,Symbol.hasInstance,{value:(z)=>{if(Y?.Parent&&z instanceof Y.Parent)return!0;return z?._zod?.traits?.has(Q)}}),Object.defineProperty($,"name",{value:Q}),$}var TV=Symbol("zod_brand");class _0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class k1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var I6={};function V0(Q){if(Q)Object.assign(I6,Q);return I6}var h={};OX(h,{unwrapMessage:()=>v1,uint8ArrayToHex:()=>jz,uint8ArrayToBase64url:()=>qz,uint8ArrayToBase64:()=>jX,stringifyPrimitive:()=>C6,shallowClone:()=>MX,safeExtend:()=>Uz,required:()=>Mz,randomString:()=>Hz,propertyKeyTypes:()=>X9,promiseAllObject:()=>zz,primitiveTypes:()=>ZX,prefixIssues:()=>g0,pick:()=>Fz,partial:()=>Vz,optionalKeys:()=>Y9,omit:()=>Dz,objectClone:()=>Gz,numKeys:()=>Kz,nullish:()=>x1,normalizeParams:()=>b,mergeDefs:()=>i0,merge:()=>Oz,jsonStringifyReplacer:()=>F1,joinValues:()=>T6,issue:()=>L1,isPlainObject:()=>d0,isObject:()=>G1,hexToUint8Array:()=>wz,getSizableOrigin:()=>qX,getParsedType:()=>Bz,getLengthableOrigin:()=>y1,getEnumValues:()=>s4,getElementAtPath:()=>$z,floatSafeRemainder:()=>e4,finalizeIssue:()=>j0,extend:()=>Lz,escapeRegex:()=>y0,esc:()=>S6,defineLazy:()=>m,createTransparentProxy:()=>Az,cloneDef:()=>Jz,clone:()=>w0,cleanRegex:()=>_1,cleanEnum:()=>Zz,captureStackTrace:()=>R6,cached:()=>D1,base64urlToUint8Array:()=>Nz,base64ToUint8Array:()=>wX,assignProp:()=>p0,assertNotEqual:()=>Qz,assertNever:()=>Yz,assertIs:()=>Xz,assertEqual:()=>e$,assert:()=>Wz,allowsEval:()=>Q9,aborted:()=>r0,NUMBER_FORMAT_RANGES:()=>W9,Class:()=>PX,BIGINT_FORMAT_RANGES:()=>NX});function e$(Q){return Q}function Qz(Q){return Q}function Xz(Q){}function Yz(Q){throw Error()}function Wz(Q){}function s4(Q){let X=Object.values(Q).filter((W)=>typeof W==="number");return Object.entries(Q).filter(([W,G])=>X.indexOf(+W)===-1).map(([W,G])=>G)}function T6(Q,X="|"){return Q.map((Y)=>C6(Y)).join(X)}function F1(Q,X){if(typeof X==="bigint")return X.toString();return X}function D1(Q){return{get value(){{let Y=Q();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function x1(Q){return Q===null||Q===void 0}function _1(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function e4(Q,X){let Y=(Q.toString().split(".")[1]||"").length,W=X.toString(),G=(W.split(".")[1]||"").length;if(G===0&&/\d?e-\d?/.test(W)){let K=W.match(/\d?e-(\d?)/);if(K?.[1])G=Number.parseInt(K[1])}let J=Y>G?Y:G,$=Number.parseInt(Q.toFixed(J).replace(".","")),z=Number.parseInt(X.toFixed(J).replace(".",""));return $%z/10**J}var VX=Symbol("evaluating");function m(Q,X,Y){let W=void 0;Object.defineProperty(Q,X,{get(){if(W===VX)return;if(W===void 0)W=VX,W=Y();return W},set(G){Object.defineProperty(Q,X,{value:G})},configurable:!0})}function Gz(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function p0(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function i0(...Q){let X={};for(let Y of Q){let W=Object.getOwnPropertyDescriptors(Y);Object.assign(X,W)}return Object.defineProperties({},X)}function Jz(Q){return i0(Q._zod.def)}function $z(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function zz(Q){let X=Object.keys(Q),Y=X.map((W)=>Q[W]);return Promise.all(Y).then((W)=>{let G={};for(let J=0;J<X.length;J++)G[X[J]]=W[J];return G})}function Hz(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function S6(Q){return JSON.stringify(Q)}var R6="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function G1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var Q9=D1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function d0(Q){if(G1(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;let Y=X.prototype;if(G1(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function MX(Q){if(d0(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function Kz(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var Bz=(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}`)}},X9=new Set(["string","number","symbol"]),ZX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function y0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function b(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 Az(Q){let X;return new Proxy({},{get(Y,W,G){return X??(X=Q()),Reflect.get(X,W,G)},set(Y,W,G,J){return X??(X=Q()),Reflect.set(X,W,G,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,G){return X??(X=Q()),Reflect.defineProperty(X,W,G)}})}function C6(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function Y9(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var W9={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]},NX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Fz(Q,X){let Y=Q._zod.def,W=i0(Q._zod.def,{get shape(){let G={};for(let J in X){if(!(J in Y.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;G[J]=Y.shape[J]}return p0(this,"shape",G),G},checks:[]});return w0(Q,W)}function Dz(Q,X){let Y=Q._zod.def,W=i0(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let J in X){if(!(J in Y.shape))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;delete G[J]}return p0(this,"shape",G),G},checks:[]});return w0(Q,W)}function Lz(Q,X){if(!d0(X))throw Error("Invalid input to extend: expected a plain object");let Y=Q._zod.def.checks;if(Y&&Y.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let G=i0(Q._zod.def,{get shape(){let J={...Q._zod.def.shape,...X};return p0(this,"shape",J),J},checks:[]});return w0(Q,G)}function Uz(Q,X){if(!d0(X))throw Error("Invalid input to safeExtend: expected a plain object");let Y={...Q._zod.def,get shape(){let W={...Q._zod.def.shape,...X};return p0(this,"shape",W),W},checks:Q._zod.def.checks};return w0(Q,Y)}function Oz(Q,X){let Y=i0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X._zod.def.shape};return p0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:[]});return w0(Q,Y)}function Vz(Q,X,Y){let W=i0(X._zod.def,{get shape(){let G=X._zod.def.shape,J={...G};if(Y)for(let $ in Y){if(!($ in G))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;J[$]=Q?new Q({type:"optional",innerType:G[$]}):G[$]}else for(let $ in G)J[$]=Q?new Q({type:"optional",innerType:G[$]}):G[$];return p0(this,"shape",J),J},checks:[]});return w0(X,W)}function Mz(Q,X,Y){let W=i0(X._zod.def,{get shape(){let G=X._zod.def.shape,J={...G};if(Y)for(let $ in Y){if(!($ in J))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;J[$]=new Q({type:"nonoptional",innerType:G[$]})}else for(let $ in G)J[$]=new Q({type:"nonoptional",innerType:G[$]});return p0(this,"shape",J),J},checks:[]});return w0(X,W)}function r0(Q,X=0){if(Q.aborted===!0)return!0;for(let Y=X;Y<Q.issues.length;Y++)if(Q.issues[Y]?.continue!==!0)return!0;return!1}function g0(Q,X){return X.map((Y)=>{var W;return(W=Y).path??(W.path=[]),Y.path.unshift(Q),Y})}function v1(Q){return typeof Q==="string"?Q:Q?.message}function j0(Q,X,Y){let W={...Q,path:Q.path??[]};if(!Q.message){let G=v1(Q.inst?._zod.def?.error?.(Q))??v1(X?.error?.(Q))??v1(Y.customError?.(Q))??v1(Y.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function qX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function y1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function L1(...Q){let[X,Y,W]=Q;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function Zz(Q){return Object.entries(Q).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function wX(Q){let X=atob(Q),Y=new Uint8Array(X.length);for(let W=0;W<X.length;W++)Y[W]=X.charCodeAt(W);return Y}function jX(Q){let X="";for(let Y=0;Y<Q.length;Y++)X+=String.fromCharCode(Q[Y]);return btoa(X)}function Nz(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-X.length%4)%4);return wX(X+Y)}function qz(Q){return jX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wz(Q){let X=Q.replace(/^0x/,"");if(X.length%2!==0)throw Error("Invalid hex string length");let Y=new Uint8Array(X.length/2);for(let W=0;W<X.length;W+=2)Y[W/2]=Number.parseInt(X.slice(W,W+2),16);return Y}function jz(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class PX{constructor(...Q){}}var bX=(Q,X)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:X,enumerable:!1}),Q.message=JSON.stringify(X,F1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},k6=D("$ZodError",bX),G9=D("$ZodError",bX,{Parent:Error});function EX(Q,X=(Y)=>Y.message){let Y={},W=[];for(let G of Q.issues)if(G.path.length>0)Y[G.path[0]]=Y[G.path[0]]||[],Y[G.path[0]].push(X(G));else W.push(X(G));return{formErrors:W,fieldErrors:Y}}function IX(Q,X=(Y)=>Y.message){let Y={_errors:[]},W=(G)=>{for(let J of G.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map(($)=>W({issues:$}));else if(J.code==="invalid_key")W({issues:J.issues});else if(J.code==="invalid_element")W({issues:J.issues});else if(J.path.length===0)Y._errors.push(X(J));else{let $=Y,z=0;while(z<J.path.length){let K=J.path[z];if(z!==J.path.length-1)$[K]=$[K]||{_errors:[]};else $[K]=$[K]||{_errors:[]},$[K]._errors.push(X(J));$=$[K],z++}}};return W(Q),Y}var v6=(Q)=>(X,Y,W,G)=>{let J=W?Object.assign(W,{async:!1}):{async:!1},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)throw new _0;if($.issues.length){let z=new(G?.Err??Q)($.issues.map((K)=>j0(K,J,V0())));throw R6(z,G?.callee),z}return $.value};var x6=(Q)=>async(X,Y,W,G)=>{let J=W?Object.assign(W,{async:!0}):{async:!0},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)$=await $;if($.issues.length){let z=new(G?.Err??Q)($.issues.map((K)=>j0(K,J,V0())));throw R6(z,G?.callee),z}return $.value};var g1=(Q)=>(X,Y,W)=>{let G=W?{...W,async:!1}:{async:!1},J=X._zod.run({value:Y,issues:[]},G);if(J instanceof Promise)throw new _0;return J.issues.length?{success:!1,error:new(Q??k6)(J.issues.map(($)=>j0($,G,V0())))}:{success:!0,data:J.value}},h1=g1(G9),u1=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{async:!0}):{async:!0},J=X._zod.run({value:Y,issues:[]},G);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new Q(J.issues.map(($)=>j0($,G,V0())))}:{success:!0,data:J.value}},_6=u1(G9),TX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return v6(Q)(X,Y,G)};var SX=(Q)=>(X,Y,W)=>{return v6(Q)(X,Y,W)};var RX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return x6(Q)(X,Y,G)};var CX=(Q)=>async(X,Y,W)=>{return x6(Q)(X,Y,W)};var kX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return g1(Q)(X,Y,G)};var vX=(Q)=>(X,Y,W)=>{return g1(Q)(X,Y,W)};var xX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return u1(Q)(X,Y,G)};var _X=(Q)=>async(X,Y,W)=>{return u1(Q)(X,Y,W)};var yX=/^[cC][^\s-]{8,}$/,gX=/^[0-9a-z]+$/,hX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uX=/^[0-9a-vA-V]{20}$/,fX=/^[A-Za-z0-9]{27}$/,mX=/^[a-zA-Z0-9_-]{21}$/,lX=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var cX=/^([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})$/,J9=(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|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;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 pX=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function iX(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var dX=/^(?:(?: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])$/,rX=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nX=/^((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])$/,oX=/^(([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])$/,tX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$9=/^[A-Za-z0-9_-]*$/,aX=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;var sX=/^\+(?:[0-9]){6,14}[0-9]$/,eX="(?:(?:\\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])))",Q8=new RegExp(`^${eX}$`);function X8(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 Y8(Q){return new RegExp(`^${X8(Q)}$`)}function W8(Q){let X=X8({precision:Q.precision}),Y=["Z"];if(Q.local)Y.push("");if(Q.offset)Y.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let W=`${X}(?:${Y.join("|")})`;return new RegExp(`^${eX}T(?:${W})$`)}var G8=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var J8=/^-?\d+$/,$8=/^-?\d+(?:\.\d+)?/,z8=/^(?:true|false)$/i,H8=/^null$/i;var K8=/^[^A-Z]*$/,B8=/^[^a-z]*$/;var Q0=D("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),A8={number:"number",bigint:"bigint",object:"date"},z9=D("$ZodCheckLessThan",(Q,X)=>{Q0.init(Q,X);let Y=A8[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,J=(X.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<J)if(X.inclusive)G.maximum=X.value;else G.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})}}),H9=D("$ZodCheckGreaterThan",(Q,X)=>{Q0.init(Q,X);let Y=A8[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,J=(X.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>J)if(X.inclusive)G.minimum=X.value;else G.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})}}),F8=D("$ZodCheckMultipleOf",(Q,X)=>{Q0.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):e4(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})}}),D8=D("$ZodCheckNumberFormat",(Q,X)=>{Q0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[G,J]=W9[X.format];Q._zod.onattach.push(($)=>{let z=$._zod.bag;if(z.format=X.format,z.minimum=G,z.maximum=J,Y)z.pattern=J8}),Q._zod.check=($)=>{let z=$.value;if(Y){if(!Number.isInteger(z)){$.issues.push({expected:W,format:X.format,code:"invalid_type",continue:!1,input:z,inst:Q});return}if(!Number.isSafeInteger(z)){if(z>0)$.issues.push({input:z,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 $.issues.push({input:z,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(z<G)$.issues.push({origin:"number",input:z,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!X.abort});if(z>J)$.issues.push({origin:"number",input:z,code:"too_big",maximum:J,inst:Q})}});var L8=D("$ZodCheckMaxLength",(Q,X)=>{var Y;Q0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!x1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<G)W._zod.bag.maximum=X.maximum}),Q._zod.check=(W)=>{let G=W.value;if(G.length<=X.maximum)return;let $=y1(G);W.issues.push({origin:$,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),U8=D("$ZodCheckMinLength",(Q,X)=>{var Y;Q0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!x1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>G)W._zod.bag.minimum=X.minimum}),Q._zod.check=(W)=>{let G=W.value;if(G.length>=X.minimum)return;let $=y1(G);W.issues.push({origin:$,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),O8=D("$ZodCheckLengthEquals",(Q,X)=>{var Y;Q0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!x1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.minimum=X.length,G.maximum=X.length,G.length=X.length}),Q._zod.check=(W)=>{let G=W.value,J=G.length;if(J===X.length)return;let $=y1(G),z=J>X.length;W.issues.push({origin:$,...z?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:W.value,inst:Q,continue:!X.abort})}}),f1=D("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(Q0.init(Q,X),Q._zod.onattach.push((G)=>{let J=G._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=(G)=>{if(X.pattern.lastIndex=0,X.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:X.format,input:G.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:Q,continue:!X.abort})});else(W=Q._zod).check??(W.check=()=>{})}),V8=D("$ZodCheckRegex",(Q,X)=>{f1.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})}}),M8=D("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=K8),f1.init(Q,X)}),Z8=D("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=B8),f1.init(Q,X)}),N8=D("$ZodCheckIncludes",(Q,X)=>{Q0.init(Q,X);let Y=y0(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=W,Q._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(W)}),Q._zod.check=(G)=>{if(G.value.includes(X.includes,X.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:G.value,inst:Q,continue:!X.abort})}}),q8=D("$ZodCheckStartsWith",(Q,X)=>{Q0.init(Q,X);let Y=new RegExp(`^${y0(X.prefix)}.*`);X.pattern??(X.pattern=Y),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.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})}}),w8=D("$ZodCheckEndsWith",(Q,X)=>{Q0.init(Q,X);let Y=new RegExp(`.*${y0(X.suffix)}$`);X.pattern??(X.pattern=Y),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.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 j8=D("$ZodCheckOverwrite",(Q,X)=>{Q0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class K9{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)),G=Y.map((J)=>J.slice(W)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of G)this.content.push(J)}compile(){let Q=Function,X=this?.args,W=[...(this?.content??[""]).map((G)=>` ${G}`)];return new Q(...X,W.join(`
|
|
11
|
+
`))}}var b8={major:4,minor:1,patch:12};var p=D("$ZodType",(Q,X)=>{var Y;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=b8;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let G of W)for(let J of G._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 G=($,z,K)=>{let H=r0($),B;for(let A of z){if(A._zod.def.when){if(!A._zod.def.when($))continue}else if(H)continue;let L=$.issues.length,U=A._zod.check($);if(U instanceof Promise&&K?.async===!1)throw new _0;if(B||U instanceof Promise)B=(B??Promise.resolve()).then(async()=>{if(await U,$.issues.length===L)return;if(!H)H=r0($,L)});else{if($.issues.length===L)continue;if(!H)H=r0($,L)}}if(B)return B.then(()=>{return $});return $},J=($,z,K)=>{if(r0($))return $.aborted=!0,$;let H=G(z,W,K);if(H instanceof Promise){if(K.async===!1)throw new _0;return H.then((B)=>Q._zod.parse(B,K))}return Q._zod.parse(H,K)};Q._zod.run=($,z)=>{if(z.skipChecks)return Q._zod.parse($,z);if(z.direction==="backward"){let H=Q._zod.parse({value:$.value,issues:[]},{...z,skipChecks:!0});if(H instanceof Promise)return H.then((B)=>{return J(B,$,z)});return J(H,$,z)}let K=Q._zod.parse($,z);if(K instanceof Promise){if(z.async===!1)throw new _0;return K.then((H)=>G(H,W,z))}return G(K,W,z)}}Q["~standard"]={validate:(G)=>{try{let J=h1(Q,G);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return _6(Q,G).then(($)=>$.success?{value:$.data}:{issues:$.error?.issues})}},vendor:"zod",version:1}}),u6=D("$ZodString",(Q,X)=>{p.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??G8(Q._zod.bag),Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=String(Y.value)}catch(G){}if(typeof Y.value==="string")return Y;return Y.issues.push({expected:"string",code:"invalid_type",input:Y.value,inst:Q}),Y}}),i=D("$ZodStringFormat",(Q,X)=>{f1.init(Q,X),u6.init(Q,X)}),x8=D("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=cX),i.init(Q,X)}),_8=D("$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=J9(W))}else X.pattern??(X.pattern=J9());i.init(Q,X)}),y8=D("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=pX),i.init(Q,X)}),g8=D("$ZodURL",(Q,X)=>{i.init(Q,X),Q._zod.check=(Y)=>{try{let W=Y.value.trim(),G=new URL(W);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(G.hostname))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:aX.source,input:Y.value,inst:Q,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.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(X.normalize)Y.value=G.href;else Y.value=W;return}catch(W){Y.issues.push({code:"invalid_format",format:"url",input:Y.value,inst:Q,continue:!X.abort})}}}),h8=D("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=iX()),i.init(Q,X)}),u8=D("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=mX),i.init(Q,X)}),f8=D("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=yX),i.init(Q,X)}),m8=D("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=gX),i.init(Q,X)}),l8=D("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=hX),i.init(Q,X)}),c8=D("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=uX),i.init(Q,X)}),p8=D("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=fX),i.init(Q,X)}),i8=D("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=W8(X)),i.init(Q,X)}),d8=D("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=Q8),i.init(Q,X)}),r8=D("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=Y8(X)),i.init(Q,X)}),n8=D("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=lX),i.init(Q,X)}),o8=D("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=dX),i.init(Q,X),Q._zod.onattach.push((Y)=>{let W=Y._zod.bag;W.format="ipv4"})}),t8=D("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=rX),i.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})}}}),a8=D("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=nX),i.init(Q,X)}),s8=D("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=oX),i.init(Q,X),Q._zod.check=(Y)=>{let W=Y.value.split("/");try{if(W.length!==2)throw Error();let[G,J]=W;if(!J)throw Error();let $=Number(J);if(`${$}`!==J)throw Error();if($<0||$>128)throw Error();new URL(`http://[${G}]`)}catch{Y.issues.push({code:"invalid_format",format:"cidrv6",input:Y.value,inst:Q,continue:!X.abort})}}});function e8(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var QY=D("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=tX),i.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64"}),Q._zod.check=(Y)=>{if(e8(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:Q,continue:!X.abort})}});function Iz(Q){if(!$9.test(Q))return!1;let X=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return e8(Y)}var XY=D("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=$9),i.init(Q,X),Q._zod.onattach.push((Y)=>{Y._zod.bag.contentEncoding="base64url"}),Q._zod.check=(Y)=>{if(Iz(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:Q,continue:!X.abort})}}),YY=D("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=sX),i.init(Q,X)});function Tz(Q,X=null){try{let Y=Q.split(".");if(Y.length!==3)return!1;let[W]=Y;if(!W)return!1;let G=JSON.parse(atob(W));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(X&&(!("alg"in G)||G.alg!==X))return!1;return!0}catch{return!1}}var WY=D("$ZodJWT",(Q,X)=>{i.init(Q,X),Q._zod.check=(Y)=>{if(Tz(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:Q,continue:!X.abort})}});var A9=D("$ZodNumber",(Q,X)=>{p.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??$8,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch($){}let G=Y.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return Y;let J=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return Y.issues.push({expected:"number",code:"invalid_type",input:G,inst:Q,...J?{received:J}:{}}),Y}}),GY=D("$ZodNumber",(Q,X)=>{D8.init(Q,X),A9.init(Q,X)}),JY=D("$ZodBoolean",(Q,X)=>{p.init(Q,X),Q._zod.pattern=z8,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch(J){}let G=Y.value;if(typeof G==="boolean")return Y;return Y.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:Q}),Y}});var $Y=D("$ZodNull",(Q,X)=>{p.init(Q,X),Q._zod.pattern=H8,Q._zod.values=new Set([null]),Q._zod.parse=(Y,W)=>{let G=Y.value;if(G===null)return Y;return Y.issues.push({expected:"null",code:"invalid_type",input:G,inst:Q}),Y}});var zY=D("$ZodUnknown",(Q,X)=>{p.init(Q,X),Q._zod.parse=(Y)=>Y}),HY=D("$ZodNever",(Q,X)=>{p.init(Q,X),Q._zod.parse=(Y,W)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:Q}),Y}});function E8(Q,X,Y){if(Q.issues.length)X.issues.push(...g0(Y,Q.issues));X.value[Y]=Q.value}var KY=D("$ZodArray",(Q,X)=>{p.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!Array.isArray(G))return Y.issues.push({expected:"array",code:"invalid_type",input:G,inst:Q}),Y;Y.value=Array(G.length);let J=[];for(let $=0;$<G.length;$++){let z=G[$],K=X.element._zod.run({value:z,issues:[]},W);if(K instanceof Promise)J.push(K.then((H)=>E8(H,Y,$)));else E8(K,Y,$)}if(J.length)return Promise.all(J).then(()=>Y);return Y}});function h6(Q,X,Y,W){if(Q.issues.length)X.issues.push(...g0(Y,Q.issues));if(Q.value===void 0){if(Y in W)X.value[Y]=void 0}else X.value[Y]=Q.value}function BY(Q){let X=Object.keys(Q.shape);for(let W of X)if(!Q.shape?.[W]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${W}": expected a Zod schema`);let Y=Y9(Q.shape);return{...Q,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(Y)}}function AY(Q,X,Y,W,G,J){let $=[],z=G.keySet,K=G.catchall._zod,H=K.def.type;for(let B of Object.keys(X)){if(z.has(B))continue;if(H==="never"){$.push(B);continue}let A=K.run({value:X[B],issues:[]},W);if(A instanceof Promise)Q.push(A.then((L)=>h6(L,Y,B,X)));else h6(A,Y,B,X)}if($.length)Y.issues.push({code:"unrecognized_keys",keys:$,input:X,inst:J});if(!Q.length)return Y;return Promise.all(Q).then(()=>{return Y})}var Sz=D("$ZodObject",(Q,X)=>{if(p.init(Q,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let z=X.shape;Object.defineProperty(X,"shape",{get:()=>{let K={...z};return Object.defineProperty(X,"shape",{value:K}),K}})}let W=D1(()=>BY(X));m(Q._zod,"propValues",()=>{let z=X.shape,K={};for(let H in z){let B=z[H]._zod;if(B.values){K[H]??(K[H]=new Set);for(let A of B.values)K[H].add(A)}}return K});let G=G1,J=X.catchall,$;Q._zod.parse=(z,K)=>{$??($=W.value);let H=z.value;if(!G(H))return z.issues.push({expected:"object",code:"invalid_type",input:H,inst:Q}),z;z.value={};let B=[],A=$.shape;for(let L of $.keys){let O=A[L]._zod.run({value:H[L],issues:[]},K);if(O instanceof Promise)B.push(O.then((V)=>h6(V,z,L,H)));else h6(O,z,L,H)}if(!J)return B.length?Promise.all(B).then(()=>z):z;return AY(B,H,z,K,W.value,Q)}}),FY=D("$ZodObjectJIT",(Q,X)=>{Sz.init(Q,X);let Y=Q._zod.parse,W=D1(()=>BY(X)),G=(L)=>{let U=new K9(["shape","payload","ctx"]),O=W.value,V=(E)=>{let v=S6(E);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};U.write("const input = payload.value;");let Z=Object.create(null),M=0;for(let E of O.keys)Z[E]=`key_${M++}`;U.write("const newResult = {};");for(let E of O.keys){let v=Z[E],I=S6(E);U.write(`const ${v} = ${V(E)};`),U.write(`
|
|
12
|
+
if (${v}.issues.length) {
|
|
13
|
+
payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
|
|
14
|
+
...iss,
|
|
15
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
16
|
+
})));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if (${v}.value === undefined) {
|
|
21
|
+
if (${I} in input) {
|
|
22
|
+
newResult[${I}] = undefined;
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
newResult[${I}] = ${v}.value;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
`)}U.write("payload.value = newResult;"),U.write("return payload;");let T=U.compile();return(E,v)=>T(L,E,v)},J,$=G1,z=!I6.jitless,H=z&&Q9.value,B=X.catchall,A;Q._zod.parse=(L,U)=>{A??(A=W.value);let O=L.value;if(!$(O))return L.issues.push({expected:"object",code:"invalid_type",input:O,inst:Q}),L;if(z&&H&&U?.async===!1&&U.jitless!==!0){if(!J)J=G(X.shape);if(L=J(L,U),!B)return L;return AY([],O,L,U,A,Q)}return Y(L,U)}});function I8(Q,X,Y,W){for(let J of Q)if(J.issues.length===0)return X.value=J.value,X;let G=Q.filter((J)=>!r0(J));if(G.length===1)return X.value=G[0].value,G[0];return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:Q.map((J)=>J.issues.map(($)=>j0($,W,V0())))}),X}var F9=D("$ZodUnion",(Q,X)=>{p.init(Q,X),m(Q._zod,"optin",()=>X.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),m(Q._zod,"optout",()=>X.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),m(Q._zod,"values",()=>{if(X.options.every((G)=>G._zod.values))return new Set(X.options.flatMap((G)=>Array.from(G._zod.values)));return}),m(Q._zod,"pattern",()=>{if(X.options.every((G)=>G._zod.pattern)){let G=X.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>_1(J.source)).join("|")})$`)}return});let Y=X.options.length===1,W=X.options[0]._zod.run;Q._zod.parse=(G,J)=>{if(Y)return W(G,J);let $=!1,z=[];for(let K of X.options){let H=K._zod.run({value:G.value,issues:[]},J);if(H instanceof Promise)z.push(H),$=!0;else{if(H.issues.length===0)return H;z.push(H)}}if(!$)return I8(z,G,Q,J);return Promise.all(z).then((K)=>{return I8(K,G,Q,J)})}}),DY=D("$ZodDiscriminatedUnion",(Q,X)=>{F9.init(Q,X);let Y=Q._zod.parse;m(Q._zod,"propValues",()=>{let G={};for(let J of X.options){let $=J._zod.propValues;if(!$||Object.keys($).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let[z,K]of Object.entries($)){if(!G[z])G[z]=new Set;for(let H of K)G[z].add(H)}}return G});let W=D1(()=>{let G=X.options,J=new Map;for(let $ of G){let z=$._zod.propValues?.[X.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf($)}"`);for(let K of z){if(J.has(K))throw Error(`Duplicate discriminator value "${String(K)}"`);J.set(K,$)}}return J});Q._zod.parse=(G,J)=>{let $=G.value;if(!G1($))return G.issues.push({code:"invalid_type",expected:"object",input:$,inst:Q}),G;let z=W.value.get($?.[X.discriminator]);if(z)return z._zod.run(G,J);if(X.unionFallback)return Y(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,input:$,path:[X.discriminator],inst:Q}),G}}),LY=D("$ZodIntersection",(Q,X)=>{p.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value,J=X.left._zod.run({value:G,issues:[]},W),$=X.right._zod.run({value:G,issues:[]},W);if(J instanceof Promise||$ instanceof Promise)return Promise.all([J,$]).then(([K,H])=>{return T8(Y,K,H)});return T8(Y,J,$)}});function B9(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(d0(Q)&&d0(X)){let Y=Object.keys(X),W=Object.keys(Q).filter((J)=>Y.indexOf(J)!==-1),G={...Q,...X};for(let J of W){let $=B9(Q[J],X[J]);if(!$.valid)return{valid:!1,mergeErrorPath:[J,...$.mergeErrorPath]};G[J]=$.data}return{valid:!0,data:G}}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 G=Q[W],J=X[W],$=B9(G,J);if(!$.valid)return{valid:!1,mergeErrorPath:[W,...$.mergeErrorPath]};Y.push($.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function T8(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(r0(Q))return Q;let W=B9(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var UY=D("$ZodRecord",(Q,X)=>{p.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!d0(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),Y;let J=[];if(X.keyType._zod.values){let $=X.keyType._zod.values;Y.value={};for(let K of $)if(typeof K==="string"||typeof K==="number"||typeof K==="symbol"){let H=X.valueType._zod.run({value:G[K],issues:[]},W);if(H instanceof Promise)J.push(H.then((B)=>{if(B.issues.length)Y.issues.push(...g0(K,B.issues));Y.value[K]=B.value}));else{if(H.issues.length)Y.issues.push(...g0(K,H.issues));Y.value[K]=H.value}}let z;for(let K in G)if(!$.has(K))z=z??[],z.push(K);if(z&&z.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:z})}else{Y.value={};for(let $ of Reflect.ownKeys(G)){if($==="__proto__")continue;let z=X.keyType._zod.run({value:$,issues:[]},W);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(z.issues.length){Y.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map((H)=>j0(H,W,V0())),input:$,path:[$],inst:Q}),Y.value[z.value]=z.value;continue}let K=X.valueType._zod.run({value:G[$],issues:[]},W);if(K instanceof Promise)J.push(K.then((H)=>{if(H.issues.length)Y.issues.push(...g0($,H.issues));Y.value[z.value]=H.value}));else{if(K.issues.length)Y.issues.push(...g0($,K.issues));Y.value[z.value]=K.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var OY=D("$ZodEnum",(Q,X)=>{p.init(Q,X);let Y=s4(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>X9.has(typeof G)).map((G)=>typeof G==="string"?y0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,J)=>{let $=G.value;if(W.has($))return G;return G.issues.push({code:"invalid_value",values:Y,input:$,inst:Q}),G}}),VY=D("$ZodLiteral",(Q,X)=>{if(p.init(Q,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");Q._zod.values=new Set(X.values),Q._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?y0(Y):Y?y0(Y.toString()):String(Y)).join("|")})$`),Q._zod.parse=(Y,W)=>{let G=Y.value;if(Q._zod.values.has(G))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:G,inst:Q}),Y}});var MY=D("$ZodTransform",(Q,X)=>{p.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new k1(Q.constructor.name);let G=X.transform(Y.value,Y);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then(($)=>{return Y.value=$,Y});if(G instanceof Promise)throw new _0;return Y.value=G,Y}});function S8(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var ZY=D("$ZodOptional",(Q,X)=>{p.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",m(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),m(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${_1(Y.source)})?$`):void 0}),Q._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional"){let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>S8(J,Y.value));return S8(G,Y.value)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),NY=D("$ZodNullable",(Q,X)=>{p.init(Q,X),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),m(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${_1(Y.source)}|null)$`):void 0}),m(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)}}),qY=D("$ZodDefault",(Q,X)=>{p.init(Q,X),Q._zod.optin="optional",m(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);if(Y.value===void 0)return Y.value=X.defaultValue,Y;let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>R8(J,X));return R8(G,X)}});function R8(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var wY=D("$ZodPrefault",(Q,X)=>{p.init(Q,X),Q._zod.optin="optional",m(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,W)}}),jY=D("$ZodNonOptional",(Q,X)=>{p.init(Q,X),m(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 G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>C8(J,Q));return C8(G,Q)}});function C8(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 PY=D("$ZodCatch",(Q,X)=>{p.init(Q,X),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),m(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>{if(Y.value=J.value,J.issues.length)Y.value=X.catchValue({...Y,error:{issues:J.issues.map(($)=>j0($,W,V0()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=G.value,G.issues.length)Y.value=X.catchValue({...Y,error:{issues:G.issues.map((J)=>j0(J,W,V0()))},input:Y.value}),Y.issues=[];return Y}});var bY=D("$ZodPipe",(Q,X)=>{p.init(Q,X),m(Q._zod,"values",()=>X.in._zod.values),m(Q._zod,"optin",()=>X.in._zod.optin),m(Q._zod,"optout",()=>X.out._zod.optout),m(Q._zod,"propValues",()=>X.in._zod.propValues),Q._zod.parse=(Y,W)=>{if(W.direction==="backward"){let J=X.out._zod.run(Y,W);if(J instanceof Promise)return J.then(($)=>g6($,X.in,W));return g6(J,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>g6(J,X.out,W));return g6(G,X.out,W)}});function g6(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},Y)}var EY=D("$ZodReadonly",(Q,X)=>{p.init(Q,X),m(Q._zod,"propValues",()=>X.innerType._zod.propValues),m(Q._zod,"values",()=>X.innerType._zod.values),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then(k8);return k8(G)}});function k8(Q){return Q.value=Object.freeze(Q.value),Q}var IY=D("$ZodCustom",(Q,X)=>{Q0.init(Q,X),p.init(Q,X),Q._zod.parse=(Y,W)=>{return Y},Q._zod.check=(Y)=>{let W=Y.value,G=X.fn(W);if(G instanceof Promise)return G.then((J)=>v8(J,Y,W,Q));v8(G,Y,W,Q);return}});function v8(Q,X,Y,W){if(!Q){let G={code:"custom",input:Y,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)G.params=W._zod.def.params;X.issues.push(L1(G))}}var Rz=(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},Cz=()=>{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 ${Rz(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${C6(W.values[0])}`;return`Invalid option: expected one of ${T6(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",J=X(W.origin);if(J)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",J=X(W.origin);if(J)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${J.unit}`;return`Too small: expected ${W.origin} to be ${G}${W.minimum.toString()}`}case"invalid_format":{let G=W;if(G.format==="starts_with")return`Invalid string: must start with "${G.prefix}"`;if(G.format==="ends_with")return`Invalid string: must end with "${G.suffix}"`;if(G.format==="includes")return`Invalid string: must include "${G.includes}"`;if(G.format==="regex")return`Invalid string: must match pattern ${G.pattern}`;return`Invalid ${Y[G.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":""}: ${T6(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 D9(){return{localeError:Cz()}}var lV=Symbol("ZodOutput"),cV=Symbol("ZodInput");class TY{constructor(){this._map=new WeakMap,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 WeakMap,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)??{}};delete Y.id;let W={...Y,...this._map.get(Q)};return Object.keys(W).length?W:void 0}return this._map.get(Q)}has(Q){return this._map.has(Q)}}function kz(){return new TY}var m1=kz();function SY(Q,X){return new Q({type:"string",...b(X)})}function RY(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...b(X)})}function L9(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...b(X)})}function CY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...b(X)})}function kY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(X)})}function vY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(X)})}function xY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(X)})}function _Y(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...b(X)})}function yY(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...b(X)})}function gY(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(X)})}function hY(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...b(X)})}function uY(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(X)})}function fY(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...b(X)})}function mY(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...b(X)})}function lY(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(X)})}function cY(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(X)})}function pY(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(X)})}function iY(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(X)})}function dY(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(X)})}function rY(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...b(X)})}function nY(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...b(X)})}function oY(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...b(X)})}function tY(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...b(X)})}function aY(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(X)})}function sY(Q,X){return new Q({type:"string",format:"date",check:"string_format",...b(X)})}function eY(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...b(X)})}function QW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...b(X)})}function XW(Q,X){return new Q({type:"number",checks:[],...b(X)})}function YW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...b(X)})}function WW(Q,X){return new Q({type:"boolean",...b(X)})}function GW(Q,X){return new Q({type:"null",...b(X)})}function JW(Q){return new Q({type:"unknown"})}function $W(Q,X){return new Q({type:"never",...b(X)})}function f6(Q,X){return new z9({check:"less_than",...b(X),value:Q,inclusive:!1})}function l1(Q,X){return new z9({check:"less_than",...b(X),value:Q,inclusive:!0})}function m6(Q,X){return new H9({check:"greater_than",...b(X),value:Q,inclusive:!1})}function c1(Q,X){return new H9({check:"greater_than",...b(X),value:Q,inclusive:!0})}function l6(Q,X){return new F8({check:"multiple_of",...b(X),value:Q})}function c6(Q,X){return new L8({check:"max_length",...b(X),maximum:Q})}function U1(Q,X){return new U8({check:"min_length",...b(X),minimum:Q})}function p6(Q,X){return new O8({check:"length_equals",...b(X),length:Q})}function U9(Q,X){return new V8({check:"string_format",format:"regex",...b(X),pattern:Q})}function O9(Q){return new M8({check:"string_format",format:"lowercase",...b(Q)})}function V9(Q){return new Z8({check:"string_format",format:"uppercase",...b(Q)})}function M9(Q,X){return new N8({check:"string_format",format:"includes",...b(X),includes:Q})}function Z9(Q,X){return new q8({check:"string_format",format:"starts_with",...b(X),prefix:Q})}function N9(Q,X){return new w8({check:"string_format",format:"ends_with",...b(X),suffix:Q})}function J1(Q){return new j8({check:"overwrite",tx:Q})}function q9(Q){return J1((X)=>X.normalize(Q))}function w9(){return J1((Q)=>Q.trim())}function j9(){return J1((Q)=>Q.toLowerCase())}function P9(){return J1((Q)=>Q.toUpperCase())}function zW(Q,X,Y){return new Q({type:"array",element:X,...b(Y)})}function HW(Q,X,Y){let W=b(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function KW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...b(Y)})}function BW(Q){let X=vz((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(L1(W,Y.value,X._zod.def));else{let G=W;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=X),G.continue??(G.continue=!X._zod.def.abort),Y.issues.push(L1(G))}},Q(Y.value,Y)});return X}function vz(Q,X){let Y=new Q0({check:"custom",...b(X)});return Y._zod.check=Q,Y}function O1(Q){return!!Q._zod}function n0(Q,X){if(O1(Q))return h1(Q,X);return Q.safeParse(X)}function i6(Q){if(!Q)return;let X;if(O1(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 AW(Q){if(O1(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}var i1={};OX(i1,{time:()=>I9,duration:()=>T9,datetime:()=>b9,date:()=>E9,ZodISOTime:()=>LW,ZodISODuration:()=>UW,ZodISODateTime:()=>FW,ZodISODate:()=>DW});var FW=D("ZodISODateTime",(Q,X)=>{i8.init(Q,X),r.init(Q,X)});function b9(Q){return aY(FW,Q)}var DW=D("ZodISODate",(Q,X)=>{d8.init(Q,X),r.init(Q,X)});function E9(Q){return sY(DW,Q)}var LW=D("ZodISOTime",(Q,X)=>{r8.init(Q,X),r.init(Q,X)});function I9(Q){return eY(LW,Q)}var UW=D("ZodISODuration",(Q,X)=>{n8.init(Q,X),r.init(Q,X)});function T9(Q){return QW(UW,Q)}var OW=(Q,X)=>{k6.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>IX(Q,Y)},flatten:{value:(Y)=>EX(Q,Y)},addIssue:{value:(Y)=>{Q.issues.push(Y),Q.message=JSON.stringify(Q.issues,F1,2)}},addIssues:{value:(Y)=>{Q.issues.push(...Y),Q.message=JSON.stringify(Q.issues,F1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},TM=D("ZodError",OW),U0=D("ZodError",OW,{Parent:Error});var VW=v6(U0),MW=x6(U0),ZW=g1(U0),NW=u1(U0),qW=TX(U0),wW=SX(U0),jW=RX(U0),PW=CX(U0),bW=kX(U0),EW=vX(U0),IW=xX(U0),TW=_X(U0);var a=D("ZodType",(Q,X)=>{return p.init(Q,X),Q.def=X,Q.type=X.type,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...Y)=>{return Q.clone(h.mergeDefs(X,{checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(Y,W)=>w0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>VW(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>ZW(Q,Y,W),Q.parseAsync=async(Y,W)=>MW(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>NW(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>qW(Q,Y,W),Q.decode=(Y,W)=>wW(Q,Y,W),Q.encodeAsync=async(Y,W)=>jW(Q,Y,W),Q.decodeAsync=async(Y,W)=>PW(Q,Y,W),Q.safeEncode=(Y,W)=>bW(Q,Y,W),Q.safeDecode=(Y,W)=>EW(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>IW(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>TW(Q,Y,W),Q.refine=(Y,W)=>Q.check(SH(Y,W)),Q.superRefine=(Y)=>Q.check(RH(Y)),Q.overwrite=(Y)=>Q.check(J1(Y)),Q.optional=()=>t(Q),Q.nullable=()=>CW(Q),Q.nullish=()=>t(CW(Q)),Q.nonoptional=(Y)=>jH(Q,Y),Q.array=()=>x(Q),Q.or=(Y)=>c([Q,Y]),Q.and=(Y)=>r6(Q,Y),Q.transform=(Y)=>R9(Q,yW(Y)),Q.default=(Y)=>NH(Q,Y),Q.prefault=(Y)=>wH(Q,Y),Q.catch=(Y)=>bH(Q,Y),Q.pipe=(Y)=>R9(Q,Y),Q.readonly=()=>TH(Q),Q.describe=(Y)=>{let W=Q.clone();return m1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return m1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return m1.get(Q);let W=Q.clone();return m1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),kW=D("_ZodString",(Q,X)=>{u6.init(Q,X),a.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(U9(...W)),Q.includes=(...W)=>Q.check(M9(...W)),Q.startsWith=(...W)=>Q.check(Z9(...W)),Q.endsWith=(...W)=>Q.check(N9(...W)),Q.min=(...W)=>Q.check(U1(...W)),Q.max=(...W)=>Q.check(c6(...W)),Q.length=(...W)=>Q.check(p6(...W)),Q.nonempty=(...W)=>Q.check(U1(1,...W)),Q.lowercase=(W)=>Q.check(O9(W)),Q.uppercase=(W)=>Q.check(V9(W)),Q.trim=()=>Q.check(w9()),Q.normalize=(...W)=>Q.check(q9(...W)),Q.toLowerCase=()=>Q.check(j9()),Q.toUpperCase=()=>Q.check(P9())}),lz=D("ZodString",(Q,X)=>{u6.init(Q,X),kW.init(Q,X),Q.email=(Y)=>Q.check(RY(cz,Y)),Q.url=(Y)=>Q.check(_Y(pz,Y)),Q.jwt=(Y)=>Q.check(tY(JH,Y)),Q.emoji=(Y)=>Q.check(yY(iz,Y)),Q.guid=(Y)=>Q.check(L9(SW,Y)),Q.uuid=(Y)=>Q.check(CY(d6,Y)),Q.uuidv4=(Y)=>Q.check(kY(d6,Y)),Q.uuidv6=(Y)=>Q.check(vY(d6,Y)),Q.uuidv7=(Y)=>Q.check(xY(d6,Y)),Q.nanoid=(Y)=>Q.check(gY(dz,Y)),Q.guid=(Y)=>Q.check(L9(SW,Y)),Q.cuid=(Y)=>Q.check(hY(rz,Y)),Q.cuid2=(Y)=>Q.check(uY(nz,Y)),Q.ulid=(Y)=>Q.check(fY(oz,Y)),Q.base64=(Y)=>Q.check(rY(YH,Y)),Q.base64url=(Y)=>Q.check(nY(WH,Y)),Q.xid=(Y)=>Q.check(mY(tz,Y)),Q.ksuid=(Y)=>Q.check(lY(az,Y)),Q.ipv4=(Y)=>Q.check(cY(sz,Y)),Q.ipv6=(Y)=>Q.check(pY(ez,Y)),Q.cidrv4=(Y)=>Q.check(iY(QH,Y)),Q.cidrv6=(Y)=>Q.check(dY(XH,Y)),Q.e164=(Y)=>Q.check(oY(GH,Y)),Q.datetime=(Y)=>Q.check(b9(Y)),Q.date=(Y)=>Q.check(E9(Y)),Q.time=(Y)=>Q.check(I9(Y)),Q.duration=(Y)=>Q.check(T9(Y))});function F(Q){return SY(lz,Q)}var r=D("ZodStringFormat",(Q,X)=>{i.init(Q,X),kW.init(Q,X)}),cz=D("ZodEmail",(Q,X)=>{y8.init(Q,X),r.init(Q,X)});var SW=D("ZodGUID",(Q,X)=>{x8.init(Q,X),r.init(Q,X)});var d6=D("ZodUUID",(Q,X)=>{_8.init(Q,X),r.init(Q,X)});var pz=D("ZodURL",(Q,X)=>{g8.init(Q,X),r.init(Q,X)});var iz=D("ZodEmoji",(Q,X)=>{h8.init(Q,X),r.init(Q,X)});var dz=D("ZodNanoID",(Q,X)=>{u8.init(Q,X),r.init(Q,X)});var rz=D("ZodCUID",(Q,X)=>{f8.init(Q,X),r.init(Q,X)});var nz=D("ZodCUID2",(Q,X)=>{m8.init(Q,X),r.init(Q,X)});var oz=D("ZodULID",(Q,X)=>{l8.init(Q,X),r.init(Q,X)});var tz=D("ZodXID",(Q,X)=>{c8.init(Q,X),r.init(Q,X)});var az=D("ZodKSUID",(Q,X)=>{p8.init(Q,X),r.init(Q,X)});var sz=D("ZodIPv4",(Q,X)=>{o8.init(Q,X),r.init(Q,X)});var ez=D("ZodIPv6",(Q,X)=>{t8.init(Q,X),r.init(Q,X)});var QH=D("ZodCIDRv4",(Q,X)=>{a8.init(Q,X),r.init(Q,X)});var XH=D("ZodCIDRv6",(Q,X)=>{s8.init(Q,X),r.init(Q,X)});var YH=D("ZodBase64",(Q,X)=>{QY.init(Q,X),r.init(Q,X)});var WH=D("ZodBase64URL",(Q,X)=>{XY.init(Q,X),r.init(Q,X)});var GH=D("ZodE164",(Q,X)=>{YY.init(Q,X),r.init(Q,X)});var JH=D("ZodJWT",(Q,X)=>{WY.init(Q,X),r.init(Q,X)});var vW=D("ZodNumber",(Q,X)=>{A9.init(Q,X),a.init(Q,X),Q.gt=(W,G)=>Q.check(m6(W,G)),Q.gte=(W,G)=>Q.check(c1(W,G)),Q.min=(W,G)=>Q.check(c1(W,G)),Q.lt=(W,G)=>Q.check(f6(W,G)),Q.lte=(W,G)=>Q.check(l1(W,G)),Q.max=(W,G)=>Q.check(l1(W,G)),Q.int=(W)=>Q.check(RW(W)),Q.safe=(W)=>Q.check(RW(W)),Q.positive=(W)=>Q.check(m6(0,W)),Q.nonnegative=(W)=>Q.check(c1(0,W)),Q.negative=(W)=>Q.check(f6(0,W)),Q.nonpositive=(W)=>Q.check(l1(0,W)),Q.multipleOf=(W,G)=>Q.check(l6(W,G)),Q.step=(W,G)=>Q.check(l6(W,G)),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 f(Q){return XW(vW,Q)}var $H=D("ZodNumberFormat",(Q,X)=>{GY.init(Q,X),vW.init(Q,X)});function RW(Q){return YW($H,Q)}var zH=D("ZodBoolean",(Q,X)=>{JY.init(Q,X),a.init(Q,X)});function e(Q){return WW(zH,Q)}var HH=D("ZodNull",(Q,X)=>{$Y.init(Q,X),a.init(Q,X)});function C9(Q){return GW(HH,Q)}var KH=D("ZodUnknown",(Q,X)=>{zY.init(Q,X),a.init(Q,X)});function n(){return JW(KH)}var BH=D("ZodNever",(Q,X)=>{HY.init(Q,X),a.init(Q,X)});function AH(Q){return $W(BH,Q)}var FH=D("ZodArray",(Q,X)=>{KY.init(Q,X),a.init(Q,X),Q.element=X.element,Q.min=(Y,W)=>Q.check(U1(Y,W)),Q.nonempty=(Y)=>Q.check(U1(1,Y)),Q.max=(Y,W)=>Q.check(c6(Y,W)),Q.length=(Y,W)=>Q.check(p6(Y,W)),Q.unwrap=()=>Q.element});function x(Q,X){return zW(FH,Q,X)}var xW=D("ZodObject",(Q,X)=>{FY.init(Q,X),a.init(Q,X),h.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>B0(Object.keys(Q._zod.def.shape)),Q.catchall=(Y)=>Q.clone({...Q._zod.def,catchall:Y}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:n()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:n()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:AH()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return h.extend(Q,Y)},Q.safeExtend=(Y)=>{return h.safeExtend(Q,Y)},Q.merge=(Y)=>h.merge(Q,Y),Q.pick=(Y)=>h.pick(Q,Y),Q.omit=(Y)=>h.omit(Q,Y),Q.partial=(...Y)=>h.partial(gW,Q,Y[0]),Q.required=(...Y)=>h.required(hW,Q,Y[0])});function q(Q,X){let Y={type:"object",shape:Q??{},...h.normalizeParams(X)};return new xW(Y)}function z0(Q,X){return new xW({type:"object",shape:Q,catchall:n(),...h.normalizeParams(X)})}var _W=D("ZodUnion",(Q,X)=>{F9.init(Q,X),a.init(Q,X),Q.options=X.options});function c(Q,X){return new _W({type:"union",options:Q,...h.normalizeParams(X)})}var DH=D("ZodDiscriminatedUnion",(Q,X)=>{_W.init(Q,X),DY.init(Q,X)});function k9(Q,X,Y){return new DH({type:"union",options:X,discriminator:Q,...h.normalizeParams(Y)})}var LH=D("ZodIntersection",(Q,X)=>{LY.init(Q,X),a.init(Q,X)});function r6(Q,X){return new LH({type:"intersection",left:Q,right:X})}var UH=D("ZodRecord",(Q,X)=>{UY.init(Q,X),a.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function o(Q,X,Y){return new UH({type:"record",keyType:Q,valueType:X,...h.normalizeParams(Y)})}var S9=D("ZodEnum",(Q,X)=>{OY.init(Q,X),a.init(Q,X),Q.enum=X.entries,Q.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));Q.extract=(W,G)=>{let J={};for(let $ of W)if(Y.has($))J[$]=X.entries[$];else throw Error(`Key ${$} not found in enum`);return new S9({...X,checks:[],...h.normalizeParams(G),entries:J})},Q.exclude=(W,G)=>{let J={...X.entries};for(let $ of W)if(Y.has($))delete J[$];else throw Error(`Key ${$} not found in enum`);return new S9({...X,checks:[],...h.normalizeParams(G),entries:J})}});function B0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new S9({type:"enum",entries:Y,...h.normalizeParams(X)})}var OH=D("ZodLiteral",(Q,X)=>{VY.init(Q,X),a.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 j(Q,X){return new OH({type:"literal",values:Array.isArray(Q)?Q:[Q],...h.normalizeParams(X)})}var VH=D("ZodTransform",(Q,X)=>{MY.init(Q,X),a.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new k1(Q.constructor.name);Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(h.issue(J,Y.value,X));else{let $=J;if($.fatal)$.continue=!1;$.code??($.code="custom"),$.input??($.input=Y.value),$.inst??($.inst=Q),Y.issues.push(h.issue($))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then((J)=>{return Y.value=J,Y});return Y.value=G,Y}});function yW(Q){return new VH({type:"transform",transform:Q})}var gW=D("ZodOptional",(Q,X)=>{ZY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function t(Q){return new gW({type:"optional",innerType:Q})}var MH=D("ZodNullable",(Q,X)=>{NY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function CW(Q){return new MH({type:"nullable",innerType:Q})}var ZH=D("ZodDefault",(Q,X)=>{qY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function NH(Q,X){return new ZH({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var qH=D("ZodPrefault",(Q,X)=>{wY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function wH(Q,X){return new qH({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var hW=D("ZodNonOptional",(Q,X)=>{jY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function jH(Q,X){return new hW({type:"nonoptional",innerType:Q,...h.normalizeParams(X)})}var PH=D("ZodCatch",(Q,X)=>{PY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function bH(Q,X){return new PH({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var EH=D("ZodPipe",(Q,X)=>{bY.init(Q,X),a.init(Q,X),Q.in=X.in,Q.out=X.out});function R9(Q,X){return new EH({type:"pipe",in:Q,out:X})}var IH=D("ZodReadonly",(Q,X)=>{EY.init(Q,X),a.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function TH(Q){return new IH({type:"readonly",innerType:Q})}var uW=D("ZodCustom",(Q,X)=>{IY.init(Q,X),a.init(Q,X)});function fW(Q,X){return HW(uW,Q??(()=>!0),X)}function SH(Q,X={}){return KW(uW,Q,X)}function RH(Q){return BW(Q)}function v9(Q,X){return R9(yW(Q),X)}V0(D9());var x9="2025-11-25";var mW=[x9,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],o0="io.modelcontextprotocol/related-task",o6="2.0",X0=fW((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),lW=c([F(),f().int()]),cW=F(),jZ=z0({ttl:c([f(),C9()]).optional(),pollInterval:f().optional()}),CH=q({ttl:f().optional()}),kH=q({taskId:F()}),_9=z0({progressToken:lW.optional(),[o0]:kH.optional()}),O0=q({_meta:_9.optional()}),d1=O0.extend({task:CH.optional()}),pW=(Q)=>d1.safeParse(Q).success,Y0=q({method:F(),params:O0.loose().optional()}),M0=q({_meta:_9.optional()}),Z0=q({method:F(),params:M0.loose().optional()}),W0=z0({_meta:_9.optional()}),t6=c([F(),f().int()]),iW=q({jsonrpc:j(o6),id:t6,...Y0.shape}).strict(),y9=(Q)=>iW.safeParse(Q).success,dW=q({jsonrpc:j(o6),...Z0.shape}).strict(),rW=(Q)=>dW.safeParse(Q).success,g9=q({jsonrpc:j(o6),id:t6,result:W0}).strict(),r1=(Q)=>g9.safeParse(Q).success;var _;(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"})(_||(_={}));var h9=q({jsonrpc:j(o6),id:t6.optional(),error:q({code:f().int(),message:F(),data:n().optional()})}).strict();var nW=(Q)=>h9.safeParse(Q).success;var oW=c([iW,dW,g9,h9]),PZ=c([g9,h9]),a6=W0.strict(),vH=M0.extend({requestId:t6.optional(),reason:F().optional()}),s6=Z0.extend({method:j("notifications/cancelled"),params:vH}),xH=q({src:F(),mimeType:F().optional(),sizes:x(F()).optional(),theme:B0(["light","dark"]).optional()}),n1=q({icons:x(xH).optional()}),V1=q({name:F(),title:F().optional()}),tW=V1.extend({...V1.shape,...n1.shape,version:F(),websiteUrl:F().optional(),description:F().optional()}),_H=r6(q({applyDefaults:e().optional()}),o(F(),n())),yH=v9((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},r6(q({form:_H.optional(),url:X0.optional()}),o(F(),n()).optional())),gH=z0({list:X0.optional(),cancel:X0.optional(),requests:z0({sampling:z0({createMessage:X0.optional()}).optional(),elicitation:z0({create:X0.optional()}).optional()}).optional()}),hH=z0({list:X0.optional(),cancel:X0.optional(),requests:z0({tools:z0({call:X0.optional()}).optional()}).optional()}),uH=q({experimental:o(F(),X0).optional(),sampling:q({context:X0.optional(),tools:X0.optional()}).optional(),elicitation:yH.optional(),roots:q({listChanged:e().optional()}).optional(),tasks:gH.optional()}),fH=O0.extend({protocolVersion:F(),capabilities:uH,clientInfo:tW}),u9=Y0.extend({method:j("initialize"),params:fH});var mH=q({experimental:o(F(),X0).optional(),logging:X0.optional(),completions:X0.optional(),prompts:q({listChanged:e().optional()}).optional(),resources:q({subscribe:e().optional(),listChanged:e().optional()}).optional(),tools:q({listChanged:e().optional()}).optional(),tasks:hH.optional()}),lH=W0.extend({protocolVersion:F(),capabilities:mH,serverInfo:tW,instructions:F().optional()}),f9=Z0.extend({method:j("notifications/initialized"),params:M0.optional()});var e6=Y0.extend({method:j("ping"),params:O0.optional()}),cH=q({progress:f(),total:t(f()),message:t(F())}),pH=q({...M0.shape,...cH.shape,progressToken:lW}),Q4=Z0.extend({method:j("notifications/progress"),params:pH}),iH=O0.extend({cursor:cW.optional()}),o1=Y0.extend({params:iH.optional()}),t1=W0.extend({nextCursor:cW.optional()}),dH=B0(["working","input_required","completed","failed","cancelled"]),a1=q({taskId:F(),status:dH,ttl:c([f(),C9()]),createdAt:F(),lastUpdatedAt:F(),pollInterval:t(f()),statusMessage:t(F())}),M1=W0.extend({task:a1}),rH=M0.merge(a1),s1=Z0.extend({method:j("notifications/tasks/status"),params:rH}),X4=Y0.extend({method:j("tasks/get"),params:O0.extend({taskId:F()})}),Y4=W0.merge(a1),W4=Y0.extend({method:j("tasks/result"),params:O0.extend({taskId:F()})}),bZ=W0.loose(),G4=o1.extend({method:j("tasks/list")}),J4=t1.extend({tasks:x(a1)}),$4=Y0.extend({method:j("tasks/cancel"),params:O0.extend({taskId:F()})}),aW=W0.merge(a1),sW=q({uri:F(),mimeType:t(F()),_meta:o(F(),n()).optional()}),eW=sW.extend({text:F()}),m9=F().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),QG=sW.extend({blob:m9}),e1=B0(["user","assistant"]),Z1=q({audience:x(e1).optional(),priority:f().min(0).max(1).optional(),lastModified:i1.datetime({offset:!0}).optional()}),XG=q({...V1.shape,...n1.shape,uri:F(),description:t(F()),mimeType:t(F()),annotations:Z1.optional(),_meta:t(z0({}))}),nH=q({...V1.shape,...n1.shape,uriTemplate:F(),description:t(F()),mimeType:t(F()),annotations:Z1.optional(),_meta:t(z0({}))}),l9=o1.extend({method:j("resources/list")}),oH=t1.extend({resources:x(XG)}),tH=o1.extend({method:j("resources/templates/list")}),aH=t1.extend({resourceTemplates:x(nH)}),c9=O0.extend({uri:F()}),sH=c9,p9=Y0.extend({method:j("resources/read"),params:sH}),eH=W0.extend({contents:x(c([eW,QG]))}),Q3=Z0.extend({method:j("notifications/resources/list_changed"),params:M0.optional()}),X3=c9,Y3=Y0.extend({method:j("resources/subscribe"),params:X3}),W3=c9,G3=Y0.extend({method:j("resources/unsubscribe"),params:W3}),J3=M0.extend({uri:F()}),$3=Z0.extend({method:j("notifications/resources/updated"),params:J3}),z3=q({name:F(),description:t(F()),required:t(e())}),H3=q({...V1.shape,...n1.shape,description:t(F()),arguments:t(x(z3)),_meta:t(z0({}))}),K3=o1.extend({method:j("prompts/list")}),B3=t1.extend({prompts:x(H3)}),A3=O0.extend({name:F(),arguments:o(F(),F()).optional()}),F3=Y0.extend({method:j("prompts/get"),params:A3}),i9=q({type:j("text"),text:F(),annotations:Z1.optional(),_meta:o(F(),n()).optional()}),d9=q({type:j("image"),data:m9,mimeType:F(),annotations:Z1.optional(),_meta:o(F(),n()).optional()}),r9=q({type:j("audio"),data:m9,mimeType:F(),annotations:Z1.optional(),_meta:o(F(),n()).optional()}),D3=q({type:j("tool_use"),name:F(),id:F(),input:o(F(),n()),_meta:o(F(),n()).optional()}),L3=q({type:j("resource"),resource:c([eW,QG]),annotations:Z1.optional(),_meta:o(F(),n()).optional()}),U3=XG.extend({type:j("resource_link")}),n9=c([i9,d9,r9,U3,L3]),O3=q({role:e1,content:n9}),V3=W0.extend({description:F().optional(),messages:x(O3)}),M3=Z0.extend({method:j("notifications/prompts/list_changed"),params:M0.optional()}),Z3=q({title:F().optional(),readOnlyHint:e().optional(),destructiveHint:e().optional(),idempotentHint:e().optional(),openWorldHint:e().optional()}),N3=q({taskSupport:B0(["required","optional","forbidden"]).optional()}),YG=q({...V1.shape,...n1.shape,description:F().optional(),inputSchema:q({type:j("object"),properties:o(F(),X0).optional(),required:x(F()).optional()}).catchall(n()),outputSchema:q({type:j("object"),properties:o(F(),X0).optional(),required:x(F()).optional()}).catchall(n()).optional(),annotations:Z3.optional(),execution:N3.optional(),_meta:o(F(),n()).optional()}),o9=o1.extend({method:j("tools/list")}),q3=t1.extend({tools:x(YG)}),z4=W0.extend({content:x(n9).default([]),structuredContent:o(F(),n()).optional(),isError:e().optional()}),EZ=z4.or(W0.extend({toolResult:n()})),w3=d1.extend({name:F(),arguments:o(F(),n()).optional()}),Q6=Y0.extend({method:j("tools/call"),params:w3}),j3=Z0.extend({method:j("notifications/tools/list_changed"),params:M0.optional()}),IZ=q({autoRefresh:e().default(!0),debounceMs:f().int().nonnegative().default(300)}),X6=B0(["debug","info","notice","warning","error","critical","alert","emergency"]),P3=O0.extend({level:X6}),t9=Y0.extend({method:j("logging/setLevel"),params:P3}),b3=M0.extend({level:X6,logger:F().optional(),data:n()}),E3=Z0.extend({method:j("notifications/message"),params:b3}),I3=q({name:F().optional()}),T3=q({hints:x(I3).optional(),costPriority:f().min(0).max(1).optional(),speedPriority:f().min(0).max(1).optional(),intelligencePriority:f().min(0).max(1).optional()}),S3=q({mode:B0(["auto","required","none"]).optional()}),R3=q({type:j("tool_result"),toolUseId:F().describe("The unique identifier for the corresponding tool call."),content:x(n9).default([]),structuredContent:q({}).loose().optional(),isError:e().optional(),_meta:o(F(),n()).optional()}),C3=k9("type",[i9,d9,r9]),n6=k9("type",[i9,d9,r9,D3,R3]),k3=q({role:e1,content:c([n6,x(n6)]),_meta:o(F(),n()).optional()}),v3=d1.extend({messages:x(k3),modelPreferences:T3.optional(),systemPrompt:F().optional(),includeContext:B0(["none","thisServer","allServers"]).optional(),temperature:f().optional(),maxTokens:f().int(),stopSequences:x(F()).optional(),metadata:X0.optional(),tools:x(YG).optional(),toolChoice:S3.optional()}),x3=Y0.extend({method:j("sampling/createMessage"),params:v3}),a9=W0.extend({model:F(),stopReason:t(B0(["endTurn","stopSequence","maxTokens"]).or(F())),role:e1,content:C3}),s9=W0.extend({model:F(),stopReason:t(B0(["endTurn","stopSequence","maxTokens","toolUse"]).or(F())),role:e1,content:c([n6,x(n6)])}),_3=q({type:j("boolean"),title:F().optional(),description:F().optional(),default:e().optional()}),y3=q({type:j("string"),title:F().optional(),description:F().optional(),minLength:f().optional(),maxLength:f().optional(),format:B0(["email","uri","date","date-time"]).optional(),default:F().optional()}),g3=q({type:B0(["number","integer"]),title:F().optional(),description:F().optional(),minimum:f().optional(),maximum:f().optional(),default:f().optional()}),h3=q({type:j("string"),title:F().optional(),description:F().optional(),enum:x(F()),default:F().optional()}),u3=q({type:j("string"),title:F().optional(),description:F().optional(),oneOf:x(q({const:F(),title:F()})),default:F().optional()}),f3=q({type:j("string"),title:F().optional(),description:F().optional(),enum:x(F()),enumNames:x(F()).optional(),default:F().optional()}),m3=c([h3,u3]),l3=q({type:j("array"),title:F().optional(),description:F().optional(),minItems:f().optional(),maxItems:f().optional(),items:q({type:j("string"),enum:x(F())}),default:x(F()).optional()}),c3=q({type:j("array"),title:F().optional(),description:F().optional(),minItems:f().optional(),maxItems:f().optional(),items:q({anyOf:x(q({const:F(),title:F()}))}),default:x(F()).optional()}),p3=c([l3,c3]),i3=c([f3,m3,p3]),d3=c([i3,_3,y3,g3]),r3=d1.extend({mode:j("form").optional(),message:F(),requestedSchema:q({type:j("object"),properties:o(F(),d3),required:x(F()).optional()})}),n3=d1.extend({mode:j("url"),message:F(),elicitationId:F(),url:F().url()}),o3=c([r3,n3]),t3=Y0.extend({method:j("elicitation/create"),params:o3}),a3=M0.extend({elicitationId:F()}),s3=Z0.extend({method:j("notifications/elicitation/complete"),params:a3}),H4=W0.extend({action:B0(["accept","decline","cancel"]),content:v9((Q)=>Q===null?void 0:Q,o(F(),c([F(),f(),e(),x(F())])).optional())}),e3=q({type:j("ref/resource"),uri:F()});var QK=q({type:j("ref/prompt"),name:F()}),XK=O0.extend({ref:c([QK,e3]),argument:q({name:F(),value:F()}),context:q({arguments:o(F(),F()).optional()}).optional()}),YK=Y0.extend({method:j("completion/complete"),params:XK});var WK=W0.extend({completion:z0({values:x(F()).max(100),total:t(f().int()),hasMore:t(e())})}),GK=q({uri:F().startsWith("file://"),name:F().optional(),_meta:o(F(),n()).optional()}),JK=Y0.extend({method:j("roots/list"),params:O0.optional()}),e9=W0.extend({roots:x(GK)}),$K=Z0.extend({method:j("notifications/roots/list_changed"),params:M0.optional()}),TZ=c([e6,u9,YK,t9,F3,K3,l9,tH,p9,Y3,G3,Q6,o9,X4,W4,G4,$4]),SZ=c([s6,Q4,f9,$K,s1]),RZ=c([a6,a9,s9,H4,e9,Y4,J4,M1]),CZ=c([e6,x3,t3,JK,X4,W4,G4,$4]),kZ=c([s6,Q4,E3,$3,Q3,j3,M3,s1,s3]),vZ=c([a6,lH,WK,V3,B3,oH,aH,eH,z4,q3,Y4,J4,M1]);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===_.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new WG(W.elicitations,X)}return new C(Q,X,Y)}}class WG extends C{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(_.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function t0(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var zK=Symbol("Let zodToJsonSchema decide on which parser to use");var FN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function QQ(Q){let Y=i6(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=AW(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function XQ(Q,X){let Y=n0(Q,X);if(!Y.success)throw Y.error;return Y.data}var DK=60000;class YQ{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(s6,(X)=>{this._oncancel(X)}),this.setNotificationHandler(Q4,(X)=>{this._onprogress(X)}),this.setRequestHandler(e6,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(X4,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(W4,async(X,Y)=>{let W=async()=>{let G=X.params.taskId;if(this._taskMessageQueue){let $;while($=await this._taskMessageQueue.dequeue(G,Y.sessionId)){if($.type==="response"||$.type==="error"){let z=$.message,K=z.id,H=this._requestResolvers.get(K);if(H)if(this._requestResolvers.delete(K),$.type==="response")H(z);else{let B=z,A=new C(B.error.code,B.error.message,B.error.data);H(A)}else{let B=$.type==="response"?"Response":"Error";this._onerror(Error(`${B} handler missing for request ${K}`))}continue}await this._transport?.send($.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask(G,Y.sessionId);if(!J)throw new C(_.InvalidParams,`Task not found: ${G}`);if(!t0(J.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(t0(J.status)){let $=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...$,_meta:{...$._meta,[o0]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(G4,async(X,Y)=>{try{let{tasks:W,nextCursor:G}=await this._taskStore.listTasks(X.params?.cursor,Y.sessionId);return{tasks:W,nextCursor:G,_meta:{}}}catch(W){throw new C(_.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler($4,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,`Task not found: ${X.params.taskId}`);if(t0(W.status))throw new C(_.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 G=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!G)throw new C(_.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof C)throw W;throw new C(_.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,G=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(W,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Y,resetTimeoutOnProgress:G,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(_.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){this._transport=Q;let X=this.transport?.onclose;this._transport.onclose=()=>{X?.(),this._onclose()};let Y=this.transport?.onerror;this._transport.onerror=(G)=>{Y?.(G),this._onerror(G)};let W=this._transport?.onmessage;this._transport.onmessage=(G,J)=>{if(W?.(G,J),r1(G)||nW(G))this._onresponse(G);else if(y9(G))this._onrequest(G,J);else if(rW(G))this._onnotification(G);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},await this._transport.start()}_onclose(){let Q=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let X=C.fromError(_.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,G=Q.params?._meta?.[o0]?.taskId;if(Y===void 0){let H={jsonrpc:"2.0",id:Q.id,error:{code:_.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:H,timestamp:Date.now()},W?.sessionId).catch((B)=>this._onerror(Error(`Failed to enqueue error response: ${B}`)));else W?.send(H).catch((B)=>this._onerror(Error(`Failed to send an error response: ${B}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let $=pW(Q.params)?Q.params.task:void 0,z=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,K={signal:J.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(H)=>{let B={relatedRequestId:Q.id};if(G)B.relatedTask={taskId:G};await this.notification(H,B)},sendRequest:async(H,B,A)=>{let L={...A,relatedRequestId:Q.id};if(G&&!L.relatedTask)L.relatedTask={taskId:G};let U=L.relatedTask?.taskId??G;if(U&&z)await z.updateTaskStatus(U,"input_required");return await this.request(H,B,L)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:G,taskStore:z,taskRequestedTtl:$?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if($)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,K)).then(async(H)=>{if(J.signal.aborted)return;let B={result:H,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)},async(H)=>{if(J.signal.aborted)return;let B={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(H.code)?H.code:_.InternalError,message:H.message??"Internal error",...H.data!==void 0&&{data:H.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)}).catch((H)=>this._onerror(Error(`Failed to send response: ${H}`))).finally(()=>{this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:X,...Y}=Q.params,W=Number(X),G=this._progressHandlers.get(W);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(Q)}`));return}let J=this._responseHandlers.get(W),$=this._timeoutInfo.get(W);if($&&J&&$.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(z){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),J(z);return}G(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),r1(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 G=!1;if(r1(Q)&&Q.result&&typeof Q.result==="object"){let J=Q.result;if(J.task&&typeof J.task==="object"){let $=J.task;if(typeof $.taskId==="string")G=!0,this._taskProgressTokens.set($.taskId,X)}}if(!G)this._progressHandlers.delete(X);if(r1(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(_.InternalError,String(J))}}return}let G;try{let J=await this.request(Q,M1,Y);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new C(_.InternalError,"Task creation did not return a task");while(!0){let $=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:$},t0($.status)){if($.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if($.status==="failed")yield{type:"error",error:new C(_.InternalError,`Task ${G} failed`)};else if($.status==="cancelled")yield{type:"error",error:new C(_.InternalError,`Task ${G} was cancelled`)};return}if($.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};return}let z=$.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((K)=>setTimeout(K,z)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof C?J:new C(_.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J,task:$,relatedTask:z}=Y??{};return new Promise((K,H)=>{let B=(M)=>{H(M)};if(!this._transport){B(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),$)this.assertTaskCapability(Q.method)}catch(M){B(M);return}Y?.signal?.throwIfAborted();let A=this._requestMessageId++,L={...Q,jsonrpc:"2.0",id:A};if(Y?.onprogress)this._progressHandlers.set(A,Y.onprogress),L.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:A}};if($)L.params={...L.params,task:$};if(z)L.params={...L.params,_meta:{...L.params?._meta||{},[o0]:z}};let U=(M)=>{this._responseHandlers.delete(A),this._progressHandlers.delete(A),this._cleanupTimeout(A),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:A,reason:String(M)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let T=M instanceof C?M:new C(_.RequestTimeout,String(M));H(T)};this._responseHandlers.set(A,(M)=>{if(Y?.signal?.aborted)return;if(M instanceof Error)return H(M);try{let T=n0(X,M.result);if(!T.success)H(T.error);else K(T.data)}catch(T){H(T)}}),Y?.signal?.addEventListener("abort",()=>{U(Y?.signal?.reason)});let O=Y?.timeout??DK,V=()=>U(C.fromError(_.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(A,O,Y?.maxTotalTimeout,V,Y?.resetTimeoutOnProgress??!1);let Z=z?.taskId;if(Z){let M=(T)=>{let E=this._responseHandlers.get(A);if(E)E(T);else this._onerror(Error(`Response handler missing for side-channeled request ${A}`))};this._requestResolvers.set(A,M),this._enqueueTaskMessage(Z,{type:"request",message:L,timestamp:Date.now()}).catch((T)=>{this._cleanupTimeout(A),H(T)})}else this._transport.send(L,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((M)=>{this._cleanupTimeout(A),H(M)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},Y4,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},J4,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},aW,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let $={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[o0]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:$,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 $={...Q,jsonrpc:"2.0"};if(X?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[o0]:X.relatedTask}}};this._transport?.send($,X).catch((z)=>this._onerror(z))});return}let J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[o0]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=QQ(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let J=XQ(Q,W);return Promise.resolve(X(J,G))})}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=QQ(Q);this._notificationHandlers.set(Y,(W)=>{let G=XQ(Q,W);return Promise.resolve(X(G))})}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"&&y9(W.message)){let G=W.message.id,J=this._requestResolvers.get(G);if(J)J(new C(_.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(G);else this._onerror(Error(`Resolver missing for request ${G} 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,G)=>{if(X.aborted){G(new C(_.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),G(new C(_.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 G=await Y.getTask(W,X);if(!G)throw new C(_.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,J)=>{await Y.storeTaskResult(W,G,J,X);let $=await Y.getTask(W,X);if($){let z=s1.parse({method:"notifications/tasks/status",params:$});if(await this.notification(z),t0($.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,G,J)=>{let $=await Y.getTask(W,X);if(!$)throw new C(_.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(t0($.status))throw new C(_.InvalidParams,`Cannot update task "${W}" from terminal status "${$.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(W,G,J,X);let z=await Y.getTask(W,X);if(z){let K=s1.parse({method:"notifications/tasks/status",params:z});if(await this.notification(K),t0(z.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function GG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function JG(Q,X){let Y={...Q};for(let W in X){let G=W,J=X[G];if(J===void 0)continue;let $=Y[G];if(GG($)&&GG(J))Y[G]={...$,...J};else Y[G]=J}return Y}var y$=UX(tQ(),1),g$=UX(_$(),1);function wV(){let Q=new y$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return g$.default(Q),Q}class $X{constructor(Q){this._ajv=Q??wV()}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 zX{constructor(Q){this._server=Q}requestStream(Q,X,Y){return this._server.requestStream(Q,X,Y)}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 h$(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 u$(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 HX extends YQ{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(X6.options.map((Y,W)=>[Y,W])),this.isMessageIgnored=(Y,W)=>{let G=this._loggingLevels.get(W);return G?this.LOG_LEVEL_SEVERITY.get(Y)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=X?.capabilities??{},this._instructions=X?.instructions,this._jsonSchemaValidator=X?.jsonSchemaValidator??new $X,this.setRequestHandler(u9,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(f9,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(t9,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,$=X6.safeParse(J);if($.success)this._loggingLevels.set(G,$.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new zX(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=JG(this._capabilities,Q)}setRequestHandler(Q,X){let W=i6(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(O1(W)){let $=W;G=$._zod?.def?.value??$.value}else{let $=W;G=$._def?.value??$.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let $=async(z,K)=>{let H=n0(Q6,z);if(!H.success){let U=H.error instanceof Error?H.error.message:String(H.error);throw new C(_.InvalidParams,`Invalid tools/call request: ${U}`)}let{params:B}=H.data,A=await Promise.resolve(X(z,K));if(B.task){let U=n0(M1,A);if(!U.success){let O=U.error instanceof Error?U.error.message:String(U.error);throw new C(_.InvalidParams,`Invalid task creation result: ${O}`)}return U.data}let L=n0(z4,A);if(!L.success){let U=L.error instanceof Error?L.error.message:String(L.error);throw new C(_.InvalidParams,`Invalid tools/call result: ${U}`)}return L.data};return super.setRequestHandler(Q,$)}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){u$(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;h$(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:mW.includes(X)?X:x9,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"},a6)}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],G=W.some((K)=>K.type==="tool_result"),J=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,$=J?Array.isArray(J.content)?J.content:[J.content]:[],z=$.some((K)=>K.type==="tool_use");if(G){if(W.some((K)=>K.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!z)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(z){let K=new Set($.filter((B)=>B.type==="tool_use").map((B)=>B.id)),H=new Set(W.filter((B)=>B.type==="tool_result").map((B)=>B.toolUseId));if(K.size!==H.size||![...K].every((B)=>H.has(B)))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},s9,X);return this.request({method:"sampling/createMessage",params:Q},a9,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},H4,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"},G=await this.request({method:"elicitation/create",params:W},H4,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let $=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!$.valid)throw new C(_.InvalidParams,`Elicitation response content does not match requested schema: ${$.errorMessage}`)}catch(J){if(J instanceof C)throw J;throw new C(_.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return G}}}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},e9,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"})}}import m$ from"node:process";class KX{append(Q){this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
|
|
29
|
+
`);if(Q===-1)return null;let X=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),jV(X)}clear(){this._buffer=void 0}}function jV(Q){return oW.parse(JSON.parse(Q))}function f$(Q){return JSON.stringify(Q)+`
|
|
30
|
+
`}class BX{constructor(Q=m$.stdin,X=m$.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new KX,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=f$(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var l$=[{uri:"sequenzy://dashboard",name:"Dashboard Overview",description:"Live overview stats for the last 7 days",mimeType:"application/json"},{uri:"sequenzy://campaigns/recent",name:"Recent Campaigns",description:"Last 10 campaigns with status and basic stats",mimeType:"application/json"},{uri:"sequenzy://subscribers/recent",name:"Recent Subscribers",description:"Most recently added subscribers",mimeType:"application/json"},{uri:"sequenzy://subscribers/engaged",name:"Engaged Subscribers",description:"Most active/engaged subscribers",mimeType:"application/json"},{uri:"sequenzy://sequences",name:"Sequences",description:"All email sequences with status",mimeType:"application/json"},{uri:"sequenzy://templates",name:"Templates",description:"All available email templates",mimeType:"application/json"},{uri:"sequenzy://segments",name:"Segments",description:"All defined segments with subscriber counts",mimeType:"application/json"},{uri:"sequenzy://tags",name:"Tags",description:"All tags with usage counts",mimeType:"application/json"},{uri:"sequenzy://health",name:"Deliverability Health",description:"Email deliverability metrics and health status",mimeType:"application/json"}];async function c$(Q){try{let X;switch(Q){case"sequenzy://dashboard":X=await w("GET","/api/v1/stats?period=7d");break;case"sequenzy://campaigns/recent":X=await w("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":X=await w("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":X=await w("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":X=await w("GET","/api/v1/sequences");break;case"sequenzy://templates":X=await w("GET","/api/v1/templates");break;case"sequenzy://segments":X=await w("GET","/api/v1/segments");break;case"sequenzy://tags":X=await w("GET","/api/v1/tags");break;case"sequenzy://health":X=await w("GET","/api/v1/health/deliverability");break;default:throw Error(`Unknown resource: ${Q}`)}return{contents:[{uri:Q,mimeType:"application/json",text:JSON.stringify(X,null,2)}]}}catch(X){return{contents:[{uri:Q,mimeType:"text/plain",text:`Error: ${X instanceof Error?X.message:"Unknown error"}`}]}}}var p$=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
31
|
+
1. Call select_company first to choose which company to work with, OR
|
|
32
|
+
2. Pass companyId explicitly in each tool call
|
|
33
|
+
|
|
34
|
+
The response shows 'companies' (all available) and 'selectedCompanyId' (currently active). All subsequent operations will use the selected company unless you pass a companyId override.`,inputSchema:{type:"object",properties:{}}},{name:"select_company",description:"Select which company to operate on (for user-scoped API keys with access to multiple companies). Use get_account to see available companies. After selecting, all subsequent operations will use this company unless you pass a companyId override.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"The company ID to select (from get_account's companies list)"}},required:["companyId"]}},{name:"create_company",description:"Create a new company/brand. This will parse your website to extract brand information. The tool polls every 20 seconds until the company is fully processed (typically 30-60 seconds).",inputSchema:{type:"object",properties:{name:{type:"string",description:"Company name (optional, will be extracted from domain if not provided)"},domain:{type:"string",description:"The company's website domain (e.g., example.com)"}},required:["domain"]}},{name:"get_company",description:"Get company details and processing status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"The company ID to check"}},required:["companyId"]}},{name:"create_api_key",description:"Create a new API key for a company. Use this when setting up Sequenzy integration in a project. The returned key should be saved to the project's .env file as SEQUENZY_API_KEY. The key can only be retrieved once at creation time.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the key for"},name:{type:"string",description:"Optional name for the API key (e.g., 'Production', 'Development')"}},required:["companyId"]}},{name:"list_websites",description:"List all configured sender websites/domains",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"add_website",description:"Add a new sender website. Takes ~30 seconds to process.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},domain:{type:"string",description:"The domain to add (e.g., example.com)"}},required:["domain"]}},{name:"check_website",description:"Check if a website has been processed and is ready to use",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},domain:{type:"string",description:"The domain to check"}},required:["domain"]}},{name:"get_integration_guide",description:"Get code examples for integrating Sequenzy into your project. Returns code snippets and helpful tips. IMPORTANT: Before implementing, use create_api_key to generate an API key for the company, then save it to the project's .env file as SEQUENZY_API_KEY. For payment/subscription events, the event_tracking guide recommends connecting payment providers (Stripe, Paddle, Dodo, Creem) directly in the dashboard instead of manual tracking.",inputSchema:{type:"object",properties:{framework:{type:"string",description:"Framework/language (nextjs, express, python, etc.)"},use_case:{type:"string",description:"Use case: 'transactional' (sending emails), 'subscribe_form' (adding subscribers), 'event_tracking' (tracking custom events - includes payment provider integration tips)"}}}},{name:"add_subscriber",description:"Add a new subscriber to your list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to add subscriber to. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Custom attributes (name, plan, etc.)"},tags:{type:"array",items:{type:"string"},description:"Tags to apply to the subscriber"},listIds:{type:"array",items:{type:"string"},description:"List IDs to add subscriber to"}},required:["email"]}},{name:"update_subscriber",description:"Update an existing subscriber's attributes or tags",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Attributes to update"},addTags:{type:"array",items:{type:"string"},description:"Tags to add"},removeTags:{type:"array",items:{type:"string"},description:"Tags to remove"}},required:["email"]}},{name:"remove_subscriber",description:"Unsubscribe or delete a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:["email"]}},{name:"get_subscriber",description:"Get subscriber details and activity history",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"search_subscribers",description:"Search subscribers by tags, attributes, or segments",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},query:{type:"string",description:"Search query (email or name)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},segmentId:{type:"string",description:"Filter by segment ID"},limit:{type:"number",description:"Maximum results (default 50)"}}}},{name:"list_tags",description:"List all tags in the account",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list tags for. If not provided, uses the currently selected company."}}}},{name:"list_lists",description:"List all subscriber lists",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list lists for. If not provided, uses the currently selected company."}}}},{name:"create_list",description:"Create a new subscriber list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the list in. If not provided, uses the currently selected company."},name:{type:"string",description:"List name"},description:{type:"string",description:"List description"}},required:["name"]}},{name:"list_segments",description:"List all segments",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list segments for. If not provided, uses the currently selected company."}}}},{name:"create_segment",description:"Create a new segment with filter rules",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the segment in. If not provided, uses the currently selected company."},name:{type:"string",description:"Segment name"},filters:{type:"object",description:"Filter rules for the segment"}},required:["name","filters"]}},{name:"get_segment_count",description:"Get the number of subscribers in a segment",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID"}},required:["segmentId"]}},{name:"list_templates",description:"List all email templates",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_template",description:"Get a template's details and content",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"create_template",description:"Create a new email template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"}},required:["name","subject","html"]}},{name:"update_template",description:"Update an existing template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"}},required:["templateId"]}},{name:"delete_template",description:"Delete a template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"list_campaigns",description:"List all campaigns",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list campaigns for. If not provided, uses the currently selected company."},status:{type:"string",description:"Filter by status (draft, scheduled, sent)"}}}},{name:"get_campaign",description:"Get campaign details and stats",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"create_campaign",description:"Create a new campaign (as draft)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the campaign in. If not provided, uses the currently selected company."},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"},templateId:{type:"string",description:"Use a template instead of html"},segmentId:{type:"string",description:"Target segment ID"}},required:["name","subject"]}},{name:"update_campaign",description:"Update a draft campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content"}},required:["campaignId"]}},{name:"send_test_email",description:"Send a test email to a single address",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID to test"},to:{type:"string",description:"Email address to send test to"}},required:["campaignId","to"]}},{name:"list_sequences",description:"List all email sequences (automations)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list sequences for. If not provided, uses the currently selected company."}}}},{name:"get_sequence",description:"Get sequence details and emails",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"create_sequence",description:`Create a new email sequence. Sequenzy will automatically generate the email content using AI based on your company's brand and the goal you specify. The tool polls until emails are generated (typically 30-60 seconds).
|
|
35
|
+
|
|
36
|
+
IMPORTANT GUIDELINES:
|
|
37
|
+
|
|
38
|
+
1. NEVER ENABLE SEQUENCES AUTOMATICALLY:
|
|
39
|
+
- Sequences are created in DRAFT/PAUSED state
|
|
40
|
+
- NEVER call enable_sequence unless the user EXPLICITLY asks to enable/activate
|
|
41
|
+
- The user must review the AI-generated content before going live
|
|
42
|
+
- Sequences send real emails to real people - enabling without review is dangerous
|
|
43
|
+
|
|
44
|
+
2. KEEP IT SIMPLE: Only suggest sequences that are straightforward to implement:
|
|
45
|
+
- Prefer 3-5 emails per sequence (not 10+)
|
|
46
|
+
- Use simple, achievable triggers that the app already tracks
|
|
47
|
+
- Avoid complex multi-step sequences that require extensive app changes
|
|
48
|
+
|
|
49
|
+
2. MATCH THE BUSINESS MODEL:
|
|
50
|
+
- If the app has NO trial period, do NOT create trial-related sequences
|
|
51
|
+
- If the app is FREE (no paid plans), do NOT create upgrade/pricing sequences
|
|
52
|
+
- If the app is a one-time purchase (not SaaS), do NOT create subscription sequences
|
|
53
|
+
- Match sequences to events and features that ACTUALLY exist in the app
|
|
54
|
+
|
|
55
|
+
3. EVENT TRACKING: When you use a custom event (not a built-in event), you MUST:
|
|
56
|
+
- The event will be auto-created in Sequenzy
|
|
57
|
+
- The response includes eventTrackingCode showing exactly what code to add to the app
|
|
58
|
+
- Tell the user what specific user action should trigger each event
|
|
59
|
+
- Be specific: "Track 'project.created' when user creates their first project"
|
|
60
|
+
|
|
61
|
+
4. SEQUENCE TRIGGER RECIPES - USE THESE EXACT CONFIGURATIONS:
|
|
62
|
+
|
|
63
|
+
TRIAL CONVERSION:
|
|
64
|
+
- trigger: tag_added, tagName: "trial"
|
|
65
|
+
- Auto-stops when: user gets "customer" tag
|
|
66
|
+
- Goal: Convert trial users to paying customers
|
|
67
|
+
|
|
68
|
+
PAYMENT RECOVERY / DUNNING:
|
|
69
|
+
- trigger: tag_added, tagName: "past-due"
|
|
70
|
+
- Auto-stops when: user no longer has "past-due" tag (they paid)
|
|
71
|
+
- Goal: Recover failed payments before churn
|
|
72
|
+
|
|
73
|
+
CANCELLATION RECOVERY / WIN-BACK:
|
|
74
|
+
- trigger: tag_added, tagName: "cancelled"
|
|
75
|
+
- Auto-stops when: user gets "customer" tag again
|
|
76
|
+
- Goal: Win back users who cancelled
|
|
77
|
+
|
|
78
|
+
CHURN RECOVERY:
|
|
79
|
+
- trigger: tag_added, tagName: "churned"
|
|
80
|
+
- Auto-stops when: user gets "customer" tag again
|
|
81
|
+
- Goal: Re-engage churned users
|
|
82
|
+
|
|
83
|
+
UPGRADE / UPSELL:
|
|
84
|
+
- trigger: tag_added, tagName: "customer"
|
|
85
|
+
- Auto-stops when: user triggers "saas.upgrade" event
|
|
86
|
+
- Goal: Encourage customers to upgrade to higher plans
|
|
87
|
+
|
|
88
|
+
ONBOARDING:
|
|
89
|
+
- trigger: event_received, eventName: "signup.completed"
|
|
90
|
+
- Auto-stops when: "onboarding.completed" event fires
|
|
91
|
+
- Goal: Guide new users through product setup
|
|
92
|
+
|
|
93
|
+
WELCOME SERIES:
|
|
94
|
+
- trigger: contact_added (optionally with listId)
|
|
95
|
+
- No auto-stop (runs to completion)
|
|
96
|
+
- Goal: Introduce new subscribers to your brand
|
|
97
|
+
|
|
98
|
+
RE-ENGAGEMENT:
|
|
99
|
+
- trigger: inactivity, eventName: "login", inactiveDays: 14
|
|
100
|
+
- Auto-stops when: user logs in again
|
|
101
|
+
- Goal: Bring back inactive users
|
|
102
|
+
|
|
103
|
+
Built-in events you can use: saas.purchase, saas.trial_started, saas.trial_ended, saas.cancelled, email.opened, email.clicked
|
|
104
|
+
Built-in tags you can use: lead, customer, trial, cancelled, churned, active, inactive, past-due`,inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the sequence in. If not provided, uses the currently selected company."},name:{type:"string",description:"Sequence name (e.g., 'User Onboarding', 'Welcome Series')"},trigger:{type:"string",enum:["contact_added","tag_added","event_received","inactivity","frequency"],description:"Trigger type: 'contact_added' (when added to a list), 'tag_added' (when tag is applied), 'event_received' (when custom event fires), 'inactivity' (when subscriber hasn't performed an event for X days), 'frequency' (when subscriber performs event X times in Y days)"},listId:{type:"string",description:"List ID to trigger on (for contact_added trigger). If not provided, triggers on any list."},tagName:{type:"string",description:"Tag name to trigger on (required for tag_added trigger)"},eventName:{type:"string",description:"Event name to trigger on (required for event_received, inactivity, and frequency triggers)"},inactiveDays:{type:"number",description:"Number of days of inactivity (required for inactivity trigger, must be >= 1)"},minCount:{type:"number",description:"Minimum event count (required for frequency trigger, must be >= 1)"},timeWindowDays:{type:"number",description:"Time window in days for frequency trigger (required for frequency trigger, must be >= 1)"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5)"},goal:{type:"string",description:"What this sequence should accomplish. Be specific to the app's actual features and user journey. Avoid generic goals that don't match the app's business model."}},required:["name","trigger","goal"]}},{name:"update_sequence",description:"Update an existing sequence",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"},name:{type:"string",description:"Sequence name"},emails:{type:"array",description:"Updated email steps"}},required:["sequenceId"]}},{name:"enable_sequence",description:"Enable/activate a sequence. IMPORTANT: Only call this when the user EXPLICITLY asks to enable or activate a sequence. Never enable sequences automatically after creation - the user must review the content first.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"disable_sequence",description:"Disable/pause a sequence",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"delete_sequence",description:"Delete a sequence",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"send_email",description:"Send a transactional email to a single recipient",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},to:{type:"string",description:"Recipient email address"},subject:{type:"string",description:"Email subject (required if not using templateId)"},html:{type:"string",description:"Email HTML content (required if not using templateId)"},templateId:{type:"string",description:"Template ID to use (alternative to html)"},variables:{type:"object",description:"Variables for template personalization"}},required:["to"]}},{name:"get_stats",description:"Get overview statistics for a time period",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},period:{type:"string",description:"Time period: 7d, 30d, or 90d (default: 7d)"}}}},{name:"get_campaign_stats",description:"Get detailed statistics for a campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"get_sequence_stats",description:"Get statistics for a sequence",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"get_subscriber_activity",description:"Get activity timeline for a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"generate_email",description:"Generate email HTML content from a prompt",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},prompt:{type:"string",description:"Description of the email to generate"},style:{type:"string",description:"Style: minimal, branded, promotional"},tone:{type:"string",description:"Tone: professional, casual, friendly"}},required:["prompt"]}},{name:"generate_sequence",description:"[DEPRECATED - Use create_sequence instead] Generate a multi-email sequence from a goal. Note: create_sequence now handles AI generation automatically.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},goal:{type:"string",description:"Goal of the sequence (e.g., 'onboard new SaaS trial users')"},emailCount:{type:"number",description:"Number of emails in the sequence (default: 5)"},durationDays:{type:"number",description:"Total duration in days (default: 14)"}},required:["goal"]}},{name:"generate_subject_lines",description:"Generate A/B test subject line variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},topic:{type:"string",description:"Topic or context for the subject lines"},count:{type:"number",description:"Number of variants to generate (default: 5)"}},required:["topic"]}}];async function i$(Q,X){try{let Y;switch(Q){case"get_account":{let W=await w("GET","/api/v1/account"),G=d$();Y={...W,selectedCompanyId:G??W.currentCompanyId};break}case"select_company":{let W=X.companyId,G=await w("GET","/api/v1/account"),J=G.companies?.find(($)=>$.id===W);if(!J)throw Error(`Company not found. Available companies: ${G.companies?.map(($)=>`${$.name} (${$.id})`).join(", ")??"none"}`);AX(W),Y={success:!0,message:`Switched to company: ${J.name}`,companyId:J.id,companyName:J.name};break}case"create_company":{let W=await w("POST","/api/v1/companies",{name:X.name,domain:X.domain});if(!W.success)throw Error("Failed to create company");let G=W.company.id,J=6,$=0,z=W.company.status;while(z==="processing"&&$<J){await new Promise((B)=>setTimeout(B,20000)),$++;let H=await w("GET",`/api/v1/companies/${G}`);if(H.success)z=H.company.status}AX(G);let K=await w("GET",`/api/v1/companies/${G}`);Y={success:!0,company:K.company,message:z==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${K.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let W=X.companyId;Y=await w("GET",`/api/v1/companies/${W}`);break}case"create_api_key":{let W=X.companyId;Y=await w("POST","/api/v1/api-keys",{name:X.name},W);break}case"list_websites":{let W=X.companyId;Y=await w("GET","/api/v1/websites",void 0,W);break}case"add_website":{let W=X.companyId;Y=await w("POST","/api/v1/websites",{domain:X.domain},W);break}case"check_website":{let W=X.companyId;Y=await w("GET",`/api/v1/websites/${X.domain}`,void 0,W);break}case"get_integration_guide":Y=await w("POST","/api/v1/integration-guide",X);break;case"add_subscriber":{let W=X.companyId;Y=await w("POST","/api/v1/subscribers",X,W);break}case"update_subscriber":{let W=X.companyId;Y=await w("PUT",`/api/v1/subscribers/${X.email}`,X,W);break}case"remove_subscriber":{let W=X.companyId;Y=await w("DELETE",`/api/v1/subscribers/${X.email}`,X,W);break}case"get_subscriber":{let W=X.companyId;Y=await w("GET",`/api/v1/subscribers/${X.email}`,void 0,W);break}case"search_subscribers":{let W=X.companyId,G=new URLSearchParams;if(X.query)G.set("query",String(X.query));if(X.tags)G.set("tags",X.tags.join(","));if(X.segmentId)G.set("segmentId",String(X.segmentId));if(X.limit)G.set("limit",String(X.limit));Y=await w("GET",`/api/v1/subscribers?${G}`,void 0,W);break}case"list_tags":{let W=X.companyId;Y=await w("GET","/api/v1/tags",void 0,W);break}case"list_lists":{let W=X.companyId;Y=await w("GET","/api/v1/lists",void 0,W);break}case"create_list":{let W=X.companyId;Y=await w("POST","/api/v1/lists",X,W);break}case"list_segments":{let W=X.companyId;Y=await w("GET","/api/v1/segments",void 0,W);break}case"create_segment":{let W=X.companyId;Y=await w("POST","/api/v1/segments",X,W);break}case"get_segment_count":{let W=X.companyId;Y=await w("GET",`/api/v1/segments/${X.segmentId}/count`,void 0,W);break}case"list_templates":{let W=X.companyId;Y=await w("GET","/api/v1/templates",void 0,W);break}case"get_template":{let W=X.companyId;Y=await w("GET",`/api/v1/templates/${X.templateId}`,void 0,W);break}case"create_template":{let W=X.companyId;Y=await w("POST","/api/v1/templates",X,W);break}case"update_template":{let W=X.companyId;Y=await w("PUT",`/api/v1/templates/${X.templateId}`,X,W);break}case"delete_template":{let W=X.companyId;Y=await w("DELETE",`/api/v1/templates/${X.templateId}`,void 0,W);break}case"list_campaigns":{let W=X.companyId,G=new URLSearchParams;if(X.status)G.set("status",String(X.status));Y=await w("GET",`/api/v1/campaigns?${G}`,void 0,W);break}case"get_campaign":{let W=X.companyId;Y=await w("GET",`/api/v1/campaigns/${X.campaignId}`,void 0,W);break}case"create_campaign":{let W=X.companyId;Y=await w("POST","/api/v1/campaigns",X,W);break}case"update_campaign":{let W=X.companyId;Y=await w("PUT",`/api/v1/campaigns/${X.campaignId}`,X,W);break}case"send_test_email":{let W=X.companyId;Y=await w("POST",`/api/v1/campaigns/${X.campaignId}/test`,{to:X.to},W);break}case"list_sequences":{let W=X.companyId;Y=await w("GET","/api/v1/sequences",void 0,W);break}case"get_sequence":{let W=X.companyId;Y=await w("GET",`/api/v1/sequences/${X.sequenceId}`,void 0,W);break}case"create_sequence":{let W=X.companyId,G=await w("POST","/api/v1/sequences",X,W);if(!G.success){Y=G;break}let J=G.sequence.id,$=6,z=0,K="pending";while(K!=="complete"&&z<$){await new Promise((A)=>setTimeout(A,20000)),z++;let B=await w("GET",`/api/v1/sequences/${J}`,void 0,W);if(B.success)K=B.sequence.enrichmentStatus}let H=await w("GET",`/api/v1/sequences/${J}`,void 0,W);if(H.success)Y={success:!0,sequence:H.sequence,message:H.sequence.enrichmentStatus==="complete"?`Sequence "${H.sequence.name}" created with ${H.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${H.sequence.name}" created. Email enrichment is still in progress (${H.sequence.enrichedCount}/${H.sequence.emailCount} emails generated). You can check status with get_sequence.`};else Y=H;break}case"update_sequence":{let W=X.companyId;Y=await w("PUT",`/api/v1/sequences/${X.sequenceId}`,X,W);break}case"enable_sequence":{let W=X.companyId;Y=await w("POST",`/api/v1/sequences/${X.sequenceId}/enable`,void 0,W);break}case"disable_sequence":{let W=X.companyId;Y=await w("POST",`/api/v1/sequences/${X.sequenceId}/disable`,void 0,W);break}case"delete_sequence":{let W=X.companyId;Y=await w("DELETE",`/api/v1/sequences/${X.sequenceId}`,void 0,W);break}case"send_email":{let W=X.companyId;Y=await w("POST","/api/v1/transactional/send",X,W);break}case"get_stats":{let W=X.companyId,G=X.period??"7d";Y=await w("GET",`/api/v1/stats?period=${G}`,void 0,W);break}case"get_campaign_stats":{let W=X.companyId;Y=await w("GET",`/api/v1/campaigns/${X.campaignId}/stats`,void 0,W);break}case"get_sequence_stats":{let W=X.companyId;Y=await w("GET",`/api/v1/sequences/${X.sequenceId}/stats`,void 0,W);break}case"get_subscriber_activity":{let W=X.companyId;Y=await w("GET",`/api/v1/subscribers/${X.email}/activity`,void 0,W);break}case"generate_email":{let W=X.companyId;Y=await w("POST","/api/v1/generate/email",X,W);break}case"generate_sequence":{let W=X.companyId;Y=await w("POST","/api/v1/generate/sequence",X,W);break}case"generate_subject_lines":{let W=X.companyId;Y=await w("POST","/api/v1/generate/subjects",X,W);break}default:throw Error(`Unknown tool: ${Q}`)}return{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}catch(Y){return{content:[{type:"text",text:`Error: ${Y instanceof Error?Y.message:"Unknown error"}`}]}}}var PV=process.env.SEQUENZY_API_URL??"https://api.sequenzy.com",r$=process.env.SEQUENZY_API_KEY,FX=null;if(!r$)console.error("Error: SEQUENZY_API_KEY environment variable is required"),console.error("Run `npx @sequenzy/setup` to configure your API key."),process.exit(1);function d$(){return FX}function AX(Q){FX=Q}var E6=new HX({name:"sequenzy",version:"0.0.1"},{capabilities:{tools:{},resources:{}}});async function w(Q,X,Y,W){let G={"Content-Type":"application/json",Authorization:`Bearer ${r$}`},J=W??FX;if(J)G["x-company-id"]=J;let $=await fetch(`${PV}${X}`,{method:Q,headers:G,body:Y?JSON.stringify(Y):void 0});if(!$.ok){let z=await $.text();throw Error(`API error: ${$.status} - ${z}`)}return $.json()}E6.setRequestHandler(o9,async()=>{return{tools:p$}});E6.setRequestHandler(Q6,async(Q)=>{let{name:X,arguments:Y}=Q.params;return i$(X,Y??{})});E6.setRequestHandler(l9,async()=>{return{resources:l$}});E6.setRequestHandler(p9,async(Q)=>{let{uri:X}=Q.params;return c$(X)});async function bV(){let Q=new BX;await E6.connect(Q),console.error("Sequenzy MCP server running on stdio")}bV().catch((Q)=>{console.error("Fatal error:",Q),process.exit(1)});export{AX as setSelectedCompanyId,d$ as getSelectedCompanyId,w as apiRequest};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sequenzy/mcp",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Sequenzy MCP server for AI-powered email marketing automation",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"sequenzy-mcp": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./src/index.ts",
|
|
10
|
+
"types": "./src/index.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": "./src/index.ts"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "bun --watch src/index.ts",
|
|
16
|
+
"build": "bun build src/index.ts --outdir dist --target node --minify",
|
|
17
|
+
"start": "node dist/index.js",
|
|
18
|
+
"type-check": "tsc --noEmit",
|
|
19
|
+
"test": "bun test",
|
|
20
|
+
"test:watch": "bun test --watch",
|
|
21
|
+
"prepublishOnly": "bun run build"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/bun": "latest",
|
|
28
|
+
"@types/node": "^22.0.0",
|
|
29
|
+
"bun-types": "latest",
|
|
30
|
+
"typescript": "^5.8.0"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"keywords": [
|
|
36
|
+
"sequenzy",
|
|
37
|
+
"email",
|
|
38
|
+
"mcp",
|
|
39
|
+
"ai",
|
|
40
|
+
"claude",
|
|
41
|
+
"automation"
|
|
42
|
+
],
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": "https://github.com/sequenzy/sequenzy"
|
|
47
|
+
}
|
|
48
|
+
}
|