@sequenzy/mcp 0.0.42 → 0.0.43
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 +13 -13
- package/dist/runtime.js +2 -0
- package/dist/server.js +174 -0
- package/package.json +4 -2
- package/server.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var w5=Object.create;var{getPrototypeOf:b5,defineProperty:BQ,getOwnPropertyNames:P5}=Object;var j5=Object.prototype.hasOwnProperty;function I5(Q){return this[Q]}var E5,T5,xX=(Q,X,Y)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=X?E5??=new WeakMap:T5??=new WeakMap,$=G.get(Q);if($)return $}Y=Q!=null?w5(b5(Q)):{};let J=X||!Q||!Q.__esModule?BQ(Y,"default",{value:Q,enumerable:!0}):Y;for(let z of P5(Q))if(!j5.call(J,z))BQ(J,z,{get:I5.bind(Q,z),enumerable:!0});if(W)G.set(Q,J);return J};var N=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var S5=(Q)=>Q;function R5(Q,X){this[Q]=S5.bind(null,X)}var _X=(Q,X)=>{for(var Y in X)BQ(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:R5.bind(X,Y)})};var F4=N((EG)=>{Object.defineProperty(EG,"__esModule",{value:!0});EG.regexpCode=EG.getEsmExportName=EG.getProperty=EG.safeStringify=EG.stringify=EG.strConcat=EG.addCodeArg=EG.str=EG._=EG.nil=EG._Code=EG.Name=EG.IDENTIFIER=EG._CodeOrName=void 0;class b6{}EG._CodeOrName=b6;EG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class R1 extends b6{constructor(Q){super();if(!EG.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}}}EG.Name=R1;class S0 extends b6{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 R1)X[Y.str]=(X[Y.str]||0)+1;return X},{})}}EG._Code=S0;EG.nil=new S0("");function jG(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)Z9(Y,X[W]),Y.push(Q[++W]);return new S0(Y)}EG._=jG;var V9=new S0("+");function IG(Q,...X){let Y=[q4(Q[0])],W=0;while(W<X.length)Y.push(V9),Z9(Y,X[W]),Y.push(V9,q4(Q[++W]));return nU(Y),new S0(Y)}EG.str=IG;function Z9(Q,X){if(X instanceof S0)Q.push(...X._items);else if(X instanceof R1)Q.push(X);else Q.push(oU(X))}EG.addCodeArg=Z9;function nU(Q){let X=1;while(X<Q.length-1){if(Q[X]===V9){let Y=rU(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function rU(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof R1||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 R1))return`"${Q}${X.slice(1)}`;return}function dU(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:IG`${Q}${X}`}EG.strConcat=dU;function oU(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:q4(Array.isArray(Q)?Q.join(","):Q)}function tU(Q){return new S0(q4(Q))}EG.stringify=tU;function q4(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}EG.safeStringify=q4;function aU(Q){return typeof Q=="string"&&EG.IDENTIFIER.test(Q)?new S0(`.${Q}`):jG`[${Q}]`}EG.getProperty=aU;function sU(Q){if(typeof Q=="string"&&EG.IDENTIFIER.test(Q))return new S0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}EG.getEsmExportName=sU;function eU(Q){return new S0(Q.toString())}EG.regexpCode=eU});var P9=N((CG)=>{Object.defineProperty(CG,"__esModule",{value:!0});CG.ValueScope=CG.ValueScopeName=CG.Scope=CG.varKinds=CG.UsedValueState=void 0;var q0=F4();class SG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var j6;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(j6||(CG.UsedValueState=j6={}));CG.varKinds={const:new q0.Name("const"),let:new q0.Name("let"),var:new q0.Name("var")};class w9{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof q0.Name?Q:this.name(Q)}name(Q){return new q0.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}}}CG.Scope=w9;class b9 extends q0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:Y}){this.value=Q,this.scopePath=q0._`.${new q0.Name(X)}[${Y}]`}}CG.ValueScopeName=b9;var BA=q0._`\n`;class RG extends w9{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?BA:q0.nil}}get(){return this._scope}name(Q){return new b9(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,$=(Y=X.key)!==null&&Y!==void 0?Y:X.ref,J=this._values[G];if(J){let U=J.get($);if(U)return U}else J=this._values[G]=new Map;J.set($,W);let z=this._scope[G]||(this._scope[G]=[]),H=z.length;return z[H]=X.ref,W.setValue(X,{property:G,itemIndex:H}),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 q0._`${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=q0.nil;for(let $ in Q){let J=Q[$];if(!J)continue;let z=Y[$]=Y[$]||new Map;J.forEach((H)=>{if(z.has(H))return;z.set(H,j6.Started);let U=X(H);if(U){let A=this.opts.es5?CG.varKinds.var:CG.varKinds.const;G=q0._`${G}${A} ${H} = ${U};${this.opts._n}`}else if(U=W===null||W===void 0?void 0:W(H))G=q0._`${G}${U}${this.opts._n}`;else throw new SG(H);z.set(H,j6.Completed)})}return G}}CG.ValueScope=RG});var v=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 g=F4(),R0=P9(),G1=F4();Object.defineProperty(F0,"_",{enumerable:!0,get:function(){return G1._}});Object.defineProperty(F0,"str",{enumerable:!0,get:function(){return G1.str}});Object.defineProperty(F0,"strConcat",{enumerable:!0,get:function(){return G1.strConcat}});Object.defineProperty(F0,"nil",{enumerable:!0,get:function(){return G1.nil}});Object.defineProperty(F0,"getProperty",{enumerable:!0,get:function(){return G1.getProperty}});Object.defineProperty(F0,"stringify",{enumerable:!0,get:function(){return G1.stringify}});Object.defineProperty(F0,"regexpCode",{enumerable:!0,get:function(){return G1.regexpCode}});Object.defineProperty(F0,"Name",{enumerable:!0,get:function(){return G1.Name}});var C6=P9();Object.defineProperty(F0,"Scope",{enumerable:!0,get:function(){return C6.Scope}});Object.defineProperty(F0,"ValueScope",{enumerable:!0,get:function(){return C6.ValueScope}});Object.defineProperty(F0,"ValueScopeName",{enumerable:!0,get:function(){return C6.ValueScopeName}});Object.defineProperty(F0,"varKinds",{enumerable:!0,get:function(){return C6.varKinds}});F0.operators={GT:new g._Code(">"),GTE:new g._Code(">="),LT:new g._Code("<"),LTE:new g._Code("<="),EQ:new g._Code("==="),NEQ:new g._Code("!=="),NOT:new g._Code("!"),OR:new g._Code("||"),AND:new g._Code("&&"),ADD:new g._Code("+")};class $1{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class vG extends $1{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?R0.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=k1(this.rhs,Q,X);return this}get names(){return this.rhs instanceof g._CodeOrName?this.rhs.names:{}}}class E9 extends $1{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 g.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=k1(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof g.Name?{}:{...this.lhs.names};return R6(Q,this.rhs)}}class xG extends E9{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class _G extends $1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class yG extends $1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class gG extends $1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class uG extends $1{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=k1(this.code,Q,X),this}get names(){return this.code instanceof g._CodeOrName?this.code.names:{}}}class k6 extends $1{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;FA(Q,G.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>L1(Q,X.names),{})}}class J1 extends k6{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class hG extends k6{}class O4 extends J1{}O4.kind="else";class i0 extends J1{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 O4(Y):Y}if(X){if(Q===!1)return X instanceof i0?X:X.nodes;if(this.nodes.length)return this;return new i0(pG(Q),X instanceof i0?[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=k1(this.condition,Q,X),this}get names(){let Q=super.names;if(R6(Q,this.condition),this.else)L1(Q,this.else.names);return Q}}i0.kind="if";class C1 extends J1{}C1.kind="for";class fG extends C1{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=k1(this.iteration,Q,X),this}get names(){return L1(super.names,this.iteration.names)}}class lG extends C1{constructor(Q,X,Y,W){super();this.varKind=Q,this.name=X,this.from=Y,this.to=W}render(Q){let X=Q.es5?R0.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=R6(super.names,this.from);return R6(Q,this.to)}}class j9 extends C1{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=k1(this.iterable,Q,X),this}get names(){return L1(super.names,this.iterable.names)}}class I6 extends J1{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)}}I6.kind="func";class E6 extends k6{render(Q){return"return "+super.render(Q)}}E6.kind="return";class mG extends J1{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)L1(Q,this.catch.names);if(this.finally)L1(Q,this.finally.names);return Q}}class T6 extends J1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}T6.kind="catch";class S6 extends J1{render(Q){return"finally"+super.render(Q)}}S6.kind="finally";class cG{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
|
|
3
|
-
`:""},this._extScope=Q,this._scope=new R0.Scope({parent:Q}),this._nodes=[new hG]}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 vG(Q,G,Y)),G}const(Q,X,Y){return this._def(R0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(R0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(R0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new E9(Q,X,Y))}add(Q,X){return this._leafNode(new xG(Q,F0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==g.nil)this._leafNode(new uG(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,g.addCodeArg)(X,W)}return X.push("}"),new g._Code(X)}if(Q,X,Y){if(this._blockNode(new i0(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 i0(Q))}else(){return this._elseNode(new O4)}endIf(){return this._endBlockNode(i0,O4)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new fG(Q),X)}forRange(Q,X,Y,W,G=this.opts.es5?R0.varKinds.var:R0.varKinds.let){let $=this._scope.toName(Q);return this._for(new lG(G,$,X,Y),()=>W($))}forOf(Q,X,Y,W=R0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let $=X instanceof g.Name?X:this.var("_arr",X);return this.forRange("_i",0,g._`${$}.length`,(J)=>{this.var(G,g._`${$}[${J}]`),Y(G)})}return this._for(new j9("of",W,G,X),()=>Y(G))}forIn(Q,X,Y,W=this.opts.es5?R0.varKinds.var:R0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,g._`Object.keys(${X})`,Y);let G=this._scope.toName(Q);return this._for(new j9("in",W,G,X),()=>Y(G))}endFor(){return this._endBlockNode(C1)}label(Q){return this._leafNode(new _G(Q))}break(Q){return this._leafNode(new yG(Q))}return(Q){let X=new E6;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(E6)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new mG;if(this._blockNode(W),this.code(Q),X){let G=this.name("e");this._currNode=W.catch=new T6(G),X(G)}if(Y)this._currNode=W.finally=new S6,this.code(Y);return this._endBlockNode(T6,S6)}throw(Q){return this._leafNode(new gG(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=g.nil,Y,W){if(this._blockNode(new I6(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(I6)}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 i0))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=cG;function L1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function R6(Q,X){return X instanceof g._CodeOrName?L1(Q,X.names):Q}function k1(Q,X,Y){if(Q instanceof g.Name)return W(Q);if(!G(Q))return Q;return new g._Code(Q._items.reduce(($,J)=>{if(J instanceof g.Name)J=W(J);if(J instanceof g._Code)$.push(...J._items);else $.push(J);return $},[]));function W($){let J=Y[$.str];if(J===void 0||X[$.str]!==1)return $;return delete X[$.str],J}function G($){return $ instanceof g._Code&&$._items.some((J)=>J instanceof g.Name&&X[J.str]===1&&Y[J.str]!==void 0)}}function FA(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function pG(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:g._`!${I9(Q)}`}F0.not=pG;var OA=iG(F0.operators.AND);function MA(...Q){return Q.reduce(OA)}F0.and=MA;var VA=iG(F0.operators.OR);function ZA(...Q){return Q.reduce(VA)}F0.or=ZA;function iG(Q){return(X,Y)=>X===g.nil?Y:Y===g.nil?X:g._`${I9(X)} ${Q} ${I9(Y)}`}function I9(Q){return Q instanceof g.Name?Q:g._`(${Q})`}});var f=N((Q$)=>{Object.defineProperty(Q$,"__esModule",{value:!0});Q$.checkStrictMode=Q$.getErrorPath=Q$.Type=Q$.useFunc=Q$.setEvaluated=Q$.evaluatedPropsToName=Q$.mergeEvaluated=Q$.eachItem=Q$.unescapeJsonPointer=Q$.escapeJsonPointer=Q$.escapeFragment=Q$.unescapeFragment=Q$.schemaRefOrVal=Q$.schemaHasRulesButRef=Q$.schemaHasRules=Q$.checkUnknownRules=Q$.alwaysValidSchema=Q$.toHash=void 0;var c=v(),PA=F4();function jA(Q){let X={};for(let Y of Q)X[Y]=!0;return X}Q$.toHash=jA;function IA(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return oG(Q,X),!tG(X,Q.self.RULES.all)}Q$.alwaysValidSchema=IA;function oG(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 $ in X)if(!G[$])eG(Q,`unknown keyword: "${$}"`)}Q$.checkUnknownRules=oG;function tG(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}Q$.schemaHasRules=tG;function EA(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}Q$.schemaHasRulesButRef=EA;function TA({topSchemaRef:Q,schemaPath:X},Y,W,G){if(!G){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return c._`${Y}`}return c._`${Q}${X}${(0,c.getProperty)(W)}`}Q$.schemaRefOrVal=TA;function SA(Q){return aG(decodeURIComponent(Q))}Q$.unescapeFragment=SA;function RA(Q){return encodeURIComponent(S9(Q))}Q$.escapeFragment=RA;function S9(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}Q$.escapeJsonPointer=S9;function aG(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}Q$.unescapeJsonPointer=aG;function CA(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}Q$.eachItem=CA;function rG({mergeNames:Q,mergeToName:X,mergeValues:Y,resultToName:W}){return(G,$,J,z)=>{let H=J===void 0?$:J instanceof c.Name?($ instanceof c.Name?Q(G,$,J):X(G,$,J),J):$ instanceof c.Name?(X(G,J,$),$):Y($,J);return z===c.Name&&!(H instanceof c.Name)?W(G,H):H}}Q$.mergeEvaluated={props:rG({mergeNames:(Q,X,Y)=>Q.if(c._`${Y} !== true && ${X} !== undefined`,()=>{Q.if(c._`${X} === true`,()=>Q.assign(Y,!0),()=>Q.assign(Y,c._`${Y} || {}`).code(c._`Object.assign(${Y}, ${X})`))}),mergeToName:(Q,X,Y)=>Q.if(c._`${Y} !== true`,()=>{if(X===!0)Q.assign(Y,!0);else Q.assign(Y,c._`${Y} || {}`),R9(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:sG}),items:rG({mergeNames:(Q,X,Y)=>Q.if(c._`${Y} !== true && ${X} !== undefined`,()=>Q.assign(Y,c._`${X} === true ? true : ${Y} > ${X} ? ${Y} : ${X}`)),mergeToName:(Q,X,Y)=>Q.if(c._`${Y} !== true`,()=>Q.assign(Y,X===!0?!0:c._`${Y} > ${X} ? ${Y} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function sG(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",c._`{}`);if(X!==void 0)R9(Q,Y,X);return Y}Q$.evaluatedPropsToName=sG;function R9(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(c._`${X}${(0,c.getProperty)(W)}`,!0))}Q$.setEvaluated=R9;var dG={};function kA(Q,X){return Q.scopeValue("func",{ref:X,code:dG[X.code]||(dG[X.code]=new PA._Code(X.code))})}Q$.useFunc=kA;var T9;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(T9||(Q$.Type=T9={}));function vA(Q,X,Y){if(Q instanceof c.Name){let W=X===T9.Num;return Y?W?c._`"[" + ${Q} + "]"`:c._`"['" + ${Q} + "']"`:W?c._`"/" + ${Q}`:c._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,c.getProperty)(Q).toString():"/"+S9(Q)}Q$.getErrorPath=vA;function eG(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}Q$.checkStrictMode=eG});var n0=N((Y$)=>{Object.defineProperty(Y$,"__esModule",{value:!0});var U0=v(),aA={data:new U0.Name("data"),valCxt:new U0.Name("valCxt"),instancePath:new U0.Name("instancePath"),parentData:new U0.Name("parentData"),parentDataProperty:new U0.Name("parentDataProperty"),rootData:new U0.Name("rootData"),dynamicAnchors:new U0.Name("dynamicAnchors"),vErrors:new U0.Name("vErrors"),errors:new U0.Name("errors"),this:new U0.Name("this"),self:new U0.Name("self"),scope:new U0.Name("scope"),json:new U0.Name("json"),jsonPos:new U0.Name("jsonPos"),jsonLen:new U0.Name("jsonLen"),jsonPart:new U0.Name("jsonPart")};Y$.default=aA});var M4=N((J$)=>{Object.defineProperty(J$,"__esModule",{value:!0});J$.extendErrors=J$.resetErrorsCount=J$.reportExtraError=J$.reportError=J$.keyword$DataError=J$.keywordError=void 0;var u=v(),x6=f(),K0=n0();J$.keywordError={message:({keyword:Q})=>u.str`must pass "${Q}" keyword validation`};J$.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?u.str`"${Q}" keyword must be ${X} ($data)`:u.str`"${Q}" keyword is invalid ($data)`};function eA(Q,X=J$.keywordError,Y,W){let{it:G}=Q,{gen:$,compositeRule:J,allErrors:z}=G,H=$$(Q,X,Y);if(W!==null&&W!==void 0?W:J||z)W$($,H);else G$(G,u._`[${H}]`)}J$.reportError=eA;function QK(Q,X=J$.keywordError,Y){let{it:W}=Q,{gen:G,compositeRule:$,allErrors:J}=W,z=$$(Q,X,Y);if(W$(G,z),!($||J))G$(W,K0.default.vErrors)}J$.reportExtraError=QK;function XK(Q,X){Q.assign(K0.default.errors,X),Q.if(u._`${K0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(u._`${K0.default.vErrors}.length`,X),()=>Q.assign(K0.default.vErrors,null)))}J$.resetErrorsCount=XK;function YK({gen:Q,keyword:X,schemaValue:Y,data:W,errsCount:G,it:$}){if(G===void 0)throw Error("ajv implementation error");let J=Q.name("err");Q.forRange("i",G,K0.default.errors,(z)=>{if(Q.const(J,u._`${K0.default.vErrors}[${z}]`),Q.if(u._`${J}.instancePath === undefined`,()=>Q.assign(u._`${J}.instancePath`,(0,u.strConcat)(K0.default.instancePath,$.errorPath))),Q.assign(u._`${J}.schemaPath`,u.str`${$.errSchemaPath}/${X}`),$.opts.verbose)Q.assign(u._`${J}.schema`,Y),Q.assign(u._`${J}.data`,W)})}J$.extendErrors=YK;function W$(Q,X){let Y=Q.const("err",X);Q.if(u._`${K0.default.vErrors} === null`,()=>Q.assign(K0.default.vErrors,u._`[${Y}]`),u._`${K0.default.vErrors}.push(${Y})`),Q.code(u._`${K0.default.errors}++`)}function G$(Q,X){let{gen:Y,validateName:W,schemaEnv:G}=Q;if(G.$async)Y.throw(u._`new ${Q.ValidationError}(${X})`);else Y.assign(u._`${W}.errors`,X),Y.return(!1)}var q1={keyword:new u.Name("keyword"),schemaPath:new u.Name("schemaPath"),params:new u.Name("params"),propertyName:new u.Name("propertyName"),message:new u.Name("message"),schema:new u.Name("schema"),parentSchema:new u.Name("parentSchema")};function $$(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return u._`{}`;return WK(Q,X,Y)}function WK(Q,X,Y={}){let{gen:W,it:G}=Q,$=[GK(G,Y),$K(Q,Y)];return JK(Q,X,$),W.object(...$)}function GK({errorPath:Q},{instancePath:X}){let Y=X?u.str`${Q}${(0,x6.getErrorPath)(X,x6.Type.Str)}`:Q;return[K0.default.instancePath,(0,u.strConcat)(K0.default.instancePath,Y)]}function $K({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let G=W?X:u.str`${X}/${Q}`;if(Y)G=u.str`${G}${(0,x6.getErrorPath)(Y,x6.Type.Str)}`;return[q1.schemaPath,G]}function JK(Q,{params:X,message:Y},W){let{keyword:G,data:$,schemaValue:J,it:z}=Q,{opts:H,propertyName:U,topSchemaRef:A,schemaPath:K}=z;if(W.push([q1.keyword,G],[q1.params,typeof X=="function"?X(Q):X||u._`{}`]),H.messages)W.push([q1.message,typeof Y=="function"?Y(Q):Y]);if(H.verbose)W.push([q1.schema,J],[q1.parentSchema,u._`${A}${K}`],[K0.default.data,$]);if(U)W.push([q1.propertyName,U])}});var K$=N((U$)=>{Object.defineProperty(U$,"__esModule",{value:!0});U$.boolOrEmptySchema=U$.topBoolOrEmptySchema=void 0;var KK=M4(),BK=v(),DK=n0(),LK={message:"boolean schema is false"};function qK(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)H$(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(DK.default.data);else X.assign(BK._`${W}.errors`,null),X.return(!0)}U$.topBoolOrEmptySchema=qK;function FK(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),H$(Q);else Y.var(X,!0)}U$.boolOrEmptySchema=FK;function H$(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,KK.reportError)(G,LK,void 0,X)}});var k9=N((B$)=>{Object.defineProperty(B$,"__esModule",{value:!0});B$.getRules=B$.isJSONType=void 0;var MK=["string","number","integer","boolean","null","object","array"],VK=new Set(MK);function ZK(Q){return typeof Q=="string"&&VK.has(Q)}B$.isJSONType=ZK;function NK(){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:{}}}B$.getRules=NK});var v9=N((F$)=>{Object.defineProperty(F$,"__esModule",{value:!0});F$.shouldUseRule=F$.shouldUseGroup=F$.schemaHasRulesForType=void 0;function bK({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&L$(Q,W)}F$.schemaHasRulesForType=bK;function L$(Q,X){return X.rules.some((Y)=>q$(Q,Y))}F$.shouldUseGroup=L$;function q$(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))}F$.shouldUseRule=q$});var V4=N((N$)=>{Object.defineProperty(N$,"__esModule",{value:!0});N$.reportTypeError=N$.checkDataTypes=N$.checkDataType=N$.coerceAndCheckDataType=N$.getJSONTypes=N$.getSchemaTypes=N$.DataType=void 0;var IK=k9(),EK=v9(),TK=M4(),C=v(),M$=f(),v1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(v1||(N$.DataType=v1={}));function SK(Q){let X=V$(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}N$.getSchemaTypes=SK;function V$(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(IK.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}N$.getJSONTypes=V$;function RK(Q,X){let{gen:Y,data:W,opts:G}=Q,$=CK(X,G.coerceTypes),J=X.length>0&&!($.length===0&&X.length===1&&(0,EK.schemaHasRulesForType)(Q,X[0]));if(J){let z=_9(X,W,G.strictNumbers,v1.Wrong);Y.if(z,()=>{if($.length)kK(Q,X,$);else y9(Q)})}return J}N$.coerceAndCheckDataType=RK;var Z$=new Set(["string","number","integer","boolean","null"]);function CK(Q,X){return X?Q.filter((Y)=>Z$.has(Y)||X==="array"&&Y==="array"):[]}function kK(Q,X,Y){let{gen:W,data:G,opts:$}=Q,J=W.let("dataType",C._`typeof ${G}`),z=W.let("coerced",C._`undefined`);if($.coerceTypes==="array")W.if(C._`${J} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,C._`${G}[0]`).assign(J,C._`typeof ${G}`).if(_9(X,G,$.strictNumbers),()=>W.assign(z,G)));W.if(C._`${z} !== undefined`);for(let U of Y)if(Z$.has(U)||U==="array"&&$.coerceTypes==="array")H(U);W.else(),y9(Q),W.endIf(),W.if(C._`${z} !== undefined`,()=>{W.assign(G,z),vK(Q,z)});function H(U){switch(U){case"string":W.elseIf(C._`${J} == "number" || ${J} == "boolean"`).assign(z,C._`"" + ${G}`).elseIf(C._`${G} === null`).assign(z,C._`""`);return;case"number":W.elseIf(C._`${J} == "boolean" || ${G} === null
|
|
2
|
+
var j5=Object.create;var{getPrototypeOf:E5,defineProperty:B6,getOwnPropertyNames:T5}=Object;var S5=Object.prototype.hasOwnProperty;function R5(Q){return this[Q]}var C5,k5,_9=(Q,Y,X)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=Y?C5??=new WeakMap:k5??=new WeakMap,$=G.get(Q);if($)return $}X=Q!=null?j5(E5(Q)):{};let J=Y||!Q||!Q.__esModule?B6(X,"default",{value:Q,enumerable:!0}):X;for(let z of T5(Q))if(!S5.call(J,z))B6(J,z,{get:R5.bind(Q,z),enumerable:!0});if(W)G.set(Q,J);return J};var Z=(Q,Y)=>()=>(Y||Q((Y={exports:{}}).exports,Y),Y.exports);var v5=(Q)=>Q;function x5(Q,Y){this[Q]=v5.bind(null,Y)}var y9=(Q,Y)=>{for(var X in Y)B6(Q,X,{get:Y[X],enumerable:!0,configurable:!0,set:x5.bind(Y,X)})};var O4=Z((CG)=>{Object.defineProperty(CG,"__esModule",{value:!0});CG.regexpCode=CG.getEsmExportName=CG.getProperty=CG.safeStringify=CG.stringify=CG.strConcat=CG.addCodeArg=CG.str=CG._=CG.nil=CG._Code=CG.Name=CG.IDENTIFIER=CG._CodeOrName=void 0;class PQ{}CG._CodeOrName=PQ;CG.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class k1 extends PQ{constructor(Q){super();if(!CG.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}}}CG.Name=k1;class S0 extends PQ{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((Y,X)=>`${Y}${X}`,"")}get names(){var Q;return(Q=this._names)!==null&&Q!==void 0?Q:this._names=this._items.reduce((Y,X)=>{if(X instanceof k1)Y[X.str]=(Y[X.str]||0)+1;return Y},{})}}CG._Code=S0;CG.nil=new S0("");function SG(Q,...Y){let X=[Q[0]],W=0;while(W<Y.length)wY(X,Y[W]),X.push(Q[++W]);return new S0(X)}CG._=SG;var ZY=new S0("+");function RG(Q,...Y){let X=[q4(Q[0])],W=0;while(W<Y.length)X.push(ZY),wY(X,Y[W]),X.push(ZY,q4(Q[++W]));return W3(X),new S0(X)}CG.str=RG;function wY(Q,Y){if(Y instanceof S0)Q.push(...Y._items);else if(Y instanceof k1)Q.push(Y);else Q.push(J3(Y))}CG.addCodeArg=wY;function W3(Q){let Y=1;while(Y<Q.length-1){if(Q[Y]===ZY){let X=G3(Q[Y-1],Q[Y+1]);if(X!==void 0){Q.splice(Y-1,3,X);continue}Q[Y++]="+"}Y++}}function G3(Q,Y){if(Y==='""')return Q;if(Q==='""')return Y;if(typeof Q=="string"){if(Y instanceof k1||Q[Q.length-1]!=='"')return;if(typeof Y!="string")return`${Q.slice(0,-1)}${Y}"`;if(Y[0]==='"')return Q.slice(0,-1)+Y.slice(1);return}if(typeof Y=="string"&&Y[0]==='"'&&!(Q instanceof k1))return`"${Q}${Y.slice(1)}`;return}function $3(Q,Y){return Y.emptyStr()?Q:Q.emptyStr()?Y:RG`${Q}${Y}`}CG.strConcat=$3;function J3(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:q4(Array.isArray(Q)?Q.join(","):Q)}function z3(Q){return new S0(q4(Q))}CG.stringify=z3;function q4(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}CG.safeStringify=q4;function H3(Q){return typeof Q=="string"&&CG.IDENTIFIER.test(Q)?new S0(`.${Q}`):SG`[${Q}]`}CG.getProperty=H3;function A3(Q){if(typeof Q=="string"&&CG.IDENTIFIER.test(Q))return new S0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}CG.getEsmExportName=A3;function U3(Q){return new S0(Q.toString())}CG.regexpCode=U3});var jY=Z((_G)=>{Object.defineProperty(_G,"__esModule",{value:!0});_G.ValueScope=_G.ValueScopeName=_G.Scope=_G.varKinds=_G.UsedValueState=void 0;var F0=O4();class vG extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var jQ;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(jQ||(_G.UsedValueState=jQ={}));_G.varKinds={const:new F0.Name("const"),let:new F0.Name("let"),var:new F0.Name("var")};class PY{constructor({prefixes:Q,parent:Y}={}){this._names={},this._prefixes=Q,this._parent=Y}toName(Q){return Q instanceof F0.Name?Q:this.name(Q)}name(Q){return new F0.Name(this._newName(Q))}_newName(Q){let Y=this._names[Q]||this._nameGroup(Q);return`${Q}${Y.index++}`}_nameGroup(Q){var Y,X;if(((X=(Y=this._parent)===null||Y===void 0?void 0:Y._prefixes)===null||X===void 0?void 0:X.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}}}_G.Scope=PY;class IY extends F0.Name{constructor(Q,Y){super(Y);this.prefix=Q}setValue(Q,{property:Y,itemIndex:X}){this.value=Q,this.scopePath=F0._`.${new F0.Name(Y)}[${X}]`}}_G.ValueScopeName=IY;var b3=F0._`\n`;class xG extends PY{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?b3:F0.nil}}get(){return this._scope}name(Q){return new IY(Q,this._newName(Q))}value(Q,Y){var X;if(Y.ref===void 0)throw Error("CodeGen: ref must be passed in value");let W=this.toName(Q),{prefix:G}=W,$=(X=Y.key)!==null&&X!==void 0?X:Y.ref,J=this._values[G];if(J){let A=J.get($);if(A)return A}else J=this._values[G]=new Map;J.set($,W);let z=this._scope[G]||(this._scope[G]=[]),H=z.length;return z[H]=Y.ref,W.setValue(Y,{property:G,itemIndex:H}),W}getValue(Q,Y){let X=this._values[Q];if(!X)return;return X.get(Y)}scopeRefs(Q,Y=this._values){return this._reduceValues(Y,(X)=>{if(X.scopePath===void 0)throw Error(`CodeGen: name "${X}" has no value`);return F0._`${Q}${X.scopePath}`})}scopeCode(Q=this._values,Y,X){return this._reduceValues(Q,(W)=>{if(W.value===void 0)throw Error(`CodeGen: name "${W}" has no value`);return W.value.code},Y,X)}_reduceValues(Q,Y,X={},W){let G=F0.nil;for(let $ in Q){let J=Q[$];if(!J)continue;let z=X[$]=X[$]||new Map;J.forEach((H)=>{if(z.has(H))return;z.set(H,jQ.Started);let A=Y(H);if(A){let U=this.opts.es5?_G.varKinds.var:_G.varKinds.const;G=F0._`${G}${U} ${H} = ${A};${this.opts._n}`}else if(A=W===null||W===void 0?void 0:W(H))G=F0._`${G}${A}${this.opts._n}`;else throw new vG(H);z.set(H,jQ.Completed)})}return G}}_G.ValueScope=xG});var v=Z((q0)=>{Object.defineProperty(q0,"__esModule",{value:!0});q0.or=q0.and=q0.not=q0.CodeGen=q0.operators=q0.varKinds=q0.ValueScopeName=q0.ValueScope=q0.Scope=q0.Name=q0.regexpCode=q0.stringify=q0.getProperty=q0.nil=q0.strConcat=q0.str=q0._=void 0;var g=O4(),R0=jY(),J1=O4();Object.defineProperty(q0,"_",{enumerable:!0,get:function(){return J1._}});Object.defineProperty(q0,"str",{enumerable:!0,get:function(){return J1.str}});Object.defineProperty(q0,"strConcat",{enumerable:!0,get:function(){return J1.strConcat}});Object.defineProperty(q0,"nil",{enumerable:!0,get:function(){return J1.nil}});Object.defineProperty(q0,"getProperty",{enumerable:!0,get:function(){return J1.getProperty}});Object.defineProperty(q0,"stringify",{enumerable:!0,get:function(){return J1.stringify}});Object.defineProperty(q0,"regexpCode",{enumerable:!0,get:function(){return J1.regexpCode}});Object.defineProperty(q0,"Name",{enumerable:!0,get:function(){return J1.Name}});var kQ=jY();Object.defineProperty(q0,"Scope",{enumerable:!0,get:function(){return kQ.Scope}});Object.defineProperty(q0,"ValueScope",{enumerable:!0,get:function(){return kQ.ValueScope}});Object.defineProperty(q0,"ValueScopeName",{enumerable:!0,get:function(){return kQ.ValueScopeName}});Object.defineProperty(q0,"varKinds",{enumerable:!0,get:function(){return kQ.varKinds}});q0.operators={GT:new g._Code(">"),GTE:new g._Code(">="),LT:new g._Code("<"),LTE:new g._Code("<="),EQ:new g._Code("==="),NEQ:new g._Code("!=="),NOT:new g._Code("!"),OR:new g._Code("||"),AND:new g._Code("&&"),ADD:new g._Code("+")};class z1{optimizeNodes(){return this}optimizeNames(Q,Y){return this}}class gG extends z1{constructor(Q,Y,X){super();this.varKind=Q,this.name=Y,this.rhs=X}render({es5:Q,_n:Y}){let X=Q?R0.varKinds.var:this.varKind,W=this.rhs===void 0?"":` = ${this.rhs}`;return`${X} ${this.name}${W};`+Y}optimizeNames(Q,Y){if(!Q[this.name.str])return;if(this.rhs)this.rhs=x1(this.rhs,Q,Y);return this}get names(){return this.rhs instanceof g._CodeOrName?this.rhs.names:{}}}class SY extends z1{constructor(Q,Y,X){super();this.lhs=Q,this.rhs=Y,this.sideEffects=X}render({_n:Q}){return`${this.lhs} = ${this.rhs};`+Q}optimizeNames(Q,Y){if(this.lhs instanceof g.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=x1(this.rhs,Q,Y),this}get names(){let Q=this.lhs instanceof g.Name?{}:{...this.lhs.names};return CQ(Q,this.rhs)}}class uG extends SY{constructor(Q,Y,X,W){super(Q,X,W);this.op=Y}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class hG extends z1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class fG extends z1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class lG extends z1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class mG extends z1{constructor(Q){super();this.code=Q}render({_n:Q}){return`${this.code};`+Q}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(Q,Y){return this.code=x1(this.code,Q,Y),this}get names(){return this.code instanceof g._CodeOrName?this.code.names:{}}}class vQ extends z1{constructor(Q=[]){super();this.nodes=Q}render(Q){return this.nodes.reduce((Y,X)=>Y+X.render(Q),"")}optimizeNodes(){let{nodes:Q}=this,Y=Q.length;while(Y--){let X=Q[Y].optimizeNodes();if(Array.isArray(X))Q.splice(Y,1,...X);else if(X)Q[Y]=X;else Q.splice(Y,1)}return Q.length>0?this:void 0}optimizeNames(Q,Y){let{nodes:X}=this,W=X.length;while(W--){let G=X[W];if(G.optimizeNames(Q,Y))continue;E3(Q,G.names),X.splice(W,1)}return X.length>0?this:void 0}get names(){return this.nodes.reduce((Q,Y)=>O1(Q,Y.names),{})}}class H1 extends vQ{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class cG extends vQ{}class M4 extends H1{}M4.kind="else";class i0 extends H1{constructor(Q,Y){super(Y);this.condition=Q}render(Q){let Y=`if(${this.condition})`+super.render(Q);if(this.else)Y+="else "+this.else.render(Q);return Y}optimizeNodes(){super.optimizeNodes();let Q=this.condition;if(Q===!0)return this.nodes;let Y=this.else;if(Y){let X=Y.optimizeNodes();Y=this.else=Array.isArray(X)?new M4(X):X}if(Y){if(Q===!1)return Y instanceof i0?Y:Y.nodes;if(this.nodes.length)return this;return new i0(dG(Q),Y instanceof i0?[Y]:Y.nodes)}if(Q===!1||!this.nodes.length)return;return this}optimizeNames(Q,Y){var X;if(this.else=(X=this.else)===null||X===void 0?void 0:X.optimizeNames(Q,Y),!(super.optimizeNames(Q,Y)||this.else))return;return this.condition=x1(this.condition,Q,Y),this}get names(){let Q=super.names;if(CQ(Q,this.condition),this.else)O1(Q,this.else.names);return Q}}i0.kind="if";class v1 extends H1{}v1.kind="for";class pG extends v1{constructor(Q){super();this.iteration=Q}render(Q){return`for(${this.iteration})`+super.render(Q)}optimizeNames(Q,Y){if(!super.optimizeNames(Q,Y))return;return this.iteration=x1(this.iteration,Q,Y),this}get names(){return O1(super.names,this.iteration.names)}}class iG extends v1{constructor(Q,Y,X,W){super();this.varKind=Q,this.name=Y,this.from=X,this.to=W}render(Q){let Y=Q.es5?R0.varKinds.var:this.varKind,{name:X,from:W,to:G}=this;return`for(${Y} ${X}=${W}; ${X}<${G}; ${X}++)`+super.render(Q)}get names(){let Q=CQ(super.names,this.from);return CQ(Q,this.to)}}class EY extends v1{constructor(Q,Y,X,W){super();this.loop=Q,this.varKind=Y,this.name=X,this.iterable=W}render(Q){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(Q)}optimizeNames(Q,Y){if(!super.optimizeNames(Q,Y))return;return this.iterable=x1(this.iterable,Q,Y),this}get names(){return O1(super.names,this.iterable.names)}}class EQ extends H1{constructor(Q,Y,X){super();this.name=Q,this.args=Y,this.async=X}render(Q){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(Q)}}EQ.kind="func";class TQ extends vQ{render(Q){return"return "+super.render(Q)}}TQ.kind="return";class rG extends H1{render(Q){let Y="try"+super.render(Q);if(this.catch)Y+=this.catch.render(Q);if(this.finally)Y+=this.finally.render(Q);return Y}optimizeNodes(){var Q,Y;return super.optimizeNodes(),(Q=this.catch)===null||Q===void 0||Q.optimizeNodes(),(Y=this.finally)===null||Y===void 0||Y.optimizeNodes(),this}optimizeNames(Q,Y){var X,W;return super.optimizeNames(Q,Y),(X=this.catch)===null||X===void 0||X.optimizeNames(Q,Y),(W=this.finally)===null||W===void 0||W.optimizeNames(Q,Y),this}get names(){let Q=super.names;if(this.catch)O1(Q,this.catch.names);if(this.finally)O1(Q,this.finally.names);return Q}}class SQ extends H1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}SQ.kind="catch";class RQ extends H1{render(Q){return"finally"+super.render(Q)}}RQ.kind="finally";class nG{constructor(Q,Y={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...Y,_n:Y.lines?`
|
|
3
|
+
`:""},this._extScope=Q,this._scope=new R0.Scope({parent:Q}),this._nodes=[new cG]}toString(){return this._root.render(this.opts)}name(Q){return this._scope.name(Q)}scopeName(Q){return this._extScope.name(Q)}scopeValue(Q,Y){let X=this._extScope.value(Q,Y);return(this._values[X.prefix]||(this._values[X.prefix]=new Set)).add(X),X}getScopeValue(Q,Y){return this._extScope.getValue(Q,Y)}scopeRefs(Q){return this._extScope.scopeRefs(Q,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(Q,Y,X,W){let G=this._scope.toName(Y);if(X!==void 0&&W)this._constants[G.str]=X;return this._leafNode(new gG(Q,G,X)),G}const(Q,Y,X){return this._def(R0.varKinds.const,Q,Y,X)}let(Q,Y,X){return this._def(R0.varKinds.let,Q,Y,X)}var(Q,Y,X){return this._def(R0.varKinds.var,Q,Y,X)}assign(Q,Y,X){return this._leafNode(new SY(Q,Y,X))}add(Q,Y){return this._leafNode(new uG(Q,q0.operators.ADD,Y))}code(Q){if(typeof Q=="function")Q();else if(Q!==g.nil)this._leafNode(new mG(Q));return this}object(...Q){let Y=["{"];for(let[X,W]of Q){if(Y.length>1)Y.push(",");if(Y.push(X),X!==W||this.opts.es5)Y.push(":"),(0,g.addCodeArg)(Y,W)}return Y.push("}"),new g._Code(Y)}if(Q,Y,X){if(this._blockNode(new i0(Q)),Y&&X)this.code(Y).else().code(X).endIf();else if(Y)this.code(Y).endIf();else if(X)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(Q){return this._elseNode(new i0(Q))}else(){return this._elseNode(new M4)}endIf(){return this._endBlockNode(i0,M4)}_for(Q,Y){if(this._blockNode(Q),Y)this.code(Y).endFor();return this}for(Q,Y){return this._for(new pG(Q),Y)}forRange(Q,Y,X,W,G=this.opts.es5?R0.varKinds.var:R0.varKinds.let){let $=this._scope.toName(Q);return this._for(new iG(G,$,Y,X),()=>W($))}forOf(Q,Y,X,W=R0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let $=Y instanceof g.Name?Y:this.var("_arr",Y);return this.forRange("_i",0,g._`${$}.length`,(J)=>{this.var(G,g._`${$}[${J}]`),X(G)})}return this._for(new EY("of",W,G,Y),()=>X(G))}forIn(Q,Y,X,W=this.opts.es5?R0.varKinds.var:R0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,g._`Object.keys(${Y})`,X);let G=this._scope.toName(Q);return this._for(new EY("in",W,G,Y),()=>X(G))}endFor(){return this._endBlockNode(v1)}label(Q){return this._leafNode(new hG(Q))}break(Q){return this._leafNode(new fG(Q))}return(Q){let Y=new TQ;if(this._blockNode(Y),this.code(Q),Y.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(TQ)}try(Q,Y,X){if(!Y&&!X)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new rG;if(this._blockNode(W),this.code(Q),Y){let G=this.name("e");this._currNode=W.catch=new SQ(G),Y(G)}if(X)this._currNode=W.finally=new RQ,this.code(X);return this._endBlockNode(SQ,RQ)}throw(Q){return this._leafNode(new lG(Q))}block(Q,Y){if(this._blockStarts.push(this._nodes.length),Q)this.code(Q).endBlock(Y);return this}endBlock(Q){let Y=this._blockStarts.pop();if(Y===void 0)throw Error("CodeGen: not in self-balancing block");let X=this._nodes.length-Y;if(X<0||Q!==void 0&&X!==Q)throw Error(`CodeGen: wrong number of nodes: ${X} vs ${Q} expected`);return this._nodes.length=Y,this}func(Q,Y=g.nil,X,W){if(this._blockNode(new EQ(Q,Y,X)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(EQ)}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,Y){let X=this._currNode;if(X instanceof Q||Y&&X instanceof Y)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${Y?`${Q.kind}/${Y.kind}`:Q.kind}"`)}_elseNode(Q){let Y=this._currNode;if(!(Y instanceof i0))throw Error('CodeGen: "else" without "if"');return this._currNode=Y.else=Q,this}get _root(){return this._nodes[0]}get _currNode(){let Q=this._nodes;return Q[Q.length-1]}set _currNode(Q){let Y=this._nodes;Y[Y.length-1]=Q}}q0.CodeGen=nG;function O1(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)+(Y[X]||0);return Q}function CQ(Q,Y){return Y instanceof g._CodeOrName?O1(Q,Y.names):Q}function x1(Q,Y,X){if(Q instanceof g.Name)return W(Q);if(!G(Q))return Q;return new g._Code(Q._items.reduce(($,J)=>{if(J instanceof g.Name)J=W(J);if(J instanceof g._Code)$.push(...J._items);else $.push(J);return $},[]));function W($){let J=X[$.str];if(J===void 0||Y[$.str]!==1)return $;return delete Y[$.str],J}function G($){return $ instanceof g._Code&&$._items.some((J)=>J instanceof g.Name&&Y[J.str]===1&&X[J.str]!==void 0)}}function E3(Q,Y){for(let X in Y)Q[X]=(Q[X]||0)-(Y[X]||0)}function dG(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:g._`!${TY(Q)}`}q0.not=dG;var T3=oG(q0.operators.AND);function S3(...Q){return Q.reduce(T3)}q0.and=S3;var R3=oG(q0.operators.OR);function C3(...Q){return Q.reduce(R3)}q0.or=C3;function oG(Q){return(Y,X)=>Y===g.nil?X:X===g.nil?Y:g._`${TY(Y)} ${Q} ${TY(X)}`}function TY(Q){return Q instanceof g.Name?Q:g._`(${Q})`}});var f=Z((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 c=v(),_3=O4();function y3(Q){let Y={};for(let X of Q)Y[X]=!0;return Y}G$.toHash=y3;function g3(Q,Y){if(typeof Y=="boolean")return Y;if(Object.keys(Y).length===0)return!0;return eG(Q,Y),!Q$(Y,Q.self.RULES.all)}G$.alwaysValidSchema=g3;function eG(Q,Y=Q.schema){let{opts:X,self:W}=Q;if(!X.strictSchema)return;if(typeof Y==="boolean")return;let G=W.RULES.keywords;for(let $ in Y)if(!G[$])W$(Q,`unknown keyword: "${$}"`)}G$.checkUnknownRules=eG;function Q$(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(Y[X])return!0;return!1}G$.schemaHasRules=Q$;function u3(Q,Y){if(typeof Q=="boolean")return!Q;for(let X in Q)if(X!=="$ref"&&Y.all[X])return!0;return!1}G$.schemaHasRulesButRef=u3;function h3({topSchemaRef:Q,schemaPath:Y},X,W,G){if(!G){if(typeof X=="number"||typeof X=="boolean")return X;if(typeof X=="string")return c._`${X}`}return c._`${Q}${Y}${(0,c.getProperty)(W)}`}G$.schemaRefOrVal=h3;function f3(Q){return Y$(decodeURIComponent(Q))}G$.unescapeFragment=f3;function l3(Q){return encodeURIComponent(CY(Q))}G$.escapeFragment=l3;function CY(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}G$.escapeJsonPointer=CY;function Y$(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}G$.unescapeJsonPointer=Y$;function m3(Q,Y){if(Array.isArray(Q))for(let X of Q)Y(X);else Y(Q)}G$.eachItem=m3;function aG({mergeNames:Q,mergeToName:Y,mergeValues:X,resultToName:W}){return(G,$,J,z)=>{let H=J===void 0?$:J instanceof c.Name?($ instanceof c.Name?Q(G,$,J):Y(G,$,J),J):$ instanceof c.Name?(Y(G,J,$),$):X($,J);return z===c.Name&&!(H instanceof c.Name)?W(G,H):H}}G$.mergeEvaluated={props:aG({mergeNames:(Q,Y,X)=>Q.if(c._`${X} !== true && ${Y} !== undefined`,()=>{Q.if(c._`${Y} === true`,()=>Q.assign(X,!0),()=>Q.assign(X,c._`${X} || {}`).code(c._`Object.assign(${X}, ${Y})`))}),mergeToName:(Q,Y,X)=>Q.if(c._`${X} !== true`,()=>{if(Y===!0)Q.assign(X,!0);else Q.assign(X,c._`${X} || {}`),kY(Q,X,Y)}),mergeValues:(Q,Y)=>Q===!0?!0:{...Q,...Y},resultToName:X$}),items:aG({mergeNames:(Q,Y,X)=>Q.if(c._`${X} !== true && ${Y} !== undefined`,()=>Q.assign(X,c._`${Y} === true ? true : ${X} > ${Y} ? ${X} : ${Y}`)),mergeToName:(Q,Y,X)=>Q.if(c._`${X} !== true`,()=>Q.assign(X,Y===!0?!0:c._`${X} > ${Y} ? ${X} : ${Y}`)),mergeValues:(Q,Y)=>Q===!0?!0:Math.max(Q,Y),resultToName:(Q,Y)=>Q.var("items",Y)})};function X$(Q,Y){if(Y===!0)return Q.var("props",!0);let X=Q.var("props",c._`{}`);if(Y!==void 0)kY(Q,X,Y);return X}G$.evaluatedPropsToName=X$;function kY(Q,Y,X){Object.keys(X).forEach((W)=>Q.assign(c._`${Y}${(0,c.getProperty)(W)}`,!0))}G$.setEvaluated=kY;var sG={};function c3(Q,Y){return Q.scopeValue("func",{ref:Y,code:sG[Y.code]||(sG[Y.code]=new _3._Code(Y.code))})}G$.useFunc=c3;var RY;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(RY||(G$.Type=RY={}));function p3(Q,Y,X){if(Q instanceof c.Name){let W=Y===RY.Num;return X?W?c._`"[" + ${Q} + "]"`:c._`"['" + ${Q} + "']"`:W?c._`"/" + ${Q}`:c._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return X?(0,c.getProperty)(Q).toString():"/"+CY(Q)}G$.getErrorPath=p3;function W$(Q,Y,X=Q.opts.strictSchema){if(!X)return;if(Y=`strict mode: ${Y}`,X===!0)throw Error(Y);Q.self.logger.warn(Y)}G$.checkStrictMode=W$});var r0=Z((J$)=>{Object.defineProperty(J$,"__esModule",{value:!0});var A0=v(),HK={data:new A0.Name("data"),valCxt:new A0.Name("valCxt"),instancePath:new A0.Name("instancePath"),parentData:new A0.Name("parentData"),parentDataProperty:new A0.Name("parentDataProperty"),rootData:new A0.Name("rootData"),dynamicAnchors:new A0.Name("dynamicAnchors"),vErrors:new A0.Name("vErrors"),errors:new A0.Name("errors"),this:new A0.Name("this"),self:new A0.Name("self"),scope:new A0.Name("scope"),json:new A0.Name("json"),jsonPos:new A0.Name("jsonPos"),jsonLen:new A0.Name("jsonLen"),jsonPart:new A0.Name("jsonPart")};J$.default=HK});var V4=Z((U$)=>{Object.defineProperty(U$,"__esModule",{value:!0});U$.extendErrors=U$.resetErrorsCount=U$.reportExtraError=U$.reportError=U$.keyword$DataError=U$.keywordError=void 0;var u=v(),_Q=f(),K0=r0();U$.keywordError={message:({keyword:Q})=>u.str`must pass "${Q}" keyword validation`};U$.keyword$DataError={message:({keyword:Q,schemaType:Y})=>Y?u.str`"${Q}" keyword must be ${Y} ($data)`:u.str`"${Q}" keyword is invalid ($data)`};function UK(Q,Y=U$.keywordError,X,W){let{it:G}=Q,{gen:$,compositeRule:J,allErrors:z}=G,H=A$(Q,Y,X);if(W!==null&&W!==void 0?W:J||z)z$($,H);else H$(G,u._`[${H}]`)}U$.reportError=UK;function KK(Q,Y=U$.keywordError,X){let{it:W}=Q,{gen:G,compositeRule:$,allErrors:J}=W,z=A$(Q,Y,X);if(z$(G,z),!($||J))H$(W,K0.default.vErrors)}U$.reportExtraError=KK;function DK(Q,Y){Q.assign(K0.default.errors,Y),Q.if(u._`${K0.default.vErrors} !== null`,()=>Q.if(Y,()=>Q.assign(u._`${K0.default.vErrors}.length`,Y),()=>Q.assign(K0.default.vErrors,null)))}U$.resetErrorsCount=DK;function BK({gen:Q,keyword:Y,schemaValue:X,data:W,errsCount:G,it:$}){if(G===void 0)throw Error("ajv implementation error");let J=Q.name("err");Q.forRange("i",G,K0.default.errors,(z)=>{if(Q.const(J,u._`${K0.default.vErrors}[${z}]`),Q.if(u._`${J}.instancePath === undefined`,()=>Q.assign(u._`${J}.instancePath`,(0,u.strConcat)(K0.default.instancePath,$.errorPath))),Q.assign(u._`${J}.schemaPath`,u.str`${$.errSchemaPath}/${Y}`),$.opts.verbose)Q.assign(u._`${J}.schema`,X),Q.assign(u._`${J}.data`,W)})}U$.extendErrors=BK;function z$(Q,Y){let X=Q.const("err",Y);Q.if(u._`${K0.default.vErrors} === null`,()=>Q.assign(K0.default.vErrors,u._`[${X}]`),u._`${K0.default.vErrors}.push(${X})`),Q.code(u._`${K0.default.errors}++`)}function H$(Q,Y){let{gen:X,validateName:W,schemaEnv:G}=Q;if(G.$async)X.throw(u._`new ${Q.ValidationError}(${Y})`);else X.assign(u._`${W}.errors`,Y),X.return(!1)}var M1={keyword:new u.Name("keyword"),schemaPath:new u.Name("schemaPath"),params:new u.Name("params"),propertyName:new u.Name("propertyName"),message:new u.Name("message"),schema:new u.Name("schema"),parentSchema:new u.Name("parentSchema")};function A$(Q,Y,X){let{createErrors:W}=Q.it;if(W===!1)return u._`{}`;return LK(Q,Y,X)}function LK(Q,Y,X={}){let{gen:W,it:G}=Q,$=[FK(G,X),qK(Q,X)];return OK(Q,Y,$),W.object(...$)}function FK({errorPath:Q},{instancePath:Y}){let X=Y?u.str`${Q}${(0,_Q.getErrorPath)(Y,_Q.Type.Str)}`:Q;return[K0.default.instancePath,(0,u.strConcat)(K0.default.instancePath,X)]}function qK({keyword:Q,it:{errSchemaPath:Y}},{schemaPath:X,parentSchema:W}){let G=W?Y:u.str`${Y}/${Q}`;if(X)G=u.str`${G}${(0,_Q.getErrorPath)(X,_Q.Type.Str)}`;return[M1.schemaPath,G]}function OK(Q,{params:Y,message:X},W){let{keyword:G,data:$,schemaValue:J,it:z}=Q,{opts:H,propertyName:A,topSchemaRef:U,schemaPath:K}=z;if(W.push([M1.keyword,G],[M1.params,typeof Y=="function"?Y(Q):Y||u._`{}`]),H.messages)W.push([M1.message,typeof X=="function"?X(Q):X]);if(H.verbose)W.push([M1.schema,J],[M1.parentSchema,u._`${U}${K}`],[K0.default.data,$]);if(A)W.push([M1.propertyName,A])}});var F$=Z((B$)=>{Object.defineProperty(B$,"__esModule",{value:!0});B$.boolOrEmptySchema=B$.topBoolOrEmptySchema=void 0;var wK=V4(),bK=v(),PK=r0(),IK={message:"boolean schema is false"};function jK(Q){let{gen:Y,schema:X,validateName:W}=Q;if(X===!1)D$(Q,!1);else if(typeof X=="object"&&X.$async===!0)Y.return(PK.default.data);else Y.assign(bK._`${W}.errors`,null),Y.return(!0)}B$.topBoolOrEmptySchema=jK;function EK(Q,Y){let{gen:X,schema:W}=Q;if(W===!1)X.var(Y,!1),D$(Q);else X.var(Y,!0)}B$.boolOrEmptySchema=EK;function D$(Q,Y){let{gen:X,data:W}=Q,G={gen:X,keyword:"false schema",data:W,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:Q};(0,wK.reportError)(G,IK,void 0,Y)}});var xY=Z((q$)=>{Object.defineProperty(q$,"__esModule",{value:!0});q$.getRules=q$.isJSONType=void 0;var SK=["string","number","integer","boolean","null","object","array"],RK=new Set(SK);function CK(Q){return typeof Q=="string"&&RK.has(Q)}q$.isJSONType=CK;function kK(){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:{}}}q$.getRules=kK});var _Y=Z((N$)=>{Object.defineProperty(N$,"__esModule",{value:!0});N$.shouldUseRule=N$.shouldUseGroup=N$.schemaHasRulesForType=void 0;function xK({schema:Q,self:Y},X){let W=Y.RULES.types[X];return W&&W!==!0&&M$(Q,W)}N$.schemaHasRulesForType=xK;function M$(Q,Y){return Y.rules.some((X)=>V$(Q,X))}N$.shouldUseGroup=M$;function V$(Q,Y){var X;return Q[Y.keyword]!==void 0||((X=Y.definition.implements)===null||X===void 0?void 0:X.some((W)=>Q[W]!==void 0))}N$.shouldUseRule=V$});var N4=Z((I$)=>{Object.defineProperty(I$,"__esModule",{value:!0});I$.reportTypeError=I$.checkDataTypes=I$.checkDataType=I$.coerceAndCheckDataType=I$.getJSONTypes=I$.getSchemaTypes=I$.DataType=void 0;var gK=xY(),uK=_Y(),hK=V4(),C=v(),w$=f(),_1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(_1||(I$.DataType=_1={}));function fK(Q){let Y=b$(Q.type);if(Y.includes("null")){if(Q.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!Y.length&&Q.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(Q.nullable===!0)Y.push("null")}return Y}I$.getSchemaTypes=fK;function b$(Q){let Y=Array.isArray(Q)?Q:Q?[Q]:[];if(Y.every(gK.isJSONType))return Y;throw Error("type must be JSONType or JSONType[]: "+Y.join(","))}I$.getJSONTypes=b$;function lK(Q,Y){let{gen:X,data:W,opts:G}=Q,$=mK(Y,G.coerceTypes),J=Y.length>0&&!($.length===0&&Y.length===1&&(0,uK.schemaHasRulesForType)(Q,Y[0]));if(J){let z=gY(Y,W,G.strictNumbers,_1.Wrong);X.if(z,()=>{if($.length)cK(Q,Y,$);else uY(Q)})}return J}I$.coerceAndCheckDataType=lK;var P$=new Set(["string","number","integer","boolean","null"]);function mK(Q,Y){return Y?Q.filter((X)=>P$.has(X)||Y==="array"&&X==="array"):[]}function cK(Q,Y,X){let{gen:W,data:G,opts:$}=Q,J=W.let("dataType",C._`typeof ${G}`),z=W.let("coerced",C._`undefined`);if($.coerceTypes==="array")W.if(C._`${J} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,C._`${G}[0]`).assign(J,C._`typeof ${G}`).if(gY(Y,G,$.strictNumbers),()=>W.assign(z,G)));W.if(C._`${z} !== undefined`);for(let A of X)if(P$.has(A)||A==="array"&&$.coerceTypes==="array")H(A);W.else(),uY(Q),W.endIf(),W.if(C._`${z} !== undefined`,()=>{W.assign(G,z),pK(Q,z)});function H(A){switch(A){case"string":W.elseIf(C._`${J} == "number" || ${J} == "boolean"`).assign(z,C._`"" + ${G}`).elseIf(C._`${G} === null`).assign(z,C._`""`);return;case"number":W.elseIf(C._`${J} == "boolean" || ${G} === null
|
|
4
4
|
|| (${J} == "string" && ${G} && ${G} == +${G})`).assign(z,C._`+${G}`);return;case"integer":W.elseIf(C._`${J} === "boolean" || ${G} === null
|
|
5
5
|
|| (${J} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign(z,C._`+${G}`);return;case"boolean":W.elseIf(C._`${G} === "false" || ${G} === 0 || ${G} === null`).assign(z,!1).elseIf(C._`${G} === "true" || ${G} === 1`).assign(z,!0);return;case"null":W.elseIf(C._`${G} === "" || ${G} === 0 || ${G} === false`),W.assign(z,null);return;case"array":W.elseIf(C._`${J} === "string" || ${J} === "number"
|
|
6
|
-
|| ${J} === "boolean" || ${G} === null`).assign(z,C._`[${G}]`)}}}function vK({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(C._`${X} !== undefined`,()=>Q.assign(C._`${X}[${Y}]`,W))}function x9(Q,X,Y,W=v1.Correct){let G=W===v1.Correct?C.operators.EQ:C.operators.NEQ,$;switch(Q){case"null":return C._`${X} ${G} null`;case"array":$=C._`Array.isArray(${X})`;break;case"object":$=C._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":$=J(C._`!(${X} % 1) && !isNaN(${X})`);break;case"number":$=J();break;default:return C._`typeof ${X} ${G} ${Q}`}return W===v1.Correct?$:(0,C.not)($);function J(z=C.nil){return(0,C.and)(C._`typeof ${X} == "number"`,z,Y?C._`isFinite(${X})`:C.nil)}}N$.checkDataType=x9;function _9(Q,X,Y,W){if(Q.length===1)return x9(Q[0],X,Y,W);let G,$=(0,M$.toHash)(Q);if($.array&&$.object){let J=C._`typeof ${X} != "object"`;G=$.null?J:C._`!${X} || ${J}`,delete $.null,delete $.array,delete $.object}else G=C.nil;if($.number)delete $.integer;for(let J in $)G=(0,C.and)(G,x9(J,X,Y,W));return G}N$.checkDataTypes=_9;var xK={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?C._`{type: ${Q}}`:C._`{type: ${X}}`};function y9(Q){let X=_K(Q);(0,TK.reportError)(X,xK)}N$.reportTypeError=y9;function _K(Q){let{gen:X,data:Y,schema:W}=Q,G=(0,M$.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var I$=N((P$)=>{Object.defineProperty(P$,"__esModule",{value:!0});P$.assignDefaults=void 0;var x1=v(),mK=f();function cK(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let G in Y)b$(Q,G,Y[G].default);else if(X==="array"&&Array.isArray(W))W.forEach((G,$)=>b$(Q,$,G.default))}P$.assignDefaults=cK;function b$(Q,X,Y){let{gen:W,compositeRule:G,data:$,opts:J}=Q;if(Y===void 0)return;let z=x1._`${$}${(0,x1.getProperty)(X)}`;if(G){(0,mK.checkStrictMode)(Q,`default is ignored for: ${z}`);return}let H=x1._`${z} === undefined`;if(J.useDefaults==="empty")H=x1._`${H} || ${z} === null || ${z} === ""`;W.if(H,x1._`${z} = ${(0,x1.stringify)(Y)}`)}});var j0=N((S$)=>{Object.defineProperty(S$,"__esModule",{value:!0});S$.validateUnion=S$.validateArray=S$.usePattern=S$.callValidateCode=S$.schemaProperties=S$.allSchemaProperties=S$.noPropertyInData=S$.propertyInData=S$.isOwnProperty=S$.hasPropFunc=S$.reportMissingProp=S$.checkMissingProp=S$.checkReportMissingProp=void 0;var r=v(),g9=f(),z1=n0(),pK=f();function iK(Q,X){let{gen:Y,data:W,it:G}=Q;Y.if(h9(Y,W,X,G.opts.ownProperties),()=>{Q.setParams({missingProperty:r._`${X}`},!0),Q.error()})}S$.checkReportMissingProp=iK;function nK({gen:Q,data:X,it:{opts:Y}},W,G){return(0,r.or)(...W.map(($)=>(0,r.and)(h9(Q,X,$,Y.ownProperties),r._`${G} = ${$}`)))}S$.checkMissingProp=nK;function rK(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}S$.reportMissingProp=rK;function E$(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:r._`Object.prototype.hasOwnProperty`})}S$.hasPropFunc=E$;function u9(Q,X,Y){return r._`${E$(Q)}.call(${X}, ${Y})`}S$.isOwnProperty=u9;function dK(Q,X,Y,W){let G=r._`${X}${(0,r.getProperty)(Y)} !== undefined`;return W?r._`${G} && ${u9(Q,X,Y)}`:G}S$.propertyInData=dK;function h9(Q,X,Y,W){let G=r._`${X}${(0,r.getProperty)(Y)} === undefined`;return W?(0,r.or)(G,(0,r.not)(u9(Q,X,Y))):G}S$.noPropertyInData=h9;function T$(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}S$.allSchemaProperties=T$;function oK(Q,X){return T$(X).filter((Y)=>!(0,g9.alwaysValidSchema)(Q,X[Y]))}S$.schemaProperties=oK;function tK({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:G,errorPath:$},it:J},z,H,U){let A=U?r._`${Q}, ${X}, ${W}${G}`:X,K=[[z1.default.instancePath,(0,r.strConcat)(z1.default.instancePath,$)],[z1.default.parentData,J.parentData],[z1.default.parentDataProperty,J.parentDataProperty],[z1.default.rootData,z1.default.rootData]];if(J.opts.dynamicRef)K.push([z1.default.dynamicAnchors,z1.default.dynamicAnchors]);let B=r._`${A}, ${Y.object(...K)}`;return H!==r.nil?r._`${z}.call(${H}, ${B})`:r._`${z}(${B})`}S$.callValidateCode=tK;var aK=r._`new RegExp`;function sK({gen:Q,it:{opts:X}},Y){let W=X.unicodeRegExp?"u":"",{regExp:G}=X.code,$=G(Y,W);return Q.scopeValue("pattern",{key:$.toString(),ref:$,code:r._`${G.code==="new RegExp"?aK:(0,pK.useFunc)(Q,G)}(${Y}, ${W})`})}S$.usePattern=sK;function eK(Q){let{gen:X,data:Y,keyword:W,it:G}=Q,$=X.name("valid");if(G.allErrors){let z=X.let("valid",!0);return J(()=>X.assign(z,!1)),z}return X.var($,!0),J(()=>X.break()),$;function J(z){let H=X.const("len",r._`${Y}.length`);X.forRange("i",0,H,(U)=>{Q.subschema({keyword:W,dataProp:U,dataPropType:g9.Type.Num},$),X.if((0,r.not)($),z)})}}S$.validateArray=eK;function QB(Q){let{gen:X,schema:Y,keyword:W,it:G}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((H)=>(0,g9.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let J=X.let("valid",!1),z=X.name("_valid");X.block(()=>Y.forEach((H,U)=>{let A=Q.subschema({keyword:W,schemaProp:U,compositeRule:!0},z);if(X.assign(J,r._`${J} || ${z}`),!Q.mergeValidEvaluated(A,z))X.if((0,r.not)(J))})),Q.result(J,()=>Q.reset(),()=>Q.error(!0))}S$.validateUnion=QB});var _$=N((v$)=>{Object.defineProperty(v$,"__esModule",{value:!0});v$.validateKeywordUsage=v$.validSchemaType=v$.funcKeywordCode=v$.macroKeywordCode=void 0;var B0=v(),F1=n0(),DB=j0(),LB=M4();function qB(Q,X){let{gen:Y,keyword:W,schema:G,parentSchema:$,it:J}=Q,z=X.macro.call(J.self,G,$,J),H=k$(Y,W,z);if(J.opts.validateSchema!==!1)J.self.validateSchema(z,!0);let U=Y.name("valid");Q.subschema({schema:z,schemaPath:B0.nil,errSchemaPath:`${J.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},U),Q.pass(U,()=>Q.error(!0))}v$.macroKeywordCode=qB;function FB(Q,X){var Y;let{gen:W,keyword:G,schema:$,parentSchema:J,$data:z,it:H}=Q;MB(H,X);let U=!z&&X.compile?X.compile.call(H.self,$,J,H):X.validate,A=k$(W,G,U),K=W.let("valid");Q.block$data(K,B),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:K);function B(){if(X.errors===!1){if(O(),X.modifying)C$(Q);V(()=>Q.error())}else{let M=X.async?L():F();if(X.modifying)C$(Q);V(()=>OB(Q,M))}}function L(){let M=W.let("ruleErrs",null);return W.try(()=>O(B0._`await `),(S)=>W.assign(K,!1).if(B0._`${S} instanceof ${H.ValidationError}`,()=>W.assign(M,B0._`${S}.errors`),()=>W.throw(S))),M}function F(){let M=B0._`${A}.errors`;return W.assign(M,null),O(B0.nil),M}function O(M=X.async?B0._`await `:B0.nil){let S=H.opts.passContext?F1.default.this:F1.default.self,E=!(("compile"in X)&&!z||X.schema===!1);W.assign(K,B0._`${M}${(0,DB.callValidateCode)(Q,A,S,E)}`,X.modifying)}function V(M){var S;W.if((0,B0.not)((S=X.valid)!==null&&S!==void 0?S:K),M)}}v$.funcKeywordCode=FB;function C$(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,B0._`${W.parentData}[${W.parentDataProperty}]`))}function OB(Q,X){let{gen:Y}=Q;Y.if(B0._`Array.isArray(${X})`,()=>{Y.assign(F1.default.vErrors,B0._`${F1.default.vErrors} === null ? ${X} : ${F1.default.vErrors}.concat(${X})`).assign(F1.default.errors,B0._`${F1.default.vErrors}.length`),(0,LB.extendErrors)(Q)},()=>Q.error())}function MB({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function k$(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,B0.stringify)(Y)})}function VB(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")}v$.validSchemaType=VB;function ZB({schema:Q,opts:X,self:Y,errSchemaPath:W},G,$){if(Array.isArray(G.keyword)?!G.keyword.includes($):G.keyword!==$)throw Error("ajv implementation error");let J=G.dependencies;if(J===null||J===void 0?void 0:J.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[$])){let H=`keyword "${$}" value is invalid at path "${W}": `+Y.errorsText(G.validateSchema.errors);if(X.validateSchema==="log")Y.logger.error(H);else throw Error(H)}}}v$.validateKeywordUsage=ZB});var h$=N((g$)=>{Object.defineProperty(g$,"__esModule",{value:!0});g$.extendSubschemaMode=g$.extendSubschemaData=g$.getSubschema=void 0;var y0=v(),y$=f();function PB(Q,{keyword:X,schemaProp:Y,schema:W,schemaPath:G,errSchemaPath:$,topSchemaRef:J}){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:y0._`${Q.schemaPath}${(0,y0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:z[Y],schemaPath:y0._`${Q.schemaPath}${(0,y0.getProperty)(X)}${(0,y0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,y$.escapeFragment)(Y)}`}}if(W!==void 0){if(G===void 0||$===void 0||J===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:J,errSchemaPath:$}}throw Error('either "keyword" or "schema" must be passed')}g$.getSubschema=PB;function jB(Q,X,{dataProp:Y,dataPropType:W,data:G,dataTypes:$,propertyName:J}){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:U,dataPathArr:A,opts:K}=X,B=z.let("data",y0._`${X.data}${(0,y0.getProperty)(Y)}`,!0);H(B),Q.errorPath=y0.str`${U}${(0,y$.getErrorPath)(Y,W,K.jsPropertySyntax)}`,Q.parentDataProperty=y0._`${Y}`,Q.dataPathArr=[...A,Q.parentDataProperty]}if(G!==void 0){let U=G instanceof y0.Name?G:z.let("data",G,!0);if(H(U),J!==void 0)Q.propertyName=J}if($)Q.dataTypes=$;function H(U){Q.data=U,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,U]}}g$.extendSubschemaData=jB;function IB(Q,{jtdDiscriminator:X,jtdMetadata:Y,compositeRule:W,createErrors:G,allErrors:$}){if(W!==void 0)Q.compositeRule=W;if(G!==void 0)Q.createErrors=G;if($!==void 0)Q.allErrors=$;Q.jtdDiscriminator=X,Q.jtdMetadata=Y}g$.extendSubschemaMode=IB});var f9=N((yP,f$)=>{f$.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,$;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($=Object.keys(X),W=$.length,W!==Object.keys(Y).length)return!1;for(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,$[G]))return!1;for(G=W;G--!==0;){var J=$[G];if(!Q(X[J],Y[J]))return!1}return!0}return X!==X&&Y!==Y}});var m$=N((gP,l$)=>{var H1=l$.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(){};_6(X,W,G,Q,"",Q)};H1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};H1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};H1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};H1.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 _6(Q,X,Y,W,G,$,J,z,H,U){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,G,$,J,z,H,U);for(var A in W){var K=W[A];if(Array.isArray(K)){if(A in H1.arrayKeywords)for(var B=0;B<K.length;B++)_6(Q,X,Y,K[B],G+"/"+A+"/"+B,$,G,A,W,B)}else if(A in H1.propsKeywords){if(K&&typeof K=="object")for(var L in K)_6(Q,X,Y,K[L],G+"/"+A+"/"+SB(L),$,G,A,W,L)}else if(A in H1.keywords||Q.allKeys&&!(A in H1.skipKeywords))_6(Q,X,Y,K,G+"/"+A,$,G,A,W)}Y(W,G,$,J,z,H,U)}}function SB(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var Z4=N((n$)=>{Object.defineProperty(n$,"__esModule",{value:!0});n$.getSchemaRefs=n$.resolveUrl=n$.normalizeId=n$._getFullPath=n$.getFullPath=n$.inlineRef=void 0;var RB=f(),CB=f9(),kB=m$(),vB=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function xB(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!l9(Q);if(!X)return!1;return c$(Q)<=X}n$.inlineRef=xB;var _B=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l9(Q){for(let X in Q){if(_B.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(l9))return!0;if(typeof Y=="object"&&l9(Y))return!0}return!1}function c$(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,vB.has(Y))continue;if(typeof Q[Y]=="object")(0,RB.eachItem)(Q[Y],(W)=>X+=c$(W));if(X===1/0)return 1/0}return X}function p$(Q,X="",Y){if(Y!==!1)X=_1(X);let W=Q.parse(X);return i$(Q,W)}n$.getFullPath=p$;function i$(Q,X){return Q.serialize(X).split("#")[0]+"#"}n$._getFullPath=i$;var yB=/#\/?$/;function _1(Q){return Q?Q.replace(yB,""):""}n$.normalizeId=_1;function gB(Q,X,Y){return Y=_1(Y),Q.resolve(X,Y)}n$.resolveUrl=gB;var uB=/^[a-z_][-a-z0-9._]*$/i;function hB(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,G=_1(Q[Y]||X),$={"":G},J=p$(W,G,!1),z={},H=new Set;return kB(Q,{allKeys:!0},(K,B,L,F)=>{if(F===void 0)return;let O=J+B,V=$[F];if(typeof K[Y]=="string")V=M.call(this,K[Y]);S.call(this,K.$anchor),S.call(this,K.$dynamicAnchor),$[B]=V;function M(E){let x=this.opts.uriResolver.resolve;if(E=_1(V?x(V,E):E),H.has(E))throw A(E);H.add(E);let T=this.refs[E];if(typeof T=="string")T=this.refs[T];if(typeof T=="object")U(K,T.schema,E);else if(E!==_1(O))if(E[0]==="#")U(K,z[E],E),z[E]=K;else this.refs[E]=O;return E}function S(E){if(typeof E=="string"){if(!uB.test(E))throw Error(`invalid anchor "${E}"`);M.call(this,`#${E}`)}}}),z;function U(K,B,L){if(B!==void 0&&!CB(K,B))throw A(L)}function A(K){return Error(`reference "${K}" resolves to more than one schema`)}}n$.getSchemaRefs=hB});var b4=N((HJ)=>{Object.defineProperty(HJ,"__esModule",{value:!0});HJ.getData=HJ.KeywordCxt=HJ.validateFunctionCode=void 0;var s$=K$(),d$=V4(),c9=v9(),y6=V4(),iB=I$(),w4=_$(),m9=h$(),P=v(),R=n0(),nB=Z4(),r0=f(),N4=M4();function rB(Q){if(XJ(Q)){if(YJ(Q),QJ(Q)){tB(Q);return}}e$(Q,()=>(0,s$.topBoolOrEmptySchema)(Q))}HJ.validateFunctionCode=rB;function e$({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:G},$){if(G.code.es5)Q.func(X,P._`${R.default.data}, ${R.default.valCxt}`,W.$async,()=>{Q.code(P._`"use strict"; ${o$(Y,G)}`),oB(Q,G),Q.code($)});else Q.func(X,P._`${R.default.data}, ${dB(G)}`,W.$async,()=>Q.code(o$(Y,G)).code($))}function dB(Q){return P._`{${R.default.instancePath}="", ${R.default.parentData}, ${R.default.parentDataProperty}, ${R.default.rootData}=${R.default.data}${Q.dynamicRef?P._`, ${R.default.dynamicAnchors}={}`:P.nil}}={}`}function oB(Q,X){Q.if(R.default.valCxt,()=>{if(Q.var(R.default.instancePath,P._`${R.default.valCxt}.${R.default.instancePath}`),Q.var(R.default.parentData,P._`${R.default.valCxt}.${R.default.parentData}`),Q.var(R.default.parentDataProperty,P._`${R.default.valCxt}.${R.default.parentDataProperty}`),Q.var(R.default.rootData,P._`${R.default.valCxt}.${R.default.rootData}`),X.dynamicRef)Q.var(R.default.dynamicAnchors,P._`${R.default.valCxt}.${R.default.dynamicAnchors}`)},()=>{if(Q.var(R.default.instancePath,P._`""`),Q.var(R.default.parentData,P._`undefined`),Q.var(R.default.parentDataProperty,P._`undefined`),Q.var(R.default.rootData,R.default.data),X.dynamicRef)Q.var(R.default.dynamicAnchors,P._`{}`)})}function tB(Q){let{schema:X,opts:Y,gen:W}=Q;e$(Q,()=>{if(Y.$comment&&X.$comment)GJ(Q);if(XD(Q),W.let(R.default.vErrors,null),W.let(R.default.errors,0),Y.unevaluated)aB(Q);WJ(Q),GD(Q)});return}function aB(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 o$(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?P._`/*# sourceURL=${Y} */`:P.nil}function sB(Q,X){if(XJ(Q)){if(YJ(Q),QJ(Q)){eB(Q,X);return}}(0,s$.boolOrEmptySchema)(Q,X)}function QJ({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 XJ(Q){return typeof Q.schema!="boolean"}function eB(Q,X){let{schema:Y,gen:W,opts:G}=Q;if(G.$comment&&Y.$comment)GJ(Q);YD(Q),WD(Q);let $=W.const("_errs",R.default.errors);WJ(Q,$),W.var(X,P._`${$} === ${R.default.errors}`)}function YJ(Q){(0,r0.checkUnknownRules)(Q),QD(Q)}function WJ(Q,X){if(Q.opts.jtd)return t$(Q,[],!1,X);let Y=(0,d$.getSchemaTypes)(Q.schema),W=(0,d$.coerceAndCheckDataType)(Q,Y);t$(Q,Y,!W,X)}function QD(Q){let{schema:X,errSchemaPath:Y,opts:W,self:G}=Q;if(X.$ref&&W.ignoreKeywordsWithRef&&(0,r0.schemaHasRulesButRef)(X,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${Y}"`)}function XD(Q){let{schema:X,opts:Y}=Q;if(X.default!==void 0&&Y.useDefaults&&Y.strictSchema)(0,r0.checkStrictMode)(Q,"default is ignored in the schema root")}function YD(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,nB.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function WD(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function GJ({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:G}){let $=Y.$comment;if(G.$comment===!0)Q.code(P._`${R.default.self}.logger.log(${$})`);else if(typeof G.$comment=="function"){let J=P.str`${W}/$comment`,z=Q.scopeValue("root",{ref:X.root});Q.code(P._`${R.default.self}.opts.$comment(${$}, ${J}, ${z}.schema)`)}}function GD(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:G,opts:$}=Q;if(Y.$async)X.if(P._`${R.default.errors} === 0`,()=>X.return(R.default.data),()=>X.throw(P._`new ${G}(${R.default.vErrors})`));else{if(X.assign(P._`${W}.errors`,R.default.vErrors),$.unevaluated)$D(Q);X.return(P._`${R.default.errors} === 0`)}}function $D({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 t$(Q,X,Y,W){let{gen:G,schema:$,data:J,allErrors:z,opts:H,self:U}=Q,{RULES:A}=U;if($.$ref&&(H.ignoreKeywordsWithRef||!(0,r0.schemaHasRulesButRef)($,A))){G.block(()=>JJ(Q,"$ref",A.all.$ref.definition));return}if(!H.jtd)JD(Q,X);G.block(()=>{for(let B of A.rules)K(B);K(A.post)});function K(B){if(!(0,c9.shouldUseGroup)($,B))return;if(B.type){if(G.if((0,y6.checkDataType)(B.type,J,H.strictNumbers)),a$(Q,B),X.length===1&&X[0]===B.type&&Y)G.else(),(0,y6.reportTypeError)(Q);G.endIf()}else a$(Q,B);if(!z)G.if(P._`${R.default.errors} === ${W||0}`)}}function a$(Q,X){let{gen:Y,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,iB.assignDefaults)(Q,X.type);Y.block(()=>{for(let $ of X.rules)if((0,c9.shouldUseRule)(W,$))JJ(Q,$.keyword,$.definition,X.type)})}function JD(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(zD(Q,X),!Q.opts.allowUnionTypes)HD(Q,X);UD(Q,Q.dataTypes)}function zD(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!$J(Q.dataTypes,Y))p9(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),KD(Q,X)}function HD(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))p9(Q,"use allowUnionTypes to allow union type keyword")}function UD(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let G=Y[W];if(typeof G=="object"&&(0,c9.shouldUseRule)(Q.schema,G)){let{type:$}=G.definition;if($.length&&!$.some((J)=>AD(X,J)))p9(Q,`missing type "${$.join(",")}" for keyword "${W}"`)}}}function AD(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function $J(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function KD(Q,X){let Y=[];for(let W of Q.dataTypes)if($J(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function p9(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,r0.checkStrictMode)(Q,X,Q.opts.strictTypes)}class i9{constructor(Q,X,Y){if((0,w4.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,r0.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",zJ(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,w4.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",R.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?N4.reportExtraError:N4.reportError)(this,this.def.error,X)}$dataError(){(0,N4.reportError)(this,this.def.$dataError||N4.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,N4.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:$}=this;if(Y.if((0,P.or)(P._`${W} === undefined`,X)),Q!==P.nil)Y.assign(Q,!0);if(G.length||$.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 $(){if(Y.length){if(!(X instanceof P.Name))throw Error("ajv implementation error");let z=Array.isArray(Y)?Y:[Y];return P._`${(0,y6.checkDataTypes)(z,X,G.opts.strictNumbers,y6.DataType.Wrong)}`}return P.nil}function J(){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,m9.getSubschema)(this.it,Q);(0,m9.extendSubschemaData)(Y,this.it,Q),(0,m9.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return sB(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=r0.mergeEvaluated.props(W,Q.props,Y.props,X);if(Y.items!==!0&&Q.items!==void 0)Y.items=r0.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}}HJ.KeywordCxt=i9;function JJ(Q,X,Y,W){let G=new i9(Q,Y,X);if("code"in Y)Y.code(G,W);else if(G.$data&&Y.validate)(0,w4.funcKeywordCode)(G,Y);else if("macro"in Y)(0,w4.macroKeywordCode)(G,Y);else if(Y.compile||Y.validate)(0,w4.funcKeywordCode)(G,Y)}var BD=/^\/(?:[^~]|~0|~1)*$/,DD=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function zJ(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let G,$;if(Q==="")return R.default.rootData;if(Q[0]==="/"){if(!BD.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,$=R.default.rootData}else{let U=DD.exec(Q);if(!U)throw Error(`Invalid JSON-pointer: ${Q}`);let A=+U[1];if(G=U[2],G==="#"){if(A>=X)throw Error(H("property/index",A));return W[X-A]}if(A>X)throw Error(H("data",A));if($=Y[X-A],!G)return $}let J=$,z=G.split("/");for(let U of z)if(U)$=P._`${$}${(0,P.getProperty)((0,r0.unescapeJsonPointer)(U))}`,J=P._`${J} && ${$}`;return J;function H(U,A){return`Cannot access ${U} ${A} levels up, current level is ${X}`}}HJ.getData=zJ});var g6=N((KJ)=>{Object.defineProperty(KJ,"__esModule",{value:!0});class AJ extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}KJ.default=AJ});var P4=N((DJ)=>{Object.defineProperty(DJ,"__esModule",{value:!0});var n9=Z4();class BJ extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,n9.resolveUrl)(Q,X,Y),this.missingSchema=(0,n9.normalizeId)((0,n9.getFullPath)(Q,this.missingRef))}}DJ.default=BJ});var h6=N((FJ)=>{Object.defineProperty(FJ,"__esModule",{value:!0});FJ.resolveSchema=FJ.getCompilingSchema=FJ.resolveRef=FJ.compileSchema=FJ.SchemaEnv=void 0;var C0=v(),MD=g6(),O1=n0(),k0=Z4(),LJ=f(),VD=b4();class j4{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,k0.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={}}}FJ.SchemaEnv=j4;function d9(Q){let X=qJ.call(this,Q);if(X)return X;let Y=(0,k0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:$}=this.opts,J=new C0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:$}),z;if(Q.$async)z=J.scopeValue("Error",{ref:MD.default,code:C0._`require("ajv/dist/runtime/validation_error").default`});let H=J.scopeName("validate");Q.validateName=H;let U={gen:J,allErrors:this.opts.allErrors,data:O1.default.data,parentData:O1.default.parentData,parentDataProperty:O1.default.parentDataProperty,dataNames:[O1.default.data],dataPathArr:[C0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:J.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,C0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:z,schema:Q.schema,schemaEnv:Q,rootId:Y,baseId:Q.baseId||Y,schemaPath:C0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:C0._`""`,opts:this.opts,self:this},A;try{this._compilations.add(Q),(0,VD.validateFunctionCode)(U),J.optimize(this.opts.code.optimize);let K=J.toString();if(A=`${J.scopeRefs(O1.default.scope)}return ${K}`,this.opts.code.process)A=this.opts.code.process(A,Q);let L=Function(`${O1.default.self}`,`${O1.default.scope}`,A)(this,this.scope.get());if(this.scope.value(H,{ref:L}),L.errors=null,L.schema=Q.schema,L.schemaEnv=Q,Q.$async)L.$async=!0;if(this.opts.code.source===!0)L.source={validateName:H,validateCode:K,scopeValues:J._values};if(this.opts.unevaluated){let{props:F,items:O}=U;if(L.evaluated={props:F instanceof C0.Name?void 0:F,items:O instanceof C0.Name?void 0:O,dynamicProps:F instanceof C0.Name,dynamicItems:O instanceof C0.Name},L.source)L.source.evaluated=(0,C0.stringify)(L.evaluated)}return Q.validate=L,Q}catch(K){if(delete Q.validate,delete Q.validateName,A)this.logger.error("Error compiling schema, function code:",A);throw K}finally{this._compilations.delete(Q)}}FJ.compileSchema=d9;function ZD(Q,X,Y){var W;Y=(0,k0.resolveUrl)(this.opts.uriResolver,X,Y);let G=Q.refs[Y];if(G)return G;let $=bD.call(this,Q,Y);if($===void 0){let J=(W=Q.localRefs)===null||W===void 0?void 0:W[Y],{schemaId:z}=this.opts;if(J)$=new j4({schema:J,schemaId:z,root:Q,baseId:X})}if($===void 0)return;return Q.refs[Y]=ND.call(this,$)}FJ.resolveRef=ZD;function ND(Q){if((0,k0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:d9.call(this,Q)}function qJ(Q){for(let X of this._compilations)if(wD(X,Q))return X}FJ.getCompilingSchema=qJ;function wD(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function bD(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||u6.call(this,Q,X)}function u6(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,k0._getFullPath)(this.opts.uriResolver,Y),G=(0,k0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return r9.call(this,Y,Q);let $=(0,k0.normalizeId)(W),J=this.refs[$]||this.schemas[$];if(typeof J=="string"){let z=u6.call(this,Q,J);if(typeof(z===null||z===void 0?void 0:z.schema)!=="object")return;return r9.call(this,Y,z)}if(typeof(J===null||J===void 0?void 0:J.schema)!=="object")return;if(!J.validate)d9.call(this,J);if($===(0,k0.normalizeId)(X)){let{schema:z}=J,{schemaId:H}=this.opts,U=z[H];if(U)G=(0,k0.resolveUrl)(this.opts.uriResolver,G,U);return new j4({schema:z,schemaId:H,root:Q,baseId:G})}return r9.call(this,Y,J)}FJ.resolveSchema=u6;var PD=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function r9(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 H=Y[(0,LJ.unescapeFragment)(z)];if(H===void 0)return;Y=H;let U=typeof Y==="object"&&Y[this.opts.schemaId];if(!PD.has(z)&&U)X=(0,k0.resolveUrl)(this.opts.uriResolver,X,U)}let $;if(typeof Y!="boolean"&&Y.$ref&&!(0,LJ.schemaHasRulesButRef)(Y,this.RULES)){let z=(0,k0.resolveUrl)(this.opts.uriResolver,X,Y.$ref);$=u6.call(this,W,z)}let{schemaId:J}=this.opts;if($=$||new j4({schema:Y,schemaId:J,root:W,baseId:X}),$.schema!==$.root.schema)return $;return}});var MJ=N((cP,SD)=>{SD.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 t9=N((pP,wJ)=>{var RD=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),ZJ=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 o9(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 CD=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function VJ(Q){return Q.length=0,!0}function kD(Q,X,Y){if(Q.length){let W=o9(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function vD(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],G=[],$=!1,J=!1,z=kD;for(let H=0;H<Q.length;H++){let U=Q[H];if(U==="["||U==="]")continue;if(U===":"){if($===!0)J=!0;if(!z(G,W,Y))break;if(++X>7){Y.error=!0;break}if(H>0&&Q[H-1]===":")$=!0;W.push(":");continue}else if(U==="%"){if(!z(G,W,Y))break;z=VJ}else{G.push(U);continue}}if(G.length)if(z===VJ)Y.zone=G.join("");else if(J)W.push(G.join(""));else W.push(o9(G));return Y.address=W.join(""),Y}function NJ(Q){if(xD(Q,":")<2)return{host:Q,isIPV6:!1};let X=vD(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 xD(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function _D(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 yD(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 gD(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(!ZJ(Y)){let W=NJ(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}wJ.exports={nonSimpleDomain:CD,recomposeAuthority:gD,normalizeComponentEncoding:yD,removeDotSegments:_D,isIPv4:ZJ,isUUID:RD,normalizeIPv6:NJ,stringArrayToHexStripped:o9}});var EJ=N((iP,IJ)=>{var{isUUID:uD}=t9(),hD=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,fD=["http","https","ws","wss","urn","urn:uuid"];function lD(Q){return fD.indexOf(Q)!==-1}function a9(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 bJ(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function PJ(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 mD(Q){return Q.secure=a9(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function cD(Q){if(Q.port===(a9(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 pD(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(hD);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}`,$=s9(G);if(Q.path=void 0,$)Q=$.parse(Q,X)}else Q.error=Q.error||"URN can not be parsed.";return Q}function iD(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}`,$=s9(G);if($)Q=$.serialize(Q,X);let J=Q,z=Q.nss;return J.path=`${W||X.nid}:${z}`,X.skipEscape=!0,J}function nD(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!uD(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function rD(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var jJ={scheme:"http",domainHost:!0,parse:bJ,serialize:PJ},dD={scheme:"https",domainHost:jJ.domainHost,parse:bJ,serialize:PJ},f6={scheme:"ws",domainHost:!0,parse:mD,serialize:cD},oD={scheme:"wss",domainHost:f6.domainHost,parse:f6.parse,serialize:f6.serialize},tD={scheme:"urn",parse:pD,serialize:iD,skipNormalize:!0},aD={scheme:"urn:uuid",parse:nD,serialize:rD,skipNormalize:!0},l6={http:jJ,https:dD,ws:f6,wss:oD,urn:tD,"urn:uuid":aD};Object.setPrototypeOf(l6,null);function s9(Q){return Q&&(l6[Q]||l6[Q.toLowerCase()])||void 0}IJ.exports={wsIsSecure:a9,SCHEMES:l6,isValidSchemeName:lD,getSchemeHandler:s9}});var RJ=N((nP,c6)=>{var{normalizeIPv6:sD,removeDotSegments:I4,recomposeAuthority:eD,normalizeComponentEncoding:m6,isIPv4:QL,nonSimpleDomain:XL}=t9(),{SCHEMES:YL,getSchemeHandler:TJ}=EJ();function WL(Q,X){if(typeof Q==="string")Q=g0(d0(Q,X),X);else if(typeof Q==="object")Q=d0(g0(Q,X),X);return Q}function GL(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},G=SJ(d0(Q,W),d0(X,W),W,!0);return W.skipEscape=!0,g0(G,W)}function SJ(Q,X,Y,W){let G={};if(!W)Q=d0(g0(Q,Y),Y),X=d0(g0(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=I4(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=I4(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=I4(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=I4(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 $L(Q,X,Y){if(typeof Q==="string")Q=unescape(Q),Q=g0(m6(d0(Q,Y),!0),{...Y,skipEscape:!0});else if(typeof Q==="object")Q=g0(m6(Q,!0),{...Y,skipEscape:!0});if(typeof X==="string")X=unescape(X),X=g0(m6(d0(X,Y),!0),{...Y,skipEscape:!0});else if(typeof X==="object")X=g0(m6(X,!0),{...Y,skipEscape:!0});return Q.toLowerCase()===X.toLowerCase()}function g0(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=[],$=TJ(W.scheme||Y.scheme);if($&&$.serialize)$.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 J=eD(Y);if(J!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push(J),Y.path&&Y.path[0]!=="/")G.push("/")}if(Y.path!==void 0){let z=Y.path;if(!W.absolutePath&&(!$||!$.absolutePath))z=I4(z);if(J===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 JL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function d0(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 $=Q.match(JL);if($){if(W.scheme=$[1],W.userinfo=$[3],W.host=$[4],W.port=parseInt($[5],10),W.path=$[6]||"",W.query=$[7],W.fragment=$[8],isNaN(W.port))W.port=$[5];if(W.host)if(QL(W.host)===!1){let H=sD(W.host);W.host=H.host.toLowerCase(),G=H.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 J=TJ(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!J||!J.unicodeSupport)){if(W.host&&(Y.domainHost||J&&J.domainHost)&&G===!1&&XL(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(!J||J&&!J.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(J&&J.parse)J.parse(W,Y)}else W.error=W.error||"URI can not be parsed.";return W}var e9={SCHEMES:YL,normalize:WL,resolve:GL,resolveComponent:SJ,equal:$L,serialize:g0,parse:d0};c6.exports=e9;c6.exports.default=e9;c6.exports.fastUri=e9});var vJ=N((kJ)=>{Object.defineProperty(kJ,"__esModule",{value:!0});var CJ=RJ();CJ.code='require("ajv/dist/runtime/uri").default';kJ.default=CJ});var lJ=N((o0)=>{Object.defineProperty(o0,"__esModule",{value:!0});o0.CodeGen=o0.Name=o0.nil=o0.stringify=o0.str=o0._=o0.KeywordCxt=void 0;var HL=b4();Object.defineProperty(o0,"KeywordCxt",{enumerable:!0,get:function(){return HL.KeywordCxt}});var y1=v();Object.defineProperty(o0,"_",{enumerable:!0,get:function(){return y1._}});Object.defineProperty(o0,"str",{enumerable:!0,get:function(){return y1.str}});Object.defineProperty(o0,"stringify",{enumerable:!0,get:function(){return y1.stringify}});Object.defineProperty(o0,"nil",{enumerable:!0,get:function(){return y1.nil}});Object.defineProperty(o0,"Name",{enumerable:!0,get:function(){return y1.Name}});Object.defineProperty(o0,"CodeGen",{enumerable:!0,get:function(){return y1.CodeGen}});var UL=g6(),uJ=P4(),AL=k9(),E4=h6(),KL=v(),T4=Z4(),p6=V4(),XX=f(),xJ=MJ(),BL=vJ(),hJ=(Q,X)=>new RegExp(Q,X);hJ.code="new RegExp";var DL=["removeAdditional","useDefaults","coerceTypes"],LL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),qL={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."},FL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},_J=200;function OL(Q){var X,Y,W,G,$,J,z,H,U,A,K,B,L,F,O,V,M,S,E,x,T,_0,f0,UQ,AQ;let c1=Q.strict,KQ=(X=Q.code)===null||X===void 0?void 0:X.optimize,kX=KQ===!0||KQ===void 0?1:KQ||0,vX=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:hJ,N5=(G=Q.uriResolver)!==null&&G!==void 0?G:BL.default;return{strictSchema:(J=($=Q.strictSchema)!==null&&$!==void 0?$:c1)!==null&&J!==void 0?J:!0,strictNumbers:(H=(z=Q.strictNumbers)!==null&&z!==void 0?z:c1)!==null&&H!==void 0?H:!0,strictTypes:(A=(U=Q.strictTypes)!==null&&U!==void 0?U:c1)!==null&&A!==void 0?A:"log",strictTuples:(B=(K=Q.strictTuples)!==null&&K!==void 0?K:c1)!==null&&B!==void 0?B:"log",strictRequired:(F=(L=Q.strictRequired)!==null&&L!==void 0?L:c1)!==null&&F!==void 0?F:!1,code:Q.code?{...Q.code,optimize:kX,regExp:vX}:{optimize:kX,regExp:vX},loopRequired:(O=Q.loopRequired)!==null&&O!==void 0?O:_J,loopEnum:(V=Q.loopEnum)!==null&&V!==void 0?V:_J,meta:(M=Q.meta)!==null&&M!==void 0?M:!0,messages:(S=Q.messages)!==null&&S!==void 0?S:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(x=Q.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(T=Q.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(_0=Q.validateSchema)!==null&&_0!==void 0?_0:!0,validateFormats:(f0=Q.validateFormats)!==null&&f0!==void 0?f0:!0,unicodeRegExp:(UQ=Q.unicodeRegExp)!==null&&UQ!==void 0?UQ:!0,int32range:(AQ=Q.int32range)!==null&&AQ!==void 0?AQ:!0,uriResolver:N5}}class i6{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...OL(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new KL.ValueScope({scope:{},prefixes:LL,es5:X,lines:Y}),this.logger=bL(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,AL.getRules)(),yJ.call(this,qL,Q,"NOT SUPPORTED"),yJ.call(this,FL,Q,"DEPRECATED","warn"),this._metaOpts=NL.call(this),Q.formats)VL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)ZL.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);ML.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=xJ;if(Y==="id")W={...xJ},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(U,A){await G.call(this,U.$schema);let K=this._addSchema(U,A);return K.validate||$.call(this,K)}async function G(U){if(U&&!this.getSchema(U))await W.call(this,{$ref:U},!0)}async function $(U){try{return this._compileSchemaEnv(U)}catch(A){if(!(A instanceof uJ.default))throw A;return J.call(this,A),await z.call(this,A.missingSchema),$.call(this,U)}}function J({missingSchema:U,missingRef:A}){if(this.refs[U])throw Error(`AnySchema ${U} is loaded but ${A} cannot be resolved`)}async function z(U){let A=await H.call(this,U);if(!this.refs[U])await G.call(this,A.$schema);if(!this.refs[U])this.addSchema(A,U,X)}async function H(U){let A=this._loading[U];if(A)return A;try{return await(this._loading[U]=Y(U))}finally{delete this._loading[U]}}}addSchema(Q,X,Y,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let $ of Q)this.addSchema($,void 0,Y,W);return this}let G;if(typeof Q==="object"){let{schemaId:$}=this.opts;if(G=Q[$],G!==void 0&&typeof G!="string")throw Error(`schema ${$} must be string`)}return X=(0,T4.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=gJ.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new E4.SchemaEnv({schema:{},schemaId:Y});if(X=E4.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=gJ.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,T4.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(jL.call(this,Y,X),!X)return(0,XX.eachItem)(Y,(G)=>QX.call(this,G)),this;EL.call(this,X);let W={...X,type:(0,p6.getJSONTypes)(X.type),schemaType:(0,p6.getJSONTypes)(X.schemaType)};return(0,XX.eachItem)(Y,W.type.length===0?(G)=>QX.call(this,G,W):(G)=>W.type.forEach(($)=>QX.call(this,G,W,$))),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),$=Q;for(let J of G)$=$[J];for(let J in Y){let z=Y[J];if(typeof z!="object")continue;let{$data:H}=z.definition,U=$[J];if(H&&U)$[J]=fJ(U)}}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 $,{schemaId:J}=this.opts;if(typeof Q=="object")$=Q[J];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,T4.normalizeId)($||Y);let H=T4.getSchemaRefs.call(this,Q,Y);if(z=new E4.SchemaEnv({schema:Q,schemaId:J,meta:X,baseId:Y,localRefs:H}),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 E4.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{E4.compileSchema.call(this,Q)}finally{this.opts=X}}}i6.ValidationError=UL.default;i6.MissingRefError=uJ.default;o0.default=i6;function yJ(Q,X,Y,W="error"){for(let G in Q){let $=G;if($ in X)this.logger[W](`${Y}: option ${G}. ${Q[$]}`)}}function gJ(Q){return Q=(0,T4.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function ML(){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 VL(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function ZL(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 NL(){let Q={...this.opts};for(let X of DL)delete Q[X];return Q}var wL={log(){},warn(){},error(){}};function bL(Q){if(Q===!1)return wL;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 PL=/^[a-z_$][a-z0-9_$:-]*$/i;function jL(Q,X){let{RULES:Y}=this;if((0,XX.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!PL.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 QX(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:$}=this,J=G?$.post:$.rules.find(({type:H})=>H===Y);if(!J)J={type:Y,rules:[]},$.rules.push(J);if($.keywords[Q]=!0,!X)return;let z={keyword:Q,definition:{...X,type:(0,p6.getJSONTypes)(X.type),schemaType:(0,p6.getJSONTypes)(X.schemaType)}};if(X.before)IL.call(this,J,z,X.before);else J.rules.push(z);$.all[Q]=z,(W=X.implements)===null||W===void 0||W.forEach((H)=>this.addKeyword(H))}function IL(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 EL(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=fJ(X);Q.validateSchema=this.compile(X,!0)}var TL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function fJ(Q){return{anyOf:[Q,TL]}}});var cJ=N((mJ)=>{Object.defineProperty(mJ,"__esModule",{value:!0});var CL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};mJ.default=CL});var oJ=N((rJ)=>{Object.defineProperty(rJ,"__esModule",{value:!0});rJ.callRef=rJ.getValidate=void 0;var vL=P4(),pJ=j0(),O0=v(),g1=n0(),iJ=h6(),n6=f(),xL={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:Y,it:W}=Q,{baseId:G,schemaEnv:$,validateName:J,opts:z,self:H}=W,{root:U}=$;if((Y==="#"||Y==="#/")&&G===U.baseId)return K();let A=iJ.resolveRef.call(H,U,G,Y);if(A===void 0)throw new vL.default(W.opts.uriResolver,G,Y);if(A instanceof iJ.SchemaEnv)return B(A);return L(A);function K(){if($===U)return r6(Q,J,$,$.$async);let F=X.scopeValue("root",{ref:U});return r6(Q,O0._`${F}.validate`,U,U.$async)}function B(F){let O=nJ(Q,F);r6(Q,O,F,F.$async)}function L(F){let O=X.scopeValue("schema",z.code.source===!0?{ref:F,code:(0,O0.stringify)(F)}:{ref:F}),V=X.name("valid"),M=Q.subschema({schema:F,dataTypes:[],schemaPath:O0.nil,topSchemaRef:O,errSchemaPath:Y},V);Q.mergeEvaluated(M),Q.ok(V)}}};function nJ(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):O0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}rJ.getValidate=nJ;function r6(Q,X,Y,W){let{gen:G,it:$}=Q,{allErrors:J,schemaEnv:z,opts:H}=$,U=H.passContext?g1.default.this:O0.nil;if(W)A();else K();function A(){if(!z.$async)throw Error("async schema referenced by sync schema");let F=G.let("valid");G.try(()=>{if(G.code(O0._`await ${(0,pJ.callValidateCode)(Q,X,U)}`),L(X),!J)G.assign(F,!0)},(O)=>{if(G.if(O0._`!(${O} instanceof ${$.ValidationError})`,()=>G.throw(O)),B(O),!J)G.assign(F,!1)}),Q.ok(F)}function K(){Q.result((0,pJ.callValidateCode)(Q,X,U),()=>L(X),()=>B(X))}function B(F){let O=O0._`${F}.errors`;G.assign(g1.default.vErrors,O0._`${g1.default.vErrors} === null ? ${O} : ${g1.default.vErrors}.concat(${O})`),G.assign(g1.default.errors,O0._`${g1.default.vErrors}.length`)}function L(F){var O;if(!$.opts.unevaluated)return;let V=(O=Y===null||Y===void 0?void 0:Y.validate)===null||O===void 0?void 0:O.evaluated;if($.props!==!0)if(V&&!V.dynamicProps){if(V.props!==void 0)$.props=n6.mergeEvaluated.props(G,V.props,$.props)}else{let M=G.var("props",O0._`${F}.evaluated.props`);$.props=n6.mergeEvaluated.props(G,M,$.props,O0.Name)}if($.items!==!0)if(V&&!V.dynamicItems){if(V.items!==void 0)$.items=n6.mergeEvaluated.items(G,V.items,$.items)}else{let M=G.var("items",O0._`${F}.evaluated.items`);$.items=n6.mergeEvaluated.items(G,M,$.items,O0.Name)}}}rJ.callRef=r6;rJ.default=xL});var aJ=N((tJ)=>{Object.defineProperty(tJ,"__esModule",{value:!0});var gL=cJ(),uL=oJ(),hL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",gL.default,uL.default];tJ.default=hL});var eJ=N((sJ)=>{Object.defineProperty(sJ,"__esModule",{value:!0});var d6=v(),U1=d6.operators,o6={maximum:{okStr:"<=",ok:U1.LTE,fail:U1.GT},minimum:{okStr:">=",ok:U1.GTE,fail:U1.LT},exclusiveMaximum:{okStr:"<",ok:U1.LT,fail:U1.GTE},exclusiveMinimum:{okStr:">",ok:U1.GT,fail:U1.LTE}},lL={message:({keyword:Q,schemaCode:X})=>d6.str`must be ${o6[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>d6._`{comparison: ${o6[Q].okStr}, limit: ${X}}`},mL={keyword:Object.keys(o6),type:"number",schemaType:"number",$data:!0,error:lL,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(d6._`${Y} ${o6[X].fail} ${W} || isNaN(${Y})`)}};sJ.default=mL});var Xz=N((Qz)=>{Object.defineProperty(Qz,"__esModule",{value:!0});var S4=v(),pL={message:({schemaCode:Q})=>S4.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>S4._`{multipleOf: ${Q}}`},iL={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:pL,code(Q){let{gen:X,data:Y,schemaCode:W,it:G}=Q,$=G.opts.multipleOfPrecision,J=X.let("res"),z=$?S4._`Math.abs(Math.round(${J}) - ${J}) > 1e-${$}`:S4._`${J} !== parseInt(${J})`;Q.fail$data(S4._`(${W} === 0 || (${J} = ${Y}/${W}, ${z}))`)}};Qz.default=iL});var Gz=N((Wz)=>{Object.defineProperty(Wz,"__esModule",{value:!0});function Yz(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}Wz.default=Yz;Yz.code='require("ajv/dist/runtime/ucs2length").default'});var Jz=N(($z)=>{Object.defineProperty($z,"__esModule",{value:!0});var M1=v(),dL=f(),oL=Gz(),tL={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return M1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>M1._`{limit: ${Q}}`},aL={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:tL,code(Q){let{keyword:X,data:Y,schemaCode:W,it:G}=Q,$=X==="maxLength"?M1.operators.GT:M1.operators.LT,J=G.opts.unicode===!1?M1._`${Y}.length`:M1._`${(0,dL.useFunc)(Q.gen,oL.default)}(${Y})`;Q.fail$data(M1._`${J} ${$} ${W}`)}};$z.default=aL});var Hz=N((zz)=>{Object.defineProperty(zz,"__esModule",{value:!0});var eL=j0(),t6=v(),Qq={message:({schemaCode:Q})=>t6.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>t6._`{pattern: ${Q}}`},Xq={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Qq,code(Q){let{data:X,$data:Y,schema:W,schemaCode:G,it:$}=Q,J=$.opts.unicodeRegExp?"u":"",z=Y?t6._`(new RegExp(${G}, ${J}))`:(0,eL.usePattern)(Q,W);Q.fail$data(t6._`!${z}.test(${X})`)}};zz.default=Xq});var Az=N((Uz)=>{Object.defineProperty(Uz,"__esModule",{value:!0});var R4=v(),Wq={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return R4.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>R4._`{limit: ${Q}}`},Gq={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Wq,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxProperties"?R4.operators.GT:R4.operators.LT;Q.fail$data(R4._`Object.keys(${Y}).length ${G} ${W}`)}};Uz.default=Gq});var Bz=N((Kz)=>{Object.defineProperty(Kz,"__esModule",{value:!0});var C4=j0(),k4=v(),Jq=f(),zq={message:({params:{missingProperty:Q}})=>k4.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>k4._`{missingProperty: ${Q}}`},Hq={keyword:"required",type:"object",schemaType:"array",$data:!0,error:zq,code(Q){let{gen:X,schema:Y,schemaCode:W,data:G,$data:$,it:J}=Q,{opts:z}=J;if(!$&&Y.length===0)return;let H=Y.length>=z.loopRequired;if(J.allErrors)U();else A();if(z.strictRequired){let L=Q.parentSchema.properties,{definedProperties:F}=Q.it;for(let O of Y)if((L===null||L===void 0?void 0:L[O])===void 0&&!F.has(O)){let V=J.schemaEnv.baseId+J.errSchemaPath,M=`required property "${O}" is not defined at "${V}" (strictRequired)`;(0,Jq.checkStrictMode)(J,M,J.opts.strictRequired)}}function U(){if(H||$)Q.block$data(k4.nil,K);else for(let L of Y)(0,C4.checkReportMissingProp)(Q,L)}function A(){let L=X.let("missing");if(H||$){let F=X.let("valid",!0);Q.block$data(F,()=>B(L,F)),Q.ok(F)}else X.if((0,C4.checkMissingProp)(Q,Y,L)),(0,C4.reportMissingProp)(Q,L),X.else()}function K(){X.forOf("prop",W,(L)=>{Q.setParams({missingProperty:L}),X.if((0,C4.noPropertyInData)(X,G,L,z.ownProperties),()=>Q.error())})}function B(L,F){Q.setParams({missingProperty:L}),X.forOf(L,W,()=>{X.assign(F,(0,C4.propertyInData)(X,G,L,z.ownProperties)),X.if((0,k4.not)(F),()=>{Q.error(),X.break()})},k4.nil)}}};Kz.default=Hq});var Lz=N((Dz)=>{Object.defineProperty(Dz,"__esModule",{value:!0});var v4=v(),Aq={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return v4.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>v4._`{limit: ${Q}}`},Kq={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Aq,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxItems"?v4.operators.GT:v4.operators.LT;Q.fail$data(v4._`${Y}.length ${G} ${W}`)}};Dz.default=Kq});var a6=N((Fz)=>{Object.defineProperty(Fz,"__esModule",{value:!0});var qz=f9();qz.code='require("ajv/dist/runtime/equal").default';Fz.default=qz});var Mz=N((Oz)=>{Object.defineProperty(Oz,"__esModule",{value:!0});var YX=V4(),H0=v(),Lq=f(),qq=a6(),Fq={message:({params:{i:Q,j:X}})=>H0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>H0._`{i: ${Q}, j: ${X}}`},Oq={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Fq,code(Q){let{gen:X,data:Y,$data:W,schema:G,parentSchema:$,schemaCode:J,it:z}=Q;if(!W&&!G)return;let H=X.let("valid"),U=$.items?(0,YX.getSchemaTypes)($.items):[];Q.block$data(H,A,H0._`${J} === false`),Q.ok(H);function A(){let F=X.let("i",H0._`${Y}.length`),O=X.let("j");Q.setParams({i:F,j:O}),X.assign(H,!0),X.if(H0._`${F} > 1`,()=>(K()?B:L)(F,O))}function K(){return U.length>0&&!U.some((F)=>F==="object"||F==="array")}function B(F,O){let V=X.name("item"),M=(0,YX.checkDataTypes)(U,V,z.opts.strictNumbers,YX.DataType.Wrong),S=X.const("indices",H0._`{}`);X.for(H0._`;${F}--;`,()=>{if(X.let(V,H0._`${Y}[${F}]`),X.if(M,H0._`continue`),U.length>1)X.if(H0._`typeof ${V} == "string"`,H0._`${V} += "_"`);X.if(H0._`typeof ${S}[${V}] == "number"`,()=>{X.assign(O,H0._`${S}[${V}]`),Q.error(),X.assign(H,!1).break()}).code(H0._`${S}[${V}] = ${F}`)})}function L(F,O){let V=(0,Lq.useFunc)(X,qq.default),M=X.name("outer");X.label(M).for(H0._`;${F}--;`,()=>X.for(H0._`${O} = ${F}; ${O}--;`,()=>X.if(H0._`${V}(${Y}[${F}], ${Y}[${O}])`,()=>{Q.error(),X.assign(H,!1).break(M)})))}}};Oz.default=Oq});var Zz=N((Vz)=>{Object.defineProperty(Vz,"__esModule",{value:!0});var WX=v(),Vq=f(),Zq=a6(),Nq={message:"must be equal to constant",params:({schemaCode:Q})=>WX._`{allowedValue: ${Q}}`},wq={keyword:"const",$data:!0,error:Nq,code(Q){let{gen:X,data:Y,$data:W,schemaCode:G,schema:$}=Q;if(W||$&&typeof $=="object")Q.fail$data(WX._`!${(0,Vq.useFunc)(X,Zq.default)}(${Y}, ${G})`);else Q.fail(WX._`${$} !== ${Y}`)}};Vz.default=wq});var wz=N((Nz)=>{Object.defineProperty(Nz,"__esModule",{value:!0});var x4=v(),Pq=f(),jq=a6(),Iq={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>x4._`{allowedValues: ${Q}}`},Eq={keyword:"enum",schemaType:"array",$data:!0,error:Iq,code(Q){let{gen:X,data:Y,$data:W,schema:G,schemaCode:$,it:J}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let z=G.length>=J.opts.loopEnum,H,U=()=>H!==null&&H!==void 0?H:H=(0,Pq.useFunc)(X,jq.default),A;if(z||W)A=X.let("valid"),Q.block$data(A,K);else{if(!Array.isArray(G))throw Error("ajv implementation error");let L=X.const("vSchema",$);A=(0,x4.or)(...G.map((F,O)=>B(L,O)))}Q.pass(A);function K(){X.assign(A,!1),X.forOf("v",$,(L)=>X.if(x4._`${U()}(${Y}, ${L})`,()=>X.assign(A,!0).break()))}function B(L,F){let O=G[F];return typeof O==="object"&&O!==null?x4._`${U()}(${Y}, ${L}[${F}])`:x4._`${Y} === ${O}`}}};Nz.default=Eq});var Pz=N((bz)=>{Object.defineProperty(bz,"__esModule",{value:!0});var Sq=eJ(),Rq=Xz(),Cq=Jz(),kq=Hz(),vq=Az(),xq=Bz(),_q=Lz(),yq=Mz(),gq=Zz(),uq=wz(),hq=[Sq.default,Rq.default,Cq.default,kq.default,vq.default,xq.default,_q.default,yq.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},gq.default,uq.default];bz.default=hq});var $X=N((Iz)=>{Object.defineProperty(Iz,"__esModule",{value:!0});Iz.validateAdditionalItems=void 0;var V1=v(),GX=f(),lq={message:({params:{len:Q}})=>V1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>V1._`{limit: ${Q}}`},mq={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:lq,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,GX.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}jz(Q,W)}};function jz(Q,X){let{gen:Y,schema:W,data:G,keyword:$,it:J}=Q;J.items=!0;let z=Y.const("len",V1._`${G}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(V1._`${z} <= ${X.length}`);else if(typeof W=="object"&&!(0,GX.alwaysValidSchema)(J,W)){let U=Y.var("valid",V1._`${z} <= ${X.length}`);Y.if((0,V1.not)(U),()=>H(U)),Q.ok(U)}function H(U){Y.forRange("i",X.length,z,(A)=>{if(Q.subschema({keyword:$,dataProp:A,dataPropType:GX.Type.Num},U),!J.allErrors)Y.if((0,V1.not)(U),()=>Y.break())})}}Iz.validateAdditionalItems=jz;Iz.default=mq});var JX=N((Rz)=>{Object.defineProperty(Rz,"__esModule",{value:!0});Rz.validateTuple=void 0;var Tz=v(),s6=f(),pq=j0(),iq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return Sz(Q,"additionalItems",X);if(Y.items=!0,(0,s6.alwaysValidSchema)(Y,X))return;Q.ok((0,pq.validateArray)(Q))}};function Sz(Q,X,Y=Q.schema){let{gen:W,parentSchema:G,data:$,keyword:J,it:z}=Q;if(A(G),z.opts.unevaluated&&Y.length&&z.items!==!0)z.items=s6.mergeEvaluated.items(W,Y.length,z.items);let H=W.name("valid"),U=W.const("len",Tz._`${$}.length`);Y.forEach((K,B)=>{if((0,s6.alwaysValidSchema)(z,K))return;W.if(Tz._`${U} > ${B}`,()=>Q.subschema({keyword:J,schemaProp:B,dataProp:B},H)),Q.ok(H)});function A(K){let{opts:B,errSchemaPath:L}=z,F=Y.length,O=F===K.minItems&&(F===K.maxItems||K[X]===!1);if(B.strictTuples&&!O){let V=`"${J}" is ${F}-tuple, but minItems or maxItems/${X} are not specified or different at path "${L}"`;(0,s6.checkStrictMode)(z,V,B.strictTuples)}}}Rz.validateTuple=Sz;Rz.default=iq});var vz=N((kz)=>{Object.defineProperty(kz,"__esModule",{value:!0});var rq=JX(),dq={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,rq.validateTuple)(Q,"items")};kz.default=dq});var yz=N((_z)=>{Object.defineProperty(_z,"__esModule",{value:!0});var xz=v(),tq=f(),aq=j0(),sq=$X(),eq={message:({params:{len:Q}})=>xz.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>xz._`{limit: ${Q}}`},QF={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:eq,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:G}=Y;if(W.items=!0,(0,tq.alwaysValidSchema)(W,X))return;if(G)(0,sq.validateAdditionalItems)(Q,G);else Q.ok((0,aq.validateArray)(Q))}};_z.default=QF});var uz=N((gz)=>{Object.defineProperty(gz,"__esModule",{value:!0});var I0=v(),e6=f(),YF={message:({params:{min:Q,max:X}})=>X===void 0?I0.str`must contain at least ${Q} valid item(s)`:I0.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?I0._`{minContains: ${Q}}`:I0._`{minContains: ${Q}, maxContains: ${X}}`},WF={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:YF,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:$}=Q,J,z,{minContains:H,maxContains:U}=W;if($.opts.next)J=H===void 0?1:H,z=U;else J=1;let A=X.const("len",I0._`${G}.length`);if(Q.setParams({min:J,max:z}),z===void 0&&J===0){(0,e6.checkStrictMode)($,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(z!==void 0&&J>z){(0,e6.checkStrictMode)($,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,e6.alwaysValidSchema)($,Y)){let O=I0._`${A} >= ${J}`;if(z!==void 0)O=I0._`${O} && ${A} <= ${z}`;Q.pass(O);return}$.items=!0;let K=X.name("valid");if(z===void 0&&J===1)L(K,()=>X.if(K,()=>X.break()));else if(J===0){if(X.let(K,!0),z!==void 0)X.if(I0._`${G}.length > 0`,B)}else X.let(K,!1),B();Q.result(K,()=>Q.reset());function B(){let O=X.name("_valid"),V=X.let("count",0);L(O,()=>X.if(O,()=>F(V)))}function L(O,V){X.forRange("i",0,A,(M)=>{Q.subschema({keyword:"contains",dataProp:M,dataPropType:e6.Type.Num,compositeRule:!0},O),V()})}function F(O){if(X.code(I0._`${O}++`),z===void 0)X.if(I0._`${O} >= ${J}`,()=>X.assign(K,!0).break());else if(X.if(I0._`${O} > ${z}`,()=>X.assign(K,!1).break()),J===1)X.assign(K,!0);else X.if(I0._`${O} >= ${J}`,()=>X.assign(K,!0))}}};gz.default=WF});var pz=N((lz)=>{Object.defineProperty(lz,"__esModule",{value:!0});lz.validateSchemaDeps=lz.validatePropertyDeps=lz.error=void 0;var zX=v(),$F=f(),_4=j0();lz.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return zX.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>zX._`{property: ${Q},
|
|
6
|
+
|| ${J} === "boolean" || ${G} === null`).assign(z,C._`[${G}]`)}}}function pK({gen:Q,parentData:Y,parentDataProperty:X},W){Q.if(C._`${Y} !== undefined`,()=>Q.assign(C._`${Y}[${X}]`,W))}function yY(Q,Y,X,W=_1.Correct){let G=W===_1.Correct?C.operators.EQ:C.operators.NEQ,$;switch(Q){case"null":return C._`${Y} ${G} null`;case"array":$=C._`Array.isArray(${Y})`;break;case"object":$=C._`${Y} && typeof ${Y} == "object" && !Array.isArray(${Y})`;break;case"integer":$=J(C._`!(${Y} % 1) && !isNaN(${Y})`);break;case"number":$=J();break;default:return C._`typeof ${Y} ${G} ${Q}`}return W===_1.Correct?$:(0,C.not)($);function J(z=C.nil){return(0,C.and)(C._`typeof ${Y} == "number"`,z,X?C._`isFinite(${Y})`:C.nil)}}I$.checkDataType=yY;function gY(Q,Y,X,W){if(Q.length===1)return yY(Q[0],Y,X,W);let G,$=(0,w$.toHash)(Q);if($.array&&$.object){let J=C._`typeof ${Y} != "object"`;G=$.null?J:C._`!${Y} || ${J}`,delete $.null,delete $.array,delete $.object}else G=C.nil;if($.number)delete $.integer;for(let J in $)G=(0,C.and)(G,yY(J,Y,X,W));return G}I$.checkDataTypes=gY;var iK={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:Y})=>typeof Q=="string"?C._`{type: ${Q}}`:C._`{type: ${Y}}`};function uY(Q){let Y=rK(Q);(0,hK.reportError)(Y,iK)}I$.reportTypeError=uY;function rK(Q){let{gen:Y,data:X,schema:W}=Q,G=(0,w$.schemaRefOrVal)(Q,W,"type");return{gen:Y,keyword:"type",data:X,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var R$=Z((T$)=>{Object.defineProperty(T$,"__esModule",{value:!0});T$.assignDefaults=void 0;var y1=v(),eK=f();function QD(Q,Y){let{properties:X,items:W}=Q.schema;if(Y==="object"&&X)for(let G in X)E$(Q,G,X[G].default);else if(Y==="array"&&Array.isArray(W))W.forEach((G,$)=>E$(Q,$,G.default))}T$.assignDefaults=QD;function E$(Q,Y,X){let{gen:W,compositeRule:G,data:$,opts:J}=Q;if(X===void 0)return;let z=y1._`${$}${(0,y1.getProperty)(Y)}`;if(G){(0,eK.checkStrictMode)(Q,`default is ignored for: ${z}`);return}let H=y1._`${z} === undefined`;if(J.useDefaults==="empty")H=y1._`${H} || ${z} === null || ${z} === ""`;W.if(H,y1._`${z} = ${(0,y1.stringify)(X)}`)}});var I0=Z((v$)=>{Object.defineProperty(v$,"__esModule",{value:!0});v$.validateUnion=v$.validateArray=v$.usePattern=v$.callValidateCode=v$.schemaProperties=v$.allSchemaProperties=v$.noPropertyInData=v$.propertyInData=v$.isOwnProperty=v$.hasPropFunc=v$.reportMissingProp=v$.checkMissingProp=v$.checkReportMissingProp=void 0;var n=v(),hY=f(),A1=r0(),YD=f();function XD(Q,Y){let{gen:X,data:W,it:G}=Q;X.if(lY(X,W,Y,G.opts.ownProperties),()=>{Q.setParams({missingProperty:n._`${Y}`},!0),Q.error()})}v$.checkReportMissingProp=XD;function WD({gen:Q,data:Y,it:{opts:X}},W,G){return(0,n.or)(...W.map(($)=>(0,n.and)(lY(Q,Y,$,X.ownProperties),n._`${G} = ${$}`)))}v$.checkMissingProp=WD;function GD(Q,Y){Q.setParams({missingProperty:Y},!0),Q.error()}v$.reportMissingProp=GD;function C$(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:n._`Object.prototype.hasOwnProperty`})}v$.hasPropFunc=C$;function fY(Q,Y,X){return n._`${C$(Q)}.call(${Y}, ${X})`}v$.isOwnProperty=fY;function $D(Q,Y,X,W){let G=n._`${Y}${(0,n.getProperty)(X)} !== undefined`;return W?n._`${G} && ${fY(Q,Y,X)}`:G}v$.propertyInData=$D;function lY(Q,Y,X,W){let G=n._`${Y}${(0,n.getProperty)(X)} === undefined`;return W?(0,n.or)(G,(0,n.not)(fY(Q,Y,X))):G}v$.noPropertyInData=lY;function k$(Q){return Q?Object.keys(Q).filter((Y)=>Y!=="__proto__"):[]}v$.allSchemaProperties=k$;function JD(Q,Y){return k$(Y).filter((X)=>!(0,hY.alwaysValidSchema)(Q,Y[X]))}v$.schemaProperties=JD;function zD({schemaCode:Q,data:Y,it:{gen:X,topSchemaRef:W,schemaPath:G,errorPath:$},it:J},z,H,A){let U=A?n._`${Q}, ${Y}, ${W}${G}`:Y,K=[[A1.default.instancePath,(0,n.strConcat)(A1.default.instancePath,$)],[A1.default.parentData,J.parentData],[A1.default.parentDataProperty,J.parentDataProperty],[A1.default.rootData,A1.default.rootData]];if(J.opts.dynamicRef)K.push([A1.default.dynamicAnchors,A1.default.dynamicAnchors]);let D=n._`${U}, ${X.object(...K)}`;return H!==n.nil?n._`${z}.call(${H}, ${D})`:n._`${z}(${D})`}v$.callValidateCode=zD;var HD=n._`new RegExp`;function AD({gen:Q,it:{opts:Y}},X){let W=Y.unicodeRegExp?"u":"",{regExp:G}=Y.code,$=G(X,W);return Q.scopeValue("pattern",{key:$.toString(),ref:$,code:n._`${G.code==="new RegExp"?HD:(0,YD.useFunc)(Q,G)}(${X}, ${W})`})}v$.usePattern=AD;function UD(Q){let{gen:Y,data:X,keyword:W,it:G}=Q,$=Y.name("valid");if(G.allErrors){let z=Y.let("valid",!0);return J(()=>Y.assign(z,!1)),z}return Y.var($,!0),J(()=>Y.break()),$;function J(z){let H=Y.const("len",n._`${X}.length`);Y.forRange("i",0,H,(A)=>{Q.subschema({keyword:W,dataProp:A,dataPropType:hY.Type.Num},$),Y.if((0,n.not)($),z)})}}v$.validateArray=UD;function KD(Q){let{gen:Y,schema:X,keyword:W,it:G}=Q;if(!Array.isArray(X))throw Error("ajv implementation error");if(X.some((H)=>(0,hY.alwaysValidSchema)(G,H))&&!G.opts.unevaluated)return;let J=Y.let("valid",!1),z=Y.name("_valid");Y.block(()=>X.forEach((H,A)=>{let U=Q.subschema({keyword:W,schemaProp:A,compositeRule:!0},z);if(Y.assign(J,n._`${J} || ${z}`),!Q.mergeValidEvaluated(U,z))Y.if((0,n.not)(J))})),Q.result(J,()=>Q.reset(),()=>Q.error(!0))}v$.validateUnion=KD});var h$=Z((g$)=>{Object.defineProperty(g$,"__esModule",{value:!0});g$.validateKeywordUsage=g$.validSchemaType=g$.funcKeywordCode=g$.macroKeywordCode=void 0;var D0=v(),V1=r0(),PD=I0(),ID=V4();function jD(Q,Y){let{gen:X,keyword:W,schema:G,parentSchema:$,it:J}=Q,z=Y.macro.call(J.self,G,$,J),H=y$(X,W,z);if(J.opts.validateSchema!==!1)J.self.validateSchema(z,!0);let A=X.name("valid");Q.subschema({schema:z,schemaPath:D0.nil,errSchemaPath:`${J.errSchemaPath}/${W}`,topSchemaRef:H,compositeRule:!0},A),Q.pass(A,()=>Q.error(!0))}g$.macroKeywordCode=jD;function ED(Q,Y){var X;let{gen:W,keyword:G,schema:$,parentSchema:J,$data:z,it:H}=Q;SD(H,Y);let A=!z&&Y.compile?Y.compile.call(H.self,$,J,H):Y.validate,U=y$(W,G,A),K=W.let("valid");Q.block$data(K,D),Q.ok((X=Y.valid)!==null&&X!==void 0?X:K);function D(){if(Y.errors===!1){if(O(),Y.modifying)_$(Q);V(()=>Q.error())}else{let M=Y.async?L():q();if(Y.modifying)_$(Q);V(()=>TD(Q,M))}}function L(){let M=W.let("ruleErrs",null);return W.try(()=>O(D0._`await `),(S)=>W.assign(K,!1).if(D0._`${S} instanceof ${H.ValidationError}`,()=>W.assign(M,D0._`${S}.errors`),()=>W.throw(S))),M}function q(){let M=D0._`${U}.errors`;return W.assign(M,null),O(D0.nil),M}function O(M=Y.async?D0._`await `:D0.nil){let S=H.opts.passContext?V1.default.this:V1.default.self,E=!(("compile"in Y)&&!z||Y.schema===!1);W.assign(K,D0._`${M}${(0,PD.callValidateCode)(Q,U,S,E)}`,Y.modifying)}function V(M){var S;W.if((0,D0.not)((S=Y.valid)!==null&&S!==void 0?S:K),M)}}g$.funcKeywordCode=ED;function _$(Q){let{gen:Y,data:X,it:W}=Q;Y.if(W.parentData,()=>Y.assign(X,D0._`${W.parentData}[${W.parentDataProperty}]`))}function TD(Q,Y){let{gen:X}=Q;X.if(D0._`Array.isArray(${Y})`,()=>{X.assign(V1.default.vErrors,D0._`${V1.default.vErrors} === null ? ${Y} : ${V1.default.vErrors}.concat(${Y})`).assign(V1.default.errors,D0._`${V1.default.vErrors}.length`),(0,ID.extendErrors)(Q)},()=>Q.error())}function SD({schemaEnv:Q},Y){if(Y.async&&!Q.$async)throw Error("async keyword in sync schema")}function y$(Q,Y,X){if(X===void 0)throw Error(`keyword "${Y}" failed to compile`);return Q.scopeValue("keyword",typeof X=="function"?{ref:X}:{ref:X,code:(0,D0.stringify)(X)})}function RD(Q,Y,X=!1){return!Y.length||Y.some((W)=>W==="array"?Array.isArray(Q):W==="object"?Q&&typeof Q=="object"&&!Array.isArray(Q):typeof Q==W||X&&typeof Q>"u")}g$.validSchemaType=RD;function CD({schema:Q,opts:Y,self:X,errSchemaPath:W},G,$){if(Array.isArray(G.keyword)?!G.keyword.includes($):G.keyword!==$)throw Error("ajv implementation error");let J=G.dependencies;if(J===null||J===void 0?void 0:J.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[$])){let H=`keyword "${$}" value is invalid at path "${W}": `+X.errorsText(G.validateSchema.errors);if(Y.validateSchema==="log")X.logger.error(H);else throw Error(H)}}}g$.validateKeywordUsage=CD});var c$=Z((l$)=>{Object.defineProperty(l$,"__esModule",{value:!0});l$.extendSubschemaMode=l$.extendSubschemaData=l$.getSubschema=void 0;var y0=v(),f$=f();function _D(Q,{keyword:Y,schemaProp:X,schema:W,schemaPath:G,errSchemaPath:$,topSchemaRef:J}){if(Y!==void 0&&W!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(Y!==void 0){let z=Q.schema[Y];return X===void 0?{schema:z,schemaPath:y0._`${Q.schemaPath}${(0,y0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}`}:{schema:z[X],schemaPath:y0._`${Q.schemaPath}${(0,y0.getProperty)(Y)}${(0,y0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${Y}/${(0,f$.escapeFragment)(X)}`}}if(W!==void 0){if(G===void 0||$===void 0||J===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:J,errSchemaPath:$}}throw Error('either "keyword" or "schema" must be passed')}l$.getSubschema=_D;function yD(Q,Y,{dataProp:X,dataPropType:W,data:G,dataTypes:$,propertyName:J}){if(G!==void 0&&X!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:z}=Y;if(X!==void 0){let{errorPath:A,dataPathArr:U,opts:K}=Y,D=z.let("data",y0._`${Y.data}${(0,y0.getProperty)(X)}`,!0);H(D),Q.errorPath=y0.str`${A}${(0,f$.getErrorPath)(X,W,K.jsPropertySyntax)}`,Q.parentDataProperty=y0._`${X}`,Q.dataPathArr=[...U,Q.parentDataProperty]}if(G!==void 0){let A=G instanceof y0.Name?G:z.let("data",G,!0);if(H(A),J!==void 0)Q.propertyName=J}if($)Q.dataTypes=$;function H(A){Q.data=A,Q.dataLevel=Y.dataLevel+1,Q.dataTypes=[],Y.definedProperties=new Set,Q.parentData=Y.data,Q.dataNames=[...Y.dataNames,A]}}l$.extendSubschemaData=yD;function gD(Q,{jtdDiscriminator:Y,jtdMetadata:X,compositeRule:W,createErrors:G,allErrors:$}){if(W!==void 0)Q.compositeRule=W;if(G!==void 0)Q.createErrors=G;if($!==void 0)Q.allErrors=$;Q.jtdDiscriminator=Y,Q.jtdMetadata=X}l$.extendSubschemaMode=gD});var mY=Z((rP,p$)=>{p$.exports=function Q(Y,X){if(Y===X)return!0;if(Y&&X&&typeof Y=="object"&&typeof X=="object"){if(Y.constructor!==X.constructor)return!1;var W,G,$;if(Array.isArray(Y)){if(W=Y.length,W!=X.length)return!1;for(G=W;G--!==0;)if(!Q(Y[G],X[G]))return!1;return!0}if(Y.constructor===RegExp)return Y.source===X.source&&Y.flags===X.flags;if(Y.valueOf!==Object.prototype.valueOf)return Y.valueOf()===X.valueOf();if(Y.toString!==Object.prototype.toString)return Y.toString()===X.toString();if($=Object.keys(Y),W=$.length,W!==Object.keys(X).length)return!1;for(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(X,$[G]))return!1;for(G=W;G--!==0;){var J=$[G];if(!Q(Y[J],X[J]))return!1}return!0}return Y!==Y&&X!==X}});var r$=Z((nP,i$)=>{var U1=i$.exports=function(Q,Y,X){if(typeof Y=="function")X=Y,Y={};X=Y.cb||X;var W=typeof X=="function"?X:X.pre||function(){},G=X.post||function(){};yQ(Y,W,G,Q,"",Q)};U1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};U1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};U1.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};U1.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 yQ(Q,Y,X,W,G,$,J,z,H,A){if(W&&typeof W=="object"&&!Array.isArray(W)){Y(W,G,$,J,z,H,A);for(var U in W){var K=W[U];if(Array.isArray(K)){if(U in U1.arrayKeywords)for(var D=0;D<K.length;D++)yQ(Q,Y,X,K[D],G+"/"+U+"/"+D,$,G,U,W,D)}else if(U in U1.propsKeywords){if(K&&typeof K=="object")for(var L in K)yQ(Q,Y,X,K[L],G+"/"+U+"/"+fD(L),$,G,U,W,L)}else if(U in U1.keywords||Q.allKeys&&!(U in U1.skipKeywords))yQ(Q,Y,X,K,G+"/"+U,$,G,U,W)}X(W,G,$,J,z,H,A)}}function fD(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var Z4=Z((t$)=>{Object.defineProperty(t$,"__esModule",{value:!0});t$.getSchemaRefs=t$.resolveUrl=t$.normalizeId=t$._getFullPath=t$.getFullPath=t$.inlineRef=void 0;var lD=f(),mD=mY(),cD=r$(),pD=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function iD(Q,Y=!0){if(typeof Q=="boolean")return!0;if(Y===!0)return!cY(Q);if(!Y)return!1;return n$(Q)<=Y}t$.inlineRef=iD;var rD=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function cY(Q){for(let Y in Q){if(rD.has(Y))return!0;let X=Q[Y];if(Array.isArray(X)&&X.some(cY))return!0;if(typeof X=="object"&&cY(X))return!0}return!1}function n$(Q){let Y=0;for(let X in Q){if(X==="$ref")return 1/0;if(Y++,pD.has(X))continue;if(typeof Q[X]=="object")(0,lD.eachItem)(Q[X],(W)=>Y+=n$(W));if(Y===1/0)return 1/0}return Y}function d$(Q,Y="",X){if(X!==!1)Y=g1(Y);let W=Q.parse(Y);return o$(Q,W)}t$.getFullPath=d$;function o$(Q,Y){return Q.serialize(Y).split("#")[0]+"#"}t$._getFullPath=o$;var nD=/#\/?$/;function g1(Q){return Q?Q.replace(nD,""):""}t$.normalizeId=g1;function dD(Q,Y,X){return X=g1(X),Q.resolve(Y,X)}t$.resolveUrl=dD;var oD=/^[a-z_][-a-z0-9._]*$/i;function tD(Q,Y){if(typeof Q=="boolean")return{};let{schemaId:X,uriResolver:W}=this.opts,G=g1(Q[X]||Y),$={"":G},J=d$(W,G,!1),z={},H=new Set;return cD(Q,{allKeys:!0},(K,D,L,q)=>{if(q===void 0)return;let O=J+D,V=$[q];if(typeof K[X]=="string")V=M.call(this,K[X]);S.call(this,K.$anchor),S.call(this,K.$dynamicAnchor),$[D]=V;function M(E){let x=this.opts.uriResolver.resolve;if(E=g1(V?x(V,E):E),H.has(E))throw U(E);H.add(E);let T=this.refs[E];if(typeof T=="string")T=this.refs[T];if(typeof T=="object")A(K,T.schema,E);else if(E!==g1(O))if(E[0]==="#")A(K,z[E],E),z[E]=K;else this.refs[E]=O;return E}function S(E){if(typeof E=="string"){if(!oD.test(E))throw Error(`invalid anchor "${E}"`);M.call(this,`#${E}`)}}}),z;function A(K,D,L){if(D!==void 0&&!mD(K,D))throw U(L)}function U(K){return Error(`reference "${K}" resolves to more than one schema`)}}t$.getSchemaRefs=tD});var P4=Z((DJ)=>{Object.defineProperty(DJ,"__esModule",{value:!0});DJ.getData=DJ.KeywordCxt=DJ.validateFunctionCode=void 0;var XJ=F$(),s$=N4(),iY=_Y(),gQ=N4(),XB=R$(),b4=h$(),pY=c$(),P=v(),R=r0(),WB=Z4(),n0=f(),w4=V4();function GB(Q){if($J(Q)){if(JJ(Q),GJ(Q)){zB(Q);return}}WJ(Q,()=>(0,XJ.topBoolOrEmptySchema)(Q))}DJ.validateFunctionCode=GB;function WJ({gen:Q,validateName:Y,schema:X,schemaEnv:W,opts:G},$){if(G.code.es5)Q.func(Y,P._`${R.default.data}, ${R.default.valCxt}`,W.$async,()=>{Q.code(P._`"use strict"; ${e$(X,G)}`),JB(Q,G),Q.code($)});else Q.func(Y,P._`${R.default.data}, ${$B(G)}`,W.$async,()=>Q.code(e$(X,G)).code($))}function $B(Q){return P._`{${R.default.instancePath}="", ${R.default.parentData}, ${R.default.parentDataProperty}, ${R.default.rootData}=${R.default.data}${Q.dynamicRef?P._`, ${R.default.dynamicAnchors}={}`:P.nil}}={}`}function JB(Q,Y){Q.if(R.default.valCxt,()=>{if(Q.var(R.default.instancePath,P._`${R.default.valCxt}.${R.default.instancePath}`),Q.var(R.default.parentData,P._`${R.default.valCxt}.${R.default.parentData}`),Q.var(R.default.parentDataProperty,P._`${R.default.valCxt}.${R.default.parentDataProperty}`),Q.var(R.default.rootData,P._`${R.default.valCxt}.${R.default.rootData}`),Y.dynamicRef)Q.var(R.default.dynamicAnchors,P._`${R.default.valCxt}.${R.default.dynamicAnchors}`)},()=>{if(Q.var(R.default.instancePath,P._`""`),Q.var(R.default.parentData,P._`undefined`),Q.var(R.default.parentDataProperty,P._`undefined`),Q.var(R.default.rootData,R.default.data),Y.dynamicRef)Q.var(R.default.dynamicAnchors,P._`{}`)})}function zB(Q){let{schema:Y,opts:X,gen:W}=Q;WJ(Q,()=>{if(X.$comment&&Y.$comment)HJ(Q);if(DB(Q),W.let(R.default.vErrors,null),W.let(R.default.errors,0),X.unevaluated)HB(Q);zJ(Q),FB(Q)});return}function HB(Q){let{gen:Y,validateName:X}=Q;Q.evaluated=Y.const("evaluated",P._`${X}.evaluated`),Y.if(P._`${Q.evaluated}.dynamicProps`,()=>Y.assign(P._`${Q.evaluated}.props`,P._`undefined`)),Y.if(P._`${Q.evaluated}.dynamicItems`,()=>Y.assign(P._`${Q.evaluated}.items`,P._`undefined`))}function e$(Q,Y){let X=typeof Q=="object"&&Q[Y.schemaId];return X&&(Y.code.source||Y.code.process)?P._`/*# sourceURL=${X} */`:P.nil}function AB(Q,Y){if($J(Q)){if(JJ(Q),GJ(Q)){UB(Q,Y);return}}(0,XJ.boolOrEmptySchema)(Q,Y)}function GJ({schema:Q,self:Y}){if(typeof Q=="boolean")return!Q;for(let X in Q)if(Y.RULES.all[X])return!0;return!1}function $J(Q){return typeof Q.schema!="boolean"}function UB(Q,Y){let{schema:X,gen:W,opts:G}=Q;if(G.$comment&&X.$comment)HJ(Q);BB(Q),LB(Q);let $=W.const("_errs",R.default.errors);zJ(Q,$),W.var(Y,P._`${$} === ${R.default.errors}`)}function JJ(Q){(0,n0.checkUnknownRules)(Q),KB(Q)}function zJ(Q,Y){if(Q.opts.jtd)return QJ(Q,[],!1,Y);let X=(0,s$.getSchemaTypes)(Q.schema),W=(0,s$.coerceAndCheckDataType)(Q,X);QJ(Q,X,!W,Y)}function KB(Q){let{schema:Y,errSchemaPath:X,opts:W,self:G}=Q;if(Y.$ref&&W.ignoreKeywordsWithRef&&(0,n0.schemaHasRulesButRef)(Y,G.RULES))G.logger.warn(`$ref: keywords ignored in schema at path "${X}"`)}function DB(Q){let{schema:Y,opts:X}=Q;if(Y.default!==void 0&&X.useDefaults&&X.strictSchema)(0,n0.checkStrictMode)(Q,"default is ignored in the schema root")}function BB(Q){let Y=Q.schema[Q.opts.schemaId];if(Y)Q.baseId=(0,WB.resolveUrl)(Q.opts.uriResolver,Q.baseId,Y)}function LB(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function HJ({gen:Q,schemaEnv:Y,schema:X,errSchemaPath:W,opts:G}){let $=X.$comment;if(G.$comment===!0)Q.code(P._`${R.default.self}.logger.log(${$})`);else if(typeof G.$comment=="function"){let J=P.str`${W}/$comment`,z=Q.scopeValue("root",{ref:Y.root});Q.code(P._`${R.default.self}.opts.$comment(${$}, ${J}, ${z}.schema)`)}}function FB(Q){let{gen:Y,schemaEnv:X,validateName:W,ValidationError:G,opts:$}=Q;if(X.$async)Y.if(P._`${R.default.errors} === 0`,()=>Y.return(R.default.data),()=>Y.throw(P._`new ${G}(${R.default.vErrors})`));else{if(Y.assign(P._`${W}.errors`,R.default.vErrors),$.unevaluated)qB(Q);Y.return(P._`${R.default.errors} === 0`)}}function qB({gen:Q,evaluated:Y,props:X,items:W}){if(X instanceof P.Name)Q.assign(P._`${Y}.props`,X);if(W instanceof P.Name)Q.assign(P._`${Y}.items`,W)}function QJ(Q,Y,X,W){let{gen:G,schema:$,data:J,allErrors:z,opts:H,self:A}=Q,{RULES:U}=A;if($.$ref&&(H.ignoreKeywordsWithRef||!(0,n0.schemaHasRulesButRef)($,U))){G.block(()=>UJ(Q,"$ref",U.all.$ref.definition));return}if(!H.jtd)OB(Q,Y);G.block(()=>{for(let D of U.rules)K(D);K(U.post)});function K(D){if(!(0,iY.shouldUseGroup)($,D))return;if(D.type){if(G.if((0,gQ.checkDataType)(D.type,J,H.strictNumbers)),YJ(Q,D),Y.length===1&&Y[0]===D.type&&X)G.else(),(0,gQ.reportTypeError)(Q);G.endIf()}else YJ(Q,D);if(!z)G.if(P._`${R.default.errors} === ${W||0}`)}}function YJ(Q,Y){let{gen:X,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,XB.assignDefaults)(Q,Y.type);X.block(()=>{for(let $ of Y.rules)if((0,iY.shouldUseRule)(W,$))UJ(Q,$.keyword,$.definition,Y.type)})}function OB(Q,Y){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(MB(Q,Y),!Q.opts.allowUnionTypes)VB(Q,Y);NB(Q,Q.dataTypes)}function MB(Q,Y){if(!Y.length)return;if(!Q.dataTypes.length){Q.dataTypes=Y;return}Y.forEach((X)=>{if(!AJ(Q.dataTypes,X))rY(Q,`type "${X}" not allowed by context "${Q.dataTypes.join(",")}"`)}),wB(Q,Y)}function VB(Q,Y){if(Y.length>1&&!(Y.length===2&&Y.includes("null")))rY(Q,"use allowUnionTypes to allow union type keyword")}function NB(Q,Y){let X=Q.self.RULES.all;for(let W in X){let G=X[W];if(typeof G=="object"&&(0,iY.shouldUseRule)(Q.schema,G)){let{type:$}=G.definition;if($.length&&!$.some((J)=>ZB(Y,J)))rY(Q,`missing type "${$.join(",")}" for keyword "${W}"`)}}}function ZB(Q,Y){return Q.includes(Y)||Y==="number"&&Q.includes("integer")}function AJ(Q,Y){return Q.includes(Y)||Y==="integer"&&Q.includes("number")}function wB(Q,Y){let X=[];for(let W of Q.dataTypes)if(AJ(Y,W))X.push(W);else if(Y.includes("integer")&&W==="number")X.push("integer");Q.dataTypes=X}function rY(Q,Y){let X=Q.schemaEnv.baseId+Q.errSchemaPath;Y+=` at "${X}" (strictTypes)`,(0,n0.checkStrictMode)(Q,Y,Q.opts.strictTypes)}class nY{constructor(Q,Y,X){if((0,b4.validateKeywordUsage)(Q,Y,X),this.gen=Q.gen,this.allErrors=Q.allErrors,this.keyword=X,this.data=Q.data,this.schema=Q.schema[X],this.$data=Y.$data&&Q.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,n0.schemaRefOrVal)(Q,this.schema,X,this.$data),this.schemaType=Y.schemaType,this.parentSchema=Q.schema,this.params={},this.it=Q,this.def=Y,this.$data)this.schemaCode=Q.gen.const("vSchema",KJ(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,b4.validSchemaType)(this.schema,Y.schemaType,Y.allowUndefined))throw Error(`${X} value must be ${JSON.stringify(Y.schemaType)}`);if("code"in Y?Y.trackErrors:Y.errors!==!1)this.errsCount=Q.gen.const("_errs",R.default.errors)}result(Q,Y,X){this.failResult((0,P.not)(Q),Y,X)}failResult(Q,Y,X){if(this.gen.if(Q),X)X();else this.error();if(Y){if(this.gen.else(),Y(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(Q,Y){this.failResult((0,P.not)(Q),void 0,Y)}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:Y}=this;this.fail(P._`${Y} !== undefined && (${(0,P.or)(this.invalid$data(),Q)})`)}error(Q,Y,X){if(Y){this.setParams(Y),this._error(Q,X),this.setParams({});return}this._error(Q,X)}_error(Q,Y){(Q?w4.reportExtraError:w4.reportError)(this,this.def.error,Y)}$dataError(){(0,w4.reportError)(this,this.def.$dataError||w4.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,w4.resetErrorsCount)(this.gen,this.errsCount)}ok(Q){if(!this.allErrors)this.gen.if(Q)}setParams(Q,Y){if(Y)Object.assign(this.params,Q);else this.params=Q}block$data(Q,Y,X=P.nil){this.gen.block(()=>{this.check$data(Q,X),Y()})}check$data(Q=P.nil,Y=P.nil){if(!this.$data)return;let{gen:X,schemaCode:W,schemaType:G,def:$}=this;if(X.if((0,P.or)(P._`${W} === undefined`,Y)),Q!==P.nil)X.assign(Q,!0);if(G.length||$.validateSchema){if(X.elseIf(this.invalid$data()),this.$dataError(),Q!==P.nil)X.assign(Q,!1)}X.else()}invalid$data(){let{gen:Q,schemaCode:Y,schemaType:X,def:W,it:G}=this;return(0,P.or)($(),J());function $(){if(X.length){if(!(Y instanceof P.Name))throw Error("ajv implementation error");let z=Array.isArray(X)?X:[X];return P._`${(0,gQ.checkDataTypes)(z,Y,G.opts.strictNumbers,gQ.DataType.Wrong)}`}return P.nil}function J(){if(W.validateSchema){let z=Q.scopeValue("validate$data",{ref:W.validateSchema});return P._`!${z}(${Y})`}return P.nil}}subschema(Q,Y){let X=(0,pY.getSubschema)(this.it,Q);(0,pY.extendSubschemaData)(X,this.it,Q),(0,pY.extendSubschemaMode)(X,Q);let W={...this.it,...X,items:void 0,props:void 0};return AB(W,Y),W}mergeEvaluated(Q,Y){let{it:X,gen:W}=this;if(!X.opts.unevaluated)return;if(X.props!==!0&&Q.props!==void 0)X.props=n0.mergeEvaluated.props(W,Q.props,X.props,Y);if(X.items!==!0&&Q.items!==void 0)X.items=n0.mergeEvaluated.items(W,Q.items,X.items,Y)}mergeValidEvaluated(Q,Y){let{it:X,gen:W}=this;if(X.opts.unevaluated&&(X.props!==!0||X.items!==!0))return W.if(Y,()=>this.mergeEvaluated(Q,P.Name)),!0}}DJ.KeywordCxt=nY;function UJ(Q,Y,X,W){let G=new nY(Q,X,Y);if("code"in X)X.code(G,W);else if(G.$data&&X.validate)(0,b4.funcKeywordCode)(G,X);else if("macro"in X)(0,b4.macroKeywordCode)(G,X);else if(X.compile||X.validate)(0,b4.funcKeywordCode)(G,X)}var bB=/^\/(?:[^~]|~0|~1)*$/,PB=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function KJ(Q,{dataLevel:Y,dataNames:X,dataPathArr:W}){let G,$;if(Q==="")return R.default.rootData;if(Q[0]==="/"){if(!bB.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,$=R.default.rootData}else{let A=PB.exec(Q);if(!A)throw Error(`Invalid JSON-pointer: ${Q}`);let U=+A[1];if(G=A[2],G==="#"){if(U>=Y)throw Error(H("property/index",U));return W[Y-U]}if(U>Y)throw Error(H("data",U));if($=X[Y-U],!G)return $}let J=$,z=G.split("/");for(let A of z)if(A)$=P._`${$}${(0,P.getProperty)((0,n0.unescapeJsonPointer)(A))}`,J=P._`${J} && ${$}`;return J;function H(A,U){return`Cannot access ${A} ${U} levels up, current level is ${Y}`}}DJ.getData=KJ});var uQ=Z((FJ)=>{Object.defineProperty(FJ,"__esModule",{value:!0});class LJ extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}FJ.default=LJ});var I4=Z((OJ)=>{Object.defineProperty(OJ,"__esModule",{value:!0});var dY=Z4();class qJ extends Error{constructor(Q,Y,X,W){super(W||`can't resolve reference ${X} from id ${Y}`);this.missingRef=(0,dY.resolveUrl)(Q,Y,X),this.missingSchema=(0,dY.normalizeId)((0,dY.getFullPath)(Q,this.missingRef))}}OJ.default=qJ});var fQ=Z((NJ)=>{Object.defineProperty(NJ,"__esModule",{value:!0});NJ.resolveSchema=NJ.getCompilingSchema=NJ.resolveRef=NJ.compileSchema=NJ.SchemaEnv=void 0;var C0=v(),SB=uQ(),N1=r0(),k0=Z4(),MJ=f(),RB=P4();class j4{constructor(Q){var Y;this.refs={},this.dynamicAnchors={};let X;if(typeof Q.schema=="object")X=Q.schema;this.schema=Q.schema,this.schemaId=Q.schemaId,this.root=Q.root||this,this.baseId=(Y=Q.baseId)!==null&&Y!==void 0?Y:(0,k0.normalizeId)(X===null||X===void 0?void 0:X[Q.schemaId||"$id"]),this.schemaPath=Q.schemaPath,this.localRefs=Q.localRefs,this.meta=Q.meta,this.$async=X===null||X===void 0?void 0:X.$async,this.refs={}}}NJ.SchemaEnv=j4;function tY(Q){let Y=VJ.call(this,Q);if(Y)return Y;let X=(0,k0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:$}=this.opts,J=new C0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:$}),z;if(Q.$async)z=J.scopeValue("Error",{ref:SB.default,code:C0._`require("ajv/dist/runtime/validation_error").default`});let H=J.scopeName("validate");Q.validateName=H;let A={gen:J,allErrors:this.opts.allErrors,data:N1.default.data,parentData:N1.default.parentData,parentDataProperty:N1.default.parentDataProperty,dataNames:[N1.default.data],dataPathArr:[C0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:J.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,C0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:H,ValidationError:z,schema:Q.schema,schemaEnv:Q,rootId:X,baseId:Q.baseId||X,schemaPath:C0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:C0._`""`,opts:this.opts,self:this},U;try{this._compilations.add(Q),(0,RB.validateFunctionCode)(A),J.optimize(this.opts.code.optimize);let K=J.toString();if(U=`${J.scopeRefs(N1.default.scope)}return ${K}`,this.opts.code.process)U=this.opts.code.process(U,Q);let L=Function(`${N1.default.self}`,`${N1.default.scope}`,U)(this,this.scope.get());if(this.scope.value(H,{ref:L}),L.errors=null,L.schema=Q.schema,L.schemaEnv=Q,Q.$async)L.$async=!0;if(this.opts.code.source===!0)L.source={validateName:H,validateCode:K,scopeValues:J._values};if(this.opts.unevaluated){let{props:q,items:O}=A;if(L.evaluated={props:q instanceof C0.Name?void 0:q,items:O instanceof C0.Name?void 0:O,dynamicProps:q instanceof C0.Name,dynamicItems:O instanceof C0.Name},L.source)L.source.evaluated=(0,C0.stringify)(L.evaluated)}return Q.validate=L,Q}catch(K){if(delete Q.validate,delete Q.validateName,U)this.logger.error("Error compiling schema, function code:",U);throw K}finally{this._compilations.delete(Q)}}NJ.compileSchema=tY;function CB(Q,Y,X){var W;X=(0,k0.resolveUrl)(this.opts.uriResolver,Y,X);let G=Q.refs[X];if(G)return G;let $=xB.call(this,Q,X);if($===void 0){let J=(W=Q.localRefs)===null||W===void 0?void 0:W[X],{schemaId:z}=this.opts;if(J)$=new j4({schema:J,schemaId:z,root:Q,baseId:Y})}if($===void 0)return;return Q.refs[X]=kB.call(this,$)}NJ.resolveRef=CB;function kB(Q){if((0,k0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:tY.call(this,Q)}function VJ(Q){for(let Y of this._compilations)if(vB(Y,Q))return Y}NJ.getCompilingSchema=VJ;function vB(Q,Y){return Q.schema===Y.schema&&Q.root===Y.root&&Q.baseId===Y.baseId}function xB(Q,Y){let X;while(typeof(X=this.refs[Y])=="string")Y=X;return X||this.schemas[Y]||hQ.call(this,Q,Y)}function hQ(Q,Y){let X=this.opts.uriResolver.parse(Y),W=(0,k0._getFullPath)(this.opts.uriResolver,X),G=(0,k0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return oY.call(this,X,Q);let $=(0,k0.normalizeId)(W),J=this.refs[$]||this.schemas[$];if(typeof J=="string"){let z=hQ.call(this,Q,J);if(typeof(z===null||z===void 0?void 0:z.schema)!=="object")return;return oY.call(this,X,z)}if(typeof(J===null||J===void 0?void 0:J.schema)!=="object")return;if(!J.validate)tY.call(this,J);if($===(0,k0.normalizeId)(Y)){let{schema:z}=J,{schemaId:H}=this.opts,A=z[H];if(A)G=(0,k0.resolveUrl)(this.opts.uriResolver,G,A);return new j4({schema:z,schemaId:H,root:Q,baseId:G})}return oY.call(this,X,J)}NJ.resolveSchema=hQ;var _B=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function oY(Q,{baseId:Y,schema:X,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 X==="boolean")return;let H=X[(0,MJ.unescapeFragment)(z)];if(H===void 0)return;X=H;let A=typeof X==="object"&&X[this.opts.schemaId];if(!_B.has(z)&&A)Y=(0,k0.resolveUrl)(this.opts.uriResolver,Y,A)}let $;if(typeof X!="boolean"&&X.$ref&&!(0,MJ.schemaHasRulesButRef)(X,this.RULES)){let z=(0,k0.resolveUrl)(this.opts.uriResolver,Y,X.$ref);$=hQ.call(this,W,z)}let{schemaId:J}=this.opts;if($=$||new j4({schema:X,schemaId:J,root:W,baseId:Y}),$.schema!==$.root.schema)return $;return}});var wJ=Z((eP,fB)=>{fB.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 sY=Z((QI,jJ)=>{var lB=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),PJ=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 aY(Q){let Y="",X=0,W=0;for(W=0;W<Q.length;W++){if(X=Q[W].charCodeAt(0),X===48)continue;if(!(X>=48&&X<=57||X>=65&&X<=70||X>=97&&X<=102))return"";Y+=Q[W];break}for(W+=1;W<Q.length;W++){if(X=Q[W].charCodeAt(0),!(X>=48&&X<=57||X>=65&&X<=70||X>=97&&X<=102))return"";Y+=Q[W]}return Y}var mB=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function bJ(Q){return Q.length=0,!0}function cB(Q,Y,X){if(Q.length){let W=aY(Q);if(W!=="")Y.push(W);else return X.error=!0,!1;Q.length=0}return!0}function pB(Q){let Y=0,X={error:!1,address:"",zone:""},W=[],G=[],$=!1,J=!1,z=cB;for(let H=0;H<Q.length;H++){let A=Q[H];if(A==="["||A==="]")continue;if(A===":"){if($===!0)J=!0;if(!z(G,W,X))break;if(++Y>7){X.error=!0;break}if(H>0&&Q[H-1]===":")$=!0;W.push(":");continue}else if(A==="%"){if(!z(G,W,X))break;z=bJ}else{G.push(A);continue}}if(G.length)if(z===bJ)X.zone=G.join("");else if(J)W.push(G.join(""));else W.push(aY(G));return X.address=W.join(""),X}function IJ(Q){if(iB(Q,":")<2)return{host:Q,isIPV6:!1};let Y=pB(Q);if(!Y.error){let{address:X,address:W}=Y;if(Y.zone)X+="%"+Y.zone,W+="%25"+Y.zone;return{host:X,isIPV6:!0,escapedHost:W}}else return{host:Q,isIPV6:!1}}function iB(Q,Y){let X=0;for(let W=0;W<Q.length;W++)if(Q[W]===Y)X++;return X}function rB(Q){let Y=Q,X=[],W=-1,G=0;while(G=Y.length){if(G===1)if(Y===".")break;else if(Y==="/"){X.push("/");break}else{X.push(Y);break}else if(G===2){if(Y[0]==="."){if(Y[1]===".")break;else if(Y[1]==="/"){Y=Y.slice(2);continue}}else if(Y[0]==="/"){if(Y[1]==="."||Y[1]==="/"){X.push("/");break}}}else if(G===3){if(Y==="/.."){if(X.length!==0)X.pop();X.push("/");break}}if(Y[0]==="."){if(Y[1]==="."){if(Y[2]==="/"){Y=Y.slice(3);continue}}else if(Y[1]==="/"){Y=Y.slice(2);continue}}else if(Y[0]==="/"){if(Y[1]==="."){if(Y[2]==="/"){Y=Y.slice(2);continue}else if(Y[2]==="."){if(Y[3]==="/"){if(Y=Y.slice(3),X.length!==0)X.pop();continue}}}}if((W=Y.indexOf("/",1))===-1){X.push(Y);break}else X.push(Y.slice(0,W)),Y=Y.slice(W)}return X.join("")}function nB(Q,Y){let X=Y!==!0?escape:unescape;if(Q.scheme!==void 0)Q.scheme=X(Q.scheme);if(Q.userinfo!==void 0)Q.userinfo=X(Q.userinfo);if(Q.host!==void 0)Q.host=X(Q.host);if(Q.path!==void 0)Q.path=X(Q.path);if(Q.query!==void 0)Q.query=X(Q.query);if(Q.fragment!==void 0)Q.fragment=X(Q.fragment);return Q}function dB(Q){let Y=[];if(Q.userinfo!==void 0)Y.push(Q.userinfo),Y.push("@");if(Q.host!==void 0){let X=unescape(Q.host);if(!PJ(X)){let W=IJ(X);if(W.isIPV6===!0)X=`[${W.escapedHost}]`;else X=Q.host}Y.push(X)}if(typeof Q.port==="number"||typeof Q.port==="string")Y.push(":"),Y.push(String(Q.port));return Y.length?Y.join(""):void 0}jJ.exports={nonSimpleDomain:mB,recomposeAuthority:dB,normalizeComponentEncoding:nB,removeDotSegments:rB,isIPv4:PJ,isUUID:lB,normalizeIPv6:IJ,stringArrayToHexStripped:aY}});var CJ=Z((YI,RJ)=>{var{isUUID:oB}=sY(),tB=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,aB=["http","https","ws","wss","urn","urn:uuid"];function sB(Q){return aB.indexOf(Q)!==-1}function eY(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 EJ(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function TJ(Q){let Y=String(Q.scheme).toLowerCase()==="https";if(Q.port===(Y?443:80)||Q.port==="")Q.port=void 0;if(!Q.path)Q.path="/";return Q}function eB(Q){return Q.secure=eY(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function QL(Q){if(Q.port===(eY(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[Y,X]=Q.resourceName.split("?");Q.path=Y&&Y!=="/"?Y:void 0,Q.query=X,Q.resourceName=void 0}return Q.fragment=void 0,Q}function YL(Q,Y){if(!Q.path)return Q.error="URN can not be parsed",Q;let X=Q.path.match(tB);if(X){let W=Y.scheme||Q.scheme||"urn";Q.nid=X[1].toLowerCase(),Q.nss=X[2];let G=`${W}:${Y.nid||Q.nid}`,$=Q9(G);if(Q.path=void 0,$)Q=$.parse(Q,Y)}else Q.error=Q.error||"URN can not be parsed.";return Q}function XL(Q,Y){if(Q.nid===void 0)throw Error("URN without nid cannot be serialized");let X=Y.scheme||Q.scheme||"urn",W=Q.nid.toLowerCase(),G=`${X}:${Y.nid||W}`,$=Q9(G);if($)Q=$.serialize(Q,Y);let J=Q,z=Q.nss;return J.path=`${W||Y.nid}:${z}`,Y.skipEscape=!0,J}function WL(Q,Y){let X=Q;if(X.uuid=X.nss,X.nss=void 0,!Y.tolerant&&(!X.uuid||!oB(X.uuid)))X.error=X.error||"UUID is not valid.";return X}function GL(Q){let Y=Q;return Y.nss=(Q.uuid||"").toLowerCase(),Y}var SJ={scheme:"http",domainHost:!0,parse:EJ,serialize:TJ},$L={scheme:"https",domainHost:SJ.domainHost,parse:EJ,serialize:TJ},lQ={scheme:"ws",domainHost:!0,parse:eB,serialize:QL},JL={scheme:"wss",domainHost:lQ.domainHost,parse:lQ.parse,serialize:lQ.serialize},zL={scheme:"urn",parse:YL,serialize:XL,skipNormalize:!0},HL={scheme:"urn:uuid",parse:WL,serialize:GL,skipNormalize:!0},mQ={http:SJ,https:$L,ws:lQ,wss:JL,urn:zL,"urn:uuid":HL};Object.setPrototypeOf(mQ,null);function Q9(Q){return Q&&(mQ[Q]||mQ[Q.toLowerCase()])||void 0}RJ.exports={wsIsSecure:eY,SCHEMES:mQ,isValidSchemeName:sB,getSchemeHandler:Q9}});var xJ=Z((XI,pQ)=>{var{normalizeIPv6:AL,removeDotSegments:E4,recomposeAuthority:UL,normalizeComponentEncoding:cQ,isIPv4:KL,nonSimpleDomain:DL}=sY(),{SCHEMES:BL,getSchemeHandler:kJ}=CJ();function LL(Q,Y){if(typeof Q==="string")Q=g0(d0(Q,Y),Y);else if(typeof Q==="object")Q=d0(g0(Q,Y),Y);return Q}function FL(Q,Y,X){let W=X?Object.assign({scheme:"null"},X):{scheme:"null"},G=vJ(d0(Q,W),d0(Y,W),W,!0);return W.skipEscape=!0,g0(G,W)}function vJ(Q,Y,X,W){let G={};if(!W)Q=d0(g0(Q,X),X),Y=d0(g0(Y,X),X);if(X=X||{},!X.tolerant&&Y.scheme)G.scheme=Y.scheme,G.userinfo=Y.userinfo,G.host=Y.host,G.port=Y.port,G.path=E4(Y.path||""),G.query=Y.query;else{if(Y.userinfo!==void 0||Y.host!==void 0||Y.port!==void 0)G.userinfo=Y.userinfo,G.host=Y.host,G.port=Y.port,G.path=E4(Y.path||""),G.query=Y.query;else{if(!Y.path)if(G.path=Q.path,Y.query!==void 0)G.query=Y.query;else G.query=Q.query;else{if(Y.path[0]==="/")G.path=E4(Y.path);else{if((Q.userinfo!==void 0||Q.host!==void 0||Q.port!==void 0)&&!Q.path)G.path="/"+Y.path;else if(!Q.path)G.path=Y.path;else G.path=Q.path.slice(0,Q.path.lastIndexOf("/")+1)+Y.path;G.path=E4(G.path)}G.query=Y.query}G.userinfo=Q.userinfo,G.host=Q.host,G.port=Q.port}G.scheme=Q.scheme}return G.fragment=Y.fragment,G}function qL(Q,Y,X){if(typeof Q==="string")Q=unescape(Q),Q=g0(cQ(d0(Q,X),!0),{...X,skipEscape:!0});else if(typeof Q==="object")Q=g0(cQ(Q,!0),{...X,skipEscape:!0});if(typeof Y==="string")Y=unescape(Y),Y=g0(cQ(d0(Y,X),!0),{...X,skipEscape:!0});else if(typeof Y==="object")Y=g0(cQ(Y,!0),{...X,skipEscape:!0});return Q.toLowerCase()===Y.toLowerCase()}function g0(Q,Y){let X={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({},Y),G=[],$=kJ(W.scheme||X.scheme);if($&&$.serialize)$.serialize(X,W);if(X.path!==void 0)if(!W.skipEscape){if(X.path=escape(X.path),X.scheme!==void 0)X.path=X.path.split("%3A").join(":")}else X.path=unescape(X.path);if(W.reference!=="suffix"&&X.scheme)G.push(X.scheme,":");let J=UL(X);if(J!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push(J),X.path&&X.path[0]!=="/")G.push("/")}if(X.path!==void 0){let z=X.path;if(!W.absolutePath&&(!$||!$.absolutePath))z=E4(z);if(J===void 0&&z[0]==="/"&&z[1]==="/")z="/%2F"+z.slice(2);G.push(z)}if(X.query!==void 0)G.push("?",X.query);if(X.fragment!==void 0)G.push("#",X.fragment);return G.join("")}var OL=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function d0(Q,Y){let X=Object.assign({},Y),W={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},G=!1;if(X.reference==="suffix")if(X.scheme)Q=X.scheme+":"+Q;else Q="//"+Q;let $=Q.match(OL);if($){if(W.scheme=$[1],W.userinfo=$[3],W.host=$[4],W.port=parseInt($[5],10),W.path=$[6]||"",W.query=$[7],W.fragment=$[8],isNaN(W.port))W.port=$[5];if(W.host)if(KL(W.host)===!1){let H=AL(W.host);W.host=H.host.toLowerCase(),G=H.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(X.reference&&X.reference!=="suffix"&&X.reference!==W.reference)W.error=W.error||"URI is not a "+X.reference+" reference.";let J=kJ(X.scheme||W.scheme);if(!X.unicodeSupport&&(!J||!J.unicodeSupport)){if(W.host&&(X.domainHost||J&&J.domainHost)&&G===!1&&DL(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(!J||J&&!J.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(J&&J.parse)J.parse(W,X)}else W.error=W.error||"URI can not be parsed.";return W}var Y9={SCHEMES:BL,normalize:LL,resolve:FL,resolveComponent:vJ,equal:qL,serialize:g0,parse:d0};pQ.exports=Y9;pQ.exports.default=Y9;pQ.exports.fastUri=Y9});var gJ=Z((yJ)=>{Object.defineProperty(yJ,"__esModule",{value:!0});var _J=xJ();_J.code='require("ajv/dist/runtime/uri").default';yJ.default=_J});var iJ=Z((o0)=>{Object.defineProperty(o0,"__esModule",{value:!0});o0.CodeGen=o0.Name=o0.nil=o0.stringify=o0.str=o0._=o0.KeywordCxt=void 0;var VL=P4();Object.defineProperty(o0,"KeywordCxt",{enumerable:!0,get:function(){return VL.KeywordCxt}});var u1=v();Object.defineProperty(o0,"_",{enumerable:!0,get:function(){return u1._}});Object.defineProperty(o0,"str",{enumerable:!0,get:function(){return u1.str}});Object.defineProperty(o0,"stringify",{enumerable:!0,get:function(){return u1.stringify}});Object.defineProperty(o0,"nil",{enumerable:!0,get:function(){return u1.nil}});Object.defineProperty(o0,"Name",{enumerable:!0,get:function(){return u1.Name}});Object.defineProperty(o0,"CodeGen",{enumerable:!0,get:function(){return u1.CodeGen}});var NL=uQ(),mJ=I4(),ZL=xY(),T4=fQ(),wL=v(),S4=Z4(),iQ=N4(),W9=f(),uJ=wJ(),bL=gJ(),cJ=(Q,Y)=>new RegExp(Q,Y);cJ.code="new RegExp";var PL=["removeAdditional","useDefaults","coerceTypes"],IL=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),jL={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."},EL={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},hJ=200;function TL(Q){var Y,X,W,G,$,J,z,H,A,U,K,D,L,q,O,V,M,S,E,x,T,_0,f0,U6,K6;let c1=Q.strict,D6=(Y=Q.code)===null||Y===void 0?void 0:Y.optimize,v9=D6===!0||D6===void 0?1:D6||0,x9=(W=(X=Q.code)===null||X===void 0?void 0:X.regExp)!==null&&W!==void 0?W:cJ,I5=(G=Q.uriResolver)!==null&&G!==void 0?G:bL.default;return{strictSchema:(J=($=Q.strictSchema)!==null&&$!==void 0?$:c1)!==null&&J!==void 0?J:!0,strictNumbers:(H=(z=Q.strictNumbers)!==null&&z!==void 0?z:c1)!==null&&H!==void 0?H:!0,strictTypes:(U=(A=Q.strictTypes)!==null&&A!==void 0?A:c1)!==null&&U!==void 0?U:"log",strictTuples:(D=(K=Q.strictTuples)!==null&&K!==void 0?K:c1)!==null&&D!==void 0?D:"log",strictRequired:(q=(L=Q.strictRequired)!==null&&L!==void 0?L:c1)!==null&&q!==void 0?q:!1,code:Q.code?{...Q.code,optimize:v9,regExp:x9}:{optimize:v9,regExp:x9},loopRequired:(O=Q.loopRequired)!==null&&O!==void 0?O:hJ,loopEnum:(V=Q.loopEnum)!==null&&V!==void 0?V:hJ,meta:(M=Q.meta)!==null&&M!==void 0?M:!0,messages:(S=Q.messages)!==null&&S!==void 0?S:!0,inlineRefs:(E=Q.inlineRefs)!==null&&E!==void 0?E:!0,schemaId:(x=Q.schemaId)!==null&&x!==void 0?x:"$id",addUsedSchema:(T=Q.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(_0=Q.validateSchema)!==null&&_0!==void 0?_0:!0,validateFormats:(f0=Q.validateFormats)!==null&&f0!==void 0?f0:!0,unicodeRegExp:(U6=Q.unicodeRegExp)!==null&&U6!==void 0?U6:!0,int32range:(K6=Q.int32range)!==null&&K6!==void 0?K6:!0,uriResolver:I5}}class rQ{constructor(Q={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...TL(Q)};let{es5:Y,lines:X}=this.opts.code;this.scope=new wL.ValueScope({scope:{},prefixes:IL,es5:Y,lines:X}),this.logger=xL(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,ZL.getRules)(),fJ.call(this,jL,Q,"NOT SUPPORTED"),fJ.call(this,EL,Q,"DEPRECATED","warn"),this._metaOpts=kL.call(this),Q.formats)RL.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)CL.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);SL.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:Y,schemaId:X}=this.opts,W=uJ;if(X==="id")W={...uJ},W.id=W.$id,delete W.$id;if(Y&&Q)this.addMetaSchema(W,W[X],!1)}defaultMeta(){let{meta:Q,schemaId:Y}=this.opts;return this.opts.defaultMeta=typeof Q=="object"?Q[Y]||Q:void 0}validate(Q,Y){let X;if(typeof Q=="string"){if(X=this.getSchema(Q),!X)throw Error(`no schema with key or ref "${Q}"`)}else X=this.compile(Q);let W=X(Y);if(!("$async"in X))this.errors=X.errors;return W}compile(Q,Y){let X=this._addSchema(Q,Y);return X.validate||this._compileSchemaEnv(X)}compileAsync(Q,Y){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:X}=this.opts;return W.call(this,Q,Y);async function W(A,U){await G.call(this,A.$schema);let K=this._addSchema(A,U);return K.validate||$.call(this,K)}async function G(A){if(A&&!this.getSchema(A))await W.call(this,{$ref:A},!0)}async function $(A){try{return this._compileSchemaEnv(A)}catch(U){if(!(U instanceof mJ.default))throw U;return J.call(this,U),await z.call(this,U.missingSchema),$.call(this,A)}}function J({missingSchema:A,missingRef:U}){if(this.refs[A])throw Error(`AnySchema ${A} is loaded but ${U} cannot be resolved`)}async function z(A){let U=await H.call(this,A);if(!this.refs[A])await G.call(this,U.$schema);if(!this.refs[A])this.addSchema(U,A,Y)}async function H(A){let U=this._loading[A];if(U)return U;try{return await(this._loading[A]=X(A))}finally{delete this._loading[A]}}}addSchema(Q,Y,X,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let $ of Q)this.addSchema($,void 0,X,W);return this}let G;if(typeof Q==="object"){let{schemaId:$}=this.opts;if(G=Q[$],G!==void 0&&typeof G!="string")throw Error(`schema ${$} must be string`)}return Y=(0,S4.normalizeId)(Y||G),this._checkUnique(Y),this.schemas[Y]=this._addSchema(Q,X,Y,W,!0),this}addMetaSchema(Q,Y,X=this.opts.validateSchema){return this.addSchema(Q,Y,!0,X),this}validateSchema(Q,Y){if(typeof Q=="boolean")return!0;let X;if(X=Q.$schema,X!==void 0&&typeof X!="string")throw Error("$schema must be a string");if(X=X||this.opts.defaultMeta||this.defaultMeta(),!X)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let W=this.validate(X,Q);if(!W&&Y){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 Y;while(typeof(Y=lJ.call(this,Q))=="string")Q=Y;if(Y===void 0){let{schemaId:X}=this.opts,W=new T4.SchemaEnv({schema:{},schemaId:X});if(Y=T4.resolveSchema.call(this,W,Q),!Y)return;this.refs[Q]=Y}return Y.validate||this._compileSchemaEnv(Y)}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 Y=lJ.call(this,Q);if(typeof Y=="object")this._cache.delete(Y.schema);return delete this.schemas[Q],delete this.refs[Q],this}case"object":{let Y=Q;this._cache.delete(Y);let X=Q[this.opts.schemaId];if(X)X=(0,S4.normalizeId)(X),delete this.schemas[X],delete this.refs[X];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(Q){for(let Y of Q)this.addKeyword(Y);return this}addKeyword(Q,Y){let X;if(typeof Q=="string"){if(X=Q,typeof Y=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),Y.keyword=X}else if(typeof Q=="object"&&Y===void 0){if(Y=Q,X=Y.keyword,Array.isArray(X)&&!X.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(yL.call(this,X,Y),!Y)return(0,W9.eachItem)(X,(G)=>X9.call(this,G)),this;uL.call(this,Y);let W={...Y,type:(0,iQ.getJSONTypes)(Y.type),schemaType:(0,iQ.getJSONTypes)(Y.schemaType)};return(0,W9.eachItem)(X,W.type.length===0?(G)=>X9.call(this,G,W):(G)=>W.type.forEach(($)=>X9.call(this,G,W,$))),this}getKeyword(Q){let Y=this.RULES.all[Q];return typeof Y=="object"?Y.definition:!!Y}removeKeyword(Q){let{RULES:Y}=this;delete Y.keywords[Q],delete Y.all[Q];for(let X of Y.rules){let W=X.rules.findIndex((G)=>G.keyword===Q);if(W>=0)X.rules.splice(W,1)}return this}addFormat(Q,Y){if(typeof Y=="string")Y=new RegExp(Y);return this.formats[Q]=Y,this}errorsText(Q=this.errors,{separator:Y=", ",dataVar:X="data"}={}){if(!Q||Q.length===0)return"No errors";return Q.map((W)=>`${X}${W.instancePath} ${W.message}`).reduce((W,G)=>W+Y+G)}$dataMetaSchema(Q,Y){let X=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let W of Y){let G=W.split("/").slice(1),$=Q;for(let J of G)$=$[J];for(let J in X){let z=X[J];if(typeof z!="object")continue;let{$data:H}=z.definition,A=$[J];if(H&&A)$[J]=pJ(A)}}return Q}_removeAllSchemas(Q,Y){for(let X in Q){let W=Q[X];if(!Y||Y.test(X)){if(typeof W=="string")delete Q[X];else if(W&&!W.meta)this._cache.delete(W.schema),delete Q[X]}}}_addSchema(Q,Y,X,W=this.opts.validateSchema,G=this.opts.addUsedSchema){let $,{schemaId:J}=this.opts;if(typeof Q=="object")$=Q[J];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;X=(0,S4.normalizeId)($||X);let H=S4.getSchemaRefs.call(this,Q,X);if(z=new T4.SchemaEnv({schema:Q,schemaId:J,meta:Y,baseId:X,localRefs:H}),this._cache.set(z.schema,z),G&&!X.startsWith("#")){if(X)this._checkUnique(X);this.refs[X]=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 T4.compileSchema.call(this,Q);if(!Q.validate)throw Error("ajv implementation error");return Q.validate}_compileMetaSchema(Q){let Y=this.opts;this.opts=this._metaOpts;try{T4.compileSchema.call(this,Q)}finally{this.opts=Y}}}rQ.ValidationError=NL.default;rQ.MissingRefError=mJ.default;o0.default=rQ;function fJ(Q,Y,X,W="error"){for(let G in Q){let $=G;if($ in Y)this.logger[W](`${X}: option ${G}. ${Q[$]}`)}}function lJ(Q){return Q=(0,S4.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function SL(){let Q=this.opts.schemas;if(!Q)return;if(Array.isArray(Q))this.addSchema(Q);else for(let Y in Q)this.addSchema(Q[Y],Y)}function RL(){for(let Q in this.opts.formats){let Y=this.opts.formats[Q];if(Y)this.addFormat(Q,Y)}}function CL(Q){if(Array.isArray(Q)){this.addVocabulary(Q);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let Y in Q){let X=Q[Y];if(!X.keyword)X.keyword=Y;this.addKeyword(X)}}function kL(){let Q={...this.opts};for(let Y of PL)delete Q[Y];return Q}var vL={log(){},warn(){},error(){}};function xL(Q){if(Q===!1)return vL;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 _L=/^[a-z_$][a-z0-9_$:-]*$/i;function yL(Q,Y){let{RULES:X}=this;if((0,W9.eachItem)(Q,(W)=>{if(X.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!_L.test(W))throw Error(`Keyword ${W} has invalid name`)}),!Y)return;if(Y.$data&&!(("code"in Y)||("validate"in Y)))throw Error('$data keyword must have "code" or "validate" function')}function X9(Q,Y,X){var W;let G=Y===null||Y===void 0?void 0:Y.post;if(X&&G)throw Error('keyword with "post" flag cannot have "type"');let{RULES:$}=this,J=G?$.post:$.rules.find(({type:H})=>H===X);if(!J)J={type:X,rules:[]},$.rules.push(J);if($.keywords[Q]=!0,!Y)return;let z={keyword:Q,definition:{...Y,type:(0,iQ.getJSONTypes)(Y.type),schemaType:(0,iQ.getJSONTypes)(Y.schemaType)}};if(Y.before)gL.call(this,J,z,Y.before);else J.rules.push(z);$.all[Q]=z,(W=Y.implements)===null||W===void 0||W.forEach((H)=>this.addKeyword(H))}function gL(Q,Y,X){let W=Q.rules.findIndex((G)=>G.keyword===X);if(W>=0)Q.rules.splice(W,0,Y);else Q.rules.push(Y),this.logger.warn(`rule ${X} is not defined`)}function uL(Q){let{metaSchema:Y}=Q;if(Y===void 0)return;if(Q.$data&&this.opts.$data)Y=pJ(Y);Q.validateSchema=this.compile(Y,!0)}var hL={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function pJ(Q){return{anyOf:[Q,hL]}}});var nJ=Z((rJ)=>{Object.defineProperty(rJ,"__esModule",{value:!0});var mL={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};rJ.default=mL});var eJ=Z((aJ)=>{Object.defineProperty(aJ,"__esModule",{value:!0});aJ.callRef=aJ.getValidate=void 0;var pL=I4(),dJ=I0(),O0=v(),h1=r0(),oJ=fQ(),nQ=f(),iL={keyword:"$ref",schemaType:"string",code(Q){let{gen:Y,schema:X,it:W}=Q,{baseId:G,schemaEnv:$,validateName:J,opts:z,self:H}=W,{root:A}=$;if((X==="#"||X==="#/")&&G===A.baseId)return K();let U=oJ.resolveRef.call(H,A,G,X);if(U===void 0)throw new pL.default(W.opts.uriResolver,G,X);if(U instanceof oJ.SchemaEnv)return D(U);return L(U);function K(){if($===A)return dQ(Q,J,$,$.$async);let q=Y.scopeValue("root",{ref:A});return dQ(Q,O0._`${q}.validate`,A,A.$async)}function D(q){let O=tJ(Q,q);dQ(Q,O,q,q.$async)}function L(q){let O=Y.scopeValue("schema",z.code.source===!0?{ref:q,code:(0,O0.stringify)(q)}:{ref:q}),V=Y.name("valid"),M=Q.subschema({schema:q,dataTypes:[],schemaPath:O0.nil,topSchemaRef:O,errSchemaPath:X},V);Q.mergeEvaluated(M),Q.ok(V)}}};function tJ(Q,Y){let{gen:X}=Q;return Y.validate?X.scopeValue("validate",{ref:Y.validate}):O0._`${X.scopeValue("wrapper",{ref:Y})}.validate`}aJ.getValidate=tJ;function dQ(Q,Y,X,W){let{gen:G,it:$}=Q,{allErrors:J,schemaEnv:z,opts:H}=$,A=H.passContext?h1.default.this:O0.nil;if(W)U();else K();function U(){if(!z.$async)throw Error("async schema referenced by sync schema");let q=G.let("valid");G.try(()=>{if(G.code(O0._`await ${(0,dJ.callValidateCode)(Q,Y,A)}`),L(Y),!J)G.assign(q,!0)},(O)=>{if(G.if(O0._`!(${O} instanceof ${$.ValidationError})`,()=>G.throw(O)),D(O),!J)G.assign(q,!1)}),Q.ok(q)}function K(){Q.result((0,dJ.callValidateCode)(Q,Y,A),()=>L(Y),()=>D(Y))}function D(q){let O=O0._`${q}.errors`;G.assign(h1.default.vErrors,O0._`${h1.default.vErrors} === null ? ${O} : ${h1.default.vErrors}.concat(${O})`),G.assign(h1.default.errors,O0._`${h1.default.vErrors}.length`)}function L(q){var O;if(!$.opts.unevaluated)return;let V=(O=X===null||X===void 0?void 0:X.validate)===null||O===void 0?void 0:O.evaluated;if($.props!==!0)if(V&&!V.dynamicProps){if(V.props!==void 0)$.props=nQ.mergeEvaluated.props(G,V.props,$.props)}else{let M=G.var("props",O0._`${q}.evaluated.props`);$.props=nQ.mergeEvaluated.props(G,M,$.props,O0.Name)}if($.items!==!0)if(V&&!V.dynamicItems){if(V.items!==void 0)$.items=nQ.mergeEvaluated.items(G,V.items,$.items)}else{let M=G.var("items",O0._`${q}.evaluated.items`);$.items=nQ.mergeEvaluated.items(G,M,$.items,O0.Name)}}}aJ.callRef=dQ;aJ.default=iL});var Yz=Z((Qz)=>{Object.defineProperty(Qz,"__esModule",{value:!0});var dL=nJ(),oL=eJ(),tL=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",dL.default,oL.default];Qz.default=tL});var Wz=Z((Xz)=>{Object.defineProperty(Xz,"__esModule",{value:!0});var oQ=v(),K1=oQ.operators,tQ={maximum:{okStr:"<=",ok:K1.LTE,fail:K1.GT},minimum:{okStr:">=",ok:K1.GTE,fail:K1.LT},exclusiveMaximum:{okStr:"<",ok:K1.LT,fail:K1.GTE},exclusiveMinimum:{okStr:">",ok:K1.GT,fail:K1.LTE}},sL={message:({keyword:Q,schemaCode:Y})=>oQ.str`must be ${tQ[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>oQ._`{comparison: ${tQ[Q].okStr}, limit: ${Y}}`},eL={keyword:Object.keys(tQ),type:"number",schemaType:"number",$data:!0,error:sL,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q;Q.fail$data(oQ._`${X} ${tQ[Y].fail} ${W} || isNaN(${X})`)}};Xz.default=eL});var $z=Z((Gz)=>{Object.defineProperty(Gz,"__esModule",{value:!0});var R4=v(),YF={message:({schemaCode:Q})=>R4.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>R4._`{multipleOf: ${Q}}`},XF={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:YF,code(Q){let{gen:Y,data:X,schemaCode:W,it:G}=Q,$=G.opts.multipleOfPrecision,J=Y.let("res"),z=$?R4._`Math.abs(Math.round(${J}) - ${J}) > 1e-${$}`:R4._`${J} !== parseInt(${J})`;Q.fail$data(R4._`(${W} === 0 || (${J} = ${X}/${W}, ${z}))`)}};Gz.default=XF});var Hz=Z((zz)=>{Object.defineProperty(zz,"__esModule",{value:!0});function Jz(Q){let Y=Q.length,X=0,W=0,G;while(W<Y)if(X++,G=Q.charCodeAt(W++),G>=55296&&G<=56319&&W<Y){if(G=Q.charCodeAt(W),(G&64512)===56320)W++}return X}zz.default=Jz;Jz.code='require("ajv/dist/runtime/ucs2length").default'});var Uz=Z((Az)=>{Object.defineProperty(Az,"__esModule",{value:!0});var Z1=v(),$F=f(),JF=Hz(),zF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxLength"?"more":"fewer";return Z1.str`must NOT have ${X} than ${Y} characters`},params:({schemaCode:Q})=>Z1._`{limit: ${Q}}`},HF={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:zF,code(Q){let{keyword:Y,data:X,schemaCode:W,it:G}=Q,$=Y==="maxLength"?Z1.operators.GT:Z1.operators.LT,J=G.opts.unicode===!1?Z1._`${X}.length`:Z1._`${(0,$F.useFunc)(Q.gen,JF.default)}(${X})`;Q.fail$data(Z1._`${J} ${$} ${W}`)}};Az.default=HF});var Dz=Z((Kz)=>{Object.defineProperty(Kz,"__esModule",{value:!0});var UF=I0(),aQ=v(),KF={message:({schemaCode:Q})=>aQ.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>aQ._`{pattern: ${Q}}`},DF={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:KF,code(Q){let{data:Y,$data:X,schema:W,schemaCode:G,it:$}=Q,J=$.opts.unicodeRegExp?"u":"",z=X?aQ._`(new RegExp(${G}, ${J}))`:(0,UF.usePattern)(Q,W);Q.fail$data(aQ._`!${z}.test(${Y})`)}};Kz.default=DF});var Lz=Z((Bz)=>{Object.defineProperty(Bz,"__esModule",{value:!0});var C4=v(),LF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxProperties"?"more":"fewer";return C4.str`must NOT have ${X} than ${Y} properties`},params:({schemaCode:Q})=>C4._`{limit: ${Q}}`},FF={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:LF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxProperties"?C4.operators.GT:C4.operators.LT;Q.fail$data(C4._`Object.keys(${X}).length ${G} ${W}`)}};Bz.default=FF});var qz=Z((Fz)=>{Object.defineProperty(Fz,"__esModule",{value:!0});var k4=I0(),v4=v(),OF=f(),MF={message:({params:{missingProperty:Q}})=>v4.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>v4._`{missingProperty: ${Q}}`},VF={keyword:"required",type:"object",schemaType:"array",$data:!0,error:MF,code(Q){let{gen:Y,schema:X,schemaCode:W,data:G,$data:$,it:J}=Q,{opts:z}=J;if(!$&&X.length===0)return;let H=X.length>=z.loopRequired;if(J.allErrors)A();else U();if(z.strictRequired){let L=Q.parentSchema.properties,{definedProperties:q}=Q.it;for(let O of X)if((L===null||L===void 0?void 0:L[O])===void 0&&!q.has(O)){let V=J.schemaEnv.baseId+J.errSchemaPath,M=`required property "${O}" is not defined at "${V}" (strictRequired)`;(0,OF.checkStrictMode)(J,M,J.opts.strictRequired)}}function A(){if(H||$)Q.block$data(v4.nil,K);else for(let L of X)(0,k4.checkReportMissingProp)(Q,L)}function U(){let L=Y.let("missing");if(H||$){let q=Y.let("valid",!0);Q.block$data(q,()=>D(L,q)),Q.ok(q)}else Y.if((0,k4.checkMissingProp)(Q,X,L)),(0,k4.reportMissingProp)(Q,L),Y.else()}function K(){Y.forOf("prop",W,(L)=>{Q.setParams({missingProperty:L}),Y.if((0,k4.noPropertyInData)(Y,G,L,z.ownProperties),()=>Q.error())})}function D(L,q){Q.setParams({missingProperty:L}),Y.forOf(L,W,()=>{Y.assign(q,(0,k4.propertyInData)(Y,G,L,z.ownProperties)),Y.if((0,v4.not)(q),()=>{Q.error(),Y.break()})},v4.nil)}}};Fz.default=VF});var Mz=Z((Oz)=>{Object.defineProperty(Oz,"__esModule",{value:!0});var x4=v(),ZF={message({keyword:Q,schemaCode:Y}){let X=Q==="maxItems"?"more":"fewer";return x4.str`must NOT have ${X} than ${Y} items`},params:({schemaCode:Q})=>x4._`{limit: ${Q}}`},wF={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:ZF,code(Q){let{keyword:Y,data:X,schemaCode:W}=Q,G=Y==="maxItems"?x4.operators.GT:x4.operators.LT;Q.fail$data(x4._`${X}.length ${G} ${W}`)}};Oz.default=wF});var sQ=Z((Nz)=>{Object.defineProperty(Nz,"__esModule",{value:!0});var Vz=mY();Vz.code='require("ajv/dist/runtime/equal").default';Nz.default=Vz});var wz=Z((Zz)=>{Object.defineProperty(Zz,"__esModule",{value:!0});var G9=N4(),H0=v(),IF=f(),jF=sQ(),EF={message:({params:{i:Q,j:Y}})=>H0.str`must NOT have duplicate items (items ## ${Y} and ${Q} are identical)`,params:({params:{i:Q,j:Y}})=>H0._`{i: ${Q}, j: ${Y}}`},TF={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:EF,code(Q){let{gen:Y,data:X,$data:W,schema:G,parentSchema:$,schemaCode:J,it:z}=Q;if(!W&&!G)return;let H=Y.let("valid"),A=$.items?(0,G9.getSchemaTypes)($.items):[];Q.block$data(H,U,H0._`${J} === false`),Q.ok(H);function U(){let q=Y.let("i",H0._`${X}.length`),O=Y.let("j");Q.setParams({i:q,j:O}),Y.assign(H,!0),Y.if(H0._`${q} > 1`,()=>(K()?D:L)(q,O))}function K(){return A.length>0&&!A.some((q)=>q==="object"||q==="array")}function D(q,O){let V=Y.name("item"),M=(0,G9.checkDataTypes)(A,V,z.opts.strictNumbers,G9.DataType.Wrong),S=Y.const("indices",H0._`{}`);Y.for(H0._`;${q}--;`,()=>{if(Y.let(V,H0._`${X}[${q}]`),Y.if(M,H0._`continue`),A.length>1)Y.if(H0._`typeof ${V} == "string"`,H0._`${V} += "_"`);Y.if(H0._`typeof ${S}[${V}] == "number"`,()=>{Y.assign(O,H0._`${S}[${V}]`),Q.error(),Y.assign(H,!1).break()}).code(H0._`${S}[${V}] = ${q}`)})}function L(q,O){let V=(0,IF.useFunc)(Y,jF.default),M=Y.name("outer");Y.label(M).for(H0._`;${q}--;`,()=>Y.for(H0._`${O} = ${q}; ${O}--;`,()=>Y.if(H0._`${V}(${X}[${q}], ${X}[${O}])`,()=>{Q.error(),Y.assign(H,!1).break(M)})))}}};Zz.default=TF});var Pz=Z((bz)=>{Object.defineProperty(bz,"__esModule",{value:!0});var $9=v(),RF=f(),CF=sQ(),kF={message:"must be equal to constant",params:({schemaCode:Q})=>$9._`{allowedValue: ${Q}}`},vF={keyword:"const",$data:!0,error:kF,code(Q){let{gen:Y,data:X,$data:W,schemaCode:G,schema:$}=Q;if(W||$&&typeof $=="object")Q.fail$data($9._`!${(0,RF.useFunc)(Y,CF.default)}(${X}, ${G})`);else Q.fail($9._`${$} !== ${X}`)}};bz.default=vF});var jz=Z((Iz)=>{Object.defineProperty(Iz,"__esModule",{value:!0});var _4=v(),_F=f(),yF=sQ(),gF={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>_4._`{allowedValues: ${Q}}`},uF={keyword:"enum",schemaType:"array",$data:!0,error:gF,code(Q){let{gen:Y,data:X,$data:W,schema:G,schemaCode:$,it:J}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let z=G.length>=J.opts.loopEnum,H,A=()=>H!==null&&H!==void 0?H:H=(0,_F.useFunc)(Y,yF.default),U;if(z||W)U=Y.let("valid"),Q.block$data(U,K);else{if(!Array.isArray(G))throw Error("ajv implementation error");let L=Y.const("vSchema",$);U=(0,_4.or)(...G.map((q,O)=>D(L,O)))}Q.pass(U);function K(){Y.assign(U,!1),Y.forOf("v",$,(L)=>Y.if(_4._`${A()}(${X}, ${L})`,()=>Y.assign(U,!0).break()))}function D(L,q){let O=G[q];return typeof O==="object"&&O!==null?_4._`${A()}(${X}, ${L}[${q}])`:_4._`${X} === ${O}`}}};Iz.default=uF});var Tz=Z((Ez)=>{Object.defineProperty(Ez,"__esModule",{value:!0});var fF=Wz(),lF=$z(),mF=Uz(),cF=Dz(),pF=Lz(),iF=qz(),rF=Mz(),nF=wz(),dF=Pz(),oF=jz(),tF=[fF.default,lF.default,mF.default,cF.default,pF.default,iF.default,rF.default,nF.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},dF.default,oF.default];Ez.default=tF});var z9=Z((Rz)=>{Object.defineProperty(Rz,"__esModule",{value:!0});Rz.validateAdditionalItems=void 0;var w1=v(),J9=f(),sF={message:({params:{len:Q}})=>w1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>w1._`{limit: ${Q}}`},eF={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:sF,code(Q){let{parentSchema:Y,it:X}=Q,{items:W}=Y;if(!Array.isArray(W)){(0,J9.checkStrictMode)(X,'"additionalItems" is ignored when "items" is not an array of schemas');return}Sz(Q,W)}};function Sz(Q,Y){let{gen:X,schema:W,data:G,keyword:$,it:J}=Q;J.items=!0;let z=X.const("len",w1._`${G}.length`);if(W===!1)Q.setParams({len:Y.length}),Q.pass(w1._`${z} <= ${Y.length}`);else if(typeof W=="object"&&!(0,J9.alwaysValidSchema)(J,W)){let A=X.var("valid",w1._`${z} <= ${Y.length}`);X.if((0,w1.not)(A),()=>H(A)),Q.ok(A)}function H(A){X.forRange("i",Y.length,z,(U)=>{if(Q.subschema({keyword:$,dataProp:U,dataPropType:J9.Type.Num},A),!J.allErrors)X.if((0,w1.not)(A),()=>X.break())})}}Rz.validateAdditionalItems=Sz;Rz.default=eF});var H9=Z((xz)=>{Object.defineProperty(xz,"__esModule",{value:!0});xz.validateTuple=void 0;var kz=v(),eQ=f(),Yq=I0(),Xq={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:Y,it:X}=Q;if(Array.isArray(Y))return vz(Q,"additionalItems",Y);if(X.items=!0,(0,eQ.alwaysValidSchema)(X,Y))return;Q.ok((0,Yq.validateArray)(Q))}};function vz(Q,Y,X=Q.schema){let{gen:W,parentSchema:G,data:$,keyword:J,it:z}=Q;if(U(G),z.opts.unevaluated&&X.length&&z.items!==!0)z.items=eQ.mergeEvaluated.items(W,X.length,z.items);let H=W.name("valid"),A=W.const("len",kz._`${$}.length`);X.forEach((K,D)=>{if((0,eQ.alwaysValidSchema)(z,K))return;W.if(kz._`${A} > ${D}`,()=>Q.subschema({keyword:J,schemaProp:D,dataProp:D},H)),Q.ok(H)});function U(K){let{opts:D,errSchemaPath:L}=z,q=X.length,O=q===K.minItems&&(q===K.maxItems||K[Y]===!1);if(D.strictTuples&&!O){let V=`"${J}" is ${q}-tuple, but minItems or maxItems/${Y} are not specified or different at path "${L}"`;(0,eQ.checkStrictMode)(z,V,D.strictTuples)}}}xz.validateTuple=vz;xz.default=Xq});var gz=Z((yz)=>{Object.defineProperty(yz,"__esModule",{value:!0});var Gq=H9(),$q={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,Gq.validateTuple)(Q,"items")};yz.default=$q});var fz=Z((hz)=>{Object.defineProperty(hz,"__esModule",{value:!0});var uz=v(),zq=f(),Hq=I0(),Aq=z9(),Uq={message:({params:{len:Q}})=>uz.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>uz._`{limit: ${Q}}`},Kq={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Uq,code(Q){let{schema:Y,parentSchema:X,it:W}=Q,{prefixItems:G}=X;if(W.items=!0,(0,zq.alwaysValidSchema)(W,Y))return;if(G)(0,Aq.validateAdditionalItems)(Q,G);else Q.ok((0,Hq.validateArray)(Q))}};hz.default=Kq});var mz=Z((lz)=>{Object.defineProperty(lz,"__esModule",{value:!0});var j0=v(),Q6=f(),Bq={message:({params:{min:Q,max:Y}})=>Y===void 0?j0.str`must contain at least ${Q} valid item(s)`:j0.str`must contain at least ${Q} and no more than ${Y} valid item(s)`,params:({params:{min:Q,max:Y}})=>Y===void 0?j0._`{minContains: ${Q}}`:j0._`{minContains: ${Q}, maxContains: ${Y}}`},Lq={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Bq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:$}=Q,J,z,{minContains:H,maxContains:A}=W;if($.opts.next)J=H===void 0?1:H,z=A;else J=1;let U=Y.const("len",j0._`${G}.length`);if(Q.setParams({min:J,max:z}),z===void 0&&J===0){(0,Q6.checkStrictMode)($,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(z!==void 0&&J>z){(0,Q6.checkStrictMode)($,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,Q6.alwaysValidSchema)($,X)){let O=j0._`${U} >= ${J}`;if(z!==void 0)O=j0._`${O} && ${U} <= ${z}`;Q.pass(O);return}$.items=!0;let K=Y.name("valid");if(z===void 0&&J===1)L(K,()=>Y.if(K,()=>Y.break()));else if(J===0){if(Y.let(K,!0),z!==void 0)Y.if(j0._`${G}.length > 0`,D)}else Y.let(K,!1),D();Q.result(K,()=>Q.reset());function D(){let O=Y.name("_valid"),V=Y.let("count",0);L(O,()=>Y.if(O,()=>q(V)))}function L(O,V){Y.forRange("i",0,U,(M)=>{Q.subschema({keyword:"contains",dataProp:M,dataPropType:Q6.Type.Num,compositeRule:!0},O),V()})}function q(O){if(Y.code(j0._`${O}++`),z===void 0)Y.if(j0._`${O} >= ${J}`,()=>Y.assign(K,!0).break());else if(Y.if(j0._`${O} > ${z}`,()=>Y.assign(K,!1).break()),J===1)Y.assign(K,!0);else Y.if(j0._`${O} >= ${J}`,()=>Y.assign(K,!0))}}};lz.default=Lq});var dz=Z((iz)=>{Object.defineProperty(iz,"__esModule",{value:!0});iz.validateSchemaDeps=iz.validatePropertyDeps=iz.error=void 0;var A9=v(),qq=f(),y4=I0();iz.error={message:({params:{property:Q,depsCount:Y,deps:X}})=>{let W=Y===1?"property":"properties";return A9.str`must have ${W} ${X} when property ${Q} is present`},params:({params:{property:Q,depsCount:Y,deps:X,missingProperty:W}})=>A9._`{property: ${Q},
|
|
7
7
|
missingProperty: ${W},
|
|
8
|
-
depsCount: ${
|
|
9
|
-
deps: ${Y}}`};var JF={keyword:"dependencies",type:"object",schemaType:"object",error:lz.error,code(Q){let[X,Y]=zF(Q);hz(Q,X),fz(Q,Y)}};function zF({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 hz(Q,X=Q.schema){let{gen:Y,data:W,it:G}=Q;if(Object.keys(X).length===0)return;let $=Y.let("missing");for(let J in X){let z=X[J];if(z.length===0)continue;let H=(0,_4.propertyInData)(Y,W,J,G.opts.ownProperties);if(Q.setParams({property:J,depsCount:z.length,deps:z.join(", ")}),G.allErrors)Y.if(H,()=>{for(let U of z)(0,_4.checkReportMissingProp)(Q,U)});else Y.if(zX._`${H} && (${(0,_4.checkMissingProp)(Q,z,$)})`),(0,_4.reportMissingProp)(Q,$),Y.else()}}lz.validatePropertyDeps=hz;function fz(Q,X=Q.schema){let{gen:Y,data:W,keyword:G,it:$}=Q,J=Y.name("valid");for(let z in X){if((0,$F.alwaysValidSchema)($,X[z]))continue;Y.if((0,_4.propertyInData)(Y,W,z,$.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:z},J);Q.mergeValidEvaluated(H,J)},()=>Y.var(J,!0)),Q.ok(J)}}lz.validateSchemaDeps=fz;lz.default=JF});var rz=N((nz)=>{Object.defineProperty(nz,"__esModule",{value:!0});var iz=v(),AF=f(),KF={message:"property name must be valid",params:({params:Q})=>iz._`{propertyName: ${Q.propertyName}}`},BF={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:KF,code(Q){let{gen:X,schema:Y,data:W,it:G}=Q;if((0,AF.alwaysValidSchema)(G,Y))return;let $=X.name("valid");X.forIn("key",W,(J)=>{Q.setParams({propertyName:J}),Q.subschema({keyword:"propertyNames",data:J,dataTypes:["string"],propertyName:J,compositeRule:!0},$),X.if((0,iz.not)($),()=>{if(Q.error(!0),!G.allErrors)X.break()})}),Q.ok($)}};nz.default=BF});var HX=N((dz)=>{Object.defineProperty(dz,"__esModule",{value:!0});var QQ=j0(),v0=v(),LF=n0(),XQ=f(),qF={message:"must NOT have additional properties",params:({params:Q})=>v0._`{additionalProperty: ${Q.additionalProperty}}`},FF={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:qF,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,errsCount:$,it:J}=Q;if(!$)throw Error("ajv implementation error");let{allErrors:z,opts:H}=J;if(J.props=!0,H.removeAdditional!=="all"&&(0,XQ.alwaysValidSchema)(J,Y))return;let U=(0,QQ.allSchemaProperties)(W.properties),A=(0,QQ.allSchemaProperties)(W.patternProperties);K(),Q.ok(v0._`${$} === ${LF.default.errors}`);function K(){X.forIn("key",G,(V)=>{if(!U.length&&!A.length)F(V);else X.if(B(V),()=>F(V))})}function B(V){let M;if(U.length>8){let S=(0,XQ.schemaRefOrVal)(J,W.properties,"properties");M=(0,QQ.isOwnProperty)(X,S,V)}else if(U.length)M=(0,v0.or)(...U.map((S)=>v0._`${V} === ${S}`));else M=v0.nil;if(A.length)M=(0,v0.or)(M,...A.map((S)=>v0._`${(0,QQ.usePattern)(Q,S)}.test(${V})`));return(0,v0.not)(M)}function L(V){X.code(v0._`delete ${G}[${V}]`)}function F(V){if(H.removeAdditional==="all"||H.removeAdditional&&Y===!1){L(V);return}if(Y===!1){if(Q.setParams({additionalProperty:V}),Q.error(),!z)X.break();return}if(typeof Y=="object"&&!(0,XQ.alwaysValidSchema)(J,Y)){let M=X.name("valid");if(H.removeAdditional==="failing")O(V,M,!1),X.if((0,v0.not)(M),()=>{Q.reset(),L(V)});else if(O(V,M),!z)X.if((0,v0.not)(M),()=>X.break())}}function O(V,M,S){let E={keyword:"additionalProperties",dataProp:V,dataPropType:XQ.Type.Str};if(S===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,M)}}};dz.default=FF});var sz=N((az)=>{Object.defineProperty(az,"__esModule",{value:!0});var MF=b4(),oz=j0(),UX=f(),tz=HX(),VF={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:$}=Q;if($.opts.removeAdditional==="all"&&W.additionalProperties===void 0)tz.default.code(new MF.KeywordCxt($,tz.default,"additionalProperties"));let J=(0,oz.allSchemaProperties)(Y);for(let K of J)$.definedProperties.add(K);if($.opts.unevaluated&&J.length&&$.props!==!0)$.props=UX.mergeEvaluated.props(X,(0,UX.toHash)(J),$.props);let z=J.filter((K)=>!(0,UX.alwaysValidSchema)($,Y[K]));if(z.length===0)return;let H=X.name("valid");for(let K of z){if(U(K))A(K);else{if(X.if((0,oz.propertyInData)(X,G,K,$.opts.ownProperties)),A(K),!$.allErrors)X.else().var(H,!0);X.endIf()}Q.it.definedProperties.add(K),Q.ok(H)}function U(K){return $.opts.useDefaults&&!$.compositeRule&&Y[K].default!==void 0}function A(K){Q.subschema({keyword:"properties",schemaProp:K,dataProp:K},H)}}};az.default=VF});var W7=N((Y7)=>{Object.defineProperty(Y7,"__esModule",{value:!0});var ez=j0(),YQ=v(),Q7=f(),X7=f(),NF={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:G,it:$}=Q,{opts:J}=$,z=(0,ez.allSchemaProperties)(Y),H=z.filter((O)=>(0,Q7.alwaysValidSchema)($,Y[O]));if(z.length===0||H.length===z.length&&(!$.opts.unevaluated||$.props===!0))return;let U=J.strictSchema&&!J.allowMatchingProperties&&G.properties,A=X.name("valid");if($.props!==!0&&!($.props instanceof YQ.Name))$.props=(0,X7.evaluatedPropsToName)(X,$.props);let{props:K}=$;B();function B(){for(let O of z){if(U)L(O);if($.allErrors)F(O);else X.var(A,!0),F(O),X.if(A)}}function L(O){for(let V in U)if(new RegExp(O).test(V))(0,Q7.checkStrictMode)($,`property ${V} matches pattern ${O} (use allowMatchingProperties)`)}function F(O){X.forIn("key",W,(V)=>{X.if(YQ._`${(0,ez.usePattern)(Q,O)}.test(${V})`,()=>{let M=H.includes(O);if(!M)Q.subschema({keyword:"patternProperties",schemaProp:O,dataProp:V,dataPropType:X7.Type.Str},A);if($.opts.unevaluated&&K!==!0)X.assign(YQ._`${K}[${V}]`,!0);else if(!M&&!$.allErrors)X.if((0,YQ.not)(A),()=>X.break())})})}}};Y7.default=NF});var $7=N((G7)=>{Object.defineProperty(G7,"__esModule",{value:!0});var bF=f(),PF={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,bF.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"}};G7.default=PF});var z7=N((J7)=>{Object.defineProperty(J7,"__esModule",{value:!0});var IF=j0(),EF={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:IF.validateUnion,error:{message:"must match a schema in anyOf"}};J7.default=EF});var U7=N((H7)=>{Object.defineProperty(H7,"__esModule",{value:!0});var WQ=v(),SF=f(),RF={message:"must match exactly one schema in oneOf",params:({params:Q})=>WQ._`{passingSchemas: ${Q.passing}}`},CF={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:RF,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 $=Y,J=X.let("valid",!1),z=X.let("passing",null),H=X.name("_valid");Q.setParams({passing:z}),X.block(U),Q.result(J,()=>Q.reset(),()=>Q.error(!0));function U(){$.forEach((A,K)=>{let B;if((0,SF.alwaysValidSchema)(G,A))X.var(H,!0);else B=Q.subschema({keyword:"oneOf",schemaProp:K,compositeRule:!0},H);if(K>0)X.if(WQ._`${H} && ${J}`).assign(J,!1).assign(z,WQ._`[${z}, ${K}]`).else();X.if(H,()=>{if(X.assign(J,!0),X.assign(z,K),B)Q.mergeEvaluated(B,WQ.Name)})})}}};H7.default=CF});var K7=N((A7)=>{Object.defineProperty(A7,"__esModule",{value:!0});var vF=f(),xF={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,vF.alwaysValidSchema)(W,$))return;let z=Q.subschema({keyword:"allOf",schemaProp:J},G);Q.ok(G),Q.mergeEvaluated(z)})}};A7.default=xF});var q7=N((L7)=>{Object.defineProperty(L7,"__esModule",{value:!0});var GQ=v(),D7=f(),yF={message:({params:Q})=>GQ.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>GQ._`{failingKeyword: ${Q.ifClause}}`},gF={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:yF,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,D7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=B7(W,"then"),$=B7(W,"else");if(!G&&!$)return;let J=X.let("valid",!0),z=X.name("_valid");if(H(),Q.reset(),G&&$){let A=X.let("ifClause");Q.setParams({ifClause:A}),X.if(z,U("then",A),U("else",A))}else if(G)X.if(z,U("then"));else X.if((0,GQ.not)(z),U("else"));Q.pass(J,()=>Q.error(!0));function H(){let A=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},z);Q.mergeEvaluated(A)}function U(A,K){return()=>{let B=Q.subschema({keyword:A},z);if(X.assign(J,z),Q.mergeValidEvaluated(B,J),K)X.assign(K,GQ._`${A}`);else Q.setParams({ifClause:A})}}}};function B7(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,D7.alwaysValidSchema)(Q,Y)}L7.default=gF});var O7=N((F7)=>{Object.defineProperty(F7,"__esModule",{value:!0});var hF=f(),fF={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,hF.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};F7.default=fF});var V7=N((M7)=>{Object.defineProperty(M7,"__esModule",{value:!0});var mF=$X(),cF=vz(),pF=JX(),iF=yz(),nF=uz(),rF=pz(),dF=rz(),oF=HX(),tF=sz(),aF=W7(),sF=$7(),eF=z7(),QO=U7(),XO=K7(),YO=q7(),WO=O7();function GO(Q=!1){let X=[sF.default,eF.default,QO.default,XO.default,YO.default,WO.default,dF.default,oF.default,rF.default,tF.default,aF.default];if(Q)X.push(cF.default,iF.default);else X.push(mF.default,pF.default);return X.push(nF.default),X}M7.default=GO});var N7=N((Z7)=>{Object.defineProperty(Z7,"__esModule",{value:!0});var e=v(),JO={message:({schemaCode:Q})=>e.str`must match format "${Q}"`,params:({schemaCode:Q})=>e._`{format: ${Q}}`},zO={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:JO,code(Q,X){let{gen:Y,data:W,$data:G,schema:$,schemaCode:J,it:z}=Q,{opts:H,errSchemaPath:U,schemaEnv:A,self:K}=z;if(!H.validateFormats)return;if(G)B();else L();function B(){let F=Y.scopeValue("formats",{ref:K.formats,code:H.code.formats}),O=Y.const("fDef",e._`${F}[${J}]`),V=Y.let("fType"),M=Y.let("format");Y.if(e._`typeof ${O} == "object" && !(${O} instanceof RegExp)`,()=>Y.assign(V,e._`${O}.type || "string"`).assign(M,e._`${O}.validate`),()=>Y.assign(V,e._`"string"`).assign(M,O)),Q.fail$data((0,e.or)(S(),E()));function S(){if(H.strictSchema===!1)return e.nil;return e._`${J} && !${M}`}function E(){let x=A.$async?e._`(${O}.async ? await ${M}(${W}) : ${M}(${W}))`:e._`${M}(${W})`,T=e._`(typeof ${M} == "function" ? ${x} : ${M}.test(${W}))`;return e._`${M} && ${M} !== true && ${V} === ${X} && !${T}`}}function L(){let F=K.formats[$];if(!F){S();return}if(F===!0)return;let[O,V,M]=E(F);if(O===X)Q.pass(x());function S(){if(H.strictSchema===!1){K.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${$}" ignored in schema at path "${U}"`}}function E(T){let _0=T instanceof RegExp?(0,e.regexpCode)(T):H.code.formats?e._`${H.code.formats}${(0,e.getProperty)($)}`:void 0,f0=Y.scopeValue("formats",{key:$,ref:T,code:_0});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,e._`${f0}.validate`];return["string",T,f0]}function x(){if(typeof F=="object"&&!(F instanceof RegExp)&&F.async){if(!A.$async)throw Error("async format in sync schema");return e._`await ${M}(${W})`}return typeof V=="function"?e._`${M}(${W})`:e._`${M}.test(${W})`}}}};Z7.default=zO});var b7=N((w7)=>{Object.defineProperty(w7,"__esModule",{value:!0});var UO=N7(),AO=[UO.default];w7.default=AO});var I7=N((P7)=>{Object.defineProperty(P7,"__esModule",{value:!0});P7.contentVocabulary=P7.metadataVocabulary=void 0;P7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];P7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var S7=N((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});var DO=aJ(),LO=Pz(),qO=V7(),FO=b7(),E7=I7(),OO=[DO.default,LO.default,(0,qO.default)(),FO.default,E7.metadataVocabulary,E7.contentVocabulary];T7.default=OO});var v7=N((C7)=>{Object.defineProperty(C7,"__esModule",{value:!0});C7.DiscrError=void 0;var R7;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(R7||(C7.DiscrError=R7={}))});var y7=N((_7)=>{Object.defineProperty(_7,"__esModule",{value:!0});var u1=v(),AX=v7(),x7=h6(),VO=P4(),ZO=f(),NO={message:({params:{discrError:Q,tagName:X}})=>Q===AX.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:Y}})=>u1._`{error: ${Q}, tag: ${Y}, tagValue: ${X}}`},wO={keyword:"discriminator",type:"object",schemaType:"object",error:NO,code(Q){let{gen:X,data:Y,schema:W,parentSchema:G,it:$}=Q,{oneOf:J}=G;if(!$.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(!J)throw Error("discriminator: requires oneOf keyword");let H=X.let("valid",!1),U=X.const("tag",u1._`${Y}${(0,u1.getProperty)(z)}`);X.if(u1._`typeof ${U} == "string"`,()=>A(),()=>Q.error(!1,{discrError:AX.DiscrError.Tag,tag:U,tagName:z})),Q.ok(H);function A(){let L=B();X.if(!1);for(let F in L)X.elseIf(u1._`${U} === ${F}`),X.assign(H,K(L[F]));X.else(),Q.error(!1,{discrError:AX.DiscrError.Mapping,tag:U,tagName:z}),X.endIf()}function K(L){let F=X.name("valid"),O=Q.subschema({keyword:"oneOf",schemaProp:L},F);return Q.mergeEvaluated(O,u1.Name),F}function B(){var L;let F={},O=M(G),V=!0;for(let x=0;x<J.length;x++){let T=J[x];if((T===null||T===void 0?void 0:T.$ref)&&!(0,ZO.schemaHasRulesButRef)(T,$.self.RULES)){let f0=T.$ref;if(T=x7.resolveRef.call($.self,$.schemaEnv.root,$.baseId,f0),T instanceof x7.SchemaEnv)T=T.schema;if(T===void 0)throw new VO.default($.opts.uriResolver,$.baseId,f0)}let _0=(L=T===null||T===void 0?void 0:T.properties)===null||L===void 0?void 0:L[z];if(typeof _0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${z}"`);V=V&&(O||M(T)),S(_0,x)}if(!V)throw Error(`discriminator: "${z}" must be required`);return F;function M({required:x}){return Array.isArray(x)&&x.includes(z)}function S(x,T){if(x.const)E(x.const,T);else if(x.enum)for(let _0 of x.enum)E(_0,T);else throw Error(`discriminator: "properties/${z}" must have "const" or "enum"`)}function E(x,T){if(typeof x!="string"||x in F)throw Error(`discriminator: "${z}" values must be unique strings`);F[x]=T}}}};_7.default=wO});var g7=N((fj,PO)=>{PO.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 BX=N((M0,KX)=>{Object.defineProperty(M0,"__esModule",{value:!0});M0.MissingRefError=M0.ValidationError=M0.CodeGen=M0.Name=M0.nil=M0.stringify=M0.str=M0._=M0.KeywordCxt=M0.Ajv=void 0;var jO=lJ(),IO=S7(),EO=y7(),u7=g7(),TO=["/properties"],$Q="http://json-schema.org/draft-07/schema";class y4 extends jO.default{_addVocabularies(){if(super._addVocabularies(),IO.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(EO.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(u7,TO):u7;this.addMetaSchema(Q,$Q,!1),this.refs["http://json-schema.org/schema"]=$Q}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema($Q)?$Q:void 0)}}M0.Ajv=y4;KX.exports=M0=y4;KX.exports.Ajv=y4;Object.defineProperty(M0,"__esModule",{value:!0});M0.default=y4;var SO=b4();Object.defineProperty(M0,"KeywordCxt",{enumerable:!0,get:function(){return SO.KeywordCxt}});var h1=v();Object.defineProperty(M0,"_",{enumerable:!0,get:function(){return h1._}});Object.defineProperty(M0,"str",{enumerable:!0,get:function(){return h1.str}});Object.defineProperty(M0,"stringify",{enumerable:!0,get:function(){return h1.stringify}});Object.defineProperty(M0,"nil",{enumerable:!0,get:function(){return h1.nil}});Object.defineProperty(M0,"Name",{enumerable:!0,get:function(){return h1.Name}});Object.defineProperty(M0,"CodeGen",{enumerable:!0,get:function(){return h1.CodeGen}});var RO=g6();Object.defineProperty(M0,"ValidationError",{enumerable:!0,get:function(){return RO.default}});var CO=P4();Object.defineProperty(M0,"MissingRefError",{enumerable:!0,get:function(){return CO.default}})});var d7=N((n7)=>{Object.defineProperty(n7,"__esModule",{value:!0});n7.formatNames=n7.fastFormats=n7.fullFormats=void 0;function u0(Q,X){return{validate:Q,compare:X}}n7.fullFormats={date:u0(m7,FX),time:u0(LX(!0),OX),"date-time":u0(h7(!0),p7),"iso-time":u0(LX(),c7),"iso-date-time":u0(h7(),i7),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:hO,"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:nO,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:fO,int32:{type:"number",validate:cO},int64:{type:"number",validate:pO},float:{type:"number",validate:l7},double:{type:"number",validate:l7},password:!0,binary:!0};n7.fastFormats={...n7.fullFormats,date:u0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,FX),time:u0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,OX),"date-time":u0(/^\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,p7),"iso-time":u0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c7),"iso-date-time":u0(/^\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,i7),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};n7.formatNames=Object.keys(n7.fullFormats);function xO(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var _O=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,yO=[0,31,28,31,30,31,30,31,31,30,31,30,31];function m7(Q){let X=_O.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&&xO(Y)?29:yO[W])}function FX(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var DX=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function LX(Q){return function(Y){let W=DX.exec(Y);if(!W)return!1;let G=+W[1],$=+W[2],J=+W[3],z=W[4],H=W[5]==="-"?-1:1,U=+(W[6]||0),A=+(W[7]||0);if(U>23||A>59||Q&&!z)return!1;if(G<=23&&$<=59&&J<60)return!0;let K=$-A*H,B=G-U*H-(K<0?1:0);return(B===23||B===-1)&&(K===59||K===-1)&&J<61}}function OX(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 c7(Q,X){if(!(Q&&X))return;let Y=DX.exec(Q),W=DX.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 qX=/t|\s/i;function h7(Q){let X=LX(Q);return function(W){let G=W.split(qX);return G.length===2&&m7(G[0])&&X(G[1])}}function p7(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 i7(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(qX),[G,$]=X.split(qX),J=FX(Y,G);if(J===void 0)return;return J||OX(W,$)}var gO=/\/|:/,uO=/^(?:[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 hO(Q){return gO.test(Q)&&uO.test(Q)}var f7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function fO(Q){return f7.lastIndex=0,f7.test(Q)}var lO=-2147483648,mO=2147483647;function cO(Q){return Number.isInteger(Q)&&Q<=mO&&Q>=lO}function pO(Q){return Number.isInteger(Q)}function l7(){return!0}var iO=/[^\\]\\Z/;function nO(Q){if(iO.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var t7=N((o7)=>{Object.defineProperty(o7,"__esModule",{value:!0});o7.formatLimitDefinition=void 0;var dO=BX(),x0=v(),A1=x0.operators,JQ={formatMaximum:{okStr:"<=",ok:A1.LTE,fail:A1.GT},formatMinimum:{okStr:">=",ok:A1.GTE,fail:A1.LT},formatExclusiveMaximum:{okStr:"<",ok:A1.LT,fail:A1.GTE},formatExclusiveMinimum:{okStr:">",ok:A1.GT,fail:A1.LTE}},oO={message:({keyword:Q,schemaCode:X})=>x0.str`should be ${JQ[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>x0._`{comparison: ${JQ[Q].okStr}, limit: ${X}}`};o7.formatLimitDefinition={keyword:Object.keys(JQ),type:"string",schemaType:"string",$data:!0,error:oO,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:G,it:$}=Q,{opts:J,self:z}=$;if(!J.validateFormats)return;let H=new dO.KeywordCxt($,z.RULES.all.format.definition,"format");if(H.$data)U();else A();function U(){let B=X.scopeValue("formats",{ref:z.formats,code:J.code.formats}),L=X.const("fmt",x0._`${B}[${H.schemaCode}]`);Q.fail$data((0,x0.or)(x0._`typeof ${L} != "object"`,x0._`${L} instanceof RegExp`,x0._`typeof ${L}.compare != "function"`,K(L)))}function A(){let B=H.schema,L=z.formats[B];if(!L||L===!0)return;if(typeof L!="object"||L instanceof RegExp||typeof L.compare!="function")throw Error(`"${G}": format "${B}" does not define "compare" function`);let F=X.scopeValue("formats",{key:B,ref:L,code:J.code.formats?x0._`${J.code.formats}${(0,x0.getProperty)(B)}`:void 0});Q.fail$data(K(F))}function K(B){return x0._`${B}.compare(${Y}, ${W}) ${JQ[G].fail} 0`}},dependencies:["format"]};var tO=(Q)=>{return Q.addKeyword(o7.formatLimitDefinition),Q};o7.default=tO});var Q5=N((g4,e7)=>{Object.defineProperty(g4,"__esModule",{value:!0});var f1=d7(),sO=t7(),ZX=v(),a7=new ZX.Name("fullFormats"),eO=new ZX.Name("fastFormats"),NX=(Q,X={keywords:!0})=>{if(Array.isArray(X))return s7(Q,X,f1.fullFormats,a7),Q;let[Y,W]=X.mode==="fast"?[f1.fastFormats,eO]:[f1.fullFormats,a7],G=X.formats||f1.formatNames;if(s7(Q,G,Y,W),X.keywords)(0,sO.default)(Q);return Q};NX.get=(Q,X="full")=>{let W=(X==="fast"?f1.fastFormats:f1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function s7(Q,X,Y,W){var G,$;(G=($=Q.opts.code).formats)!==null&&G!==void 0||($.formats=ZX._`require("ajv-formats/dist/formats").${W}`);for(let J of X)Q.addFormat(J,Y[J])}e7.exports=g4=NX;Object.defineProperty(g4,"__esModule",{value:!0});g4.default=NX});var EM=Object.freeze({status:"aborted"});function q(Q,X,Y){function W(z,H){var U;Object.defineProperty(z,"_zod",{value:z._zod??{},enumerable:!1}),(U=z._zod).traits??(U.traits=new Set),z._zod.traits.add(Q),X(z,H);for(let A in J.prototype)if(!(A in z))Object.defineProperty(z,A,{value:J.prototype[A].bind(z)});z._zod.constr=J,z._zod.def=H}let G=Y?.Parent??Object;class $ extends G{}Object.defineProperty($,"name",{value:Q});function J(z){var H;let U=Y?.Parent?new $:this;W(U,z),(H=U._zod).deferred??(H.deferred=[]);for(let A of U._zod.deferred)A();return U}return Object.defineProperty(J,"init",{value:W}),Object.defineProperty(J,Symbol.hasInstance,{value:(z)=>{if(Y?.Parent&&z instanceof Y.Parent)return!0;return z?._zod?.traits?.has(Q)}}),Object.defineProperty(J,"name",{value:Q}),J}var TM=Symbol("zod_brand");class l0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class p1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var l4={};function w0(Q){if(Q)Object.assign(l4,Q);return l4}var h={};_X(h,{unwrapMessage:()=>i1,uint8ArrayToHex:()=>XH,uint8ArrayToBase64url:()=>e5,uint8ArrayToBase64:()=>mX,stringifyPrimitive:()=>i4,shallowClone:()=>gX,safeExtend:()=>r5,required:()=>t5,randomString:()=>f5,propertyKeyTypes:()=>OQ,promiseAllObject:()=>h5,primitiveTypes:()=>uX,prefixIssues:()=>c0,pick:()=>p5,partial:()=>o5,optionalKeys:()=>MQ,omit:()=>i5,objectClone:()=>y5,numKeys:()=>l5,nullish:()=>n1,normalizeParams:()=>I,mergeDefs:()=>s0,merge:()=>d5,jsonStringifyReplacer:()=>w1,joinValues:()=>m4,issue:()=>P1,isPlainObject:()=>e0,isObject:()=>B1,hexToUint8Array:()=>QH,getSizableOrigin:()=>fX,getParsedType:()=>m5,getLengthableOrigin:()=>d1,getEnumValues:()=>LQ,getElementAtPath:()=>u5,floatSafeRemainder:()=>qQ,finalizeIssue:()=>T0,extend:()=>n5,escapeRegex:()=>m0,esc:()=>c4,defineLazy:()=>m,createTransparentProxy:()=>c5,cloneDef:()=>g5,clone:()=>E0,cleanRegex:()=>r1,cleanEnum:()=>a5,captureStackTrace:()=>p4,cached:()=>b1,base64urlToUint8Array:()=>s5,base64ToUint8Array:()=>lX,assignProp:()=>a0,assertNotEqual:()=>k5,assertNever:()=>x5,assertIs:()=>v5,assertEqual:()=>C5,assert:()=>_5,allowsEval:()=>FQ,aborted:()=>Q1,NUMBER_FORMAT_RANGES:()=>VQ,Class:()=>cX,BIGINT_FORMAT_RANGES:()=>hX});function C5(Q){return Q}function k5(Q){return Q}function v5(Q){}function x5(Q){throw Error()}function _5(Q){}function LQ(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 m4(Q,X="|"){return Q.map((Y)=>i4(Y)).join(X)}function w1(Q,X){if(typeof X==="bigint")return X.toString();return X}function b1(Q){return{get value(){{let Y=Q();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function n1(Q){return Q===null||Q===void 0}function r1(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function qQ(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 H=W.match(/\d?e-(\d?)/);if(H?.[1])G=Number.parseInt(H[1])}let $=Y>G?Y:G,J=Number.parseInt(Q.toFixed($).replace(".","")),z=Number.parseInt(X.toFixed($).replace(".",""));return J%z/10**$}var yX=Symbol("evaluating");function m(Q,X,Y){let W=void 0;Object.defineProperty(Q,X,{get(){if(W===yX)return;if(W===void 0)W=yX,W=Y();return W},set(G){Object.defineProperty(Q,X,{value:G})},configurable:!0})}function y5(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function a0(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function s0(...Q){let X={};for(let Y of Q){let W=Object.getOwnPropertyDescriptors(Y);Object.assign(X,W)}return Object.defineProperties({},X)}function g5(Q){return s0(Q._zod.def)}function u5(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function h5(Q){let X=Object.keys(Q),Y=X.map((W)=>Q[W]);return Promise.all(Y).then((W)=>{let G={};for(let $=0;$<X.length;$++)G[X[$]]=W[$];return G})}function f5(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function c4(Q){return JSON.stringify(Q)}var p4="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function B1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var FQ=b1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function e0(Q){if(B1(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;let Y=X.prototype;if(B1(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function gX(Q){if(e0(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function l5(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var m5=(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}`)}},OQ=new Set(["string","number","symbol"]),uX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function m0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function I(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 c5(Q){let X;return new Proxy({},{get(Y,W,G){return X??(X=Q()),Reflect.get(X,W,G)},set(Y,W,G,$){return X??(X=Q()),Reflect.set(X,W,G,$)},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 i4(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function MQ(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var VQ={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]},hX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function p5(Q,X){let Y=Q._zod.def,W=s0(Q._zod.def,{get shape(){let G={};for(let $ in X){if(!($ in Y.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;G[$]=Y.shape[$]}return a0(this,"shape",G),G},checks:[]});return E0(Q,W)}function i5(Q,X){let Y=Q._zod.def,W=s0(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let $ in X){if(!($ in Y.shape))throw Error(`Unrecognized key: "${$}"`);if(!X[$])continue;delete G[$]}return a0(this,"shape",G),G},checks:[]});return E0(Q,W)}function n5(Q,X){if(!e0(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=s0(Q._zod.def,{get shape(){let $={...Q._zod.def.shape,...X};return a0(this,"shape",$),$},checks:[]});return E0(Q,G)}function r5(Q,X){if(!e0(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 a0(this,"shape",W),W},checks:Q._zod.def.checks};return E0(Q,Y)}function d5(Q,X){let Y=s0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X._zod.def.shape};return a0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:[]});return E0(Q,Y)}function o5(Q,X,Y){let W=s0(X._zod.def,{get shape(){let G=X._zod.def.shape,$={...G};if(Y)for(let J in Y){if(!(J in G))throw Error(`Unrecognized key: "${J}"`);if(!Y[J])continue;$[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J]}else for(let J in G)$[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J];return a0(this,"shape",$),$},checks:[]});return E0(X,W)}function t5(Q,X,Y){let W=s0(X._zod.def,{get shape(){let G=X._zod.def.shape,$={...G};if(Y)for(let J in Y){if(!(J in $))throw Error(`Unrecognized key: "${J}"`);if(!Y[J])continue;$[J]=new Q({type:"nonoptional",innerType:G[J]})}else for(let J in G)$[J]=new Q({type:"nonoptional",innerType:G[J]});return a0(this,"shape",$),$},checks:[]});return E0(X,W)}function Q1(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 c0(Q,X){return X.map((Y)=>{var W;return(W=Y).path??(W.path=[]),Y.path.unshift(Q),Y})}function i1(Q){return typeof Q==="string"?Q:Q?.message}function T0(Q,X,Y){let W={...Q,path:Q.path??[]};if(!Q.message){let G=i1(Q.inst?._zod.def?.error?.(Q))??i1(X?.error?.(Q))??i1(Y.customError?.(Q))??i1(Y.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!X?.reportInput)delete W.input;return W}function fX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function d1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function P1(...Q){let[X,Y,W]=Q;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function a5(Q){return Object.entries(Q).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function lX(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 mX(Q){let X="";for(let Y=0;Y<Q.length;Y++)X+=String.fromCharCode(Q[Y]);return btoa(X)}function s5(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-X.length%4)%4);return lX(X+Y)}function e5(Q){return mX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function QH(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 XH(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class cX{constructor(...Q){}}var pX=(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,w1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},n4=q("$ZodError",pX),ZQ=q("$ZodError",pX,{Parent:Error});function iX(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 nX(Q,X=(Y)=>Y.message){let Y={_errors:[]},W=(G)=>{for(let $ of G.issues)if($.code==="invalid_union"&&$.errors.length)$.errors.map((J)=>W({issues:J}));else if($.code==="invalid_key")W({issues:$.issues});else if($.code==="invalid_element")W({issues:$.issues});else if($.path.length===0)Y._errors.push(X($));else{let J=Y,z=0;while(z<$.path.length){let H=$.path[z];if(z!==$.path.length-1)J[H]=J[H]||{_errors:[]};else J[H]=J[H]||{_errors:[]},J[H]._errors.push(X($));J=J[H],z++}}};return W(Q),Y}var r4=(Q)=>(X,Y,W,G)=>{let $=W?Object.assign(W,{async:!1}):{async:!1},J=X._zod.run({value:Y,issues:[]},$);if(J instanceof Promise)throw new l0;if(J.issues.length){let z=new(G?.Err??Q)(J.issues.map((H)=>T0(H,$,w0())));throw p4(z,G?.callee),z}return J.value};var d4=(Q)=>async(X,Y,W,G)=>{let $=W?Object.assign(W,{async:!0}):{async:!0},J=X._zod.run({value:Y,issues:[]},$);if(J instanceof Promise)J=await J;if(J.issues.length){let z=new(G?.Err??Q)(J.issues.map((H)=>T0(H,$,w0())));throw p4(z,G?.callee),z}return J.value};var o1=(Q)=>(X,Y,W)=>{let G=W?{...W,async:!1}:{async:!1},$=X._zod.run({value:Y,issues:[]},G);if($ instanceof Promise)throw new l0;return $.issues.length?{success:!1,error:new(Q??n4)($.issues.map((J)=>T0(J,G,w0())))}:{success:!0,data:$.value}},t1=o1(ZQ),a1=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{async:!0}):{async:!0},$=X._zod.run({value:Y,issues:[]},G);if($ instanceof Promise)$=await $;return $.issues.length?{success:!1,error:new Q($.issues.map((J)=>T0(J,G,w0())))}:{success:!0,data:$.value}},o4=a1(ZQ),rX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return r4(Q)(X,Y,G)};var dX=(Q)=>(X,Y,W)=>{return r4(Q)(X,Y,W)};var oX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return d4(Q)(X,Y,G)};var tX=(Q)=>async(X,Y,W)=>{return d4(Q)(X,Y,W)};var aX=(Q)=>(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return o1(Q)(X,Y,G)};var sX=(Q)=>(X,Y,W)=>{return o1(Q)(X,Y,W)};var eX=(Q)=>async(X,Y,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return a1(Q)(X,Y,G)};var Q8=(Q)=>async(X,Y,W)=>{return a1(Q)(X,Y,W)};var X8=/^[cC][^\s-]{8,}$/,Y8=/^[0-9a-z]+$/,W8=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,G8=/^[0-9a-vA-V]{20}$/,$8=/^[A-Za-z0-9]{27}$/,J8=/^[a-zA-Z0-9_-]{21}$/,z8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var H8=/^([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})$/,NQ=(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 U8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function A8(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var K8=/^(?:(?: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])$/,B8=/^(([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}|:))$/,D8=/^((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])$/,L8=/^(([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])$/,q8=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wQ=/^[A-Za-z0-9_-]*$/,F8=/^(?=.{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 O8=/^\+(?:[0-9]){6,14}[0-9]$/,M8="(?:(?:\\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])))",V8=new RegExp(`^${M8}$`);function Z8(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 N8(Q){return new RegExp(`^${Z8(Q)}$`)}function w8(Q){let X=Z8({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(`^${M8}T(?:${W})$`)}var b8=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var P8=/^-?\d+$/,j8=/^-?\d+(?:\.\d+)?/,I8=/^(?:true|false)$/i,E8=/^null$/i;var T8=/^[^A-Z]*$/,S8=/^[^a-z]*$/;var W0=q("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),R8={number:"number",bigint:"bigint",object:"date"},bQ=q("$ZodCheckLessThan",(Q,X)=>{W0.init(Q,X);let Y=R8[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(X.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<$)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})}}),PQ=q("$ZodCheckGreaterThan",(Q,X)=>{W0.init(Q,X);let Y=R8[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(X.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>$)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})}}),C8=q("$ZodCheckMultipleOf",(Q,X)=>{W0.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):qQ(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})}}),k8=q("$ZodCheckNumberFormat",(Q,X)=>{W0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[G,$]=VQ[X.format];Q._zod.onattach.push((J)=>{let z=J._zod.bag;if(z.format=X.format,z.minimum=G,z.maximum=$,Y)z.pattern=P8}),Q._zod.check=(J)=>{let z=J.value;if(Y){if(!Number.isInteger(z)){J.issues.push({expected:W,format:X.format,code:"invalid_type",continue:!1,input:z,inst:Q});return}if(!Number.isSafeInteger(z)){if(z>0)J.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 J.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)J.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:$,inst:Q})}});var v8=q("$ZodCheckMaxLength",(Q,X)=>{var Y;W0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!n1(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 J=d1(G);W.issues.push({origin:J,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),x8=q("$ZodCheckMinLength",(Q,X)=>{var Y;W0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!n1(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 J=d1(G);W.issues.push({origin:J,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),_8=q("$ZodCheckLengthEquals",(Q,X)=>{var Y;W0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!n1(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,$=G.length;if($===X.length)return;let J=d1(G),z=$>X.length;W.issues.push({origin:J,...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})}}),s1=q("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(W0.init(Q,X),Q._zod.onattach.push((G)=>{let $=G._zod.bag;if($.format=X.format,X.pattern)$.patterns??($.patterns=new Set),$.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=()=>{})}),y8=q("$ZodCheckRegex",(Q,X)=>{s1.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})}}),g8=q("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=T8),s1.init(Q,X)}),u8=q("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=S8),s1.init(Q,X)}),h8=q("$ZodCheckIncludes",(Q,X)=>{W0.init(Q,X);let Y=m0(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=W,Q._zod.onattach.push((G)=>{let $=G._zod.bag;$.patterns??($.patterns=new Set),$.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})}}),f8=q("$ZodCheckStartsWith",(Q,X)=>{W0.init(Q,X);let Y=new RegExp(`^${m0(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})}}),l8=q("$ZodCheckEndsWith",(Q,X)=>{W0.init(Q,X);let Y=new RegExp(`.*${m0(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 m8=q("$ZodCheckOverwrite",(Q,X)=>{W0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class jQ{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(($)=>$),W=Math.min(...Y.map(($)=>$.length-$.trimStart().length)),G=Y.map(($)=>$.slice(W)).map(($)=>" ".repeat(this.indent*2)+$);for(let $ of G)this.content.push($)}compile(){let Q=Function,X=this?.args,W=[...(this?.content??[""]).map((G)=>` ${G}`)];return new Q(...X,W.join(`
|
|
11
|
-
`)
|
|
8
|
+
depsCount: ${Y},
|
|
9
|
+
deps: ${X}}`};var Oq={keyword:"dependencies",type:"object",schemaType:"object",error:iz.error,code(Q){let[Y,X]=Mq(Q);cz(Q,Y),pz(Q,X)}};function Mq({schema:Q}){let Y={},X={};for(let W in Q){if(W==="__proto__")continue;let G=Array.isArray(Q[W])?Y:X;G[W]=Q[W]}return[Y,X]}function cz(Q,Y=Q.schema){let{gen:X,data:W,it:G}=Q;if(Object.keys(Y).length===0)return;let $=X.let("missing");for(let J in Y){let z=Y[J];if(z.length===0)continue;let H=(0,y4.propertyInData)(X,W,J,G.opts.ownProperties);if(Q.setParams({property:J,depsCount:z.length,deps:z.join(", ")}),G.allErrors)X.if(H,()=>{for(let A of z)(0,y4.checkReportMissingProp)(Q,A)});else X.if(A9._`${H} && (${(0,y4.checkMissingProp)(Q,z,$)})`),(0,y4.reportMissingProp)(Q,$),X.else()}}iz.validatePropertyDeps=cz;function pz(Q,Y=Q.schema){let{gen:X,data:W,keyword:G,it:$}=Q,J=X.name("valid");for(let z in Y){if((0,qq.alwaysValidSchema)($,Y[z]))continue;X.if((0,y4.propertyInData)(X,W,z,$.opts.ownProperties),()=>{let H=Q.subschema({keyword:G,schemaProp:z},J);Q.mergeValidEvaluated(H,J)},()=>X.var(J,!0)),Q.ok(J)}}iz.validateSchemaDeps=pz;iz.default=Oq});var az=Z((tz)=>{Object.defineProperty(tz,"__esModule",{value:!0});var oz=v(),Zq=f(),wq={message:"property name must be valid",params:({params:Q})=>oz._`{propertyName: ${Q.propertyName}}`},bq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:wq,code(Q){let{gen:Y,schema:X,data:W,it:G}=Q;if((0,Zq.alwaysValidSchema)(G,X))return;let $=Y.name("valid");Y.forIn("key",W,(J)=>{Q.setParams({propertyName:J}),Q.subschema({keyword:"propertyNames",data:J,dataTypes:["string"],propertyName:J,compositeRule:!0},$),Y.if((0,oz.not)($),()=>{if(Q.error(!0),!G.allErrors)Y.break()})}),Q.ok($)}};tz.default=bq});var U9=Z((sz)=>{Object.defineProperty(sz,"__esModule",{value:!0});var Y6=I0(),v0=v(),Iq=r0(),X6=f(),jq={message:"must NOT have additional properties",params:({params:Q})=>v0._`{additionalProperty: ${Q.additionalProperty}}`},Eq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jq,code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,errsCount:$,it:J}=Q;if(!$)throw Error("ajv implementation error");let{allErrors:z,opts:H}=J;if(J.props=!0,H.removeAdditional!=="all"&&(0,X6.alwaysValidSchema)(J,X))return;let A=(0,Y6.allSchemaProperties)(W.properties),U=(0,Y6.allSchemaProperties)(W.patternProperties);K(),Q.ok(v0._`${$} === ${Iq.default.errors}`);function K(){Y.forIn("key",G,(V)=>{if(!A.length&&!U.length)q(V);else Y.if(D(V),()=>q(V))})}function D(V){let M;if(A.length>8){let S=(0,X6.schemaRefOrVal)(J,W.properties,"properties");M=(0,Y6.isOwnProperty)(Y,S,V)}else if(A.length)M=(0,v0.or)(...A.map((S)=>v0._`${V} === ${S}`));else M=v0.nil;if(U.length)M=(0,v0.or)(M,...U.map((S)=>v0._`${(0,Y6.usePattern)(Q,S)}.test(${V})`));return(0,v0.not)(M)}function L(V){Y.code(v0._`delete ${G}[${V}]`)}function q(V){if(H.removeAdditional==="all"||H.removeAdditional&&X===!1){L(V);return}if(X===!1){if(Q.setParams({additionalProperty:V}),Q.error(),!z)Y.break();return}if(typeof X=="object"&&!(0,X6.alwaysValidSchema)(J,X)){let M=Y.name("valid");if(H.removeAdditional==="failing")O(V,M,!1),Y.if((0,v0.not)(M),()=>{Q.reset(),L(V)});else if(O(V,M),!z)Y.if((0,v0.not)(M),()=>Y.break())}}function O(V,M,S){let E={keyword:"additionalProperties",dataProp:V,dataPropType:X6.Type.Str};if(S===!1)Object.assign(E,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(E,M)}}};sz.default=Eq});var X7=Z((Y7)=>{Object.defineProperty(Y7,"__esModule",{value:!0});var Sq=P4(),ez=I0(),K9=f(),Q7=U9(),Rq={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,parentSchema:W,data:G,it:$}=Q;if($.opts.removeAdditional==="all"&&W.additionalProperties===void 0)Q7.default.code(new Sq.KeywordCxt($,Q7.default,"additionalProperties"));let J=(0,ez.allSchemaProperties)(X);for(let K of J)$.definedProperties.add(K);if($.opts.unevaluated&&J.length&&$.props!==!0)$.props=K9.mergeEvaluated.props(Y,(0,K9.toHash)(J),$.props);let z=J.filter((K)=>!(0,K9.alwaysValidSchema)($,X[K]));if(z.length===0)return;let H=Y.name("valid");for(let K of z){if(A(K))U(K);else{if(Y.if((0,ez.propertyInData)(Y,G,K,$.opts.ownProperties)),U(K),!$.allErrors)Y.else().var(H,!0);Y.endIf()}Q.it.definedProperties.add(K),Q.ok(H)}function A(K){return $.opts.useDefaults&&!$.compositeRule&&X[K].default!==void 0}function U(K){Q.subschema({keyword:"properties",schemaProp:K,dataProp:K},H)}}};Y7.default=Rq});var z7=Z((J7)=>{Object.defineProperty(J7,"__esModule",{value:!0});var W7=I0(),W6=v(),G7=f(),$7=f(),kq={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:Y,schema:X,data:W,parentSchema:G,it:$}=Q,{opts:J}=$,z=(0,W7.allSchemaProperties)(X),H=z.filter((O)=>(0,G7.alwaysValidSchema)($,X[O]));if(z.length===0||H.length===z.length&&(!$.opts.unevaluated||$.props===!0))return;let A=J.strictSchema&&!J.allowMatchingProperties&&G.properties,U=Y.name("valid");if($.props!==!0&&!($.props instanceof W6.Name))$.props=(0,$7.evaluatedPropsToName)(Y,$.props);let{props:K}=$;D();function D(){for(let O of z){if(A)L(O);if($.allErrors)q(O);else Y.var(U,!0),q(O),Y.if(U)}}function L(O){for(let V in A)if(new RegExp(O).test(V))(0,G7.checkStrictMode)($,`property ${V} matches pattern ${O} (use allowMatchingProperties)`)}function q(O){Y.forIn("key",W,(V)=>{Y.if(W6._`${(0,W7.usePattern)(Q,O)}.test(${V})`,()=>{let M=H.includes(O);if(!M)Q.subschema({keyword:"patternProperties",schemaProp:O,dataProp:V,dataPropType:$7.Type.Str},U);if($.opts.unevaluated&&K!==!0)Y.assign(W6._`${K}[${V}]`,!0);else if(!M&&!$.allErrors)Y.if((0,W6.not)(U),()=>Y.break())})})}}};J7.default=kq});var A7=Z((H7)=>{Object.defineProperty(H7,"__esModule",{value:!0});var xq=f(),_q={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:Y,schema:X,it:W}=Q;if((0,xq.alwaysValidSchema)(W,X)){Q.fail();return}let G=Y.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"}};H7.default=_q});var K7=Z((U7)=>{Object.defineProperty(U7,"__esModule",{value:!0});var gq=I0(),uq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:gq.validateUnion,error:{message:"must match a schema in anyOf"}};U7.default=uq});var B7=Z((D7)=>{Object.defineProperty(D7,"__esModule",{value:!0});var G6=v(),fq=f(),lq={message:"must match exactly one schema in oneOf",params:({params:Q})=>G6._`{passingSchemas: ${Q.passing}}`},mq={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:lq,code(Q){let{gen:Y,schema:X,parentSchema:W,it:G}=Q;if(!Array.isArray(X))throw Error("ajv implementation error");if(G.opts.discriminator&&W.discriminator)return;let $=X,J=Y.let("valid",!1),z=Y.let("passing",null),H=Y.name("_valid");Q.setParams({passing:z}),Y.block(A),Q.result(J,()=>Q.reset(),()=>Q.error(!0));function A(){$.forEach((U,K)=>{let D;if((0,fq.alwaysValidSchema)(G,U))Y.var(H,!0);else D=Q.subschema({keyword:"oneOf",schemaProp:K,compositeRule:!0},H);if(K>0)Y.if(G6._`${H} && ${J}`).assign(J,!1).assign(z,G6._`[${z}, ${K}]`).else();Y.if(H,()=>{if(Y.assign(J,!0),Y.assign(z,K),D)Q.mergeEvaluated(D,G6.Name)})})}}};D7.default=mq});var F7=Z((L7)=>{Object.defineProperty(L7,"__esModule",{value:!0});var pq=f(),iq={keyword:"allOf",schemaType:"array",code(Q){let{gen:Y,schema:X,it:W}=Q;if(!Array.isArray(X))throw Error("ajv implementation error");let G=Y.name("valid");X.forEach(($,J)=>{if((0,pq.alwaysValidSchema)(W,$))return;let z=Q.subschema({keyword:"allOf",schemaProp:J},G);Q.ok(G),Q.mergeEvaluated(z)})}};L7.default=iq});var V7=Z((M7)=>{Object.defineProperty(M7,"__esModule",{value:!0});var $6=v(),O7=f(),nq={message:({params:Q})=>$6.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>$6._`{failingKeyword: ${Q.ifClause}}`},dq={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:nq,code(Q){let{gen:Y,parentSchema:X,it:W}=Q;if(X.then===void 0&&X.else===void 0)(0,O7.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=q7(W,"then"),$=q7(W,"else");if(!G&&!$)return;let J=Y.let("valid",!0),z=Y.name("_valid");if(H(),Q.reset(),G&&$){let U=Y.let("ifClause");Q.setParams({ifClause:U}),Y.if(z,A("then",U),A("else",U))}else if(G)Y.if(z,A("then"));else Y.if((0,$6.not)(z),A("else"));Q.pass(J,()=>Q.error(!0));function H(){let U=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},z);Q.mergeEvaluated(U)}function A(U,K){return()=>{let D=Q.subschema({keyword:U},z);if(Y.assign(J,z),Q.mergeValidEvaluated(D,J),K)Y.assign(K,$6._`${U}`);else Q.setParams({ifClause:U})}}}};function q7(Q,Y){let X=Q.schema[Y];return X!==void 0&&!(0,O7.alwaysValidSchema)(Q,X)}M7.default=dq});var Z7=Z((N7)=>{Object.defineProperty(N7,"__esModule",{value:!0});var tq=f(),aq={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:Y,it:X}){if(Y.if===void 0)(0,tq.checkStrictMode)(X,`"${Q}" without "if" is ignored`)}};N7.default=aq});var b7=Z((w7)=>{Object.defineProperty(w7,"__esModule",{value:!0});var eq=z9(),QO=gz(),YO=H9(),XO=fz(),WO=mz(),GO=dz(),$O=az(),JO=U9(),zO=X7(),HO=z7(),AO=A7(),UO=K7(),KO=B7(),DO=F7(),BO=V7(),LO=Z7();function FO(Q=!1){let Y=[AO.default,UO.default,KO.default,DO.default,BO.default,LO.default,$O.default,JO.default,GO.default,zO.default,HO.default];if(Q)Y.push(QO.default,XO.default);else Y.push(eq.default,YO.default);return Y.push(WO.default),Y}w7.default=FO});var I7=Z((P7)=>{Object.defineProperty(P7,"__esModule",{value:!0});var e=v(),OO={message:({schemaCode:Q})=>e.str`must match format "${Q}"`,params:({schemaCode:Q})=>e._`{format: ${Q}}`},MO={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:OO,code(Q,Y){let{gen:X,data:W,$data:G,schema:$,schemaCode:J,it:z}=Q,{opts:H,errSchemaPath:A,schemaEnv:U,self:K}=z;if(!H.validateFormats)return;if(G)D();else L();function D(){let q=X.scopeValue("formats",{ref:K.formats,code:H.code.formats}),O=X.const("fDef",e._`${q}[${J}]`),V=X.let("fType"),M=X.let("format");X.if(e._`typeof ${O} == "object" && !(${O} instanceof RegExp)`,()=>X.assign(V,e._`${O}.type || "string"`).assign(M,e._`${O}.validate`),()=>X.assign(V,e._`"string"`).assign(M,O)),Q.fail$data((0,e.or)(S(),E()));function S(){if(H.strictSchema===!1)return e.nil;return e._`${J} && !${M}`}function E(){let x=U.$async?e._`(${O}.async ? await ${M}(${W}) : ${M}(${W}))`:e._`${M}(${W})`,T=e._`(typeof ${M} == "function" ? ${x} : ${M}.test(${W}))`;return e._`${M} && ${M} !== true && ${V} === ${Y} && !${T}`}}function L(){let q=K.formats[$];if(!q){S();return}if(q===!0)return;let[O,V,M]=E(q);if(O===Y)Q.pass(x());function S(){if(H.strictSchema===!1){K.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${$}" ignored in schema at path "${A}"`}}function E(T){let _0=T instanceof RegExp?(0,e.regexpCode)(T):H.code.formats?e._`${H.code.formats}${(0,e.getProperty)($)}`:void 0,f0=X.scopeValue("formats",{key:$,ref:T,code:_0});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,e._`${f0}.validate`];return["string",T,f0]}function x(){if(typeof q=="object"&&!(q instanceof RegExp)&&q.async){if(!U.$async)throw Error("async format in sync schema");return e._`await ${M}(${W})`}return typeof V=="function"?e._`${M}(${W})`:e._`${M}.test(${W})`}}}};P7.default=MO});var E7=Z((j7)=>{Object.defineProperty(j7,"__esModule",{value:!0});var NO=I7(),ZO=[NO.default];j7.default=ZO});var R7=Z((T7)=>{Object.defineProperty(T7,"__esModule",{value:!0});T7.contentVocabulary=T7.metadataVocabulary=void 0;T7.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];T7.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var v7=Z((k7)=>{Object.defineProperty(k7,"__esModule",{value:!0});var PO=Yz(),IO=Tz(),jO=b7(),EO=E7(),C7=R7(),TO=[PO.default,IO.default,(0,jO.default)(),EO.default,C7.metadataVocabulary,C7.contentVocabulary];k7.default=TO});var g7=Z((_7)=>{Object.defineProperty(_7,"__esModule",{value:!0});_7.DiscrError=void 0;var x7;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(x7||(_7.DiscrError=x7={}))});var f7=Z((h7)=>{Object.defineProperty(h7,"__esModule",{value:!0});var f1=v(),D9=g7(),u7=fQ(),RO=I4(),CO=f(),kO={message:({params:{discrError:Q,tagName:Y}})=>Q===D9.DiscrError.Tag?`tag "${Y}" must be string`:`value of tag "${Y}" must be in oneOf`,params:({params:{discrError:Q,tag:Y,tagName:X}})=>f1._`{error: ${Q}, tag: ${X}, tagValue: ${Y}}`},vO={keyword:"discriminator",type:"object",schemaType:"object",error:kO,code(Q){let{gen:Y,data:X,schema:W,parentSchema:G,it:$}=Q,{oneOf:J}=G;if(!$.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(!J)throw Error("discriminator: requires oneOf keyword");let H=Y.let("valid",!1),A=Y.const("tag",f1._`${X}${(0,f1.getProperty)(z)}`);Y.if(f1._`typeof ${A} == "string"`,()=>U(),()=>Q.error(!1,{discrError:D9.DiscrError.Tag,tag:A,tagName:z})),Q.ok(H);function U(){let L=D();Y.if(!1);for(let q in L)Y.elseIf(f1._`${A} === ${q}`),Y.assign(H,K(L[q]));Y.else(),Q.error(!1,{discrError:D9.DiscrError.Mapping,tag:A,tagName:z}),Y.endIf()}function K(L){let q=Y.name("valid"),O=Q.subschema({keyword:"oneOf",schemaProp:L},q);return Q.mergeEvaluated(O,f1.Name),q}function D(){var L;let q={},O=M(G),V=!0;for(let x=0;x<J.length;x++){let T=J[x];if((T===null||T===void 0?void 0:T.$ref)&&!(0,CO.schemaHasRulesButRef)(T,$.self.RULES)){let f0=T.$ref;if(T=u7.resolveRef.call($.self,$.schemaEnv.root,$.baseId,f0),T instanceof u7.SchemaEnv)T=T.schema;if(T===void 0)throw new RO.default($.opts.uriResolver,$.baseId,f0)}let _0=(L=T===null||T===void 0?void 0:T.properties)===null||L===void 0?void 0:L[z];if(typeof _0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${z}"`);V=V&&(O||M(T)),S(_0,x)}if(!V)throw Error(`discriminator: "${z}" must be required`);return q;function M({required:x}){return Array.isArray(x)&&x.includes(z)}function S(x,T){if(x.const)E(x.const,T);else if(x.enum)for(let _0 of x.enum)E(_0,T);else throw Error(`discriminator: "properties/${z}" must have "const" or "enum"`)}function E(x,T){if(typeof x!="string"||x in q)throw Error(`discriminator: "${z}" values must be unique strings`);q[x]=T}}}};h7.default=vO});var l7=Z((tI,_O)=>{_O.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 L9=Z((M0,B9)=>{Object.defineProperty(M0,"__esModule",{value:!0});M0.MissingRefError=M0.ValidationError=M0.CodeGen=M0.Name=M0.nil=M0.stringify=M0.str=M0._=M0.KeywordCxt=M0.Ajv=void 0;var yO=iJ(),gO=v7(),uO=f7(),m7=l7(),hO=["/properties"],J6="http://json-schema.org/draft-07/schema";class g4 extends yO.default{_addVocabularies(){if(super._addVocabularies(),gO.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(uO.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(m7,hO):m7;this.addMetaSchema(Q,J6,!1),this.refs["http://json-schema.org/schema"]=J6}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(J6)?J6:void 0)}}M0.Ajv=g4;B9.exports=M0=g4;B9.exports.Ajv=g4;Object.defineProperty(M0,"__esModule",{value:!0});M0.default=g4;var fO=P4();Object.defineProperty(M0,"KeywordCxt",{enumerable:!0,get:function(){return fO.KeywordCxt}});var l1=v();Object.defineProperty(M0,"_",{enumerable:!0,get:function(){return l1._}});Object.defineProperty(M0,"str",{enumerable:!0,get:function(){return l1.str}});Object.defineProperty(M0,"stringify",{enumerable:!0,get:function(){return l1.stringify}});Object.defineProperty(M0,"nil",{enumerable:!0,get:function(){return l1.nil}});Object.defineProperty(M0,"Name",{enumerable:!0,get:function(){return l1.Name}});Object.defineProperty(M0,"CodeGen",{enumerable:!0,get:function(){return l1.CodeGen}});var lO=uQ();Object.defineProperty(M0,"ValidationError",{enumerable:!0,get:function(){return lO.default}});var mO=I4();Object.defineProperty(M0,"MissingRefError",{enumerable:!0,get:function(){return mO.default}})});var s7=Z((t7)=>{Object.defineProperty(t7,"__esModule",{value:!0});t7.formatNames=t7.fastFormats=t7.fullFormats=void 0;function u0(Q,Y){return{validate:Q,compare:Y}}t7.fullFormats={date:u0(r7,M9),time:u0(q9(!0),V9),"date-time":u0(c7(!0),d7),"iso-time":u0(q9(),n7),"iso-date-time":u0(c7(),o7),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:tO,"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:WM,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:aO,int32:{type:"number",validate:QM},int64:{type:"number",validate:YM},float:{type:"number",validate:i7},double:{type:"number",validate:i7},password:!0,binary:!0};t7.fastFormats={...t7.fullFormats,date:u0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,M9),time:u0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,V9),"date-time":u0(/^\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,d7),"iso-time":u0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,n7),"iso-date-time":u0(/^\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,o7),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};t7.formatNames=Object.keys(t7.fullFormats);function iO(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var rO=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,nO=[0,31,28,31,30,31,30,31,31,30,31,30,31];function r7(Q){let Y=rO.exec(Q);if(!Y)return!1;let X=+Y[1],W=+Y[2],G=+Y[3];return W>=1&&W<=12&&G>=1&&G<=(W===2&&iO(X)?29:nO[W])}function M9(Q,Y){if(!(Q&&Y))return;if(Q>Y)return 1;if(Q<Y)return-1;return 0}var F9=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function q9(Q){return function(X){let W=F9.exec(X);if(!W)return!1;let G=+W[1],$=+W[2],J=+W[3],z=W[4],H=W[5]==="-"?-1:1,A=+(W[6]||0),U=+(W[7]||0);if(A>23||U>59||Q&&!z)return!1;if(G<=23&&$<=59&&J<60)return!0;let K=$-U*H,D=G-A*H-(K<0?1:0);return(D===23||D===-1)&&(K===59||K===-1)&&J<61}}function V9(Q,Y){if(!(Q&&Y))return;let X=new Date("2020-01-01T"+Q).valueOf(),W=new Date("2020-01-01T"+Y).valueOf();if(!(X&&W))return;return X-W}function n7(Q,Y){if(!(Q&&Y))return;let X=F9.exec(Q),W=F9.exec(Y);if(!(X&&W))return;if(Q=X[1]+X[2]+X[3],Y=W[1]+W[2]+W[3],Q>Y)return 1;if(Q<Y)return-1;return 0}var O9=/t|\s/i;function c7(Q){let Y=q9(Q);return function(W){let G=W.split(O9);return G.length===2&&r7(G[0])&&Y(G[1])}}function d7(Q,Y){if(!(Q&&Y))return;let X=new Date(Q).valueOf(),W=new Date(Y).valueOf();if(!(X&&W))return;return X-W}function o7(Q,Y){if(!(Q&&Y))return;let[X,W]=Q.split(O9),[G,$]=Y.split(O9),J=M9(X,G);if(J===void 0)return;return J||V9(W,$)}var dO=/\/|:/,oO=/^(?:[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 tO(Q){return dO.test(Q)&&oO.test(Q)}var p7=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function aO(Q){return p7.lastIndex=0,p7.test(Q)}var sO=-2147483648,eO=2147483647;function QM(Q){return Number.isInteger(Q)&&Q<=eO&&Q>=sO}function YM(Q){return Number.isInteger(Q)}function i7(){return!0}var XM=/[^\\]\\Z/;function WM(Q){if(XM.test(Q))return!1;try{return new RegExp(Q),!0}catch(Y){return!1}}});var Q5=Z((e7)=>{Object.defineProperty(e7,"__esModule",{value:!0});e7.formatLimitDefinition=void 0;var $M=L9(),x0=v(),D1=x0.operators,z6={formatMaximum:{okStr:"<=",ok:D1.LTE,fail:D1.GT},formatMinimum:{okStr:">=",ok:D1.GTE,fail:D1.LT},formatExclusiveMaximum:{okStr:"<",ok:D1.LT,fail:D1.GTE},formatExclusiveMinimum:{okStr:">",ok:D1.GT,fail:D1.LTE}},JM={message:({keyword:Q,schemaCode:Y})=>x0.str`should be ${z6[Q].okStr} ${Y}`,params:({keyword:Q,schemaCode:Y})=>x0._`{comparison: ${z6[Q].okStr}, limit: ${Y}}`};e7.formatLimitDefinition={keyword:Object.keys(z6),type:"string",schemaType:"string",$data:!0,error:JM,code(Q){let{gen:Y,data:X,schemaCode:W,keyword:G,it:$}=Q,{opts:J,self:z}=$;if(!J.validateFormats)return;let H=new $M.KeywordCxt($,z.RULES.all.format.definition,"format");if(H.$data)A();else U();function A(){let D=Y.scopeValue("formats",{ref:z.formats,code:J.code.formats}),L=Y.const("fmt",x0._`${D}[${H.schemaCode}]`);Q.fail$data((0,x0.or)(x0._`typeof ${L} != "object"`,x0._`${L} instanceof RegExp`,x0._`typeof ${L}.compare != "function"`,K(L)))}function U(){let D=H.schema,L=z.formats[D];if(!L||L===!0)return;if(typeof L!="object"||L instanceof RegExp||typeof L.compare!="function")throw Error(`"${G}": format "${D}" does not define "compare" function`);let q=Y.scopeValue("formats",{key:D,ref:L,code:J.code.formats?x0._`${J.code.formats}${(0,x0.getProperty)(D)}`:void 0});Q.fail$data(K(q))}function K(D){return x0._`${D}.compare(${X}, ${W}) ${z6[G].fail} 0`}},dependencies:["format"]};var zM=(Q)=>{return Q.addKeyword(e7.formatLimitDefinition),Q};e7.default=zM});var G5=Z((u4,W5)=>{Object.defineProperty(u4,"__esModule",{value:!0});var m1=s7(),AM=Q5(),w9=v(),Y5=new w9.Name("fullFormats"),UM=new w9.Name("fastFormats"),b9=(Q,Y={keywords:!0})=>{if(Array.isArray(Y))return X5(Q,Y,m1.fullFormats,Y5),Q;let[X,W]=Y.mode==="fast"?[m1.fastFormats,UM]:[m1.fullFormats,Y5],G=Y.formats||m1.formatNames;if(X5(Q,G,X,W),Y.keywords)(0,AM.default)(Q);return Q};b9.get=(Q,Y="full")=>{let W=(Y==="fast"?m1.fastFormats:m1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function X5(Q,Y,X,W){var G,$;(G=($=Q.opts.code).formats)!==null&&G!==void 0||($.formats=w9._`require("ajv-formats/dist/formats").${W}`);for(let J of Y)Q.addFormat(J,X[J])}W5.exports=u4=b9;Object.defineProperty(u4,"__esModule",{value:!0});u4.default=b9});import{AsyncLocalStorage as g5}from"node:async_hooks";class L1 extends Error{statusCode;rawDetails;code;context;constructor(Q,Y,X,W,G){super(Q);this.statusCode=Y;this.rawDetails=X;this.code=W;this.context=G;this.name="McpApiError"}}function _5(Q){if(Q instanceof L1)return{message:Q.message,statusCode:Q.statusCode,code:Q.code,rawDetails:Q.rawDetails,context:Q.context};if(Q instanceof Error)return{message:Q.message};return{message:String(Q)}}function y5(Q){let Y=_5(Q),X=Y.message.trim()||"Unknown error",W=X.toLowerCase(),G=Y.rawDetails?.trim()||X;if(Y.context?.title||Y.context?.description||Y.context?.howToFix||Y.context?.docsUrl)return{title:Y.context.title??(Y.statusCode===409?"Request conflict":"API request failed"),description:Y.context.description??X,howToFix:Y.context.howToFix??"Review the details below, adjust the tool input, and retry.",docsUrl:Y.context.docsUrl??"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.code==="MCP_AUTH_REQUIRED"||W.includes("sequenzy_api_key environment variable is required"))return{title:"Missing MCP API key",description:"The MCP server started without a Sequenzy API key, so it cannot authenticate any tool or resource request.",howToFix:"Add `SEQUENZY_API_KEY` to the MCP server environment, or run `npx @sequenzy/setup` to configure the integration automatically.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.statusCode===401||Y.code==="UNAUTHORIZED")return{title:"Authentication failed",description:"The MCP server reached Sequenzy, but the current API key was rejected.",howToFix:"Replace `SEQUENZY_API_KEY` with a valid personal API key, then restart the MCP client so it reconnects with fresh credentials.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(Y.statusCode===403||W.includes("access denied"))return{title:"Access denied",description:"The current API key is valid, but it does not have permission to access the requested company or action.",howToFix:"Use an API key that belongs to the right account, or select a company the key can access before retrying the tool call.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(W.includes("no company available")||W.includes("company not found"))return{title:"Company selection required",description:"The MCP server could not resolve a company for this request.",howToFix:"Call `get_account` to inspect available companies, then call `select_company`, or pass `companyId` explicitly in the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.statusCode===404||W.includes("not found"))return{title:"Requested resource not found",description:"Sequenzy could not find the requested campaign, template, sequence, company, or subscriber.",howToFix:"List or fetch the resource collection first, then retry the tool with a confirmed ID or email value.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.statusCode===409||W.includes("already exists"))return{title:"Resource already exists",description:"Sequenzy rejected this MCP request because it would create a duplicate resource.",howToFix:"List the existing resources first, reuse the matching resource when appropriate, or retry with a unique name or domain.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.statusCode===429||W.includes("rate limit"))return{title:"Rate limited",description:"Sequenzy temporarily slowed this MCP request because too many requests were sent too quickly.",howToFix:"Wait briefly before retrying. If the client is looping, reduce retries or add backoff before the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.code==="NETWORK_ERROR"||W.includes("fetch failed"))return{title:"Network or configuration error",description:"The MCP server could not reach the Sequenzy API from this environment.",howToFix:"Check connectivity and verify `SEQUENZY_API_URL` if you override it in the MCP environment.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("unknown tool")||W.includes("unknown resource"))return{title:"Unsupported MCP request",description:"The client asked for a tool or resource name that this Sequenzy MCP server does not expose.",howToFix:"Refresh the client's tool list and call only the names returned by `list_tools` or `list_resources`.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("is required")||W.includes("invalid"))return{title:"Invalid MCP input",description:"The tool call was missing a required field or included an invalid value.",howToFix:"Review the tool schema, supply the missing argument, and retry the request with corrected input.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(Y.statusCode&&Y.statusCode>=500)return{title:"Sequenzy server error",description:"The request reached Sequenzy, but the server could not complete it successfully.",howToFix:"Retry once. If it still fails, keep the details below and consult the docs before escalating.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};return{title:"Tool execution failed",description:"The MCP server could not complete the requested operation.",howToFix:"Review the details below, adjust the tool input or credentials, and retry.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G}}function a0(Q){let Y=y5(Q);return[`Sequenzy MCP error: ${Y.title}`,`Description: ${Y.description}`,`How to fix: ${Y.howToFix}`,`Docs: ${Y.docsUrl}`,`Details: ${Y.details}`].join(`
|
|
10
|
+
`)}var u5="https://api.sequenzy.com",p1=new g5,g9=null;function s0(){let Q=p1.getStore();if(Q)return Q.selectedCompanyId??null;return g9}function l4(Q){let Y=p1.getStore();if(Y){Y.selectedCompanyId=Q;return}g9=Q}function L6(Q,Y){return p1.run(Q,Y)}function h5(){return p1.getStore()?.apiUrl??process.env.SEQUENZY_API_URL??u5}function u9(){return p1.getStore()?.apiKey??process.env.SEQUENZY_API_KEY}function h9(){if(u9())return;console.error(a0(new L1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1)}function V0(Q,Y){let X=Q[Y];return typeof X==="string"&&X.trim()!==""?X.trim():void 0}function f5(Q){if(Q===void 0)return;if(typeof Q==="string")return Q.trim()||void 0;return JSON.stringify(Q)}function l5(Q){if(!Q.trim())return{message:"Request failed"};try{let Y=JSON.parse(Q);if(typeof Y==="string")return{message:Y};let X=typeof Y.error==="object"&&Y.error!==null?Y.error:void 0,W=V0(Y,"code")??(X?V0(X,"code"):void 0),G=(typeof Y.error==="string"?Y.error:void 0)??(X?V0(X,"message"):void 0)??V0(Y,"message")??V0(Y,"error")??Q,$=V0(Y,"howToFix")??V0(Y,"resolution"),J={...V0(Y,"title")?{title:V0(Y,"title")}:{},...V0(Y,"description")?{description:V0(Y,"description")}:{},...$?{howToFix:$}:{},...V0(Y,"docsUrl")?{docsUrl:V0(Y,"docsUrl")}:{}},z=f5(Y.details);if(Object.keys(J).length>0||z)return{message:G,...W?{code:W}:{},...z?{details:z}:{},...Object.keys(J).length>0?{context:J}:{}};if(typeof Y.error==="string")return{message:Y.error,...W?{code:W}:{}};if(X)return{message:G,...W?{code:W}:{}};return{message:G,...W?{code:W}:{}}}catch{return{message:Q}}}async function N(Q,Y,X,W){let G=u9();if(!G)throw new L1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED");let $={"Content-Type":"application/json",Authorization:`Bearer ${G}`},J=W??s0();if(J)$["x-company-id"]=J;let z;try{z=await fetch(`${h5()}${Y}`,{method:Q,headers:$,body:X?JSON.stringify(X):void 0})}catch(H){throw new L1(H instanceof Error?H.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!z.ok){let H=await z.text(),A=l5(H);throw new L1(A.message,z.status,A.details??H,A.code,A.context)}return z.json()}var gM=Object.freeze({status:"aborted"});function F(Q,Y,X){function W(z,H){var A;Object.defineProperty(z,"_zod",{value:z._zod??{},enumerable:!1}),(A=z._zod).traits??(A.traits=new Set),z._zod.traits.add(Q),Y(z,H);for(let U in J.prototype)if(!(U in z))Object.defineProperty(z,U,{value:J.prototype[U].bind(z)});z._zod.constr=J,z._zod.def=H}let G=X?.Parent??Object;class $ extends G{}Object.defineProperty($,"name",{value:Q});function J(z){var H;let A=X?.Parent?new $:this;W(A,z),(H=A._zod).deferred??(H.deferred=[]);for(let U of A._zod.deferred)U();return A}return Object.defineProperty(J,"init",{value:W}),Object.defineProperty(J,Symbol.hasInstance,{value:(z)=>{if(X?.Parent&&z instanceof X.Parent)return!0;return z?._zod?.traits?.has(Q)}}),Object.defineProperty(J,"name",{value:Q}),J}var uM=Symbol("zod_brand");class l0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class i1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}var m4={};function w0(Q){if(Q)Object.assign(m4,Q);return m4}var h={};y9(h,{unwrapMessage:()=>r1,uint8ArrayToHex:()=>DH,uint8ArrayToBase64url:()=>UH,uint8ArrayToBase64:()=>r9,stringifyPrimitive:()=>r4,shallowClone:()=>l9,safeExtend:()=>GH,required:()=>zH,randomString:()=>a5,propertyKeyTypes:()=>V6,promiseAllObject:()=>t5,primitiveTypes:()=>m9,prefixIssues:()=>c0,pick:()=>YH,partial:()=>JH,optionalKeys:()=>N6,omit:()=>XH,objectClone:()=>n5,numKeys:()=>s5,nullish:()=>n1,normalizeParams:()=>j,mergeDefs:()=>Q1,merge:()=>$H,jsonStringifyReplacer:()=>P1,joinValues:()=>c4,issue:()=>j1,isPlainObject:()=>Y1,isObject:()=>F1,hexToUint8Array:()=>KH,getSizableOrigin:()=>p9,getParsedType:()=>e5,getLengthableOrigin:()=>o1,getEnumValues:()=>q6,getElementAtPath:()=>o5,floatSafeRemainder:()=>O6,finalizeIssue:()=>T0,extend:()=>WH,escapeRegex:()=>m0,esc:()=>p4,defineLazy:()=>m,createTransparentProxy:()=>QH,cloneDef:()=>d5,clone:()=>E0,cleanRegex:()=>d1,cleanEnum:()=>HH,captureStackTrace:()=>i4,cached:()=>I1,base64urlToUint8Array:()=>AH,base64ToUint8Array:()=>i9,assignProp:()=>e0,assertNotEqual:()=>c5,assertNever:()=>i5,assertIs:()=>p5,assertEqual:()=>m5,assert:()=>r5,allowsEval:()=>M6,aborted:()=>X1,NUMBER_FORMAT_RANGES:()=>Z6,Class:()=>n9,BIGINT_FORMAT_RANGES:()=>c9});function m5(Q){return Q}function c5(Q){return Q}function p5(Q){}function i5(Q){throw Error()}function r5(Q){}function q6(Q){let Y=Object.values(Q).filter((W)=>typeof W==="number");return Object.entries(Q).filter(([W,G])=>Y.indexOf(+W)===-1).map(([W,G])=>G)}function c4(Q,Y="|"){return Q.map((X)=>r4(X)).join(Y)}function P1(Q,Y){if(typeof Y==="bigint")return Y.toString();return Y}function I1(Q){return{get value(){{let X=Q();return Object.defineProperty(this,"value",{value:X}),X}throw Error("cached value already set")}}}function n1(Q){return Q===null||Q===void 0}function d1(Q){let Y=Q.startsWith("^")?1:0,X=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(Y,X)}function O6(Q,Y){let X=(Q.toString().split(".")[1]||"").length,W=Y.toString(),G=(W.split(".")[1]||"").length;if(G===0&&/\d?e-\d?/.test(W)){let H=W.match(/\d?e-(\d?)/);if(H?.[1])G=Number.parseInt(H[1])}let $=X>G?X:G,J=Number.parseInt(Q.toFixed($).replace(".","")),z=Number.parseInt(Y.toFixed($).replace(".",""));return J%z/10**$}var f9=Symbol("evaluating");function m(Q,Y,X){let W=void 0;Object.defineProperty(Q,Y,{get(){if(W===f9)return;if(W===void 0)W=f9,W=X();return W},set(G){Object.defineProperty(Q,Y,{value:G})},configurable:!0})}function n5(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function e0(Q,Y,X){Object.defineProperty(Q,Y,{value:X,writable:!0,enumerable:!0,configurable:!0})}function Q1(...Q){let Y={};for(let X of Q){let W=Object.getOwnPropertyDescriptors(X);Object.assign(Y,W)}return Object.defineProperties({},Y)}function d5(Q){return Q1(Q._zod.def)}function o5(Q,Y){if(!Y)return Q;return Y.reduce((X,W)=>X?.[W],Q)}function t5(Q){let Y=Object.keys(Q),X=Y.map((W)=>Q[W]);return Promise.all(X).then((W)=>{let G={};for(let $=0;$<Y.length;$++)G[Y[$]]=W[$];return G})}function a5(Q=10){let X="";for(let W=0;W<Q;W++)X+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return X}function p4(Q){return JSON.stringify(Q)}var i4="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function F1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var M6=I1(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function Y1(Q){if(F1(Q)===!1)return!1;let Y=Q.constructor;if(Y===void 0)return!0;let X=Y.prototype;if(F1(X)===!1)return!1;if(Object.prototype.hasOwnProperty.call(X,"isPrototypeOf")===!1)return!1;return!0}function l9(Q){if(Y1(Q))return{...Q};if(Array.isArray(Q))return[...Q];return Q}function s5(Q){let Y=0;for(let X in Q)if(Object.prototype.hasOwnProperty.call(Q,X))Y++;return Y}var e5=(Q)=>{let Y=typeof Q;switch(Y){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: ${Y}`)}},V6=new Set(["string","number","symbol"]),m9=new Set(["string","number","bigint","boolean","symbol","undefined"]);function m0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function E0(Q,Y,X){let W=new Q._zod.constr(Y??Q._zod.def);if(!Y||X?.parent)W._zod.parent=Q;return W}function j(Q){let Y=Q;if(!Y)return{};if(typeof Y==="string")return{error:()=>Y};if(Y?.message!==void 0){if(Y?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");Y.error=Y.message}if(delete Y.message,typeof Y.error==="string")return{...Y,error:()=>Y.error};return Y}function QH(Q){let Y;return new Proxy({},{get(X,W,G){return Y??(Y=Q()),Reflect.get(Y,W,G)},set(X,W,G,$){return Y??(Y=Q()),Reflect.set(Y,W,G,$)},has(X,W){return Y??(Y=Q()),Reflect.has(Y,W)},deleteProperty(X,W){return Y??(Y=Q()),Reflect.deleteProperty(Y,W)},ownKeys(X){return Y??(Y=Q()),Reflect.ownKeys(Y)},getOwnPropertyDescriptor(X,W){return Y??(Y=Q()),Reflect.getOwnPropertyDescriptor(Y,W)},defineProperty(X,W,G){return Y??(Y=Q()),Reflect.defineProperty(Y,W,G)}})}function r4(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function N6(Q){return Object.keys(Q).filter((Y)=>{return Q[Y]._zod.optin==="optional"&&Q[Y]._zod.optout==="optional"})}var Z6={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]},c9={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function YH(Q,Y){let X=Q._zod.def,W=Q1(Q._zod.def,{get shape(){let G={};for(let $ in Y){if(!($ in X.shape))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;G[$]=X.shape[$]}return e0(this,"shape",G),G},checks:[]});return E0(Q,W)}function XH(Q,Y){let X=Q._zod.def,W=Q1(Q._zod.def,{get shape(){let G={...Q._zod.def.shape};for(let $ in Y){if(!($ in X.shape))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;delete G[$]}return e0(this,"shape",G),G},checks:[]});return E0(Q,W)}function WH(Q,Y){if(!Y1(Y))throw Error("Invalid input to extend: expected a plain object");let X=Q._zod.def.checks;if(X&&X.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let G=Q1(Q._zod.def,{get shape(){let $={...Q._zod.def.shape,...Y};return e0(this,"shape",$),$},checks:[]});return E0(Q,G)}function GH(Q,Y){if(!Y1(Y))throw Error("Invalid input to safeExtend: expected a plain object");let X={...Q._zod.def,get shape(){let W={...Q._zod.def.shape,...Y};return e0(this,"shape",W),W},checks:Q._zod.def.checks};return E0(Q,X)}function $H(Q,Y){let X=Q1(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...Y._zod.def.shape};return e0(this,"shape",W),W},get catchall(){return Y._zod.def.catchall},checks:[]});return E0(Q,X)}function JH(Q,Y,X){let W=Q1(Y._zod.def,{get shape(){let G=Y._zod.def.shape,$={...G};if(X)for(let J in X){if(!(J in G))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;$[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J]}else for(let J in G)$[J]=Q?new Q({type:"optional",innerType:G[J]}):G[J];return e0(this,"shape",$),$},checks:[]});return E0(Y,W)}function zH(Q,Y,X){let W=Q1(Y._zod.def,{get shape(){let G=Y._zod.def.shape,$={...G};if(X)for(let J in X){if(!(J in $))throw Error(`Unrecognized key: "${J}"`);if(!X[J])continue;$[J]=new Q({type:"nonoptional",innerType:G[J]})}else for(let J in G)$[J]=new Q({type:"nonoptional",innerType:G[J]});return e0(this,"shape",$),$},checks:[]});return E0(Y,W)}function X1(Q,Y=0){if(Q.aborted===!0)return!0;for(let X=Y;X<Q.issues.length;X++)if(Q.issues[X]?.continue!==!0)return!0;return!1}function c0(Q,Y){return Y.map((X)=>{var W;return(W=X).path??(W.path=[]),X.path.unshift(Q),X})}function r1(Q){return typeof Q==="string"?Q:Q?.message}function T0(Q,Y,X){let W={...Q,path:Q.path??[]};if(!Q.message){let G=r1(Q.inst?._zod.def?.error?.(Q))??r1(Y?.error?.(Q))??r1(X.customError?.(Q))??r1(X.localeError?.(Q))??"Invalid input";W.message=G}if(delete W.inst,delete W.continue,!Y?.reportInput)delete W.input;return W}function p9(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function o1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function j1(...Q){let[Y,X,W]=Q;if(typeof Y==="string")return{message:Y,code:"custom",input:X,inst:W};return{...Y}}function HH(Q){return Object.entries(Q).filter(([Y,X])=>{return Number.isNaN(Number.parseInt(Y,10))}).map((Y)=>Y[1])}function i9(Q){let Y=atob(Q),X=new Uint8Array(Y.length);for(let W=0;W<Y.length;W++)X[W]=Y.charCodeAt(W);return X}function r9(Q){let Y="";for(let X=0;X<Q.length;X++)Y+=String.fromCharCode(Q[X]);return btoa(Y)}function AH(Q){let Y=Q.replace(/-/g,"+").replace(/_/g,"/"),X="=".repeat((4-Y.length%4)%4);return i9(Y+X)}function UH(Q){return r9(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function KH(Q){let Y=Q.replace(/^0x/,"");if(Y.length%2!==0)throw Error("Invalid hex string length");let X=new Uint8Array(Y.length/2);for(let W=0;W<Y.length;W+=2)X[W/2]=Number.parseInt(Y.slice(W,W+2),16);return X}function DH(Q){return Array.from(Q).map((Y)=>Y.toString(16).padStart(2,"0")).join("")}class n9{constructor(...Q){}}var d9=(Q,Y)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:Y,enumerable:!1}),Q.message=JSON.stringify(Y,P1,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},n4=F("$ZodError",d9),w6=F("$ZodError",d9,{Parent:Error});function o9(Q,Y=(X)=>X.message){let X={},W=[];for(let G of Q.issues)if(G.path.length>0)X[G.path[0]]=X[G.path[0]]||[],X[G.path[0]].push(Y(G));else W.push(Y(G));return{formErrors:W,fieldErrors:X}}function t9(Q,Y=(X)=>X.message){let X={_errors:[]},W=(G)=>{for(let $ of G.issues)if($.code==="invalid_union"&&$.errors.length)$.errors.map((J)=>W({issues:J}));else if($.code==="invalid_key")W({issues:$.issues});else if($.code==="invalid_element")W({issues:$.issues});else if($.path.length===0)X._errors.push(Y($));else{let J=X,z=0;while(z<$.path.length){let H=$.path[z];if(z!==$.path.length-1)J[H]=J[H]||{_errors:[]};else J[H]=J[H]||{_errors:[]},J[H]._errors.push(Y($));J=J[H],z++}}};return W(Q),X}var d4=(Q)=>(Y,X,W,G)=>{let $=W?Object.assign(W,{async:!1}):{async:!1},J=Y._zod.run({value:X,issues:[]},$);if(J instanceof Promise)throw new l0;if(J.issues.length){let z=new(G?.Err??Q)(J.issues.map((H)=>T0(H,$,w0())));throw i4(z,G?.callee),z}return J.value};var o4=(Q)=>async(Y,X,W,G)=>{let $=W?Object.assign(W,{async:!0}):{async:!0},J=Y._zod.run({value:X,issues:[]},$);if(J instanceof Promise)J=await J;if(J.issues.length){let z=new(G?.Err??Q)(J.issues.map((H)=>T0(H,$,w0())));throw i4(z,G?.callee),z}return J.value};var t1=(Q)=>(Y,X,W)=>{let G=W?{...W,async:!1}:{async:!1},$=Y._zod.run({value:X,issues:[]},G);if($ instanceof Promise)throw new l0;return $.issues.length?{success:!1,error:new(Q??n4)($.issues.map((J)=>T0(J,G,w0())))}:{success:!0,data:$.value}},a1=t1(w6),s1=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{async:!0}):{async:!0},$=Y._zod.run({value:X,issues:[]},G);if($ instanceof Promise)$=await $;return $.issues.length?{success:!1,error:new Q($.issues.map((J)=>T0(J,G,w0())))}:{success:!0,data:$.value}},t4=s1(w6),a9=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return d4(Q)(Y,X,G)};var s9=(Q)=>(Y,X,W)=>{return d4(Q)(Y,X,W)};var e9=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return o4(Q)(Y,X,G)};var QX=(Q)=>async(Y,X,W)=>{return o4(Q)(Y,X,W)};var YX=(Q)=>(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return t1(Q)(Y,X,G)};var XX=(Q)=>(Y,X,W)=>{return t1(Q)(Y,X,W)};var WX=(Q)=>async(Y,X,W)=>{let G=W?Object.assign(W,{direction:"backward"}):{direction:"backward"};return s1(Q)(Y,X,G)};var GX=(Q)=>async(Y,X,W)=>{return s1(Q)(Y,X,W)};var $X=/^[cC][^\s-]{8,}$/,JX=/^[0-9a-z]+$/,zX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,HX=/^[0-9a-vA-V]{20}$/,AX=/^[A-Za-z0-9]{27}$/,UX=/^[a-zA-Z0-9_-]{21}$/,KX=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var DX=/^([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})$/,b6=(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 BX=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function LX(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var FX=/^(?:(?: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])$/,qX=/^(([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}|:))$/,OX=/^((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])$/,MX=/^(([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])$/,VX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,P6=/^[A-Za-z0-9_-]*$/,NX=/^(?=.{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 ZX=/^\+(?:[0-9]){6,14}[0-9]$/,wX="(?:(?:\\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])))",bX=new RegExp(`^${wX}$`);function PX(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 IX(Q){return new RegExp(`^${PX(Q)}$`)}function jX(Q){let Y=PX({precision:Q.precision}),X=["Z"];if(Q.local)X.push("");if(Q.offset)X.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let W=`${Y}(?:${X.join("|")})`;return new RegExp(`^${wX}T(?:${W})$`)}var EX=(Q)=>{let Y=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)};var TX=/^-?\d+$/,SX=/^-?\d+(?:\.\d+)?/,RX=/^(?:true|false)$/i,CX=/^null$/i;var kX=/^[^A-Z]*$/,vX=/^[^a-z]*$/;var W0=F("$ZodCheck",(Q,Y)=>{var X;Q._zod??(Q._zod={}),Q._zod.def=Y,(X=Q._zod).onattach??(X.onattach=[])}),xX={number:"number",bigint:"bigint",object:"date"},I6=F("$ZodCheckLessThan",(Q,Y)=>{W0.init(Q,Y);let X=xX[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(Y.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Y.value<$)if(Y.inclusive)G.maximum=Y.value;else G.exclusiveMaximum=Y.value}),Q._zod.check=(W)=>{if(Y.inclusive?W.value<=Y.value:W.value<Y.value)return;W.issues.push({origin:X,code:"too_big",maximum:Y.value,input:W.value,inclusive:Y.inclusive,inst:Q,continue:!Y.abort})}}),j6=F("$ZodCheckGreaterThan",(Q,Y)=>{W0.init(Q,Y);let X=xX[typeof Y.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,$=(Y.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Y.value>$)if(Y.inclusive)G.minimum=Y.value;else G.exclusiveMinimum=Y.value}),Q._zod.check=(W)=>{if(Y.inclusive?W.value>=Y.value:W.value>Y.value)return;W.issues.push({origin:X,code:"too_small",minimum:Y.value,input:W.value,inclusive:Y.inclusive,inst:Q,continue:!Y.abort})}}),_X=F("$ZodCheckMultipleOf",(Q,Y)=>{W0.init(Q,Y),Q._zod.onattach.push((X)=>{var W;(W=X._zod.bag).multipleOf??(W.multipleOf=Y.value)}),Q._zod.check=(X)=>{if(typeof X.value!==typeof Y.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof X.value==="bigint"?X.value%Y.value===BigInt(0):O6(X.value,Y.value)===0)return;X.issues.push({origin:typeof X.value,code:"not_multiple_of",divisor:Y.value,input:X.value,inst:Q,continue:!Y.abort})}}),yX=F("$ZodCheckNumberFormat",(Q,Y)=>{W0.init(Q,Y),Y.format=Y.format||"float64";let X=Y.format?.includes("int"),W=X?"int":"number",[G,$]=Z6[Y.format];Q._zod.onattach.push((J)=>{let z=J._zod.bag;if(z.format=Y.format,z.minimum=G,z.maximum=$,X)z.pattern=TX}),Q._zod.check=(J)=>{let z=J.value;if(X){if(!Number.isInteger(z)){J.issues.push({expected:W,format:Y.format,code:"invalid_type",continue:!1,input:z,inst:Q});return}if(!Number.isSafeInteger(z)){if(z>0)J.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:!Y.abort});else J.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:!Y.abort});return}}if(z<G)J.issues.push({origin:"number",input:z,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!Y.abort});if(z>$)J.issues.push({origin:"number",input:z,code:"too_big",maximum:$,inst:Q})}});var gX=F("$ZodCheckMaxLength",(Q,Y)=>{var X;W0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!n1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.maximum??Number.POSITIVE_INFINITY;if(Y.maximum<G)W._zod.bag.maximum=Y.maximum}),Q._zod.check=(W)=>{let G=W.value;if(G.length<=Y.maximum)return;let J=o1(G);W.issues.push({origin:J,code:"too_big",maximum:Y.maximum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),uX=F("$ZodCheckMinLength",(Q,Y)=>{var X;W0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!n1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(Y.minimum>G)W._zod.bag.minimum=Y.minimum}),Q._zod.check=(W)=>{let G=W.value;if(G.length>=Y.minimum)return;let J=o1(G);W.issues.push({origin:J,code:"too_small",minimum:Y.minimum,inclusive:!0,input:G,inst:Q,continue:!Y.abort})}}),hX=F("$ZodCheckLengthEquals",(Q,Y)=>{var X;W0.init(Q,Y),(X=Q._zod.def).when??(X.when=(W)=>{let G=W.value;return!n1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.minimum=Y.length,G.maximum=Y.length,G.length=Y.length}),Q._zod.check=(W)=>{let G=W.value,$=G.length;if($===Y.length)return;let J=o1(G),z=$>Y.length;W.issues.push({origin:J,...z?{code:"too_big",maximum:Y.length}:{code:"too_small",minimum:Y.length},inclusive:!0,exact:!0,input:W.value,inst:Q,continue:!Y.abort})}}),e1=F("$ZodCheckStringFormat",(Q,Y)=>{var X,W;if(W0.init(Q,Y),Q._zod.onattach.push((G)=>{let $=G._zod.bag;if($.format=Y.format,Y.pattern)$.patterns??($.patterns=new Set),$.patterns.add(Y.pattern)}),Y.pattern)(X=Q._zod).check??(X.check=(G)=>{if(Y.pattern.lastIndex=0,Y.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:Y.format,input:G.value,...Y.pattern?{pattern:Y.pattern.toString()}:{},inst:Q,continue:!Y.abort})});else(W=Q._zod).check??(W.check=()=>{})}),fX=F("$ZodCheckRegex",(Q,Y)=>{e1.init(Q,Y),Q._zod.check=(X)=>{if(Y.pattern.lastIndex=0,Y.pattern.test(X.value))return;X.issues.push({origin:"string",code:"invalid_format",format:"regex",input:X.value,pattern:Y.pattern.toString(),inst:Q,continue:!Y.abort})}}),lX=F("$ZodCheckLowerCase",(Q,Y)=>{Y.pattern??(Y.pattern=kX),e1.init(Q,Y)}),mX=F("$ZodCheckUpperCase",(Q,Y)=>{Y.pattern??(Y.pattern=vX),e1.init(Q,Y)}),cX=F("$ZodCheckIncludes",(Q,Y)=>{W0.init(Q,Y);let X=m0(Y.includes),W=new RegExp(typeof Y.position==="number"?`^.{${Y.position}}${X}`:X);Y.pattern=W,Q._zod.onattach.push((G)=>{let $=G._zod.bag;$.patterns??($.patterns=new Set),$.patterns.add(W)}),Q._zod.check=(G)=>{if(G.value.includes(Y.includes,Y.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:Y.includes,input:G.value,inst:Q,continue:!Y.abort})}}),pX=F("$ZodCheckStartsWith",(Q,Y)=>{W0.init(Q,Y);let X=new RegExp(`^${m0(Y.prefix)}.*`);Y.pattern??(Y.pattern=X),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),Q._zod.check=(W)=>{if(W.value.startsWith(Y.prefix))return;W.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:Y.prefix,input:W.value,inst:Q,continue:!Y.abort})}}),iX=F("$ZodCheckEndsWith",(Q,Y)=>{W0.init(Q,Y);let X=new RegExp(`.*${m0(Y.suffix)}$`);Y.pattern??(Y.pattern=X),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(X)}),Q._zod.check=(W)=>{if(W.value.endsWith(Y.suffix))return;W.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:Y.suffix,input:W.value,inst:Q,continue:!Y.abort})}});var rX=F("$ZodCheckOverwrite",(Q,Y)=>{W0.init(Q,Y),Q._zod.check=(X)=>{X.value=Y.tx(X.value)}});class E6{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 X=Q.split(`
|
|
11
|
+
`).filter(($)=>$),W=Math.min(...X.map(($)=>$.length-$.trimStart().length)),G=X.map(($)=>$.slice(W)).map(($)=>" ".repeat(this.indent*2)+$);for(let $ of G)this.content.push($)}compile(){let Q=Function,Y=this?.args,W=[...(this?.content??[""]).map((G)=>` ${G}`)];return new Q(...Y,W.join(`
|
|
12
|
+
`))}}var dX={major:4,minor:1,patch:12};var i=F("$ZodType",(Q,Y)=>{var X;Q??(Q={}),Q._zod.def=Y,Q._zod.bag=Q._zod.bag||{},Q._zod.version=dX;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let G of W)for(let $ of G._zod.onattach)$(Q);if(W.length===0)(X=Q._zod).deferred??(X.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let G=(J,z,H)=>{let A=X1(J),U;for(let K of z){if(K._zod.def.when){if(!K._zod.def.when(J))continue}else if(A)continue;let D=J.issues.length,L=K._zod.check(J);if(L instanceof Promise&&H?.async===!1)throw new l0;if(U||L instanceof Promise)U=(U??Promise.resolve()).then(async()=>{if(await L,J.issues.length===D)return;if(!A)A=X1(J,D)});else{if(J.issues.length===D)continue;if(!A)A=X1(J,D)}}if(U)return U.then(()=>{return J});return J},$=(J,z,H)=>{if(X1(J))return J.aborted=!0,J;let A=G(z,W,H);if(A instanceof Promise){if(H.async===!1)throw new l0;return A.then((U)=>Q._zod.parse(U,H))}return Q._zod.parse(A,H)};Q._zod.run=(J,z)=>{if(z.skipChecks)return Q._zod.parse(J,z);if(z.direction==="backward"){let A=Q._zod.parse({value:J.value,issues:[]},{...z,skipChecks:!0});if(A instanceof Promise)return A.then((U)=>{return $(U,J,z)});return $(A,J,z)}let H=Q._zod.parse(J,z);if(H instanceof Promise){if(z.async===!1)throw new l0;return H.then((A)=>G(A,W,z))}return G(H,W,z)}}Q["~standard"]={validate:(G)=>{try{let $=a1(Q,G);return $.success?{value:$.data}:{issues:$.error?.issues}}catch($){return t4(Q,G).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}}),QQ=F("$ZodString",(Q,Y)=>{i.init(Q,Y),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??EX(Q._zod.bag),Q._zod.parse=(X,W)=>{if(Y.coerce)try{X.value=String(X.value)}catch(G){}if(typeof X.value==="string")return X;return X.issues.push({expected:"string",code:"invalid_type",input:X.value,inst:Q}),X}}),r=F("$ZodStringFormat",(Q,Y)=>{e1.init(Q,Y),QQ.init(Q,Y)}),W8=F("$ZodGUID",(Q,Y)=>{Y.pattern??(Y.pattern=DX),r.init(Q,Y)}),G8=F("$ZodUUID",(Q,Y)=>{if(Y.version){let W={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[Y.version];if(W===void 0)throw Error(`Invalid UUID version: "${Y.version}"`);Y.pattern??(Y.pattern=b6(W))}else Y.pattern??(Y.pattern=b6());r.init(Q,Y)}),$8=F("$ZodEmail",(Q,Y)=>{Y.pattern??(Y.pattern=BX),r.init(Q,Y)}),J8=F("$ZodURL",(Q,Y)=>{r.init(Q,Y),Q._zod.check=(X)=>{try{let W=X.value.trim(),G=new URL(W);if(Y.hostname){if(Y.hostname.lastIndex=0,!Y.hostname.test(G.hostname))X.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:NX.source,input:X.value,inst:Q,continue:!Y.abort})}if(Y.protocol){if(Y.protocol.lastIndex=0,!Y.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))X.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:Y.protocol.source,input:X.value,inst:Q,continue:!Y.abort})}if(Y.normalize)X.value=G.href;else X.value=W;return}catch(W){X.issues.push({code:"invalid_format",format:"url",input:X.value,inst:Q,continue:!Y.abort})}}}),z8=F("$ZodEmoji",(Q,Y)=>{Y.pattern??(Y.pattern=LX()),r.init(Q,Y)}),H8=F("$ZodNanoID",(Q,Y)=>{Y.pattern??(Y.pattern=UX),r.init(Q,Y)}),A8=F("$ZodCUID",(Q,Y)=>{Y.pattern??(Y.pattern=$X),r.init(Q,Y)}),U8=F("$ZodCUID2",(Q,Y)=>{Y.pattern??(Y.pattern=JX),r.init(Q,Y)}),K8=F("$ZodULID",(Q,Y)=>{Y.pattern??(Y.pattern=zX),r.init(Q,Y)}),D8=F("$ZodXID",(Q,Y)=>{Y.pattern??(Y.pattern=HX),r.init(Q,Y)}),B8=F("$ZodKSUID",(Q,Y)=>{Y.pattern??(Y.pattern=AX),r.init(Q,Y)}),L8=F("$ZodISODateTime",(Q,Y)=>{Y.pattern??(Y.pattern=jX(Y)),r.init(Q,Y)}),F8=F("$ZodISODate",(Q,Y)=>{Y.pattern??(Y.pattern=bX),r.init(Q,Y)}),q8=F("$ZodISOTime",(Q,Y)=>{Y.pattern??(Y.pattern=IX(Y)),r.init(Q,Y)}),O8=F("$ZodISODuration",(Q,Y)=>{Y.pattern??(Y.pattern=KX),r.init(Q,Y)}),M8=F("$ZodIPv4",(Q,Y)=>{Y.pattern??(Y.pattern=FX),r.init(Q,Y),Q._zod.onattach.push((X)=>{let W=X._zod.bag;W.format="ipv4"})}),V8=F("$ZodIPv6",(Q,Y)=>{Y.pattern??(Y.pattern=qX),r.init(Q,Y),Q._zod.onattach.push((X)=>{let W=X._zod.bag;W.format="ipv6"}),Q._zod.check=(X)=>{try{new URL(`http://[${X.value}]`)}catch{X.issues.push({code:"invalid_format",format:"ipv6",input:X.value,inst:Q,continue:!Y.abort})}}}),N8=F("$ZodCIDRv4",(Q,Y)=>{Y.pattern??(Y.pattern=OX),r.init(Q,Y)}),Z8=F("$ZodCIDRv6",(Q,Y)=>{Y.pattern??(Y.pattern=MX),r.init(Q,Y),Q._zod.check=(X)=>{let W=X.value.split("/");try{if(W.length!==2)throw Error();let[G,$]=W;if(!$)throw Error();let J=Number($);if(`${J}`!==$)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${G}]`)}catch{X.issues.push({code:"invalid_format",format:"cidrv6",input:X.value,inst:Q,continue:!Y.abort})}}});function w8(Q){if(Q==="")return!0;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var b8=F("$ZodBase64",(Q,Y)=>{Y.pattern??(Y.pattern=VX),r.init(Q,Y),Q._zod.onattach.push((X)=>{X._zod.bag.contentEncoding="base64"}),Q._zod.check=(X)=>{if(w8(X.value))return;X.issues.push({code:"invalid_format",format:"base64",input:X.value,inst:Q,continue:!Y.abort})}});function qH(Q){if(!P6.test(Q))return!1;let Y=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),X=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return w8(X)}var P8=F("$ZodBase64URL",(Q,Y)=>{Y.pattern??(Y.pattern=P6),r.init(Q,Y),Q._zod.onattach.push((X)=>{X._zod.bag.contentEncoding="base64url"}),Q._zod.check=(X)=>{if(qH(X.value))return;X.issues.push({code:"invalid_format",format:"base64url",input:X.value,inst:Q,continue:!Y.abort})}}),I8=F("$ZodE164",(Q,Y)=>{Y.pattern??(Y.pattern=ZX),r.init(Q,Y)});function OH(Q,Y=null){try{let X=Q.split(".");if(X.length!==3)return!1;let[W]=X;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(Y&&(!("alg"in G)||G.alg!==Y))return!1;return!0}catch{return!1}}var j8=F("$ZodJWT",(Q,Y)=>{r.init(Q,Y),Q._zod.check=(X)=>{if(OH(X.value,Y.alg))return;X.issues.push({code:"invalid_format",format:"jwt",input:X.value,inst:Q,continue:!Y.abort})}});var S6=F("$ZodNumber",(Q,Y)=>{i.init(Q,Y),Q._zod.pattern=Q._zod.bag.pattern??SX,Q._zod.parse=(X,W)=>{if(Y.coerce)try{X.value=Number(X.value)}catch(J){}let G=X.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return X;let $=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return X.issues.push({expected:"number",code:"invalid_type",input:G,inst:Q,...$?{received:$}:{}}),X}}),E8=F("$ZodNumber",(Q,Y)=>{yX.init(Q,Y),S6.init(Q,Y)}),T8=F("$ZodBoolean",(Q,Y)=>{i.init(Q,Y),Q._zod.pattern=RX,Q._zod.parse=(X,W)=>{if(Y.coerce)try{X.value=Boolean(X.value)}catch($){}let G=X.value;if(typeof G==="boolean")return X;return X.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:Q}),X}});var S8=F("$ZodNull",(Q,Y)=>{i.init(Q,Y),Q._zod.pattern=CX,Q._zod.values=new Set([null]),Q._zod.parse=(X,W)=>{let G=X.value;if(G===null)return X;return X.issues.push({expected:"null",code:"invalid_type",input:G,inst:Q}),X}});var R8=F("$ZodUnknown",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X)=>X}),C8=F("$ZodNever",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{return X.issues.push({expected:"never",code:"invalid_type",input:X.value,inst:Q}),X}});function oX(Q,Y,X){if(Q.issues.length)Y.issues.push(...c0(X,Q.issues));Y.value[X]=Q.value}var k8=F("$ZodArray",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value;if(!Array.isArray(G))return X.issues.push({expected:"array",code:"invalid_type",input:G,inst:Q}),X;X.value=Array(G.length);let $=[];for(let J=0;J<G.length;J++){let z=G[J],H=Y.element._zod.run({value:z,issues:[]},W);if(H instanceof Promise)$.push(H.then((A)=>oX(A,X,J)));else oX(H,X,J)}if($.length)return Promise.all($).then(()=>X);return X}});function e4(Q,Y,X,W){if(Q.issues.length)Y.issues.push(...c0(X,Q.issues));if(Q.value===void 0){if(X in W)Y.value[X]=void 0}else Y.value[X]=Q.value}function v8(Q){let Y=Object.keys(Q.shape);for(let W of Y)if(!Q.shape?.[W]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${W}": expected a Zod schema`);let X=N6(Q.shape);return{...Q,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(X)}}function x8(Q,Y,X,W,G,$){let J=[],z=G.keySet,H=G.catchall._zod,A=H.def.type;for(let U of Object.keys(Y)){if(z.has(U))continue;if(A==="never"){J.push(U);continue}let K=H.run({value:Y[U],issues:[]},W);if(K instanceof Promise)Q.push(K.then((D)=>e4(D,X,U,Y)));else e4(K,X,U,Y)}if(J.length)X.issues.push({code:"unrecognized_keys",keys:J,input:Y,inst:$});if(!Q.length)return X;return Promise.all(Q).then(()=>{return X})}var MH=F("$ZodObject",(Q,Y)=>{if(i.init(Q,Y),!Object.getOwnPropertyDescriptor(Y,"shape")?.get){let z=Y.shape;Object.defineProperty(Y,"shape",{get:()=>{let H={...z};return Object.defineProperty(Y,"shape",{value:H}),H}})}let W=I1(()=>v8(Y));m(Q._zod,"propValues",()=>{let z=Y.shape,H={};for(let A in z){let U=z[A]._zod;if(U.values){H[A]??(H[A]=new Set);for(let K of U.values)H[A].add(K)}}return H});let G=F1,$=Y.catchall,J;Q._zod.parse=(z,H)=>{J??(J=W.value);let A=z.value;if(!G(A))return z.issues.push({expected:"object",code:"invalid_type",input:A,inst:Q}),z;z.value={};let U=[],K=J.shape;for(let D of J.keys){let q=K[D]._zod.run({value:A[D],issues:[]},H);if(q instanceof Promise)U.push(q.then((O)=>e4(O,z,D,A)));else e4(q,z,D,A)}if(!$)return U.length?Promise.all(U).then(()=>z):z;return x8(U,A,z,H,W.value,Q)}}),_8=F("$ZodObjectJIT",(Q,Y)=>{MH.init(Q,Y);let X=Q._zod.parse,W=I1(()=>v8(Y)),G=(D)=>{let L=new E6(["shape","payload","ctx"]),q=W.value,O=(E)=>{let x=p4(E);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};L.write("const input = payload.value;");let V=Object.create(null),M=0;for(let E of q.keys)V[E]=`key_${M++}`;L.write("const newResult = {};");for(let E of q.keys){let x=V[E],T=p4(E);L.write(`const ${x} = ${O(E)};`),L.write(`
|
|
12
13
|
if (${x}.issues.length) {
|
|
13
14
|
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
14
15
|
...iss,
|
|
@@ -25,10 +26,7 @@ var w5=Object.create;var{getPrototypeOf:b5,defineProperty:BQ,getOwnPropertyNames
|
|
|
25
26
|
newResult[${T}] = ${x}.value;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
`)}L.write("payload.value = newResult;"),L.write("return payload;");let S=L.compile();return(E,x)=>S(B,E,x)},$,J=B1,z=!l4.jitless,U=z&&FQ.value,A=X.catchall,K;Q._zod.parse=(B,L)=>{K??(K=W.value);let F=B.value;if(!J(F))return B.issues.push({expected:"object",code:"invalid_type",input:F,inst:Q}),B;if(z&&U&&L?.async===!1&&L.jitless!==!0){if(!$)$=G(X.shape);if(B=$(B,L),!A)return B;return RY([],F,B,L,K,Q)}return Y(B,L)}});function n8(Q,X,Y,W){for(let $ of Q)if($.issues.length===0)return X.value=$.value,X;let G=Q.filter(($)=>!Q1($));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(($)=>$.issues.map((J)=>T0(J,W,w0())))}),X}var TQ=q("$ZodUnion",(Q,X)=>{i.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(($)=>$._zod.pattern);return new RegExp(`^(${G.map(($)=>r1($.source)).join("|")})$`)}return});let Y=X.options.length===1,W=X.options[0]._zod.run;Q._zod.parse=(G,$)=>{if(Y)return W(G,$);let J=!1,z=[];for(let H of X.options){let U=H._zod.run({value:G.value,issues:[]},$);if(U instanceof Promise)z.push(U),J=!0;else{if(U.issues.length===0)return U;z.push(U)}}if(!J)return n8(z,G,Q,$);return Promise.all(z).then((H)=>{return n8(H,G,Q,$)})}}),kY=q("$ZodDiscriminatedUnion",(Q,X)=>{TQ.init(Q,X);let Y=Q._zod.parse;m(Q._zod,"propValues",()=>{let G={};for(let $ of X.options){let J=$._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf($)}"`);for(let[z,H]of Object.entries(J)){if(!G[z])G[z]=new Set;for(let U of H)G[z].add(U)}}return G});let W=b1(()=>{let G=X.options,$=new Map;for(let J of G){let z=J._zod.propValues?.[X.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let H of z){if($.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);$.set(H,J)}}return $});Q._zod.parse=(G,$)=>{let J=G.value;if(!B1(J))return G.issues.push({code:"invalid_type",expected:"object",input:J,inst:Q}),G;let z=W.value.get(J?.[X.discriminator]);if(z)return z._zod.run(G,$);if(X.unionFallback)return Y(G,$);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,input:J,path:[X.discriminator],inst:Q}),G}}),vY=q("$ZodIntersection",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value,$=X.left._zod.run({value:G,issues:[]},W),J=X.right._zod.run({value:G,issues:[]},W);if($ instanceof Promise||J instanceof Promise)return Promise.all([$,J]).then(([H,U])=>{return r8(Y,H,U)});return r8(Y,$,J)}});function IQ(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(e0(Q)&&e0(X)){let Y=Object.keys(X),W=Object.keys(Q).filter(($)=>Y.indexOf($)!==-1),G={...Q,...X};for(let $ of W){let J=IQ(Q[$],X[$]);if(!J.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],$=X[W],J=IQ(G,$);if(!J.valid)return{valid:!1,mergeErrorPath:[W,...J.mergeErrorPath]};Y.push(J.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function r8(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(Q1(Q))return Q;let W=IQ(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var xY=q("$ZodRecord",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!e0(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),Y;let $=[];if(X.keyType._zod.values){let J=X.keyType._zod.values;Y.value={};for(let H of J)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let U=X.valueType._zod.run({value:G[H],issues:[]},W);if(U instanceof Promise)$.push(U.then((A)=>{if(A.issues.length)Y.issues.push(...c0(H,A.issues));Y.value[H]=A.value}));else{if(U.issues.length)Y.issues.push(...c0(H,U.issues));Y.value[H]=U.value}}let z;for(let H in G)if(!J.has(H))z=z??[],z.push(H);if(z&&z.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:z})}else{Y.value={};for(let J of Reflect.ownKeys(G)){if(J==="__proto__")continue;let z=X.keyType._zod.run({value:J,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((U)=>T0(U,W,w0())),input:J,path:[J],inst:Q}),Y.value[z.value]=z.value;continue}let H=X.valueType._zod.run({value:G[J],issues:[]},W);if(H instanceof Promise)$.push(H.then((U)=>{if(U.issues.length)Y.issues.push(...c0(J,U.issues));Y.value[z.value]=U.value}));else{if(H.issues.length)Y.issues.push(...c0(J,H.issues));Y.value[z.value]=H.value}}}if($.length)return Promise.all($).then(()=>Y);return Y}});var _Y=q("$ZodEnum",(Q,X)=>{i.init(Q,X);let Y=LQ(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>OQ.has(typeof G)).map((G)=>typeof G==="string"?m0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,$)=>{let J=G.value;if(W.has(J))return G;return G.issues.push({code:"invalid_value",values:Y,input:J,inst:Q}),G}}),yY=q("$ZodLiteral",(Q,X)=>{if(i.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"?m0(Y):Y?m0(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 gY=q("$ZodTransform",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new p1(Q.constructor.name);let G=X.transform(Y.value,Y);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then((J)=>{return Y.value=J,Y});if(G instanceof Promise)throw new l0;return Y.value=G,Y}});function d8(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var uY=q("$ZodOptional",(Q,X)=>{i.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(`^(${r1(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(($)=>d8($,Y.value));return d8(G,Y.value)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),hY=q("$ZodNullable",(Q,X)=>{i.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(`^(${r1(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)}}),fY=q("$ZodDefault",(Q,X)=>{i.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(($)=>o8($,X));return o8(G,X)}});function o8(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var lY=q("$ZodPrefault",(Q,X)=>{i.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)}}),mY=q("$ZodNonOptional",(Q,X)=>{i.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(($)=>t8($,Q));return t8(G,Q)}});function t8(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 cY=q("$ZodCatch",(Q,X)=>{i.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(($)=>{if(Y.value=$.value,$.issues.length)Y.value=X.catchValue({...Y,error:{issues:$.issues.map((J)=>T0(J,W,w0()))},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(($)=>T0($,W,w0()))},input:Y.value}),Y.issues=[];return Y}});var pY=q("$ZodPipe",(Q,X)=>{i.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 $=X.out._zod.run(Y,W);if($ instanceof Promise)return $.then((J)=>a4(J,X.in,W));return a4($,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then(($)=>a4($,X.out,W));return a4(G,X.out,W)}});function a4(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},Y)}var iY=q("$ZodReadonly",(Q,X)=>{i.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(a8);return a8(G)}});function a8(Q){return Q.value=Object.freeze(Q.value),Q}var nY=q("$ZodCustom",(Q,X)=>{W0.init(Q,X),i.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(($)=>s8($,Y,W,Q));s8(G,Y,W,Q);return}});function s8(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(P1(G))}}var HH=(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},UH=()=>{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 ${HH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${i4(W.values[0])}`;return`Invalid option: expected one of ${m4(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",$=X(W.origin);if($)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${$.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",$=X(W.origin);if($)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${$.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":""}: ${m4(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 SQ(){return{localeError:UH()}}var mM=Symbol("ZodOutput"),cM=Symbol("ZodInput");class rY{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 AH(){return new rY}var e1=AH();function dY(Q,X){return new Q({type:"string",...I(X)})}function oY(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...I(X)})}function RQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...I(X)})}function tY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...I(X)})}function aY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(X)})}function sY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(X)})}function eY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(X)})}function QW(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...I(X)})}function XW(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...I(X)})}function YW(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(X)})}function WW(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...I(X)})}function GW(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(X)})}function $W(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...I(X)})}function JW(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...I(X)})}function zW(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(X)})}function HW(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(X)})}function UW(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(X)})}function AW(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(X)})}function KW(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(X)})}function BW(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...I(X)})}function DW(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...I(X)})}function LW(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...I(X)})}function qW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...I(X)})}function FW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(X)})}function OW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...I(X)})}function MW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...I(X)})}function VW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...I(X)})}function ZW(Q,X){return new Q({type:"number",checks:[],...I(X)})}function NW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...I(X)})}function wW(Q,X){return new Q({type:"boolean",...I(X)})}function bW(Q,X){return new Q({type:"null",...I(X)})}function PW(Q){return new Q({type:"unknown"})}function jW(Q,X){return new Q({type:"never",...I(X)})}function Q6(Q,X){return new bQ({check:"less_than",...I(X),value:Q,inclusive:!1})}function Q4(Q,X){return new bQ({check:"less_than",...I(X),value:Q,inclusive:!0})}function X6(Q,X){return new PQ({check:"greater_than",...I(X),value:Q,inclusive:!1})}function X4(Q,X){return new PQ({check:"greater_than",...I(X),value:Q,inclusive:!0})}function Y6(Q,X){return new C8({check:"multiple_of",...I(X),value:Q})}function W6(Q,X){return new v8({check:"max_length",...I(X),maximum:Q})}function j1(Q,X){return new x8({check:"min_length",...I(X),minimum:Q})}function G6(Q,X){return new _8({check:"length_equals",...I(X),length:Q})}function CQ(Q,X){return new y8({check:"string_format",format:"regex",...I(X),pattern:Q})}function kQ(Q){return new g8({check:"string_format",format:"lowercase",...I(Q)})}function vQ(Q){return new u8({check:"string_format",format:"uppercase",...I(Q)})}function xQ(Q,X){return new h8({check:"string_format",format:"includes",...I(X),includes:Q})}function _Q(Q,X){return new f8({check:"string_format",format:"starts_with",...I(X),prefix:Q})}function yQ(Q,X){return new l8({check:"string_format",format:"ends_with",...I(X),suffix:Q})}function D1(Q){return new m8({check:"overwrite",tx:Q})}function gQ(Q){return D1((X)=>X.normalize(Q))}function uQ(){return D1((Q)=>Q.trim())}function hQ(){return D1((Q)=>Q.toLowerCase())}function fQ(){return D1((Q)=>Q.toUpperCase())}function IW(Q,X,Y){return new Q({type:"array",element:X,...I(Y)})}function EW(Q,X,Y){let W=I(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function TW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...I(Y)})}function SW(Q){let X=KH((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(P1(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(P1(G))}},Q(Y.value,Y)});return X}function KH(Q,X){let Y=new W0({check:"custom",...I(X)});return Y._zod.check=Q,Y}function I1(Q){return!!Q._zod}function X1(Q,X){if(I1(Q))return t1(Q,X);return Q.safeParse(X)}function $6(Q){if(!Q)return;let X;if(I1(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 RW(Q){if(I1(Q)){let $=Q._zod?.def;if($){if($.value!==void 0)return $.value;if(Array.isArray($.values)&&$.values.length>0)return $.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 W4={};_X(W4,{time:()=>cQ,duration:()=>pQ,datetime:()=>lQ,date:()=>mQ,ZodISOTime:()=>vW,ZodISODuration:()=>xW,ZodISODateTime:()=>CW,ZodISODate:()=>kW});var CW=q("ZodISODateTime",(Q,X)=>{AY.init(Q,X),d.init(Q,X)});function lQ(Q){return FW(CW,Q)}var kW=q("ZodISODate",(Q,X)=>{KY.init(Q,X),d.init(Q,X)});function mQ(Q){return OW(kW,Q)}var vW=q("ZodISOTime",(Q,X)=>{BY.init(Q,X),d.init(Q,X)});function cQ(Q){return MW(vW,Q)}var xW=q("ZodISODuration",(Q,X)=>{DY.init(Q,X),d.init(Q,X)});function pQ(Q){return VW(xW,Q)}var _W=(Q,X)=>{n4.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>nX(Q,Y)},flatten:{value:(Y)=>iX(Q,Y)},addIssue:{value:(Y)=>{Q.issues.push(Y),Q.message=JSON.stringify(Q.issues,w1,2)}},addIssues:{value:(Y)=>{Q.issues.push(...Y),Q.message=JSON.stringify(Q.issues,w1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},TV=q("ZodError",_W),V0=q("ZodError",_W,{Parent:Error});var yW=r4(V0),gW=d4(V0),uW=o1(V0),hW=a1(V0),fW=rX(V0),lW=dX(V0),mW=oX(V0),cW=tX(V0),pW=aX(V0),iW=sX(V0),nW=eX(V0),rW=Q8(V0);var s=q("ZodType",(Q,X)=>{return i.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)=>E0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>yW(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>uW(Q,Y,W),Q.parseAsync=async(Y,W)=>gW(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>hW(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>fW(Q,Y,W),Q.decode=(Y,W)=>lW(Q,Y,W),Q.encodeAsync=async(Y,W)=>mW(Q,Y,W),Q.decodeAsync=async(Y,W)=>cW(Q,Y,W),Q.safeEncode=(Y,W)=>pW(Q,Y,W),Q.safeDecode=(Y,W)=>iW(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>nW(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>rW(Q,Y,W),Q.refine=(Y,W)=>Q.check(z3(Y,W)),Q.superRefine=(Y)=>Q.check(H3(Y)),Q.overwrite=(Y)=>Q.check(D1(Y)),Q.optional=()=>a(Q),Q.nullable=()=>tW(Q),Q.nullish=()=>a(tW(Q)),Q.nonoptional=(Y)=>X3(Q,Y),Q.array=()=>_(Q),Q.or=(Y)=>p([Q,Y]),Q.and=(Y)=>z6(Q,Y),Q.transform=(Y)=>nQ(Q,XG(Y)),Q.default=(Y)=>sH(Q,Y),Q.prefault=(Y)=>Q3(Q,Y),Q.catch=(Y)=>W3(Q,Y),Q.pipe=(Y)=>nQ(Q,Y),Q.readonly=()=>J3(Q),Q.describe=(Y)=>{let W=Q.clone();return e1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return e1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return e1.get(Q);let W=Q.clone();return e1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),aW=q("_ZodString",(Q,X)=>{e4.init(Q,X),s.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(CQ(...W)),Q.includes=(...W)=>Q.check(xQ(...W)),Q.startsWith=(...W)=>Q.check(_Q(...W)),Q.endsWith=(...W)=>Q.check(yQ(...W)),Q.min=(...W)=>Q.check(j1(...W)),Q.max=(...W)=>Q.check(W6(...W)),Q.length=(...W)=>Q.check(G6(...W)),Q.nonempty=(...W)=>Q.check(j1(1,...W)),Q.lowercase=(W)=>Q.check(kQ(W)),Q.uppercase=(W)=>Q.check(vQ(W)),Q.trim=()=>Q.check(uQ()),Q.normalize=(...W)=>Q.check(gQ(...W)),Q.toLowerCase=()=>Q.check(hQ()),Q.toUpperCase=()=>Q.check(fQ())}),ZH=q("ZodString",(Q,X)=>{e4.init(Q,X),aW.init(Q,X),Q.email=(Y)=>Q.check(oY(NH,Y)),Q.url=(Y)=>Q.check(QW(wH,Y)),Q.jwt=(Y)=>Q.check(qW(gH,Y)),Q.emoji=(Y)=>Q.check(XW(bH,Y)),Q.guid=(Y)=>Q.check(RQ(dW,Y)),Q.uuid=(Y)=>Q.check(tY(J6,Y)),Q.uuidv4=(Y)=>Q.check(aY(J6,Y)),Q.uuidv6=(Y)=>Q.check(sY(J6,Y)),Q.uuidv7=(Y)=>Q.check(eY(J6,Y)),Q.nanoid=(Y)=>Q.check(YW(PH,Y)),Q.guid=(Y)=>Q.check(RQ(dW,Y)),Q.cuid=(Y)=>Q.check(WW(jH,Y)),Q.cuid2=(Y)=>Q.check(GW(IH,Y)),Q.ulid=(Y)=>Q.check($W(EH,Y)),Q.base64=(Y)=>Q.check(BW(xH,Y)),Q.base64url=(Y)=>Q.check(DW(_H,Y)),Q.xid=(Y)=>Q.check(JW(TH,Y)),Q.ksuid=(Y)=>Q.check(zW(SH,Y)),Q.ipv4=(Y)=>Q.check(HW(RH,Y)),Q.ipv6=(Y)=>Q.check(UW(CH,Y)),Q.cidrv4=(Y)=>Q.check(AW(kH,Y)),Q.cidrv6=(Y)=>Q.check(KW(vH,Y)),Q.e164=(Y)=>Q.check(LW(yH,Y)),Q.datetime=(Y)=>Q.check(lQ(Y)),Q.date=(Y)=>Q.check(mQ(Y)),Q.time=(Y)=>Q.check(cQ(Y)),Q.duration=(Y)=>Q.check(pQ(Y))});function D(Q){return dY(ZH,Q)}var d=q("ZodStringFormat",(Q,X)=>{n.init(Q,X),aW.init(Q,X)}),NH=q("ZodEmail",(Q,X)=>{XY.init(Q,X),d.init(Q,X)});var dW=q("ZodGUID",(Q,X)=>{e8.init(Q,X),d.init(Q,X)});var J6=q("ZodUUID",(Q,X)=>{QY.init(Q,X),d.init(Q,X)});var wH=q("ZodURL",(Q,X)=>{YY.init(Q,X),d.init(Q,X)});var bH=q("ZodEmoji",(Q,X)=>{WY.init(Q,X),d.init(Q,X)});var PH=q("ZodNanoID",(Q,X)=>{GY.init(Q,X),d.init(Q,X)});var jH=q("ZodCUID",(Q,X)=>{$Y.init(Q,X),d.init(Q,X)});var IH=q("ZodCUID2",(Q,X)=>{JY.init(Q,X),d.init(Q,X)});var EH=q("ZodULID",(Q,X)=>{zY.init(Q,X),d.init(Q,X)});var TH=q("ZodXID",(Q,X)=>{HY.init(Q,X),d.init(Q,X)});var SH=q("ZodKSUID",(Q,X)=>{UY.init(Q,X),d.init(Q,X)});var RH=q("ZodIPv4",(Q,X)=>{LY.init(Q,X),d.init(Q,X)});var CH=q("ZodIPv6",(Q,X)=>{qY.init(Q,X),d.init(Q,X)});var kH=q("ZodCIDRv4",(Q,X)=>{FY.init(Q,X),d.init(Q,X)});var vH=q("ZodCIDRv6",(Q,X)=>{OY.init(Q,X),d.init(Q,X)});var xH=q("ZodBase64",(Q,X)=>{VY.init(Q,X),d.init(Q,X)});var _H=q("ZodBase64URL",(Q,X)=>{ZY.init(Q,X),d.init(Q,X)});var yH=q("ZodE164",(Q,X)=>{NY.init(Q,X),d.init(Q,X)});var gH=q("ZodJWT",(Q,X)=>{wY.init(Q,X),d.init(Q,X)});var sW=q("ZodNumber",(Q,X)=>{EQ.init(Q,X),s.init(Q,X),Q.gt=(W,G)=>Q.check(X6(W,G)),Q.gte=(W,G)=>Q.check(X4(W,G)),Q.min=(W,G)=>Q.check(X4(W,G)),Q.lt=(W,G)=>Q.check(Q6(W,G)),Q.lte=(W,G)=>Q.check(Q4(W,G)),Q.max=(W,G)=>Q.check(Q4(W,G)),Q.int=(W)=>Q.check(oW(W)),Q.safe=(W)=>Q.check(oW(W)),Q.positive=(W)=>Q.check(X6(0,W)),Q.nonnegative=(W)=>Q.check(X4(0,W)),Q.negative=(W)=>Q.check(Q6(0,W)),Q.nonpositive=(W)=>Q.check(Q4(0,W)),Q.multipleOf=(W,G)=>Q.check(Y6(W,G)),Q.step=(W,G)=>Q.check(Y6(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 l(Q){return ZW(sW,Q)}var uH=q("ZodNumberFormat",(Q,X)=>{bY.init(Q,X),sW.init(Q,X)});function oW(Q){return NW(uH,Q)}var hH=q("ZodBoolean",(Q,X)=>{PY.init(Q,X),s.init(Q,X)});function Y0(Q){return wW(hH,Q)}var fH=q("ZodNull",(Q,X)=>{jY.init(Q,X),s.init(Q,X)});function rQ(Q){return bW(fH,Q)}var lH=q("ZodUnknown",(Q,X)=>{IY.init(Q,X),s.init(Q,X)});function o(){return PW(lH)}var mH=q("ZodNever",(Q,X)=>{EY.init(Q,X),s.init(Q,X)});function cH(Q){return jW(mH,Q)}var pH=q("ZodArray",(Q,X)=>{TY.init(Q,X),s.init(Q,X),Q.element=X.element,Q.min=(Y,W)=>Q.check(j1(Y,W)),Q.nonempty=(Y)=>Q.check(j1(1,Y)),Q.max=(Y,W)=>Q.check(W6(Y,W)),Q.length=(Y,W)=>Q.check(G6(Y,W)),Q.unwrap=()=>Q.element});function _(Q,X){return IW(pH,Q,X)}var eW=q("ZodObject",(Q,X)=>{CY.init(Q,X),s.init(Q,X),h.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>L0(Object.keys(Q._zod.def.shape)),Q.catchall=(Y)=>Q.clone({...Q._zod.def,catchall:Y}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:cH()}),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(YG,Q,Y[0]),Q.required=(...Y)=>h.required(WG,Q,Y[0])});function w(Q,X){let Y={type:"object",shape:Q??{},...h.normalizeParams(X)};return new eW(Y)}function A0(Q,X){return new eW({type:"object",shape:Q,catchall:o(),...h.normalizeParams(X)})}var QG=q("ZodUnion",(Q,X)=>{TQ.init(Q,X),s.init(Q,X),Q.options=X.options});function p(Q,X){return new QG({type:"union",options:Q,...h.normalizeParams(X)})}var iH=q("ZodDiscriminatedUnion",(Q,X)=>{QG.init(Q,X),kY.init(Q,X)});function dQ(Q,X,Y){return new iH({type:"union",options:X,discriminator:Q,...h.normalizeParams(Y)})}var nH=q("ZodIntersection",(Q,X)=>{vY.init(Q,X),s.init(Q,X)});function z6(Q,X){return new nH({type:"intersection",left:Q,right:X})}var rH=q("ZodRecord",(Q,X)=>{xY.init(Q,X),s.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function t(Q,X,Y){return new rH({type:"record",keyType:Q,valueType:X,...h.normalizeParams(Y)})}var iQ=q("ZodEnum",(Q,X)=>{_Y.init(Q,X),s.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 $={};for(let J of W)if(Y.has(J))$[J]=X.entries[J];else throw Error(`Key ${J} not found in enum`);return new iQ({...X,checks:[],...h.normalizeParams(G),entries:$})},Q.exclude=(W,G)=>{let $={...X.entries};for(let J of W)if(Y.has(J))delete $[J];else throw Error(`Key ${J} not found in enum`);return new iQ({...X,checks:[],...h.normalizeParams(G),entries:$})}});function L0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new iQ({type:"enum",entries:Y,...h.normalizeParams(X)})}var dH=q("ZodLiteral",(Q,X)=>{yY.init(Q,X),s.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 b(Q,X){return new dH({type:"literal",values:Array.isArray(Q)?Q:[Q],...h.normalizeParams(X)})}var oH=q("ZodTransform",(Q,X)=>{gY.init(Q,X),s.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new p1(Q.constructor.name);Y.addIssue=($)=>{if(typeof $==="string")Y.issues.push(h.issue($,Y.value,X));else{let J=$;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=Y.value),J.inst??(J.inst=Q),Y.issues.push(h.issue(J))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then(($)=>{return Y.value=$,Y});return Y.value=G,Y}});function XG(Q){return new oH({type:"transform",transform:Q})}var YG=q("ZodOptional",(Q,X)=>{uY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function a(Q){return new YG({type:"optional",innerType:Q})}var tH=q("ZodNullable",(Q,X)=>{hY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function tW(Q){return new tH({type:"nullable",innerType:Q})}var aH=q("ZodDefault",(Q,X)=>{fY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function sH(Q,X){return new aH({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var eH=q("ZodPrefault",(Q,X)=>{lY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function Q3(Q,X){return new eH({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var WG=q("ZodNonOptional",(Q,X)=>{mY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function X3(Q,X){return new WG({type:"nonoptional",innerType:Q,...h.normalizeParams(X)})}var Y3=q("ZodCatch",(Q,X)=>{cY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function W3(Q,X){return new Y3({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var G3=q("ZodPipe",(Q,X)=>{pY.init(Q,X),s.init(Q,X),Q.in=X.in,Q.out=X.out});function nQ(Q,X){return new G3({type:"pipe",in:Q,out:X})}var $3=q("ZodReadonly",(Q,X)=>{iY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function J3(Q){return new $3({type:"readonly",innerType:Q})}var GG=q("ZodCustom",(Q,X)=>{nY.init(Q,X),s.init(Q,X)});function $G(Q,X){return EW(GG,Q??(()=>!0),X)}function z3(Q,X={}){return TW(GG,Q,X)}function H3(Q){return SW(Q)}function oQ(Q,X){return nQ(XG(Q),X)}w0(SQ());var tQ="2025-11-25";var JG=[tQ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Y1="io.modelcontextprotocol/related-task",U6="2.0",G0=$G((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),zG=p([D(),l().int()]),HG=D(),bZ=A0({ttl:p([l(),rQ()]).optional(),pollInterval:l().optional()}),U3=w({ttl:l().optional()}),A3=w({taskId:D()}),aQ=A0({progressToken:zG.optional(),[Y1]:A3.optional()}),Z0=w({_meta:aQ.optional()}),G4=Z0.extend({task:U3.optional()}),UG=(Q)=>G4.safeParse(Q).success,$0=w({method:D(),params:Z0.loose().optional()}),b0=w({_meta:aQ.optional()}),P0=w({method:D(),params:b0.loose().optional()}),J0=A0({_meta:aQ.optional()}),A6=p([D(),l().int()]),AG=w({jsonrpc:b(U6),id:A6,...$0.shape}).strict(),sQ=(Q)=>AG.safeParse(Q).success,KG=w({jsonrpc:b(U6),...P0.shape}).strict(),BG=(Q)=>KG.safeParse(Q).success,eQ=w({jsonrpc:b(U6),id:A6,result:J0}).strict(),$4=(Q)=>eQ.safeParse(Q).success;var y;(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"})(y||(y={}));var Q9=w({jsonrpc:b(U6),id:A6.optional(),error:w({code:l().int(),message:D(),data:o().optional()})}).strict();var DG=(Q)=>Q9.safeParse(Q).success;var LG=p([AG,KG,eQ,Q9]),PZ=p([eQ,Q9]),K6=J0.strict(),K3=b0.extend({requestId:A6.optional(),reason:D().optional()}),B6=P0.extend({method:b("notifications/cancelled"),params:K3}),B3=w({src:D(),mimeType:D().optional(),sizes:_(D()).optional(),theme:L0(["light","dark"]).optional()}),J4=w({icons:_(B3).optional()}),E1=w({name:D(),title:D().optional()}),qG=E1.extend({...E1.shape,...J4.shape,version:D(),websiteUrl:D().optional(),description:D().optional()}),D3=z6(w({applyDefaults:Y0().optional()}),t(D(),o())),L3=oQ((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},z6(w({form:D3.optional(),url:G0.optional()}),t(D(),o()).optional())),q3=A0({list:G0.optional(),cancel:G0.optional(),requests:A0({sampling:A0({createMessage:G0.optional()}).optional(),elicitation:A0({create:G0.optional()}).optional()}).optional()}),F3=A0({list:G0.optional(),cancel:G0.optional(),requests:A0({tools:A0({call:G0.optional()}).optional()}).optional()}),O3=w({experimental:t(D(),G0).optional(),sampling:w({context:G0.optional(),tools:G0.optional()}).optional(),elicitation:L3.optional(),roots:w({listChanged:Y0().optional()}).optional(),tasks:q3.optional()}),M3=Z0.extend({protocolVersion:D(),capabilities:O3,clientInfo:qG}),X9=$0.extend({method:b("initialize"),params:M3});var V3=w({experimental:t(D(),G0).optional(),logging:G0.optional(),completions:G0.optional(),prompts:w({listChanged:Y0().optional()}).optional(),resources:w({subscribe:Y0().optional(),listChanged:Y0().optional()}).optional(),tools:w({listChanged:Y0().optional()}).optional(),tasks:F3.optional()}),Z3=J0.extend({protocolVersion:D(),capabilities:V3,serverInfo:qG,instructions:D().optional()}),Y9=P0.extend({method:b("notifications/initialized"),params:b0.optional()});var D6=$0.extend({method:b("ping"),params:Z0.optional()}),N3=w({progress:l(),total:a(l()),message:a(D())}),w3=w({...b0.shape,...N3.shape,progressToken:zG}),L6=P0.extend({method:b("notifications/progress"),params:w3}),b3=Z0.extend({cursor:HG.optional()}),z4=$0.extend({params:b3.optional()}),H4=J0.extend({nextCursor:HG.optional()}),P3=L0(["working","input_required","completed","failed","cancelled"]),U4=w({taskId:D(),status:P3,ttl:p([l(),rQ()]),createdAt:D(),lastUpdatedAt:D(),pollInterval:a(l()),statusMessage:a(D())}),T1=J0.extend({task:U4}),j3=b0.merge(U4),A4=P0.extend({method:b("notifications/tasks/status"),params:j3}),q6=$0.extend({method:b("tasks/get"),params:Z0.extend({taskId:D()})}),F6=J0.merge(U4),O6=$0.extend({method:b("tasks/result"),params:Z0.extend({taskId:D()})}),jZ=J0.loose(),M6=z4.extend({method:b("tasks/list")}),V6=H4.extend({tasks:_(U4)}),Z6=$0.extend({method:b("tasks/cancel"),params:Z0.extend({taskId:D()})}),FG=J0.merge(U4),OG=w({uri:D(),mimeType:a(D()),_meta:t(D(),o()).optional()}),MG=OG.extend({text:D()}),W9=D().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),VG=OG.extend({blob:W9}),K4=L0(["user","assistant"]),S1=w({audience:_(K4).optional(),priority:l().min(0).max(1).optional(),lastModified:W4.datetime({offset:!0}).optional()}),ZG=w({...E1.shape,...J4.shape,uri:D(),description:a(D()),mimeType:a(D()),annotations:S1.optional(),_meta:a(A0({}))}),I3=w({...E1.shape,...J4.shape,uriTemplate:D(),description:a(D()),mimeType:a(D()),annotations:S1.optional(),_meta:a(A0({}))}),G9=z4.extend({method:b("resources/list")}),E3=H4.extend({resources:_(ZG)}),T3=z4.extend({method:b("resources/templates/list")}),S3=H4.extend({resourceTemplates:_(I3)}),$9=Z0.extend({uri:D()}),R3=$9,J9=$0.extend({method:b("resources/read"),params:R3}),C3=J0.extend({contents:_(p([MG,VG]))}),k3=P0.extend({method:b("notifications/resources/list_changed"),params:b0.optional()}),v3=$9,x3=$0.extend({method:b("resources/subscribe"),params:v3}),_3=$9,y3=$0.extend({method:b("resources/unsubscribe"),params:_3}),g3=b0.extend({uri:D()}),u3=P0.extend({method:b("notifications/resources/updated"),params:g3}),h3=w({name:D(),description:a(D()),required:a(Y0())}),f3=w({...E1.shape,...J4.shape,description:a(D()),arguments:a(_(h3)),_meta:a(A0({}))}),l3=z4.extend({method:b("prompts/list")}),m3=H4.extend({prompts:_(f3)}),c3=Z0.extend({name:D(),arguments:t(D(),D()).optional()}),p3=$0.extend({method:b("prompts/get"),params:c3}),z9=w({type:b("text"),text:D(),annotations:S1.optional(),_meta:t(D(),o()).optional()}),H9=w({type:b("image"),data:W9,mimeType:D(),annotations:S1.optional(),_meta:t(D(),o()).optional()}),U9=w({type:b("audio"),data:W9,mimeType:D(),annotations:S1.optional(),_meta:t(D(),o()).optional()}),i3=w({type:b("tool_use"),name:D(),id:D(),input:t(D(),o()),_meta:t(D(),o()).optional()}),n3=w({type:b("resource"),resource:p([MG,VG]),annotations:S1.optional(),_meta:t(D(),o()).optional()}),r3=ZG.extend({type:b("resource_link")}),A9=p([z9,H9,U9,r3,n3]),d3=w({role:K4,content:A9}),o3=J0.extend({description:D().optional(),messages:_(d3)}),t3=P0.extend({method:b("notifications/prompts/list_changed"),params:b0.optional()}),a3=w({title:D().optional(),readOnlyHint:Y0().optional(),destructiveHint:Y0().optional(),idempotentHint:Y0().optional(),openWorldHint:Y0().optional()}),s3=w({taskSupport:L0(["required","optional","forbidden"]).optional()}),NG=w({...E1.shape,...J4.shape,description:D().optional(),inputSchema:w({type:b("object"),properties:t(D(),G0).optional(),required:_(D()).optional()}).catchall(o()),outputSchema:w({type:b("object"),properties:t(D(),G0).optional(),required:_(D()).optional()}).catchall(o()).optional(),annotations:a3.optional(),execution:s3.optional(),_meta:t(D(),o()).optional()}),K9=z4.extend({method:b("tools/list")}),e3=H4.extend({tools:_(NG)}),N6=J0.extend({content:_(A9).default([]),structuredContent:t(D(),o()).optional(),isError:Y0().optional()}),IZ=N6.or(J0.extend({toolResult:o()})),QU=G4.extend({name:D(),arguments:t(D(),o()).optional()}),B4=$0.extend({method:b("tools/call"),params:QU}),XU=P0.extend({method:b("notifications/tools/list_changed"),params:b0.optional()}),EZ=w({autoRefresh:Y0().default(!0),debounceMs:l().int().nonnegative().default(300)}),D4=L0(["debug","info","notice","warning","error","critical","alert","emergency"]),YU=Z0.extend({level:D4}),B9=$0.extend({method:b("logging/setLevel"),params:YU}),WU=b0.extend({level:D4,logger:D().optional(),data:o()}),GU=P0.extend({method:b("notifications/message"),params:WU}),$U=w({name:D().optional()}),JU=w({hints:_($U).optional(),costPriority:l().min(0).max(1).optional(),speedPriority:l().min(0).max(1).optional(),intelligencePriority:l().min(0).max(1).optional()}),zU=w({mode:L0(["auto","required","none"]).optional()}),HU=w({type:b("tool_result"),toolUseId:D().describe("The unique identifier for the corresponding tool call."),content:_(A9).default([]),structuredContent:w({}).loose().optional(),isError:Y0().optional(),_meta:t(D(),o()).optional()}),UU=dQ("type",[z9,H9,U9]),H6=dQ("type",[z9,H9,U9,i3,HU]),AU=w({role:K4,content:p([H6,_(H6)]),_meta:t(D(),o()).optional()}),KU=G4.extend({messages:_(AU),modelPreferences:JU.optional(),systemPrompt:D().optional(),includeContext:L0(["none","thisServer","allServers"]).optional(),temperature:l().optional(),maxTokens:l().int(),stopSequences:_(D()).optional(),metadata:G0.optional(),tools:_(NG).optional(),toolChoice:zU.optional()}),BU=$0.extend({method:b("sampling/createMessage"),params:KU}),D9=J0.extend({model:D(),stopReason:a(L0(["endTurn","stopSequence","maxTokens"]).or(D())),role:K4,content:UU}),L9=J0.extend({model:D(),stopReason:a(L0(["endTurn","stopSequence","maxTokens","toolUse"]).or(D())),role:K4,content:p([H6,_(H6)])}),DU=w({type:b("boolean"),title:D().optional(),description:D().optional(),default:Y0().optional()}),LU=w({type:b("string"),title:D().optional(),description:D().optional(),minLength:l().optional(),maxLength:l().optional(),format:L0(["email","uri","date","date-time"]).optional(),default:D().optional()}),qU=w({type:L0(["number","integer"]),title:D().optional(),description:D().optional(),minimum:l().optional(),maximum:l().optional(),default:l().optional()}),FU=w({type:b("string"),title:D().optional(),description:D().optional(),enum:_(D()),default:D().optional()}),OU=w({type:b("string"),title:D().optional(),description:D().optional(),oneOf:_(w({const:D(),title:D()})),default:D().optional()}),MU=w({type:b("string"),title:D().optional(),description:D().optional(),enum:_(D()),enumNames:_(D()).optional(),default:D().optional()}),VU=p([FU,OU]),ZU=w({type:b("array"),title:D().optional(),description:D().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({type:b("string"),enum:_(D())}),default:_(D()).optional()}),NU=w({type:b("array"),title:D().optional(),description:D().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({anyOf:_(w({const:D(),title:D()}))}),default:_(D()).optional()}),wU=p([ZU,NU]),bU=p([MU,VU,wU]),PU=p([bU,DU,LU,qU]),jU=G4.extend({mode:b("form").optional(),message:D(),requestedSchema:w({type:b("object"),properties:t(D(),PU),required:_(D()).optional()})}),IU=G4.extend({mode:b("url"),message:D(),elicitationId:D(),url:D().url()}),EU=p([jU,IU]),TU=$0.extend({method:b("elicitation/create"),params:EU}),SU=b0.extend({elicitationId:D()}),RU=P0.extend({method:b("notifications/elicitation/complete"),params:SU}),w6=J0.extend({action:L0(["accept","decline","cancel"]),content:oQ((Q)=>Q===null?void 0:Q,t(D(),p([D(),l(),Y0(),_(D())])).optional())}),CU=w({type:b("ref/resource"),uri:D()});var kU=w({type:b("ref/prompt"),name:D()}),vU=Z0.extend({ref:p([kU,CU]),argument:w({name:D(),value:D()}),context:w({arguments:t(D(),D()).optional()}).optional()}),xU=$0.extend({method:b("completion/complete"),params:vU});var _U=J0.extend({completion:A0({values:_(D()).max(100),total:a(l().int()),hasMore:a(Y0())})}),yU=w({uri:D().startsWith("file://"),name:D().optional(),_meta:t(D(),o()).optional()}),gU=$0.extend({method:b("roots/list"),params:Z0.optional()}),q9=J0.extend({roots:_(yU)}),uU=P0.extend({method:b("notifications/roots/list_changed"),params:b0.optional()}),TZ=p([D6,X9,xU,B9,p3,l3,G9,T3,J9,x3,y3,B4,K9,q6,O6,M6,Z6]),SZ=p([B6,L6,Y9,uU,A4]),RZ=p([K6,D9,L9,w6,q9,F6,V6,T1]),CZ=p([D6,BU,TU,gU,q6,O6,M6,Z6]),kZ=p([B6,L6,GU,u3,k3,XU,t3,A4,RU]),vZ=p([K6,Z3,_U,o3,m3,E3,S3,C3,N6,e3,F6,V6,T1]);class k 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===y.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new wG(W.elicitations,X)}return new k(Q,X,Y)}}class wG extends k{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(y.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function W1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var hU=Symbol("Let zodToJsonSchema decide on which parser to use");var BN=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function F9(Q){let Y=$6(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=RW(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function O9(Q,X){let Y=X1(Q,X);if(!Y.success)throw Y.error;return Y.data}var iU=60000;class M9{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(B6,(X)=>{this._oncancel(X)}),this.setNotificationHandler(L6,(X)=>{this._onprogress(X)}),this.setRequestHandler(D6,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(q6,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new k(y.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(O6,async(X,Y)=>{let W=async()=>{let G=X.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(G,Y.sessionId)){if(J.type==="response"||J.type==="error"){let z=J.message,H=z.id,U=this._requestResolvers.get(H);if(U)if(this._requestResolvers.delete(H),J.type==="response")U(z);else{let A=z,K=new k(A.error.code,A.error.message,A.error.data);U(K)}else{let A=J.type==="response"?"Response":"Error";this._onerror(Error(`${A} handler missing for request ${H}`))}continue}await this._transport?.send(J.message,{relatedRequestId:Y.requestId})}}let $=await this._taskStore.getTask(G,Y.sessionId);if(!$)throw new k(y.InvalidParams,`Task not found: ${G}`);if(!W1($.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(W1($.status)){let J=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...J,_meta:{...J._meta,[Y1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(M6,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 k(y.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(Z6,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new k(y.InvalidParams,`Task not found: ${X.params.taskId}`);if(W1(W.status))throw new k(y.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 k(y.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof k)throw W;throw new k(y.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),k.fromError(y.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,$)=>{if(W?.(G,$),$4(G)||DG(G))this._onresponse(G);else if(sQ(G))this._onrequest(G,$);else if(BG(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=k.fromError(y.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?.[Y1]?.taskId;if(Y===void 0){let U={jsonrpc:"2.0",id:Q.id,error:{code:y.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:U,timestamp:Date.now()},W?.sessionId).catch((A)=>this._onerror(Error(`Failed to enqueue error response: ${A}`)));else W?.send(U).catch((A)=>this._onerror(Error(`Failed to send an error response: ${A}`)));return}let $=new AbortController;this._requestHandlerAbortControllers.set(Q.id,$);let J=UG(Q.params)?Q.params.task:void 0,z=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:$.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(U)=>{let A={relatedRequestId:Q.id};if(G)A.relatedTask={taskId:G};await this.notification(U,A)},sendRequest:async(U,A,K)=>{let B={...K,relatedRequestId:Q.id};if(G&&!B.relatedTask)B.relatedTask={taskId:G};let L=B.relatedTask?.taskId??G;if(L&&z)await z.updateTaskStatus(L,"input_required");return await this.request(U,A,B)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:G,taskStore:z,taskRequestedTtl:J?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,H)).then(async(U)=>{if($.signal.aborted)return;let A={result:U,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)},async(U)=>{if($.signal.aborted)return;let A={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(U.code)?U.code:y.InternalError,message:U.message??"Internal error",...U.data!==void 0&&{data:U.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:A,timestamp:Date.now()},W?.sessionId);else await W?.send(A)}).catch((U)=>this._onerror(Error(`Failed to send response: ${U}`))).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 $=this._responseHandlers.get(W),J=this._timeoutInfo.get(W);if(J&&$&&J.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(z){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),$(z);return}G(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),$4(Q))Y(Q);else{let $=new k(Q.error.code,Q.error.message,Q.error.data);Y($)}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($4(Q)&&Q.result&&typeof Q.result==="object"){let $=Q.result;if($.task&&typeof $.task==="object"){let J=$.task;if(typeof J.taskId==="string")G=!0,this._taskProgressTokens.set(J.taskId,X)}}if(!G)this._progressHandlers.delete(X);if($4(Q))W(Q);else{let $=k.fromError(Q.error.code,Q.error.message,Q.error.data);W($)}}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($){yield{type:"error",error:$ instanceof k?$:new k(y.InternalError,String($))}}return}let G;try{let $=await this.request(Q,T1,Y);if($.task)G=$.task.taskId,yield{type:"taskCreated",task:$.task};else throw new k(y.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:J},W1(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if(J.status==="failed")yield{type:"error",error:new k(y.InternalError,`Task ${G} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new k(y.InternalError,`Task ${G} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};return}let z=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,z)),Y?.signal?.throwIfAborted()}}catch($){yield{type:"error",error:$ instanceof k?$:new k(y.InternalError,String($))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$,task:J,relatedTask:z}=Y??{};return new Promise((H,U)=>{let A=(M)=>{U(M)};if(!this._transport){A(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),J)this.assertTaskCapability(Q.method)}catch(M){A(M);return}Y?.signal?.throwIfAborted();let K=this._requestMessageId++,B={...Q,jsonrpc:"2.0",id:K};if(Y?.onprogress)this._progressHandlers.set(K,Y.onprogress),B.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:K}};if(J)B.params={...B.params,task:J};if(z)B.params={...B.params,_meta:{...B.params?._meta||{},[Y1]:z}};let L=(M)=>{this._responseHandlers.delete(K),this._progressHandlers.delete(K),this._cleanupTimeout(K),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:K,reason:String(M)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let S=M instanceof k?M:new k(y.RequestTimeout,String(M));U(S)};this._responseHandlers.set(K,(M)=>{if(Y?.signal?.aborted)return;if(M instanceof Error)return U(M);try{let S=X1(X,M.result);if(!S.success)U(S.error);else H(S.data)}catch(S){U(S)}}),Y?.signal?.addEventListener("abort",()=>{L(Y?.signal?.reason)});let F=Y?.timeout??iU,O=()=>L(k.fromError(y.RequestTimeout,"Request timed out",{timeout:F}));this._setupTimeout(K,F,Y?.maxTotalTimeout,O,Y?.resetTimeoutOnProgress??!1);let V=z?.taskId;if(V){let M=(S)=>{let E=this._responseHandlers.get(K);if(E)E(S);else this._onerror(Error(`Response handler missing for side-channeled request ${K}`))};this._requestResolvers.set(K,M),this._enqueueTaskMessage(V,{type:"request",message:B,timestamp:Date.now()}).catch((S)=>{this._cleanupTimeout(K),U(S)})}else this._transport.send(B,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((M)=>{this._cleanupTimeout(K),U(M)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},F6,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},V6,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},FG,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let J={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[Y1]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:J,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 J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[Y1]:X.relatedTask}}};this._transport?.send(J,X).catch((z)=>this._onerror(z))});return}let $={...Q,jsonrpc:"2.0"};if(X?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[Y1]:X.relatedTask}}};await this._transport.send($,X)}setRequestHandler(Q,X){let Y=F9(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let $=O9(Q,W);return Promise.resolve(X($,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=F9(Q);this._notificationHandlers.set(Y,(W)=>{let G=O9(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"&&sQ(W.message)){let G=W.message.id,$=this._requestResolvers.get(G);if($)$(new k(y.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 k(y.InvalidRequest,"Request cancelled"));return}let $=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout($),G(new k(y.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 k(y.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,$)=>{await Y.storeTaskResult(W,G,$,X);let J=await Y.getTask(W,X);if(J){let z=A4.parse({method:"notifications/tasks/status",params:J});if(await this.notification(z),W1(J.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,G,$)=>{let J=await Y.getTask(W,X);if(!J)throw new k(y.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(W1(J.status))throw new k(y.InvalidParams,`Cannot update task "${W}" from terminal status "${J.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(W,G,$,X);let z=await Y.getTask(W,X);if(z){let H=A4.parse({method:"notifications/tasks/status",params:z});if(await this.notification(H),W1(z.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function bG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function PG(Q,X){let Y={...Q};for(let W in X){let G=W,$=X[G];if($===void 0)continue;let J=Y[G];if(bG(J)&&bG($))Y[G]={...J,...$};else Y[G]=$}return Y}var X5=xX(BX(),1),Y5=xX(Q5(),1);function QM(){let Q=new X5.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Y5.default(Q),Q}class wX{constructor(Q){this._ajv=Q??QM()}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 bX{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 W5(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 G5(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 PX extends M9{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(D4.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 wX,this.setRequestHandler(X9,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(Y9,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(B9,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:$}=Y.params,J=D4.safeParse($);if(J.success)this._loggingLevels.set(G,J.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new bX(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=PG(this._capabilities,Q)}setRequestHandler(Q,X){let W=$6(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(I1(W)){let J=W;G=J._zod?.def?.value??J.value}else{let J=W;G=J._def?.value??J.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let J=async(z,H)=>{let U=X1(B4,z);if(!U.success){let L=U.error instanceof Error?U.error.message:String(U.error);throw new k(y.InvalidParams,`Invalid tools/call request: ${L}`)}let{params:A}=U.data,K=await Promise.resolve(X(z,H));if(A.task){let L=X1(T1,K);if(!L.success){let F=L.error instanceof Error?L.error.message:String(L.error);throw new k(y.InvalidParams,`Invalid task creation result: ${F}`)}return L.data}let B=X1(N6,K);if(!B.success){let L=B.error instanceof Error?B.error.message:String(B.error);throw new k(y.InvalidParams,`Invalid tools/call result: ${L}`)}return B.data};return super.setRequestHandler(Q,J)}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){G5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;W5(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:JG.includes(X)?X:tQ,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"},K6)}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((H)=>H.type==="tool_result"),$=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,J=$?Array.isArray($.content)?$.content:[$.content]:[],z=J.some((H)=>H.type==="tool_use");if(G){if(W.some((H)=>H.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 H=new Set(J.filter((A)=>A.type==="tool_use").map((A)=>A.id)),U=new Set(W.filter((A)=>A.type==="tool_result").map((A)=>A.toolUseId));if(H.size!==U.size||![...H].every((A)=>U.has(A)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(Q.tools)return this.request({method:"sampling/createMessage",params:Q},L9,X);return this.request({method:"sampling/createMessage",params:Q},D9,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},w6,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},w6,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let J=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!J.valid)throw new k(y.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorMessage}`)}catch($){if($ instanceof k)throw $;throw new k(y.InternalError,`Error validating elicitation response: ${$ instanceof Error?$.message:String($)}`)}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},q9,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 J5 from"node:process";class jX{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),XM(X)}clear(){this._buffer=void 0}}function XM(Q){return LG.parse(JSON.parse(Q))}function $5(Q){return JSON.stringify(Q)+`
|
|
30
|
-
`}class IX{constructor(Q=J5.stdin,X=J5.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new jX,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=$5(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var z5={name:"@sequenzy/mcp",version:"0.0.42",mcpName:"io.github.sequenzy/mcp",description:"Sequenzy MCP server for AI-powered email marketing automation",type:"module",bin:{"sequenzy-mcp":"dist/index.js"},main:"./dist/index.js",exports:{".":"./dist/index.js","./server.json":"./server.json"},scripts:{dev:"bun --watch src/index.ts",build:"bun build src/index.ts --outdir dist --target node --minify",start:"node dist/index.js","type-check":"tsc --noEmit",test:"bun test","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{"@modelcontextprotocol/sdk":"^1.0.0"},devDependencies:{"@types/bun":"latest","@types/node":"^22.0.0","bun-types":"latest",typescript:"^5.8.0"},files:["dist","server.json"],keywords:["sequenzy","email","mcp","ai","claude","automation"],license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/Sequenzy/mcp.git"},homepage:"https://sequenzy.com",bugs:{url:"https://github.com/Sequenzy/mcp/issues"}};class l1 extends Error{statusCode;rawDetails;code;context;constructor(Q,X,Y,W,G){super(Q);this.statusCode=X;this.rawDetails=Y;this.code=W;this.context=G;this.name="McpApiError"}}function WM(Q){if(Q instanceof l1)return{message:Q.message,statusCode:Q.statusCode,code:Q.code,rawDetails:Q.rawDetails,context:Q.context};if(Q instanceof Error)return{message:Q.message};return{message:String(Q)}}function GM(Q){let X=WM(Q),Y=X.message.trim()||"Unknown error",W=Y.toLowerCase(),G=X.rawDetails?.trim()||Y;if(X.context?.title||X.context?.description||X.context?.howToFix||X.context?.docsUrl)return{title:X.context.title??(X.statusCode===409?"Request conflict":"API request failed"),description:X.context.description??Y,howToFix:X.context.howToFix??"Review the details below, adjust the tool input, and retry.",docsUrl:X.context.docsUrl??"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.code==="MCP_AUTH_REQUIRED"||W.includes("sequenzy_api_key environment variable is required"))return{title:"Missing MCP API key",description:"The MCP server started without a Sequenzy API key, so it cannot authenticate any tool or resource request.",howToFix:"Add `SEQUENZY_API_KEY` to the MCP server environment, or run `npx @sequenzy/setup` to configure the integration automatically.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===401||X.code==="UNAUTHORIZED")return{title:"Authentication failed",description:"The MCP server reached Sequenzy, but the current API key was rejected.",howToFix:"Replace `SEQUENZY_API_KEY` with a valid personal API key, then restart the MCP client so it reconnects with fresh credentials.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(X.statusCode===403||W.includes("access denied"))return{title:"Access denied",description:"The current API key is valid, but it does not have permission to access the requested company or action.",howToFix:"Use an API key that belongs to the right account, or select a company the key can access before retrying the tool call.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(W.includes("no company available")||W.includes("company not found"))return{title:"Company selection required",description:"The MCP server could not resolve a company for this request.",howToFix:"Call `get_account` to inspect available companies, then call `select_company`, or pass `companyId` explicitly in the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===404||W.includes("not found"))return{title:"Requested resource not found",description:"Sequenzy could not find the requested campaign, template, sequence, company, or subscriber.",howToFix:"List or fetch the resource collection first, then retry the tool with a confirmed ID or email value.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===409||W.includes("already exists"))return{title:"Resource already exists",description:"Sequenzy rejected this MCP request because it would create a duplicate resource.",howToFix:"List the existing resources first, reuse the matching resource when appropriate, or retry with a unique name or domain.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===429||W.includes("rate limit"))return{title:"Rate limited",description:"Sequenzy temporarily slowed this MCP request because too many requests were sent too quickly.",howToFix:"Wait briefly before retrying. If the client is looping, reduce retries or add backoff before the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.code==="NETWORK_ERROR"||W.includes("fetch failed"))return{title:"Network or configuration error",description:"The MCP server could not reach the Sequenzy API from this environment.",howToFix:"Check connectivity and verify `SEQUENZY_API_URL` if you override it in the MCP environment.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("unknown tool")||W.includes("unknown resource"))return{title:"Unsupported MCP request",description:"The client asked for a tool or resource name that this Sequenzy MCP server does not expose.",howToFix:"Refresh the client's tool list and call only the names returned by `list_tools` or `list_resources`.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("is required")||W.includes("invalid"))return{title:"Invalid MCP input",description:"The tool call was missing a required field or included an invalid value.",howToFix:"Review the tool schema, supply the missing argument, and retry the request with corrected input.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode&&X.statusCode>=500)return{title:"Sequenzy server error",description:"The request reached Sequenzy, but the server could not complete it successfully.",howToFix:"Retry once. If it still fails, keep the details below and consult the docs before escalating.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};return{title:"Tool execution failed",description:"The MCP server could not complete the requested operation.",howToFix:"Review the details below, adjust the tool input or credentials, and retry.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G}}function Z1(Q){let X=GM(Q);return[`Sequenzy MCP error: ${X.title}`,`Description: ${X.description}`,`How to fix: ${X.howToFix}`,`Docs: ${X.docsUrl}`,`Details: ${X.details}`].join(`
|
|
31
|
-
`)}var EX=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],H5={dashboard:"/dashboard/company/{companyId}",campaigns:"/dashboard/company/{companyId}/campaign",campaign:"/dashboard/company/{companyId}/campaign/{campaignId}",campaignPreview:"/dashboard/company/{companyId}/campaign/{campaignId}?step=review",campaignList:"/dashboard/company/{companyId}/campaign/list/{status}",sequences:"/dashboard/company/{companyId}/sequences",sequence:"/dashboard/company/{companyId}/sequences/{sequenceId}",sequenceList:"/dashboard/company/{companyId}/sequences/list/{status}",settings:"/dashboard/company/{companyId}/settings",settingsTab:"/dashboard/company/{companyId}/settings?tab={tab}",emails:"/dashboard/company/{companyId}/emails",email:"/dashboard/company/{companyId}/emails/{emailId}",subscribers:"/dashboard/company/{companyId}/subscribers",sentEmails:"/dashboard/company/{companyId}/sent-emails",emailSend:"/dashboard/company/{companyId}/sent-emails/{emailSendId}",segments:"/dashboard/company/{companyId}/segments",metrics:"/dashboard/company/{companyId}/metrics",transactional:"/dashboard/company/{companyId}/transactional",transactionalEmail:"/dashboard/company/{companyId}/transactional/{transactionalId}",domain:"/dashboard/company/{companyId}/settings/domain/{domainId}",domainVerify:"/dashboard/company/{companyId}/settings/domain/{domainId}/verify"};function $M(Q){let Y=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return Y.length>0?Y:"https://sequenzy.com"}function h0(Q){let X=Q?.trim();return X?X:void 0}function t0(Q){return encodeURIComponent(Q)}function Q0(Q,X){return`${Q}${X}`}function X0(Q,X=""){return`/dashboard/company/${t0(Q)}${X}`}function U5(Q,X,Y){return Q0(Q,`${X0(X,"/settings")}?tab=${encodeURIComponent(Y)}`)}function JM(Q,X){let Y=EX.map((W)=>[W,X?U5(Q,X,W):""]);return Object.fromEntries(Y)}function K1(Q={},X){let Y=$M(X),W=h0(Q.companyId),G={},$=JM(Y,W);if(!W)return{appUrl:Y,routeTemplates:H5,settingsTabValues:EX,urls:G,settingsUrls:$};G.dashboard=Q0(Y,X0(W)),G.campaigns=Q0(Y,X0(W,"/campaign")),G.sequences=Q0(Y,X0(W,"/sequences")),G.settings=Q0(Y,X0(W,"/settings")),G.emails=Q0(Y,X0(W,"/emails")),G.subscribers=Q0(Y,X0(W,"/subscribers")),G.sentEmails=Q0(Y,X0(W,"/sent-emails")),G.segments=Q0(Y,X0(W,"/segments")),G.metrics=Q0(Y,X0(W,"/metrics")),G.transactional=Q0(Y,X0(W,"/transactional"));let J=h0(Q.campaignId);if(J)G.campaign=Q0(Y,X0(W,`/campaign/${t0(J)}`)),G.campaignPreview=`${G.campaign}?step=review`;let z=h0(Q.sequenceId);if(z)G.sequence=Q0(Y,X0(W,`/sequences/${t0(z)}`));let H=h0(Q.emailId)??h0(Q.templateId);if(H)G.email=Q0(Y,X0(W,`/emails/${t0(H)}`)),G.template=G.email;let U=h0(Q.transactionalId);if(U)G.transactionalEmail=Q0(Y,X0(W,`/transactional/${t0(U)}`));let A=h0(Q.emailSendId);if(A)G.emailSend=Q0(Y,X0(W,`/sent-emails/${t0(A)}`));let K=h0(Q.domainId);if(K)G.domain=Q0(Y,X0(W,`/settings/domain/${t0(K)}`)),G.domainVerify=`${G.domain}/verify`;let B=h0(Q.status);if(B)G.campaignList=Q0(Y,X0(W,`/campaign/list/${t0(B)}`)),G.sequenceList=Q0(Y,X0(W,`/sequences/list/${t0(B)}`));let L=h0(Q.settingsTab);if(L)G.settingsTab=U5(Y,W,L);return{appUrl:Y,routeTemplates:H5,settingsTabValues:EX,urls:G,settingsUrls:$}}var A5=[{uri:"sequenzy://dashboard",name:"Dashboard Overview",description:"Live overview stats for the last 7 days",mimeType:"application/json"},{uri:"sequenzy://company",name:"Current Company",description:"The currently selected company, including localization settings",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 with localization status",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"},{uri:"sequenzy://app-routes",name:"Dashboard URL Routes",description:"Route templates and settings tabs for building Sequenzy dashboard links",mimeType:"application/json"}];async function K5(Q){try{let X;switch(Q){case"sequenzy://dashboard":X=await Z("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let Y=await Z("GET","/api/v1/account"),W=m1()??Y.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");X=await Z("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":X=await Z("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":X=await Z("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":X=await Z("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":X=await Z("GET","/api/v1/sequences");break;case"sequenzy://templates":X=await Z("GET","/api/v1/templates");break;case"sequenzy://segments":X=await Z("GET","/api/v1/segments");break;case"sequenzy://tags":X=await Z("GET","/api/v1/tags");break;case"sequenzy://health":X=await Z("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":X=K1();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:Z1(X)}]}}}var zM={type:"object",properties:{id:{type:"string",description:"Optional filter ID. Any stable string works; one will be generated if omitted."},field:{type:"string",enum:["status","tag","email","emailProvider","added","firstName","lastName","list","emailSent","emailOpened","emailClicked","emailBounced","emailComplained","attribute","event","segment","stripeProduct","stripeCurrentProduct","stripeTrialProduct"],description:"Filter field. Use `event` for custom subscriber events, `segment` for saved segment membership, and `stripeProduct`/`stripeCurrentProduct`/`stripeTrialProduct` for Stripe product-based segments. Engagement fields (`emailSent`, `emailOpened`, `emailClicked`, `emailBounced`, `emailComplained`) accept a time range as the value or a specific campaign via `campaign:<campaign_id>`."},operator:{type:"string",enum:["is","is_not","is_empty","is_not_empty","contains","not_contains","less_than","more_than","at_least","less_than_count","gte","lte","gt","lt"],description:"Filter operator. Use `is_empty` or `is_not_empty` for fields that can be blank, including custom attributes. For `stripeProduct`, use `is` or `is_not` with a raw product ID, and `at_least` or `less_than_count` with `productId:count`. For `event`, use `is`, `is_not`, `at_least`, or `less_than_count`. For engagement fields, use `is` (event happened) or `is_not` (event did not happen)."},value:{type:"string",description:"Filter value. For custom attribute empty checks, use `attributeName:` such as `last_logged_in:`. Event examples: `saas.purchase:30d`, `saas.purchase:all`, or `saas.purchase:5:30d` for thresholds. Segment values are segment IDs. Stripe product examples: `prod_123` for bought/didn't buy, `prod_123:3` for payment thresholds. Engagement examples: `7d`, `30d`, `90d`, `180d`, `all` for rolling time windows, or `campaign:<campaign_id>` to scope to a specific sent campaign (use `list_campaigns` to find IDs)."}},required:["field","operator","value"],additionalProperties:!1},HM={type:"object",properties:{kind:{type:"string",enum:["group"]},id:{type:"string",description:"Stable group ID. Any string works; one will be generated if omitted."},joinOperator:{type:"string",enum:["and","or"],description:"How children in this group combine."},children:{type:"array",minItems:1,items:{type:"object",description:'Either a filter leaf (`kind: "filter"`) or another group (`kind: "group"`).'}}},required:["kind","joinOperator","children"],additionalProperties:!0};function L5(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(typeof X!=="object"||X===null)return X;let Y=X;if(typeof Y.id==="string"&&Y.id.trim()!=="")return Y;return{...Y,id:crypto.randomUUID()}})}function q5(Q){if(typeof Q!=="object"||Q===null)return Q;let X=Q;if(X.kind==="filter"){let Y=L5([X]);return Array.isArray(Y)?Y[0]:X}if(X.kind!=="group")return Q;return{...X,id:typeof X.id==="string"&&X.id.trim()!==""?X.id:crypto.randomUUID(),children:Array.isArray(X.children)?X.children.map(q5):[]}}function N1(Q,X,Y){if(X.html!==void 0&&X.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(X.blocks!==void 0&&!Array.isArray(X.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(Y?.requireContent&&X.html===void 0&&X.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function HQ(Q,X){if(X.labels===void 0)return;if(!Array.isArray(X.labels))throw Error(`\`labels\` must be an array when calling \`${Q}\`.`);if(X.labels.some((Y)=>typeof Y!=="string"||Y.trim().length===0))throw Error(`\`labels\` must contain only non-empty strings when calling \`${Q}\`.`)}function UM(Q){let X=Q.filters!==void 0,Y=Q.root!==void 0;if(X&&Y)throw Error("Provide either `filters` or `root` when calling `create_segment`, not both.");if(!X&&!Y)throw Error("Provide either `filters` or `root` when calling `create_segment`.");if(X){if(!Array.isArray(Q.filters))throw Error("`filters` must be an array when calling `create_segment`.");if(Q.filters.length===0)throw Error("`filters` must include at least one filter when calling `create_segment`.")}if(Y&&(typeof Q.root!=="object"||Q.root===null))throw Error("`root` must be an object when calling `create_segment`.")}function AM(Q){if(Q.clearEnrollmentFieldPath===!0&&Q.enrollmentFieldPath!==void 0)throw Error("Provide either `enrollmentFieldPath` or `clearEnrollmentFieldPath` when calling `update_sequence`, not both.");let X={...Q};if(delete X.clearEnrollmentFieldPath,Q.clearEnrollmentFieldPath===!0)X.enrollmentFieldPath=null;return X}function KM(Q){let X=j(Q,"subscriberId"),Y=Q.fieldValues,W=Y===void 0?void 0:Array.isArray(Y)?Y:void 0;if(Y!==void 0&&W===void 0)throw Error("`fieldValues` must be an array when calling `cancel_sequence_enrollments`.");let G=W?.map((z)=>typeof z==="string"?z.trim():"").filter((z)=>z.length>0)??[];if(W?.some((z)=>typeof z!=="string")||W!==void 0&&G.length===0)throw Error("`fieldValues` must contain at least one non-empty string when calling `cancel_sequence_enrollments`.");if(X!==void 0===G.length>0)throw Error("Provide exactly one target when calling `cancel_sequence_enrollments`: `subscriberId` or `fieldValues`.");let $=j(Q,"fieldPath"),J=j(Q,"reason");return{...X!==void 0&&{subscriberId:X},...$!==void 0&&{fieldPath:$},...G.length>0&&{fieldValues:G},...typeof Q.dryRun==="boolean"&&{dryRun:Q.dryRun},...J!==void 0&&{reason:J}}}function BM(Q){N1("create_campaign",Q),HQ("create_campaign",Q);let X=j(Q,"prompt")!==void 0,Y=Q.html!==void 0,W=Q.blocks!==void 0,G=Q.templateId!==void 0;if(Q.prompt!==void 0&&!X)throw Error("`prompt` cannot be empty when calling `create_campaign`.");if(X&&(Y||W||G))throw Error("Provide either `prompt`, `html`, `blocks`, or `templateId` when calling `create_campaign`, not multiple content sources.");if(!X&&(Q.style!==void 0||Q.tone!==void 0))throw Error("`style` and `tone` can only be used with `prompt` when calling `create_campaign`.");if(!X&&j(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}function DM(Q){if(j(Q,"scheduledAt")===void 0)throw Error("`scheduledAt` is required when calling `schedule_campaign`.");if(Q.targetLists!==void 0&&!D0(Q.targetLists))throw Error("`targetLists` must be an object when calling `schedule_campaign`.");if(Q.sendTimeOptimization!==void 0){if(typeof Q.sendTimeOptimization!=="boolean")throw Error("`sendTimeOptimization` must be a boolean when calling `schedule_campaign`.")}if(Q.spreadOverHours!==void 0){if(typeof Q.spreadOverHours!=="number"||!Number.isInteger(Q.spreadOverHours)||Q.spreadOverHours<1||Q.spreadOverHours>72)throw Error("`spreadOverHours` must be an integer between 1 and 72 when calling `schedule_campaign`.")}}function LM(Q){N1("create_transactional_email",Q);let X=j(Q,"prompt")!==void 0,Y=Q.html!==void 0,W=Q.blocks!==void 0;if(Q.prompt!==void 0&&!X)throw Error("`prompt` cannot be empty when calling `create_transactional_email`.");if(X&&(Y||W))throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`, not multiple content sources.");if(!X&&(Q.style!==void 0||Q.tone!==void 0))throw Error("`style` and `tone` can only be used with `prompt` when calling `create_transactional_email`.");if(!X&&!Y&&!W)throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`.");if(!X&&j(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_transactional_email`.")}var B5={type:"object",description:"A step to create inside a branch path. Use type:'delay' for a standalone delay, type:'email' for an email, or type:'create_discount' for a discount action.",properties:{type:{type:"string",enum:["email","delay","create_discount","discount","webhook"],description:"Branch path step type. Omit for email steps; use delay for standalone waits."},nodeType:{type:"string",enum:["logic_delay","action_email","action_create_discount","action_add_tag","action_remove_tag","action_add_to_list","action_remove_from_list","action_update_attributes","logic_wait_for_event","action_webhook"],description:"Advanced branch path node type. Prefer type unless creating a non-email action."},config:{type:"object",description:"Config for advanced nodeType steps such as tag/list/webhook/wait-for-event actions.",additionalProperties:!0},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:"Sequenzy email blocks for email steps.",items:{type:"object"}},html:{type:"string",description:"HTML content for email steps."},delay:{type:"object",description:"Delay before this step, or the delay duration when type is delay.",properties:{days:{type:"number"},hours:{type:"number"},minutes:{type:"number"}}},delayMs:{type:"number",description:"Delay in milliseconds. Useful for standalone type:'delay' steps."},name:{type:"string",description:"Email template name for email steps."},discount:{type:"object",description:"Discount configuration for create_discount steps. Same shape as create_sequence steps.",additionalProperties:!0},label:{type:"string",description:"Node label for discount or advanced node steps."},provider:{type:"string",enum:["stripe","shopify"]},discountType:{type:"string",enum:["percent","amount"]},percentOff:{type:"number"},amountOff:{type:"number"},currency:{type:"string"},duration:{type:"string",enum:["once","forever","repeating"]},durationInMonths:{type:"number"},appliesToAllPlans:{type:"boolean"},planIds:{type:"array",items:{type:"string"}},codePrefix:{type:"string"},maxRedemptions:{type:"number"},lockToSubscriber:{type:"boolean"},expiresAt:{type:"string"},expiresInHours:{type:"number"}},additionalProperties:!1};function qM(Q){if(!Q||typeof Q!=="object")return null;let X=Q;if(X.success!==!1)return null;if(typeof X.error==="string")return Error(X.error);if(X.error&&typeof X.error==="object"&&typeof X.error.message==="string")return Error(X.error.message);if(typeof X.message==="string")return Error(X.message);return Error("The tool returned an unsuccessful response.")}function D0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function D5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function FM(Q){let X=new URLSearchParams;if(typeof Q.query==="string"&&Q.query.trim()!=="")X.set("query",Q.query.trim());if(Array.isArray(Q.tags)&&Q.tags.length>0)X.set("tags",Q.tags.filter((Y)=>typeof Y==="string"&&Y.trim()!=="").join(","));if(typeof Q.segmentId==="string"&&Q.segmentId.trim()!=="")X.set("segmentId",Q.segmentId);if(typeof Q.status==="string"&&Q.status.trim()!=="")X.set("status",Q.status.trim());return X.set("page",String(Q.page)),X.set("limit",String(Q.pageSize)),X}async function OM(Q,X){let Y=typeof Q.limit==="number"&&Number.isFinite(Q.limit)?Math.max(1,Math.trunc(Q.limit)):void 0,W=Math.min(100,Math.max(1,Y??100)),G=[],$=1,J=0,z=0,H=0;while(!0){let A=FM({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,status:Q.status,page:$,pageSize:W}),K=await Z("GET",`/api/v1/subscribers?${A.toString()}`,void 0,X);J=K.pagination?.total??K.subscribers.length,z=K.pagination?.totalPages??1,H+=1,G.push(...K.subscribers??[]);let B=Y!==void 0&&G.length>=Y,L=K.pagination?$>=K.pagination.totalPages:(K.subscribers??[]).length<W;if(B||L)break;$+=1}let U=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:U,pagination:{page:1,limit:W,total:J,totalPages:z,fetchedPages:H},returned:U.length,truncated:Y!==void 0&&J>0&&U.length<J}}function MM(Q){let X=typeof Q.email==="string"&&Q.email.trim()!==""?Q.email.trim():void 0,Y=typeof Q.externalId==="string"&&Q.externalId.trim()!==""?Q.externalId.trim():void 0;return{...X?{email:X}:{},...Y?{externalId:Y}:{}}}function u4(Q,X){let Y=MM(X);if(!Y.email&&!Y.externalId)throw Error(`Provide either \`email\` or \`externalId\` when calling \`${Q}\`.`);return Y}function SX(Q){if(Q.email)return`/api/v1/subscribers/${encodeURIComponent(Q.email)}`;return`/api/v1/subscribers/external?externalId=${encodeURIComponent(String(Q.externalId))}`}async function TX(Q,X){return Z("GET",SX(Q),void 0,X)}function j(Q,X){let Y=Q[X];if(typeof Y!=="string")return;let W=Y.trim();return W.length>0?W:void 0}async function F5(Q){let X=j(Q,"companyId");if(X)return X;let Y=m1();if(Y)return Y;try{return(await Z("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function h4(Q,X){if(!D0(Q)||!X)return Q;return{...Q,url:X}}function O5(Q,X){if(!D0(Q))return Q;return{...Q,...X.campaign!==void 0&&{url:X.campaign},...X.campaignPreview!==void 0&&{previewUrl:X.campaignPreview}}}function zQ(Q,X,Y){if(!Array.isArray(Q)||!X)return Q;return Q.map((W)=>{if(!D0(W))return W;let G=j(W,"id");if(!G)return W;let $=K1({companyId:X,...Y==="campaign"&&{campaignId:G},...Y==="sequence"&&{sequenceId:G},...Y==="template"&&{emailId:G},...Y==="transactional"&&{transactionalId:G}});if(Y==="campaign")return O5(W,$.urls);let J=Y==="sequence"?$.urls.sequence:Y==="template"?$.urls.email:$.urls.transactionalEmail;return h4(W,J)})}function VM(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(!D0(X))return X;let Y=j(X,"id");if(!Y)return X;let W=K1({companyId:Y});return{...X,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var ZM=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","get_email_send","create_campaign","update_campaign","schedule_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","cancel_sequence_enrollments","list_ab_tests","get_ab_test","get_ab_test_stats","update_ab_test_variant","list_templates","get_template","create_template","update_template","list_transactional_emails","get_transactional_email","create_transactional_email","update_transactional_email"]);async function NM(Q,X,Y){if(!D0(Y)||!ZM.has(Q))return Y;let W=D0(Y.company)?Y.company:void 0,$=j(Y,"selectedCompanyId")??j(Y,"currentCompanyId")??j(Y,"companyId")??(W?j(W,"id"):void 0)??(W?j(W,"companyId"):void 0)??await F5(X);if(!$)return Y;let J=D0(Y.campaign)?Y.campaign:void 0,z=D0(Y.sequence)?Y.sequence:void 0,H=D0(Y.template)?Y.template:void 0,U=D0(Y.transactional)&&!Array.isArray(Y.transactional)?Y.transactional:void 0,A={companyId:$,campaignId:j(X,"campaignId")??j(Y,"campaignId")??(J?j(J,"id"):void 0),sequenceId:j(X,"sequenceId")??j(Y,"sequenceId")??(z?j(z,"id"):void 0),emailId:j(Y,"templateId")??(H?j(H,"id"):void 0)??(U?j(U,"emailId"):void 0)??j(X,"templateId"),transactionalId:j(X,"transactionalId")??(U?j(U,"id"):void 0)??j(X,"idOrSlug"),emailSendId:j(X,"emailSendId")??j(Y,"emailSendId")??(D0(Y.emailSend)?j(Y.emailSend,"id"):void 0),status:j(X,"status")},K=K1(A),B=W?K1({companyId:$}):void 0;return{...Y,...Array.isArray(Y.companies)&&{companies:VM(Y.companies)},...Array.isArray(Y.campaigns)&&{campaigns:zQ(Y.campaigns,$,"campaign")},...Array.isArray(Y.sequences)&&{sequences:zQ(Y.sequences,$,"sequence")},...Array.isArray(Y.templates)&&{templates:zQ(Y.templates,$,"template")},...Array.isArray(Y.transactional)&&{transactional:zQ(Y.transactional,$,"transactional")},...W&&B!==void 0&&{company:{...W,url:B.urls.dashboard,settingsUrl:B.urls.settings}},...J&&K.urls.campaign!==void 0&&{campaign:O5(J,K.urls)},...z&&K.urls.sequence!==void 0&&{sequence:h4(z,K.urls.sequence)},...H&&K.urls.email!==void 0&&{template:h4(H,K.urls.email)},...U&&K.urls.transactionalEmail!==void 0&&{transactional:h4(U,K.urls.transactionalEmail)},...D0(Y.emailSend)&&K.urls.emailSend!==void 0&&{emailSend:h4(Y.emailSend,K.urls.emailSend)},appUrls:K.urls}}var M5=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
29
|
+
`)}L.write("payload.value = newResult;"),L.write("return payload;");let S=L.compile();return(E,x)=>S(D,E,x)},$,J=F1,z=!m4.jitless,A=z&&M6.value,U=Y.catchall,K;Q._zod.parse=(D,L)=>{K??(K=W.value);let q=D.value;if(!J(q))return D.issues.push({expected:"object",code:"invalid_type",input:q,inst:Q}),D;if(z&&A&&L?.async===!1&&L.jitless!==!0){if(!$)$=G(Y.shape);if(D=$(D,L),!U)return D;return x8([],q,D,L,K,Q)}return X(D,L)}});function tX(Q,Y,X,W){for(let $ of Q)if($.issues.length===0)return Y.value=$.value,Y;let G=Q.filter(($)=>!X1($));if(G.length===1)return Y.value=G[0].value,G[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:X,errors:Q.map(($)=>$.issues.map((J)=>T0(J,W,w0())))}),Y}var R6=F("$ZodUnion",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"optin",()=>Y.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),m(Q._zod,"optout",()=>Y.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),m(Q._zod,"values",()=>{if(Y.options.every((G)=>G._zod.values))return new Set(Y.options.flatMap((G)=>Array.from(G._zod.values)));return}),m(Q._zod,"pattern",()=>{if(Y.options.every((G)=>G._zod.pattern)){let G=Y.options.map(($)=>$._zod.pattern);return new RegExp(`^(${G.map(($)=>d1($.source)).join("|")})$`)}return});let X=Y.options.length===1,W=Y.options[0]._zod.run;Q._zod.parse=(G,$)=>{if(X)return W(G,$);let J=!1,z=[];for(let H of Y.options){let A=H._zod.run({value:G.value,issues:[]},$);if(A instanceof Promise)z.push(A),J=!0;else{if(A.issues.length===0)return A;z.push(A)}}if(!J)return tX(z,G,Q,$);return Promise.all(z).then((H)=>{return tX(H,G,Q,$)})}}),y8=F("$ZodDiscriminatedUnion",(Q,Y)=>{R6.init(Q,Y);let X=Q._zod.parse;m(Q._zod,"propValues",()=>{let G={};for(let $ of Y.options){let J=$._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf($)}"`);for(let[z,H]of Object.entries(J)){if(!G[z])G[z]=new Set;for(let A of H)G[z].add(A)}}return G});let W=I1(()=>{let G=Y.options,$=new Map;for(let J of G){let z=J._zod.propValues?.[Y.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let H of z){if($.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);$.set(H,J)}}return $});Q._zod.parse=(G,$)=>{let J=G.value;if(!F1(J))return G.issues.push({code:"invalid_type",expected:"object",input:J,inst:Q}),G;let z=W.value.get(J?.[Y.discriminator]);if(z)return z._zod.run(G,$);if(Y.unionFallback)return X(G,$);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,input:J,path:[Y.discriminator],inst:Q}),G}}),g8=F("$ZodIntersection",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value,$=Y.left._zod.run({value:G,issues:[]},W),J=Y.right._zod.run({value:G,issues:[]},W);if($ instanceof Promise||J instanceof Promise)return Promise.all([$,J]).then(([H,A])=>{return aX(X,H,A)});return aX(X,$,J)}});function T6(Q,Y){if(Q===Y)return{valid:!0,data:Q};if(Q instanceof Date&&Y instanceof Date&&+Q===+Y)return{valid:!0,data:Q};if(Y1(Q)&&Y1(Y)){let X=Object.keys(Y),W=Object.keys(Q).filter(($)=>X.indexOf($)!==-1),G={...Q,...Y};for(let $ of W){let J=T6(Q[$],Y[$]);if(!J.valid)return{valid:!1,mergeErrorPath:[$,...J.mergeErrorPath]};G[$]=J.data}return{valid:!0,data:G}}if(Array.isArray(Q)&&Array.isArray(Y)){if(Q.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let X=[];for(let W=0;W<Q.length;W++){let G=Q[W],$=Y[W],J=T6(G,$);if(!J.valid)return{valid:!1,mergeErrorPath:[W,...J.mergeErrorPath]};X.push(J.data)}return{valid:!0,data:X}}return{valid:!1,mergeErrorPath:[]}}function aX(Q,Y,X){if(Y.issues.length)Q.issues.push(...Y.issues);if(X.issues.length)Q.issues.push(...X.issues);if(X1(Q))return Q;let W=T6(Y.value,X.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var u8=F("$ZodRecord",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{let G=X.value;if(!Y1(G))return X.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),X;let $=[];if(Y.keyType._zod.values){let J=Y.keyType._zod.values;X.value={};for(let H of J)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let A=Y.valueType._zod.run({value:G[H],issues:[]},W);if(A instanceof Promise)$.push(A.then((U)=>{if(U.issues.length)X.issues.push(...c0(H,U.issues));X.value[H]=U.value}));else{if(A.issues.length)X.issues.push(...c0(H,A.issues));X.value[H]=A.value}}let z;for(let H in G)if(!J.has(H))z=z??[],z.push(H);if(z&&z.length>0)X.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:z})}else{X.value={};for(let J of Reflect.ownKeys(G)){if(J==="__proto__")continue;let z=Y.keyType._zod.run({value:J,issues:[]},W);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(z.issues.length){X.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map((A)=>T0(A,W,w0())),input:J,path:[J],inst:Q}),X.value[z.value]=z.value;continue}let H=Y.valueType._zod.run({value:G[J],issues:[]},W);if(H instanceof Promise)$.push(H.then((A)=>{if(A.issues.length)X.issues.push(...c0(J,A.issues));X.value[z.value]=A.value}));else{if(H.issues.length)X.issues.push(...c0(J,H.issues));X.value[z.value]=H.value}}}if($.length)return Promise.all($).then(()=>X);return X}});var h8=F("$ZodEnum",(Q,Y)=>{i.init(Q,Y);let X=q6(Y.entries),W=new Set(X);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${X.filter((G)=>V6.has(typeof G)).map((G)=>typeof G==="string"?m0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,$)=>{let J=G.value;if(W.has(J))return G;return G.issues.push({code:"invalid_value",values:X,input:J,inst:Q}),G}}),f8=F("$ZodLiteral",(Q,Y)=>{if(i.init(Q,Y),Y.values.length===0)throw Error("Cannot create literal schema with no valid values");Q._zod.values=new Set(Y.values),Q._zod.pattern=new RegExp(`^(${Y.values.map((X)=>typeof X==="string"?m0(X):X?m0(X.toString()):String(X)).join("|")})$`),Q._zod.parse=(X,W)=>{let G=X.value;if(Q._zod.values.has(G))return X;return X.issues.push({code:"invalid_value",values:Y.values,input:G,inst:Q}),X}});var l8=F("$ZodTransform",(Q,Y)=>{i.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new i1(Q.constructor.name);let G=Y.transform(X.value,X);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then((J)=>{return X.value=J,X});if(G instanceof Promise)throw new l0;return X.value=G,X}});function sX(Q,Y){if(Q.issues.length&&Y===void 0)return{issues:[],value:void 0};return Q}var m8=F("$ZodOptional",(Q,Y)=>{i.init(Q,Y),Q._zod.optin="optional",Q._zod.optout="optional",m(Q._zod,"values",()=>{return Y.innerType._zod.values?new Set([...Y.innerType._zod.values,void 0]):void 0}),m(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${d1(X.source)})?$`):void 0}),Q._zod.parse=(X,W)=>{if(Y.innerType._zod.optin==="optional"){let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>sX($,X.value));return sX(G,X.value)}if(X.value===void 0)return X;return Y.innerType._zod.run(X,W)}}),c8=F("$ZodNullable",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"optin",()=>Y.innerType._zod.optin),m(Q._zod,"optout",()=>Y.innerType._zod.optout),m(Q._zod,"pattern",()=>{let X=Y.innerType._zod.pattern;return X?new RegExp(`^(${d1(X.source)}|null)$`):void 0}),m(Q._zod,"values",()=>{return Y.innerType._zod.values?new Set([...Y.innerType._zod.values,null]):void 0}),Q._zod.parse=(X,W)=>{if(X.value===null)return X;return Y.innerType._zod.run(X,W)}}),p8=F("$ZodDefault",(Q,Y)=>{i.init(Q,Y),Q._zod.optin="optional",m(Q._zod,"values",()=>Y.innerType._zod.values),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);if(X.value===void 0)return X.value=Y.defaultValue,X;let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>eX($,Y));return eX(G,Y)}});function eX(Q,Y){if(Q.value===void 0)Q.value=Y.defaultValue;return Q}var i8=F("$ZodPrefault",(Q,Y)=>{i.init(Q,Y),Q._zod.optin="optional",m(Q._zod,"values",()=>Y.innerType._zod.values),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);if(X.value===void 0)X.value=Y.defaultValue;return Y.innerType._zod.run(X,W)}}),r8=F("$ZodNonOptional",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"values",()=>{let X=Y.innerType._zod.values;return X?new Set([...X].filter((W)=>W!==void 0)):void 0}),Q._zod.parse=(X,W)=>{let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>Q8($,Q));return Q8(G,Q)}});function Q8(Q,Y){if(!Q.issues.length&&Q.value===void 0)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:Q.value,inst:Y});return Q}var n8=F("$ZodCatch",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"optin",()=>Y.innerType._zod.optin),m(Q._zod,"optout",()=>Y.innerType._zod.optout),m(Q._zod,"values",()=>Y.innerType._zod.values),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>{if(X.value=$.value,$.issues.length)X.value=Y.catchValue({...X,error:{issues:$.issues.map((J)=>T0(J,W,w0()))},input:X.value}),X.issues=[];return X});if(X.value=G.value,G.issues.length)X.value=Y.catchValue({...X,error:{issues:G.issues.map(($)=>T0($,W,w0()))},input:X.value}),X.issues=[];return X}});var d8=F("$ZodPipe",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"values",()=>Y.in._zod.values),m(Q._zod,"optin",()=>Y.in._zod.optin),m(Q._zod,"optout",()=>Y.out._zod.optout),m(Q._zod,"propValues",()=>Y.in._zod.propValues),Q._zod.parse=(X,W)=>{if(W.direction==="backward"){let $=Y.out._zod.run(X,W);if($ instanceof Promise)return $.then((J)=>s4(J,Y.in,W));return s4($,Y.in,W)}let G=Y.in._zod.run(X,W);if(G instanceof Promise)return G.then(($)=>s4($,Y.out,W));return s4(G,Y.out,W)}});function s4(Q,Y,X){if(Q.issues.length)return Q.aborted=!0,Q;return Y._zod.run({value:Q.value,issues:Q.issues},X)}var o8=F("$ZodReadonly",(Q,Y)=>{i.init(Q,Y),m(Q._zod,"propValues",()=>Y.innerType._zod.propValues),m(Q._zod,"values",()=>Y.innerType._zod.values),m(Q._zod,"optin",()=>Y.innerType._zod.optin),m(Q._zod,"optout",()=>Y.innerType._zod.optout),Q._zod.parse=(X,W)=>{if(W.direction==="backward")return Y.innerType._zod.run(X,W);let G=Y.innerType._zod.run(X,W);if(G instanceof Promise)return G.then(Y8);return Y8(G)}});function Y8(Q){return Q.value=Object.freeze(Q.value),Q}var t8=F("$ZodCustom",(Q,Y)=>{W0.init(Q,Y),i.init(Q,Y),Q._zod.parse=(X,W)=>{return X},Q._zod.check=(X)=>{let W=X.value,G=Y.fn(W);if(G instanceof Promise)return G.then(($)=>X8($,X,W,Q));X8(G,X,W,Q);return}});function X8(Q,Y,X,W){if(!Q){let G={code:"custom",input:X,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)G.params=W._zod.def.params;Y.issues.push(j1(G))}}var VH=(Q)=>{let Y=typeof Q;switch(Y){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 Y},NH=()=>{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 Y(W){return Q[W]??null}let X={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 ${VH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${r4(W.values[0])}`;return`Invalid option: expected one of ${c4(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",$=Y(W.origin);if($)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${$.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",$=Y(W.origin);if($)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${$.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 ${X[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":""}: ${c4(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 C6(){return{localeError:NH()}}var sM=Symbol("ZodOutput"),eM=Symbol("ZodInput");class a8{constructor(){this._map=new WeakMap,this._idmap=new Map}add(Q,...Y){let X=Y[0];if(this._map.set(Q,X),X&&typeof X==="object"&&"id"in X){if(this._idmap.has(X.id))throw Error(`ID ${X.id} already exists in the registry`);this._idmap.set(X.id,Q)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(Q){let Y=this._map.get(Q);if(Y&&typeof Y==="object"&&"id"in Y)this._idmap.delete(Y.id);return this._map.delete(Q),this}get(Q){let Y=Q._zod.parent;if(Y){let X={...this.get(Y)??{}};delete X.id;let W={...X,...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 ZH(){return new a8}var Q4=ZH();function s8(Q,Y){return new Q({type:"string",...j(Y)})}function e8(Q,Y){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...j(Y)})}function k6(Q,Y){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...j(Y)})}function QW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...j(Y)})}function YW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...j(Y)})}function XW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...j(Y)})}function WW(Q,Y){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...j(Y)})}function GW(Q,Y){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...j(Y)})}function $W(Q,Y){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...j(Y)})}function JW(Q,Y){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...j(Y)})}function zW(Q,Y){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...j(Y)})}function HW(Q,Y){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...j(Y)})}function AW(Q,Y){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...j(Y)})}function UW(Q,Y){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...j(Y)})}function KW(Q,Y){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...j(Y)})}function DW(Q,Y){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...j(Y)})}function BW(Q,Y){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...j(Y)})}function LW(Q,Y){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...j(Y)})}function FW(Q,Y){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...j(Y)})}function qW(Q,Y){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...j(Y)})}function OW(Q,Y){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...j(Y)})}function MW(Q,Y){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...j(Y)})}function VW(Q,Y){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...j(Y)})}function NW(Q,Y){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...j(Y)})}function ZW(Q,Y){return new Q({type:"string",format:"date",check:"string_format",...j(Y)})}function wW(Q,Y){return new Q({type:"string",format:"time",check:"string_format",precision:null,...j(Y)})}function bW(Q,Y){return new Q({type:"string",format:"duration",check:"string_format",...j(Y)})}function PW(Q,Y){return new Q({type:"number",checks:[],...j(Y)})}function IW(Q,Y){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...j(Y)})}function jW(Q,Y){return new Q({type:"boolean",...j(Y)})}function EW(Q,Y){return new Q({type:"null",...j(Y)})}function TW(Q){return new Q({type:"unknown"})}function SW(Q,Y){return new Q({type:"never",...j(Y)})}function YQ(Q,Y){return new I6({check:"less_than",...j(Y),value:Q,inclusive:!1})}function Y4(Q,Y){return new I6({check:"less_than",...j(Y),value:Q,inclusive:!0})}function XQ(Q,Y){return new j6({check:"greater_than",...j(Y),value:Q,inclusive:!1})}function X4(Q,Y){return new j6({check:"greater_than",...j(Y),value:Q,inclusive:!0})}function WQ(Q,Y){return new _X({check:"multiple_of",...j(Y),value:Q})}function GQ(Q,Y){return new gX({check:"max_length",...j(Y),maximum:Q})}function E1(Q,Y){return new uX({check:"min_length",...j(Y),minimum:Q})}function $Q(Q,Y){return new hX({check:"length_equals",...j(Y),length:Q})}function v6(Q,Y){return new fX({check:"string_format",format:"regex",...j(Y),pattern:Q})}function x6(Q){return new lX({check:"string_format",format:"lowercase",...j(Q)})}function _6(Q){return new mX({check:"string_format",format:"uppercase",...j(Q)})}function y6(Q,Y){return new cX({check:"string_format",format:"includes",...j(Y),includes:Q})}function g6(Q,Y){return new pX({check:"string_format",format:"starts_with",...j(Y),prefix:Q})}function u6(Q,Y){return new iX({check:"string_format",format:"ends_with",...j(Y),suffix:Q})}function q1(Q){return new rX({check:"overwrite",tx:Q})}function h6(Q){return q1((Y)=>Y.normalize(Q))}function f6(){return q1((Q)=>Q.trim())}function l6(){return q1((Q)=>Q.toLowerCase())}function m6(){return q1((Q)=>Q.toUpperCase())}function RW(Q,Y,X){return new Q({type:"array",element:Y,...j(X)})}function CW(Q,Y,X){let W=j(X);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:Y,...W})}function kW(Q,Y,X){return new Q({type:"custom",check:"custom",fn:Y,...j(X)})}function vW(Q){let Y=wH((X)=>{return X.addIssue=(W)=>{if(typeof W==="string")X.issues.push(j1(W,X.value,Y._zod.def));else{let G=W;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=X.value),G.inst??(G.inst=Y),G.continue??(G.continue=!Y._zod.def.abort),X.issues.push(j1(G))}},Q(X.value,X)});return Y}function wH(Q,Y){let X=new W0({check:"custom",...j(Y)});return X._zod.check=Q,X}function T1(Q){return!!Q._zod}function W1(Q,Y){if(T1(Q))return a1(Q,Y);return Q.safeParse(Y)}function JQ(Q){if(!Q)return;let Y;if(T1(Q))Y=Q._zod?.def?.shape;else Y=Q.shape;if(!Y)return;if(typeof Y==="function")try{return Y()}catch{return}return Y}function xW(Q){if(T1(Q)){let $=Q._zod?.def;if($){if($.value!==void 0)return $.value;if(Array.isArray($.values)&&$.values.length>0)return $.values[0]}}let X=Q._def;if(X){if(X.value!==void 0)return X.value;if(Array.isArray(X.values)&&X.values.length>0)return X.values[0]}let W=Q.value;if(W!==void 0)return W;return}var G4={};y9(G4,{time:()=>i6,duration:()=>r6,datetime:()=>c6,date:()=>p6,ZodISOTime:()=>gW,ZodISODuration:()=>uW,ZodISODateTime:()=>_W,ZodISODate:()=>yW});var _W=F("ZodISODateTime",(Q,Y)=>{L8.init(Q,Y),d.init(Q,Y)});function c6(Q){return NW(_W,Q)}var yW=F("ZodISODate",(Q,Y)=>{F8.init(Q,Y),d.init(Q,Y)});function p6(Q){return ZW(yW,Q)}var gW=F("ZodISOTime",(Q,Y)=>{q8.init(Q,Y),d.init(Q,Y)});function i6(Q){return wW(gW,Q)}var uW=F("ZodISODuration",(Q,Y)=>{O8.init(Q,Y),d.init(Q,Y)});function r6(Q){return bW(uW,Q)}var hW=(Q,Y)=>{n4.init(Q,Y),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(X)=>t9(Q,X)},flatten:{value:(X)=>o9(Q,X)},addIssue:{value:(X)=>{Q.issues.push(X),Q.message=JSON.stringify(Q.issues,P1,2)}},addIssues:{value:(X)=>{Q.issues.push(...X),Q.message=JSON.stringify(Q.issues,P1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},uV=F("ZodError",hW),N0=F("ZodError",hW,{Parent:Error});var fW=d4(N0),lW=o4(N0),mW=t1(N0),cW=s1(N0),pW=a9(N0),iW=s9(N0),rW=e9(N0),nW=QX(N0),dW=YX(N0),oW=XX(N0),tW=WX(N0),aW=GX(N0);var s=F("ZodType",(Q,Y)=>{return i.init(Q,Y),Q.def=Y,Q.type=Y.type,Object.defineProperty(Q,"_def",{value:Y}),Q.check=(...X)=>{return Q.clone(h.mergeDefs(Y,{checks:[...Y.checks??[],...X.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(X,W)=>E0(Q,X,W),Q.brand=()=>Q,Q.register=(X,W)=>{return X.add(Q,W),Q},Q.parse=(X,W)=>fW(Q,X,W,{callee:Q.parse}),Q.safeParse=(X,W)=>mW(Q,X,W),Q.parseAsync=async(X,W)=>lW(Q,X,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(X,W)=>cW(Q,X,W),Q.spa=Q.safeParseAsync,Q.encode=(X,W)=>pW(Q,X,W),Q.decode=(X,W)=>iW(Q,X,W),Q.encodeAsync=async(X,W)=>rW(Q,X,W),Q.decodeAsync=async(X,W)=>nW(Q,X,W),Q.safeEncode=(X,W)=>dW(Q,X,W),Q.safeDecode=(X,W)=>oW(Q,X,W),Q.safeEncodeAsync=async(X,W)=>tW(Q,X,W),Q.safeDecodeAsync=async(X,W)=>aW(Q,X,W),Q.refine=(X,W)=>Q.check(MA(X,W)),Q.superRefine=(X)=>Q.check(VA(X)),Q.overwrite=(X)=>Q.check(q1(X)),Q.optional=()=>a(Q),Q.nullable=()=>QG(Q),Q.nullish=()=>a(QG(Q)),Q.nonoptional=(X)=>DA(Q,X),Q.array=()=>_(Q),Q.or=(X)=>p([Q,X]),Q.and=(X)=>HQ(Q,X),Q.transform=(X)=>d6(Q,$G(X)),Q.default=(X)=>AA(Q,X),Q.prefault=(X)=>KA(Q,X),Q.catch=(X)=>LA(Q,X),Q.pipe=(X)=>d6(Q,X),Q.readonly=()=>OA(Q),Q.describe=(X)=>{let W=Q.clone();return Q4.add(W,{description:X}),W},Object.defineProperty(Q,"description",{get(){return Q4.get(Q)?.description},configurable:!0}),Q.meta=(...X)=>{if(X.length===0)return Q4.get(Q);let W=Q.clone();return Q4.add(W,X[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),YG=F("_ZodString",(Q,Y)=>{QQ.init(Q,Y),s.init(Q,Y);let X=Q._zod.bag;Q.format=X.format??null,Q.minLength=X.minimum??null,Q.maxLength=X.maximum??null,Q.regex=(...W)=>Q.check(v6(...W)),Q.includes=(...W)=>Q.check(y6(...W)),Q.startsWith=(...W)=>Q.check(g6(...W)),Q.endsWith=(...W)=>Q.check(u6(...W)),Q.min=(...W)=>Q.check(E1(...W)),Q.max=(...W)=>Q.check(GQ(...W)),Q.length=(...W)=>Q.check($Q(...W)),Q.nonempty=(...W)=>Q.check(E1(1,...W)),Q.lowercase=(W)=>Q.check(x6(W)),Q.uppercase=(W)=>Q.check(_6(W)),Q.trim=()=>Q.check(f6()),Q.normalize=(...W)=>Q.check(h6(...W)),Q.toLowerCase=()=>Q.check(l6()),Q.toUpperCase=()=>Q.check(m6())}),CH=F("ZodString",(Q,Y)=>{QQ.init(Q,Y),YG.init(Q,Y),Q.email=(X)=>Q.check(e8(kH,X)),Q.url=(X)=>Q.check(GW(vH,X)),Q.jwt=(X)=>Q.check(VW(dH,X)),Q.emoji=(X)=>Q.check($W(xH,X)),Q.guid=(X)=>Q.check(k6(sW,X)),Q.uuid=(X)=>Q.check(QW(zQ,X)),Q.uuidv4=(X)=>Q.check(YW(zQ,X)),Q.uuidv6=(X)=>Q.check(XW(zQ,X)),Q.uuidv7=(X)=>Q.check(WW(zQ,X)),Q.nanoid=(X)=>Q.check(JW(_H,X)),Q.guid=(X)=>Q.check(k6(sW,X)),Q.cuid=(X)=>Q.check(zW(yH,X)),Q.cuid2=(X)=>Q.check(HW(gH,X)),Q.ulid=(X)=>Q.check(AW(uH,X)),Q.base64=(X)=>Q.check(qW(iH,X)),Q.base64url=(X)=>Q.check(OW(rH,X)),Q.xid=(X)=>Q.check(UW(hH,X)),Q.ksuid=(X)=>Q.check(KW(fH,X)),Q.ipv4=(X)=>Q.check(DW(lH,X)),Q.ipv6=(X)=>Q.check(BW(mH,X)),Q.cidrv4=(X)=>Q.check(LW(cH,X)),Q.cidrv6=(X)=>Q.check(FW(pH,X)),Q.e164=(X)=>Q.check(MW(nH,X)),Q.datetime=(X)=>Q.check(c6(X)),Q.date=(X)=>Q.check(p6(X)),Q.time=(X)=>Q.check(i6(X)),Q.duration=(X)=>Q.check(r6(X))});function B(Q){return s8(CH,Q)}var d=F("ZodStringFormat",(Q,Y)=>{r.init(Q,Y),YG.init(Q,Y)}),kH=F("ZodEmail",(Q,Y)=>{$8.init(Q,Y),d.init(Q,Y)});var sW=F("ZodGUID",(Q,Y)=>{W8.init(Q,Y),d.init(Q,Y)});var zQ=F("ZodUUID",(Q,Y)=>{G8.init(Q,Y),d.init(Q,Y)});var vH=F("ZodURL",(Q,Y)=>{J8.init(Q,Y),d.init(Q,Y)});var xH=F("ZodEmoji",(Q,Y)=>{z8.init(Q,Y),d.init(Q,Y)});var _H=F("ZodNanoID",(Q,Y)=>{H8.init(Q,Y),d.init(Q,Y)});var yH=F("ZodCUID",(Q,Y)=>{A8.init(Q,Y),d.init(Q,Y)});var gH=F("ZodCUID2",(Q,Y)=>{U8.init(Q,Y),d.init(Q,Y)});var uH=F("ZodULID",(Q,Y)=>{K8.init(Q,Y),d.init(Q,Y)});var hH=F("ZodXID",(Q,Y)=>{D8.init(Q,Y),d.init(Q,Y)});var fH=F("ZodKSUID",(Q,Y)=>{B8.init(Q,Y),d.init(Q,Y)});var lH=F("ZodIPv4",(Q,Y)=>{M8.init(Q,Y),d.init(Q,Y)});var mH=F("ZodIPv6",(Q,Y)=>{V8.init(Q,Y),d.init(Q,Y)});var cH=F("ZodCIDRv4",(Q,Y)=>{N8.init(Q,Y),d.init(Q,Y)});var pH=F("ZodCIDRv6",(Q,Y)=>{Z8.init(Q,Y),d.init(Q,Y)});var iH=F("ZodBase64",(Q,Y)=>{b8.init(Q,Y),d.init(Q,Y)});var rH=F("ZodBase64URL",(Q,Y)=>{P8.init(Q,Y),d.init(Q,Y)});var nH=F("ZodE164",(Q,Y)=>{I8.init(Q,Y),d.init(Q,Y)});var dH=F("ZodJWT",(Q,Y)=>{j8.init(Q,Y),d.init(Q,Y)});var XG=F("ZodNumber",(Q,Y)=>{S6.init(Q,Y),s.init(Q,Y),Q.gt=(W,G)=>Q.check(XQ(W,G)),Q.gte=(W,G)=>Q.check(X4(W,G)),Q.min=(W,G)=>Q.check(X4(W,G)),Q.lt=(W,G)=>Q.check(YQ(W,G)),Q.lte=(W,G)=>Q.check(Y4(W,G)),Q.max=(W,G)=>Q.check(Y4(W,G)),Q.int=(W)=>Q.check(eW(W)),Q.safe=(W)=>Q.check(eW(W)),Q.positive=(W)=>Q.check(XQ(0,W)),Q.nonnegative=(W)=>Q.check(X4(0,W)),Q.negative=(W)=>Q.check(YQ(0,W)),Q.nonpositive=(W)=>Q.check(Y4(0,W)),Q.multipleOf=(W,G)=>Q.check(WQ(W,G)),Q.step=(W,G)=>Q.check(WQ(W,G)),Q.finite=()=>Q;let X=Q._zod.bag;Q.minValue=Math.max(X.minimum??Number.NEGATIVE_INFINITY,X.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(X.maximum??Number.POSITIVE_INFINITY,X.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(X.format??"").includes("int")||Number.isSafeInteger(X.multipleOf??0.5),Q.isFinite=!0,Q.format=X.format??null});function l(Q){return PW(XG,Q)}var oH=F("ZodNumberFormat",(Q,Y)=>{E8.init(Q,Y),XG.init(Q,Y)});function eW(Q){return IW(oH,Q)}var tH=F("ZodBoolean",(Q,Y)=>{T8.init(Q,Y),s.init(Q,Y)});function X0(Q){return jW(tH,Q)}var aH=F("ZodNull",(Q,Y)=>{S8.init(Q,Y),s.init(Q,Y)});function o6(Q){return EW(aH,Q)}var sH=F("ZodUnknown",(Q,Y)=>{R8.init(Q,Y),s.init(Q,Y)});function o(){return TW(sH)}var eH=F("ZodNever",(Q,Y)=>{C8.init(Q,Y),s.init(Q,Y)});function QA(Q){return SW(eH,Q)}var YA=F("ZodArray",(Q,Y)=>{k8.init(Q,Y),s.init(Q,Y),Q.element=Y.element,Q.min=(X,W)=>Q.check(E1(X,W)),Q.nonempty=(X)=>Q.check(E1(1,X)),Q.max=(X,W)=>Q.check(GQ(X,W)),Q.length=(X,W)=>Q.check($Q(X,W)),Q.unwrap=()=>Q.element});function _(Q,Y){return RW(YA,Q,Y)}var WG=F("ZodObject",(Q,Y)=>{_8.init(Q,Y),s.init(Q,Y),h.defineLazy(Q,"shape",()=>{return Y.shape}),Q.keyof=()=>L0(Object.keys(Q._zod.def.shape)),Q.catchall=(X)=>Q.clone({...Q._zod.def,catchall:X}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:QA()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(X)=>{return h.extend(Q,X)},Q.safeExtend=(X)=>{return h.safeExtend(Q,X)},Q.merge=(X)=>h.merge(Q,X),Q.pick=(X)=>h.pick(Q,X),Q.omit=(X)=>h.omit(Q,X),Q.partial=(...X)=>h.partial(JG,Q,X[0]),Q.required=(...X)=>h.required(zG,Q,X[0])});function w(Q,Y){let X={type:"object",shape:Q??{},...h.normalizeParams(Y)};return new WG(X)}function U0(Q,Y){return new WG({type:"object",shape:Q,catchall:o(),...h.normalizeParams(Y)})}var GG=F("ZodUnion",(Q,Y)=>{R6.init(Q,Y),s.init(Q,Y),Q.options=Y.options});function p(Q,Y){return new GG({type:"union",options:Q,...h.normalizeParams(Y)})}var XA=F("ZodDiscriminatedUnion",(Q,Y)=>{GG.init(Q,Y),y8.init(Q,Y)});function t6(Q,Y,X){return new XA({type:"union",options:Y,discriminator:Q,...h.normalizeParams(X)})}var WA=F("ZodIntersection",(Q,Y)=>{g8.init(Q,Y),s.init(Q,Y)});function HQ(Q,Y){return new WA({type:"intersection",left:Q,right:Y})}var GA=F("ZodRecord",(Q,Y)=>{u8.init(Q,Y),s.init(Q,Y),Q.keyType=Y.keyType,Q.valueType=Y.valueType});function t(Q,Y,X){return new GA({type:"record",keyType:Q,valueType:Y,...h.normalizeParams(X)})}var n6=F("ZodEnum",(Q,Y)=>{h8.init(Q,Y),s.init(Q,Y),Q.enum=Y.entries,Q.options=Object.values(Y.entries);let X=new Set(Object.keys(Y.entries));Q.extract=(W,G)=>{let $={};for(let J of W)if(X.has(J))$[J]=Y.entries[J];else throw Error(`Key ${J} not found in enum`);return new n6({...Y,checks:[],...h.normalizeParams(G),entries:$})},Q.exclude=(W,G)=>{let $={...Y.entries};for(let J of W)if(X.has(J))delete $[J];else throw Error(`Key ${J} not found in enum`);return new n6({...Y,checks:[],...h.normalizeParams(G),entries:$})}});function L0(Q,Y){let X=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new n6({type:"enum",entries:X,...h.normalizeParams(Y)})}var $A=F("ZodLiteral",(Q,Y)=>{f8.init(Q,Y),s.init(Q,Y),Q.values=new Set(Y.values),Object.defineProperty(Q,"value",{get(){if(Y.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Y.values[0]}})});function b(Q,Y){return new $A({type:"literal",values:Array.isArray(Q)?Q:[Q],...h.normalizeParams(Y)})}var JA=F("ZodTransform",(Q,Y)=>{l8.init(Q,Y),s.init(Q,Y),Q._zod.parse=(X,W)=>{if(W.direction==="backward")throw new i1(Q.constructor.name);X.addIssue=($)=>{if(typeof $==="string")X.issues.push(h.issue($,X.value,Y));else{let J=$;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=X.value),J.inst??(J.inst=Q),X.issues.push(h.issue(J))}};let G=Y.transform(X.value,X);if(G instanceof Promise)return G.then(($)=>{return X.value=$,X});return X.value=G,X}});function $G(Q){return new JA({type:"transform",transform:Q})}var JG=F("ZodOptional",(Q,Y)=>{m8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function a(Q){return new JG({type:"optional",innerType:Q})}var zA=F("ZodNullable",(Q,Y)=>{c8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function QG(Q){return new zA({type:"nullable",innerType:Q})}var HA=F("ZodDefault",(Q,Y)=>{p8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function AA(Q,Y){return new HA({type:"default",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():h.shallowClone(Y)}})}var UA=F("ZodPrefault",(Q,Y)=>{i8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function KA(Q,Y){return new UA({type:"prefault",innerType:Q,get defaultValue(){return typeof Y==="function"?Y():h.shallowClone(Y)}})}var zG=F("ZodNonOptional",(Q,Y)=>{r8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function DA(Q,Y){return new zG({type:"nonoptional",innerType:Q,...h.normalizeParams(Y)})}var BA=F("ZodCatch",(Q,Y)=>{n8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function LA(Q,Y){return new BA({type:"catch",innerType:Q,catchValue:typeof Y==="function"?Y:()=>Y})}var FA=F("ZodPipe",(Q,Y)=>{d8.init(Q,Y),s.init(Q,Y),Q.in=Y.in,Q.out=Y.out});function d6(Q,Y){return new FA({type:"pipe",in:Q,out:Y})}var qA=F("ZodReadonly",(Q,Y)=>{o8.init(Q,Y),s.init(Q,Y),Q.unwrap=()=>Q._zod.def.innerType});function OA(Q){return new qA({type:"readonly",innerType:Q})}var HG=F("ZodCustom",(Q,Y)=>{t8.init(Q,Y),s.init(Q,Y)});function AG(Q,Y){return CW(HG,Q??(()=>!0),Y)}function MA(Q,Y={}){return kW(HG,Q,Y)}function VA(Q){return vW(Q)}function a6(Q,Y){return d6($G(Q),Y)}w0(C6());var s6="2025-11-25";var UG=[s6,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],G1="io.modelcontextprotocol/related-task",UQ="2.0",G0=AG((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),KG=p([B(),l().int()]),DG=B(),vN=U0({ttl:p([l(),o6()]).optional(),pollInterval:l().optional()}),NA=w({ttl:l().optional()}),ZA=w({taskId:B()}),e6=U0({progressToken:KG.optional(),[G1]:ZA.optional()}),Z0=w({_meta:e6.optional()}),$4=Z0.extend({task:NA.optional()}),BG=(Q)=>$4.safeParse(Q).success,$0=w({method:B(),params:Z0.loose().optional()}),b0=w({_meta:e6.optional()}),P0=w({method:B(),params:b0.loose().optional()}),J0=U0({_meta:e6.optional()}),KQ=p([B(),l().int()]),LG=w({jsonrpc:b(UQ),id:KQ,...$0.shape}).strict(),QY=(Q)=>LG.safeParse(Q).success,FG=w({jsonrpc:b(UQ),...P0.shape}).strict(),qG=(Q)=>FG.safeParse(Q).success,YY=w({jsonrpc:b(UQ),id:KQ,result:J0}).strict(),J4=(Q)=>YY.safeParse(Q).success;var y;(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"})(y||(y={}));var XY=w({jsonrpc:b(UQ),id:KQ.optional(),error:w({code:l().int(),message:B(),data:o().optional()})}).strict();var OG=(Q)=>XY.safeParse(Q).success;var MG=p([LG,FG,YY,XY]),xN=p([YY,XY]),DQ=J0.strict(),wA=b0.extend({requestId:KQ.optional(),reason:B().optional()}),BQ=P0.extend({method:b("notifications/cancelled"),params:wA}),bA=w({src:B(),mimeType:B().optional(),sizes:_(B()).optional(),theme:L0(["light","dark"]).optional()}),z4=w({icons:_(bA).optional()}),S1=w({name:B(),title:B().optional()}),VG=S1.extend({...S1.shape,...z4.shape,version:B(),websiteUrl:B().optional(),description:B().optional()}),PA=HQ(w({applyDefaults:X0().optional()}),t(B(),o())),IA=a6((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},HQ(w({form:PA.optional(),url:G0.optional()}),t(B(),o()).optional())),jA=U0({list:G0.optional(),cancel:G0.optional(),requests:U0({sampling:U0({createMessage:G0.optional()}).optional(),elicitation:U0({create:G0.optional()}).optional()}).optional()}),EA=U0({list:G0.optional(),cancel:G0.optional(),requests:U0({tools:U0({call:G0.optional()}).optional()}).optional()}),TA=w({experimental:t(B(),G0).optional(),sampling:w({context:G0.optional(),tools:G0.optional()}).optional(),elicitation:IA.optional(),roots:w({listChanged:X0().optional()}).optional(),tasks:jA.optional()}),SA=Z0.extend({protocolVersion:B(),capabilities:TA,clientInfo:VG}),WY=$0.extend({method:b("initialize"),params:SA});var RA=w({experimental:t(B(),G0).optional(),logging:G0.optional(),completions:G0.optional(),prompts:w({listChanged:X0().optional()}).optional(),resources:w({subscribe:X0().optional(),listChanged:X0().optional()}).optional(),tools:w({listChanged:X0().optional()}).optional(),tasks:EA.optional()}),CA=J0.extend({protocolVersion:B(),capabilities:RA,serverInfo:VG,instructions:B().optional()}),GY=P0.extend({method:b("notifications/initialized"),params:b0.optional()});var LQ=$0.extend({method:b("ping"),params:Z0.optional()}),kA=w({progress:l(),total:a(l()),message:a(B())}),vA=w({...b0.shape,...kA.shape,progressToken:KG}),FQ=P0.extend({method:b("notifications/progress"),params:vA}),xA=Z0.extend({cursor:DG.optional()}),H4=$0.extend({params:xA.optional()}),A4=J0.extend({nextCursor:DG.optional()}),_A=L0(["working","input_required","completed","failed","cancelled"]),U4=w({taskId:B(),status:_A,ttl:p([l(),o6()]),createdAt:B(),lastUpdatedAt:B(),pollInterval:a(l()),statusMessage:a(B())}),R1=J0.extend({task:U4}),yA=b0.merge(U4),K4=P0.extend({method:b("notifications/tasks/status"),params:yA}),qQ=$0.extend({method:b("tasks/get"),params:Z0.extend({taskId:B()})}),OQ=J0.merge(U4),MQ=$0.extend({method:b("tasks/result"),params:Z0.extend({taskId:B()})}),_N=J0.loose(),VQ=H4.extend({method:b("tasks/list")}),NQ=A4.extend({tasks:_(U4)}),ZQ=$0.extend({method:b("tasks/cancel"),params:Z0.extend({taskId:B()})}),NG=J0.merge(U4),ZG=w({uri:B(),mimeType:a(B()),_meta:t(B(),o()).optional()}),wG=ZG.extend({text:B()}),$Y=B().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),bG=ZG.extend({blob:$Y}),D4=L0(["user","assistant"]),C1=w({audience:_(D4).optional(),priority:l().min(0).max(1).optional(),lastModified:G4.datetime({offset:!0}).optional()}),PG=w({...S1.shape,...z4.shape,uri:B(),description:a(B()),mimeType:a(B()),annotations:C1.optional(),_meta:a(U0({}))}),gA=w({...S1.shape,...z4.shape,uriTemplate:B(),description:a(B()),mimeType:a(B()),annotations:C1.optional(),_meta:a(U0({}))}),JY=H4.extend({method:b("resources/list")}),uA=A4.extend({resources:_(PG)}),hA=H4.extend({method:b("resources/templates/list")}),fA=A4.extend({resourceTemplates:_(gA)}),zY=Z0.extend({uri:B()}),lA=zY,HY=$0.extend({method:b("resources/read"),params:lA}),mA=J0.extend({contents:_(p([wG,bG]))}),cA=P0.extend({method:b("notifications/resources/list_changed"),params:b0.optional()}),pA=zY,iA=$0.extend({method:b("resources/subscribe"),params:pA}),rA=zY,nA=$0.extend({method:b("resources/unsubscribe"),params:rA}),dA=b0.extend({uri:B()}),oA=P0.extend({method:b("notifications/resources/updated"),params:dA}),tA=w({name:B(),description:a(B()),required:a(X0())}),aA=w({...S1.shape,...z4.shape,description:a(B()),arguments:a(_(tA)),_meta:a(U0({}))}),sA=H4.extend({method:b("prompts/list")}),eA=A4.extend({prompts:_(aA)}),QU=Z0.extend({name:B(),arguments:t(B(),B()).optional()}),YU=$0.extend({method:b("prompts/get"),params:QU}),AY=w({type:b("text"),text:B(),annotations:C1.optional(),_meta:t(B(),o()).optional()}),UY=w({type:b("image"),data:$Y,mimeType:B(),annotations:C1.optional(),_meta:t(B(),o()).optional()}),KY=w({type:b("audio"),data:$Y,mimeType:B(),annotations:C1.optional(),_meta:t(B(),o()).optional()}),XU=w({type:b("tool_use"),name:B(),id:B(),input:t(B(),o()),_meta:t(B(),o()).optional()}),WU=w({type:b("resource"),resource:p([wG,bG]),annotations:C1.optional(),_meta:t(B(),o()).optional()}),GU=PG.extend({type:b("resource_link")}),DY=p([AY,UY,KY,GU,WU]),$U=w({role:D4,content:DY}),JU=J0.extend({description:B().optional(),messages:_($U)}),zU=P0.extend({method:b("notifications/prompts/list_changed"),params:b0.optional()}),HU=w({title:B().optional(),readOnlyHint:X0().optional(),destructiveHint:X0().optional(),idempotentHint:X0().optional(),openWorldHint:X0().optional()}),AU=w({taskSupport:L0(["required","optional","forbidden"]).optional()}),IG=w({...S1.shape,...z4.shape,description:B().optional(),inputSchema:w({type:b("object"),properties:t(B(),G0).optional(),required:_(B()).optional()}).catchall(o()),outputSchema:w({type:b("object"),properties:t(B(),G0).optional(),required:_(B()).optional()}).catchall(o()).optional(),annotations:HU.optional(),execution:AU.optional(),_meta:t(B(),o()).optional()}),BY=H4.extend({method:b("tools/list")}),UU=A4.extend({tools:_(IG)}),wQ=J0.extend({content:_(DY).default([]),structuredContent:t(B(),o()).optional(),isError:X0().optional()}),yN=wQ.or(J0.extend({toolResult:o()})),KU=$4.extend({name:B(),arguments:t(B(),o()).optional()}),B4=$0.extend({method:b("tools/call"),params:KU}),DU=P0.extend({method:b("notifications/tools/list_changed"),params:b0.optional()}),gN=w({autoRefresh:X0().default(!0),debounceMs:l().int().nonnegative().default(300)}),L4=L0(["debug","info","notice","warning","error","critical","alert","emergency"]),BU=Z0.extend({level:L4}),LY=$0.extend({method:b("logging/setLevel"),params:BU}),LU=b0.extend({level:L4,logger:B().optional(),data:o()}),FU=P0.extend({method:b("notifications/message"),params:LU}),qU=w({name:B().optional()}),OU=w({hints:_(qU).optional(),costPriority:l().min(0).max(1).optional(),speedPriority:l().min(0).max(1).optional(),intelligencePriority:l().min(0).max(1).optional()}),MU=w({mode:L0(["auto","required","none"]).optional()}),VU=w({type:b("tool_result"),toolUseId:B().describe("The unique identifier for the corresponding tool call."),content:_(DY).default([]),structuredContent:w({}).loose().optional(),isError:X0().optional(),_meta:t(B(),o()).optional()}),NU=t6("type",[AY,UY,KY]),AQ=t6("type",[AY,UY,KY,XU,VU]),ZU=w({role:D4,content:p([AQ,_(AQ)]),_meta:t(B(),o()).optional()}),wU=$4.extend({messages:_(ZU),modelPreferences:OU.optional(),systemPrompt:B().optional(),includeContext:L0(["none","thisServer","allServers"]).optional(),temperature:l().optional(),maxTokens:l().int(),stopSequences:_(B()).optional(),metadata:G0.optional(),tools:_(IG).optional(),toolChoice:MU.optional()}),bU=$0.extend({method:b("sampling/createMessage"),params:wU}),FY=J0.extend({model:B(),stopReason:a(L0(["endTurn","stopSequence","maxTokens"]).or(B())),role:D4,content:NU}),qY=J0.extend({model:B(),stopReason:a(L0(["endTurn","stopSequence","maxTokens","toolUse"]).or(B())),role:D4,content:p([AQ,_(AQ)])}),PU=w({type:b("boolean"),title:B().optional(),description:B().optional(),default:X0().optional()}),IU=w({type:b("string"),title:B().optional(),description:B().optional(),minLength:l().optional(),maxLength:l().optional(),format:L0(["email","uri","date","date-time"]).optional(),default:B().optional()}),jU=w({type:L0(["number","integer"]),title:B().optional(),description:B().optional(),minimum:l().optional(),maximum:l().optional(),default:l().optional()}),EU=w({type:b("string"),title:B().optional(),description:B().optional(),enum:_(B()),default:B().optional()}),TU=w({type:b("string"),title:B().optional(),description:B().optional(),oneOf:_(w({const:B(),title:B()})),default:B().optional()}),SU=w({type:b("string"),title:B().optional(),description:B().optional(),enum:_(B()),enumNames:_(B()).optional(),default:B().optional()}),RU=p([EU,TU]),CU=w({type:b("array"),title:B().optional(),description:B().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({type:b("string"),enum:_(B())}),default:_(B()).optional()}),kU=w({type:b("array"),title:B().optional(),description:B().optional(),minItems:l().optional(),maxItems:l().optional(),items:w({anyOf:_(w({const:B(),title:B()}))}),default:_(B()).optional()}),vU=p([CU,kU]),xU=p([SU,RU,vU]),_U=p([xU,PU,IU,jU]),yU=$4.extend({mode:b("form").optional(),message:B(),requestedSchema:w({type:b("object"),properties:t(B(),_U),required:_(B()).optional()})}),gU=$4.extend({mode:b("url"),message:B(),elicitationId:B(),url:B().url()}),uU=p([yU,gU]),hU=$0.extend({method:b("elicitation/create"),params:uU}),fU=b0.extend({elicitationId:B()}),lU=P0.extend({method:b("notifications/elicitation/complete"),params:fU}),bQ=J0.extend({action:L0(["accept","decline","cancel"]),content:a6((Q)=>Q===null?void 0:Q,t(B(),p([B(),l(),X0(),_(B())])).optional())}),mU=w({type:b("ref/resource"),uri:B()});var cU=w({type:b("ref/prompt"),name:B()}),pU=Z0.extend({ref:p([cU,mU]),argument:w({name:B(),value:B()}),context:w({arguments:t(B(),B()).optional()}).optional()}),iU=$0.extend({method:b("completion/complete"),params:pU});var rU=J0.extend({completion:U0({values:_(B()).max(100),total:a(l().int()),hasMore:a(X0())})}),nU=w({uri:B().startsWith("file://"),name:B().optional(),_meta:t(B(),o()).optional()}),dU=$0.extend({method:b("roots/list"),params:Z0.optional()}),OY=J0.extend({roots:_(nU)}),oU=P0.extend({method:b("notifications/roots/list_changed"),params:b0.optional()}),uN=p([LQ,WY,iU,LY,YU,sA,JY,hA,HY,iA,nA,B4,BY,qQ,MQ,VQ,ZQ]),hN=p([BQ,FQ,GY,oU,K4]),fN=p([DQ,FY,qY,bQ,OY,OQ,NQ,R1]),lN=p([LQ,bU,hU,dU,qQ,MQ,VQ,ZQ]),mN=p([BQ,FQ,FU,oA,cA,DU,zU,K4,lU]),cN=p([DQ,CA,rU,JU,eA,uA,fA,mA,wQ,UU,OQ,NQ,R1]);class k extends Error{constructor(Q,Y,X){super(`MCP error ${Q}: ${Y}`);this.code=Q,this.data=X,this.name="McpError"}static fromError(Q,Y,X){if(Q===y.UrlElicitationRequired&&X){let W=X;if(W.elicitations)return new jG(W.elicitations,Y)}return new k(Q,Y,X)}}class jG extends k{constructor(Q,Y=`URL elicitation${Q.length>1?"s":""} required`){super(y.UrlElicitationRequired,Y,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function $1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var tU=Symbol("Let zodToJsonSchema decide on which parser to use");var wZ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function MY(Q){let X=JQ(Q)?.method;if(!X)throw Error("Schema is missing a method literal");let W=xW(X);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function VY(Q,Y){let X=W1(Q,Y);if(!X.success)throw X.error;return X.data}var X3=60000;class NY{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(BQ,(Y)=>{this._oncancel(Y)}),this.setNotificationHandler(FQ,(Y)=>{this._onprogress(Y)}),this.setRequestHandler(LQ,(Y)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(qQ,async(Y,X)=>{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new k(y.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(MQ,async(Y,X)=>{let W=async()=>{let G=Y.params.taskId;if(this._taskMessageQueue){let J;while(J=await this._taskMessageQueue.dequeue(G,X.sessionId)){if(J.type==="response"||J.type==="error"){let z=J.message,H=z.id,A=this._requestResolvers.get(H);if(A)if(this._requestResolvers.delete(H),J.type==="response")A(z);else{let U=z,K=new k(U.error.code,U.error.message,U.error.data);A(K)}else{let U=J.type==="response"?"Response":"Error";this._onerror(Error(`${U} handler missing for request ${H}`))}continue}await this._transport?.send(J.message,{relatedRequestId:X.requestId})}}let $=await this._taskStore.getTask(G,X.sessionId);if(!$)throw new k(y.InvalidParams,`Task not found: ${G}`);if(!$1($.status))return await this._waitForTaskUpdate(G,X.signal),await W();if($1($.status)){let J=await this._taskStore.getTaskResult(G,X.sessionId);return this._clearTaskQueue(G),{...J,_meta:{...J._meta,[G1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(VQ,async(Y,X)=>{try{let{tasks:W,nextCursor:G}=await this._taskStore.listTasks(Y.params?.cursor,X.sessionId);return{tasks:W,nextCursor:G,_meta:{}}}catch(W){throw new k(y.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(ZQ,async(Y,X)=>{try{let W=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!W)throw new k(y.InvalidParams,`Task not found: ${Y.params.taskId}`);if($1(W.status))throw new k(y.InvalidParams,`Cannot cancel task in terminal status: ${W.status}`);await this._taskStore.updateTaskStatus(Y.params.taskId,"cancelled","Client cancelled task execution.",X.sessionId),this._clearTaskQueue(Y.params.taskId);let G=await this._taskStore.getTask(Y.params.taskId,X.sessionId);if(!G)throw new k(y.InvalidParams,`Task not found after cancellation: ${Y.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof k)throw W;throw new k(y.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,Y,X,W,G=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(W,Y),startTime:Date.now(),timeout:Y,maxTotalTimeout:X,resetTimeoutOnProgress:G,onTimeout:W})}_resetTimeout(Q){let Y=this._timeoutInfo.get(Q);if(!Y)return!1;let X=Date.now()-Y.startTime;if(Y.maxTotalTimeout&&X>=Y.maxTotalTimeout)throw this._timeoutInfo.delete(Q),k.fromError(y.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Y.maxTotalTimeout,totalElapsed:X});return clearTimeout(Y.timeoutId),Y.timeoutId=setTimeout(Y.onTimeout,Y.timeout),!0}_cleanupTimeout(Q){let Y=this._timeoutInfo.get(Q);if(Y)clearTimeout(Y.timeoutId),this._timeoutInfo.delete(Q)}async connect(Q){this._transport=Q;let Y=this.transport?.onclose;this._transport.onclose=()=>{Y?.(),this._onclose()};let X=this.transport?.onerror;this._transport.onerror=(G)=>{X?.(G),this._onerror(G)};let W=this._transport?.onmessage;this._transport.onmessage=(G,$)=>{if(W?.(G,$),J4(G)||OG(G))this._onresponse(G);else if(QY(G))this._onrequest(G,$);else if(qG(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 Y=k.fromError(y.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let X of Q.values())X(Y)}_onerror(Q){this.onerror?.(Q)}_onnotification(Q){let Y=this._notificationHandlers.get(Q.method)??this.fallbackNotificationHandler;if(Y===void 0)return;Promise.resolve().then(()=>Y(Q)).catch((X)=>this._onerror(Error(`Uncaught error in notification handler: ${X}`)))}_onrequest(Q,Y){let X=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,W=this._transport,G=Q.params?._meta?.[G1]?.taskId;if(X===void 0){let A={jsonrpc:"2.0",id:Q.id,error:{code:y.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:A,timestamp:Date.now()},W?.sessionId).catch((U)=>this._onerror(Error(`Failed to enqueue error response: ${U}`)));else W?.send(A).catch((U)=>this._onerror(Error(`Failed to send an error response: ${U}`)));return}let $=new AbortController;this._requestHandlerAbortControllers.set(Q.id,$);let J=BG(Q.params)?Q.params.task:void 0,z=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:$.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(A)=>{let U={relatedRequestId:Q.id};if(G)U.relatedTask={taskId:G};await this.notification(A,U)},sendRequest:async(A,U,K)=>{let D={...K,relatedRequestId:Q.id};if(G&&!D.relatedTask)D.relatedTask={taskId:G};let L=D.relatedTask?.taskId??G;if(L&&z)await z.updateTaskStatus(L,"input_required");return await this.request(A,U,D)},authInfo:Y?.authInfo,requestId:Q.id,requestInfo:Y?.requestInfo,taskId:G,taskStore:z,taskRequestedTtl:J?.ttl,closeSSEStream:Y?.closeSSEStream,closeStandaloneSSEStream:Y?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(J)this.assertTaskHandlerCapability(Q.method)}).then(()=>X(Q,H)).then(async(A)=>{if($.signal.aborted)return;let U={result:A,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:U,timestamp:Date.now()},W?.sessionId);else await W?.send(U)},async(A)=>{if($.signal.aborted)return;let U={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(A.code)?A.code:y.InternalError,message:A.message??"Internal error",...A.data!==void 0&&{data:A.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:U,timestamp:Date.now()},W?.sessionId);else await W?.send(U)}).catch((A)=>this._onerror(Error(`Failed to send response: ${A}`))).finally(()=>{this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:Y,...X}=Q.params,W=Number(Y),G=this._progressHandlers.get(W);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(Q)}`));return}let $=this._responseHandlers.get(W),J=this._timeoutInfo.get(W);if(J&&$&&J.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(z){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),$(z);return}G(X)}_onresponse(Q){let Y=Number(Q.id),X=this._requestResolvers.get(Y);if(X){if(this._requestResolvers.delete(Y),J4(Q))X(Q);else{let $=new k(Q.error.code,Q.error.message,Q.error.data);X($)}return}let W=this._responseHandlers.get(Y);if(W===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(Y),this._cleanupTimeout(Y);let G=!1;if(J4(Q)&&Q.result&&typeof Q.result==="object"){let $=Q.result;if($.task&&typeof $.task==="object"){let J=$.task;if(typeof J.taskId==="string")G=!0,this._taskProgressTokens.set(J.taskId,Y)}}if(!G)this._progressHandlers.delete(Y);if(J4(Q))W(Q);else{let $=k.fromError(Q.error.code,Q.error.message,Q.error.data);W($)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(Q,Y,X){let{task:W}=X??{};if(!W){try{yield{type:"result",result:await this.request(Q,Y,X)}}catch($){yield{type:"error",error:$ instanceof k?$:new k(y.InternalError,String($))}}return}let G;try{let $=await this.request(Q,R1,X);if($.task)G=$.task.taskId,yield{type:"taskCreated",task:$.task};else throw new k(y.InternalError,"Task creation did not return a task");while(!0){let J=await this.getTask({taskId:G},X);if(yield{type:"taskStatus",task:J},$1(J.status)){if(J.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};else if(J.status==="failed")yield{type:"error",error:new k(y.InternalError,`Task ${G} failed`)};else if(J.status==="cancelled")yield{type:"error",error:new k(y.InternalError,`Task ${G} was cancelled`)};return}if(J.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},Y,X)};return}let z=J.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,z)),X?.signal?.throwIfAborted()}}catch($){yield{type:"error",error:$ instanceof k?$:new k(y.InternalError,String($))}}}request(Q,Y,X){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$,task:J,relatedTask:z}=X??{};return new Promise((H,A)=>{let U=(M)=>{A(M)};if(!this._transport){U(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),J)this.assertTaskCapability(Q.method)}catch(M){U(M);return}X?.signal?.throwIfAborted();let K=this._requestMessageId++,D={...Q,jsonrpc:"2.0",id:K};if(X?.onprogress)this._progressHandlers.set(K,X.onprogress),D.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:K}};if(J)D.params={...D.params,task:J};if(z)D.params={...D.params,_meta:{...D.params?._meta||{},[G1]:z}};let L=(M)=>{this._responseHandlers.delete(K),this._progressHandlers.delete(K),this._cleanupTimeout(K),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:K,reason:String(M)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let S=M instanceof k?M:new k(y.RequestTimeout,String(M));A(S)};this._responseHandlers.set(K,(M)=>{if(X?.signal?.aborted)return;if(M instanceof Error)return A(M);try{let S=W1(Y,M.result);if(!S.success)A(S.error);else H(S.data)}catch(S){A(S)}}),X?.signal?.addEventListener("abort",()=>{L(X?.signal?.reason)});let q=X?.timeout??X3,O=()=>L(k.fromError(y.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(K,q,X?.maxTotalTimeout,O,X?.resetTimeoutOnProgress??!1);let V=z?.taskId;if(V){let M=(S)=>{let E=this._responseHandlers.get(K);if(E)E(S);else this._onerror(Error(`Response handler missing for side-channeled request ${K}`))};this._requestResolvers.set(K,M),this._enqueueTaskMessage(V,{type:"request",message:D,timestamp:Date.now()}).catch((S)=>{this._cleanupTimeout(K),A(S)})}else this._transport.send(D,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:$}).catch((M)=>{this._cleanupTimeout(K),A(M)})})}async getTask(Q,Y){return this.request({method:"tasks/get",params:Q},OQ,Y)}async getTaskResult(Q,Y,X){return this.request({method:"tasks/result",params:Q},Y,X)}async listTasks(Q,Y){return this.request({method:"tasks/list",params:Q},NQ,Y)}async cancelTask(Q,Y){return this.request({method:"tasks/cancel",params:Q},NG,Y)}async notification(Q,Y){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let X=Y?.relatedTask?.taskId;if(X){let J={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[G1]:Y.relatedTask}}};await this._enqueueTaskMessage(X,{type:"notification",message:J,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!Y?.relatedRequestId&&!Y?.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 J={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[G1]:Y.relatedTask}}};this._transport?.send(J,Y).catch((z)=>this._onerror(z))});return}let $={...Q,jsonrpc:"2.0"};if(Y?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[G1]:Y.relatedTask}}};await this._transport.send($,Y)}setRequestHandler(Q,Y){let X=MY(Q);this.assertRequestHandlerCapability(X),this._requestHandlers.set(X,(W,G)=>{let $=VY(Q,W);return Promise.resolve(Y($,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,Y){let X=MY(Q);this._notificationHandlers.set(X,(W)=>{let G=VY(Q,W);return Promise.resolve(Y(G))})}removeNotificationHandler(Q){this._notificationHandlers.delete(Q)}_cleanupTaskProgressHandler(Q){let Y=this._taskProgressTokens.get(Q);if(Y!==void 0)this._progressHandlers.delete(Y),this._taskProgressTokens.delete(Q)}async _enqueueTaskMessage(Q,Y,X){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,Y,X,W)}async _clearTaskQueue(Q,Y){if(this._taskMessageQueue){let X=await this._taskMessageQueue.dequeueAll(Q,Y);for(let W of X)if(W.type==="request"&&QY(W.message)){let G=W.message.id,$=this._requestResolvers.get(G);if($)$(new k(y.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,Y){let X=this._options?.defaultTaskPollInterval??1000;try{let W=await this._taskStore?.getTask(Q);if(W?.pollInterval)X=W.pollInterval}catch{}return new Promise((W,G)=>{if(Y.aborted){G(new k(y.InvalidRequest,"Request cancelled"));return}let $=setTimeout(W,X);Y.addEventListener("abort",()=>{clearTimeout($),G(new k(y.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(Q,Y){let X=this._taskStore;if(!X)throw Error("No task store configured");return{createTask:async(W)=>{if(!Q)throw Error("No request provided");return await X.createTask(W,Q.id,{method:Q.method,params:Q.params},Y)},getTask:async(W)=>{let G=await X.getTask(W,Y);if(!G)throw new k(y.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,$)=>{await X.storeTaskResult(W,G,$,Y);let J=await X.getTask(W,Y);if(J){let z=K4.parse({method:"notifications/tasks/status",params:J});if(await this.notification(z),$1(J.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return X.getTaskResult(W,Y)},updateTaskStatus:async(W,G,$)=>{let J=await X.getTask(W,Y);if(!J)throw new k(y.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if($1(J.status))throw new k(y.InvalidParams,`Cannot update task "${W}" from terminal status "${J.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await X.updateTaskStatus(W,G,$,Y);let z=await X.getTask(W,Y);if(z){let H=K4.parse({method:"notifications/tasks/status",params:z});if(await this.notification(H),$1(z.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return X.listTasks(W,Y)}}}}function EG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function TG(Q,Y){let X={...Q};for(let W in Y){let G=W,$=Y[G];if($===void 0)continue;let J=X[G];if(EG(J)&&EG($))X[G]={...J,...$};else X[G]=$}return X}var $5=_9(L9(),1),J5=_9(G5(),1);function KM(){let Q=new $5.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return J5.default(Q),Q}class P9{constructor(Q){this._ajv=Q??KM()}getValidator(Q){let Y="$id"in Q&&typeof Q.$id==="string"?this._ajv.getSchema(Q.$id)??this._ajv.compile(Q):this._ajv.compile(Q);return(X)=>{if(Y(X))return{valid:!0,data:X,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(Y.errors)}}}}class I9{constructor(Q){this._server=Q}requestStream(Q,Y,X){return this._server.requestStream(Q,Y,X)}async getTask(Q,Y){return this._server.getTask({taskId:Q},Y)}async getTaskResult(Q,Y,X){return this._server.getTaskResult({taskId:Q},Y,X)}async listTasks(Q,Y){return this._server.listTasks(Q?{cursor:Q}:void 0,Y)}async cancelTask(Q,Y){return this._server.cancelTask({taskId:Q},Y)}}function z5(Q,Y,X){if(!Q)throw Error(`${X} does not support task creation (required for ${Y})`);switch(Y){case"tools/call":if(!Q.tools?.call)throw Error(`${X} does not support task creation for tools/call (required for ${Y})`);break;default:break}}function H5(Q,Y,X){if(!Q)throw Error(`${X} does not support task creation (required for ${Y})`);switch(Y){case"sampling/createMessage":if(!Q.sampling?.createMessage)throw Error(`${X} does not support task creation for sampling/createMessage (required for ${Y})`);break;case"elicitation/create":if(!Q.elicitation?.create)throw Error(`${X} does not support task creation for elicitation/create (required for ${Y})`);break;default:break}}class j9 extends NY{constructor(Q,Y){super(Y);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(L4.options.map((X,W)=>[X,W])),this.isMessageIgnored=(X,W)=>{let G=this._loggingLevels.get(W);return G?this.LOG_LEVEL_SEVERITY.get(X)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=Y?.capabilities??{},this._instructions=Y?.instructions,this._jsonSchemaValidator=Y?.jsonSchemaValidator??new P9,this.setRequestHandler(WY,(X)=>this._oninitialize(X)),this.setNotificationHandler(GY,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(LY,async(X,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:$}=X.params,J=L4.safeParse($);if(J.success)this._loggingLevels.set(G,J.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new I9(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=TG(this._capabilities,Q)}setRequestHandler(Q,Y){let W=JQ(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(T1(W)){let J=W;G=J._zod?.def?.value??J.value}else{let J=W;G=J._def?.value??J.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let J=async(z,H)=>{let A=W1(B4,z);if(!A.success){let L=A.error instanceof Error?A.error.message:String(A.error);throw new k(y.InvalidParams,`Invalid tools/call request: ${L}`)}let{params:U}=A.data,K=await Promise.resolve(Y(z,H));if(U.task){let L=W1(R1,K);if(!L.success){let q=L.error instanceof Error?L.error.message:String(L.error);throw new k(y.InvalidParams,`Invalid task creation result: ${q}`)}return L.data}let D=W1(wQ,K);if(!D.success){let L=D.error instanceof Error?D.error.message:String(D.error);throw new k(y.InvalidParams,`Invalid tools/call result: ${L}`)}return D.data};return super.setRequestHandler(Q,J)}return super.setRequestHandler(Q,Y)}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){H5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;z5(this._capabilities.tasks?.requests,Q,"Server")}async _oninitialize(Q){let Y=Q.params.protocolVersion;return this._clientCapabilities=Q.params.capabilities,this._clientVersion=Q.params.clientInfo,{protocolVersion:UG.includes(Y)?Y:s6,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"},DQ)}async createMessage(Q,Y){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 X=Q.messages[Q.messages.length-1],W=Array.isArray(X.content)?X.content:[X.content],G=W.some((H)=>H.type==="tool_result"),$=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,J=$?Array.isArray($.content)?$.content:[$.content]:[],z=J.some((H)=>H.type==="tool_use");if(G){if(W.some((H)=>H.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 H=new Set(J.filter((U)=>U.type==="tool_use").map((U)=>U.id)),A=new Set(W.filter((U)=>U.type==="tool_result").map((U)=>U.toolUseId));if(H.size!==A.size||![...H].every((U)=>A.has(U)))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},qY,Y);return this.request({method:"sampling/createMessage",params:Q},FY,Y)}async elicitInput(Q,Y){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},bQ,Y)}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},bQ,Y);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let J=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!J.valid)throw new k(y.InvalidParams,`Elicitation response content does not match requested schema: ${J.errorMessage}`)}catch($){if($ instanceof k)throw $;throw new k(y.InternalError,`Error validating elicitation response: ${$ instanceof Error?$.message:String($)}`)}return G}}}createElicitationCompletionNotifier(Q,Y){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}},Y)}async listRoots(Q,Y){return this.request({method:"roots/list",params:Q},OY,Y)}async sendLoggingMessage(Q,Y){if(this._capabilities.logging){if(!this.isMessageIgnored(Q.level,Y))return this.notification({method:"notifications/message",params:Q})}}async sendResourceUpdated(Q){return this.notification({method:"notifications/resources/updated",params:Q})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var A5={name:"@sequenzy/mcp",version:"0.0.43",mcpName:"io.github.sequenzy/mcp",description:"Sequenzy MCP server for AI-powered email marketing automation",type:"module",bin:{"sequenzy-mcp":"dist/index.js"},main:"./dist/index.js",exports:{".":"./dist/index.js","./server":"./dist/server.js","./runtime":"./dist/runtime.js","./server.json":"./server.json"},scripts:{dev:"bun --watch src/index.ts",build:"bun build src/index.ts src/server.ts src/runtime.ts --outdir dist --target node --minify",start:"node dist/index.js","type-check":"tsc --noEmit",test:"bun test","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{"@modelcontextprotocol/sdk":"^1.0.0"},devDependencies:{"@types/bun":"latest","@types/node":"^22.0.0","bun-types":"latest",typescript:"^5.8.0"},files:["dist","server.json"],keywords:["sequenzy","email","mcp","ai","claude","automation"],license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/Sequenzy/mcp.git"},homepage:"https://sequenzy.com",bugs:{url:"https://github.com/Sequenzy/mcp/issues"}};var E9=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],U5={dashboard:"/dashboard/company/{companyId}",campaigns:"/dashboard/company/{companyId}/campaign",campaign:"/dashboard/company/{companyId}/campaign/{campaignId}",campaignPreview:"/dashboard/company/{companyId}/campaign/{campaignId}?step=review",campaignList:"/dashboard/company/{companyId}/campaign/list/{status}",sequences:"/dashboard/company/{companyId}/sequences",sequence:"/dashboard/company/{companyId}/sequences/{sequenceId}",sequenceList:"/dashboard/company/{companyId}/sequences/list/{status}",settings:"/dashboard/company/{companyId}/settings",settingsTab:"/dashboard/company/{companyId}/settings?tab={tab}",emails:"/dashboard/company/{companyId}/emails",email:"/dashboard/company/{companyId}/emails/{emailId}",subscribers:"/dashboard/company/{companyId}/subscribers",sentEmails:"/dashboard/company/{companyId}/sent-emails",emailSend:"/dashboard/company/{companyId}/sent-emails/{emailSendId}",segments:"/dashboard/company/{companyId}/segments",metrics:"/dashboard/company/{companyId}/metrics",transactional:"/dashboard/company/{companyId}/transactional",transactionalEmail:"/dashboard/company/{companyId}/transactional/{transactionalId}",domain:"/dashboard/company/{companyId}/settings/domain/{domainId}",domainVerify:"/dashboard/company/{companyId}/settings/domain/{domainId}/verify"};function BM(Q){let X=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return X.length>0?X:"https://sequenzy.com"}function h0(Q){let Y=Q?.trim();return Y?Y:void 0}function t0(Q){return encodeURIComponent(Q)}function Q0(Q,Y){return`${Q}${Y}`}function Y0(Q,Y=""){return`/dashboard/company/${t0(Q)}${Y}`}function K5(Q,Y,X){return Q0(Q,`${Y0(Y,"/settings")}?tab=${encodeURIComponent(X)}`)}function LM(Q,Y){let X=E9.map((W)=>[W,Y?K5(Q,Y,W):""]);return Object.fromEntries(X)}function B1(Q={},Y){let X=BM(Y),W=h0(Q.companyId),G={},$=LM(X,W);if(!W)return{appUrl:X,routeTemplates:U5,settingsTabValues:E9,urls:G,settingsUrls:$};G.dashboard=Q0(X,Y0(W)),G.campaigns=Q0(X,Y0(W,"/campaign")),G.sequences=Q0(X,Y0(W,"/sequences")),G.settings=Q0(X,Y0(W,"/settings")),G.emails=Q0(X,Y0(W,"/emails")),G.subscribers=Q0(X,Y0(W,"/subscribers")),G.sentEmails=Q0(X,Y0(W,"/sent-emails")),G.segments=Q0(X,Y0(W,"/segments")),G.metrics=Q0(X,Y0(W,"/metrics")),G.transactional=Q0(X,Y0(W,"/transactional"));let J=h0(Q.campaignId);if(J)G.campaign=Q0(X,Y0(W,`/campaign/${t0(J)}`)),G.campaignPreview=`${G.campaign}?step=review`;let z=h0(Q.sequenceId);if(z)G.sequence=Q0(X,Y0(W,`/sequences/${t0(z)}`));let H=h0(Q.emailId)??h0(Q.templateId);if(H)G.email=Q0(X,Y0(W,`/emails/${t0(H)}`)),G.template=G.email;let A=h0(Q.transactionalId);if(A)G.transactionalEmail=Q0(X,Y0(W,`/transactional/${t0(A)}`));let U=h0(Q.emailSendId);if(U)G.emailSend=Q0(X,Y0(W,`/sent-emails/${t0(U)}`));let K=h0(Q.domainId);if(K)G.domain=Q0(X,Y0(W,`/settings/domain/${t0(K)}`)),G.domainVerify=`${G.domain}/verify`;let D=h0(Q.status);if(D)G.campaignList=Q0(X,Y0(W,`/campaign/list/${t0(D)}`)),G.sequenceList=Q0(X,Y0(W,`/sequences/list/${t0(D)}`));let L=h0(Q.settingsTab);if(L)G.settingsTab=K5(X,W,L);return{appUrl:X,routeTemplates:U5,settingsTabValues:E9,urls:G,settingsUrls:$}}var D5=[{uri:"sequenzy://dashboard",name:"Dashboard Overview",description:"Live overview stats for the last 7 days",mimeType:"application/json"},{uri:"sequenzy://company",name:"Current Company",description:"The currently selected company, including localization settings",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 with localization status",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"},{uri:"sequenzy://app-routes",name:"Dashboard URL Routes",description:"Route templates and settings tabs for building Sequenzy dashboard links",mimeType:"application/json"}];async function B5(Q){try{let Y;switch(Q){case"sequenzy://dashboard":Y=await N("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let X=await N("GET","/api/v1/account"),W=s0()??X.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");Y=await N("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":Y=await N("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":Y=await N("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":Y=await N("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":Y=await N("GET","/api/v1/sequences");break;case"sequenzy://templates":Y=await N("GET","/api/v1/templates");break;case"sequenzy://segments":Y=await N("GET","/api/v1/segments");break;case"sequenzy://tags":Y=await N("GET","/api/v1/tags");break;case"sequenzy://health":Y=await N("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":Y=B1();break;default:throw Error(`Unknown resource: ${Q}`)}return{contents:[{uri:Q,mimeType:"application/json",text:JSON.stringify(Y,null,2)}]}}catch(Y){return{contents:[{uri:Q,mimeType:"text/plain",text:a0(Y)}]}}}var FM={type:"object",properties:{id:{type:"string",description:"Optional filter ID. Any stable string works; one will be generated if omitted."},field:{type:"string",enum:["status","tag","email","emailProvider","added","firstName","lastName","list","emailSent","emailOpened","emailClicked","emailBounced","emailComplained","attribute","event","segment","stripeProduct","stripeCurrentProduct","stripeTrialProduct"],description:"Filter field. Use `event` for custom subscriber events, `segment` for saved segment membership, and `stripeProduct`/`stripeCurrentProduct`/`stripeTrialProduct` for Stripe product-based segments. Engagement fields (`emailSent`, `emailOpened`, `emailClicked`, `emailBounced`, `emailComplained`) accept a time range as the value or a specific campaign via `campaign:<campaign_id>`."},operator:{type:"string",enum:["is","is_not","is_empty","is_not_empty","contains","not_contains","less_than","more_than","at_least","less_than_count","gte","lte","gt","lt"],description:"Filter operator. Use `is_empty` or `is_not_empty` for fields that can be blank, including custom attributes. For `stripeProduct`, use `is` or `is_not` with a raw product ID, and `at_least` or `less_than_count` with `productId:count`. For `event`, use `is`, `is_not`, `at_least`, or `less_than_count`. For engagement fields, use `is` (event happened) or `is_not` (event did not happen)."},value:{type:"string",description:"Filter value. For custom attribute empty checks, use `attributeName:` such as `last_logged_in:`. Event examples: `saas.purchase:30d`, `saas.purchase:all`, or `saas.purchase:5:30d` for thresholds. Segment values are segment IDs. Stripe product examples: `prod_123` for bought/didn't buy, `prod_123:3` for payment thresholds. Engagement examples: `7d`, `30d`, `90d`, `180d`, `all` for rolling time windows, or `campaign:<campaign_id>` to scope to a specific sent campaign (use `list_campaigns` to find IDs)."}},required:["field","operator","value"],additionalProperties:!1},qM={type:"object",properties:{kind:{type:"string",enum:["group"]},id:{type:"string",description:"Stable group ID. Any string works; one will be generated if omitted."},joinOperator:{type:"string",enum:["and","or"],description:"How children in this group combine."},children:{type:"array",minItems:1,items:{type:"object",description:'Either a filter leaf (`kind: "filter"`) or another group (`kind: "group"`).'}}},required:["kind","joinOperator","children"],additionalProperties:!0};function q5(Q){if(!Array.isArray(Q))return Q;return Q.map((Y)=>{if(typeof Y!=="object"||Y===null)return Y;let X=Y;if(typeof X.id==="string"&&X.id.trim()!=="")return X;return{...X,id:crypto.randomUUID()}})}function O5(Q){if(typeof Q!=="object"||Q===null)return Q;let Y=Q;if(Y.kind==="filter"){let X=q5([Y]);return Array.isArray(X)?X[0]:Y}if(Y.kind!=="group")return Q;return{...Y,id:typeof Y.id==="string"&&Y.id.trim()!==""?Y.id:crypto.randomUUID(),children:Array.isArray(Y.children)?Y.children.map(O5):[]}}function b1(Q,Y,X){if(Y.html!==void 0&&Y.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(Y.blocks!==void 0&&!Array.isArray(Y.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(X?.requireContent&&Y.html===void 0&&Y.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function A6(Q,Y){if(Y.labels===void 0)return;if(!Array.isArray(Y.labels))throw Error(`\`labels\` must be an array when calling \`${Q}\`.`);if(Y.labels.some((X)=>typeof X!=="string"||X.trim().length===0))throw Error(`\`labels\` must contain only non-empty strings when calling \`${Q}\`.`)}function OM(Q){let Y=Q.filters!==void 0,X=Q.root!==void 0;if(Y&&X)throw Error("Provide either `filters` or `root` when calling `create_segment`, not both.");if(!Y&&!X)throw Error("Provide either `filters` or `root` when calling `create_segment`.");if(Y){if(!Array.isArray(Q.filters))throw Error("`filters` must be an array when calling `create_segment`.");if(Q.filters.length===0)throw Error("`filters` must include at least one filter when calling `create_segment`.")}if(X&&(typeof Q.root!=="object"||Q.root===null))throw Error("`root` must be an object when calling `create_segment`.")}function MM(Q){if(Q.clearEnrollmentFieldPath===!0&&Q.enrollmentFieldPath!==void 0)throw Error("Provide either `enrollmentFieldPath` or `clearEnrollmentFieldPath` when calling `update_sequence`, not both.");let Y={...Q};if(delete Y.clearEnrollmentFieldPath,Q.clearEnrollmentFieldPath===!0)Y.enrollmentFieldPath=null;return Y}function VM(Q){let Y=I(Q,"subscriberId"),X=Q.fieldValues,W=X===void 0?void 0:Array.isArray(X)?X:void 0;if(X!==void 0&&W===void 0)throw Error("`fieldValues` must be an array when calling `cancel_sequence_enrollments`.");let G=W?.map((z)=>typeof z==="string"?z.trim():"").filter((z)=>z.length>0)??[];if(W?.some((z)=>typeof z!=="string")||W!==void 0&&G.length===0)throw Error("`fieldValues` must contain at least one non-empty string when calling `cancel_sequence_enrollments`.");if(Y!==void 0===G.length>0)throw Error("Provide exactly one target when calling `cancel_sequence_enrollments`: `subscriberId` or `fieldValues`.");let $=I(Q,"fieldPath"),J=I(Q,"reason");return{...Y!==void 0&&{subscriberId:Y},...$!==void 0&&{fieldPath:$},...G.length>0&&{fieldValues:G},...typeof Q.dryRun==="boolean"&&{dryRun:Q.dryRun},...J!==void 0&&{reason:J}}}function NM(Q){b1("create_campaign",Q),A6("create_campaign",Q);let Y=I(Q,"prompt")!==void 0,X=Q.html!==void 0,W=Q.blocks!==void 0,G=Q.templateId!==void 0;if(Q.prompt!==void 0&&!Y)throw Error("`prompt` cannot be empty when calling `create_campaign`.");if(Y&&(X||W||G))throw Error("Provide either `prompt`, `html`, `blocks`, or `templateId` when calling `create_campaign`, not multiple content sources.");if(!Y&&(Q.style!==void 0||Q.tone!==void 0))throw Error("`style` and `tone` can only be used with `prompt` when calling `create_campaign`.");if(!Y&&I(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_campaign`.")}function ZM(Q){if(I(Q,"scheduledAt")===void 0)throw Error("`scheduledAt` is required when calling `schedule_campaign`.");if(Q.targetLists!==void 0&&!B0(Q.targetLists))throw Error("`targetLists` must be an object when calling `schedule_campaign`.");if(Q.sendTimeOptimization!==void 0){if(typeof Q.sendTimeOptimization!=="boolean")throw Error("`sendTimeOptimization` must be a boolean when calling `schedule_campaign`.")}if(Q.spreadOverHours!==void 0){if(typeof Q.spreadOverHours!=="number"||!Number.isInteger(Q.spreadOverHours)||Q.spreadOverHours<1||Q.spreadOverHours>72)throw Error("`spreadOverHours` must be an integer between 1 and 72 when calling `schedule_campaign`.")}}function wM(Q){b1("create_transactional_email",Q);let Y=I(Q,"prompt")!==void 0,X=Q.html!==void 0,W=Q.blocks!==void 0;if(Q.prompt!==void 0&&!Y)throw Error("`prompt` cannot be empty when calling `create_transactional_email`.");if(Y&&(X||W))throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`, not multiple content sources.");if(!Y&&(Q.style!==void 0||Q.tone!==void 0))throw Error("`style` and `tone` can only be used with `prompt` when calling `create_transactional_email`.");if(!Y&&!X&&!W)throw Error("Provide either `prompt`, `html`, or `blocks` when calling `create_transactional_email`.");if(!Y&&I(Q,"subject")===void 0)throw Error("`subject` is required unless `prompt` is provided when calling `create_transactional_email`.")}var L5={type:"object",description:"A step to create inside a branch path. Use type:'delay' for a standalone delay, type:'email' for an email, or type:'create_discount' for a discount action.",properties:{type:{type:"string",enum:["email","delay","create_discount","discount","webhook"],description:"Branch path step type. Omit for email steps; use delay for standalone waits."},nodeType:{type:"string",enum:["logic_delay","action_email","action_create_discount","action_add_tag","action_remove_tag","action_add_to_list","action_remove_from_list","action_update_attributes","logic_wait_for_event","action_webhook"],description:"Advanced branch path node type. Prefer type unless creating a non-email action."},config:{type:"object",description:"Config for advanced nodeType steps such as tag/list/webhook/wait-for-event actions.",additionalProperties:!0},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:"Sequenzy email blocks for email steps.",items:{type:"object"}},html:{type:"string",description:"HTML content for email steps."},delay:{type:"object",description:"Delay before this step, or the delay duration when type is delay.",properties:{days:{type:"number"},hours:{type:"number"},minutes:{type:"number"}}},delayMs:{type:"number",description:"Delay in milliseconds. Useful for standalone type:'delay' steps."},name:{type:"string",description:"Email template name for email steps."},discount:{type:"object",description:"Discount configuration for create_discount steps. Same shape as create_sequence steps.",additionalProperties:!0},label:{type:"string",description:"Node label for discount or advanced node steps."},provider:{type:"string",enum:["stripe","shopify"]},discountType:{type:"string",enum:["percent","amount"]},percentOff:{type:"number"},amountOff:{type:"number"},currency:{type:"string"},duration:{type:"string",enum:["once","forever","repeating"]},durationInMonths:{type:"number"},appliesToAllPlans:{type:"boolean"},planIds:{type:"array",items:{type:"string"}},codePrefix:{type:"string"},maxRedemptions:{type:"number"},lockToSubscriber:{type:"boolean"},expiresAt:{type:"string"},expiresInHours:{type:"number"}},additionalProperties:!1};function bM(Q){if(!Q||typeof Q!=="object")return null;let Y=Q;if(Y.success!==!1)return null;if(typeof Y.error==="string")return Error(Y.error);if(Y.error&&typeof Y.error==="object"&&typeof Y.error.message==="string")return Error(Y.error.message);if(typeof Y.message==="string")return Error(Y.message);return Error("The tool returned an unsuccessful response.")}function B0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function F5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function PM(Q){let Y=new URLSearchParams;if(typeof Q.query==="string"&&Q.query.trim()!=="")Y.set("query",Q.query.trim());if(Array.isArray(Q.tags)&&Q.tags.length>0)Y.set("tags",Q.tags.filter((X)=>typeof X==="string"&&X.trim()!=="").join(","));if(typeof Q.segmentId==="string"&&Q.segmentId.trim()!=="")Y.set("segmentId",Q.segmentId);if(typeof Q.status==="string"&&Q.status.trim()!=="")Y.set("status",Q.status.trim());return Y.set("page",String(Q.page)),Y.set("limit",String(Q.pageSize)),Y}async function IM(Q,Y){let X=typeof Q.limit==="number"&&Number.isFinite(Q.limit)?Math.max(1,Math.trunc(Q.limit)):void 0,W=Math.min(100,Math.max(1,X??100)),G=[],$=1,J=0,z=0,H=0;while(!0){let U=PM({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,status:Q.status,page:$,pageSize:W}),K=await N("GET",`/api/v1/subscribers?${U.toString()}`,void 0,Y);J=K.pagination?.total??K.subscribers.length,z=K.pagination?.totalPages??1,H+=1,G.push(...K.subscribers??[]);let D=X!==void 0&&G.length>=X,L=K.pagination?$>=K.pagination.totalPages:(K.subscribers??[]).length<W;if(D||L)break;$+=1}let A=X!==void 0?G.slice(0,X):G;return{success:!0,subscribers:A,pagination:{page:1,limit:W,total:J,totalPages:z,fetchedPages:H},returned:A.length,truncated:X!==void 0&&J>0&&A.length<J}}function jM(Q){let Y=typeof Q.email==="string"&&Q.email.trim()!==""?Q.email.trim():void 0,X=typeof Q.externalId==="string"&&Q.externalId.trim()!==""?Q.externalId.trim():void 0;return{...Y?{email:Y}:{},...X?{externalId:X}:{}}}function h4(Q,Y){let X=jM(Y);if(!X.email&&!X.externalId)throw Error(`Provide either \`email\` or \`externalId\` when calling \`${Q}\`.`);return X}function S9(Q){if(Q.email)return`/api/v1/subscribers/${encodeURIComponent(Q.email)}`;return`/api/v1/subscribers/external?externalId=${encodeURIComponent(String(Q.externalId))}`}async function T9(Q,Y){return N("GET",S9(Q),void 0,Y)}function I(Q,Y){let X=Q[Y];if(typeof X!=="string")return;let W=X.trim();return W.length>0?W:void 0}async function M5(Q){let Y=I(Q,"companyId");if(Y)return Y;let X=s0();if(X)return X;try{return(await N("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function f4(Q,Y){if(!B0(Q)||!Y)return Q;return{...Q,url:Y}}function V5(Q,Y){if(!B0(Q))return Q;return{...Q,...Y.campaign!==void 0&&{url:Y.campaign},...Y.campaignPreview!==void 0&&{previewUrl:Y.campaignPreview}}}function H6(Q,Y,X){if(!Array.isArray(Q)||!Y)return Q;return Q.map((W)=>{if(!B0(W))return W;let G=I(W,"id");if(!G)return W;let $=B1({companyId:Y,...X==="campaign"&&{campaignId:G},...X==="sequence"&&{sequenceId:G},...X==="template"&&{emailId:G},...X==="transactional"&&{transactionalId:G}});if(X==="campaign")return V5(W,$.urls);let J=X==="sequence"?$.urls.sequence:X==="template"?$.urls.email:$.urls.transactionalEmail;return f4(W,J)})}function EM(Q){if(!Array.isArray(Q))return Q;return Q.map((Y)=>{if(!B0(Y))return Y;let X=I(Y,"id");if(!X)return Y;let W=B1({companyId:X});return{...Y,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var TM=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","get_email_send","create_campaign","update_campaign","schedule_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","cancel_sequence_enrollments","list_ab_tests","get_ab_test","get_ab_test_stats","update_ab_test_variant","list_templates","get_template","create_template","update_template","list_transactional_emails","get_transactional_email","create_transactional_email","update_transactional_email"]);async function SM(Q,Y,X){if(!B0(X)||!TM.has(Q))return X;let W=B0(X.company)?X.company:void 0,$=I(X,"selectedCompanyId")??I(X,"currentCompanyId")??I(X,"companyId")??(W?I(W,"id"):void 0)??(W?I(W,"companyId"):void 0)??await M5(Y);if(!$)return X;let J=B0(X.campaign)?X.campaign:void 0,z=B0(X.sequence)?X.sequence:void 0,H=B0(X.template)?X.template:void 0,A=B0(X.transactional)&&!Array.isArray(X.transactional)?X.transactional:void 0,U={companyId:$,campaignId:I(Y,"campaignId")??I(X,"campaignId")??(J?I(J,"id"):void 0),sequenceId:I(Y,"sequenceId")??I(X,"sequenceId")??(z?I(z,"id"):void 0),emailId:I(X,"templateId")??(H?I(H,"id"):void 0)??(A?I(A,"emailId"):void 0)??I(Y,"templateId"),transactionalId:I(Y,"transactionalId")??(A?I(A,"id"):void 0)??I(Y,"idOrSlug"),emailSendId:I(Y,"emailSendId")??I(X,"emailSendId")??(B0(X.emailSend)?I(X.emailSend,"id"):void 0),status:I(Y,"status")},K=B1(U),D=W?B1({companyId:$}):void 0;return{...X,...Array.isArray(X.companies)&&{companies:EM(X.companies)},...Array.isArray(X.campaigns)&&{campaigns:H6(X.campaigns,$,"campaign")},...Array.isArray(X.sequences)&&{sequences:H6(X.sequences,$,"sequence")},...Array.isArray(X.templates)&&{templates:H6(X.templates,$,"template")},...Array.isArray(X.transactional)&&{transactional:H6(X.transactional,$,"transactional")},...W&&D!==void 0&&{company:{...W,url:D.urls.dashboard,settingsUrl:D.urls.settings}},...J&&K.urls.campaign!==void 0&&{campaign:V5(J,K.urls)},...z&&K.urls.sequence!==void 0&&{sequence:f4(z,K.urls.sequence)},...H&&K.urls.email!==void 0&&{template:f4(H,K.urls.email)},...A&&K.urls.transactionalEmail!==void 0&&{transactional:f4(A,K.urls.transactionalEmail)},...B0(X.emailSend)&&K.urls.emailSend!==void 0&&{emailSend:f4(X.emailSend,K.urls.emailSend)},appUrls:K.urls}}var N5=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
32
30
|
1. Call select_company first to choose which company to work with, OR
|
|
33
31
|
2. Pass companyId explicitly in each tool call
|
|
34
32
|
|
|
@@ -45,7 +43,7 @@ Use cases:
|
|
|
45
43
|
- 'subscribe_form': Adding subscribers from signup forms
|
|
46
44
|
- 'event_tracking': Tracking CUSTOM events only (not payment events - those come from the integration)
|
|
47
45
|
|
|
48
|
-
Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,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 only - payment events should come from Stripe/Polar/etc integration)"}}}},{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"},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide this with email when creating, or instead of email for an existing subscriber."},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"},status:{type:"string",description:"Initial subscriber status: active, unsubscribed, or bounced. Defaults to active."},optInMode:{type:"string",description:"Consent mode: confirmed creates active immediately when consent is verified, double_opt_in sends a confirmation email before activation, and default obeys company double opt-in settings."}},required:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."},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:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:[]}},{name:"get_subscriber",description:"Get the full subscriber profile, including tags, list memberships, sequence enrollments, email stats, and recent activity",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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",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"},status:{type:"string",description:"Filter by subscriber status: active, unsubscribed, or bounced."},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{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 from explicit filter rules. Use `filters` plus `filterJoinOperator` for flat legacy rules, or `root` for nested AND/OR groups such as `{ "kind": "group", "joinOperator": "and", "children": [{ "kind": "filter", "field": "attribute", "operator": "gte", "value": "mrr:50" }, { "kind": "group", "joinOperator": "or", "children": [{ "kind": "filter", "field": "tag", "operator": "contains", "value": "vip" }, { "kind": "filter", "field": "event", "operator": "is_not", "value": "saas.purchase:30d" }] }] }`. Supports `event` and `segment` fields, Stripe product purchase filters, and campaign-specific engagement filters.',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"},filterJoinOperator:{type:"string",enum:["and","or"],description:'How top-level filters combine. Use `"and"` to require every filter or `"or"` to match any filter.'},filters:{type:"array",items:zM,minItems:1,description:'Array of segment filters. Example custom attribute empty check: [{"id":"filter-1","field":"attribute","operator":"is_empty","value":"last_logged_in:"}]. Example Stripe purchase filter: [{"id":"filter-1","field":"stripeProduct","operator":"is","value":"prod_123"}]. Example threshold filter: [{"id":"filter-1","field":"stripeProduct","operator":"at_least","value":"prod_123:3"}]. Example campaign-specific engagement combo: [{"id":"filter-1","field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"id":"filter-2","field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]. Combine them with `filterJoinOperator: "or"` to match any filter.'},root:{...HM,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"]}},{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, including per-locale localization sync status",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, content, and all localized variants with sync status",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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},labels:{type:"array",description:"Optional label names to assign. Missing labels are created automatically.",items:{type:"string"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, `blocks`, or `labels` is required, and only those update fields are accepted.",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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},required:["templateId"],additionalProperties:!1}},{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_ab_tests",description:"List A/B tests and their variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Optional sequence ID to filter automation A/B tests."}}}},{name:"get_ab_test",description:"Get A/B test details, variants, and per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"}},required:["abTestId"]}},{name:"get_ab_test_stats",description:"Get A/B test aggregate stats and per-variant stats. Supports period or custom start/end ranges.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"},period:{type:"string",description:"Optional period: 1h, 24h, 7d, 30d, or 90d."},start:{type:"string",description:"Custom range start as ISO 8601. Requires end."},end:{type:"string",description:"Custom range end as ISO 8601. Requires start."}},required:["abTestId"]}},{name:"restart_ab_test",description:"Run another sequence A/B test after a winner is selected. By default the winner becomes the new control; pass sourceVariantId to use another variant as the control email.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID to restart"},sourceVariantId:{type:"string",description:"Optional variant ID to use as the new control email. Defaults to the selected winner."},testType:{type:"string",description:"Optional test type: subject or content."},winnerThreshold:{type:"number",description:"Optional number of subscribers before selecting a winner. Must be from 10 to 1000."},variantCount:{type:"number",description:"Optional total variants including the control. Must be from 2 to 4."}},required:["abTestId"],additionalProperties:!1}},{name:"update_ab_test_variant",description:"Update a draft A/B test variant. Provide at least one of subject, previewText, html, or blocks. Use either html or blocks, not both.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"},variantId:{type:"string",description:"A/B test variant ID"},subject:{type:"string",description:"Variant subject line"},previewText:{type:"string",description:"Variant preview text. Pass an empty string to clear it."},html:{type:"string",description:"Replacement HTML body. Mutually exclusive with blocks."},blocks:{type:"array",description:"Replacement Sequenzy email blocks. Mutually exclusive with html.",items:{type:"object"}}},required:["abTestId","variantId"],additionalProperties:!1}},{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)"},label:{type:"string",description:"Optional label name filter. Only campaigns assigned this label are returned."}}}},{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:"get_email_send",description:"Get a sent email by emailSendId, including the stored HTML body when available and the ClickHouse event timeline. If the short-lived email send row has been cleaned up, returns the retained ClickHouse events and a sparse summary.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},emailSendId:{type:"string",description:"Email send ID to inspect."}},required:["emailSendId"]}},{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. Optional when `prompt` is provided because the generated subject will be used."},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},prompt:{type:"string",description:"Generate campaign blocks from a prompt. Mutually exclusive with `html`, `blocks`, and `templateId`."},style:{type:"string",description:"Prompt generation style: minimal, branded, promotional. Only used with `prompt`."},tone:{type:"string",description:"Prompt generation tone: professional, casual, friendly. Only used with `prompt`."},templateId:{type:"string",description:"Use a template instead of html"},segmentId:{type:"string",description:"Target segment ID"},campaignData:{type:"object",description:"Optional campaign-scoped JSON data for repeat blocks and personalization."},computedLists:{type:"array",description:"Optional computed list definitions derived from campaignData at send time.",items:{type:"object"}},labels:{type:"array",description:"Optional label names to assign. Missing labels are created automatically.",items:{type:"string"}}},required:["name"]}},{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"},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested. Send an empty string to clear it."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},replyTo:{type:"string",description:"Set reply-to using an existing reply profile email address for this company."},replyProfileId:{type:"string",description:"Set reply-to using a reply profile ID for this company."},campaignData:{type:"object",description:"Set campaign-scoped JSON data for repeat blocks and personalization."},computedLists:{type:"array",description:"Set computed list definitions derived from campaignData at send time.",items:{type:"object"}},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},required:["campaignId"],additionalProperties:!1}},{name:"schedule_campaign",description:"Schedule a draft or already scheduled campaign. Returns dashboard edit and preview URLs.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},scheduledAt:{type:"string",description:"Future ISO 8601 timestamp for the send, for example 2026-06-01T14:00:00Z."},targetLists:{type:"object",description:"Optional campaign targeting object. Omit to use saved targeting or all active subscribers. Examples: {type:'all'}, {type:'lists', listIds:['list_123']}, {type:'segment', segmentId:'seg_123'}, or {type:'filtered', filters:[...], filterJoinOperator:'and'}.",additionalProperties:!0},sendTimeOptimization:{type:"boolean",description:"Whether to use send-time optimization."},spreadOverHours:{type:"number",description:"Spread delivery over an integer number of hours from 1 to 72. When set, spread delivery takes precedence over send-time optimization."}},required:["campaignId","scheduledAt"],additionalProperties:!1}},{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 plus editable step content. The response includes sequence.emails with each step's nodeId, linked emailId, subject, previewText, and blocks.",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"],additionalProperties:!1}},{name:"create_sequence",description:`Create a new email sequence. Provide either a goal for AI generation or explicit steps. Explicit steps can include email content and create_discount actions; emails after a discount action can use merge tags such as {{discount.code}} and {{discount.percentOff}}. For AI-generated sequences, the tool polls until emails are generated (typically 30-60 seconds).
|
|
46
|
+
Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,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 only - payment events should come from Stripe/Polar/etc integration)"}}}},{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"},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide this with email when creating, or instead of email for an existing subscriber."},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"},status:{type:"string",description:"Initial subscriber status: active, unsubscribed, or bounced. Defaults to active."},optInMode:{type:"string",description:"Consent mode: confirmed creates active immediately when consent is verified, double_opt_in sends a confirmation email before activation, and default obeys company double opt-in settings."}},required:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."},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:[]}},{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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:[]}},{name:"get_subscriber",description:"Get the full subscriber profile, including tags, list memberships, sequence enrollments, email stats, and recent activity",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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",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"},status:{type:"string",description:"Filter by subscriber status: active, unsubscribed, or bounced."},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{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 from explicit filter rules. Use `filters` plus `filterJoinOperator` for flat legacy rules, or `root` for nested AND/OR groups such as `{ "kind": "group", "joinOperator": "and", "children": [{ "kind": "filter", "field": "attribute", "operator": "gte", "value": "mrr:50" }, { "kind": "group", "joinOperator": "or", "children": [{ "kind": "filter", "field": "tag", "operator": "contains", "value": "vip" }, { "kind": "filter", "field": "event", "operator": "is_not", "value": "saas.purchase:30d" }] }] }`. Supports `event` and `segment` fields, Stripe product purchase filters, and campaign-specific engagement filters.',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"},filterJoinOperator:{type:"string",enum:["and","or"],description:'How top-level filters combine. Use `"and"` to require every filter or `"or"` to match any filter.'},filters:{type:"array",items:FM,minItems:1,description:'Array of segment filters. Example custom attribute empty check: [{"id":"filter-1","field":"attribute","operator":"is_empty","value":"last_logged_in:"}]. Example Stripe purchase filter: [{"id":"filter-1","field":"stripeProduct","operator":"is","value":"prod_123"}]. Example threshold filter: [{"id":"filter-1","field":"stripeProduct","operator":"at_least","value":"prod_123:3"}]. Example campaign-specific engagement combo: [{"id":"filter-1","field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"id":"filter-2","field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]. Combine them with `filterJoinOperator: "or"` to match any filter.'},root:{...qM,description:"Nested filter root. Mutually exclusive with `filters` and `filterJoinOperator`."}},required:["name"]}},{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, including per-locale localization sync status",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, content, and all localized variants with sync status",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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},labels:{type:"array",description:"Optional label names to assign. Missing labels are created automatically.",items:{type:"string"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, `blocks`, or `labels` is required, and only those update fields are accepted.",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. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},required:["templateId"],additionalProperties:!1}},{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_ab_tests",description:"List A/B tests and their variants",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Optional sequence ID to filter automation A/B tests."}}}},{name:"get_ab_test",description:"Get A/B test details, variants, and per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"}},required:["abTestId"]}},{name:"get_ab_test_stats",description:"Get A/B test aggregate stats and per-variant stats. Supports period or custom start/end ranges.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"},period:{type:"string",description:"Optional period: 1h, 24h, 7d, 30d, or 90d."},start:{type:"string",description:"Custom range start as ISO 8601. Requires end."},end:{type:"string",description:"Custom range end as ISO 8601. Requires start."}},required:["abTestId"]}},{name:"restart_ab_test",description:"Run another sequence A/B test after a winner is selected. By default the winner becomes the new control; pass sourceVariantId to use another variant as the control email.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID to restart"},sourceVariantId:{type:"string",description:"Optional variant ID to use as the new control email. Defaults to the selected winner."},testType:{type:"string",description:"Optional test type: subject or content."},winnerThreshold:{type:"number",description:"Optional number of subscribers before selecting a winner. Must be from 10 to 1000."},variantCount:{type:"number",description:"Optional total variants including the control. Must be from 2 to 4."}},required:["abTestId"],additionalProperties:!1}},{name:"update_ab_test_variant",description:"Update a draft A/B test variant. Provide at least one of subject, previewText, html, or blocks. Use either html or blocks, not both.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},abTestId:{type:"string",description:"A/B test ID"},variantId:{type:"string",description:"A/B test variant ID"},subject:{type:"string",description:"Variant subject line"},previewText:{type:"string",description:"Variant preview text. Pass an empty string to clear it."},html:{type:"string",description:"Replacement HTML body. Mutually exclusive with blocks."},blocks:{type:"array",description:"Replacement Sequenzy email blocks. Mutually exclusive with html.",items:{type:"object"}}},required:["abTestId","variantId"],additionalProperties:!1}},{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)"},label:{type:"string",description:"Optional label name filter. Only campaigns assigned this label are returned."}}}},{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:"get_email_send",description:"Get a sent email by emailSendId, including the stored HTML body when available and the ClickHouse event timeline. If the short-lived email send row has been cleaned up, returns the retained ClickHouse events and a sparse summary.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},emailSendId:{type:"string",description:"Email send ID to inspect."}},required:["emailSendId"]}},{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. Optional when `prompt` is provided because the generated subject will be used."},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},prompt:{type:"string",description:"Generate campaign blocks from a prompt. Mutually exclusive with `html`, `blocks`, and `templateId`."},style:{type:"string",description:"Prompt generation style: minimal, branded, promotional. Only used with `prompt`."},tone:{type:"string",description:"Prompt generation tone: professional, casual, friendly. Only used with `prompt`."},templateId:{type:"string",description:"Use a template instead of html"},segmentId:{type:"string",description:"Target segment ID"},campaignData:{type:"object",description:"Optional campaign-scoped JSON data for repeat blocks and personalization."},computedLists:{type:"array",description:"Optional computed list definitions derived from campaignData at send time.",items:{type:"object"}},labels:{type:"array",description:"Optional label names to assign. Missing labels are created automatically.",items:{type:"string"}}},required:["name"]}},{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"},trackingCode:{type:"string",description:"Optional campaign tracking code for UTM templates. Use only when explicitly requested. Send an empty string to clear it."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }.",items:{type:"object"}},replyTo:{type:"string",description:"Set reply-to using an existing reply profile email address for this company."},replyProfileId:{type:"string",description:"Set reply-to using a reply profile ID for this company."},campaignData:{type:"object",description:"Set campaign-scoped JSON data for repeat blocks and personalization."},computedLists:{type:"array",description:"Set computed list definitions derived from campaignData at send time.",items:{type:"object"}},labels:{type:"array",description:"Replacement label names. Send an empty array to clear labels. Missing labels are created automatically.",items:{type:"string"}}},required:["campaignId"],additionalProperties:!1}},{name:"schedule_campaign",description:"Schedule a draft or already scheduled campaign. Returns dashboard edit and preview URLs.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},scheduledAt:{type:"string",description:"Future ISO 8601 timestamp for the send, for example 2026-06-01T14:00:00Z."},targetLists:{type:"object",description:"Optional campaign targeting object. Omit to use saved targeting or all active subscribers. Examples: {type:'all'}, {type:'lists', listIds:['list_123']}, {type:'segment', segmentId:'seg_123'}, or {type:'filtered', filters:[...], filterJoinOperator:'and'}.",additionalProperties:!0},sendTimeOptimization:{type:"boolean",description:"Whether to use send-time optimization."},spreadOverHours:{type:"number",description:"Spread delivery over an integer number of hours from 1 to 72. When set, spread delivery takes precedence over send-time optimization."}},required:["campaignId","scheduledAt"],additionalProperties:!1}},{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 plus editable step content. The response includes sequence.emails with each step's nodeId, linked emailId, subject, previewText, and blocks.",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"],additionalProperties:!1}},{name:"create_sequence",description:`Create a new email sequence. Provide either a goal for AI generation or explicit steps. Explicit steps can include email content and create_discount actions; emails after a discount action can use merge tags such as {{discount.code}} and {{discount.percentOff}}. For AI-generated sequences, the tool polls until emails are generated (typically 30-60 seconds).
|
|
49
47
|
|
|
50
48
|
IMPORTANT GUIDELINES:
|
|
51
49
|
|
|
@@ -174,4 +172,6 @@ BUILT-IN EVENTS (auto-fired by payment integrations):
|
|
|
174
172
|
|
|
175
173
|
OTHER BUILT-IN EVENTS:
|
|
176
174
|
- email.opened, email.clicked, email.replied, email.bounced, email.unsubscribed
|
|
177
|
-
- contact.subscribed, contact.unsubscribed`,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","segment_entered","event_received","inactivity","frequency"],description:"Trigger type: 'contact_added' (when added to a list), 'tag_added' (when tag is applied), 'segment_entered' (when a contact newly enters a saved segment), '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)"},segmentId:{type:"string",description:"Segment ID to trigger on (required for segment_entered trigger). Use list_segments first to choose a saved segment."},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, max: 10)"},goal:{type:"string",description:"What this sequence should accomplish for AI generation. Be specific to the app's actual features and user journey. Avoid generic goals that don't match the app's business model."},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Sequence re-entry mode. Use 'matching_field' only for event_received triggers when duplicate active runs should be blocked per event field value."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Leave omitted for Shopify back-in-stock/replenishment product-variant defaults."},stopCondition:{type:"object",description:"Optional explicit auto-stop condition. Use { type: 'has_tag', value: 'customer' } to end the sequence when a subscriber gets a tag, { type: 'does_not_have_tag', value: 'trial' } when a tag is removed, { type: 'removed_from_list', value: 'list_123' } when they leave a list, { type: 'event_received', value: 'onboarding.completed' } when an event is tracked, or { type: 'none', value: null } for no auto-stop.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"],description:"Stop condition type."},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition. Use null or omit for type 'none'."}},required:["type"]},steps:{type:"array",description:"Explicit sequence steps. Omit type for email steps, or use type: 'create_discount' for a Stripe discount action. Later email steps can reference the most recent discount with {{discount.code}}, {{discount.percentOff}}, {{discount.amountOff}}, and {{discount.expiresAt}}.",items:{type:"object",properties:{type:{type:"string",enum:["email","create_discount","discount"],description:"Step type. Omit or use 'email' for email content. Use 'create_discount' to generate a discount code before later emails."},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:"Sequenzy email blocks. Provide blocks or html for email steps. Blocks can include repeat blocks over array variables such as items.",items:{type:"object"}},html:{type:"string",description:"HTML content for email steps. Will be converted to Sequenzy blocks."},delay:{type:"object",description:"Delay before this step.",properties:{days:{type:"number"},hours:{type:"number"},minutes:{type:"number"}}},name:{type:"string",description:"Email template name for email steps."},discount:{type:"object",description:"Discount configuration for create_discount steps. Prefer this nested shape for new integrations; legacy top-level discount fields are still accepted.",properties:{label:{type:"string",description:"Builder label for the discount step."},provider:{type:"string",enum:["stripe"],description:"Discount provider. Currently only 'stripe'."},discountType:{type:"string",enum:["percent","amount"],description:"Discount type."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Stripe-only. Restrict each generated promotion code to the matched subscriber's Stripe customer."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."},name:{type:"string",description:"Optional provider coupon name."}}},label:{type:"string",description:"Legacy top-level discount label. Prefer discount.label."},provider:{type:"string",enum:["stripe"],description:"Legacy top-level discount provider. Prefer discount.provider."},discountType:{type:"string",enum:["percent","amount"],description:"Legacy top-level discount type. Prefer discount.discountType."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Legacy top-level Stripe-only flag. Prefer discount.lockToSubscriber."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."}}}}},required:["name","trigger"]}},{name:"update_sequence",description:"Update an existing sequence. To target a specific step, use the emailId or nodeId returned in get_sequence.sequence.emails. You can also update enrollmentMode and enrollmentFieldPath for event-triggered matching-field enrollment. When inserting an if/else branch, include steps for every branch arm and elseSteps so the branch is usable immediately. Branch conditions support tags, lists, saved segments, custom events, clicked links, and subscriber field comparisons.",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"},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Updated sequence re-entry mode. 'matching_field' is only valid for event-based sequence triggers."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Omit to leave unchanged. Use clearEnrollmentFieldPath to clear it."},clearEnrollmentFieldPath:{type:"boolean",description:"Set true to clear enrollmentFieldPath without sending a nullable schema value."},stopCondition:{type:"object",description:"Update the sequence auto-stop condition. Example: { type: 'has_tag', value: 'customer' } ends the sequence when the subscriber has that tag. Use { type: 'removed_from_list', value: 'list_123' } to stop when they leave a list, or { type: 'none', value: null } to clear it.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"]},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition."}},required:["type"]},branch:{type:"object",description:"Insert an if/else branch into an existing sequence. The branch is inserted after afterNodeId and creates an if path plus an else fallback path. Use get_sequence first to choose afterNodeId. Each branch condition should include steps, and elseSteps is required unless allowEmptyPaths is true. Conditions support tags, lists, saved segments, events, clicked links, and field comparisons. Use activityScope for event_received and link_clicked checks.",properties:{afterNodeId:{type:"string",description:"Existing node ID to insert the branch after. Use a nodeId from get_sequence.sequence.nodes or get_sequence.sequence.emails."},label:{type:"string",description:"Optional branch node label."},branches:{type:"array",description:"Conditional branches evaluated in order. An else fallback is created automatically.",items:{type:"object",properties:{id:{type:"string",description:"Optional stable branch ID. Defaults to branch-0, branch-1, etc."},label:{type:"string",description:"Display label, e.g. 'If has customer tag'."},conditionType:{type:"string",enum:["has_tag","in_list","in_segment","event_received","link_clicked","field_equals","field_contains","field_greater_than","field_less_than"],description:"Condition type for this branch."},tagName:{type:"string",description:"Tag name for has_tag conditions. This can be used instead of tagId."},tagId:{type:"string",description:"Tag ID or tag name for has_tag conditions."},listId:{type:"string",description:"List ID for in_list conditions."},segmentId:{type:"string",description:"Segment ID for in_segment conditions."},segmentName:{type:"string",description:"Optional display name for in_segment conditions."},eventName:{type:"string",description:"Event name for event_received conditions, such as project.invite.accepted."},linkUrl:{type:"string",description:"Optional URL substring for link_clicked conditions. Omit to match any clicked link."},activityScope:{type:"string",enum:["ever","this_sequence","previous_email"],description:"Scope for event_received and link_clicked conditions. Omit to check ever."},fieldName:{type:"string",description:"Subscriber attribute name for field conditions."},fieldValue:{type:"string",description:"Comparison value for field conditions."},steps:{type:"array",description:"Steps to create inside this branch path. Required by default so the branch is not an empty placeholder.",items:B5}},required:["conditionType"]}},elseSteps:{type:"array",description:"Steps to create inside the else fallback path. Required by default so the else arm is usable.",items:B5},allowEmptyPaths:{type:"boolean",description:"Set true only when intentionally creating empty UI placeholders. Normal API/MCP use should omit this and provide branch steps plus elseSteps."}},required:["afterNodeId","branches"]},emails:{type:"array",description:"Updated sequence emails. If you omit emailId/nodeId, items are matched by existing step order.",items:{type:"object",properties:{emailId:{type:"string",description:"Optional target linked email template ID for a step. Use the emailId returned in get_sequence.sequence.emails."},nodeId:{type:"string",description:"Optional target action_email node ID for a step. Use the nodeId returned in get_sequence.sequence.emails."},name:{type:"string",description:"Updated step/template name"},subject:{type:"string",description:"Updated email subject"},previewText:{type:"string",description:"Updated preview text"},html:{type:"string",description:"Updated HTML content. Will be converted to Sequenzy blocks."},htmlContent:{type:"string",description:"Alias for html. Use this when updating HTML content for a step."},blocks:{type:"array",description:"Updated Sequenzy block JSON for the step",items:{type:"object"}}}}},steps:{type:"array",description:"Alias for emails. Supports the same fields and matching rules.",items:{type:"object",properties:{emailId:{type:"string",description:"Optional target linked email template ID for a step. Use the emailId returned in get_sequence.sequence.emails."},nodeId:{type:"string",description:"Optional target action_email node ID for a step. Use the nodeId returned in get_sequence.sequence.emails."},name:{type:"string",description:"Updated step/template name"},subject:{type:"string",description:"Updated email subject"},previewText:{type:"string",description:"Updated preview text"},html:{type:"string",description:"Updated HTML content. Will be converted to Sequenzy blocks."},htmlContent:{type:"string",description:"Alias for html. Use this when updating HTML content for a step."},blocks:{type:"array",description:"Updated Sequenzy block JSON for the step",items:{type:"object"}}}}}},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:"cancel_sequence_enrollments",description:"Cancel active/waiting enrollments in one sequence. Provide sequenceId and exactly one target: subscriberId for one subscriber, or fieldValues to match stored entry event properties. For fieldValues, fieldPath is optional when the sequence has enrollmentFieldPath configured; otherwise provide a dot path such as order.id.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID whose enrollments should be cancelled."},subscriberId:{type:"string",description:"Subscriber ID to cancel in this sequence. Provide subscriberId or fieldValues, not both."},fieldPath:{type:"string",description:"Dot-path inside the token's stored entry event properties, such as order.id or event.id. Optional when the sequence has enrollmentFieldPath configured."},fieldValues:{type:"array",items:{type:"string"},description:"Entry field values to match. Cancels all active/waiting enrollments in the sequence whose entry field value is in this list. Provide fieldValues or subscriberId, not both."},dryRun:{type:"boolean",description:"When true, returns matching enrollments without cancelling them. Field-value cancellation defaults to dryRun on the API unless explicitly false."},reason:{type:"string",description:"Optional cancellation reason stored on matched enrollment tokens."}},required:["sequenceId"],additionalProperties:!1}},{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:"list_transactional_emails",description:"List transactional email templates, including their API slugs and linked email IDs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_transactional_email",description:"Get a transactional email by ID or slug, including subject, preview text, blocks, variables, and linked dashboard URLs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},idOrSlug:{type:"string",description:"Transactional email ID or API slug, for example `welcome-email`."}},required:["idOrSlug"]}},{name:"create_transactional_email",description:"Create a saved transactional email template with an API slug. Provide `prompt` to generate the email with AI, or provide either `html` or Sequenzy `blocks` for the email body.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Transactional email name."},slug:{type:"string",description:"Optional API slug used when sending by slug, for example `password-reset`. If omitted, Sequenzy generates one from the name."},subject:{type:"string",description:"Email subject line. Optional when `prompt` is provided because the generated subject will be used."},previewText:{type:["string","null"],description:"Email preview text."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }. Mutually exclusive with `html`.",items:{type:"object"}},prompt:{type:"string",description:"Generate transactional email blocks from a prompt. Mutually exclusive with `html` and `blocks`."},style:{type:"string",description:"Prompt generation style: minimal, branded, promotional. Only used with `prompt`."},tone:{type:"string",description:"Prompt generation tone: professional, casual, friendly. Only used with `prompt`."},enabled:{type:"boolean",description:"Whether this transactional email can be sent immediately. Defaults to true."}},required:["name"],additionalProperties:!1}},{name:"update_transactional_email",description:"Update a transactional email by ID or slug. At least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` is required. Use `html` or `blocks` to replace the linked email body.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},idOrSlug:{type:"string",description:"Transactional email ID or API slug, for example `welcome-email`."},name:{type:"string",description:"Transactional email name."},enabled:{type:"boolean",description:"Whether this transactional email can be sent."},subject:{type:"string",description:"Email subject line."},previewText:{type:["string","null"],description:"Email preview text."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks, including conditional and repeat blocks. Mutually exclusive with `html`.",items:{type:"object"}}},required:["idOrSlug"],additionalProperties:!1}},{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. Nested objects and arrays are supported for repeat blocks, for example { items: [...] }."},subscriberExternalId:{type:"string",description:"Customer-owned subscriber ID for attaching analytics/localization on single-recipient sends."}},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, including per-step failed subscribers and failure reasons",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 recent activity, email stats, and current sequence enrollments 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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{name:"generate_email",description:"Generate email blocks 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, max: 10)"},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 V5(Q,X){try{let Y;switch(Q){case"get_account":{let G=await Z("GET","/api/v1/account"),$=m1();Y={...G,selectedCompanyId:$??G.currentCompanyId};break}case"select_company":{let G=X.companyId,$=await Z("GET","/api/v1/account"),J=$.companies?.find((z)=>z.id===G);if(!J)throw Error(`Company not found. Available companies: ${$.companies?.map((z)=>`${z.name} (${z.id})`).join(", ")??"none"}`);RX(G),Y={success:!0,message:`Switched to company: ${J.name}`,companyId:J.id,companyName:J.name};break}case"get_app_urls":{let G=await F5(X);Y={...K1({companyId:G,campaignId:j(X,"campaignId"),sequenceId:j(X,"sequenceId"),emailId:j(X,"emailId")??j(X,"templateId"),transactionalId:j(X,"transactionalId"),emailSendId:j(X,"emailSendId"),domainId:j(X,"domainId"),status:j(X,"status"),settingsTab:j(X,"settingsTab")}),...G===void 0&&{note:"No company ID is selected. Call get_account, select_company, or pass companyId to get concrete dashboard URLs."}};break}case"create_company":{let G=await Z("POST","/api/v1/companies",{name:X.name,domain:X.domain});if(!G.success)throw Error("Failed to create company");let $=G.company.id,J=6,z=0,H=G.company.status;while(H==="processing"&&z<J){await new Promise((K)=>setTimeout(K,20000)),z++;let A=await Z("GET",`/api/v1/companies/${$}`);if(A.success)H=A.company.status}RX($);let U=await Z("GET",`/api/v1/companies/${$}`);Y={success:!0,company:U.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${U.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=X.companyId;Y=await Z("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=X.companyId;Y=await Z("POST","/api/v1/api-keys",{name:X.name},G);break}case"list_websites":{let G=X.companyId;Y=await Z("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=X.companyId;Y=await Z("POST","/api/v1/websites",{domain:X.domain},G);break}case"check_website":{let G=X.companyId;Y=await Z("GET",`/api/v1/websites/${X.domain}`,void 0,G);break}case"get_integration_guide":Y=await Z("POST","/api/v1/integration-guide",X);break;case"add_subscriber":{let G=X.companyId,$=u4("add_subscriber",X);Y=await Z("POST","/api/v1/subscribers",{...$,customAttributes:X.attributes,tags:X.tags,lists:X.listIds,...X.status!==void 0&&{status:X.status},...X.optInMode!==void 0&&{optInMode:X.optInMode}},G);break}case"update_subscriber":{let G=X.companyId,$=u4("update_subscriber",X),J=await TX($,G),z=Array.isArray(J.subscriber.tags)?J.subscriber.tags.filter((B)=>typeof B==="string"):[],H=Array.isArray(X.addTags)?X.addTags.filter((B)=>typeof B==="string"&&B.trim()!=="").map(D5):[],U=new Set(Array.isArray(X.removeTags)?X.removeTags.filter((B)=>typeof B==="string"&&B.trim()!=="").map(D5):[]),A=z.filter((B)=>!U.has(B));for(let B of H)if(!A.includes(B))A.push(B);let K={};if($.email&&$.externalId)K.externalId=$.externalId;if(D0(X.attributes))K.customAttributes={...D0(J.subscriber.customAttributes)?J.subscriber.customAttributes:{},...X.attributes};if(X.addTags||X.removeTags)K.tags=A;Y=await Z("PATCH",SX($),K,G);break}case"remove_subscriber":{let G=X.companyId,$=u4("remove_subscriber",X),J=SX($);if(X.hardDelete===!0)Y=await Z("DELETE",J,void 0,G);else Y=await Z("PATCH",J,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=X.companyId,$=u4("get_subscriber",X);Y=await TX($,G);break}case"search_subscribers":{let G=X.companyId;Y=await OM(X,G);break}case"list_tags":{let G=X.companyId;Y=await Z("GET","/api/v1/tags",void 0,G);break}case"list_lists":{let G=X.companyId;Y=await Z("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=X.companyId;Y=await Z("POST","/api/v1/lists",X,G);break}case"list_segments":{let G=X.companyId;Y=await Z("GET","/api/v1/segments",void 0,G);break}case"create_segment":{UM(X);let G=X.companyId;Y=await Z("POST","/api/v1/segments",{...X,...X.filters!==void 0?{filters:L5(X.filters)}:{},...X.root!==void 0?{root:q5(X.root)}:{}},G);break}case"get_segment_count":{let G=X.companyId;Y=await Z("GET",`/api/v1/segments/${X.segmentId}/count`,void 0,G);break}case"list_templates":{let G=X.companyId,$=new URLSearchParams,J=j(X,"label");if(J)$.set("label",J);Y=await Z("GET",`/api/v1/templates${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_template":{let G=X.companyId;Y=await Z("GET",`/api/v1/templates/${X.templateId}`,void 0,G);break}case"create_template":{let G=X.companyId;N1("create_template",X,{requireContent:!0}),HQ("create_template",X),Y=await Z("POST","/api/v1/templates",X,G);break}case"update_template":{let G=X.companyId,$=new Set(["companyId","templateId","name","subject","html","blocks","labels"]),J=Object.keys(X).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);if(N1("update_template",X),HQ("update_template",X),X.name===void 0&&X.subject===void 0&&X.html===void 0&&X.blocks===void 0&&X.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, or `labels` when calling `update_template`.");Y=await Z("PUT",`/api/v1/templates/${X.templateId}`,X,G);break}case"delete_template":{let G=X.companyId;Y=await Z("DELETE",`/api/v1/templates/${X.templateId}`,void 0,G);break}case"list_ab_tests":{let G=X.companyId,$=new URLSearchParams,J=j(X,"sequenceId");if(J)$.set("sequenceId",J);Y=await Z("GET",`/api/v1/ab-tests${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_ab_test":{let G=X.companyId;Y=await Z("GET",`/api/v1/ab-tests/${X.abTestId}`,void 0,G);break}case"get_ab_test_stats":{let G=X.companyId,$=new URLSearchParams,J=j(X,"period"),z=j(X,"start"),H=j(X,"end");if(J)$.set("period",J);if(z)$.set("start",z);if(H)$.set("end",H);Y=await Z("GET",`/api/v1/ab-tests/${X.abTestId}/stats${$.size>0?`?${$}`:""}`,void 0,G);break}case"restart_ab_test":{let G=X.companyId,$=new Set(["companyId","abTestId","sourceVariantId","testType","winnerThreshold","variantCount"]),J=Object.keys(X).filter((A)=>!$.has(A));if(J.length>0)throw Error(`\`restart_ab_test\` accepts only \`sourceVariantId\`, \`testType\`, \`winnerThreshold\`, and \`variantCount\` option fields. Unsupported field${J.length===1?"":"s"}: ${J.map((A)=>`\`${A}\``).join(", ")}.`);let z=j(X,"testType");if(z!==void 0&&z!=="subject"&&z!=="content")throw Error("`restart_ab_test` testType must be `subject` or `content`.");let H=X.winnerThreshold===void 0?void 0:Number(X.winnerThreshold);if(H!==void 0&&(!Number.isInteger(H)||H<10||H>1000))throw Error("`restart_ab_test` winnerThreshold must be an integer from 10 to 1000.");let U=X.variantCount===void 0?void 0:Number(X.variantCount);if(U!==void 0&&(!Number.isInteger(U)||U<2||U>4))throw Error("`restart_ab_test` variantCount must be an integer from 2 to 4.");Y=await Z("POST",`/api/v1/ab-tests/${X.abTestId}/restart`,{sourceVariantId:j(X,"sourceVariantId"),testType:z,winnerThreshold:H,variantCount:U},G);break}case"update_ab_test_variant":{let G=X.companyId,$=new Set(["companyId","abTestId","variantId","subject","previewText","html","blocks"]),J=Object.keys(X).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`update_ab_test_variant\` accepts only \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);if(N1("update_ab_test_variant",X),X.subject===void 0&&X.previewText===void 0&&X.html===void 0&&X.blocks===void 0)throw Error("Provide at least one of `subject`, `previewText`, `html`, or `blocks` when calling `update_ab_test_variant`.");Y=await Z("PATCH",`/api/v1/ab-tests/${X.abTestId}/variants/${X.variantId}`,X,G);break}case"list_campaigns":{let G=X.companyId,$=new URLSearchParams;if(X.status)$.set("status",String(X.status));let J=j(X,"label");if(J)$.set("label",J);Y=await Z("GET",`/api/v1/campaigns?${$}`,void 0,G);break}case"get_campaign":{let G=X.companyId;Y=await Z("GET",`/api/v1/campaigns/${X.campaignId}`,void 0,G);break}case"get_email_send":{let G=X.companyId;Y=await Z("GET",`/api/v1/email-sends/${encodeURIComponent(String(X.emailSendId))}`,void 0,G);break}case"create_campaign":{let G=X.companyId;BM(X);let $=j(X,"prompt");if($!==void 0){let J=await Z("POST","/api/v1/generate/email",{prompt:$,...X.style!==void 0&&{style:X.style},...X.tone!==void 0&&{tone:X.tone}},G),z=j(X,"subject")??(typeof J.subject==="string"&&J.subject.trim()!==""?J.subject.trim():void 0);if(!z)throw Error("`create_campaign` prompt generation did not return a subject. Provide `subject` explicitly.");let H=Array.isArray(J.blocks)&&J.blocks.length>0?J.blocks:void 0,U=typeof J.html==="string"&&J.html.trim()!==""?J.html:void 0;if(H===void 0&&U===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");Y=await Z("POST","/api/v1/campaigns",{name:X.name,subject:z,...H!==void 0?{blocks:H}:{html:U},...X.segmentId!==void 0&&{segmentId:X.segmentId},...X.trackingCode!==void 0&&{trackingCode:X.trackingCode},...X.campaignData!==void 0&&{campaignData:X.campaignData},...X.computedLists!==void 0&&{computedLists:X.computedLists},...X.labels!==void 0&&{labels:X.labels}},G);break}Y=await Z("POST","/api/v1/campaigns",X,G);break}case"update_campaign":{let G=X.companyId,$=new Set(["companyId","campaignId","name","subject","trackingCode","html","blocks","replyTo","replyProfileId","campaignData","computedLists","labels"]),J=Object.keys(X).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`trackingCode\`, \`html\`, \`blocks\`, \`replyTo\`, \`replyProfileId\`, \`campaignData\`, \`computedLists\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);if(N1("update_campaign",X),HQ("update_campaign",X),X.replyTo!==void 0&&X.replyProfileId!==void 0)throw Error("Provide either `replyTo` or `replyProfileId` when calling `update_campaign`, not both.");if(X.name===void 0&&X.subject===void 0&&X.trackingCode===void 0&&X.html===void 0&&X.blocks===void 0&&X.replyTo===void 0&&X.replyProfileId===void 0&&X.campaignData===void 0&&X.computedLists===void 0&&X.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `trackingCode`, `html`, `blocks`, `replyTo`, `replyProfileId`, `campaignData`, `computedLists`, or `labels` when calling `update_campaign`.");Y=await Z("PUT",`/api/v1/campaigns/${X.campaignId}`,X,G);break}case"schedule_campaign":{let G=X.companyId,$=new Set(["companyId","campaignId","scheduledAt","targetLists","sendTimeOptimization","spreadOverHours"]),J=Object.keys(X).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`schedule_campaign\` accepts only \`campaignId\`, \`scheduledAt\`, \`targetLists\`, \`sendTimeOptimization\`, and \`spreadOverHours\`. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);DM(X),Y=await Z("POST",`/api/v1/campaigns/${X.campaignId}/schedule`,{scheduledAt:X.scheduledAt,...X.targetLists!==void 0&&{targetLists:X.targetLists},...X.sendTimeOptimization!==void 0&&{sendTimeOptimization:X.sendTimeOptimization},...X.spreadOverHours!==void 0&&{spreadOverHours:X.spreadOverHours}},G);break}case"send_test_email":{let G=X.companyId;Y=await Z("POST",`/api/v1/campaigns/${X.campaignId}/test`,{to:X.to},G);break}case"list_sequences":{let G=X.companyId;Y=await Z("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=X.companyId;Y=await Z("GET",`/api/v1/sequences/${X.sequenceId}`,void 0,G);break}case"create_sequence":{let G=X.companyId,$=Array.isArray(X.steps)&&X.steps.length>0,J=await Z("POST","/api/v1/sequences",X,G);if(!J.success){Y=J;break}let z=J.sequence.id;if($){let B=await Z("GET",`/api/v1/sequences/${z}`,void 0,G);if(B.success)Y={success:!0,sequence:B.sequence,message:`Sequence "${B.sequence.name}" created with explicit steps. Review it before enabling.`};else Y=B;break}let H=6,U=0,A="pending";while(A!=="complete"&&U<H){await new Promise((L)=>setTimeout(L,20000)),U++;let B=await Z("GET",`/api/v1/sequences/${z}`,void 0,G);if(B.success)A=B.sequence.enrichmentStatus}let K=await Z("GET",`/api/v1/sequences/${z}`,void 0,G);if(K.success)Y={success:!0,sequence:K.sequence,message:K.sequence.enrichmentStatus==="complete"?`Sequence "${K.sequence.name}" created with ${K.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${K.sequence.name}" created. Email enrichment is still in progress (${K.sequence.enrichedCount}/${K.sequence.emailCount} emails generated). You can check status with get_sequence.`};else Y=K;break}case"update_sequence":{let G=X.companyId,$=AM(X);Y=await Z("PUT",`/api/v1/sequences/${X.sequenceId}`,$,G);break}case"enable_sequence":{let G=X.companyId;Y=await Z("POST",`/api/v1/sequences/${X.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=X.companyId;Y=await Z("POST",`/api/v1/sequences/${X.sequenceId}/disable`,void 0,G);break}case"cancel_sequence_enrollments":{let G=X.companyId,$=KM(X);Y=await Z("POST",`/api/v1/sequences/${X.sequenceId}/enrollments/cancel`,$,G);break}case"delete_sequence":{let G=X.companyId;Y=await Z("DELETE",`/api/v1/sequences/${X.sequenceId}`,void 0,G);break}case"list_transactional_emails":{let G=X.companyId;Y=await Z("GET","/api/v1/transactional",void 0,G);break}case"get_transactional_email":{let G=X.companyId;Y=await Z("GET",`/api/v1/transactional/${X.idOrSlug}`,void 0,G);break}case"create_transactional_email":{let G=X.companyId,$=new Set(["companyId","name","slug","subject","previewText","html","blocks","prompt","style","tone","enabled"]),J=Object.keys(X).filter((U)=>!$.has(U));if(J.length>0)throw Error(`\`create_transactional_email\` accepts only \`name\`, \`slug\`, \`subject\`, \`previewText\`, \`html\`, \`blocks\`, \`prompt\`, \`style\`, \`tone\`, and \`enabled\` fields. Unsupported field${J.length===1?"":"s"}: ${J.map((U)=>`\`${U}\``).join(", ")}.`);LM(X);let z=j(X,"prompt");if(z!==void 0){let U={companyId:G??m1()??"",name:typeof X.name==="string"&&X.name.trim()!==""?X.name.trim():"",slug:typeof X.slug==="string"&&X.slug.trim()!==""?X.slug.trim():"",promptLength:z.length,style:typeof X.style==="string"?X.style:"",tone:typeof X.tone==="string"?X.tone:""};try{console.error("[mcp:create_transactional_email] generating from prompt",U);let A=await Z("POST","/api/v1/generate/email",{prompt:z,...X.style!==void 0&&{style:X.style},...X.tone!==void 0&&{tone:X.tone}},G);console.error("[mcp:create_transactional_email] prompt generation complete",{...U,subject:A.subject??"",previewTextLength:typeof A.previewText==="string"?A.previewText.length:0,blockCount:Array.isArray(A.blocks)?A.blocks.length:0,htmlLength:typeof A.html==="string"?A.html.length:0});let K=j(X,"subject")??(typeof A.subject==="string"&&A.subject.trim()!==""?A.subject.trim():void 0);if(!K)throw Error("`create_transactional_email` prompt generation did not return a subject. Provide `subject` explicitly.");let B=Array.isArray(A.blocks)&&A.blocks.length>0?A.blocks:void 0,L=typeof A.html==="string"&&A.html.trim()!==""?A.html:void 0,F=j(X,"previewText")??(typeof A.previewText==="string"?A.previewText.trim():void 0);if(B===void 0&&L===void 0)throw Error("`create_transactional_email` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");console.error("[mcp:create_transactional_email] creating generated transactional",{...U,subject:K,contentSource:B!==void 0?"blocks":"html",blockCount:B?.length??0,htmlLength:L?.length??0}),Y=await Z("POST","/api/v1/transactional",{name:X.name,...X.slug!==void 0&&{slug:X.slug},subject:K,...F!==void 0&&{previewText:F},...B!==void 0?{blocks:B}:{html:L},...X.enabled!==void 0&&{enabled:X.enabled}},G),console.error("[mcp:create_transactional_email] generated transactional created",U)}catch(A){throw console.error("[mcp:create_transactional_email] prompt-based create failed",{...U,error:A instanceof Error?A.message:String(A)}),A}break}let H=Object.fromEntries(Object.entries(X).filter(([U])=>U!=="companyId"));Y=await Z("POST","/api/v1/transactional",H,G);break}case"update_transactional_email":{let G=X.companyId,$=new Set(["companyId","idOrSlug","name","enabled","subject","previewText","html","blocks"]),J=Object.keys(X).filter((H)=>!$.has(H));if(J.length>0)throw Error(`\`update_transactional_email\` accepts only \`name\`, \`enabled\`, \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((H)=>`\`${H}\``).join(", ")}.`);if(N1("update_transactional_email",X),X.name===void 0&&X.enabled===void 0&&X.subject===void 0&&X.previewText===void 0&&X.html===void 0&&X.blocks===void 0)throw Error("Provide at least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` when calling `update_transactional_email`.");let z=Object.fromEntries(Object.entries(X).filter(([H])=>H!=="companyId"&&H!=="idOrSlug"));Y=await Z("PATCH",`/api/v1/transactional/${X.idOrSlug}`,z,G);break}case"send_email":{let G=X.companyId;Y=await Z("POST","/api/v1/transactional/send",X,G);break}case"get_stats":{let G=X.companyId,$=X.period??"7d";Y=await Z("GET",`/api/v1/metrics?period=${$}`,void 0,G);break}case"get_campaign_stats":{let G=X.companyId;Y=await Z("GET",`/api/v1/metrics/campaigns/${X.campaignId}`,void 0,G);break}case"get_sequence_stats":{let G=X.companyId;Y=await Z("GET",`/api/v1/metrics/sequences/${X.sequenceId}`,void 0,G);break}case"get_subscriber_activity":{let G=X.companyId,$=u4("get_subscriber_activity",X),J=await TX($,G);Y={success:J.success,email:J.subscriber.email,emailStats:J.subscriber.emailStats??null,activity:J.subscriber.activity??[],sequenceEnrollments:J.subscriber.sequenceEnrollments??[]};break}case"generate_email":{let G=X.companyId;Y=await Z("POST","/api/v1/generate/email",X,G);break}case"generate_sequence":{let G=X.companyId;Y=await Z("POST","/api/v1/generate/sequence",X,G);break}case"generate_subject_lines":{let G=X.companyId;Y=await Z("POST","/api/v1/generate/subjects",X,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=qM(Y);if(W)throw W;return Y=await NM(Q,X,Y),{content:[{type:"text",text:JSON.stringify(Y,null,2)}]}}catch(Y){return{isError:!0,content:[{type:"text",text:Z1(Y)}]}}}var wM=process.env.SEQUENZY_API_URL??"https://api.sequenzy.com",Z5=process.env.SEQUENZY_API_KEY,CX=null;if(!Z5)console.error(Z1(new l1("SEQUENZY_API_KEY environment variable is required",401,void 0,"MCP_AUTH_REQUIRED"))),process.exit(1);function m1(){return CX}function RX(Q){CX=Q}var f4=new PX({name:"sequenzy",version:z5.version},{capabilities:{tools:{},resources:{}}});function N0(Q,X){let Y=Q[X];return typeof Y==="string"&&Y.trim()!==""?Y.trim():void 0}function bM(Q){if(Q===void 0)return;if(typeof Q==="string")return Q.trim()||void 0;return JSON.stringify(Q)}function PM(Q){if(!Q.trim())return{message:"Request failed"};try{let X=JSON.parse(Q);if(typeof X==="string")return{message:X};let Y=typeof X.error==="object"&&X.error!==null?X.error:void 0,W=N0(X,"code")??(Y?N0(Y,"code"):void 0),G=(typeof X.error==="string"?X.error:void 0)??(Y?N0(Y,"message"):void 0)??N0(X,"message")??N0(X,"error")??Q,$=N0(X,"howToFix")??N0(X,"resolution"),J={...N0(X,"title")?{title:N0(X,"title")}:{},...N0(X,"description")?{description:N0(X,"description")}:{},...$?{howToFix:$}:{},...N0(X,"docsUrl")?{docsUrl:N0(X,"docsUrl")}:{}},z=bM(X.details);if(Object.keys(J).length>0||z)return{message:G,...W?{code:W}:{},...z?{details:z}:{},...Object.keys(J).length>0?{context:J}:{}};if(typeof X.error==="string")return{message:X.error,...W?{code:W}:{}};if(Y)return{message:G,...W?{code:W}:{}};return{message:G,...W?{code:W}:{}}}catch{return{message:Q}}}async function Z(Q,X,Y,W){let G={"Content-Type":"application/json",Authorization:`Bearer ${Z5}`},$=W??CX;if($)G["x-company-id"]=$;let J;try{J=await fetch(`${wM}${X}`,{method:Q,headers:G,body:Y?JSON.stringify(Y):void 0})}catch(z){throw new l1(z instanceof Error?z.message:"Failed to reach Sequenzy API",0,void 0,"NETWORK_ERROR")}if(!J.ok){let z=await J.text(),H=PM(z);throw new l1(H.message,J.status,H.details??z,H.code,H.context)}return J.json()}f4.setRequestHandler(K9,async()=>{return{tools:M5}});f4.setRequestHandler(B4,async(Q)=>{let{name:X,arguments:Y}=Q.params;return V5(X,Y??{})});f4.setRequestHandler(G9,async()=>{return{resources:A5}});f4.setRequestHandler(J9,async(Q)=>{let{uri:X}=Q.params;return K5(X)});async function jM(){let Q=new IX;await f4.connect(Q),console.error("Sequenzy MCP server running on stdio")}jM().catch((Q)=>{console.error(Z1(Q)),process.exit(1)});export{RX as setSelectedCompanyId,m1 as getSelectedCompanyId,Z as apiRequest};
|
|
175
|
+
- contact.subscribed, contact.unsubscribed`,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","segment_entered","event_received","inactivity","frequency"],description:"Trigger type: 'contact_added' (when added to a list), 'tag_added' (when tag is applied), 'segment_entered' (when a contact newly enters a saved segment), '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)"},segmentId:{type:"string",description:"Segment ID to trigger on (required for segment_entered trigger). Use list_segments first to choose a saved segment."},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, max: 10)"},goal:{type:"string",description:"What this sequence should accomplish for AI generation. Be specific to the app's actual features and user journey. Avoid generic goals that don't match the app's business model."},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Sequence re-entry mode. Use 'matching_field' only for event_received triggers when duplicate active runs should be blocked per event field value."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Leave omitted for Shopify back-in-stock/replenishment product-variant defaults."},stopCondition:{type:"object",description:"Optional explicit auto-stop condition. Use { type: 'has_tag', value: 'customer' } to end the sequence when a subscriber gets a tag, { type: 'does_not_have_tag', value: 'trial' } when a tag is removed, { type: 'removed_from_list', value: 'list_123' } when they leave a list, { type: 'event_received', value: 'onboarding.completed' } when an event is tracked, or { type: 'none', value: null } for no auto-stop.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"],description:"Stop condition type."},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition. Use null or omit for type 'none'."}},required:["type"]},steps:{type:"array",description:"Explicit sequence steps. Omit type for email steps, or use type: 'create_discount' for a Stripe discount action. Later email steps can reference the most recent discount with {{discount.code}}, {{discount.percentOff}}, {{discount.amountOff}}, and {{discount.expiresAt}}.",items:{type:"object",properties:{type:{type:"string",enum:["email","create_discount","discount"],description:"Step type. Omit or use 'email' for email content. Use 'create_discount' to generate a discount code before later emails."},subject:{type:"string",description:"Email subject. Required for email steps."},previewText:{type:"string",description:"Email preview text."},blocks:{type:"array",description:"Sequenzy email blocks. Provide blocks or html for email steps. Blocks can include repeat blocks over array variables such as items.",items:{type:"object"}},html:{type:"string",description:"HTML content for email steps. Will be converted to Sequenzy blocks."},delay:{type:"object",description:"Delay before this step.",properties:{days:{type:"number"},hours:{type:"number"},minutes:{type:"number"}}},name:{type:"string",description:"Email template name for email steps."},discount:{type:"object",description:"Discount configuration for create_discount steps. Prefer this nested shape for new integrations; legacy top-level discount fields are still accepted.",properties:{label:{type:"string",description:"Builder label for the discount step."},provider:{type:"string",enum:["stripe"],description:"Discount provider. Currently only 'stripe'."},discountType:{type:"string",enum:["percent","amount"],description:"Discount type."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Stripe-only. Restrict each generated promotion code to the matched subscriber's Stripe customer."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."},name:{type:"string",description:"Optional provider coupon name."}}},label:{type:"string",description:"Legacy top-level discount label. Prefer discount.label."},provider:{type:"string",enum:["stripe"],description:"Legacy top-level discount provider. Prefer discount.provider."},discountType:{type:"string",enum:["percent","amount"],description:"Legacy top-level discount type. Prefer discount.discountType."},percentOff:{type:"number",description:"Percent discount from 1 to 100. Required when discountType is percent."},amountOff:{type:"number",description:"Fixed amount discount in the smallest currency unit, for example 500 for $5. Required when discountType is amount."},currency:{type:"string",description:"ISO currency for amount discounts. Defaults to usd."},duration:{type:"string",enum:["once","forever","repeating"],description:"Stripe coupon duration. Defaults to once."},durationInMonths:{type:"number",description:"Required for repeating discounts."},appliesToAllPlans:{type:"boolean",description:"Whether the discount applies to all plans. Defaults to true."},planIds:{type:"array",description:"Stripe product IDs, such as prod_abc123, when appliesToAllPlans is false.",items:{type:"string"}},codePrefix:{type:"string",description:"Optional prefix for generated promotion codes."},maxRedemptions:{type:"number",description:"Maximum promotion code redemptions. Use 1 for subscriber-specific codes."},lockToSubscriber:{type:"boolean",description:"Legacy top-level Stripe-only flag. Prefer discount.lockToSubscriber."},expiresAt:{type:"string",description:"Optional future expiration date or ISO timestamp."},expiresInHours:{type:"number",description:"Optional relative expiration in hours, resolved when each subscriber's code is created (e.g., 48 for a 48-hour window per subscriber). Takes precedence over expiresAt."}}}}},required:["name","trigger"]}},{name:"update_sequence",description:"Update an existing sequence. To target a specific step, use the emailId or nodeId returned in get_sequence.sequence.emails. You can also update enrollmentMode and enrollmentFieldPath for event-triggered matching-field enrollment. When inserting an if/else branch, include steps for every branch arm and elseSteps so the branch is usable immediately. Branch conditions support tags, lists, saved segments, custom events, clicked links, and subscriber field comparisons.",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"},enrollmentMode:{type:"string",enum:["unlimited","one_time","matching_field"],description:"Updated sequence re-entry mode. 'matching_field' is only valid for event-based sequence triggers."},enrollmentFieldPath:{type:"string",description:"Dot-path event property used by enrollmentMode='matching_field', such as 'order.id' or 'product.providerVariantId'. Omit to leave unchanged. Use clearEnrollmentFieldPath to clear it."},clearEnrollmentFieldPath:{type:"boolean",description:"Set true to clear enrollmentFieldPath without sending a nullable schema value."},stopCondition:{type:"object",description:"Update the sequence auto-stop condition. Example: { type: 'has_tag', value: 'customer' } ends the sequence when the subscriber has that tag. Use { type: 'removed_from_list', value: 'list_123' } to stop when they leave a list, or { type: 'none', value: null } to clear it.",properties:{type:{type:"string",enum:["none","has_tag","does_not_have_tag","added_to_list","removed_from_list","event_received"]},value:{type:["string","null"],description:"Tag name, list ID, or event name for the stop condition."}},required:["type"]},branch:{type:"object",description:"Insert an if/else branch into an existing sequence. The branch is inserted after afterNodeId and creates an if path plus an else fallback path. Use get_sequence first to choose afterNodeId. Each branch condition should include steps, and elseSteps is required unless allowEmptyPaths is true. Conditions support tags, lists, saved segments, events, clicked links, and field comparisons. Use activityScope for event_received and link_clicked checks.",properties:{afterNodeId:{type:"string",description:"Existing node ID to insert the branch after. Use a nodeId from get_sequence.sequence.nodes or get_sequence.sequence.emails."},label:{type:"string",description:"Optional branch node label."},branches:{type:"array",description:"Conditional branches evaluated in order. An else fallback is created automatically.",items:{type:"object",properties:{id:{type:"string",description:"Optional stable branch ID. Defaults to branch-0, branch-1, etc."},label:{type:"string",description:"Display label, e.g. 'If has customer tag'."},conditionType:{type:"string",enum:["has_tag","in_list","in_segment","event_received","link_clicked","field_equals","field_contains","field_greater_than","field_less_than"],description:"Condition type for this branch."},tagName:{type:"string",description:"Tag name for has_tag conditions. This can be used instead of tagId."},tagId:{type:"string",description:"Tag ID or tag name for has_tag conditions."},listId:{type:"string",description:"List ID for in_list conditions."},segmentId:{type:"string",description:"Segment ID for in_segment conditions."},segmentName:{type:"string",description:"Optional display name for in_segment conditions."},eventName:{type:"string",description:"Event name for event_received conditions, such as project.invite.accepted."},linkUrl:{type:"string",description:"Optional URL substring for link_clicked conditions. Omit to match any clicked link."},activityScope:{type:"string",enum:["ever","this_sequence","previous_email"],description:"Scope for event_received and link_clicked conditions. Omit to check ever."},fieldName:{type:"string",description:"Subscriber attribute name for field conditions."},fieldValue:{type:"string",description:"Comparison value for field conditions."},steps:{type:"array",description:"Steps to create inside this branch path. Required by default so the branch is not an empty placeholder.",items:L5}},required:["conditionType"]}},elseSteps:{type:"array",description:"Steps to create inside the else fallback path. Required by default so the else arm is usable.",items:L5},allowEmptyPaths:{type:"boolean",description:"Set true only when intentionally creating empty UI placeholders. Normal API/MCP use should omit this and provide branch steps plus elseSteps."}},required:["afterNodeId","branches"]},emails:{type:"array",description:"Updated sequence emails. If you omit emailId/nodeId, items are matched by existing step order.",items:{type:"object",properties:{emailId:{type:"string",description:"Optional target linked email template ID for a step. Use the emailId returned in get_sequence.sequence.emails."},nodeId:{type:"string",description:"Optional target action_email node ID for a step. Use the nodeId returned in get_sequence.sequence.emails."},name:{type:"string",description:"Updated step/template name"},subject:{type:"string",description:"Updated email subject"},previewText:{type:"string",description:"Updated preview text"},html:{type:"string",description:"Updated HTML content. Will be converted to Sequenzy blocks."},htmlContent:{type:"string",description:"Alias for html. Use this when updating HTML content for a step."},blocks:{type:"array",description:"Updated Sequenzy block JSON for the step",items:{type:"object"}}}}},steps:{type:"array",description:"Alias for emails. Supports the same fields and matching rules.",items:{type:"object",properties:{emailId:{type:"string",description:"Optional target linked email template ID for a step. Use the emailId returned in get_sequence.sequence.emails."},nodeId:{type:"string",description:"Optional target action_email node ID for a step. Use the nodeId returned in get_sequence.sequence.emails."},name:{type:"string",description:"Updated step/template name"},subject:{type:"string",description:"Updated email subject"},previewText:{type:"string",description:"Updated preview text"},html:{type:"string",description:"Updated HTML content. Will be converted to Sequenzy blocks."},htmlContent:{type:"string",description:"Alias for html. Use this when updating HTML content for a step."},blocks:{type:"array",description:"Updated Sequenzy block JSON for the step",items:{type:"object"}}}}}},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:"cancel_sequence_enrollments",description:"Cancel active/waiting enrollments in one sequence. Provide sequenceId and exactly one target: subscriberId for one subscriber, or fieldValues to match stored entry event properties. For fieldValues, fieldPath is optional when the sequence has enrollmentFieldPath configured; otherwise provide a dot path such as order.id.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID whose enrollments should be cancelled."},subscriberId:{type:"string",description:"Subscriber ID to cancel in this sequence. Provide subscriberId or fieldValues, not both."},fieldPath:{type:"string",description:"Dot-path inside the token's stored entry event properties, such as order.id or event.id. Optional when the sequence has enrollmentFieldPath configured."},fieldValues:{type:"array",items:{type:"string"},description:"Entry field values to match. Cancels all active/waiting enrollments in the sequence whose entry field value is in this list. Provide fieldValues or subscriberId, not both."},dryRun:{type:"boolean",description:"When true, returns matching enrollments without cancelling them. Field-value cancellation defaults to dryRun on the API unless explicitly false."},reason:{type:"string",description:"Optional cancellation reason stored on matched enrollment tokens."}},required:["sequenceId"],additionalProperties:!1}},{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:"list_transactional_emails",description:"List transactional email templates, including their API slugs and linked email IDs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_transactional_email",description:"Get a transactional email by ID or slug, including subject, preview text, blocks, variables, and linked dashboard URLs",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},idOrSlug:{type:"string",description:"Transactional email ID or API slug, for example `welcome-email`."}},required:["idOrSlug"]}},{name:"create_transactional_email",description:"Create a saved transactional email template with an API slug. Provide `prompt` to generate the email with AI, or provide either `html` or Sequenzy `blocks` for the email body.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Transactional email name."},slug:{type:"string",description:"Optional API slug used when sending by slug, for example `password-reset`. If omitted, Sequenzy generates one from the name."},subject:{type:"string",description:"Email subject line. Optional when `prompt` is provided because the generated subject will be used."},previewText:{type:["string","null"],description:"Email preview text."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional and repeat blocks. Repeat blocks use { type: 'repeat', source: 'items', itemAlias: 'item', children: [...] }. Mutually exclusive with `html`.",items:{type:"object"}},prompt:{type:"string",description:"Generate transactional email blocks from a prompt. Mutually exclusive with `html` and `blocks`."},style:{type:"string",description:"Prompt generation style: minimal, branded, promotional. Only used with `prompt`."},tone:{type:"string",description:"Prompt generation tone: professional, casual, friendly. Only used with `prompt`."},enabled:{type:"boolean",description:"Whether this transactional email can be sent immediately. Defaults to true."}},required:["name"],additionalProperties:!1}},{name:"update_transactional_email",description:"Update a transactional email by ID or slug. At least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` is required. Use `html` or `blocks` to replace the linked email body.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},idOrSlug:{type:"string",description:"Transactional email ID or API slug, for example `welcome-email`."},name:{type:"string",description:"Transactional email name."},enabled:{type:"boolean",description:"Whether this transactional email can be sent."},subject:{type:"string",description:"Email subject line."},previewText:{type:["string","null"],description:"Email preview text."},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks, including conditional and repeat blocks. Mutually exclusive with `html`.",items:{type:"object"}}},required:["idOrSlug"],additionalProperties:!1}},{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. Nested objects and arrays are supported for repeat blocks, for example { items: [...] }."},subscriberExternalId:{type:"string",description:"Customer-owned subscriber ID for attaching analytics/localization on single-recipient sends."}},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, including per-step failed subscribers and failure reasons",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 recent activity, email stats, and current sequence enrollments 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. Provide email or externalId to identify the subscriber."},externalId:{type:"string",description:"Customer-owned subscriber ID. Provide email or externalId to identify the subscriber."}},required:[]}},{name:"generate_email",description:"Generate email blocks 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, max: 10)"},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 Z5(Q,Y){try{let X;switch(Q){case"get_account":{let G=await N("GET","/api/v1/account"),$=s0();X={...G,selectedCompanyId:$??G.currentCompanyId};break}case"select_company":{let G=Y.companyId,$=await N("GET","/api/v1/account"),J=$.companies?.find((z)=>z.id===G);if(!J)throw Error(`Company not found. Available companies: ${$.companies?.map((z)=>`${z.name} (${z.id})`).join(", ")??"none"}`);l4(G),X={success:!0,message:`Switched to company: ${J.name}`,companyId:J.id,companyName:J.name};break}case"get_app_urls":{let G=await M5(Y);X={...B1({companyId:G,campaignId:I(Y,"campaignId"),sequenceId:I(Y,"sequenceId"),emailId:I(Y,"emailId")??I(Y,"templateId"),transactionalId:I(Y,"transactionalId"),emailSendId:I(Y,"emailSendId"),domainId:I(Y,"domainId"),status:I(Y,"status"),settingsTab:I(Y,"settingsTab")}),...G===void 0&&{note:"No company ID is selected. Call get_account, select_company, or pass companyId to get concrete dashboard URLs."}};break}case"create_company":{let G=await N("POST","/api/v1/companies",{name:Y.name,domain:Y.domain});if(!G.success)throw Error("Failed to create company");let $=G.company.id,J=6,z=0,H=G.company.status;while(H==="processing"&&z<J){await new Promise((K)=>setTimeout(K,20000)),z++;let U=await N("GET",`/api/v1/companies/${$}`);if(U.success)H=U.company.status}l4($);let A=await N("GET",`/api/v1/companies/${$}`);X={success:!0,company:A.company,message:H==="processing"?"Company created but still processing. You can continue using it while processing completes.":`Company '${A.company.name}' created and ready to use.`,autoSelected:!0};break}case"get_company":{let G=Y.companyId;X=await N("GET",`/api/v1/companies/${G}`);break}case"create_api_key":{let G=Y.companyId;X=await N("POST","/api/v1/api-keys",{name:Y.name},G);break}case"list_websites":{let G=Y.companyId;X=await N("GET","/api/v1/websites",void 0,G);break}case"add_website":{let G=Y.companyId;X=await N("POST","/api/v1/websites",{domain:Y.domain},G);break}case"check_website":{let G=Y.companyId;X=await N("GET",`/api/v1/websites/${Y.domain}`,void 0,G);break}case"get_integration_guide":X=await N("POST","/api/v1/integration-guide",Y);break;case"add_subscriber":{let G=Y.companyId,$=h4("add_subscriber",Y);X=await N("POST","/api/v1/subscribers",{...$,customAttributes:Y.attributes,tags:Y.tags,lists:Y.listIds,...Y.status!==void 0&&{status:Y.status},...Y.optInMode!==void 0&&{optInMode:Y.optInMode}},G);break}case"update_subscriber":{let G=Y.companyId,$=h4("update_subscriber",Y),J=await T9($,G),z=Array.isArray(J.subscriber.tags)?J.subscriber.tags.filter((D)=>typeof D==="string"):[],H=Array.isArray(Y.addTags)?Y.addTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(F5):[],A=new Set(Array.isArray(Y.removeTags)?Y.removeTags.filter((D)=>typeof D==="string"&&D.trim()!=="").map(F5):[]),U=z.filter((D)=>!A.has(D));for(let D of H)if(!U.includes(D))U.push(D);let K={};if($.email&&$.externalId)K.externalId=$.externalId;if(B0(Y.attributes))K.customAttributes={...B0(J.subscriber.customAttributes)?J.subscriber.customAttributes:{},...Y.attributes};if(Y.addTags||Y.removeTags)K.tags=U;X=await N("PATCH",S9($),K,G);break}case"remove_subscriber":{let G=Y.companyId,$=h4("remove_subscriber",Y),J=S9($);if(Y.hardDelete===!0)X=await N("DELETE",J,void 0,G);else X=await N("PATCH",J,{status:"unsubscribed"},G);break}case"get_subscriber":{let G=Y.companyId,$=h4("get_subscriber",Y);X=await T9($,G);break}case"search_subscribers":{let G=Y.companyId;X=await IM(Y,G);break}case"list_tags":{let G=Y.companyId;X=await N("GET","/api/v1/tags",void 0,G);break}case"list_lists":{let G=Y.companyId;X=await N("GET","/api/v1/lists",void 0,G);break}case"create_list":{let G=Y.companyId;X=await N("POST","/api/v1/lists",Y,G);break}case"list_segments":{let G=Y.companyId;X=await N("GET","/api/v1/segments",void 0,G);break}case"create_segment":{OM(Y);let G=Y.companyId;X=await N("POST","/api/v1/segments",{...Y,...Y.filters!==void 0?{filters:q5(Y.filters)}:{},...Y.root!==void 0?{root:O5(Y.root)}:{}},G);break}case"get_segment_count":{let G=Y.companyId;X=await N("GET",`/api/v1/segments/${Y.segmentId}/count`,void 0,G);break}case"list_templates":{let G=Y.companyId,$=new URLSearchParams,J=I(Y,"label");if(J)$.set("label",J);X=await N("GET",`/api/v1/templates${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_template":{let G=Y.companyId;X=await N("GET",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"create_template":{let G=Y.companyId;b1("create_template",Y,{requireContent:!0}),A6("create_template",Y),X=await N("POST","/api/v1/templates",Y,G);break}case"update_template":{let G=Y.companyId,$=new Set(["companyId","templateId","name","subject","html","blocks","labels"]),J=Object.keys(Y).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`update_template\` accepts only \`name\`, \`subject\`, \`html\`, \`blocks\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);if(b1("update_template",Y),A6("update_template",Y),Y.name===void 0&&Y.subject===void 0&&Y.html===void 0&&Y.blocks===void 0&&Y.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `html`, `blocks`, or `labels` when calling `update_template`.");X=await N("PUT",`/api/v1/templates/${Y.templateId}`,Y,G);break}case"delete_template":{let G=Y.companyId;X=await N("DELETE",`/api/v1/templates/${Y.templateId}`,void 0,G);break}case"list_ab_tests":{let G=Y.companyId,$=new URLSearchParams,J=I(Y,"sequenceId");if(J)$.set("sequenceId",J);X=await N("GET",`/api/v1/ab-tests${$.size>0?`?${$}`:""}`,void 0,G);break}case"get_ab_test":{let G=Y.companyId;X=await N("GET",`/api/v1/ab-tests/${Y.abTestId}`,void 0,G);break}case"get_ab_test_stats":{let G=Y.companyId,$=new URLSearchParams,J=I(Y,"period"),z=I(Y,"start"),H=I(Y,"end");if(J)$.set("period",J);if(z)$.set("start",z);if(H)$.set("end",H);X=await N("GET",`/api/v1/ab-tests/${Y.abTestId}/stats${$.size>0?`?${$}`:""}`,void 0,G);break}case"restart_ab_test":{let G=Y.companyId,$=new Set(["companyId","abTestId","sourceVariantId","testType","winnerThreshold","variantCount"]),J=Object.keys(Y).filter((U)=>!$.has(U));if(J.length>0)throw Error(`\`restart_ab_test\` accepts only \`sourceVariantId\`, \`testType\`, \`winnerThreshold\`, and \`variantCount\` option fields. Unsupported field${J.length===1?"":"s"}: ${J.map((U)=>`\`${U}\``).join(", ")}.`);let z=I(Y,"testType");if(z!==void 0&&z!=="subject"&&z!=="content")throw Error("`restart_ab_test` testType must be `subject` or `content`.");let H=Y.winnerThreshold===void 0?void 0:Number(Y.winnerThreshold);if(H!==void 0&&(!Number.isInteger(H)||H<10||H>1000))throw Error("`restart_ab_test` winnerThreshold must be an integer from 10 to 1000.");let A=Y.variantCount===void 0?void 0:Number(Y.variantCount);if(A!==void 0&&(!Number.isInteger(A)||A<2||A>4))throw Error("`restart_ab_test` variantCount must be an integer from 2 to 4.");X=await N("POST",`/api/v1/ab-tests/${Y.abTestId}/restart`,{sourceVariantId:I(Y,"sourceVariantId"),testType:z,winnerThreshold:H,variantCount:A},G);break}case"update_ab_test_variant":{let G=Y.companyId,$=new Set(["companyId","abTestId","variantId","subject","previewText","html","blocks"]),J=Object.keys(Y).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`update_ab_test_variant\` accepts only \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);if(b1("update_ab_test_variant",Y),Y.subject===void 0&&Y.previewText===void 0&&Y.html===void 0&&Y.blocks===void 0)throw Error("Provide at least one of `subject`, `previewText`, `html`, or `blocks` when calling `update_ab_test_variant`.");X=await N("PATCH",`/api/v1/ab-tests/${Y.abTestId}/variants/${Y.variantId}`,Y,G);break}case"list_campaigns":{let G=Y.companyId,$=new URLSearchParams;if(Y.status)$.set("status",String(Y.status));let J=I(Y,"label");if(J)$.set("label",J);X=await N("GET",`/api/v1/campaigns?${$}`,void 0,G);break}case"get_campaign":{let G=Y.companyId;X=await N("GET",`/api/v1/campaigns/${Y.campaignId}`,void 0,G);break}case"get_email_send":{let G=Y.companyId;X=await N("GET",`/api/v1/email-sends/${encodeURIComponent(String(Y.emailSendId))}`,void 0,G);break}case"create_campaign":{let G=Y.companyId;NM(Y);let $=I(Y,"prompt");if($!==void 0){let J=await N("POST","/api/v1/generate/email",{prompt:$,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G),z=I(Y,"subject")??(typeof J.subject==="string"&&J.subject.trim()!==""?J.subject.trim():void 0);if(!z)throw Error("`create_campaign` prompt generation did not return a subject. Provide `subject` explicitly.");let H=Array.isArray(J.blocks)&&J.blocks.length>0?J.blocks:void 0,A=typeof J.html==="string"&&J.html.trim()!==""?J.html:void 0;if(H===void 0&&A===void 0)throw Error("`create_campaign` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");X=await N("POST","/api/v1/campaigns",{name:Y.name,subject:z,...H!==void 0?{blocks:H}:{html:A},...Y.segmentId!==void 0&&{segmentId:Y.segmentId},...Y.trackingCode!==void 0&&{trackingCode:Y.trackingCode},...Y.campaignData!==void 0&&{campaignData:Y.campaignData},...Y.computedLists!==void 0&&{computedLists:Y.computedLists},...Y.labels!==void 0&&{labels:Y.labels}},G);break}X=await N("POST","/api/v1/campaigns",Y,G);break}case"update_campaign":{let G=Y.companyId,$=new Set(["companyId","campaignId","name","subject","trackingCode","html","blocks","replyTo","replyProfileId","campaignData","computedLists","labels"]),J=Object.keys(Y).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`update_campaign\` accepts only \`name\`, \`subject\`, \`trackingCode\`, \`html\`, \`blocks\`, \`replyTo\`, \`replyProfileId\`, \`campaignData\`, \`computedLists\`, and \`labels\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);if(b1("update_campaign",Y),A6("update_campaign",Y),Y.replyTo!==void 0&&Y.replyProfileId!==void 0)throw Error("Provide either `replyTo` or `replyProfileId` when calling `update_campaign`, not both.");if(Y.name===void 0&&Y.subject===void 0&&Y.trackingCode===void 0&&Y.html===void 0&&Y.blocks===void 0&&Y.replyTo===void 0&&Y.replyProfileId===void 0&&Y.campaignData===void 0&&Y.computedLists===void 0&&Y.labels===void 0)throw Error("Provide at least one of `name`, `subject`, `trackingCode`, `html`, `blocks`, `replyTo`, `replyProfileId`, `campaignData`, `computedLists`, or `labels` when calling `update_campaign`.");X=await N("PUT",`/api/v1/campaigns/${Y.campaignId}`,Y,G);break}case"schedule_campaign":{let G=Y.companyId,$=new Set(["companyId","campaignId","scheduledAt","targetLists","sendTimeOptimization","spreadOverHours"]),J=Object.keys(Y).filter((z)=>!$.has(z));if(J.length>0)throw Error(`\`schedule_campaign\` accepts only \`campaignId\`, \`scheduledAt\`, \`targetLists\`, \`sendTimeOptimization\`, and \`spreadOverHours\`. Unsupported field${J.length===1?"":"s"}: ${J.map((z)=>`\`${z}\``).join(", ")}.`);ZM(Y),X=await N("POST",`/api/v1/campaigns/${Y.campaignId}/schedule`,{scheduledAt:Y.scheduledAt,...Y.targetLists!==void 0&&{targetLists:Y.targetLists},...Y.sendTimeOptimization!==void 0&&{sendTimeOptimization:Y.sendTimeOptimization},...Y.spreadOverHours!==void 0&&{spreadOverHours:Y.spreadOverHours}},G);break}case"send_test_email":{let G=Y.companyId;X=await N("POST",`/api/v1/campaigns/${Y.campaignId}/test`,{to:Y.to},G);break}case"list_sequences":{let G=Y.companyId;X=await N("GET","/api/v1/sequences",void 0,G);break}case"get_sequence":{let G=Y.companyId;X=await N("GET",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"create_sequence":{let G=Y.companyId,$=Array.isArray(Y.steps)&&Y.steps.length>0,J=await N("POST","/api/v1/sequences",Y,G);if(!J.success){X=J;break}let z=J.sequence.id;if($){let D=await N("GET",`/api/v1/sequences/${z}`,void 0,G);if(D.success)X={success:!0,sequence:D.sequence,message:`Sequence "${D.sequence.name}" created with explicit steps. Review it before enabling.`};else X=D;break}let H=6,A=0,U="pending";while(U!=="complete"&&A<H){await new Promise((L)=>setTimeout(L,20000)),A++;let D=await N("GET",`/api/v1/sequences/${z}`,void 0,G);if(D.success)U=D.sequence.enrichmentStatus}let K=await N("GET",`/api/v1/sequences/${z}`,void 0,G);if(K.success)X={success:!0,sequence:K.sequence,message:K.sequence.enrichmentStatus==="complete"?`Sequence "${K.sequence.name}" created with ${K.sequence.emailCount} AI-generated emails. The sequence is ready to review and enable.`:`Sequence "${K.sequence.name}" created. Email enrichment is still in progress (${K.sequence.enrichedCount}/${K.sequence.emailCount} emails generated). You can check status with get_sequence.`};else X=K;break}case"update_sequence":{let G=Y.companyId,$=MM(Y);X=await N("PUT",`/api/v1/sequences/${Y.sequenceId}`,$,G);break}case"enable_sequence":{let G=Y.companyId;X=await N("POST",`/api/v1/sequences/${Y.sequenceId}/enable`,void 0,G);break}case"disable_sequence":{let G=Y.companyId;X=await N("POST",`/api/v1/sequences/${Y.sequenceId}/disable`,void 0,G);break}case"cancel_sequence_enrollments":{let G=Y.companyId,$=VM(Y);X=await N("POST",`/api/v1/sequences/${Y.sequenceId}/enrollments/cancel`,$,G);break}case"delete_sequence":{let G=Y.companyId;X=await N("DELETE",`/api/v1/sequences/${Y.sequenceId}`,void 0,G);break}case"list_transactional_emails":{let G=Y.companyId;X=await N("GET","/api/v1/transactional",void 0,G);break}case"get_transactional_email":{let G=Y.companyId;X=await N("GET",`/api/v1/transactional/${Y.idOrSlug}`,void 0,G);break}case"create_transactional_email":{let G=Y.companyId,$=new Set(["companyId","name","slug","subject","previewText","html","blocks","prompt","style","tone","enabled"]),J=Object.keys(Y).filter((A)=>!$.has(A));if(J.length>0)throw Error(`\`create_transactional_email\` accepts only \`name\`, \`slug\`, \`subject\`, \`previewText\`, \`html\`, \`blocks\`, \`prompt\`, \`style\`, \`tone\`, and \`enabled\` fields. Unsupported field${J.length===1?"":"s"}: ${J.map((A)=>`\`${A}\``).join(", ")}.`);wM(Y);let z=I(Y,"prompt");if(z!==void 0){let A={companyId:G??s0()??"",name:typeof Y.name==="string"&&Y.name.trim()!==""?Y.name.trim():"",slug:typeof Y.slug==="string"&&Y.slug.trim()!==""?Y.slug.trim():"",promptLength:z.length,style:typeof Y.style==="string"?Y.style:"",tone:typeof Y.tone==="string"?Y.tone:""};try{console.error("[mcp:create_transactional_email] generating from prompt",A);let U=await N("POST","/api/v1/generate/email",{prompt:z,...Y.style!==void 0&&{style:Y.style},...Y.tone!==void 0&&{tone:Y.tone}},G);console.error("[mcp:create_transactional_email] prompt generation complete",{...A,subject:U.subject??"",previewTextLength:typeof U.previewText==="string"?U.previewText.length:0,blockCount:Array.isArray(U.blocks)?U.blocks.length:0,htmlLength:typeof U.html==="string"?U.html.length:0});let K=I(Y,"subject")??(typeof U.subject==="string"&&U.subject.trim()!==""?U.subject.trim():void 0);if(!K)throw Error("`create_transactional_email` prompt generation did not return a subject. Provide `subject` explicitly.");let D=Array.isArray(U.blocks)&&U.blocks.length>0?U.blocks:void 0,L=typeof U.html==="string"&&U.html.trim()!==""?U.html:void 0,q=I(Y,"previewText")??(typeof U.previewText==="string"?U.previewText.trim():void 0);if(D===void 0&&L===void 0)throw Error("`create_transactional_email` prompt generation did not return email blocks. Try again or provide `html` or `blocks` explicitly.");console.error("[mcp:create_transactional_email] creating generated transactional",{...A,subject:K,contentSource:D!==void 0?"blocks":"html",blockCount:D?.length??0,htmlLength:L?.length??0}),X=await N("POST","/api/v1/transactional",{name:Y.name,...Y.slug!==void 0&&{slug:Y.slug},subject:K,...q!==void 0&&{previewText:q},...D!==void 0?{blocks:D}:{html:L},...Y.enabled!==void 0&&{enabled:Y.enabled}},G),console.error("[mcp:create_transactional_email] generated transactional created",A)}catch(U){throw console.error("[mcp:create_transactional_email] prompt-based create failed",{...A,error:U instanceof Error?U.message:String(U)}),U}break}let H=Object.fromEntries(Object.entries(Y).filter(([A])=>A!=="companyId"));X=await N("POST","/api/v1/transactional",H,G);break}case"update_transactional_email":{let G=Y.companyId,$=new Set(["companyId","idOrSlug","name","enabled","subject","previewText","html","blocks"]),J=Object.keys(Y).filter((H)=>!$.has(H));if(J.length>0)throw Error(`\`update_transactional_email\` accepts only \`name\`, \`enabled\`, \`subject\`, \`previewText\`, \`html\`, and \`blocks\` update fields. Unsupported field${J.length===1?"":"s"}: ${J.map((H)=>`\`${H}\``).join(", ")}.`);if(b1("update_transactional_email",Y),Y.name===void 0&&Y.enabled===void 0&&Y.subject===void 0&&Y.previewText===void 0&&Y.html===void 0&&Y.blocks===void 0)throw Error("Provide at least one of `name`, `enabled`, `subject`, `previewText`, `html`, or `blocks` when calling `update_transactional_email`.");let z=Object.fromEntries(Object.entries(Y).filter(([H])=>H!=="companyId"&&H!=="idOrSlug"));X=await N("PATCH",`/api/v1/transactional/${Y.idOrSlug}`,z,G);break}case"send_email":{let G=Y.companyId;X=await N("POST","/api/v1/transactional/send",Y,G);break}case"get_stats":{let G=Y.companyId,$=Y.period??"7d";X=await N("GET",`/api/v1/metrics?period=${$}`,void 0,G);break}case"get_campaign_stats":{let G=Y.companyId;X=await N("GET",`/api/v1/metrics/campaigns/${Y.campaignId}`,void 0,G);break}case"get_sequence_stats":{let G=Y.companyId;X=await N("GET",`/api/v1/metrics/sequences/${Y.sequenceId}`,void 0,G);break}case"get_subscriber_activity":{let G=Y.companyId,$=h4("get_subscriber_activity",Y),J=await T9($,G);X={success:J.success,email:J.subscriber.email,emailStats:J.subscriber.emailStats??null,activity:J.subscriber.activity??[],sequenceEnrollments:J.subscriber.sequenceEnrollments??[]};break}case"generate_email":{let G=Y.companyId;X=await N("POST","/api/v1/generate/email",Y,G);break}case"generate_sequence":{let G=Y.companyId;X=await N("POST","/api/v1/generate/sequence",Y,G);break}case"generate_subject_lines":{let G=Y.companyId;X=await N("POST","/api/v1/generate/subjects",Y,G);break}default:throw Error(`Unknown tool: ${Q}`)}let W=bM(X);if(W)throw W;return X=await SM(Q,Y,X),{content:[{type:"text",text:JSON.stringify(X,null,2)}]}}catch(X){return{isError:!0,content:[{type:"text",text:a0(X)}]}}}async function w5(Q,Y,X){let W=Y.getRequestContext?.(Q)??{};try{return await L6(W,X)}finally{await Y.onRequestContextUpdated?.(W,Q)}}function R9(Q={}){let Y=new j9({name:"sequenzy",version:A5.version},{capabilities:{tools:{},resources:{}}});return Y.setRequestHandler(BY,async()=>{return{tools:N5}}),Y.setRequestHandler(B4,async(X,W)=>{let{name:G,arguments:$}=X.params;return w5(W,Q,()=>Z5(G,$??{}))}),Y.setRequestHandler(JY,async()=>{return{resources:D5}}),Y.setRequestHandler(HY,async(X,W)=>{let{uri:G}=X.params;return w5(W,Q,()=>B5(G))}),Y}import P5 from"node:process";class C9{append(Q){this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
|
|
176
|
+
`);if(Q===-1)return null;let Y=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),RM(Y)}clear(){this._buffer=void 0}}function RM(Q){return MG.parse(JSON.parse(Q))}function b5(Q){return JSON.stringify(Q)+`
|
|
177
|
+
`}class k9{constructor(Q=P5.stdin,Y=P5.stdout){this._stdin=Q,this._stdout=Y,this._readBuffer=new C9,this._started=!1,this._ondata=(X)=>{this._readBuffer.append(X),this.processReadBuffer()},this._onerror=(X)=>{this.onerror?.(X)}}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((Y)=>{let X=b5(Q);if(this._stdout.write(X))Y();else this._stdout.once("drain",Y)})}}async function CM(){h9();let Q=R9(),Y=new k9;await Q.connect(Y),console.error("Sequenzy MCP server running on stdio")}CM().catch((Q)=>{console.error(a0(Q)),process.exit(1)});export{L6 as withMcpRequestContext,l4 as setSelectedCompanyId,s0 as getSelectedCompanyId,R9 as createSequenzyMcpServer,N as apiRequest};
|