@sleep2agi/agent-node 2.5.0-preview.21 → 2.5.0-preview.211
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -226
- package/build-info.json +7 -0
- package/dist/cli.js +352 -153
- package/dist/upload-file-mcp-stdio.js +75 -0
- package/package.json +12 -6
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
var lH=Object.create;var{getPrototypeOf:mH,defineProperty:b6,getOwnPropertyNames:cH}=Object;var pH=Object.prototype.hasOwnProperty;function iH(Q){return this[Q]}var dH,nH,JX=(Q,X,Y)=>{var W=Q!=null&&typeof Q==="object";if(W){var G=X?dH??=new WeakMap:nH??=new WeakMap,J=G.get(Q);if(J)return J}Y=Q!=null?lH(mH(Q)):{};let $=X||!Q||!Q.__esModule?b6(Y,"default",{value:Q,enumerable:!0}):Y;for(let H of cH(Q))if(!pH.call($,H))b6($,H,{get:iH.bind(Q,H),enumerable:!0});if(W)G.set(Q,$);return $};var w=(Q,X)=>()=>(X||Q((X={exports:{}}).exports,X),X.exports);var rH=(Q)=>Q;function oH(Q,X){this[Q]=rH.bind(null,X)}var $X=(Q,X)=>{for(var Y in X)b6(Q,Y,{get:X[Y],enumerable:!0,configurable:!0,set:oH.bind(X,Y)})};var O9=w((PJ)=>{Object.defineProperty(PJ,"__esModule",{value:!0});PJ.regexpCode=PJ.getEsmExportName=PJ.getProperty=PJ.safeStringify=PJ.stringify=PJ.strConcat=PJ.addCodeArg=PJ.str=PJ._=PJ.nil=PJ._Code=PJ.Name=PJ.IDENTIFIER=PJ._CodeOrName=void 0;class vQ{}PJ._CodeOrName=vQ;PJ.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class k1 extends vQ{constructor(Q){super();if(!PJ.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}}}PJ.Name=k1;class v0 extends vQ{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 k1)X[Y.str]=(X[Y.str]||0)+1;return X},{})}}PJ._Code=v0;PJ.nil=new v0("");function OJ(Q,...X){let Y=[Q[0]],W=0;while(W<X.length)g4(Y,X[W]),Y.push(Q[++W]);return new v0(Y)}PJ._=OJ;var x4=new v0("+");function wJ(Q,...X){let Y=[M9(Q[0])],W=0;while(W<X.length)Y.push(x4),g4(Y,X[W]),Y.push(x4,M9(Q[++W]));return NA(Y),new v0(Y)}PJ.str=wJ;function g4(Q,X){if(X instanceof v0)Q.push(...X._items);else if(X instanceof k1)Q.push(X);else Q.push(wA(X))}PJ.addCodeArg=g4;function NA(Q){let X=1;while(X<Q.length-1){if(Q[X]===x4){let Y=MA(Q[X-1],Q[X+1]);if(Y!==void 0){Q.splice(X-1,3,Y);continue}Q[X++]="+"}X++}}function MA(Q,X){if(X==='""')return Q;if(Q==='""')return X;if(typeof Q=="string"){if(X instanceof k1||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 k1))return`"${Q}${X.slice(1)}`;return}function OA(Q,X){return X.emptyStr()?Q:Q.emptyStr()?X:wJ`${Q}${X}`}PJ.strConcat=OA;function wA(Q){return typeof Q=="number"||typeof Q=="boolean"||Q===null?Q:M9(Array.isArray(Q)?Q.join(","):Q)}function PA(Q){return new v0(M9(Q))}PJ.stringify=PA;function M9(Q){return JSON.stringify(Q).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}PJ.safeStringify=M9;function IA(Q){return typeof Q=="string"&&PJ.IDENTIFIER.test(Q)?new v0(`.${Q}`):OJ`[${Q}]`}PJ.getProperty=IA;function EA(Q){if(typeof Q=="string"&&PJ.IDENTIFIER.test(Q))return new v0(`${Q}`);throw Error(`CodeGen: invalid export name: ${Q}, use explicit $id name mapping`)}PJ.getEsmExportName=EA;function bA(Q){return new v0(Q.toString())}PJ.regexpCode=bA});var f4=w((jJ)=>{Object.defineProperty(jJ,"__esModule",{value:!0});jJ.ValueScope=jJ.ValueScopeName=jJ.Scope=jJ.varKinds=jJ.UsedValueState=void 0;var V0=O9();class EJ extends Error{constructor(Q){super(`CodeGen: "code" for ${Q} not defined`);this.value=Q.value}}var xQ;(function(Q){Q[Q.Started=0]="Started",Q[Q.Completed=1]="Completed"})(xQ||(jJ.UsedValueState=xQ={}));jJ.varKinds={const:new V0.Name("const"),let:new V0.Name("let"),var:new V0.Name("var")};class h4{constructor({prefixes:Q,parent:X}={}){this._names={},this._prefixes=Q,this._parent=X}toName(Q){return Q instanceof V0.Name?Q:this.name(Q)}name(Q){return new V0.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}}}jJ.Scope=h4;class u4 extends V0.Name{constructor(Q,X){super(X);this.prefix=Q}setValue(Q,{property:X,itemIndex:Y}){this.value=Q,this.scopePath=V0._`.${new V0.Name(X)}[${Y}]`}}jJ.ValueScopeName=u4;var uA=V0._`\n`;class bJ extends h4{constructor(Q){super(Q);this._values={},this._scope=Q.scope,this.opts={...Q,_n:Q.lines?uA:V0.nil}}get(){return this._scope}name(Q){return new u4(Q,this._newName(Q))}value(Q,X){var Y;if(X.ref===void 0)throw Error("CodeGen: ref must be passed in value");let W=this.toName(Q),{prefix:G}=W,J=(Y=X.key)!==null&&Y!==void 0?Y:X.ref,$=this._values[G];if($){let K=$.get(J);if(K)return K}else $=this._values[G]=new Map;$.set(J,W);let H=this._scope[G]||(this._scope[G]=[]),B=H.length;return H[B]=X.ref,W.setValue(X,{property:G,itemIndex:B}),W}getValue(Q,X){let Y=this._values[Q];if(!Y)return;return Y.get(X)}scopeRefs(Q,X=this._values){return this._reduceValues(X,(Y)=>{if(Y.scopePath===void 0)throw Error(`CodeGen: name "${Y}" has no value`);return V0._`${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=V0.nil;for(let J in Q){let $=Q[J];if(!$)continue;let H=Y[J]=Y[J]||new Map;$.forEach((B)=>{if(H.has(B))return;H.set(B,xQ.Started);let K=X(B);if(K){let z=this.opts.es5?jJ.varKinds.var:jJ.varKinds.const;G=V0._`${G}${z} ${B} = ${K};${this.opts._n}`}else if(K=W===null||W===void 0?void 0:W(B))G=V0._`${G}${K}${this.opts._n}`;else throw new EJ(B);H.set(B,xQ.Completed)})}return G}}jJ.ValueScope=bJ});var h=w((U0)=>{Object.defineProperty(U0,"__esModule",{value:!0});U0.or=U0.and=U0.not=U0.CodeGen=U0.operators=U0.varKinds=U0.ValueScopeName=U0.ValueScope=U0.Scope=U0.Name=U0.regexpCode=U0.stringify=U0.getProperty=U0.nil=U0.strConcat=U0.str=U0._=void 0;var l=O9(),_0=f4(),W1=O9();Object.defineProperty(U0,"_",{enumerable:!0,get:function(){return W1._}});Object.defineProperty(U0,"str",{enumerable:!0,get:function(){return W1.str}});Object.defineProperty(U0,"strConcat",{enumerable:!0,get:function(){return W1.strConcat}});Object.defineProperty(U0,"nil",{enumerable:!0,get:function(){return W1.nil}});Object.defineProperty(U0,"getProperty",{enumerable:!0,get:function(){return W1.getProperty}});Object.defineProperty(U0,"stringify",{enumerable:!0,get:function(){return W1.stringify}});Object.defineProperty(U0,"regexpCode",{enumerable:!0,get:function(){return W1.regexpCode}});Object.defineProperty(U0,"Name",{enumerable:!0,get:function(){return W1.Name}});var lQ=f4();Object.defineProperty(U0,"Scope",{enumerable:!0,get:function(){return lQ.Scope}});Object.defineProperty(U0,"ValueScope",{enumerable:!0,get:function(){return lQ.ValueScope}});Object.defineProperty(U0,"ValueScopeName",{enumerable:!0,get:function(){return lQ.ValueScopeName}});Object.defineProperty(U0,"varKinds",{enumerable:!0,get:function(){return lQ.varKinds}});U0.operators={GT:new l._Code(">"),GTE:new l._Code(">="),LT:new l._Code("<"),LTE:new l._Code("<="),EQ:new l._Code("==="),NEQ:new l._Code("!=="),NOT:new l._Code("!"),OR:new l._Code("||"),AND:new l._Code("&&"),ADD:new l._Code("+")};class G1{optimizeNodes(){return this}optimizeNames(Q,X){return this}}class RJ extends G1{constructor(Q,X,Y){super();this.varKind=Q,this.name=X,this.rhs=Y}render({es5:Q,_n:X}){let Y=Q?_0.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=_1(this.rhs,Q,X);return this}get names(){return this.rhs instanceof l._CodeOrName?this.rhs.names:{}}}class c4 extends G1{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 l.Name&&!Q[this.lhs.str]&&!this.sideEffects)return;return this.rhs=_1(this.rhs,Q,X),this}get names(){let Q=this.lhs instanceof l.Name?{}:{...this.lhs.names};return fQ(Q,this.rhs)}}class SJ extends c4{constructor(Q,X,Y,W){super(Q,Y,W);this.op=X}render({_n:Q}){return`${this.lhs} ${this.op}= ${this.rhs};`+Q}}class CJ extends G1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`${this.label}:`+Q}}class kJ extends G1{constructor(Q){super();this.label=Q,this.names={}}render({_n:Q}){return`break${this.label?` ${this.label}`:""};`+Q}}class vJ extends G1{constructor(Q){super();this.error=Q}render({_n:Q}){return`throw ${this.error};`+Q}get names(){return this.error.names}}class _J extends G1{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=_1(this.code,Q,X),this}get names(){return this.code instanceof l._CodeOrName?this.code.names:{}}}class mQ extends G1{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;cA(Q,G.names),Y.splice(W,1)}return Y.length>0?this:void 0}get names(){return this.nodes.reduce((Q,X)=>D1(Q,X.names),{})}}class J1 extends mQ{render(Q){return"{"+Q._n+super.render(Q)+"}"+Q._n}}class xJ extends mQ{}class w9 extends J1{}w9.kind="else";class d0 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 w9(Y):Y}if(X){if(Q===!1)return X instanceof d0?X:X.nodes;if(this.nodes.length)return this;return new d0(fJ(Q),X instanceof d0?[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=_1(this.condition,Q,X),this}get names(){let Q=super.names;if(fQ(Q,this.condition),this.else)D1(Q,this.else.names);return Q}}d0.kind="if";class v1 extends J1{}v1.kind="for";class gJ extends v1{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=_1(this.iteration,Q,X),this}get names(){return D1(super.names,this.iteration.names)}}class yJ extends v1{constructor(Q,X,Y,W){super();this.varKind=Q,this.name=X,this.from=Y,this.to=W}render(Q){let X=Q.es5?_0.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=fQ(super.names,this.from);return fQ(Q,this.to)}}class l4 extends v1{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=_1(this.iterable,Q,X),this}get names(){return D1(super.names,this.iterable.names)}}class gQ 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)}}gQ.kind="func";class yQ extends mQ{render(Q){return"return "+super.render(Q)}}yQ.kind="return";class hJ 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)D1(Q,this.catch.names);if(this.finally)D1(Q,this.finally.names);return Q}}class hQ extends J1{constructor(Q){super();this.error=Q}render(Q){return`catch(${this.error})`+super.render(Q)}}hQ.kind="catch";class uQ extends J1{render(Q){return"finally"+super.render(Q)}}uQ.kind="finally";class uJ{constructor(Q,X={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...X,_n:X.lines?`
|
|
4
|
+
`:""},this._extScope=Q,this._scope=new _0.Scope({parent:Q}),this._nodes=[new xJ]}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 RJ(Q,G,Y)),G}const(Q,X,Y){return this._def(_0.varKinds.const,Q,X,Y)}let(Q,X,Y){return this._def(_0.varKinds.let,Q,X,Y)}var(Q,X,Y){return this._def(_0.varKinds.var,Q,X,Y)}assign(Q,X,Y){return this._leafNode(new c4(Q,X,Y))}add(Q,X){return this._leafNode(new SJ(Q,U0.operators.ADD,X))}code(Q){if(typeof Q=="function")Q();else if(Q!==l.nil)this._leafNode(new _J(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,l.addCodeArg)(X,W)}return X.push("}"),new l._Code(X)}if(Q,X,Y){if(this._blockNode(new d0(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 d0(Q))}else(){return this._elseNode(new w9)}endIf(){return this._endBlockNode(d0,w9)}_for(Q,X){if(this._blockNode(Q),X)this.code(X).endFor();return this}for(Q,X){return this._for(new gJ(Q),X)}forRange(Q,X,Y,W,G=this.opts.es5?_0.varKinds.var:_0.varKinds.let){let J=this._scope.toName(Q);return this._for(new yJ(G,J,X,Y),()=>W(J))}forOf(Q,X,Y,W=_0.varKinds.const){let G=this._scope.toName(Q);if(this.opts.es5){let J=X instanceof l.Name?X:this.var("_arr",X);return this.forRange("_i",0,l._`${J}.length`,($)=>{this.var(G,l._`${J}[${$}]`),Y(G)})}return this._for(new l4("of",W,G,X),()=>Y(G))}forIn(Q,X,Y,W=this.opts.es5?_0.varKinds.var:_0.varKinds.const){if(this.opts.ownProperties)return this.forOf(Q,l._`Object.keys(${X})`,Y);let G=this._scope.toName(Q);return this._for(new l4("in",W,G,X),()=>Y(G))}endFor(){return this._endBlockNode(v1)}label(Q){return this._leafNode(new CJ(Q))}break(Q){return this._leafNode(new kJ(Q))}return(Q){let X=new yQ;if(this._blockNode(X),this.code(Q),X.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(yQ)}try(Q,X,Y){if(!X&&!Y)throw Error('CodeGen: "try" without "catch" and "finally"');let W=new hJ;if(this._blockNode(W),this.code(Q),X){let G=this.name("e");this._currNode=W.catch=new hQ(G),X(G)}if(Y)this._currNode=W.finally=new uQ,this.code(Y);return this._endBlockNode(hQ,uQ)}throw(Q){return this._leafNode(new vJ(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=l.nil,Y,W){if(this._blockNode(new gQ(Q,X,Y)),W)this.code(W).endFunc();return this}endFunc(){return this._endBlockNode(gQ)}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 d0))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}}U0.CodeGen=uJ;function D1(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)+(X[Y]||0);return Q}function fQ(Q,X){return X instanceof l._CodeOrName?D1(Q,X.names):Q}function _1(Q,X,Y){if(Q instanceof l.Name)return W(Q);if(!G(Q))return Q;return new l._Code(Q._items.reduce((J,$)=>{if($ instanceof l.Name)$=W($);if($ instanceof l._Code)J.push(...$._items);else J.push($);return J},[]));function W(J){let $=Y[J.str];if($===void 0||X[J.str]!==1)return J;return delete X[J.str],$}function G(J){return J instanceof l._Code&&J._items.some(($)=>$ instanceof l.Name&&X[$.str]===1&&Y[$.str]!==void 0)}}function cA(Q,X){for(let Y in X)Q[Y]=(Q[Y]||0)-(X[Y]||0)}function fJ(Q){return typeof Q=="boolean"||typeof Q=="number"||Q===null?!Q:l._`!${m4(Q)}`}U0.not=fJ;var pA=lJ(U0.operators.AND);function iA(...Q){return Q.reduce(pA)}U0.and=iA;var dA=lJ(U0.operators.OR);function nA(...Q){return Q.reduce(dA)}U0.or=nA;function lJ(Q){return(X,Y)=>X===l.nil?Y:Y===l.nil?X:l._`${m4(X)} ${Q} ${m4(Y)}`}function m4(Q){return Q instanceof l.Name?Q:l._`(${Q})`}});var c=w((tJ)=>{Object.defineProperty(tJ,"__esModule",{value:!0});tJ.checkStrictMode=tJ.getErrorPath=tJ.Type=tJ.useFunc=tJ.setEvaluated=tJ.evaluatedPropsToName=tJ.mergeEvaluated=tJ.eachItem=tJ.unescapeJsonPointer=tJ.escapeJsonPointer=tJ.escapeFragment=tJ.unescapeFragment=tJ.schemaRefOrVal=tJ.schemaHasRulesButRef=tJ.schemaHasRules=tJ.checkUnknownRules=tJ.alwaysValidSchema=tJ.toHash=void 0;var r=h(),aA=O9();function sA(Q){let X={};for(let Y of Q)X[Y]=!0;return X}tJ.toHash=sA;function eA(Q,X){if(typeof X=="boolean")return X;if(Object.keys(X).length===0)return!0;return iJ(Q,X),!dJ(X,Q.self.RULES.all)}tJ.alwaysValidSchema=eA;function iJ(Q,X=Q.schema){let{opts:Y,self:W}=Q;if(!Y.strictSchema)return;if(typeof X==="boolean")return;let G=W.RULES.keywords;for(let J in X)if(!G[J])oJ(Q,`unknown keyword: "${J}"`)}tJ.checkUnknownRules=iJ;function dJ(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(X[Y])return!0;return!1}tJ.schemaHasRules=dJ;function QF(Q,X){if(typeof Q=="boolean")return!Q;for(let Y in Q)if(Y!=="$ref"&&X.all[Y])return!0;return!1}tJ.schemaHasRulesButRef=QF;function XF({topSchemaRef:Q,schemaPath:X},Y,W,G){if(!G){if(typeof Y=="number"||typeof Y=="boolean")return Y;if(typeof Y=="string")return r._`${Y}`}return r._`${Q}${X}${(0,r.getProperty)(W)}`}tJ.schemaRefOrVal=XF;function YF(Q){return nJ(decodeURIComponent(Q))}tJ.unescapeFragment=YF;function WF(Q){return encodeURIComponent(i4(Q))}tJ.escapeFragment=WF;function i4(Q){if(typeof Q=="number")return`${Q}`;return Q.replace(/~/g,"~0").replace(/\//g,"~1")}tJ.escapeJsonPointer=i4;function nJ(Q){return Q.replace(/~1/g,"/").replace(/~0/g,"~")}tJ.unescapeJsonPointer=nJ;function GF(Q,X){if(Array.isArray(Q))for(let Y of Q)X(Y);else X(Q)}tJ.eachItem=GF;function cJ({mergeNames:Q,mergeToName:X,mergeValues:Y,resultToName:W}){return(G,J,$,H)=>{let B=$===void 0?J:$ instanceof r.Name?(J instanceof r.Name?Q(G,J,$):X(G,J,$),$):J instanceof r.Name?(X(G,$,J),J):Y(J,$);return H===r.Name&&!(B instanceof r.Name)?W(G,B):B}}tJ.mergeEvaluated={props:cJ({mergeNames:(Q,X,Y)=>Q.if(r._`${Y} !== true && ${X} !== undefined`,()=>{Q.if(r._`${X} === true`,()=>Q.assign(Y,!0),()=>Q.assign(Y,r._`${Y} || {}`).code(r._`Object.assign(${Y}, ${X})`))}),mergeToName:(Q,X,Y)=>Q.if(r._`${Y} !== true`,()=>{if(X===!0)Q.assign(Y,!0);else Q.assign(Y,r._`${Y} || {}`),d4(Q,Y,X)}),mergeValues:(Q,X)=>Q===!0?!0:{...Q,...X},resultToName:rJ}),items:cJ({mergeNames:(Q,X,Y)=>Q.if(r._`${Y} !== true && ${X} !== undefined`,()=>Q.assign(Y,r._`${X} === true ? true : ${Y} > ${X} ? ${Y} : ${X}`)),mergeToName:(Q,X,Y)=>Q.if(r._`${Y} !== true`,()=>Q.assign(Y,X===!0?!0:r._`${Y} > ${X} ? ${Y} : ${X}`)),mergeValues:(Q,X)=>Q===!0?!0:Math.max(Q,X),resultToName:(Q,X)=>Q.var("items",X)})};function rJ(Q,X){if(X===!0)return Q.var("props",!0);let Y=Q.var("props",r._`{}`);if(X!==void 0)d4(Q,Y,X);return Y}tJ.evaluatedPropsToName=rJ;function d4(Q,X,Y){Object.keys(Y).forEach((W)=>Q.assign(r._`${X}${(0,r.getProperty)(W)}`,!0))}tJ.setEvaluated=d4;var pJ={};function JF(Q,X){return Q.scopeValue("func",{ref:X,code:pJ[X.code]||(pJ[X.code]=new aA._Code(X.code))})}tJ.useFunc=JF;var p4;(function(Q){Q[Q.Num=0]="Num",Q[Q.Str=1]="Str"})(p4||(tJ.Type=p4={}));function $F(Q,X,Y){if(Q instanceof r.Name){let W=X===p4.Num;return Y?W?r._`"[" + ${Q} + "]"`:r._`"['" + ${Q} + "']"`:W?r._`"/" + ${Q}`:r._`"/" + ${Q}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return Y?(0,r.getProperty)(Q).toString():"/"+i4(Q)}tJ.getErrorPath=$F;function oJ(Q,X,Y=Q.opts.strictSchema){if(!Y)return;if(X=`strict mode: ${X}`,Y===!0)throw Error(X);Q.self.logger.warn(X)}tJ.checkStrictMode=oJ});var n0=w((sJ)=>{Object.defineProperty(sJ,"__esModule",{value:!0});var A0=h(),IF={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")};sJ.default=IF});var P9=w((Y7)=>{Object.defineProperty(Y7,"__esModule",{value:!0});Y7.extendErrors=Y7.resetErrorsCount=Y7.reportExtraError=Y7.reportError=Y7.keyword$DataError=Y7.keywordError=void 0;var p=h(),pQ=c(),L0=n0();Y7.keywordError={message:({keyword:Q})=>p.str`must pass "${Q}" keyword validation`};Y7.keyword$DataError={message:({keyword:Q,schemaType:X})=>X?p.str`"${Q}" keyword must be ${X} ($data)`:p.str`"${Q}" keyword is invalid ($data)`};function bF(Q,X=Y7.keywordError,Y,W){let{it:G}=Q,{gen:J,compositeRule:$,allErrors:H}=G,B=X7(Q,X,Y);if(W!==null&&W!==void 0?W:$||H)eJ(J,B);else Q7(G,p._`[${B}]`)}Y7.reportError=bF;function jF(Q,X=Y7.keywordError,Y){let{it:W}=Q,{gen:G,compositeRule:J,allErrors:$}=W,H=X7(Q,X,Y);if(eJ(G,H),!(J||$))Q7(W,L0.default.vErrors)}Y7.reportExtraError=jF;function TF(Q,X){Q.assign(L0.default.errors,X),Q.if(p._`${L0.default.vErrors} !== null`,()=>Q.if(X,()=>Q.assign(p._`${L0.default.vErrors}.length`,X),()=>Q.assign(L0.default.vErrors,null)))}Y7.resetErrorsCount=TF;function RF({gen:Q,keyword:X,schemaValue:Y,data:W,errsCount:G,it:J}){if(G===void 0)throw Error("ajv implementation error");let $=Q.name("err");Q.forRange("i",G,L0.default.errors,(H)=>{if(Q.const($,p._`${L0.default.vErrors}[${H}]`),Q.if(p._`${$}.instancePath === undefined`,()=>Q.assign(p._`${$}.instancePath`,(0,p.strConcat)(L0.default.instancePath,J.errorPath))),Q.assign(p._`${$}.schemaPath`,p.str`${J.errSchemaPath}/${X}`),J.opts.verbose)Q.assign(p._`${$}.schema`,Y),Q.assign(p._`${$}.data`,W)})}Y7.extendErrors=RF;function eJ(Q,X){let Y=Q.const("err",X);Q.if(p._`${L0.default.vErrors} === null`,()=>Q.assign(L0.default.vErrors,p._`[${Y}]`),p._`${L0.default.vErrors}.push(${Y})`),Q.code(p._`${L0.default.errors}++`)}function Q7(Q,X){let{gen:Y,validateName:W,schemaEnv:G}=Q;if(G.$async)Y.throw(p._`new ${Q.ValidationError}(${X})`);else Y.assign(p._`${W}.errors`,X),Y.return(!1)}var V1={keyword:new p.Name("keyword"),schemaPath:new p.Name("schemaPath"),params:new p.Name("params"),propertyName:new p.Name("propertyName"),message:new p.Name("message"),schema:new p.Name("schema"),parentSchema:new p.Name("parentSchema")};function X7(Q,X,Y){let{createErrors:W}=Q.it;if(W===!1)return p._`{}`;return SF(Q,X,Y)}function SF(Q,X,Y={}){let{gen:W,it:G}=Q,J=[CF(G,Y),kF(Q,Y)];return vF(Q,X,J),W.object(...J)}function CF({errorPath:Q},{instancePath:X}){let Y=X?p.str`${Q}${(0,pQ.getErrorPath)(X,pQ.Type.Str)}`:Q;return[L0.default.instancePath,(0,p.strConcat)(L0.default.instancePath,Y)]}function kF({keyword:Q,it:{errSchemaPath:X}},{schemaPath:Y,parentSchema:W}){let G=W?X:p.str`${X}/${Q}`;if(Y)G=p.str`${G}${(0,pQ.getErrorPath)(Y,pQ.Type.Str)}`;return[V1.schemaPath,G]}function vF(Q,{params:X,message:Y},W){let{keyword:G,data:J,schemaValue:$,it:H}=Q,{opts:B,propertyName:K,topSchemaRef:z,schemaPath:F}=H;if(W.push([V1.keyword,G],[V1.params,typeof X=="function"?X(Q):X||p._`{}`]),B.messages)W.push([V1.message,typeof Y=="function"?Y(Q):Y]);if(B.verbose)W.push([V1.schema,$],[V1.parentSchema,p._`${z}${F}`],[L0.default.data,J]);if(K)W.push([V1.propertyName,K])}});var H7=w((J7)=>{Object.defineProperty(J7,"__esModule",{value:!0});J7.boolOrEmptySchema=J7.topBoolOrEmptySchema=void 0;var hF=P9(),uF=h(),fF=n0(),lF={message:"boolean schema is false"};function mF(Q){let{gen:X,schema:Y,validateName:W}=Q;if(Y===!1)G7(Q,!1);else if(typeof Y=="object"&&Y.$async===!0)X.return(fF.default.data);else X.assign(uF._`${W}.errors`,null),X.return(!0)}J7.topBoolOrEmptySchema=mF;function cF(Q,X){let{gen:Y,schema:W}=Q;if(W===!1)Y.var(X,!1),G7(Q);else Y.var(X,!0)}J7.boolOrEmptySchema=cF;function G7(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,hF.reportError)(G,lF,void 0,X)}});var r4=w((B7)=>{Object.defineProperty(B7,"__esModule",{value:!0});B7.getRules=B7.isJSONType=void 0;var iF=["string","number","integer","boolean","null","object","array"],dF=new Set(iF);function nF(Q){return typeof Q=="string"&&dF.has(Q)}B7.isJSONType=nF;function rF(){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:{}}}B7.getRules=rF});var o4=w((F7)=>{Object.defineProperty(F7,"__esModule",{value:!0});F7.shouldUseRule=F7.shouldUseGroup=F7.schemaHasRulesForType=void 0;function tF({schema:Q,self:X},Y){let W=X.RULES.types[Y];return W&&W!==!0&&z7(Q,W)}F7.schemaHasRulesForType=tF;function z7(Q,X){return X.rules.some((Y)=>A7(Q,Y))}F7.shouldUseGroup=z7;function A7(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))}F7.shouldUseRule=A7});var I9=w((Z7)=>{Object.defineProperty(Z7,"__esModule",{value:!0});Z7.reportTypeError=Z7.checkDataTypes=Z7.checkDataType=Z7.coerceAndCheckDataType=Z7.getJSONTypes=Z7.getSchemaTypes=Z7.DataType=void 0;var eF=r4(),QL=o4(),XL=P9(),y=h(),D7=c(),x1;(function(Q){Q[Q.Correct=0]="Correct",Q[Q.Wrong=1]="Wrong"})(x1||(Z7.DataType=x1={}));function YL(Q){let X=V7(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}Z7.getSchemaTypes=YL;function V7(Q){let X=Array.isArray(Q)?Q:Q?[Q]:[];if(X.every(eF.isJSONType))return X;throw Error("type must be JSONType or JSONType[]: "+X.join(","))}Z7.getJSONTypes=V7;function WL(Q,X){let{gen:Y,data:W,opts:G}=Q,J=GL(X,G.coerceTypes),$=X.length>0&&!(J.length===0&&X.length===1&&(0,QL.schemaHasRulesForType)(Q,X[0]));if($){let H=a4(X,W,G.strictNumbers,x1.Wrong);Y.if(H,()=>{if(J.length)JL(Q,X,J);else s4(Q)})}return $}Z7.coerceAndCheckDataType=WL;var U7=new Set(["string","number","integer","boolean","null"]);function GL(Q,X){return X?Q.filter((Y)=>U7.has(Y)||X==="array"&&Y==="array"):[]}function JL(Q,X,Y){let{gen:W,data:G,opts:J}=Q,$=W.let("dataType",y._`typeof ${G}`),H=W.let("coerced",y._`undefined`);if(J.coerceTypes==="array")W.if(y._`${$} == 'object' && Array.isArray(${G}) && ${G}.length == 1`,()=>W.assign(G,y._`${G}[0]`).assign($,y._`typeof ${G}`).if(a4(X,G,J.strictNumbers),()=>W.assign(H,G)));W.if(y._`${H} !== undefined`);for(let K of Y)if(U7.has(K)||K==="array"&&J.coerceTypes==="array")B(K);W.else(),s4(Q),W.endIf(),W.if(y._`${H} !== undefined`,()=>{W.assign(G,H),$L(Q,H)});function B(K){switch(K){case"string":W.elseIf(y._`${$} == "number" || ${$} == "boolean"`).assign(H,y._`"" + ${G}`).elseIf(y._`${G} === null`).assign(H,y._`""`);return;case"number":W.elseIf(y._`${$} == "boolean" || ${G} === null
|
|
5
|
+
|| (${$} == "string" && ${G} && ${G} == +${G})`).assign(H,y._`+${G}`);return;case"integer":W.elseIf(y._`${$} === "boolean" || ${G} === null
|
|
6
|
+
|| (${$} === "string" && ${G} && ${G} == +${G} && !(${G} % 1))`).assign(H,y._`+${G}`);return;case"boolean":W.elseIf(y._`${G} === "false" || ${G} === 0 || ${G} === null`).assign(H,!1).elseIf(y._`${G} === "true" || ${G} === 1`).assign(H,!0);return;case"null":W.elseIf(y._`${G} === "" || ${G} === 0 || ${G} === false`),W.assign(H,null);return;case"array":W.elseIf(y._`${$} === "string" || ${$} === "number"
|
|
7
|
+
|| ${$} === "boolean" || ${G} === null`).assign(H,y._`[${G}]`)}}}function $L({gen:Q,parentData:X,parentDataProperty:Y},W){Q.if(y._`${X} !== undefined`,()=>Q.assign(y._`${X}[${Y}]`,W))}function t4(Q,X,Y,W=x1.Correct){let G=W===x1.Correct?y.operators.EQ:y.operators.NEQ,J;switch(Q){case"null":return y._`${X} ${G} null`;case"array":J=y._`Array.isArray(${X})`;break;case"object":J=y._`${X} && typeof ${X} == "object" && !Array.isArray(${X})`;break;case"integer":J=$(y._`!(${X} % 1) && !isNaN(${X})`);break;case"number":J=$();break;default:return y._`typeof ${X} ${G} ${Q}`}return W===x1.Correct?J:(0,y.not)(J);function $(H=y.nil){return(0,y.and)(y._`typeof ${X} == "number"`,H,Y?y._`isFinite(${X})`:y.nil)}}Z7.checkDataType=t4;function a4(Q,X,Y,W){if(Q.length===1)return t4(Q[0],X,Y,W);let G,J=(0,D7.toHash)(Q);if(J.array&&J.object){let $=y._`typeof ${X} != "object"`;G=J.null?$:y._`!${X} || ${$}`,delete J.null,delete J.array,delete J.object}else G=y.nil;if(J.number)delete J.integer;for(let $ in J)G=(0,y.and)(G,t4($,X,Y,W));return G}Z7.checkDataTypes=a4;var HL={message:({schema:Q})=>`must be ${Q}`,params:({schema:Q,schemaValue:X})=>typeof Q=="string"?y._`{type: ${Q}}`:y._`{type: ${X}}`};function s4(Q){let X=BL(Q);(0,XL.reportError)(X,HL)}Z7.reportTypeError=s4;function BL(Q){let{gen:X,data:Y,schema:W}=Q,G=(0,D7.schemaRefOrVal)(Q,W,"type");return{gen:X,keyword:"type",data:Y,schema:W.type,schemaCode:G,schemaValue:G,parentSchema:W,params:{},it:Q}}});var w7=w((M7)=>{Object.defineProperty(M7,"__esModule",{value:!0});M7.assignDefaults=void 0;var g1=h(),VL=c();function UL(Q,X){let{properties:Y,items:W}=Q.schema;if(X==="object"&&Y)for(let G in Y)N7(Q,G,Y[G].default);else if(X==="array"&&Array.isArray(W))W.forEach((G,J)=>N7(Q,J,G.default))}M7.assignDefaults=UL;function N7(Q,X,Y){let{gen:W,compositeRule:G,data:J,opts:$}=Q;if(Y===void 0)return;let H=g1._`${J}${(0,g1.getProperty)(X)}`;if(G){(0,VL.checkStrictMode)(Q,`default is ignored for: ${H}`);return}let B=g1._`${H} === undefined`;if($.useDefaults==="empty")B=g1._`${B} || ${H} === null || ${H} === ""`;W.if(B,g1._`${H} = ${(0,g1.stringify)(Y)}`)}});var T0=w((E7)=>{Object.defineProperty(E7,"__esModule",{value:!0});E7.validateUnion=E7.validateArray=E7.usePattern=E7.callValidateCode=E7.schemaProperties=E7.allSchemaProperties=E7.noPropertyInData=E7.propertyInData=E7.isOwnProperty=E7.hasPropFunc=E7.reportMissingProp=E7.checkMissingProp=E7.checkReportMissingProp=void 0;var a=h(),e4=c(),$1=n0(),ZL=c();function qL(Q,X){let{gen:Y,data:W,it:G}=Q;Y.if(X8(Y,W,X,G.opts.ownProperties),()=>{Q.setParams({missingProperty:a._`${X}`},!0),Q.error()})}E7.checkReportMissingProp=qL;function NL({gen:Q,data:X,it:{opts:Y}},W,G){return(0,a.or)(...W.map((J)=>(0,a.and)(X8(Q,X,J,Y.ownProperties),a._`${G} = ${J}`)))}E7.checkMissingProp=NL;function ML(Q,X){Q.setParams({missingProperty:X},!0),Q.error()}E7.reportMissingProp=ML;function P7(Q){return Q.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:a._`Object.prototype.hasOwnProperty`})}E7.hasPropFunc=P7;function Q8(Q,X,Y){return a._`${P7(Q)}.call(${X}, ${Y})`}E7.isOwnProperty=Q8;function OL(Q,X,Y,W){let G=a._`${X}${(0,a.getProperty)(Y)} !== undefined`;return W?a._`${G} && ${Q8(Q,X,Y)}`:G}E7.propertyInData=OL;function X8(Q,X,Y,W){let G=a._`${X}${(0,a.getProperty)(Y)} === undefined`;return W?(0,a.or)(G,(0,a.not)(Q8(Q,X,Y))):G}E7.noPropertyInData=X8;function I7(Q){return Q?Object.keys(Q).filter((X)=>X!=="__proto__"):[]}E7.allSchemaProperties=I7;function wL(Q,X){return I7(X).filter((Y)=>!(0,e4.alwaysValidSchema)(Q,X[Y]))}E7.schemaProperties=wL;function PL({schemaCode:Q,data:X,it:{gen:Y,topSchemaRef:W,schemaPath:G,errorPath:J},it:$},H,B,K){let z=K?a._`${Q}, ${X}, ${W}${G}`:X,F=[[$1.default.instancePath,(0,a.strConcat)($1.default.instancePath,J)],[$1.default.parentData,$.parentData],[$1.default.parentDataProperty,$.parentDataProperty],[$1.default.rootData,$1.default.rootData]];if($.opts.dynamicRef)F.push([$1.default.dynamicAnchors,$1.default.dynamicAnchors]);let L=a._`${z}, ${Y.object(...F)}`;return B!==a.nil?a._`${H}.call(${B}, ${L})`:a._`${H}(${L})`}E7.callValidateCode=PL;var IL=a._`new RegExp`;function EL({gen:Q,it:{opts:X}},Y){let W=X.unicodeRegExp?"u":"",{regExp:G}=X.code,J=G(Y,W);return Q.scopeValue("pattern",{key:J.toString(),ref:J,code:a._`${G.code==="new RegExp"?IL:(0,ZL.useFunc)(Q,G)}(${Y}, ${W})`})}E7.usePattern=EL;function bL(Q){let{gen:X,data:Y,keyword:W,it:G}=Q,J=X.name("valid");if(G.allErrors){let H=X.let("valid",!0);return $(()=>X.assign(H,!1)),H}return X.var(J,!0),$(()=>X.break()),J;function $(H){let B=X.const("len",a._`${Y}.length`);X.forRange("i",0,B,(K)=>{Q.subschema({keyword:W,dataProp:K,dataPropType:e4.Type.Num},J),X.if((0,a.not)(J),H)})}}E7.validateArray=bL;function jL(Q){let{gen:X,schema:Y,keyword:W,it:G}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(Y.some((B)=>(0,e4.alwaysValidSchema)(G,B))&&!G.opts.unevaluated)return;let $=X.let("valid",!1),H=X.name("_valid");X.block(()=>Y.forEach((B,K)=>{let z=Q.subschema({keyword:W,schemaProp:K,compositeRule:!0},H);if(X.assign($,a._`${$} || ${H}`),!Q.mergeValidEvaluated(z,H))X.if((0,a.not)($))})),Q.result($,()=>Q.reset(),()=>Q.error(!0))}E7.validateUnion=jL});var C7=w((R7)=>{Object.defineProperty(R7,"__esModule",{value:!0});R7.validateKeywordUsage=R7.validSchemaType=R7.funcKeywordCode=R7.macroKeywordCode=void 0;var D0=h(),U1=n0(),fL=T0(),lL=P9();function mL(Q,X){let{gen:Y,keyword:W,schema:G,parentSchema:J,it:$}=Q,H=X.macro.call($.self,G,J,$),B=T7(Y,W,H);if($.opts.validateSchema!==!1)$.self.validateSchema(H,!0);let K=Y.name("valid");Q.subschema({schema:H,schemaPath:D0.nil,errSchemaPath:`${$.errSchemaPath}/${W}`,topSchemaRef:B,compositeRule:!0},K),Q.pass(K,()=>Q.error(!0))}R7.macroKeywordCode=mL;function cL(Q,X){var Y;let{gen:W,keyword:G,schema:J,parentSchema:$,$data:H,it:B}=Q;iL(B,X);let K=!H&&X.compile?X.compile.call(B.self,J,$,B):X.validate,z=T7(W,G,K),F=W.let("valid");Q.block$data(F,L),Q.ok((Y=X.valid)!==null&&Y!==void 0?Y:F);function L(){if(X.errors===!1){if(N(),X.modifying)j7(Q);M(()=>Q.error())}else{let O=X.async?D():Z();if(X.modifying)j7(Q);M(()=>pL(Q,O))}}function D(){let O=W.let("ruleErrs",null);return W.try(()=>N(D0._`await `),(k)=>W.assign(F,!1).if(D0._`${k} instanceof ${B.ValidationError}`,()=>W.assign(O,D0._`${k}.errors`),()=>W.throw(k))),O}function Z(){let O=D0._`${z}.errors`;return W.assign(O,null),N(D0.nil),O}function N(O=X.async?D0._`await `:D0.nil){let k=B.opts.passContext?U1.default.this:U1.default.self,j=!(("compile"in X)&&!H||X.schema===!1);W.assign(F,D0._`${O}${(0,fL.callValidateCode)(Q,z,k,j)}`,X.modifying)}function M(O){var k;W.if((0,D0.not)((k=X.valid)!==null&&k!==void 0?k:F),O)}}R7.funcKeywordCode=cL;function j7(Q){let{gen:X,data:Y,it:W}=Q;X.if(W.parentData,()=>X.assign(Y,D0._`${W.parentData}[${W.parentDataProperty}]`))}function pL(Q,X){let{gen:Y}=Q;Y.if(D0._`Array.isArray(${X})`,()=>{Y.assign(U1.default.vErrors,D0._`${U1.default.vErrors} === null ? ${X} : ${U1.default.vErrors}.concat(${X})`).assign(U1.default.errors,D0._`${U1.default.vErrors}.length`),(0,lL.extendErrors)(Q)},()=>Q.error())}function iL({schemaEnv:Q},X){if(X.async&&!Q.$async)throw Error("async keyword in sync schema")}function T7(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,D0.stringify)(Y)})}function dL(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")}R7.validSchemaType=dL;function nL({schema:Q,opts:X,self:Y,errSchemaPath:W},G,J){if(Array.isArray(G.keyword)?!G.keyword.includes(J):G.keyword!==J)throw Error("ajv implementation error");let $=G.dependencies;if($===null||$===void 0?void 0:$.some((H)=>!Object.prototype.hasOwnProperty.call(Q,H)))throw Error(`parent schema must have dependencies of ${J}: ${$.join(",")}`);if(G.validateSchema){if(!G.validateSchema(Q[J])){let B=`keyword "${J}" value is invalid at path "${W}": `+Y.errorsText(G.validateSchema.errors);if(X.validateSchema==="log")Y.logger.error(B);else throw Error(B)}}}R7.validateKeywordUsage=nL});var x7=w((v7)=>{Object.defineProperty(v7,"__esModule",{value:!0});v7.extendSubschemaMode=v7.extendSubschemaData=v7.getSubschema=void 0;var u0=h(),k7=c();function aL(Q,{keyword:X,schemaProp:Y,schema:W,schemaPath:G,errSchemaPath:J,topSchemaRef:$}){if(X!==void 0&&W!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(X!==void 0){let H=Q.schema[X];return Y===void 0?{schema:H,schemaPath:u0._`${Q.schemaPath}${(0,u0.getProperty)(X)}`,errSchemaPath:`${Q.errSchemaPath}/${X}`}:{schema:H[Y],schemaPath:u0._`${Q.schemaPath}${(0,u0.getProperty)(X)}${(0,u0.getProperty)(Y)}`,errSchemaPath:`${Q.errSchemaPath}/${X}/${(0,k7.escapeFragment)(Y)}`}}if(W!==void 0){if(G===void 0||J===void 0||$===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:W,schemaPath:G,topSchemaRef:$,errSchemaPath:J}}throw Error('either "keyword" or "schema" must be passed')}v7.getSubschema=aL;function sL(Q,X,{dataProp:Y,dataPropType:W,data:G,dataTypes:J,propertyName:$}){if(G!==void 0&&Y!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:H}=X;if(Y!==void 0){let{errorPath:K,dataPathArr:z,opts:F}=X,L=H.let("data",u0._`${X.data}${(0,u0.getProperty)(Y)}`,!0);B(L),Q.errorPath=u0.str`${K}${(0,k7.getErrorPath)(Y,W,F.jsPropertySyntax)}`,Q.parentDataProperty=u0._`${Y}`,Q.dataPathArr=[...z,Q.parentDataProperty]}if(G!==void 0){let K=G instanceof u0.Name?G:H.let("data",G,!0);if(B(K),$!==void 0)Q.propertyName=$}if(J)Q.dataTypes=J;function B(K){Q.data=K,Q.dataLevel=X.dataLevel+1,Q.dataTypes=[],X.definedProperties=new Set,Q.parentData=X.data,Q.dataNames=[...X.dataNames,K]}}v7.extendSubschemaData=sL;function eL(Q,{jtdDiscriminator:X,jtdMetadata:Y,compositeRule:W,createErrors:G,allErrors:J}){if(W!==void 0)Q.compositeRule=W;if(G!==void 0)Q.createErrors=G;if(J!==void 0)Q.allErrors=J;Q.jtdDiscriminator=X,Q.jtdMetadata=Y}v7.extendSubschemaMode=eL});var Y8=w((RT,g7)=>{g7.exports=function Q(X,Y){if(X===Y)return!0;if(X&&Y&&typeof X=="object"&&typeof Y=="object"){if(X.constructor!==Y.constructor)return!1;var W,G,J;if(Array.isArray(X)){if(W=X.length,W!=Y.length)return!1;for(G=W;G--!==0;)if(!Q(X[G],Y[G]))return!1;return!0}if(X.constructor===RegExp)return X.source===Y.source&&X.flags===Y.flags;if(X.valueOf!==Object.prototype.valueOf)return X.valueOf()===Y.valueOf();if(X.toString!==Object.prototype.toString)return X.toString()===Y.toString();if(J=Object.keys(X),W=J.length,W!==Object.keys(Y).length)return!1;for(G=W;G--!==0;)if(!Object.prototype.hasOwnProperty.call(Y,J[G]))return!1;for(G=W;G--!==0;){var $=J[G];if(!Q(X[$],Y[$]))return!1}return!0}return X!==X&&Y!==Y}});var h7=w((ST,y7)=>{var H1=y7.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(){};iQ(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 iQ(Q,X,Y,W,G,J,$,H,B,K){if(W&&typeof W=="object"&&!Array.isArray(W)){X(W,G,J,$,H,B,K);for(var z in W){var F=W[z];if(Array.isArray(F)){if(z in H1.arrayKeywords)for(var L=0;L<F.length;L++)iQ(Q,X,Y,F[L],G+"/"+z+"/"+L,J,G,z,W,L)}else if(z in H1.propsKeywords){if(F&&typeof F=="object")for(var D in F)iQ(Q,X,Y,F[D],G+"/"+z+"/"+YD(D),J,G,z,W,D)}else if(z in H1.keywords||Q.allKeys&&!(z in H1.skipKeywords))iQ(Q,X,Y,F,G+"/"+z,J,G,z,W)}Y(W,G,J,$,H,B,K)}}function YD(Q){return Q.replace(/~/g,"~0").replace(/\//g,"~1")}});var E9=w((m7)=>{Object.defineProperty(m7,"__esModule",{value:!0});m7.getSchemaRefs=m7.resolveUrl=m7.normalizeId=m7._getFullPath=m7.getFullPath=m7.inlineRef=void 0;var WD=c(),GD=Y8(),JD=h7(),$D=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function HD(Q,X=!0){if(typeof Q=="boolean")return!0;if(X===!0)return!W8(Q);if(!X)return!1;return u7(Q)<=X}m7.inlineRef=HD;var BD=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function W8(Q){for(let X in Q){if(BD.has(X))return!0;let Y=Q[X];if(Array.isArray(Y)&&Y.some(W8))return!0;if(typeof Y=="object"&&W8(Y))return!0}return!1}function u7(Q){let X=0;for(let Y in Q){if(Y==="$ref")return 1/0;if(X++,$D.has(Y))continue;if(typeof Q[Y]=="object")(0,WD.eachItem)(Q[Y],(W)=>X+=u7(W));if(X===1/0)return 1/0}return X}function f7(Q,X="",Y){if(Y!==!1)X=y1(X);let W=Q.parse(X);return l7(Q,W)}m7.getFullPath=f7;function l7(Q,X){return Q.serialize(X).split("#")[0]+"#"}m7._getFullPath=l7;var KD=/#\/?$/;function y1(Q){return Q?Q.replace(KD,""):""}m7.normalizeId=y1;function zD(Q,X,Y){return Y=y1(Y),Q.resolve(X,Y)}m7.resolveUrl=zD;var AD=/^[a-z_][-a-z0-9._]*$/i;function FD(Q,X){if(typeof Q=="boolean")return{};let{schemaId:Y,uriResolver:W}=this.opts,G=y1(Q[Y]||X),J={"":G},$=f7(W,G,!1),H={},B=new Set;return JD(Q,{allKeys:!0},(F,L,D,Z)=>{if(Z===void 0)return;let N=$+L,M=J[Z];if(typeof F[Y]=="string")M=O.call(this,F[Y]);k.call(this,F.$anchor),k.call(this,F.$dynamicAnchor),J[L]=M;function O(j){let S=this.opts.uriResolver.resolve;if(j=y1(M?S(M,j):j),B.has(j))throw z(j);B.add(j);let I=this.refs[j];if(typeof I=="string")I=this.refs[I];if(typeof I=="object")K(F,I.schema,j);else if(j!==y1(N))if(j[0]==="#")K(F,H[j],j),H[j]=F;else this.refs[j]=N;return j}function k(j){if(typeof j=="string"){if(!AD.test(j))throw Error(`invalid anchor "${j}"`);O.call(this,`#${j}`)}}}),H;function K(F,L,D){if(L!==void 0&&!GD(F,L))throw z(D)}function z(F){return Error(`reference "${F}" resolves to more than one schema`)}}m7.getSchemaRefs=FD});var T9=w((G5)=>{Object.defineProperty(G5,"__esModule",{value:!0});G5.getData=G5.KeywordCxt=G5.validateFunctionCode=void 0;var r7=H7(),p7=I9(),J8=o4(),dQ=I9(),qD=w7(),j9=C7(),G8=x7(),b=h(),_=n0(),ND=E9(),r0=c(),b9=P9();function MD(Q){if(a7(Q)){if(s7(Q),t7(Q)){PD(Q);return}}o7(Q,()=>(0,r7.topBoolOrEmptySchema)(Q))}G5.validateFunctionCode=MD;function o7({gen:Q,validateName:X,schema:Y,schemaEnv:W,opts:G},J){if(G.code.es5)Q.func(X,b._`${_.default.data}, ${_.default.valCxt}`,W.$async,()=>{Q.code(b._`"use strict"; ${i7(Y,G)}`),wD(Q,G),Q.code(J)});else Q.func(X,b._`${_.default.data}, ${OD(G)}`,W.$async,()=>Q.code(i7(Y,G)).code(J))}function OD(Q){return b._`{${_.default.instancePath}="", ${_.default.parentData}, ${_.default.parentDataProperty}, ${_.default.rootData}=${_.default.data}${Q.dynamicRef?b._`, ${_.default.dynamicAnchors}={}`:b.nil}}={}`}function wD(Q,X){Q.if(_.default.valCxt,()=>{if(Q.var(_.default.instancePath,b._`${_.default.valCxt}.${_.default.instancePath}`),Q.var(_.default.parentData,b._`${_.default.valCxt}.${_.default.parentData}`),Q.var(_.default.parentDataProperty,b._`${_.default.valCxt}.${_.default.parentDataProperty}`),Q.var(_.default.rootData,b._`${_.default.valCxt}.${_.default.rootData}`),X.dynamicRef)Q.var(_.default.dynamicAnchors,b._`${_.default.valCxt}.${_.default.dynamicAnchors}`)},()=>{if(Q.var(_.default.instancePath,b._`""`),Q.var(_.default.parentData,b._`undefined`),Q.var(_.default.parentDataProperty,b._`undefined`),Q.var(_.default.rootData,_.default.data),X.dynamicRef)Q.var(_.default.dynamicAnchors,b._`{}`)})}function PD(Q){let{schema:X,opts:Y,gen:W}=Q;o7(Q,()=>{if(Y.$comment&&X.$comment)Q5(Q);if(TD(Q),W.let(_.default.vErrors,null),W.let(_.default.errors,0),Y.unevaluated)ID(Q);e7(Q),CD(Q)});return}function ID(Q){let{gen:X,validateName:Y}=Q;Q.evaluated=X.const("evaluated",b._`${Y}.evaluated`),X.if(b._`${Q.evaluated}.dynamicProps`,()=>X.assign(b._`${Q.evaluated}.props`,b._`undefined`)),X.if(b._`${Q.evaluated}.dynamicItems`,()=>X.assign(b._`${Q.evaluated}.items`,b._`undefined`))}function i7(Q,X){let Y=typeof Q=="object"&&Q[X.schemaId];return Y&&(X.code.source||X.code.process)?b._`/*# sourceURL=${Y} */`:b.nil}function ED(Q,X){if(a7(Q)){if(s7(Q),t7(Q)){bD(Q,X);return}}(0,r7.boolOrEmptySchema)(Q,X)}function t7({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 a7(Q){return typeof Q.schema!="boolean"}function bD(Q,X){let{schema:Y,gen:W,opts:G}=Q;if(G.$comment&&Y.$comment)Q5(Q);RD(Q),SD(Q);let J=W.const("_errs",_.default.errors);e7(Q,J),W.var(X,b._`${J} === ${_.default.errors}`)}function s7(Q){(0,r0.checkUnknownRules)(Q),jD(Q)}function e7(Q,X){if(Q.opts.jtd)return d7(Q,[],!1,X);let Y=(0,p7.getSchemaTypes)(Q.schema),W=(0,p7.coerceAndCheckDataType)(Q,Y);d7(Q,Y,!W,X)}function jD(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 TD(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 RD(Q){let X=Q.schema[Q.opts.schemaId];if(X)Q.baseId=(0,ND.resolveUrl)(Q.opts.uriResolver,Q.baseId,X)}function SD(Q){if(Q.schema.$async&&!Q.schemaEnv.$async)throw Error("async schema in sync schema")}function Q5({gen:Q,schemaEnv:X,schema:Y,errSchemaPath:W,opts:G}){let J=Y.$comment;if(G.$comment===!0)Q.code(b._`${_.default.self}.logger.log(${J})`);else if(typeof G.$comment=="function"){let $=b.str`${W}/$comment`,H=Q.scopeValue("root",{ref:X.root});Q.code(b._`${_.default.self}.opts.$comment(${J}, ${$}, ${H}.schema)`)}}function CD(Q){let{gen:X,schemaEnv:Y,validateName:W,ValidationError:G,opts:J}=Q;if(Y.$async)X.if(b._`${_.default.errors} === 0`,()=>X.return(_.default.data),()=>X.throw(b._`new ${G}(${_.default.vErrors})`));else{if(X.assign(b._`${W}.errors`,_.default.vErrors),J.unevaluated)kD(Q);X.return(b._`${_.default.errors} === 0`)}}function kD({gen:Q,evaluated:X,props:Y,items:W}){if(Y instanceof b.Name)Q.assign(b._`${X}.props`,Y);if(W instanceof b.Name)Q.assign(b._`${X}.items`,W)}function d7(Q,X,Y,W){let{gen:G,schema:J,data:$,allErrors:H,opts:B,self:K}=Q,{RULES:z}=K;if(J.$ref&&(B.ignoreKeywordsWithRef||!(0,r0.schemaHasRulesButRef)(J,z))){G.block(()=>Y5(Q,"$ref",z.all.$ref.definition));return}if(!B.jtd)vD(Q,X);G.block(()=>{for(let L of z.rules)F(L);F(z.post)});function F(L){if(!(0,J8.shouldUseGroup)(J,L))return;if(L.type){if(G.if((0,dQ.checkDataType)(L.type,$,B.strictNumbers)),n7(Q,L),X.length===1&&X[0]===L.type&&Y)G.else(),(0,dQ.reportTypeError)(Q);G.endIf()}else n7(Q,L);if(!H)G.if(b._`${_.default.errors} === ${W||0}`)}}function n7(Q,X){let{gen:Y,schema:W,opts:{useDefaults:G}}=Q;if(G)(0,qD.assignDefaults)(Q,X.type);Y.block(()=>{for(let J of X.rules)if((0,J8.shouldUseRule)(W,J))Y5(Q,J.keyword,J.definition,X.type)})}function vD(Q,X){if(Q.schemaEnv.meta||!Q.opts.strictTypes)return;if(_D(Q,X),!Q.opts.allowUnionTypes)xD(Q,X);gD(Q,Q.dataTypes)}function _D(Q,X){if(!X.length)return;if(!Q.dataTypes.length){Q.dataTypes=X;return}X.forEach((Y)=>{if(!X5(Q.dataTypes,Y))$8(Q,`type "${Y}" not allowed by context "${Q.dataTypes.join(",")}"`)}),hD(Q,X)}function xD(Q,X){if(X.length>1&&!(X.length===2&&X.includes("null")))$8(Q,"use allowUnionTypes to allow union type keyword")}function gD(Q,X){let Y=Q.self.RULES.all;for(let W in Y){let G=Y[W];if(typeof G=="object"&&(0,J8.shouldUseRule)(Q.schema,G)){let{type:J}=G.definition;if(J.length&&!J.some(($)=>yD(X,$)))$8(Q,`missing type "${J.join(",")}" for keyword "${W}"`)}}}function yD(Q,X){return Q.includes(X)||X==="number"&&Q.includes("integer")}function X5(Q,X){return Q.includes(X)||X==="integer"&&Q.includes("number")}function hD(Q,X){let Y=[];for(let W of Q.dataTypes)if(X5(X,W))Y.push(W);else if(X.includes("integer")&&W==="number")Y.push("integer");Q.dataTypes=Y}function $8(Q,X){let Y=Q.schemaEnv.baseId+Q.errSchemaPath;X+=` at "${Y}" (strictTypes)`,(0,r0.checkStrictMode)(Q,X,Q.opts.strictTypes)}class H8{constructor(Q,X,Y){if((0,j9.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",W5(this.$data,Q));else if(this.schemaCode=this.schemaValue,!(0,j9.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",_.default.errors)}result(Q,X,Y){this.failResult((0,b.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,b.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(b._`${X} !== undefined && (${(0,b.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?b9.reportExtraError:b9.reportError)(this,this.def.error,X)}$dataError(){(0,b9.reportError)(this,this.def.$dataError||b9.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,b9.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=b.nil){this.gen.block(()=>{this.check$data(Q,Y),X()})}check$data(Q=b.nil,X=b.nil){if(!this.$data)return;let{gen:Y,schemaCode:W,schemaType:G,def:J}=this;if(Y.if((0,b.or)(b._`${W} === undefined`,X)),Q!==b.nil)Y.assign(Q,!0);if(G.length||J.validateSchema){if(Y.elseIf(this.invalid$data()),this.$dataError(),Q!==b.nil)Y.assign(Q,!1)}Y.else()}invalid$data(){let{gen:Q,schemaCode:X,schemaType:Y,def:W,it:G}=this;return(0,b.or)(J(),$());function J(){if(Y.length){if(!(X instanceof b.Name))throw Error("ajv implementation error");let H=Array.isArray(Y)?Y:[Y];return b._`${(0,dQ.checkDataTypes)(H,X,G.opts.strictNumbers,dQ.DataType.Wrong)}`}return b.nil}function $(){if(W.validateSchema){let H=Q.scopeValue("validate$data",{ref:W.validateSchema});return b._`!${H}(${X})`}return b.nil}}subschema(Q,X){let Y=(0,G8.getSubschema)(this.it,Q);(0,G8.extendSubschemaData)(Y,this.it,Q),(0,G8.extendSubschemaMode)(Y,Q);let W={...this.it,...Y,items:void 0,props:void 0};return ED(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,b.Name)),!0}}G5.KeywordCxt=H8;function Y5(Q,X,Y,W){let G=new H8(Q,Y,X);if("code"in Y)Y.code(G,W);else if(G.$data&&Y.validate)(0,j9.funcKeywordCode)(G,Y);else if("macro"in Y)(0,j9.macroKeywordCode)(G,Y);else if(Y.compile||Y.validate)(0,j9.funcKeywordCode)(G,Y)}var uD=/^\/(?:[^~]|~0|~1)*$/,fD=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function W5(Q,{dataLevel:X,dataNames:Y,dataPathArr:W}){let G,J;if(Q==="")return _.default.rootData;if(Q[0]==="/"){if(!uD.test(Q))throw Error(`Invalid JSON-pointer: ${Q}`);G=Q,J=_.default.rootData}else{let K=fD.exec(Q);if(!K)throw Error(`Invalid JSON-pointer: ${Q}`);let z=+K[1];if(G=K[2],G==="#"){if(z>=X)throw Error(B("property/index",z));return W[X-z]}if(z>X)throw Error(B("data",z));if(J=Y[X-z],!G)return J}let $=J,H=G.split("/");for(let K of H)if(K)J=b._`${J}${(0,b.getProperty)((0,r0.unescapeJsonPointer)(K))}`,$=b._`${$} && ${J}`;return $;function B(K,z){return`Cannot access ${K} ${z} levels up, current level is ${X}`}}G5.getData=W5});var nQ=w((H5)=>{Object.defineProperty(H5,"__esModule",{value:!0});class $5 extends Error{constructor(Q){super("validation failed");this.errors=Q,this.ajv=this.validation=!0}}H5.default=$5});var R9=w((K5)=>{Object.defineProperty(K5,"__esModule",{value:!0});var B8=E9();class B5 extends Error{constructor(Q,X,Y,W){super(W||`can't resolve reference ${Y} from id ${X}`);this.missingRef=(0,B8.resolveUrl)(Q,X,Y),this.missingSchema=(0,B8.normalizeId)((0,B8.getFullPath)(Q,this.missingRef))}}K5.default=B5});var oQ=w((F5)=>{Object.defineProperty(F5,"__esModule",{value:!0});F5.resolveSchema=F5.getCompilingSchema=F5.resolveRef=F5.compileSchema=F5.SchemaEnv=void 0;var x0=h(),iD=nQ(),Z1=n0(),g0=E9(),z5=c(),dD=T9();class S9{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,g0.normalizeId)(Y===null||Y===void 0?void 0:Y[Q.schemaId||"$id"]),this.schemaPath=Q.schemaPath,this.localRefs=Q.localRefs,this.meta=Q.meta,this.$async=Y===null||Y===void 0?void 0:Y.$async,this.refs={}}}F5.SchemaEnv=S9;function z8(Q){let X=A5.call(this,Q);if(X)return X;let Y=(0,g0.getFullPath)(this.opts.uriResolver,Q.root.baseId),{es5:W,lines:G}=this.opts.code,{ownProperties:J}=this.opts,$=new x0.CodeGen(this.scope,{es5:W,lines:G,ownProperties:J}),H;if(Q.$async)H=$.scopeValue("Error",{ref:iD.default,code:x0._`require("ajv/dist/runtime/validation_error").default`});let B=$.scopeName("validate");Q.validateName=B;let K={gen:$,allErrors:this.opts.allErrors,data:Z1.default.data,parentData:Z1.default.parentData,parentDataProperty:Z1.default.parentDataProperty,dataNames:[Z1.default.data],dataPathArr:[x0.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:$.scopeValue("schema",this.opts.code.source===!0?{ref:Q.schema,code:(0,x0.stringify)(Q.schema)}:{ref:Q.schema}),validateName:B,ValidationError:H,schema:Q.schema,schemaEnv:Q,rootId:Y,baseId:Q.baseId||Y,schemaPath:x0.nil,errSchemaPath:Q.schemaPath||(this.opts.jtd?"":"#"),errorPath:x0._`""`,opts:this.opts,self:this},z;try{this._compilations.add(Q),(0,dD.validateFunctionCode)(K),$.optimize(this.opts.code.optimize);let F=$.toString();if(z=`${$.scopeRefs(Z1.default.scope)}return ${F}`,this.opts.code.process)z=this.opts.code.process(z,Q);let D=Function(`${Z1.default.self}`,`${Z1.default.scope}`,z)(this,this.scope.get());if(this.scope.value(B,{ref:D}),D.errors=null,D.schema=Q.schema,D.schemaEnv=Q,Q.$async)D.$async=!0;if(this.opts.code.source===!0)D.source={validateName:B,validateCode:F,scopeValues:$._values};if(this.opts.unevaluated){let{props:Z,items:N}=K;if(D.evaluated={props:Z instanceof x0.Name?void 0:Z,items:N instanceof x0.Name?void 0:N,dynamicProps:Z instanceof x0.Name,dynamicItems:N instanceof x0.Name},D.source)D.source.evaluated=(0,x0.stringify)(D.evaluated)}return Q.validate=D,Q}catch(F){if(delete Q.validate,delete Q.validateName,z)this.logger.error("Error compiling schema, function code:",z);throw F}finally{this._compilations.delete(Q)}}F5.compileSchema=z8;function nD(Q,X,Y){var W;Y=(0,g0.resolveUrl)(this.opts.uriResolver,X,Y);let G=Q.refs[Y];if(G)return G;let J=tD.call(this,Q,Y);if(J===void 0){let $=(W=Q.localRefs)===null||W===void 0?void 0:W[Y],{schemaId:H}=this.opts;if($)J=new S9({schema:$,schemaId:H,root:Q,baseId:X})}if(J===void 0)return;return Q.refs[Y]=rD.call(this,J)}F5.resolveRef=nD;function rD(Q){if((0,g0.inlineRef)(Q.schema,this.opts.inlineRefs))return Q.schema;return Q.validate?Q:z8.call(this,Q)}function A5(Q){for(let X of this._compilations)if(oD(X,Q))return X}F5.getCompilingSchema=A5;function oD(Q,X){return Q.schema===X.schema&&Q.root===X.root&&Q.baseId===X.baseId}function tD(Q,X){let Y;while(typeof(Y=this.refs[X])=="string")X=Y;return Y||this.schemas[X]||rQ.call(this,Q,X)}function rQ(Q,X){let Y=this.opts.uriResolver.parse(X),W=(0,g0._getFullPath)(this.opts.uriResolver,Y),G=(0,g0.getFullPath)(this.opts.uriResolver,Q.baseId,void 0);if(Object.keys(Q.schema).length>0&&W===G)return K8.call(this,Y,Q);let J=(0,g0.normalizeId)(W),$=this.refs[J]||this.schemas[J];if(typeof $=="string"){let H=rQ.call(this,Q,$);if(typeof(H===null||H===void 0?void 0:H.schema)!=="object")return;return K8.call(this,Y,H)}if(typeof($===null||$===void 0?void 0:$.schema)!=="object")return;if(!$.validate)z8.call(this,$);if(J===(0,g0.normalizeId)(X)){let{schema:H}=$,{schemaId:B}=this.opts,K=H[B];if(K)G=(0,g0.resolveUrl)(this.opts.uriResolver,G,K);return new S9({schema:H,schemaId:B,root:Q,baseId:G})}return K8.call(this,Y,$)}F5.resolveSchema=rQ;var aD=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function K8(Q,{baseId:X,schema:Y,root:W}){var G;if(((G=Q.fragment)===null||G===void 0?void 0:G[0])!=="/")return;for(let H of Q.fragment.slice(1).split("/")){if(typeof Y==="boolean")return;let B=Y[(0,z5.unescapeFragment)(H)];if(B===void 0)return;Y=B;let K=typeof Y==="object"&&Y[this.opts.schemaId];if(!aD.has(H)&&K)X=(0,g0.resolveUrl)(this.opts.uriResolver,X,K)}let J;if(typeof Y!="boolean"&&Y.$ref&&!(0,z5.schemaHasRulesButRef)(Y,this.RULES)){let H=(0,g0.resolveUrl)(this.opts.uriResolver,X,Y.$ref);J=rQ.call(this,W,H)}let{schemaId:$}=this.opts;if(J=J||new S9({schema:Y,schemaId:$,root:W,baseId:X}),J.schema!==J.root.schema)return J;return}});var D5=w((gT,YV)=>{YV.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 L8=w((yT,M5)=>{var WV=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),U5=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),A8=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Z5=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),GV=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function F8(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 JV=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function V5(Q){return Q.length=0,!0}function $V(Q,X,Y){if(Q.length){let W=F8(Q);if(W!=="")X.push(W);else return Y.error=!0,!1;Q.length=0}return!0}function HV(Q){let X=0,Y={error:!1,address:"",zone:""},W=[],G=[],J=!1,$=!1,H=$V;for(let B=0;B<Q.length;B++){let K=Q[B];if(K==="["||K==="]")continue;if(K===":"){if(J===!0)$=!0;if(!H(G,W,Y))break;if(++X>7){Y.error=!0;break}if(B>0&&Q[B-1]===":")J=!0;W.push(":");continue}else if(K==="%"){if(!H(G,W,Y))break;H=V5}else{G.push(K);continue}}if(G.length)if(H===V5)Y.zone=G.join("");else if($)W.push(G.join(""));else W.push(F8(G));return Y.address=W.join(""),Y}function q5(Q){if(BV(Q,":")<2)return{host:Q,isIPV6:!1};let X=HV(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 BV(Q,X){let Y=0;for(let W=0;W<Q.length;W++)if(Q[W]===X)Y++;return Y}function KV(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("")}var zV={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},AV=/[@/?#:]/g,FV=/[@/?#]/g;function N5(Q,X){let Y=X?FV:AV;return Y.lastIndex=0,Q.replace(Y,(W)=>zV[W])}function LV(Q,X=!1){if(Q.indexOf("%")===-1)return Q;let Y="";for(let W=0;W<Q.length;W++){if(Q[W]==="%"&&W+2<Q.length){let G=Q.slice(W+1,W+3);if(A8(G)){let J=G.toUpperCase(),$=String.fromCharCode(parseInt(J,16));if(X&&Z5($))Y+=$;else Y+="%"+J;W+=2;continue}}Y+=Q[W]}return Y}function DV(Q){let X="";for(let Y=0;Y<Q.length;Y++){if(Q[Y]==="%"&&Y+2<Q.length){let W=Q.slice(Y+1,Y+3);if(A8(W)){let G=W.toUpperCase(),J=String.fromCharCode(parseInt(G,16));if(J!=="."&&Z5(J))X+=J;else X+="%"+G;Y+=2;continue}}if(GV(Q[Y]))X+=Q[Y];else X+=escape(Q[Y])}return X}function VV(Q){let X="";for(let Y=0;Y<Q.length;Y++){if(Q[Y]==="%"&&Y+2<Q.length){let W=Q.slice(Y+1,Y+3);if(A8(W)){X+="%"+W.toUpperCase(),Y+=2;continue}}X+=escape(Q[Y])}return X}function UV(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(!U5(Y)){let W=q5(Y);if(W.isIPV6===!0)Y=`[${W.escapedHost}]`;else Y=N5(Y,!1)}X.push(Y)}if(typeof Q.port==="number"||typeof Q.port==="string")X.push(":"),X.push(String(Q.port));return X.length?X.join(""):void 0}M5.exports={nonSimpleDomain:JV,recomposeAuthority:UV,reescapeHostDelimiters:N5,normalizePercentEncoding:LV,normalizePathEncoding:DV,escapePreservingEscapes:VV,removeDotSegments:KV,isIPv4:U5,isUUID:WV,normalizeIPv6:q5,stringArrayToHexStripped:F8}});var E5=w((hT,I5)=>{var{isUUID:ZV}=L8(),qV=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,NV=["http","https","ws","wss","urn","urn:uuid"];function MV(Q){return NV.indexOf(Q)!==-1}function D8(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 O5(Q){if(!Q.host)Q.error=Q.error||"HTTP URIs must have a host.";return Q}function w5(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 OV(Q){return Q.secure=D8(Q),Q.resourceName=(Q.path||"/")+(Q.query?"?"+Q.query:""),Q.path=void 0,Q.query=void 0,Q}function wV(Q){if(Q.port===(D8(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 PV(Q,X){if(!Q.path)return Q.error="URN can not be parsed",Q;let Y=Q.path.match(qV);if(Y){let W=X.scheme||Q.scheme||"urn";Q.nid=Y[1].toLowerCase(),Q.nss=Y[2];let G=`${W}:${X.nid||Q.nid}`,J=V8(G);if(Q.path=void 0,J)Q=J.parse(Q,X)}else Q.error=Q.error||"URN can not be parsed.";return Q}function IV(Q,X){if(Q.nid===void 0)throw Error("URN without nid cannot be serialized");let Y=X.scheme||Q.scheme||"urn",W=Q.nid.toLowerCase(),G=`${Y}:${X.nid||W}`,J=V8(G);if(J)Q=J.serialize(Q,X);let $=Q,H=Q.nss;return $.path=`${W||X.nid}:${H}`,X.skipEscape=!0,$}function EV(Q,X){let Y=Q;if(Y.uuid=Y.nss,Y.nss=void 0,!X.tolerant&&(!Y.uuid||!ZV(Y.uuid)))Y.error=Y.error||"UUID is not valid.";return Y}function bV(Q){let X=Q;return X.nss=(Q.uuid||"").toLowerCase(),X}var P5={scheme:"http",domainHost:!0,parse:O5,serialize:w5},jV={scheme:"https",domainHost:P5.domainHost,parse:O5,serialize:w5},tQ={scheme:"ws",domainHost:!0,parse:OV,serialize:wV},TV={scheme:"wss",domainHost:tQ.domainHost,parse:tQ.parse,serialize:tQ.serialize},RV={scheme:"urn",parse:PV,serialize:IV,skipNormalize:!0},SV={scheme:"urn:uuid",parse:EV,serialize:bV,skipNormalize:!0},aQ={http:P5,https:jV,ws:tQ,wss:TV,urn:RV,"urn:uuid":SV};Object.setPrototypeOf(aQ,null);function V8(Q){return Q&&(aQ[Q]||aQ[Q.toLowerCase()])||void 0}I5.exports={wsIsSecure:D8,SCHEMES:aQ,isValidSchemeName:MV,getSchemeHandler:V8}});var S5=w((uT,Q6)=>{var{normalizeIPv6:CV,removeDotSegments:C9,recomposeAuthority:kV,normalizePercentEncoding:vV,normalizePathEncoding:_V,escapePreservingEscapes:xV,reescapeHostDelimiters:gV,isIPv4:yV,nonSimpleDomain:hV}=L8(),{SCHEMES:uV,getSchemeHandler:j5}=E5();function fV(Q,X){if(typeof Q==="string")Q=nV(Q,X);else if(typeof Q==="object")Q=eQ(q1(Q,X),X);return Q}function lV(Q,X,Y){let W=Y?Object.assign({scheme:"null"},Y):{scheme:"null"},{parsed:G,malformedAuthorityOrPort:J}=sQ(Q,W),{parsed:$,malformedAuthorityOrPort:H}=sQ(X,W);if(J||H)throw Error(G.error||$.error||"URI is malformed.");let B=T5(G,$,W,!0);return W.skipEscape=!0,q1(B,W)}function T5(Q,X,Y,W){let G={};if(!W)Q=eQ(q1(Q,Y),Y),X=eQ(q1(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=C9(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=C9(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=C9(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=C9(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 mV(Q,X,Y){let W=b5(Q,Y),G=b5(X,Y);return W!==void 0&&G!==void 0&&W.toLowerCase()===G.toLowerCase()}function q1(Q,X){let Y={host:Q.host,scheme:Q.scheme,userinfo:Q.userinfo,port:Q.port,path:Q.path,query:Q.query,nid:Q.nid,nss:Q.nss,uuid:Q.uuid,fragment:Q.fragment,reference:Q.reference,resourceName:Q.resourceName,secure:Q.secure,error:""},W=Object.assign({},X),G=[],J=j5(W.scheme||Y.scheme);if(J&&J.serialize)J.serialize(Y,W);if(Y.path!==void 0)if(!W.skipEscape){if(Y.path=xV(Y.path),Y.scheme!==void 0)Y.path=Y.path.split("%3A").join(":")}else Y.path=vV(Y.path);if(W.reference!=="suffix"&&Y.scheme)G.push(Y.scheme,":");let $=kV(Y);if($!==void 0){if(W.reference!=="suffix")G.push("//");if(G.push($),Y.path&&Y.path[0]!=="/")G.push("/")}if(Y.path!==void 0){let H=Y.path;if(!W.absolutePath&&(!J||!J.absolutePath))H=C9(H);if($===void 0&&H[0]==="/"&&H[1]==="/")H="/%2F"+H.slice(2);G.push(H)}if(Y.query!==void 0)G.push("?",Y.query);if(Y.fragment!==void 0)G.push("#",Y.fragment);return G.join("")}var cV=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,pV=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,iV=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function dV(Q,X){if(X[2]!==void 0&&Q.path&&Q.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof Q.port==="number"&&(Q.port<0||Q.port>65535))return"URI port is malformed.";return}function sQ(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,J=!1;if(Y.reference==="suffix")if(Y.scheme)Q=Y.scheme+":"+Q;else Q="//"+Q;let $=Q.match(pV);if($!==null&&$[1].indexOf("\\")!==-1)W.error="URI authority must not contain a literal backslash.",G=!0;let H=Q.match(iV);if(H!==null){let K=H[1],z=K.replace(/[\t\n\r]/g,"");if(z.length>=2){if(z.slice(0,2)!=="//")W.error=W.error||"URI authority must not contain a literal backslash.",G=!0;else if(K.length!==z.length)W.error=W.error||"URI authority introducer must not contain whitespace.",G=!0}}let B=Q.match(cV);if(B){if(W.scheme=B[1],W.userinfo=B[3],W.host=B[4],W.port=parseInt(B[5],10),W.path=B[6]||"",W.query=B[7],W.fragment=B[8],isNaN(W.port))W.port=B[5];let K=dV(W,B);if(K!==void 0)W.error=W.error||K,G=!0;if(W.host)if(yV(W.host)===!1){let L=CV(W.host);W.host=L.host.toLowerCase(),J=L.isIPV6}else J=!0;if(W.scheme===void 0&&W.userinfo===void 0&&W.host===void 0&&W.port===void 0&&W.query===void 0&&!W.path)W.reference="same-document";else if(W.scheme===void 0)W.reference="relative";else if(W.fragment===void 0)W.reference="absolute";else W.reference="uri";if(Y.reference&&Y.reference!=="suffix"&&Y.reference!==W.reference)W.error=W.error||"URI is not a "+Y.reference+" reference.";let z=j5(Y.scheme||W.scheme);if(!Y.unicodeSupport&&(!z||!z.unicodeSupport)){if(W.host&&(Y.domainHost||z&&z.domainHost)&&J===!1&&hV(W.host))try{W.host=new URL("http://"+W.host).hostname}catch(F){W.error=W.error||"Host's domain name can not be converted to ASCII: "+F}}if(!z||z&&!z.skipNormalize){if(Q.indexOf("%")!==-1){if(W.scheme!==void 0)W.scheme=unescape(W.scheme);if(W.host!==void 0)W.host=gV(unescape(W.host),J)}if(W.path)W.path=_V(W.path);if(W.fragment)try{W.fragment=encodeURI(decodeURIComponent(W.fragment))}catch{W.error=W.error||"URI malformed"}}if(z&&z.parse)z.parse(W,Y)}else W.error=W.error||"URI can not be parsed.";return{parsed:W,malformedAuthorityOrPort:G}}function eQ(Q,X){return sQ(Q,X).parsed}function nV(Q,X){return R5(Q,X).normalized}function R5(Q,X){let{parsed:Y,malformedAuthorityOrPort:W}=sQ(Q,X);return{normalized:W?Q:q1(Y,X),malformedAuthorityOrPort:W}}function b5(Q,X){if(typeof Q==="string"){let{normalized:Y,malformedAuthorityOrPort:W}=R5(Q,X);return W?void 0:Y}if(typeof Q==="object")return q1(Q,X)}var U8={SCHEMES:uV,normalize:fV,resolve:lV,resolveComponent:T5,equal:mV,serialize:q1,parse:eQ};Q6.exports=U8;Q6.exports.default=U8;Q6.exports.fastUri=U8});var v5=w((k5)=>{Object.defineProperty(k5,"__esModule",{value:!0});var C5=S5();C5.code='require("ajv/dist/runtime/uri").default';k5.default=C5});var l5=w((o0)=>{Object.defineProperty(o0,"__esModule",{value:!0});o0.CodeGen=o0.Name=o0.nil=o0.stringify=o0.str=o0._=o0.KeywordCxt=void 0;var oV=T9();Object.defineProperty(o0,"KeywordCxt",{enumerable:!0,get:function(){return oV.KeywordCxt}});var h1=h();Object.defineProperty(o0,"_",{enumerable:!0,get:function(){return h1._}});Object.defineProperty(o0,"str",{enumerable:!0,get:function(){return h1.str}});Object.defineProperty(o0,"stringify",{enumerable:!0,get:function(){return h1.stringify}});Object.defineProperty(o0,"nil",{enumerable:!0,get:function(){return h1.nil}});Object.defineProperty(o0,"Name",{enumerable:!0,get:function(){return h1.Name}});Object.defineProperty(o0,"CodeGen",{enumerable:!0,get:function(){return h1.CodeGen}});var tV=nQ(),h5=R9(),aV=r4(),k9=oQ(),sV=h(),v9=E9(),X6=I9(),q8=c(),_5=D5(),eV=v5(),u5=(Q,X)=>new RegExp(Q,X);u5.code="new RegExp";var QU=["removeAdditional","useDefaults","coerceTypes"],XU=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),YU={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."},WU={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},x5=200;function GU(Q){var X,Y,W,G,J,$,H,B,K,z,F,L,D,Z,N,M,O,k,j,S,I,N0,I0,d1,I6;let n1=Q.strict,E6=(X=Q.code)===null||X===void 0?void 0:X.optimize,WX=E6===!0||E6===void 0?1:E6||0,GX=(W=(Y=Q.code)===null||Y===void 0?void 0:Y.regExp)!==null&&W!==void 0?W:u5,fH=(G=Q.uriResolver)!==null&&G!==void 0?G:eV.default;return{strictSchema:($=(J=Q.strictSchema)!==null&&J!==void 0?J:n1)!==null&&$!==void 0?$:!0,strictNumbers:(B=(H=Q.strictNumbers)!==null&&H!==void 0?H:n1)!==null&&B!==void 0?B:!0,strictTypes:(z=(K=Q.strictTypes)!==null&&K!==void 0?K:n1)!==null&&z!==void 0?z:"log",strictTuples:(L=(F=Q.strictTuples)!==null&&F!==void 0?F:n1)!==null&&L!==void 0?L:"log",strictRequired:(Z=(D=Q.strictRequired)!==null&&D!==void 0?D:n1)!==null&&Z!==void 0?Z:!1,code:Q.code?{...Q.code,optimize:WX,regExp:GX}:{optimize:WX,regExp:GX},loopRequired:(N=Q.loopRequired)!==null&&N!==void 0?N:x5,loopEnum:(M=Q.loopEnum)!==null&&M!==void 0?M:x5,meta:(O=Q.meta)!==null&&O!==void 0?O:!0,messages:(k=Q.messages)!==null&&k!==void 0?k:!0,inlineRefs:(j=Q.inlineRefs)!==null&&j!==void 0?j:!0,schemaId:(S=Q.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(I=Q.addUsedSchema)!==null&&I!==void 0?I:!0,validateSchema:(N0=Q.validateSchema)!==null&&N0!==void 0?N0:!0,validateFormats:(I0=Q.validateFormats)!==null&&I0!==void 0?I0:!0,unicodeRegExp:(d1=Q.unicodeRegExp)!==null&&d1!==void 0?d1:!0,int32range:(I6=Q.int32range)!==null&&I6!==void 0?I6:!0,uriResolver:fH}}class Y6{constructor(Q={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,Q=this.opts={...Q,...GU(Q)};let{es5:X,lines:Y}=this.opts.code;this.scope=new sV.ValueScope({scope:{},prefixes:XU,es5:X,lines:Y}),this.logger=zU(Q.logger);let W=Q.validateFormats;if(Q.validateFormats=!1,this.RULES=(0,aV.getRules)(),g5.call(this,YU,Q,"NOT SUPPORTED"),g5.call(this,WU,Q,"DEPRECATED","warn"),this._metaOpts=BU.call(this),Q.formats)$U.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),Q.keywords)HU.call(this,Q.keywords);if(typeof Q.meta=="object")this.addMetaSchema(Q.meta);JU.call(this),Q.validateFormats=W}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:Q,meta:X,schemaId:Y}=this.opts,W=_5;if(Y==="id")W={..._5},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(K,z){await G.call(this,K.$schema);let F=this._addSchema(K,z);return F.validate||J.call(this,F)}async function G(K){if(K&&!this.getSchema(K))await W.call(this,{$ref:K},!0)}async function J(K){try{return this._compileSchemaEnv(K)}catch(z){if(!(z instanceof h5.default))throw z;return $.call(this,z),await H.call(this,z.missingSchema),J.call(this,K)}}function $({missingSchema:K,missingRef:z}){if(this.refs[K])throw Error(`AnySchema ${K} is loaded but ${z} cannot be resolved`)}async function H(K){let z=await B.call(this,K);if(!this.refs[K])await G.call(this,z.$schema);if(!this.refs[K])this.addSchema(z,K,X)}async function B(K){let z=this._loading[K];if(z)return z;try{return await(this._loading[K]=Y(K))}finally{delete this._loading[K]}}}addSchema(Q,X,Y,W=this.opts.validateSchema){if(Array.isArray(Q)){for(let J of Q)this.addSchema(J,void 0,Y,W);return this}let G;if(typeof Q==="object"){let{schemaId:J}=this.opts;if(G=Q[J],G!==void 0&&typeof G!="string")throw Error(`schema ${J} must be string`)}return X=(0,v9.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=y5.call(this,Q))=="string")Q=X;if(X===void 0){let{schemaId:Y}=this.opts,W=new k9.SchemaEnv({schema:{},schemaId:Y});if(X=k9.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=y5.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,v9.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(FU.call(this,Y,X),!X)return(0,q8.eachItem)(Y,(G)=>Z8.call(this,G)),this;DU.call(this,X);let W={...X,type:(0,X6.getJSONTypes)(X.type),schemaType:(0,X6.getJSONTypes)(X.schemaType)};return(0,q8.eachItem)(Y,W.type.length===0?(G)=>Z8.call(this,G,W):(G)=>W.type.forEach((J)=>Z8.call(this,G,W,J))),this}getKeyword(Q){let X=this.RULES.all[Q];return typeof X=="object"?X.definition:!!X}removeKeyword(Q){let{RULES:X}=this;delete X.keywords[Q],delete X.all[Q];for(let Y of X.rules){let W=Y.rules.findIndex((G)=>G.keyword===Q);if(W>=0)Y.rules.splice(W,1)}return this}addFormat(Q,X){if(typeof X=="string")X=new RegExp(X);return this.formats[Q]=X,this}errorsText(Q=this.errors,{separator:X=", ",dataVar:Y="data"}={}){if(!Q||Q.length===0)return"No errors";return Q.map((W)=>`${Y}${W.instancePath} ${W.message}`).reduce((W,G)=>W+X+G)}$dataMetaSchema(Q,X){let Y=this.RULES.all;Q=JSON.parse(JSON.stringify(Q));for(let W of X){let G=W.split("/").slice(1),J=Q;for(let $ of G)J=J[$];for(let $ in Y){let H=Y[$];if(typeof H!="object")continue;let{$data:B}=H.definition,K=J[$];if(B&&K)J[$]=f5(K)}}return Q}_removeAllSchemas(Q,X){for(let Y in Q){let W=Q[Y];if(!X||X.test(Y)){if(typeof W=="string")delete Q[Y];else if(W&&!W.meta)this._cache.delete(W.schema),delete Q[Y]}}}_addSchema(Q,X,Y,W=this.opts.validateSchema,G=this.opts.addUsedSchema){let J,{schemaId:$}=this.opts;if(typeof Q=="object")J=Q[$];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof Q!="boolean")throw Error("schema must be object or boolean");let H=this._cache.get(Q);if(H!==void 0)return H;Y=(0,v9.normalizeId)(J||Y);let B=v9.getSchemaRefs.call(this,Q,Y);if(H=new k9.SchemaEnv({schema:Q,schemaId:$,meta:X,baseId:Y,localRefs:B}),this._cache.set(H.schema,H),G&&!Y.startsWith("#")){if(Y)this._checkUnique(Y);this.refs[Y]=H}if(W)this.validateSchema(Q,!0);return H}_checkUnique(Q){if(this.schemas[Q]||this.refs[Q])throw Error(`schema with key or id "${Q}" already exists`)}_compileSchemaEnv(Q){if(Q.meta)this._compileMetaSchema(Q);else k9.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{k9.compileSchema.call(this,Q)}finally{this.opts=X}}}Y6.ValidationError=tV.default;Y6.MissingRefError=h5.default;o0.default=Y6;function g5(Q,X,Y,W="error"){for(let G in Q){let J=G;if(J in X)this.logger[W](`${Y}: option ${G}. ${Q[J]}`)}}function y5(Q){return Q=(0,v9.normalizeId)(Q),this.schemas[Q]||this.refs[Q]}function JU(){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 $U(){for(let Q in this.opts.formats){let X=this.opts.formats[Q];if(X)this.addFormat(Q,X)}}function HU(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 BU(){let Q={...this.opts};for(let X of QU)delete Q[X];return Q}var KU={log(){},warn(){},error(){}};function zU(Q){if(Q===!1)return KU;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 AU=/^[a-z_$][a-z0-9_$:-]*$/i;function FU(Q,X){let{RULES:Y}=this;if((0,q8.eachItem)(Q,(W)=>{if(Y.keywords[W])throw Error(`Keyword ${W} is already defined`);if(!AU.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 Z8(Q,X,Y){var W;let G=X===null||X===void 0?void 0:X.post;if(Y&&G)throw Error('keyword with "post" flag cannot have "type"');let{RULES:J}=this,$=G?J.post:J.rules.find(({type:B})=>B===Y);if(!$)$={type:Y,rules:[]},J.rules.push($);if(J.keywords[Q]=!0,!X)return;let H={keyword:Q,definition:{...X,type:(0,X6.getJSONTypes)(X.type),schemaType:(0,X6.getJSONTypes)(X.schemaType)}};if(X.before)LU.call(this,$,H,X.before);else $.rules.push(H);J.all[Q]=H,(W=X.implements)===null||W===void 0||W.forEach((B)=>this.addKeyword(B))}function LU(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 DU(Q){let{metaSchema:X}=Q;if(X===void 0)return;if(Q.$data&&this.opts.$data)X=f5(X);Q.validateSchema=this.compile(X,!0)}var VU={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function f5(Q){return{anyOf:[Q,VU]}}});var c5=w((m5)=>{Object.defineProperty(m5,"__esModule",{value:!0});var qU={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};m5.default=qU});var o5=w((n5)=>{Object.defineProperty(n5,"__esModule",{value:!0});n5.callRef=n5.getValidate=void 0;var MU=R9(),p5=T0(),Z0=h(),u1=n0(),i5=oQ(),W6=c(),OU={keyword:"$ref",schemaType:"string",code(Q){let{gen:X,schema:Y,it:W}=Q,{baseId:G,schemaEnv:J,validateName:$,opts:H,self:B}=W,{root:K}=J;if((Y==="#"||Y==="#/")&&G===K.baseId)return F();let z=i5.resolveRef.call(B,K,G,Y);if(z===void 0)throw new MU.default(W.opts.uriResolver,G,Y);if(z instanceof i5.SchemaEnv)return L(z);return D(z);function F(){if(J===K)return G6(Q,$,J,J.$async);let Z=X.scopeValue("root",{ref:K});return G6(Q,Z0._`${Z}.validate`,K,K.$async)}function L(Z){let N=d5(Q,Z);G6(Q,N,Z,Z.$async)}function D(Z){let N=X.scopeValue("schema",H.code.source===!0?{ref:Z,code:(0,Z0.stringify)(Z)}:{ref:Z}),M=X.name("valid"),O=Q.subschema({schema:Z,dataTypes:[],schemaPath:Z0.nil,topSchemaRef:N,errSchemaPath:Y},M);Q.mergeEvaluated(O),Q.ok(M)}}};function d5(Q,X){let{gen:Y}=Q;return X.validate?Y.scopeValue("validate",{ref:X.validate}):Z0._`${Y.scopeValue("wrapper",{ref:X})}.validate`}n5.getValidate=d5;function G6(Q,X,Y,W){let{gen:G,it:J}=Q,{allErrors:$,schemaEnv:H,opts:B}=J,K=B.passContext?u1.default.this:Z0.nil;if(W)z();else F();function z(){if(!H.$async)throw Error("async schema referenced by sync schema");let Z=G.let("valid");G.try(()=>{if(G.code(Z0._`await ${(0,p5.callValidateCode)(Q,X,K)}`),D(X),!$)G.assign(Z,!0)},(N)=>{if(G.if(Z0._`!(${N} instanceof ${J.ValidationError})`,()=>G.throw(N)),L(N),!$)G.assign(Z,!1)}),Q.ok(Z)}function F(){Q.result((0,p5.callValidateCode)(Q,X,K),()=>D(X),()=>L(X))}function L(Z){let N=Z0._`${Z}.errors`;G.assign(u1.default.vErrors,Z0._`${u1.default.vErrors} === null ? ${N} : ${u1.default.vErrors}.concat(${N})`),G.assign(u1.default.errors,Z0._`${u1.default.vErrors}.length`)}function D(Z){var N;if(!J.opts.unevaluated)return;let M=(N=Y===null||Y===void 0?void 0:Y.validate)===null||N===void 0?void 0:N.evaluated;if(J.props!==!0)if(M&&!M.dynamicProps){if(M.props!==void 0)J.props=W6.mergeEvaluated.props(G,M.props,J.props)}else{let O=G.var("props",Z0._`${Z}.evaluated.props`);J.props=W6.mergeEvaluated.props(G,O,J.props,Z0.Name)}if(J.items!==!0)if(M&&!M.dynamicItems){if(M.items!==void 0)J.items=W6.mergeEvaluated.items(G,M.items,J.items)}else{let O=G.var("items",Z0._`${Z}.evaluated.items`);J.items=W6.mergeEvaluated.items(G,O,J.items,Z0.Name)}}}n5.callRef=G6;n5.default=OU});var a5=w((t5)=>{Object.defineProperty(t5,"__esModule",{value:!0});var IU=c5(),EU=o5(),bU=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",IU.default,EU.default];t5.default=bU});var e5=w((s5)=>{Object.defineProperty(s5,"__esModule",{value:!0});var J6=h(),B1=J6.operators,$6={maximum:{okStr:"<=",ok:B1.LTE,fail:B1.GT},minimum:{okStr:">=",ok:B1.GTE,fail:B1.LT},exclusiveMaximum:{okStr:"<",ok:B1.LT,fail:B1.GTE},exclusiveMinimum:{okStr:">",ok:B1.GT,fail:B1.LTE}},TU={message:({keyword:Q,schemaCode:X})=>J6.str`must be ${$6[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>J6._`{comparison: ${$6[Q].okStr}, limit: ${X}}`},RU={keyword:Object.keys($6),type:"number",schemaType:"number",$data:!0,error:TU,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q;Q.fail$data(J6._`${Y} ${$6[X].fail} ${W} || isNaN(${Y})`)}};s5.default=RU});var X3=w((Q3)=>{Object.defineProperty(Q3,"__esModule",{value:!0});var _9=h(),CU={message:({schemaCode:Q})=>_9.str`must be multiple of ${Q}`,params:({schemaCode:Q})=>_9._`{multipleOf: ${Q}}`},kU={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:CU,code(Q){let{gen:X,data:Y,schemaCode:W,it:G}=Q,J=G.opts.multipleOfPrecision,$=X.let("res"),H=J?_9._`Math.abs(Math.round(${$}) - ${$}) > 1e-${J}`:_9._`${$} !== parseInt(${$})`;Q.fail$data(_9._`(${W} === 0 || (${$} = ${Y}/${W}, ${H}))`)}};Q3.default=kU});var G3=w((W3)=>{Object.defineProperty(W3,"__esModule",{value:!0});function Y3(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}W3.default=Y3;Y3.code='require("ajv/dist/runtime/ucs2length").default'});var $3=w((J3)=>{Object.defineProperty(J3,"__esModule",{value:!0});var N1=h(),xU=c(),gU=G3(),yU={message({keyword:Q,schemaCode:X}){let Y=Q==="maxLength"?"more":"fewer";return N1.str`must NOT have ${Y} than ${X} characters`},params:({schemaCode:Q})=>N1._`{limit: ${Q}}`},hU={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:yU,code(Q){let{keyword:X,data:Y,schemaCode:W,it:G}=Q,J=X==="maxLength"?N1.operators.GT:N1.operators.LT,$=G.opts.unicode===!1?N1._`${Y}.length`:N1._`${(0,xU.useFunc)(Q.gen,gU.default)}(${Y})`;Q.fail$data(N1._`${$} ${J} ${W}`)}};J3.default=hU});var B3=w((H3)=>{Object.defineProperty(H3,"__esModule",{value:!0});var fU=T0(),lU=c(),f1=h(),mU={message:({schemaCode:Q})=>f1.str`must match pattern "${Q}"`,params:({schemaCode:Q})=>f1._`{pattern: ${Q}}`},cU={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:mU,code(Q){let{gen:X,data:Y,$data:W,schema:G,schemaCode:J,it:$}=Q,H=$.opts.unicodeRegExp?"u":"";if(W){let{regExp:B}=$.opts.code,K=B.code==="new RegExp"?f1._`new RegExp`:(0,lU.useFunc)(X,B),z=X.let("valid");X.try(()=>X.assign(z,f1._`${K}(${J}, ${H}).test(${Y})`),()=>X.assign(z,!1)),Q.fail$data(f1._`!${z}`)}else{let B=(0,fU.usePattern)(Q,G);Q.fail$data(f1._`!${B}.test(${Y})`)}}};H3.default=cU});var z3=w((K3)=>{Object.defineProperty(K3,"__esModule",{value:!0});var x9=h(),iU={message({keyword:Q,schemaCode:X}){let Y=Q==="maxProperties"?"more":"fewer";return x9.str`must NOT have ${Y} than ${X} properties`},params:({schemaCode:Q})=>x9._`{limit: ${Q}}`},dU={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:iU,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxProperties"?x9.operators.GT:x9.operators.LT;Q.fail$data(x9._`Object.keys(${Y}).length ${G} ${W}`)}};K3.default=dU});var F3=w((A3)=>{Object.defineProperty(A3,"__esModule",{value:!0});var g9=T0(),y9=h(),rU=c(),oU={message:({params:{missingProperty:Q}})=>y9.str`must have required property '${Q}'`,params:({params:{missingProperty:Q}})=>y9._`{missingProperty: ${Q}}`},tU={keyword:"required",type:"object",schemaType:"array",$data:!0,error:oU,code(Q){let{gen:X,schema:Y,schemaCode:W,data:G,$data:J,it:$}=Q,{opts:H}=$;if(!J&&Y.length===0)return;let B=Y.length>=H.loopRequired;if($.allErrors)K();else z();if(H.strictRequired){let D=Q.parentSchema.properties,{definedProperties:Z}=Q.it;for(let N of Y)if((D===null||D===void 0?void 0:D[N])===void 0&&!Z.has(N)){let M=$.schemaEnv.baseId+$.errSchemaPath,O=`required property "${N}" is not defined at "${M}" (strictRequired)`;(0,rU.checkStrictMode)($,O,$.opts.strictRequired)}}function K(){if(B||J)Q.block$data(y9.nil,F);else for(let D of Y)(0,g9.checkReportMissingProp)(Q,D)}function z(){let D=X.let("missing");if(B||J){let Z=X.let("valid",!0);Q.block$data(Z,()=>L(D,Z)),Q.ok(Z)}else X.if((0,g9.checkMissingProp)(Q,Y,D)),(0,g9.reportMissingProp)(Q,D),X.else()}function F(){X.forOf("prop",W,(D)=>{Q.setParams({missingProperty:D}),X.if((0,g9.noPropertyInData)(X,G,D,H.ownProperties),()=>Q.error())})}function L(D,Z){Q.setParams({missingProperty:D}),X.forOf(D,W,()=>{X.assign(Z,(0,g9.propertyInData)(X,G,D,H.ownProperties)),X.if((0,y9.not)(Z),()=>{Q.error(),X.break()})},y9.nil)}}};A3.default=tU});var D3=w((L3)=>{Object.defineProperty(L3,"__esModule",{value:!0});var h9=h(),sU={message({keyword:Q,schemaCode:X}){let Y=Q==="maxItems"?"more":"fewer";return h9.str`must NOT have ${Y} than ${X} items`},params:({schemaCode:Q})=>h9._`{limit: ${Q}}`},eU={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:sU,code(Q){let{keyword:X,data:Y,schemaCode:W}=Q,G=X==="maxItems"?h9.operators.GT:h9.operators.LT;Q.fail$data(h9._`${Y}.length ${G} ${W}`)}};L3.default=eU});var H6=w((U3)=>{Object.defineProperty(U3,"__esModule",{value:!0});var V3=Y8();V3.code='require("ajv/dist/runtime/equal").default';U3.default=V3});var q3=w((Z3)=>{Object.defineProperty(Z3,"__esModule",{value:!0});var N8=I9(),B0=h(),YZ=c(),WZ=H6(),GZ={message:({params:{i:Q,j:X}})=>B0.str`must NOT have duplicate items (items ## ${X} and ${Q} are identical)`,params:({params:{i:Q,j:X}})=>B0._`{i: ${Q}, j: ${X}}`},JZ={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:GZ,code(Q){let{gen:X,data:Y,$data:W,schema:G,parentSchema:J,schemaCode:$,it:H}=Q;if(!W&&!G)return;let B=X.let("valid"),K=J.items?(0,N8.getSchemaTypes)(J.items):[];Q.block$data(B,z,B0._`${$} === false`),Q.ok(B);function z(){let Z=X.let("i",B0._`${Y}.length`),N=X.let("j");Q.setParams({i:Z,j:N}),X.assign(B,!0),X.if(B0._`${Z} > 1`,()=>(F()?L:D)(Z,N))}function F(){return K.length>0&&!K.some((Z)=>Z==="object"||Z==="array")}function L(Z,N){let M=X.name("item"),O=(0,N8.checkDataTypes)(K,M,H.opts.strictNumbers,N8.DataType.Wrong),k=X.const("indices",B0._`{}`);X.for(B0._`;${Z}--;`,()=>{if(X.let(M,B0._`${Y}[${Z}]`),X.if(O,B0._`continue`),K.length>1)X.if(B0._`typeof ${M} == "string"`,B0._`${M} += "_"`);X.if(B0._`typeof ${k}[${M}] == "number"`,()=>{X.assign(N,B0._`${k}[${M}]`),Q.error(),X.assign(B,!1).break()}).code(B0._`${k}[${M}] = ${Z}`)})}function D(Z,N){let M=(0,YZ.useFunc)(X,WZ.default),O=X.name("outer");X.label(O).for(B0._`;${Z}--;`,()=>X.for(B0._`${N} = ${Z}; ${N}--;`,()=>X.if(B0._`${M}(${Y}[${Z}], ${Y}[${N}])`,()=>{Q.error(),X.assign(B,!1).break(O)})))}}};Z3.default=JZ});var M3=w((N3)=>{Object.defineProperty(N3,"__esModule",{value:!0});var M8=h(),HZ=c(),BZ=H6(),KZ={message:"must be equal to constant",params:({schemaCode:Q})=>M8._`{allowedValue: ${Q}}`},zZ={keyword:"const",$data:!0,error:KZ,code(Q){let{gen:X,data:Y,$data:W,schemaCode:G,schema:J}=Q;if(W||J&&typeof J=="object")Q.fail$data(M8._`!${(0,HZ.useFunc)(X,BZ.default)}(${Y}, ${G})`);else Q.fail(M8._`${J} !== ${Y}`)}};N3.default=zZ});var w3=w((O3)=>{Object.defineProperty(O3,"__esModule",{value:!0});var u9=h(),FZ=c(),LZ=H6(),DZ={message:"must be equal to one of the allowed values",params:({schemaCode:Q})=>u9._`{allowedValues: ${Q}}`},VZ={keyword:"enum",schemaType:"array",$data:!0,error:DZ,code(Q){let{gen:X,data:Y,$data:W,schema:G,schemaCode:J,it:$}=Q;if(!W&&G.length===0)throw Error("enum must have non-empty array");let H=G.length>=$.opts.loopEnum,B,K=()=>B!==null&&B!==void 0?B:B=(0,FZ.useFunc)(X,LZ.default),z;if(H||W)z=X.let("valid"),Q.block$data(z,F);else{if(!Array.isArray(G))throw Error("ajv implementation error");let D=X.const("vSchema",J);z=(0,u9.or)(...G.map((Z,N)=>L(D,N)))}Q.pass(z);function F(){X.assign(z,!1),X.forOf("v",J,(D)=>X.if(u9._`${K()}(${Y}, ${D})`,()=>X.assign(z,!0).break()))}function L(D,Z){let N=G[Z];return typeof N==="object"&&N!==null?u9._`${K()}(${Y}, ${D}[${Z}])`:u9._`${Y} === ${N}`}}};O3.default=VZ});var I3=w((P3)=>{Object.defineProperty(P3,"__esModule",{value:!0});var ZZ=e5(),qZ=X3(),NZ=$3(),MZ=B3(),OZ=z3(),wZ=F3(),PZ=D3(),IZ=q3(),EZ=M3(),bZ=w3(),jZ=[ZZ.default,qZ.default,NZ.default,MZ.default,OZ.default,wZ.default,PZ.default,IZ.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},EZ.default,bZ.default];P3.default=jZ});var w8=w((b3)=>{Object.defineProperty(b3,"__esModule",{value:!0});b3.validateAdditionalItems=void 0;var M1=h(),O8=c(),RZ={message:({params:{len:Q}})=>M1.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>M1._`{limit: ${Q}}`},SZ={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:RZ,code(Q){let{parentSchema:X,it:Y}=Q,{items:W}=X;if(!Array.isArray(W)){(0,O8.checkStrictMode)(Y,'"additionalItems" is ignored when "items" is not an array of schemas');return}E3(Q,W)}};function E3(Q,X){let{gen:Y,schema:W,data:G,keyword:J,it:$}=Q;$.items=!0;let H=Y.const("len",M1._`${G}.length`);if(W===!1)Q.setParams({len:X.length}),Q.pass(M1._`${H} <= ${X.length}`);else if(typeof W=="object"&&!(0,O8.alwaysValidSchema)($,W)){let K=Y.var("valid",M1._`${H} <= ${X.length}`);Y.if((0,M1.not)(K),()=>B(K)),Q.ok(K)}function B(K){Y.forRange("i",X.length,H,(z)=>{if(Q.subschema({keyword:J,dataProp:z,dataPropType:O8.Type.Num},K),!$.allErrors)Y.if((0,M1.not)(K),()=>Y.break())})}}b3.validateAdditionalItems=E3;b3.default=SZ});var P8=w((S3)=>{Object.defineProperty(S3,"__esModule",{value:!0});S3.validateTuple=void 0;var T3=h(),B6=c(),kZ=T0(),vZ={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(Q){let{schema:X,it:Y}=Q;if(Array.isArray(X))return R3(Q,"additionalItems",X);if(Y.items=!0,(0,B6.alwaysValidSchema)(Y,X))return;Q.ok((0,kZ.validateArray)(Q))}};function R3(Q,X,Y=Q.schema){let{gen:W,parentSchema:G,data:J,keyword:$,it:H}=Q;if(z(G),H.opts.unevaluated&&Y.length&&H.items!==!0)H.items=B6.mergeEvaluated.items(W,Y.length,H.items);let B=W.name("valid"),K=W.const("len",T3._`${J}.length`);Y.forEach((F,L)=>{if((0,B6.alwaysValidSchema)(H,F))return;W.if(T3._`${K} > ${L}`,()=>Q.subschema({keyword:$,schemaProp:L,dataProp:L},B)),Q.ok(B)});function z(F){let{opts:L,errSchemaPath:D}=H,Z=Y.length,N=Z===F.minItems&&(Z===F.maxItems||F[X]===!1);if(L.strictTuples&&!N){let M=`"${$}" is ${Z}-tuple, but minItems or maxItems/${X} are not specified or different at path "${D}"`;(0,B6.checkStrictMode)(H,M,L.strictTuples)}}}S3.validateTuple=R3;S3.default=vZ});var v3=w((k3)=>{Object.defineProperty(k3,"__esModule",{value:!0});var xZ=P8(),gZ={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(Q)=>(0,xZ.validateTuple)(Q,"items")};k3.default=gZ});var g3=w((x3)=>{Object.defineProperty(x3,"__esModule",{value:!0});var _3=h(),hZ=c(),uZ=T0(),fZ=w8(),lZ={message:({params:{len:Q}})=>_3.str`must NOT have more than ${Q} items`,params:({params:{len:Q}})=>_3._`{limit: ${Q}}`},mZ={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:lZ,code(Q){let{schema:X,parentSchema:Y,it:W}=Q,{prefixItems:G}=Y;if(W.items=!0,(0,hZ.alwaysValidSchema)(W,X))return;if(G)(0,fZ.validateAdditionalItems)(Q,G);else Q.ok((0,uZ.validateArray)(Q))}};x3.default=mZ});var h3=w((y3)=>{Object.defineProperty(y3,"__esModule",{value:!0});var R0=h(),K6=c(),pZ={message:({params:{min:Q,max:X}})=>X===void 0?R0.str`must contain at least ${Q} valid item(s)`:R0.str`must contain at least ${Q} and no more than ${X} valid item(s)`,params:({params:{min:Q,max:X}})=>X===void 0?R0._`{minContains: ${Q}}`:R0._`{minContains: ${Q}, maxContains: ${X}}`},iZ={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:pZ,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:J}=Q,$,H,{minContains:B,maxContains:K}=W;if(J.opts.next)$=B===void 0?1:B,H=K;else $=1;let z=X.const("len",R0._`${G}.length`);if(Q.setParams({min:$,max:H}),H===void 0&&$===0){(0,K6.checkStrictMode)(J,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(H!==void 0&&$>H){(0,K6.checkStrictMode)(J,'"minContains" > "maxContains" is always invalid'),Q.fail();return}if((0,K6.alwaysValidSchema)(J,Y)){let N=R0._`${z} >= ${$}`;if(H!==void 0)N=R0._`${N} && ${z} <= ${H}`;Q.pass(N);return}J.items=!0;let F=X.name("valid");if(H===void 0&&$===1)D(F,()=>X.if(F,()=>X.break()));else if($===0){if(X.let(F,!0),H!==void 0)X.if(R0._`${G}.length > 0`,L)}else X.let(F,!1),L();Q.result(F,()=>Q.reset());function L(){let N=X.name("_valid"),M=X.let("count",0);D(N,()=>X.if(N,()=>Z(M)))}function D(N,M){X.forRange("i",0,z,(O)=>{Q.subschema({keyword:"contains",dataProp:O,dataPropType:K6.Type.Num,compositeRule:!0},N),M()})}function Z(N){if(X.code(R0._`${N}++`),H===void 0)X.if(R0._`${N} >= ${$}`,()=>X.assign(F,!0).break());else if(X.if(R0._`${N} > ${H}`,()=>X.assign(F,!1).break()),$===1)X.assign(F,!0);else X.if(R0._`${N} >= ${$}`,()=>X.assign(F,!0))}}};y3.default=iZ});var p3=w((l3)=>{Object.defineProperty(l3,"__esModule",{value:!0});l3.validateSchemaDeps=l3.validatePropertyDeps=l3.error=void 0;var I8=h(),nZ=c(),f9=T0();l3.error={message:({params:{property:Q,depsCount:X,deps:Y}})=>{let W=X===1?"property":"properties";return I8.str`must have ${W} ${Y} when property ${Q} is present`},params:({params:{property:Q,depsCount:X,deps:Y,missingProperty:W}})=>I8._`{property: ${Q},
|
|
8
|
+
missingProperty: ${W},
|
|
9
|
+
depsCount: ${X},
|
|
10
|
+
deps: ${Y}}`};var rZ={keyword:"dependencies",type:"object",schemaType:"object",error:l3.error,code(Q){let[X,Y]=oZ(Q);u3(Q,X),f3(Q,Y)}};function oZ({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 u3(Q,X=Q.schema){let{gen:Y,data:W,it:G}=Q;if(Object.keys(X).length===0)return;let J=Y.let("missing");for(let $ in X){let H=X[$];if(H.length===0)continue;let B=(0,f9.propertyInData)(Y,W,$,G.opts.ownProperties);if(Q.setParams({property:$,depsCount:H.length,deps:H.join(", ")}),G.allErrors)Y.if(B,()=>{for(let K of H)(0,f9.checkReportMissingProp)(Q,K)});else Y.if(I8._`${B} && (${(0,f9.checkMissingProp)(Q,H,J)})`),(0,f9.reportMissingProp)(Q,J),Y.else()}}l3.validatePropertyDeps=u3;function f3(Q,X=Q.schema){let{gen:Y,data:W,keyword:G,it:J}=Q,$=Y.name("valid");for(let H in X){if((0,nZ.alwaysValidSchema)(J,X[H]))continue;Y.if((0,f9.propertyInData)(Y,W,H,J.opts.ownProperties),()=>{let B=Q.subschema({keyword:G,schemaProp:H},$);Q.mergeValidEvaluated(B,$)},()=>Y.var($,!0)),Q.ok($)}}l3.validateSchemaDeps=f3;l3.default=rZ});var n3=w((d3)=>{Object.defineProperty(d3,"__esModule",{value:!0});var i3=h(),sZ=c(),eZ={message:"property name must be valid",params:({params:Q})=>i3._`{propertyName: ${Q.propertyName}}`},Qq={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:eZ,code(Q){let{gen:X,schema:Y,data:W,it:G}=Q;if((0,sZ.alwaysValidSchema)(G,Y))return;let J=X.name("valid");X.forIn("key",W,($)=>{Q.setParams({propertyName:$}),Q.subschema({keyword:"propertyNames",data:$,dataTypes:["string"],propertyName:$,compositeRule:!0},J),X.if((0,i3.not)(J),()=>{if(Q.error(!0),!G.allErrors)X.break()})}),Q.ok(J)}};d3.default=Qq});var E8=w((r3)=>{Object.defineProperty(r3,"__esModule",{value:!0});var z6=T0(),y0=h(),Yq=n0(),A6=c(),Wq={message:"must NOT have additional properties",params:({params:Q})=>y0._`{additionalProperty: ${Q.additionalProperty}}`},Gq={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Wq,code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,errsCount:J,it:$}=Q;if(!J)throw Error("ajv implementation error");let{allErrors:H,opts:B}=$;if($.props=!0,B.removeAdditional!=="all"&&(0,A6.alwaysValidSchema)($,Y))return;let K=(0,z6.allSchemaProperties)(W.properties),z=(0,z6.allSchemaProperties)(W.patternProperties);F(),Q.ok(y0._`${J} === ${Yq.default.errors}`);function F(){X.forIn("key",G,(M)=>{if(!K.length&&!z.length)Z(M);else X.if(L(M),()=>Z(M))})}function L(M){let O;if(K.length>8){let k=(0,A6.schemaRefOrVal)($,W.properties,"properties");O=(0,z6.isOwnProperty)(X,k,M)}else if(K.length)O=(0,y0.or)(...K.map((k)=>y0._`${M} === ${k}`));else O=y0.nil;if(z.length)O=(0,y0.or)(O,...z.map((k)=>y0._`${(0,z6.usePattern)(Q,k)}.test(${M})`));return(0,y0.not)(O)}function D(M){X.code(y0._`delete ${G}[${M}]`)}function Z(M){if(B.removeAdditional==="all"||B.removeAdditional&&Y===!1){D(M);return}if(Y===!1){if(Q.setParams({additionalProperty:M}),Q.error(),!H)X.break();return}if(typeof Y=="object"&&!(0,A6.alwaysValidSchema)($,Y)){let O=X.name("valid");if(B.removeAdditional==="failing")N(M,O,!1),X.if((0,y0.not)(O),()=>{Q.reset(),D(M)});else if(N(M,O),!H)X.if((0,y0.not)(O),()=>X.break())}}function N(M,O,k){let j={keyword:"additionalProperties",dataProp:M,dataPropType:A6.Type.Str};if(k===!1)Object.assign(j,{compositeRule:!0,createErrors:!1,allErrors:!1});Q.subschema(j,O)}}};r3.default=Gq});var s3=w((a3)=>{Object.defineProperty(a3,"__esModule",{value:!0});var $q=T9(),o3=T0(),b8=c(),t3=E8(),Hq={keyword:"properties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,parentSchema:W,data:G,it:J}=Q;if(J.opts.removeAdditional==="all"&&W.additionalProperties===void 0)t3.default.code(new $q.KeywordCxt(J,t3.default,"additionalProperties"));let $=(0,o3.allSchemaProperties)(Y);for(let F of $)J.definedProperties.add(F);if(J.opts.unevaluated&&$.length&&J.props!==!0)J.props=b8.mergeEvaluated.props(X,(0,b8.toHash)($),J.props);let H=$.filter((F)=>!(0,b8.alwaysValidSchema)(J,Y[F]));if(H.length===0)return;let B=X.name("valid");for(let F of H){if(K(F))z(F);else{if(X.if((0,o3.propertyInData)(X,G,F,J.opts.ownProperties)),z(F),!J.allErrors)X.else().var(B,!0);X.endIf()}Q.it.definedProperties.add(F),Q.ok(B)}function K(F){return J.opts.useDefaults&&!J.compositeRule&&Y[F].default!==void 0}function z(F){Q.subschema({keyword:"properties",schemaProp:F,dataProp:F},B)}}};a3.default=Hq});var W$=w((Y$)=>{Object.defineProperty(Y$,"__esModule",{value:!0});var e3=T0(),F6=h(),Q$=c(),X$=c(),Kq={keyword:"patternProperties",type:"object",schemaType:"object",code(Q){let{gen:X,schema:Y,data:W,parentSchema:G,it:J}=Q,{opts:$}=J,H=(0,e3.allSchemaProperties)(Y),B=H.filter((N)=>(0,Q$.alwaysValidSchema)(J,Y[N]));if(H.length===0||B.length===H.length&&(!J.opts.unevaluated||J.props===!0))return;let K=$.strictSchema&&!$.allowMatchingProperties&&G.properties,z=X.name("valid");if(J.props!==!0&&!(J.props instanceof F6.Name))J.props=(0,X$.evaluatedPropsToName)(X,J.props);let{props:F}=J;L();function L(){for(let N of H){if(K)D(N);if(J.allErrors)Z(N);else X.var(z,!0),Z(N),X.if(z)}}function D(N){for(let M in K)if(new RegExp(N).test(M))(0,Q$.checkStrictMode)(J,`property ${M} matches pattern ${N} (use allowMatchingProperties)`)}function Z(N){X.forIn("key",W,(M)=>{X.if(F6._`${(0,e3.usePattern)(Q,N)}.test(${M})`,()=>{let O=B.includes(N);if(!O)Q.subschema({keyword:"patternProperties",schemaProp:N,dataProp:M,dataPropType:X$.Type.Str},z);if(J.opts.unevaluated&&F!==!0)X.assign(F6._`${F}[${M}]`,!0);else if(!O&&!J.allErrors)X.if((0,F6.not)(z),()=>X.break())})})}}};Y$.default=Kq});var J$=w((G$)=>{Object.defineProperty(G$,"__esModule",{value:!0});var Aq=c(),Fq={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(Q){let{gen:X,schema:Y,it:W}=Q;if((0,Aq.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"}};G$.default=Fq});var H$=w(($$)=>{Object.defineProperty($$,"__esModule",{value:!0});var Dq=T0(),Vq={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Dq.validateUnion,error:{message:"must match a schema in anyOf"}};$$.default=Vq});var K$=w((B$)=>{Object.defineProperty(B$,"__esModule",{value:!0});var L6=h(),Zq=c(),qq={message:"must match exactly one schema in oneOf",params:({params:Q})=>L6._`{passingSchemas: ${Q.passing}}`},Nq={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:qq,code(Q){let{gen:X,schema:Y,parentSchema:W,it:G}=Q;if(!Array.isArray(Y))throw Error("ajv implementation error");if(G.opts.discriminator&&W.discriminator)return;let J=Y,$=X.let("valid",!1),H=X.let("passing",null),B=X.name("_valid");Q.setParams({passing:H}),X.block(K),Q.result($,()=>Q.reset(),()=>Q.error(!0));function K(){J.forEach((z,F)=>{let L;if((0,Zq.alwaysValidSchema)(G,z))X.var(B,!0);else L=Q.subschema({keyword:"oneOf",schemaProp:F,compositeRule:!0},B);if(F>0)X.if(L6._`${B} && ${$}`).assign($,!1).assign(H,L6._`[${H}, ${F}]`).else();X.if(B,()=>{if(X.assign($,!0),X.assign(H,F),L)Q.mergeEvaluated(L,L6.Name)})})}}};B$.default=Nq});var A$=w((z$)=>{Object.defineProperty(z$,"__esModule",{value:!0});var Oq=c(),wq={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,Oq.alwaysValidSchema)(W,J))return;let H=Q.subschema({keyword:"allOf",schemaProp:$},G);Q.ok(G),Q.mergeEvaluated(H)})}};z$.default=wq});var V$=w((D$)=>{Object.defineProperty(D$,"__esModule",{value:!0});var D6=h(),L$=c(),Iq={message:({params:Q})=>D6.str`must match "${Q.ifClause}" schema`,params:({params:Q})=>D6._`{failingKeyword: ${Q.ifClause}}`},Eq={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Iq,code(Q){let{gen:X,parentSchema:Y,it:W}=Q;if(Y.then===void 0&&Y.else===void 0)(0,L$.checkStrictMode)(W,'"if" without "then" and "else" is ignored');let G=F$(W,"then"),J=F$(W,"else");if(!G&&!J)return;let $=X.let("valid",!0),H=X.name("_valid");if(B(),Q.reset(),G&&J){let z=X.let("ifClause");Q.setParams({ifClause:z}),X.if(H,K("then",z),K("else",z))}else if(G)X.if(H,K("then"));else X.if((0,D6.not)(H),K("else"));Q.pass($,()=>Q.error(!0));function B(){let z=Q.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},H);Q.mergeEvaluated(z)}function K(z,F){return()=>{let L=Q.subschema({keyword:z},H);if(X.assign($,H),Q.mergeValidEvaluated(L,$),F)X.assign(F,D6._`${z}`);else Q.setParams({ifClause:z})}}}};function F$(Q,X){let Y=Q.schema[X];return Y!==void 0&&!(0,L$.alwaysValidSchema)(Q,Y)}D$.default=Eq});var Z$=w((U$)=>{Object.defineProperty(U$,"__esModule",{value:!0});var jq=c(),Tq={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:Q,parentSchema:X,it:Y}){if(X.if===void 0)(0,jq.checkStrictMode)(Y,`"${Q}" without "if" is ignored`)}};U$.default=Tq});var N$=w((q$)=>{Object.defineProperty(q$,"__esModule",{value:!0});var Sq=w8(),Cq=v3(),kq=P8(),vq=g3(),_q=h3(),xq=p3(),gq=n3(),yq=E8(),hq=s3(),uq=W$(),fq=J$(),lq=H$(),mq=K$(),cq=A$(),pq=V$(),iq=Z$();function dq(Q=!1){let X=[fq.default,lq.default,mq.default,cq.default,pq.default,iq.default,gq.default,yq.default,xq.default,hq.default,uq.default];if(Q)X.push(Cq.default,vq.default);else X.push(Sq.default,kq.default);return X.push(_q.default),X}q$.default=dq});var O$=w((M$)=>{Object.defineProperty(M$,"__esModule",{value:!0});var X0=h(),rq={message:({schemaCode:Q})=>X0.str`must match format "${Q}"`,params:({schemaCode:Q})=>X0._`{format: ${Q}}`},oq={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:rq,code(Q,X){let{gen:Y,data:W,$data:G,schema:J,schemaCode:$,it:H}=Q,{opts:B,errSchemaPath:K,schemaEnv:z,self:F}=H;if(!B.validateFormats)return;if(G)L();else D();function L(){let Z=Y.scopeValue("formats",{ref:F.formats,code:B.code.formats}),N=Y.const("fDef",X0._`${Z}[${$}]`),M=Y.let("fType"),O=Y.let("format");Y.if(X0._`typeof ${N} == "object" && !(${N} instanceof RegExp)`,()=>Y.assign(M,X0._`${N}.type || "string"`).assign(O,X0._`${N}.validate`),()=>Y.assign(M,X0._`"string"`).assign(O,N)),Q.fail$data((0,X0.or)(k(),j()));function k(){if(B.strictSchema===!1)return X0.nil;return X0._`${$} && !${O}`}function j(){let S=z.$async?X0._`(${N}.async ? await ${O}(${W}) : ${O}(${W}))`:X0._`${O}(${W})`,I=X0._`(typeof ${O} == "function" ? ${S} : ${O}.test(${W}))`;return X0._`${O} && ${O} !== true && ${M} === ${X} && !${I}`}}function D(){let Z=F.formats[J];if(!Z){k();return}if(Z===!0)return;let[N,M,O]=j(Z);if(N===X)Q.pass(S());function k(){if(B.strictSchema===!1){F.logger.warn(I());return}throw Error(I());function I(){return`unknown format "${J}" ignored in schema at path "${K}"`}}function j(I){let N0=I instanceof RegExp?(0,X0.regexpCode)(I):B.code.formats?X0._`${B.code.formats}${(0,X0.getProperty)(J)}`:void 0,I0=Y.scopeValue("formats",{key:J,ref:I,code:N0});if(typeof I=="object"&&!(I instanceof RegExp))return[I.type||"string",I.validate,X0._`${I0}.validate`];return["string",I,I0]}function S(){if(typeof Z=="object"&&!(Z instanceof RegExp)&&Z.async){if(!z.$async)throw Error("async format in sync schema");return X0._`await ${O}(${W})`}return typeof M=="function"?X0._`${O}(${W})`:X0._`${O}.test(${W})`}}}};M$.default=oq});var P$=w((w$)=>{Object.defineProperty(w$,"__esModule",{value:!0});var aq=O$(),sq=[aq.default];w$.default=sq});var b$=w((I$)=>{Object.defineProperty(I$,"__esModule",{value:!0});I$.contentVocabulary=I$.metadataVocabulary=void 0;I$.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];I$.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var R$=w((T$)=>{Object.defineProperty(T$,"__esModule",{value:!0});var XN=a5(),YN=I3(),WN=N$(),GN=P$(),j$=b$(),JN=[XN.default,YN.default,(0,WN.default)(),GN.default,j$.metadataVocabulary,j$.contentVocabulary];T$.default=JN});var v$=w((C$)=>{Object.defineProperty(C$,"__esModule",{value:!0});C$.DiscrError=void 0;var S$;(function(Q){Q.Tag="tag",Q.Mapping="mapping"})(S$||(C$.DiscrError=S$={}))});var g$=w((x$)=>{Object.defineProperty(x$,"__esModule",{value:!0});var l1=h(),j8=v$(),_$=oQ(),HN=R9(),BN=c(),KN={message:({params:{discrError:Q,tagName:X}})=>Q===j8.DiscrError.Tag?`tag "${X}" must be string`:`value of tag "${X}" must be in oneOf`,params:({params:{discrError:Q,tag:X,tagName:Y}})=>l1._`{error: ${Q}, tag: ${Y}, tagValue: ${X}}`},zN={keyword:"discriminator",type:"object",schemaType:"object",error:KN,code(Q){let{gen:X,data:Y,schema:W,parentSchema:G,it:J}=Q,{oneOf:$}=G;if(!J.opts.discriminator)throw Error("discriminator: requires discriminator option");let H=W.propertyName;if(typeof H!="string")throw Error("discriminator: requires propertyName");if(W.mapping)throw Error("discriminator: mapping is not supported");if(!$)throw Error("discriminator: requires oneOf keyword");let B=X.let("valid",!1),K=X.const("tag",l1._`${Y}${(0,l1.getProperty)(H)}`);X.if(l1._`typeof ${K} == "string"`,()=>z(),()=>Q.error(!1,{discrError:j8.DiscrError.Tag,tag:K,tagName:H})),Q.ok(B);function z(){let D=L();X.if(!1);for(let Z in D)X.elseIf(l1._`${K} === ${Z}`),X.assign(B,F(D[Z]));X.else(),Q.error(!1,{discrError:j8.DiscrError.Mapping,tag:K,tagName:H}),X.endIf()}function F(D){let Z=X.name("valid"),N=Q.subschema({keyword:"oneOf",schemaProp:D},Z);return Q.mergeEvaluated(N,l1.Name),Z}function L(){var D;let Z={},N=O(G),M=!0;for(let S=0;S<$.length;S++){let I=$[S];if((I===null||I===void 0?void 0:I.$ref)&&!(0,BN.schemaHasRulesButRef)(I,J.self.RULES)){let I0=I.$ref;if(I=_$.resolveRef.call(J.self,J.schemaEnv.root,J.baseId,I0),I instanceof _$.SchemaEnv)I=I.schema;if(I===void 0)throw new HN.default(J.opts.uriResolver,J.baseId,I0)}let N0=(D=I===null||I===void 0?void 0:I.properties)===null||D===void 0?void 0:D[H];if(typeof N0!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${H}"`);M=M&&(N||O(I)),k(N0,S)}if(!M)throw Error(`discriminator: "${H}" must be required`);return Z;function O({required:S}){return Array.isArray(S)&&S.includes(H)}function k(S,I){if(S.const)j(S.const,I);else if(S.enum)for(let N0 of S.enum)j(N0,I);else throw Error(`discriminator: "properties/${H}" must have "const" or "enum"`)}function j(S,I){if(typeof S!="string"||S in Z)throw Error(`discriminator: "${H}" values must be unique strings`);Z[S]=I}}}};x$.default=zN});var y$=w((vR,FN)=>{FN.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 R8=w((q0,T8)=>{Object.defineProperty(q0,"__esModule",{value:!0});q0.MissingRefError=q0.ValidationError=q0.CodeGen=q0.Name=q0.nil=q0.stringify=q0.str=q0._=q0.KeywordCxt=q0.Ajv=void 0;var LN=l5(),DN=R$(),VN=g$(),h$=y$(),UN=["/properties"],V6="http://json-schema.org/draft-07/schema";class l9 extends LN.default{_addVocabularies(){if(super._addVocabularies(),DN.default.forEach((Q)=>this.addVocabulary(Q)),this.opts.discriminator)this.addKeyword(VN.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let Q=this.opts.$data?this.$dataMetaSchema(h$,UN):h$;this.addMetaSchema(Q,V6,!1),this.refs["http://json-schema.org/schema"]=V6}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(V6)?V6:void 0)}}q0.Ajv=l9;T8.exports=q0=l9;T8.exports.Ajv=l9;Object.defineProperty(q0,"__esModule",{value:!0});q0.default=l9;var ZN=T9();Object.defineProperty(q0,"KeywordCxt",{enumerable:!0,get:function(){return ZN.KeywordCxt}});var m1=h();Object.defineProperty(q0,"_",{enumerable:!0,get:function(){return m1._}});Object.defineProperty(q0,"str",{enumerable:!0,get:function(){return m1.str}});Object.defineProperty(q0,"stringify",{enumerable:!0,get:function(){return m1.stringify}});Object.defineProperty(q0,"nil",{enumerable:!0,get:function(){return m1.nil}});Object.defineProperty(q0,"Name",{enumerable:!0,get:function(){return m1.Name}});Object.defineProperty(q0,"CodeGen",{enumerable:!0,get:function(){return m1.CodeGen}});var qN=nQ();Object.defineProperty(q0,"ValidationError",{enumerable:!0,get:function(){return qN.default}});var NN=R9();Object.defineProperty(q0,"MissingRefError",{enumerable:!0,get:function(){return NN.default}})});var r$=w((d$)=>{Object.defineProperty(d$,"__esModule",{value:!0});d$.formatNames=d$.fastFormats=d$.fullFormats=void 0;function f0(Q,X){return{validate:Q,compare:X}}d$.fullFormats={date:f0(m$,v8),time:f0(C8(!0),_8),"date-time":f0(u$(!0),p$),"iso-time":f0(C8(),c$),"iso-date-time":f0(u$(),i$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:jN,"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:_N,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:TN,int32:{type:"number",validate:CN},int64:{type:"number",validate:kN},float:{type:"number",validate:l$},double:{type:"number",validate:l$},password:!0,binary:!0};d$.fastFormats={...d$.fullFormats,date:f0(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,v8),time:f0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,_8),"date-time":f0(/^\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,p$),"iso-time":f0(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,c$),"iso-date-time":f0(/^\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,i$),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};d$.formatNames=Object.keys(d$.fullFormats);function wN(Q){return Q%4===0&&(Q%100!==0||Q%400===0)}var PN=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,IN=[0,31,28,31,30,31,30,31,31,30,31,30,31];function m$(Q){let X=PN.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&&wN(Y)?29:IN[W])}function v8(Q,X){if(!(Q&&X))return;if(Q>X)return 1;if(Q<X)return-1;return 0}var S8=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function C8(Q){return function(Y){let W=S8.exec(Y);if(!W)return!1;let G=+W[1],J=+W[2],$=+W[3],H=W[4],B=W[5]==="-"?-1:1,K=+(W[6]||0),z=+(W[7]||0);if(K>23||z>59||Q&&!H)return!1;if(G<=23&&J<=59&&$<60)return!0;let F=J-z*B,L=G-K*B-(F<0?1:0);return(L===23||L===-1)&&(F===59||F===-1)&&$<61}}function _8(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 c$(Q,X){if(!(Q&&X))return;let Y=S8.exec(Q),W=S8.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 k8=/t|\s/i;function u$(Q){let X=C8(Q);return function(W){let G=W.split(k8);return G.length===2&&m$(G[0])&&X(G[1])}}function p$(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 i$(Q,X){if(!(Q&&X))return;let[Y,W]=Q.split(k8),[G,J]=X.split(k8),$=v8(Y,G);if($===void 0)return;return $||_8(W,J)}var EN=/\/|:/,bN=/^(?:[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 jN(Q){return EN.test(Q)&&bN.test(Q)}var f$=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function TN(Q){return f$.lastIndex=0,f$.test(Q)}var RN=-2147483648,SN=2147483647;function CN(Q){return Number.isInteger(Q)&&Q<=SN&&Q>=RN}function kN(Q){return Number.isInteger(Q)}function l$(){return!0}var vN=/[^\\]\\Z/;function _N(Q){if(vN.test(Q))return!1;try{return new RegExp(Q),!0}catch(X){return!1}}});var t$=w((o$)=>{Object.defineProperty(o$,"__esModule",{value:!0});o$.formatLimitDefinition=void 0;var gN=R8(),h0=h(),K1=h0.operators,U6={formatMaximum:{okStr:"<=",ok:K1.LTE,fail:K1.GT},formatMinimum:{okStr:">=",ok:K1.GTE,fail:K1.LT},formatExclusiveMaximum:{okStr:"<",ok:K1.LT,fail:K1.GTE},formatExclusiveMinimum:{okStr:">",ok:K1.GT,fail:K1.LTE}},yN={message:({keyword:Q,schemaCode:X})=>h0.str`should be ${U6[Q].okStr} ${X}`,params:({keyword:Q,schemaCode:X})=>h0._`{comparison: ${U6[Q].okStr}, limit: ${X}}`};o$.formatLimitDefinition={keyword:Object.keys(U6),type:"string",schemaType:"string",$data:!0,error:yN,code(Q){let{gen:X,data:Y,schemaCode:W,keyword:G,it:J}=Q,{opts:$,self:H}=J;if(!$.validateFormats)return;let B=new gN.KeywordCxt(J,H.RULES.all.format.definition,"format");if(B.$data)K();else z();function K(){let L=X.scopeValue("formats",{ref:H.formats,code:$.code.formats}),D=X.const("fmt",h0._`${L}[${B.schemaCode}]`);Q.fail$data((0,h0.or)(h0._`typeof ${D} != "object"`,h0._`${D} instanceof RegExp`,h0._`typeof ${D}.compare != "function"`,F(D)))}function z(){let L=B.schema,D=H.formats[L];if(!D||D===!0)return;if(typeof D!="object"||D instanceof RegExp||typeof D.compare!="function")throw Error(`"${G}": format "${L}" does not define "compare" function`);let Z=X.scopeValue("formats",{key:L,ref:D,code:$.code.formats?h0._`${$.code.formats}${(0,h0.getProperty)(L)}`:void 0});Q.fail$data(F(Z))}function F(L){return h0._`${L}.compare(${Y}, ${W}) ${U6[G].fail} 0`}},dependencies:["format"]};var hN=(Q)=>{return Q.addKeyword(o$.formatLimitDefinition),Q};o$.default=hN});var QH=w((m9,e$)=>{Object.defineProperty(m9,"__esModule",{value:!0});var c1=r$(),fN=t$(),y8=h(),a$=new y8.Name("fullFormats"),lN=new y8.Name("fastFormats"),h8=(Q,X={keywords:!0})=>{if(Array.isArray(X))return s$(Q,X,c1.fullFormats,a$),Q;let[Y,W]=X.mode==="fast"?[c1.fastFormats,lN]:[c1.fullFormats,a$],G=X.formats||c1.formatNames;if(s$(Q,G,Y,W),X.keywords)(0,fN.default)(Q);return Q};h8.get=(Q,X="full")=>{let W=(X==="fast"?c1.fastFormats:c1.fullFormats)[Q];if(!W)throw Error(`Unknown format "${Q}"`);return W};function s$(Q,X,Y,W){var G,J;(G=(J=Q.opts.code).formats)!==null&&G!==void 0||(J.formats=y8._`require("ajv-formats/dist/formats").${W}`);for(let $ of X)Q.addFormat($,Y[$])}e$.exports=m9=h8;Object.defineProperty(m9,"__esModule",{value:!0});m9.default=h8});var HX;function U(Q,X,Y){function W(H,B){if(!H._zod)Object.defineProperty(H,"_zod",{value:{def:B,constr:$,traits:new Set},enumerable:!1});if(H._zod.traits.has(Q))return;H._zod.traits.add(Q),X(H,B);let K=$.prototype,z=Object.keys(K);for(let F=0;F<z.length;F++){let L=z[F];if(!(L in H))H[L]=K[L].bind(H)}}let G=Y?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:Q});function $(H){var B;let K=Y?.Parent?new J:this;W(K,H),(B=K._zod).deferred??(B.deferred=[]);for(let z of K._zod.deferred)z();return K}return Object.defineProperty($,"init",{value:W}),Object.defineProperty($,Symbol.hasInstance,{value:(H)=>{if(Y?.Parent&&H instanceof Y.Parent)return!0;return H?._zod?.traits?.has(Q)}}),Object.defineProperty($,"name",{value:Q}),$}var oO=Symbol("zod_brand");class l0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class r1 extends Error{constructor(Q){super(`Encountered unidirectional transform during encode: ${Q}`);this.name="ZodEncodeError"}}(HX=globalThis).__zod_globalConfig??(HX.__zod_globalConfig={});var O1=globalThis.__zod_globalConfig;function M0(Q){if(Q)Object.assign(O1,Q);return O1}var m={};$X(m,{unwrapMessage:()=>o1,uint8ArrayToHex:()=>MB,uint8ArrayToBase64url:()=>qB,uint8ArrayToBase64:()=>DX,stringifyPrimitive:()=>s9,slugify:()=>R6,shallowClone:()=>KX,safeExtend:()=>FB,required:()=>VB,randomString:()=>JB,propertyKeyTypes:()=>C6,promiseAllObject:()=>GB,primitiveTypes:()=>zX,prefixIssues:()=>p0,pick:()=>KB,partial:()=>DB,parsedType:()=>x6,optionalKeys:()=>k6,omit:()=>zB,objectClone:()=>XB,numKeys:()=>$B,nullish:()=>a1,normalizeParams:()=>T,mergeDefs:()=>m0,merge:()=>LB,jsonStringifyReplacer:()=>w1,joinValues:()=>o9,issue:()=>I1,isPlainObject:()=>a0,isObject:()=>z1,hexToUint8Array:()=>NB,getSizableOrigin:()=>FX,getParsedType:()=>HB,getLengthableOrigin:()=>e1,getEnumValues:()=>t1,getElementAtPath:()=>WB,floatSafeRemainder:()=>T6,finalizeIssue:()=>E0,extend:()=>AB,explicitlyAborted:()=>_6,escapeRegex:()=>c0,esc:()=>t9,defineLazy:()=>i,createTransparentProxy:()=>BB,cloneDef:()=>YB,clone:()=>k0,cleanRegex:()=>s1,cleanEnum:()=>UB,captureStackTrace:()=>a9,cached:()=>P1,base64urlToUint8Array:()=>ZB,base64ToUint8Array:()=>LX,assignProp:()=>t0,assertNotEqual:()=>aH,assertNever:()=>eH,assertIs:()=>sH,assertEqual:()=>tH,assert:()=>QB,allowsEval:()=>S6,aborted:()=>s0,NUMBER_FORMAT_RANGES:()=>v6,Class:()=>VX,BIGINT_FORMAT_RANGES:()=>AX});function tH(Q){return Q}function aH(Q){return Q}function sH(Q){}function eH(Q){throw Error("Unexpected value in exhaustive check")}function QB(Q){}function t1(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 o9(Q,X="|"){return Q.map((Y)=>s9(Y)).join(X)}function w1(Q,X){if(typeof X==="bigint")return X.toString();return X}function P1(Q){return{get value(){{let Y=Q();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function a1(Q){return Q===null||Q===void 0}function s1(Q){let X=Q.startsWith("^")?1:0,Y=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(X,Y)}function T6(Q,X){let Y=Q/X,W=Math.round(Y),G=Number.EPSILON*Math.max(Math.abs(Y),1);if(Math.abs(Y-W)<G)return 0;return Y-W}var BX=Symbol("evaluating");function i(Q,X,Y){let W=void 0;Object.defineProperty(Q,X,{get(){if(W===BX)return;if(W===void 0)W=BX,W=Y();return W},set(G){Object.defineProperty(Q,X,{value:G})},configurable:!0})}function XB(Q){return Object.create(Object.getPrototypeOf(Q),Object.getOwnPropertyDescriptors(Q))}function t0(Q,X,Y){Object.defineProperty(Q,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function m0(...Q){let X={};for(let Y of Q){let W=Object.getOwnPropertyDescriptors(Y);Object.assign(X,W)}return Object.defineProperties({},X)}function YB(Q){return m0(Q._zod.def)}function WB(Q,X){if(!X)return Q;return X.reduce((Y,W)=>Y?.[W],Q)}function GB(Q){let X=Object.keys(Q),Y=X.map((W)=>Q[W]);return Promise.all(Y).then((W)=>{let G={};for(let J=0;J<X.length;J++)G[X[J]]=W[J];return G})}function JB(Q=10){let Y="";for(let W=0;W<Q;W++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function t9(Q){return JSON.stringify(Q)}function R6(Q){return Q.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var a9="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function z1(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}var S6=P1(()=>{if(O1.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(Q){return!1}});function a0(Q){if(z1(Q)===!1)return!1;let X=Q.constructor;if(X===void 0)return!0;if(typeof X!=="function")return!0;let Y=X.prototype;if(z1(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function KX(Q){if(a0(Q))return{...Q};if(Array.isArray(Q))return[...Q];if(Q instanceof Map)return new Map(Q);if(Q instanceof Set)return new Set(Q);return Q}function $B(Q){let X=0;for(let Y in Q)if(Object.prototype.hasOwnProperty.call(Q,Y))X++;return X}var HB=(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}`)}},C6=new Set(["string","number","symbol"]),zX=new Set(["string","number","bigint","boolean","symbol","undefined"]);function c0(Q){return Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k0(Q,X,Y){let W=new Q._zod.constr(X??Q._zod.def);if(!X||Y?.parent)W._zod.parent=Q;return W}function T(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 BB(Q){let X;return new Proxy({},{get(Y,W,G){return X??(X=Q()),Reflect.get(X,W,G)},set(Y,W,G,J){return X??(X=Q()),Reflect.set(X,W,G,J)},has(Y,W){return X??(X=Q()),Reflect.has(X,W)},deleteProperty(Y,W){return X??(X=Q()),Reflect.deleteProperty(X,W)},ownKeys(Y){return X??(X=Q()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(Y,W){return X??(X=Q()),Reflect.getOwnPropertyDescriptor(X,W)},defineProperty(Y,W,G){return X??(X=Q()),Reflect.defineProperty(X,W,G)}})}function s9(Q){if(typeof Q==="bigint")return Q.toString()+"n";if(typeof Q==="string")return`"${Q}"`;return`${Q}`}function k6(Q){return Object.keys(Q).filter((X)=>{return Q[X]._zod.optin==="optional"&&Q[X]._zod.optout==="optional"})}var v6={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]},AX={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function KB(Q,X){let Y=Q._zod.def,W=Y.checks;if(W&&W.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let J=m0(Q._zod.def,{get shape(){let $={};for(let H in X){if(!(H in Y.shape))throw Error(`Unrecognized key: "${H}"`);if(!X[H])continue;$[H]=Y.shape[H]}return t0(this,"shape",$),$},checks:[]});return k0(Q,J)}function zB(Q,X){let Y=Q._zod.def,W=Y.checks;if(W&&W.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let J=m0(Q._zod.def,{get shape(){let $={...Q._zod.def.shape};for(let H in X){if(!(H in Y.shape))throw Error(`Unrecognized key: "${H}"`);if(!X[H])continue;delete $[H]}return t0(this,"shape",$),$},checks:[]});return k0(Q,J)}function AB(Q,X){if(!a0(X))throw Error("Invalid input to extend: expected a plain object");let Y=Q._zod.def.checks;if(Y&&Y.length>0){let J=Q._zod.def.shape;for(let $ in X)if(Object.getOwnPropertyDescriptor(J,$)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let G=m0(Q._zod.def,{get shape(){let J={...Q._zod.def.shape,...X};return t0(this,"shape",J),J}});return k0(Q,G)}function FB(Q,X){if(!a0(X))throw Error("Invalid input to safeExtend: expected a plain object");let Y=m0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X};return t0(this,"shape",W),W}});return k0(Q,Y)}function LB(Q,X){if(Q._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let Y=m0(Q._zod.def,{get shape(){let W={...Q._zod.def.shape,...X._zod.def.shape};return t0(this,"shape",W),W},get catchall(){return X._zod.def.catchall},checks:X._zod.def.checks??[]});return k0(Q,Y)}function DB(Q,X,Y){let G=X._zod.def.checks;if(G&&G.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let $=m0(X._zod.def,{get shape(){let H=X._zod.def.shape,B={...H};if(Y)for(let K in Y){if(!(K in H))throw Error(`Unrecognized key: "${K}"`);if(!Y[K])continue;B[K]=Q?new Q({type:"optional",innerType:H[K]}):H[K]}else for(let K in H)B[K]=Q?new Q({type:"optional",innerType:H[K]}):H[K];return t0(this,"shape",B),B},checks:[]});return k0(X,$)}function VB(Q,X,Y){let W=m0(X._zod.def,{get shape(){let G=X._zod.def.shape,J={...G};if(Y)for(let $ in Y){if(!($ in J))throw Error(`Unrecognized key: "${$}"`);if(!Y[$])continue;J[$]=new Q({type:"nonoptional",innerType:G[$]})}else for(let $ in G)J[$]=new Q({type:"nonoptional",innerType:G[$]});return t0(this,"shape",J),J}});return k0(X,W)}function s0(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 _6(Q,X=0){if(Q.aborted===!0)return!0;for(let Y=X;Y<Q.issues.length;Y++)if(Q.issues[Y]?.continue===!1)return!0;return!1}function p0(Q,X){return X.map((Y)=>{var W;return(W=Y).path??(W.path=[]),Y.path.unshift(Q),Y})}function o1(Q){return typeof Q==="string"?Q:Q?.message}function E0(Q,X,Y){let W=Q.message?Q.message:o1(Q.inst?._zod.def?.error?.(Q))??o1(X?.error?.(Q))??o1(Y.customError?.(Q))??o1(Y.localeError?.(Q))??"Invalid input",{inst:G,continue:J,input:$,...H}=Q;if(H.path??(H.path=[]),H.message=W,X?.reportInput)H.input=$;return H}function FX(Q){if(Q instanceof Set)return"set";if(Q instanceof Map)return"map";if(Q instanceof File)return"file";return"unknown"}function e1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}function x6(Q){let X=typeof Q;switch(X){case"number":return Number.isNaN(Q)?"nan":"number";case"object":{if(Q===null)return"null";if(Array.isArray(Q))return"array";let Y=Q;if(Y&&Object.getPrototypeOf(Y)!==Object.prototype&&"constructor"in Y&&Y.constructor)return Y.constructor.name}}return X}function I1(...Q){let[X,Y,W]=Q;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:W};return{...X}}function UB(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 DX(Q){let X="";for(let Y=0;Y<Q.length;Y++)X+=String.fromCharCode(Q[Y]);return btoa(X)}function ZB(Q){let X=Q.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-X.length%4)%4);return LX(X+Y)}function qB(Q){return DX(Q).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function NB(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 MB(Q){return Array.from(Q).map((X)=>X.toString(16).padStart(2,"0")).join("")}class VX{constructor(...Q){}}var UX=(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})},e9=U("$ZodError",UX),g6=U("$ZodError",UX,{Parent:Error});function ZX(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 qX(Q,X=(Y)=>Y.message){let Y={_errors:[]},W=(G,J=[])=>{for(let $ of G.issues)if($.code==="invalid_union"&&$.errors.length)$.errors.map((H)=>W({issues:H},[...J,...$.path]));else if($.code==="invalid_key")W({issues:$.issues},[...J,...$.path]);else if($.code==="invalid_element")W({issues:$.issues},[...J,...$.path]);else{let H=[...J,...$.path];if(H.length===0)Y._errors.push(X($));else{let B=Y,K=0;while(K<H.length){let z=H[K];if(K!==H.length-1)B[z]=B[z]||{_errors:[]};else B[z]=B[z]||{_errors:[]},B[z]._errors.push(X($));B=B[z],K++}}}};return W(Q),Y}var QQ=(Q)=>(X,Y,W,G)=>{let J=W?{...W,async:!1}:{async:!1},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)throw new l0;if($.issues.length){let H=new(G?.Err??Q)($.issues.map((B)=>E0(B,J,M0())));throw a9(H,G?.callee),H}return $.value};var XQ=(Q)=>async(X,Y,W,G)=>{let J=W?{...W,async:!0}:{async:!0},$=X._zod.run({value:Y,issues:[]},J);if($ instanceof Promise)$=await $;if($.issues.length){let H=new(G?.Err??Q)($.issues.map((B)=>E0(B,J,M0())));throw a9(H,G?.callee),H}return $.value};var Q9=(Q)=>(X,Y,W)=>{let G=W?{...W,async:!1}:{async:!1},J=X._zod.run({value:Y,issues:[]},G);if(J instanceof Promise)throw new l0;return J.issues.length?{success:!1,error:new(Q??e9)(J.issues.map(($)=>E0($,G,M0())))}:{success:!0,data:J.value}},X9=Q9(g6),Y9=(Q)=>async(X,Y,W)=>{let G=W?{...W,async:!0}:{async:!0},J=X._zod.run({value:Y,issues:[]},G);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new Q(J.issues.map(($)=>E0($,G,M0())))}:{success:!0,data:J.value}},YQ=Y9(g6),NX=(Q)=>(X,Y,W)=>{let G=W?{...W,direction:"backward"}:{direction:"backward"};return QQ(Q)(X,Y,G)};var MX=(Q)=>(X,Y,W)=>{return QQ(Q)(X,Y,W)};var OX=(Q)=>async(X,Y,W)=>{let G=W?{...W,direction:"backward"}:{direction:"backward"};return XQ(Q)(X,Y,G)};var wX=(Q)=>async(X,Y,W)=>{return XQ(Q)(X,Y,W)};var PX=(Q)=>(X,Y,W)=>{let G=W?{...W,direction:"backward"}:{direction:"backward"};return Q9(Q)(X,Y,G)};var IX=(Q)=>(X,Y,W)=>{return Q9(Q)(X,Y,W)};var EX=(Q)=>async(X,Y,W)=>{let G=W?{...W,direction:"backward"}:{direction:"backward"};return Y9(Q)(X,Y,G)};var bX=(Q)=>async(X,Y,W)=>{return Y9(Q)(X,Y,W)};var jX=/^[cC][0-9a-z]{6,}$/,TX=/^[0-9a-z]+$/,RX=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,SX=/^[0-9a-vA-V]{20}$/,CX=/^[A-Za-z0-9]{27}$/,kX=/^[a-zA-Z0-9_-]{21}$/,vX=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var _X=/^([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})$/,y6=(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 xX=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var wB="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function gX(){return new RegExp(wB,"u")}var yX=/^(?:(?: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])$/,hX=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var uX=/^((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])$/,fX=/^(([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])$/,lX=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,h6=/^[A-Za-z0-9_-]*$/;var mX=/^https?$/,cX=/^\+[1-9]\d{6,14}$/,pX="(?:(?:\\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])))",iX=new RegExp(`^${pX}$`);function dX(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 nX(Q){return new RegExp(`^${dX(Q)}$`)}function rX(Q){let X=dX({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(`^${pX}T(?:${W})$`)}var oX=(Q)=>{let X=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var tX=/^-?\d+$/,WQ=/^-?\d+(?:\.\d+)?$/,aX=/^(?:true|false)$/i,sX=/^null$/i;var eX=/^[^A-Z]*$/,QY=/^[^a-z]*$/;var G0=U("$ZodCheck",(Q,X)=>{var Y;Q._zod??(Q._zod={}),Q._zod.def=X,(Y=Q._zod).onattach??(Y.onattach=[])}),XY={number:"number",bigint:"bigint",object:"date"},u6=U("$ZodCheckLessThan",(Q,X)=>{G0.init(Q,X);let Y=XY[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,J=(X.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<J)if(X.inclusive)G.maximum=X.value;else G.exclusiveMaximum=X.value}),Q._zod.check=(W)=>{if(X.inclusive?W.value<=X.value:W.value<X.value)return;W.issues.push({origin:Y,code:"too_big",maximum:typeof X.value==="object"?X.value.getTime():X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),f6=U("$ZodCheckGreaterThan",(Q,X)=>{G0.init(Q,X);let Y=XY[typeof X.value];Q._zod.onattach.push((W)=>{let G=W._zod.bag,J=(X.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>J)if(X.inclusive)G.minimum=X.value;else G.exclusiveMinimum=X.value}),Q._zod.check=(W)=>{if(X.inclusive?W.value>=X.value:W.value>X.value)return;W.issues.push({origin:Y,code:"too_small",minimum:typeof X.value==="object"?X.value.getTime():X.value,input:W.value,inclusive:X.inclusive,inst:Q,continue:!X.abort})}}),YY=U("$ZodCheckMultipleOf",(Q,X)=>{G0.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):T6(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})}}),WY=U("$ZodCheckNumberFormat",(Q,X)=>{G0.init(Q,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),W=Y?"int":"number",[G,J]=v6[X.format];Q._zod.onattach.push(($)=>{let H=$._zod.bag;if(H.format=X.format,H.minimum=G,H.maximum=J,Y)H.pattern=tX}),Q._zod.check=($)=>{let H=$.value;if(Y){if(!Number.isInteger(H)){$.issues.push({expected:W,format:X.format,code:"invalid_type",continue:!1,input:H,inst:Q});return}if(!Number.isSafeInteger(H)){if(H>0)$.issues.push({input:H,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,inclusive:!0,continue:!X.abort});else $.issues.push({input:H,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:Q,origin:W,inclusive:!0,continue:!X.abort});return}}if(H<G)$.issues.push({origin:"number",input:H,code:"too_small",minimum:G,inclusive:!0,inst:Q,continue:!X.abort});if(H>J)$.issues.push({origin:"number",input:H,code:"too_big",maximum:J,inclusive:!0,inst:Q,continue:!X.abort})}});var GY=U("$ZodCheckMaxLength",(Q,X)=>{var Y;G0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!a1(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 $=e1(G);W.issues.push({origin:$,code:"too_big",maximum:X.maximum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),JY=U("$ZodCheckMinLength",(Q,X)=>{var Y;G0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!a1(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 $=e1(G);W.issues.push({origin:$,code:"too_small",minimum:X.minimum,inclusive:!0,input:G,inst:Q,continue:!X.abort})}}),$Y=U("$ZodCheckLengthEquals",(Q,X)=>{var Y;G0.init(Q,X),(Y=Q._zod.def).when??(Y.when=(W)=>{let G=W.value;return!a1(G)&&G.length!==void 0}),Q._zod.onattach.push((W)=>{let G=W._zod.bag;G.minimum=X.length,G.maximum=X.length,G.length=X.length}),Q._zod.check=(W)=>{let G=W.value,J=G.length;if(J===X.length)return;let $=e1(G),H=J>X.length;W.issues.push({origin:$,...H?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:W.value,inst:Q,continue:!X.abort})}}),W9=U("$ZodCheckStringFormat",(Q,X)=>{var Y,W;if(G0.init(Q,X),Q._zod.onattach.push((G)=>{let J=G._zod.bag;if(J.format=X.format,X.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(X.pattern)}),X.pattern)(Y=Q._zod).check??(Y.check=(G)=>{if(X.pattern.lastIndex=0,X.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:X.format,input:G.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:Q,continue:!X.abort})});else(W=Q._zod).check??(W.check=()=>{})}),HY=U("$ZodCheckRegex",(Q,X)=>{W9.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})}}),BY=U("$ZodCheckLowerCase",(Q,X)=>{X.pattern??(X.pattern=eX),W9.init(Q,X)}),KY=U("$ZodCheckUpperCase",(Q,X)=>{X.pattern??(X.pattern=QY),W9.init(Q,X)}),zY=U("$ZodCheckIncludes",(Q,X)=>{G0.init(Q,X);let Y=c0(X.includes),W=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=W,Q._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(W)}),Q._zod.check=(G)=>{if(G.value.includes(X.includes,X.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:G.value,inst:Q,continue:!X.abort})}}),AY=U("$ZodCheckStartsWith",(Q,X)=>{G0.init(Q,X);let Y=new RegExp(`^${c0(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})}}),FY=U("$ZodCheckEndsWith",(Q,X)=>{G0.init(Q,X);let Y=new RegExp(`.*${c0(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 LY=U("$ZodCheckOverwrite",(Q,X)=>{G0.init(Q,X),Q._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class l6{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(`
|
|
11
|
+
`).filter((J)=>J),W=Math.min(...Y.map((J)=>J.length-J.trimStart().length)),G=Y.map((J)=>J.slice(W)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of G)this.content.push(J)}compile(){let Q=Function,X=this?.args,W=[...(this?.content??[""]).map((G)=>` ${G}`)];return new Q(...X,W.join(`
|
|
12
|
+
`))}}var VY={major:4,minor:4,patch:3};var o=U("$ZodType",(Q,X)=>{var Y;Q??(Q={}),Q._zod.def=X,Q._zod.bag=Q._zod.bag||{},Q._zod.version=VY;let W=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))W.unshift(Q);for(let G of W)for(let J of G._zod.onattach)J(Q);if(W.length===0)(Y=Q._zod).deferred??(Y.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let G=($,H,B)=>{let K=s0($),z;for(let F of H){if(F._zod.def.when){if(_6($))continue;if(!F._zod.def.when($))continue}else if(K)continue;let L=$.issues.length,D=F._zod.check($);if(D instanceof Promise&&B?.async===!1)throw new l0;if(z||D instanceof Promise)z=(z??Promise.resolve()).then(async()=>{if(await D,$.issues.length===L)return;if(!K)K=s0($,L)});else{if($.issues.length===L)continue;if(!K)K=s0($,L)}}if(z)return z.then(()=>{return $});return $},J=($,H,B)=>{if(s0($))return $.aborted=!0,$;let K=G(H,W,B);if(K instanceof Promise){if(B.async===!1)throw new l0;return K.then((z)=>Q._zod.parse(z,B))}return Q._zod.parse(K,B)};Q._zod.run=($,H)=>{if(H.skipChecks)return Q._zod.parse($,H);if(H.direction==="backward"){let K=Q._zod.parse({value:$.value,issues:[]},{...H,skipChecks:!0});if(K instanceof Promise)return K.then((z)=>{return J(z,$,H)});return J(K,$,H)}let B=Q._zod.parse($,H);if(B instanceof Promise){if(H.async===!1)throw new l0;return B.then((K)=>G(K,W,H))}return G(B,W,H)}}i(Q,"~standard",()=>({validate:(G)=>{try{let J=X9(Q,G);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return YQ(Q,G).then(($)=>$.success?{value:$.data}:{issues:$.error?.issues})}},vendor:"zod",version:1}))}),HQ=U("$ZodString",(Q,X)=>{o.init(Q,X),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??oX(Q._zod.bag),Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=String(Y.value)}catch(G){}if(typeof Y.value==="string")return Y;return Y.issues.push({expected:"string",code:"invalid_type",input:Y.value,inst:Q}),Y}}),t=U("$ZodStringFormat",(Q,X)=>{W9.init(Q,X),HQ.init(Q,X)}),IY=U("$ZodGUID",(Q,X)=>{X.pattern??(X.pattern=_X),t.init(Q,X)}),EY=U("$ZodUUID",(Q,X)=>{if(X.version){let W={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(W===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=y6(W))}else X.pattern??(X.pattern=y6());t.init(Q,X)}),bY=U("$ZodEmail",(Q,X)=>{X.pattern??(X.pattern=xX),t.init(Q,X)}),jY=U("$ZodURL",(Q,X)=>{t.init(Q,X),Q._zod.check=(Y)=>{try{let W=Y.value.trim();if(!X.normalize&&X.protocol?.source===mX.source){if(!/^https?:\/\//i.test(W)){Y.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:Y.value,inst:Q,continue:!X.abort});return}}let G=new URL(W);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(G.hostname))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:X.hostname.source,input:Y.value,inst:Q,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(G.protocol.endsWith(":")?G.protocol.slice(0,-1):G.protocol))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:Y.value,inst:Q,continue:!X.abort})}if(X.normalize)Y.value=G.href;else Y.value=W;return}catch(W){Y.issues.push({code:"invalid_format",format:"url",input:Y.value,inst:Q,continue:!X.abort})}}}),TY=U("$ZodEmoji",(Q,X)=>{X.pattern??(X.pattern=gX()),t.init(Q,X)}),RY=U("$ZodNanoID",(Q,X)=>{X.pattern??(X.pattern=kX),t.init(Q,X)}),SY=U("$ZodCUID",(Q,X)=>{X.pattern??(X.pattern=jX),t.init(Q,X)}),CY=U("$ZodCUID2",(Q,X)=>{X.pattern??(X.pattern=TX),t.init(Q,X)}),kY=U("$ZodULID",(Q,X)=>{X.pattern??(X.pattern=RX),t.init(Q,X)}),vY=U("$ZodXID",(Q,X)=>{X.pattern??(X.pattern=SX),t.init(Q,X)}),_Y=U("$ZodKSUID",(Q,X)=>{X.pattern??(X.pattern=CX),t.init(Q,X)}),xY=U("$ZodISODateTime",(Q,X)=>{X.pattern??(X.pattern=rX(X)),t.init(Q,X)}),gY=U("$ZodISODate",(Q,X)=>{X.pattern??(X.pattern=iX),t.init(Q,X)}),yY=U("$ZodISOTime",(Q,X)=>{X.pattern??(X.pattern=nX(X)),t.init(Q,X)}),hY=U("$ZodISODuration",(Q,X)=>{X.pattern??(X.pattern=vX),t.init(Q,X)}),uY=U("$ZodIPv4",(Q,X)=>{X.pattern??(X.pattern=yX),t.init(Q,X),Q._zod.bag.format="ipv4"}),fY=U("$ZodIPv6",(Q,X)=>{X.pattern??(X.pattern=hX),t.init(Q,X),Q._zod.bag.format="ipv6",Q._zod.check=(Y)=>{try{new URL(`http://[${Y.value}]`)}catch{Y.issues.push({code:"invalid_format",format:"ipv6",input:Y.value,inst:Q,continue:!X.abort})}}});var lY=U("$ZodCIDRv4",(Q,X)=>{X.pattern??(X.pattern=uX),t.init(Q,X)}),mY=U("$ZodCIDRv6",(Q,X)=>{X.pattern??(X.pattern=fX),t.init(Q,X),Q._zod.check=(Y)=>{let W=Y.value.split("/");try{if(W.length!==2)throw Error();let[G,J]=W;if(!J)throw Error();let $=Number(J);if(`${$}`!==J)throw Error();if($<0||$>128)throw Error();new URL(`http://[${G}]`)}catch{Y.issues.push({code:"invalid_format",format:"cidrv6",input:Y.value,inst:Q,continue:!X.abort})}}});function cY(Q){if(Q==="")return!0;if(/\s/.test(Q))return!1;if(Q.length%4!==0)return!1;try{return atob(Q),!0}catch{return!1}}var pY=U("$ZodBase64",(Q,X)=>{X.pattern??(X.pattern=lX),t.init(Q,X),Q._zod.bag.contentEncoding="base64",Q._zod.check=(Y)=>{if(cY(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:Q,continue:!X.abort})}});function EB(Q){if(!h6.test(Q))return!1;let X=Q.replace(/[-_]/g,(W)=>W==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return cY(Y)}var iY=U("$ZodBase64URL",(Q,X)=>{X.pattern??(X.pattern=h6),t.init(Q,X),Q._zod.bag.contentEncoding="base64url",Q._zod.check=(Y)=>{if(EB(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:Q,continue:!X.abort})}}),dY=U("$ZodE164",(Q,X)=>{X.pattern??(X.pattern=cX),t.init(Q,X)});function bB(Q,X=null){try{let Y=Q.split(".");if(Y.length!==3)return!1;let[W]=Y;if(!W)return!1;let G=JSON.parse(atob(W));if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(X&&(!("alg"in G)||G.alg!==X))return!1;return!0}catch{return!1}}var nY=U("$ZodJWT",(Q,X)=>{t.init(Q,X),Q._zod.check=(Y)=>{if(bB(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:Q,continue:!X.abort})}});var c6=U("$ZodNumber",(Q,X)=>{o.init(Q,X),Q._zod.pattern=Q._zod.bag.pattern??WQ,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch($){}let G=Y.value;if(typeof G==="number"&&!Number.isNaN(G)&&Number.isFinite(G))return Y;let J=typeof G==="number"?Number.isNaN(G)?"NaN":!Number.isFinite(G)?"Infinity":void 0:void 0;return Y.issues.push({expected:"number",code:"invalid_type",input:G,inst:Q,...J?{received:J}:{}}),Y}}),rY=U("$ZodNumberFormat",(Q,X)=>{WY.init(Q,X),c6.init(Q,X)}),oY=U("$ZodBoolean",(Q,X)=>{o.init(Q,X),Q._zod.pattern=aX,Q._zod.parse=(Y,W)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch(J){}let G=Y.value;if(typeof G==="boolean")return Y;return Y.issues.push({expected:"boolean",code:"invalid_type",input:G,inst:Q}),Y}});var tY=U("$ZodNull",(Q,X)=>{o.init(Q,X),Q._zod.pattern=sX,Q._zod.values=new Set([null]),Q._zod.parse=(Y,W)=>{let G=Y.value;if(G===null)return Y;return Y.issues.push({expected:"null",code:"invalid_type",input:G,inst:Q}),Y}});var aY=U("$ZodUnknown",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y)=>Y}),sY=U("$ZodNever",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y,W)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:Q}),Y}});function UY(Q,X,Y){if(Q.issues.length)X.issues.push(...p0(Y,Q.issues));X.value[Y]=Q.value}var eY=U("$ZodArray",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!Array.isArray(G))return Y.issues.push({expected:"array",code:"invalid_type",input:G,inst:Q}),Y;Y.value=Array(G.length);let J=[];for(let $=0;$<G.length;$++){let H=G[$],B=X.element._zod.run({value:H,issues:[]},W);if(B instanceof Promise)J.push(B.then((K)=>UY(K,Y,$)));else UY(B,Y,$)}if(J.length)return Promise.all(J).then(()=>Y);return Y}});function $Q(Q,X,Y,W,G,J){let $=Y in W;if(Q.issues.length){if(G&&J&&!$)return;X.issues.push(...p0(Y,Q.issues))}if(!$&&!G){if(!Q.issues.length)X.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[Y]});return}if(Q.value===void 0){if($)X.value[Y]=void 0}else X.value[Y]=Q.value}function QW(Q){let X=Object.keys(Q.shape);for(let W of X)if(!Q.shape?.[W]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${W}": expected a Zod schema`);let Y=k6(Q.shape);return{...Q,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(Y)}}function XW(Q,X,Y,W,G,J){let $=[],H=G.keySet,B=G.catchall._zod,K=B.def.type,z=B.optin==="optional",F=B.optout==="optional";for(let L in X){if(L==="__proto__")continue;if(H.has(L))continue;if(K==="never"){$.push(L);continue}let D=B.run({value:X[L],issues:[]},W);if(D instanceof Promise)Q.push(D.then((Z)=>$Q(Z,Y,L,X,z,F)));else $Q(D,Y,L,X,z,F)}if($.length)Y.issues.push({code:"unrecognized_keys",keys:$,input:X,inst:J});if(!Q.length)return Y;return Promise.all(Q).then(()=>{return Y})}var jB=U("$ZodObject",(Q,X)=>{if(o.init(Q,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let H=X.shape;Object.defineProperty(X,"shape",{get:()=>{let B={...H};return Object.defineProperty(X,"shape",{value:B}),B}})}let W=P1(()=>QW(X));i(Q._zod,"propValues",()=>{let H=X.shape,B={};for(let K in H){let z=H[K]._zod;if(z.values){B[K]??(B[K]=new Set);for(let F of z.values)B[K].add(F)}}return B});let G=z1,J=X.catchall,$;Q._zod.parse=(H,B)=>{$??($=W.value);let K=H.value;if(!G(K))return H.issues.push({expected:"object",code:"invalid_type",input:K,inst:Q}),H;H.value={};let z=[],F=$.shape;for(let L of $.keys){let D=F[L],Z=D._zod.optin==="optional",N=D._zod.optout==="optional",M=D._zod.run({value:K[L],issues:[]},B);if(M instanceof Promise)z.push(M.then((O)=>$Q(O,H,L,K,Z,N)));else $Q(M,H,L,K,Z,N)}if(!J)return z.length?Promise.all(z).then(()=>H):H;return XW(z,K,H,B,W.value,Q)}}),YW=U("$ZodObjectJIT",(Q,X)=>{jB.init(Q,X);let Y=Q._zod.parse,W=P1(()=>QW(X)),G=(L)=>{let D=new l6(["shape","payload","ctx"]),Z=W.value,N=(j)=>{let S=t9(j);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};D.write("const input = payload.value;");let M=Object.create(null),O=0;for(let j of Z.keys)M[j]=`key_${O++}`;D.write("const newResult = {};");for(let j of Z.keys){let S=M[j],I=t9(j),N0=L[j],I0=N0?._zod?.optin==="optional",d1=N0?._zod?.optout==="optional";if(D.write(`const ${S} = ${N(j)};`),I0&&d1)D.write(`
|
|
13
|
+
if (${S}.issues.length) {
|
|
14
|
+
if (${I} in input) {
|
|
15
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
16
|
+
...iss,
|
|
17
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
18
|
+
})));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (${S}.value === undefined) {
|
|
23
|
+
if (${I} in input) {
|
|
24
|
+
newResult[${I}] = undefined;
|
|
25
|
+
}
|
|
26
|
+
} else {
|
|
27
|
+
newResult[${I}] = ${S}.value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
`);else if(!I0)D.write(`
|
|
31
|
+
const ${S}_present = ${I} in input;
|
|
32
|
+
if (${S}.issues.length) {
|
|
33
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
34
|
+
...iss,
|
|
35
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
36
|
+
})));
|
|
37
|
+
}
|
|
38
|
+
if (!${S}_present && !${S}.issues.length) {
|
|
39
|
+
payload.issues.push({
|
|
40
|
+
code: "invalid_type",
|
|
41
|
+
expected: "nonoptional",
|
|
42
|
+
input: undefined,
|
|
43
|
+
path: [${I}]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (${S}_present) {
|
|
48
|
+
if (${S}.value === undefined) {
|
|
49
|
+
newResult[${I}] = undefined;
|
|
50
|
+
} else {
|
|
51
|
+
newResult[${I}] = ${S}.value;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
`);else D.write(`
|
|
56
|
+
if (${S}.issues.length) {
|
|
57
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
58
|
+
...iss,
|
|
59
|
+
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
60
|
+
})));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (${S}.value === undefined) {
|
|
64
|
+
if (${I} in input) {
|
|
65
|
+
newResult[${I}] = undefined;
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
newResult[${I}] = ${S}.value;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
`)}D.write("payload.value = newResult;"),D.write("return payload;");let k=D.compile();return(j,S)=>k(L,j,S)},J,$=z1,H=!O1.jitless,K=H&&S6.value,z=X.catchall,F;Q._zod.parse=(L,D)=>{F??(F=W.value);let Z=L.value;if(!$(Z))return L.issues.push({expected:"object",code:"invalid_type",input:Z,inst:Q}),L;if(H&&K&&D?.async===!1&&D.jitless!==!0){if(!J)J=G(X.shape);if(L=J(L,D),!z)return L;return XW([],Z,L,D,F,Q)}return Y(L,D)}});function ZY(Q,X,Y,W){for(let J of Q)if(J.issues.length===0)return X.value=J.value,X;let G=Q.filter((J)=>!s0(J));if(G.length===1)return X.value=G[0].value,G[0];return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:Q.map((J)=>J.issues.map(($)=>E0($,W,M0())))}),X}var p6=U("$ZodUnion",(Q,X)=>{o.init(Q,X),i(Q._zod,"optin",()=>X.options.some((W)=>W._zod.optin==="optional")?"optional":void 0),i(Q._zod,"optout",()=>X.options.some((W)=>W._zod.optout==="optional")?"optional":void 0),i(Q._zod,"values",()=>{if(X.options.every((W)=>W._zod.values))return new Set(X.options.flatMap((W)=>Array.from(W._zod.values)));return}),i(Q._zod,"pattern",()=>{if(X.options.every((W)=>W._zod.pattern)){let W=X.options.map((G)=>G._zod.pattern);return new RegExp(`^(${W.map((G)=>s1(G.source)).join("|")})$`)}return});let Y=X.options.length===1?X.options[0]._zod.run:null;Q._zod.parse=(W,G)=>{if(Y)return Y(W,G);let J=!1,$=[];for(let H of X.options){let B=H._zod.run({value:W.value,issues:[]},G);if(B instanceof Promise)$.push(B),J=!0;else{if(B.issues.length===0)return B;$.push(B)}}if(!J)return ZY($,W,Q,G);return Promise.all($).then((H)=>{return ZY(H,W,Q,G)})}});var WW=U("$ZodDiscriminatedUnion",(Q,X)=>{X.inclusive=!1,p6.init(Q,X);let Y=Q._zod.parse;i(Q._zod,"propValues",()=>{let G={};for(let J of X.options){let $=J._zod.propValues;if(!$||Object.keys($).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let[H,B]of Object.entries($)){if(!G[H])G[H]=new Set;for(let K of B)G[H].add(K)}}return G});let W=P1(()=>{let G=X.options,J=new Map;for(let $ of G){let H=$._zod.propValues?.[X.discriminator];if(!H||H.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf($)}"`);for(let B of H){if(J.has(B))throw Error(`Duplicate discriminator value "${String(B)}"`);J.set(B,$)}}return J});Q._zod.parse=(G,J)=>{let $=G.value;if(!z1($))return G.issues.push({code:"invalid_type",expected:"object",input:$,inst:Q}),G;let H=W.value.get($?.[X.discriminator]);if(H)return H._zod.run(G,J);if(X.unionFallback||J.direction==="backward")return Y(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,options:Array.from(W.value.keys()),input:$,path:[X.discriminator],inst:Q}),G}}),GW=U("$ZodIntersection",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value,J=X.left._zod.run({value:G,issues:[]},W),$=X.right._zod.run({value:G,issues:[]},W);if(J instanceof Promise||$ instanceof Promise)return Promise.all([J,$]).then(([B,K])=>{return qY(Y,B,K)});return qY(Y,J,$)}});function m6(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(a0(Q)&&a0(X)){let Y=Object.keys(X),W=Object.keys(Q).filter((J)=>Y.indexOf(J)!==-1),G={...Q,...X};for(let J of W){let $=m6(Q[J],X[J]);if(!$.valid)return{valid:!1,mergeErrorPath:[J,...$.mergeErrorPath]};G[J]=$.data}return{valid:!0,data:G}}if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let W=0;W<Q.length;W++){let G=Q[W],J=X[W],$=m6(G,J);if(!$.valid)return{valid:!1,mergeErrorPath:[W,...$.mergeErrorPath]};Y.push($.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function qY(Q,X,Y){let W=new Map,G;for(let H of X.issues)if(H.code==="unrecognized_keys"){G??(G=H);for(let B of H.keys){if(!W.has(B))W.set(B,{});W.get(B).l=!0}}else Q.issues.push(H);for(let H of Y.issues)if(H.code==="unrecognized_keys")for(let B of H.keys){if(!W.has(B))W.set(B,{});W.get(B).r=!0}else Q.issues.push(H);let J=[...W].filter(([,H])=>H.l&&H.r).map(([H])=>H);if(J.length&&G)Q.issues.push({...G,keys:J});if(s0(Q))return Q;let $=m6(X.value,Y.value);if(!$.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify($.mergeErrorPath)}`);return Q.value=$.data,Q}var JW=U("$ZodRecord",(Q,X)=>{o.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!a0(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),Y;let J=[],$=X.keyType._zod.values;if($){Y.value={};let H=new Set;for(let K of $)if(typeof K==="string"||typeof K==="number"||typeof K==="symbol"){H.add(typeof K==="number"?K.toString():K);let z=X.keyType._zod.run({value:K,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((D)=>E0(D,W,M0())),input:K,path:[K],inst:Q});continue}let F=z.value,L=X.valueType._zod.run({value:G[K],issues:[]},W);if(L instanceof Promise)J.push(L.then((D)=>{if(D.issues.length)Y.issues.push(...p0(K,D.issues));Y.value[F]=D.value}));else{if(L.issues.length)Y.issues.push(...p0(K,L.issues));Y.value[F]=L.value}}let B;for(let K in G)if(!H.has(K))B=B??[],B.push(K);if(B&&B.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:B})}else{Y.value={};for(let H of Reflect.ownKeys(G)){if(H==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(G,H))continue;let B=X.keyType._zod.run({value:H,issues:[]},W);if(B instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof H==="string"&&WQ.test(H)&&B.issues.length){let F=X.keyType._zod.run({value:Number(H),issues:[]},W);if(F instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(F.issues.length===0)B=F}if(B.issues.length){if(X.mode==="loose")Y.value[H]=G[H];else Y.issues.push({code:"invalid_key",origin:"record",issues:B.issues.map((F)=>E0(F,W,M0())),input:H,path:[H],inst:Q});continue}let z=X.valueType._zod.run({value:G[H],issues:[]},W);if(z instanceof Promise)J.push(z.then((F)=>{if(F.issues.length)Y.issues.push(...p0(H,F.issues));Y.value[B.value]=F.value}));else{if(z.issues.length)Y.issues.push(...p0(H,z.issues));Y.value[B.value]=z.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var $W=U("$ZodEnum",(Q,X)=>{o.init(Q,X);let Y=t1(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>C6.has(typeof G)).map((G)=>typeof G==="string"?c0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,J)=>{let $=G.value;if(W.has($))return G;return G.issues.push({code:"invalid_value",values:Y,input:$,inst:Q}),G}}),HW=U("$ZodLiteral",(Q,X)=>{if(o.init(Q,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");let Y=new Set(X.values);Q._zod.values=Y,Q._zod.pattern=new RegExp(`^(${X.values.map((W)=>typeof W==="string"?c0(W):W?c0(W.toString()):String(W)).join("|")})$`),Q._zod.parse=(W,G)=>{let J=W.value;if(Y.has(J))return W;return W.issues.push({code:"invalid_value",values:X.values,input:J,inst:Q}),W}});var BW=U("$ZodTransform",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new r1(Q.constructor.name);let G=X.transform(Y.value,Y);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then(($)=>{return Y.value=$,Y.fallback=!0,Y});if(G instanceof Promise)throw new l0;return Y.value=G,Y.fallback=!0,Y}});function NY(Q,X){if(X===void 0&&(Q.issues.length||Q.fallback))return{issues:[],value:void 0};return Q}var i6=U("$ZodOptional",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",i(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),i(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${s1(Y.source)})?$`):void 0}),Q._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional"){let G=Y.value,J=X.innerType._zod.run(Y,W);if(J instanceof Promise)return J.then(($)=>NY($,G));return NY(J,G)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),KW=U("$ZodExactOptional",(Q,X)=>{i6.init(Q,X),i(Q._zod,"values",()=>X.innerType._zod.values),i(Q._zod,"pattern",()=>X.innerType._zod.pattern),Q._zod.parse=(Y,W)=>{return X.innerType._zod.run(Y,W)}}),zW=U("$ZodNullable",(Q,X)=>{o.init(Q,X),i(Q._zod,"optin",()=>X.innerType._zod.optin),i(Q._zod,"optout",()=>X.innerType._zod.optout),i(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${s1(Y.source)}|null)$`):void 0}),i(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)}}),AW=U("$ZodDefault",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",i(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);if(Y.value===void 0)return Y.value=X.defaultValue,Y;let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>MY(J,X));return MY(G,X)}});function MY(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var FW=U("$ZodPrefault",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",i(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)}}),LW=U("$ZodNonOptional",(Q,X)=>{o.init(Q,X),i(Q._zod,"values",()=>{let Y=X.innerType._zod.values;return Y?new Set([...Y].filter((W)=>W!==void 0)):void 0}),Q._zod.parse=(Y,W)=>{let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>OY(J,Q));return OY(G,Q)}});function OY(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 DW=U("$ZodCatch",(Q,X)=>{o.init(Q,X),Q._zod.optin="optional",i(Q._zod,"optout",()=>X.innerType._zod.optout),i(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>{if(Y.value=J.value,J.issues.length)Y.value=X.catchValue({...Y,error:{issues:J.issues.map(($)=>E0($,W,M0()))},input:Y.value}),Y.issues=[],Y.fallback=!0;return Y});if(Y.value=G.value,G.issues.length)Y.value=X.catchValue({...Y,error:{issues:G.issues.map((J)=>E0(J,W,M0()))},input:Y.value}),Y.issues=[],Y.fallback=!0;return Y}});var d6=U("$ZodPipe",(Q,X)=>{o.init(Q,X),i(Q._zod,"values",()=>X.in._zod.values),i(Q._zod,"optin",()=>X.in._zod.optin),i(Q._zod,"optout",()=>X.out._zod.optout),i(Q._zod,"propValues",()=>X.in._zod.propValues),Q._zod.parse=(Y,W)=>{if(W.direction==="backward"){let J=X.out._zod.run(Y,W);if(J instanceof Promise)return J.then(($)=>JQ($,X.in,W));return JQ(J,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>JQ(J,X.out,W));return JQ(G,X.out,W)}});function JQ(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues,fallback:Q.fallback},Y)}var VW=U("$ZodPreprocess",(Q,X)=>{d6.init(Q,X)}),UW=U("$ZodReadonly",(Q,X)=>{o.init(Q,X),i(Q._zod,"propValues",()=>X.innerType._zod.propValues),i(Q._zod,"values",()=>X.innerType._zod.values),i(Q._zod,"optin",()=>X.innerType?._zod?.optin),i(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(wY);return wY(G)}});function wY(Q){return Q.value=Object.freeze(Q.value),Q}var ZW=U("$ZodCustom",(Q,X)=>{G0.init(Q,X),o.init(Q,X),Q._zod.parse=(Y,W)=>{return Y},Q._zod.check=(Y)=>{let W=Y.value,G=X.fn(W);if(G instanceof Promise)return G.then((J)=>PY(J,Y,W,Q));PY(G,Y,W,Q);return}});function PY(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(I1(G))}}var TB=()=>{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"},map:{unit:"entries",verb:"to have"}};function X(G){return Q[G]??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",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},W={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let J=W[G.expected]??G.expected,$=x6(G.input),H=W[$]??$;return`Invalid input: expected ${J}, received ${H}`}case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${s9(G.values[0])}`;return`Invalid option: expected one of ${o9(G.values,"|")}`;case"too_big":{let J=G.inclusive?"<=":"<",$=X(G.origin);if($)return`Too big: expected ${G.origin??"value"} to have ${J}${G.maximum.toString()} ${$.unit??"elements"}`;return`Too big: expected ${G.origin??"value"} to be ${J}${G.maximum.toString()}`}case"too_small":{let J=G.inclusive?">=":">",$=X(G.origin);if($)return`Too small: expected ${G.origin} to have ${J}${G.minimum.toString()} ${$.unit}`;return`Too small: expected ${G.origin} to be ${J}${G.minimum.toString()}`}case"invalid_format":{let J=G;if(J.format==="starts_with")return`Invalid string: must start with "${J.prefix}"`;if(J.format==="ends_with")return`Invalid string: must end with "${J.suffix}"`;if(J.format==="includes")return`Invalid string: must include "${J.includes}"`;if(J.format==="regex")return`Invalid string: must match pattern ${J.pattern}`;return`Invalid ${Y[J.format]??G.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${G.divisor}`;case"unrecognized_keys":return`Unrecognized key${G.keys.length>1?"s":""}: ${o9(G.keys,", ")}`;case"invalid_key":return`Invalid key in ${G.origin}`;case"invalid_union":if(G.options&&Array.isArray(G.options)&&G.options.length>0)return`Invalid discriminator value. Expected ${G.options.map(($)=>`'${$}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${G.origin}`;default:return"Invalid input"}}};function n6(){return{localeError:TB()}}var qW,Aw=Symbol("ZodOutput"),Fw=Symbol("ZodInput");class NW{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)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 RB(){return new NW}(qW=globalThis).__zod_globalRegistry??(qW.__zod_globalRegistry=RB());var A1=globalThis.__zod_globalRegistry;function MW(Q,X){return new Q({type:"string",...T(X)})}function OW(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...T(X)})}function r6(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...T(X)})}function wW(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...T(X)})}function PW(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(X)})}function IW(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(X)})}function EW(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(X)})}function bW(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...T(X)})}function jW(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...T(X)})}function TW(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(X)})}function RW(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...T(X)})}function SW(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(X)})}function CW(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...T(X)})}function kW(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...T(X)})}function vW(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(X)})}function _W(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(X)})}function xW(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(X)})}function gW(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(X)})}function yW(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(X)})}function hW(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...T(X)})}function uW(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...T(X)})}function fW(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...T(X)})}function lW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...T(X)})}function mW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(X)})}function cW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...T(X)})}function pW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...T(X)})}function iW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...T(X)})}function dW(Q,X){return new Q({type:"number",checks:[],...T(X)})}function nW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...T(X)})}function rW(Q,X){return new Q({type:"boolean",...T(X)})}function oW(Q,X){return new Q({type:"null",...T(X)})}function tW(Q){return new Q({type:"unknown"})}function aW(Q,X){return new Q({type:"never",...T(X)})}function BQ(Q,X){return new u6({check:"less_than",...T(X),value:Q,inclusive:!1})}function G9(Q,X){return new u6({check:"less_than",...T(X),value:Q,inclusive:!0})}function KQ(Q,X){return new f6({check:"greater_than",...T(X),value:Q,inclusive:!1})}function J9(Q,X){return new f6({check:"greater_than",...T(X),value:Q,inclusive:!0})}function zQ(Q,X){return new YY({check:"multiple_of",...T(X),value:Q})}function AQ(Q,X){return new GY({check:"max_length",...T(X),maximum:Q})}function E1(Q,X){return new JY({check:"min_length",...T(X),minimum:Q})}function FQ(Q,X){return new $Y({check:"length_equals",...T(X),length:Q})}function o6(Q,X){return new HY({check:"string_format",format:"regex",...T(X),pattern:Q})}function t6(Q){return new BY({check:"string_format",format:"lowercase",...T(Q)})}function a6(Q){return new KY({check:"string_format",format:"uppercase",...T(Q)})}function s6(Q,X){return new zY({check:"string_format",format:"includes",...T(X),includes:Q})}function e6(Q,X){return new AY({check:"string_format",format:"starts_with",...T(X),prefix:Q})}function Q4(Q,X){return new FY({check:"string_format",format:"ends_with",...T(X),suffix:Q})}function e0(Q){return new LY({check:"overwrite",tx:Q})}function X4(Q){return e0((X)=>X.normalize(Q))}function Y4(){return e0((Q)=>Q.trim())}function W4(){return e0((Q)=>Q.toLowerCase())}function G4(){return e0((Q)=>Q.toUpperCase())}function J4(){return e0((Q)=>R6(Q))}function sW(Q,X,Y){return new Q({type:"array",element:X,...T(Y)})}function eW(Q,X,Y){let W=T(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function QG(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...T(Y)})}function XG(Q,X){let Y=SB((W)=>{return W.addIssue=(G)=>{if(typeof G==="string")W.issues.push(I1(G,W.value,Y._zod.def));else{let J=G;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=W.value),J.inst??(J.inst=Y),J.continue??(J.continue=!Y._zod.def.abort),W.issues.push(I1(J))}},Q(W.value,W)},X);return Y}function SB(Q,X){let Y=new G0({check:"custom",...T(X)});return Y._zod.check=Q,Y}function $4(Q){let X=Q?.target??"draft-2020-12";if(X==="draft-4")X="draft-04";if(X==="draft-7")X="draft-07";return{processors:Q.processors??{},metadataRegistry:Q?.metadata??A1,target:X,unrepresentable:Q?.unrepresentable??"throw",override:Q?.override??(()=>{}),io:Q?.io??"output",counter:0,seen:new Map,cycles:Q?.cycles??"ref",reused:Q?.reused??"inline",external:Q?.external??void 0}}function Q0(Q,X,Y={path:[],schemaPath:[]}){var W;let G=Q._zod.def,J=X.seen.get(Q);if(J){if(J.count++,Y.schemaPath.includes(Q))J.cycle=Y.path;return J.schema}let $={schema:{},count:1,cycle:void 0,path:Y.path};X.seen.set(Q,$);let H=Q._zod.toJSONSchema?.();if(H)$.schema=H;else{let z={...Y,schemaPath:[...Y.schemaPath,Q],path:Y.path};if(Q._zod.processJSONSchema)Q._zod.processJSONSchema(X,$.schema,z);else{let L=$.schema,D=X.processors[G.type];if(!D)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);D(Q,X,L,z)}let F=Q._zod.parent;if(F){if(!$.ref)$.ref=F;Q0(F,X,z),X.seen.get(F).isParent=!0}}let B=X.metadataRegistry.get(Q);if(B)Object.assign($.schema,B);if(X.io==="input"&&F0(Q))delete $.schema.examples,delete $.schema.default;if(X.io==="input"&&"_prefault"in $.schema)(W=$.schema).default??(W.default=$.schema._prefault);return delete $.schema._prefault,X.seen.get(Q).schema}function H4(Q,X){let Y=Q.seen.get(X);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let W=new Map;for(let $ of Q.seen.entries()){let H=Q.metadataRegistry.get($[0])?.id;if(H){let B=W.get(H);if(B&&B!==$[0])throw Error(`Duplicate schema id "${H}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);W.set(H,$[0])}}let G=($)=>{let H=Q.target==="draft-2020-12"?"$defs":"definitions";if(Q.external){let F=Q.external.registry.get($[0])?.id,L=Q.external.uri??((Z)=>Z);if(F)return{ref:L(F)};let D=$[1].defId??$[1].schema.id??`schema${Q.counter++}`;return $[1].defId=D,{defId:D,ref:`${L("__shared")}#/${H}/${D}`}}if($[1]===Y)return{ref:"#"};let K=`${"#"}/${H}/`,z=$[1].schema.id??`__schema${Q.counter++}`;return{defId:z,ref:K+z}},J=($)=>{if($[1].schema.$ref)return;let H=$[1],{ref:B,defId:K}=G($);if(H.def={...H.schema},K)H.defId=K;let z=H.schema;for(let F in z)delete z[F];z.$ref=B};if(Q.cycles==="throw")for(let $ of Q.seen.entries()){let H=$[1];if(H.cycle)throw Error(`Cycle detected: #/${H.cycle?.join("/")}/<root>
|
|
72
|
+
|
|
73
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let $ of Q.seen.entries()){let H=$[1];if(X===$[0]){J($);continue}if(Q.external){let K=Q.external.registry.get($[0])?.id;if(X!==$[0]&&K){J($);continue}}if(Q.metadataRegistry.get($[0])?.id){J($);continue}if(H.cycle){J($);continue}if(H.count>1){if(Q.reused==="ref"){J($);continue}}}}function B4(Q,X){let Y=Q.seen.get(X);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let W=(H)=>{let B=Q.seen.get(H);if(B.ref===null)return;let K=B.def??B.schema,z={...K},F=B.ref;if(B.ref=null,F){W(F);let D=Q.seen.get(F),Z=D.schema;if(Z.$ref&&(Q.target==="draft-07"||Q.target==="draft-04"||Q.target==="openapi-3.0"))K.allOf=K.allOf??[],K.allOf.push(Z);else Object.assign(K,Z);if(Object.assign(K,z),H._zod.parent===F)for(let M in K){if(M==="$ref"||M==="allOf")continue;if(!(M in z))delete K[M]}if(Z.$ref&&D.def)for(let M in K){if(M==="$ref"||M==="allOf")continue;if(M in D.def&&JSON.stringify(K[M])===JSON.stringify(D.def[M]))delete K[M]}}let L=H._zod.parent;if(L&&L!==F){W(L);let D=Q.seen.get(L);if(D?.schema.$ref){if(K.$ref=D.schema.$ref,D.def)for(let Z in K){if(Z==="$ref"||Z==="allOf")continue;if(Z in D.def&&JSON.stringify(K[Z])===JSON.stringify(D.def[Z]))delete K[Z]}}}Q.override({zodSchema:H,jsonSchema:K,path:B.path??[]})};for(let H of[...Q.seen.entries()].reverse())W(H[0]);let G={};if(Q.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(Q.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(Q.target==="openapi-3.0");if(Q.external?.uri){let H=Q.external.registry.get(X)?.id;if(!H)throw Error("Schema is missing an `id` property");G.$id=Q.external.uri(H)}Object.assign(G,Y.def??Y.schema);let J=Q.metadataRegistry.get(X)?.id;if(J!==void 0&&G.id===J)delete G.id;let $=Q.external?.defs??{};for(let H of Q.seen.entries()){let B=H[1];if(B.def&&B.defId){if(B.def.id===B.defId)delete B.def.id;$[B.defId]=B.def}}if(Q.external);else if(Object.keys($).length>0)if(Q.target==="draft-2020-12")G.$defs=$;else G.definitions=$;try{let H=JSON.parse(JSON.stringify(G));return Object.defineProperty(H,"~standard",{value:{...X["~standard"],jsonSchema:{input:$9(X,"input",Q.processors),output:$9(X,"output",Q.processors)}},enumerable:!1,writable:!1}),H}catch(H){throw Error("Error converting schema to JSON.")}}function F0(Q,X){let Y=X??{seen:new Set};if(Y.seen.has(Q))return!1;Y.seen.add(Q);let W=Q._zod.def;if(W.type==="transform")return!0;if(W.type==="array")return F0(W.element,Y);if(W.type==="set")return F0(W.valueType,Y);if(W.type==="lazy")return F0(W.getter(),Y);if(W.type==="promise"||W.type==="optional"||W.type==="nonoptional"||W.type==="nullable"||W.type==="readonly"||W.type==="default"||W.type==="prefault")return F0(W.innerType,Y);if(W.type==="intersection")return F0(W.left,Y)||F0(W.right,Y);if(W.type==="record"||W.type==="map")return F0(W.keyType,Y)||F0(W.valueType,Y);if(W.type==="pipe"){if(Q._zod.traits.has("$ZodCodec"))return!0;return F0(W.in,Y)||F0(W.out,Y)}if(W.type==="object"){for(let G in W.shape)if(F0(W.shape[G],Y))return!0;return!1}if(W.type==="union"){for(let G of W.options)if(F0(G,Y))return!0;return!1}if(W.type==="tuple"){for(let G of W.items)if(F0(G,Y))return!0;if(W.rest&&F0(W.rest,Y))return!0;return!1}return!1}var YG=(Q,X={})=>(Y)=>{let W=$4({...Y,processors:X});return Q0(Q,W),H4(W,Q),B4(W,Q)},$9=(Q,X,Y={})=>(W)=>{let{libraryOptions:G,target:J}=W??{},$=$4({...G??{},target:J,io:X,processors:Y});return Q0(Q,$),H4($,Q),B4($,Q)};var CB={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},WG=(Q,X,Y,W)=>{let G=Y;G.type="string";let{minimum:J,maximum:$,format:H,patterns:B,contentEncoding:K}=Q._zod.bag;if(typeof J==="number")G.minLength=J;if(typeof $==="number")G.maxLength=$;if(H){if(G.format=CB[H]??H,G.format==="")delete G.format;if(H==="time")delete G.format}if(K)G.contentEncoding=K;if(B&&B.size>0){let z=[...B];if(z.length===1)G.pattern=z[0].source;else if(z.length>1)G.allOf=[...z.map((F)=>({...X.target==="draft-07"||X.target==="draft-04"||X.target==="openapi-3.0"?{type:"string"}:{},pattern:F.source}))]}},GG=(Q,X,Y,W)=>{let G=Y,{minimum:J,maximum:$,format:H,multipleOf:B,exclusiveMaximum:K,exclusiveMinimum:z}=Q._zod.bag;if(typeof H==="string"&&H.includes("int"))G.type="integer";else G.type="number";let F=typeof z==="number"&&z>=(J??Number.NEGATIVE_INFINITY),L=typeof K==="number"&&K<=($??Number.POSITIVE_INFINITY),D=X.target==="draft-04"||X.target==="openapi-3.0";if(F)if(D)G.minimum=z,G.exclusiveMinimum=!0;else G.exclusiveMinimum=z;else if(typeof J==="number")G.minimum=J;if(L)if(D)G.maximum=K,G.exclusiveMaximum=!0;else G.exclusiveMaximum=K;else if(typeof $==="number")G.maximum=$;if(typeof B==="number")G.multipleOf=B},JG=(Q,X,Y,W)=>{Y.type="boolean"};var $G=(Q,X,Y,W)=>{if(X.target==="openapi-3.0")Y.type="string",Y.nullable=!0,Y.enum=[null];else Y.type="null"};var HG=(Q,X,Y,W)=>{Y.not={}};var BG=(Q,X,Y,W)=>{};var KG=(Q,X,Y,W)=>{let G=Q._zod.def,J=t1(G.entries);if(J.every(($)=>typeof $==="number"))Y.type="number";if(J.every(($)=>typeof $==="string"))Y.type="string";Y.enum=J},zG=(Q,X,Y,W)=>{let G=Q._zod.def,J=[];for(let $ of G.values)if($===void 0){if(X.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof $==="bigint")if(X.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else J.push(Number($));else J.push($);if(J.length===0);else if(J.length===1){let $=J[0];if(Y.type=$===null?"null":typeof $,X.target==="draft-04"||X.target==="openapi-3.0")Y.enum=[$];else Y.const=$}else{if(J.every(($)=>typeof $==="number"))Y.type="number";if(J.every(($)=>typeof $==="string"))Y.type="string";if(J.every(($)=>typeof $==="boolean"))Y.type="boolean";if(J.every(($)=>$===null))Y.type="null";Y.enum=J}};var AG=(Q,X,Y,W)=>{if(X.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var FG=(Q,X,Y,W)=>{if(X.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var LG=(Q,X,Y,W)=>{let G=Y,J=Q._zod.def,{minimum:$,maximum:H}=Q._zod.bag;if(typeof $==="number")G.minItems=$;if(typeof H==="number")G.maxItems=H;G.type="array",G.items=Q0(J.element,X,{...W,path:[...W.path,"items"]})},DG=(Q,X,Y,W)=>{let G=Y,J=Q._zod.def;G.type="object",G.properties={};let $=J.shape;for(let K in $)G.properties[K]=Q0($[K],X,{...W,path:[...W.path,"properties",K]});let H=new Set(Object.keys($)),B=new Set([...H].filter((K)=>{let z=J.shape[K]._zod;if(X.io==="input")return z.optin===void 0;else return z.optout===void 0}));if(B.size>0)G.required=Array.from(B);if(J.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!J.catchall){if(X.io==="output")G.additionalProperties=!1}else if(J.catchall)G.additionalProperties=Q0(J.catchall,X,{...W,path:[...W.path,"additionalProperties"]})},VG=(Q,X,Y,W)=>{let G=Q._zod.def,J=G.inclusive===!1,$=G.options.map((H,B)=>Q0(H,X,{...W,path:[...W.path,J?"oneOf":"anyOf",B]}));if(J)Y.oneOf=$;else Y.anyOf=$},UG=(Q,X,Y,W)=>{let G=Q._zod.def,J=Q0(G.left,X,{...W,path:[...W.path,"allOf",0]}),$=Q0(G.right,X,{...W,path:[...W.path,"allOf",1]}),H=(K)=>("allOf"in K)&&Object.keys(K).length===1,B=[...H(J)?J.allOf:[J],...H($)?$.allOf:[$]];Y.allOf=B};var ZG=(Q,X,Y,W)=>{let G=Y,J=Q._zod.def;G.type="object";let $=J.keyType,B=$._zod.bag?.patterns;if(J.mode==="loose"&&B&&B.size>0){let z=Q0(J.valueType,X,{...W,path:[...W.path,"patternProperties","*"]});G.patternProperties={};for(let F of B)G.patternProperties[F.source]=z}else{if(X.target==="draft-07"||X.target==="draft-2020-12")G.propertyNames=Q0(J.keyType,X,{...W,path:[...W.path,"propertyNames"]});G.additionalProperties=Q0(J.valueType,X,{...W,path:[...W.path,"additionalProperties"]})}let K=$._zod.values;if(K){let z=[...K].filter((F)=>typeof F==="string"||typeof F==="number");if(z.length>0)G.required=z}},qG=(Q,X,Y,W)=>{let G=Q._zod.def,J=Q0(G.innerType,X,W),$=X.seen.get(Q);if(X.target==="openapi-3.0")$.ref=G.innerType,Y.nullable=!0;else Y.anyOf=[J,{type:"null"}]},NG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType},MG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType,Y.default=JSON.parse(JSON.stringify(G.defaultValue))},OG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);if(J.ref=G.innerType,X.io==="input")Y._prefault=JSON.parse(JSON.stringify(G.defaultValue))},wG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType;let $;try{$=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}Y.default=$},PG=(Q,X,Y,W)=>{let G=Q._zod.def,J=G.in._zod.traits.has("$ZodTransform"),$=X.io==="input"?J?G.out:G.in:G.out;Q0($,X,W);let H=X.seen.get(Q);H.ref=$},IG=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType,Y.readOnly=!0};var K4=(Q,X,Y,W)=>{let G=Q._zod.def;Q0(G.innerType,X,W);let J=X.seen.get(Q);J.ref=G.innerType};function LQ(Q){return!!Q._zod}function Q1(Q,X){if(LQ(Q))return X9(Q,X);return Q.safeParse(X)}function DQ(Q){if(!Q)return;let X;if(LQ(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 VQ(Q){if(LQ(Q)){let J=Q._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let Y=Q._def;if(Y){if(Y.value!==void 0)return Y.value;if(Array.isArray(Y.values)&&Y.values.length>0)return Y.values[0]}let W=Q.value;if(W!==void 0)return W;return}var F1={};$X(F1,{time:()=>F4,duration:()=>L4,datetime:()=>z4,date:()=>A4,ZodISOTime:()=>jG,ZodISODuration:()=>TG,ZodISODateTime:()=>EG,ZodISODate:()=>bG});var EG=U("ZodISODateTime",(Q,X)=>{xY.init(Q,X),s.init(Q,X)});function z4(Q){return mW(EG,Q)}var bG=U("ZodISODate",(Q,X)=>{gY.init(Q,X),s.init(Q,X)});function A4(Q){return cW(bG,Q)}var jG=U("ZodISOTime",(Q,X)=>{yY.init(Q,X),s.init(Q,X)});function F4(Q){return pW(jG,Q)}var TG=U("ZodISODuration",(Q,X)=>{hY.init(Q,X),s.init(Q,X)});function L4(Q){return iW(TG,Q)}var fB=(Q,X)=>{e9.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>qX(Q,Y)},flatten:{value:(Y)=>ZX(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}}})};var O0=U("ZodError",fB,{Parent:Error});var RG=QQ(O0),SG=XQ(O0),CG=Q9(O0),kG=Y9(O0),vG=NX(O0),_G=MX(O0),xG=OX(O0),gG=wX(O0),yG=PX(O0),hG=IX(O0),uG=EX(O0),fG=bX(O0);var lG=new WeakMap;function B9(Q,X,Y){let W=Object.getPrototypeOf(Q),G=lG.get(W);if(!G)G=new Set,lG.set(W,G);if(G.has(X))return;G.add(X);for(let J in Y){let $=Y[J];Object.defineProperty(W,J,{configurable:!0,enumerable:!1,get(){let H=$.bind(this);return Object.defineProperty(this,J,{configurable:!0,writable:!0,enumerable:!0,value:H}),H},set(H){Object.defineProperty(this,J,{configurable:!0,writable:!0,enumerable:!0,value:H})}})}}var e=U("ZodType",(Q,X)=>{return o.init(Q,X),Object.assign(Q["~standard"],{jsonSchema:{input:$9(Q,"input"),output:$9(Q,"output")}}),Q.toJSONSchema=YG(Q,{}),Q.def=X,Q.type=X.type,Object.defineProperty(Q,"_def",{value:X}),Q.parse=(Y,W)=>RG(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>CG(Q,Y,W),Q.parseAsync=async(Y,W)=>SG(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>kG(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>vG(Q,Y,W),Q.decode=(Y,W)=>_G(Q,Y,W),Q.encodeAsync=async(Y,W)=>xG(Q,Y,W),Q.decodeAsync=async(Y,W)=>gG(Q,Y,W),Q.safeEncode=(Y,W)=>yG(Q,Y,W),Q.safeDecode=(Y,W)=>hG(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>uG(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>fG(Q,Y,W),B9(Q,"ZodType",{check(...Y){let W=this.def;return this.clone(m.mergeDefs(W,{checks:[...W.checks??[],...Y.map((G)=>typeof G==="function"?{_zod:{check:G,def:{check:"custom"},onattach:[]}}:G)]}),{parent:!0})},with(...Y){return this.check(...Y)},clone(Y,W){return k0(this,Y,W)},brand(){return this},register(Y,W){return Y.add(this,W),this},refine(Y,W){return this.check(SK(Y,W))},superRefine(Y,W){return this.check(CK(Y,W))},overwrite(Y){return this.check(e0(Y))},optional(){return v(this)},exactOptional(){return qK(this)},nullable(){return iG(this)},nullish(){return v(iG(this))},nonoptional(Y){return IK(this,Y)},array(){return P(this)},or(Y){return C([this,Y])},and(Y){return L1(this,Y)},transform(Y){return dG(this,aG(Y))},default(Y){return OK(this,Y)},prefault(Y){return PK(this,Y)},catch(Y){return bK(this,Y)},pipe(Y){return dG(this,Y)},readonly(){return RK(this)},describe(Y){let W=this.clone();return A1.add(W,{description:Y}),W},meta(...Y){if(Y.length===0)return A1.get(this);let W=this.clone();return A1.add(W,Y[0]),W},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(Y){return Y(this)}}),Object.defineProperty(Q,"description",{get(){return A1.get(Q)?.description},configurable:!0}),Q}),nG=U("_ZodString",(Q,X)=>{HQ.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(W,G,J)=>WG(Q,W,G,J);let Y=Q._zod.bag;Q.format=Y.format??null,Q.minLength=Y.minimum??null,Q.maxLength=Y.maximum??null,B9(Q,"_ZodString",{regex(...W){return this.check(o6(...W))},includes(...W){return this.check(s6(...W))},startsWith(...W){return this.check(e6(...W))},endsWith(...W){return this.check(Q4(...W))},min(...W){return this.check(E1(...W))},max(...W){return this.check(AQ(...W))},length(...W){return this.check(FQ(...W))},nonempty(...W){return this.check(E1(1,...W))},lowercase(W){return this.check(t6(W))},uppercase(W){return this.check(a6(W))},trim(){return this.check(Y4())},normalize(...W){return this.check(X4(...W))},toLowerCase(){return this.check(W4())},toUpperCase(){return this.check(G4())},slugify(){return this.check(J4())}})}),mB=U("ZodString",(Q,X)=>{HQ.init(Q,X),nG.init(Q,X),Q.email=(Y)=>Q.check(OW(cB,Y)),Q.url=(Y)=>Q.check(bW(pB,Y)),Q.jwt=(Y)=>Q.check(lW(JK,Y)),Q.emoji=(Y)=>Q.check(jW(iB,Y)),Q.guid=(Y)=>Q.check(r6(mG,Y)),Q.uuid=(Y)=>Q.check(wW(UQ,Y)),Q.uuidv4=(Y)=>Q.check(PW(UQ,Y)),Q.uuidv6=(Y)=>Q.check(IW(UQ,Y)),Q.uuidv7=(Y)=>Q.check(EW(UQ,Y)),Q.nanoid=(Y)=>Q.check(TW(dB,Y)),Q.guid=(Y)=>Q.check(r6(mG,Y)),Q.cuid=(Y)=>Q.check(RW(nB,Y)),Q.cuid2=(Y)=>Q.check(SW(rB,Y)),Q.ulid=(Y)=>Q.check(CW(oB,Y)),Q.base64=(Y)=>Q.check(hW(YK,Y)),Q.base64url=(Y)=>Q.check(uW(WK,Y)),Q.xid=(Y)=>Q.check(kW(tB,Y)),Q.ksuid=(Y)=>Q.check(vW(aB,Y)),Q.ipv4=(Y)=>Q.check(_W(sB,Y)),Q.ipv6=(Y)=>Q.check(xW(eB,Y)),Q.cidrv4=(Y)=>Q.check(gW(QK,Y)),Q.cidrv6=(Y)=>Q.check(yW(XK,Y)),Q.e164=(Y)=>Q.check(fW(GK,Y)),Q.datetime=(Y)=>Q.check(z4(Y)),Q.date=(Y)=>Q.check(A4(Y)),Q.time=(Y)=>Q.check(F4(Y)),Q.duration=(Y)=>Q.check(L4(Y))});function A(Q){return MW(mB,Q)}var s=U("ZodStringFormat",(Q,X)=>{t.init(Q,X),nG.init(Q,X)}),cB=U("ZodEmail",(Q,X)=>{bY.init(Q,X),s.init(Q,X)});var mG=U("ZodGUID",(Q,X)=>{IY.init(Q,X),s.init(Q,X)});var UQ=U("ZodUUID",(Q,X)=>{EY.init(Q,X),s.init(Q,X)});var pB=U("ZodURL",(Q,X)=>{jY.init(Q,X),s.init(Q,X)});var iB=U("ZodEmoji",(Q,X)=>{TY.init(Q,X),s.init(Q,X)});var dB=U("ZodNanoID",(Q,X)=>{RY.init(Q,X),s.init(Q,X)});var nB=U("ZodCUID",(Q,X)=>{SY.init(Q,X),s.init(Q,X)});var rB=U("ZodCUID2",(Q,X)=>{CY.init(Q,X),s.init(Q,X)});var oB=U("ZodULID",(Q,X)=>{kY.init(Q,X),s.init(Q,X)});var tB=U("ZodXID",(Q,X)=>{vY.init(Q,X),s.init(Q,X)});var aB=U("ZodKSUID",(Q,X)=>{_Y.init(Q,X),s.init(Q,X)});var sB=U("ZodIPv4",(Q,X)=>{uY.init(Q,X),s.init(Q,X)});var eB=U("ZodIPv6",(Q,X)=>{fY.init(Q,X),s.init(Q,X)});var QK=U("ZodCIDRv4",(Q,X)=>{lY.init(Q,X),s.init(Q,X)});var XK=U("ZodCIDRv6",(Q,X)=>{mY.init(Q,X),s.init(Q,X)});var YK=U("ZodBase64",(Q,X)=>{pY.init(Q,X),s.init(Q,X)});var WK=U("ZodBase64URL",(Q,X)=>{iY.init(Q,X),s.init(Q,X)});var GK=U("ZodE164",(Q,X)=>{dY.init(Q,X),s.init(Q,X)});var JK=U("ZodJWT",(Q,X)=>{nY.init(Q,X),s.init(Q,X)});var rG=U("ZodNumber",(Q,X)=>{c6.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(W,G,J)=>GG(Q,W,G,J),B9(Q,"ZodNumber",{gt(W,G){return this.check(KQ(W,G))},gte(W,G){return this.check(J9(W,G))},min(W,G){return this.check(J9(W,G))},lt(W,G){return this.check(BQ(W,G))},lte(W,G){return this.check(G9(W,G))},max(W,G){return this.check(G9(W,G))},int(W){return this.check(cG(W))},safe(W){return this.check(cG(W))},positive(W){return this.check(KQ(0,W))},nonnegative(W){return this.check(J9(0,W))},negative(W){return this.check(BQ(0,W))},nonpositive(W){return this.check(G9(0,W))},multipleOf(W,G){return this.check(zQ(W,G))},step(W,G){return this.check(zQ(W,G))},finite(){return this}});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 E(Q){return dW(rG,Q)}var $K=U("ZodNumberFormat",(Q,X)=>{rY.init(Q,X),rG.init(Q,X)});function cG(Q){return nW($K,Q)}var HK=U("ZodBoolean",(Q,X)=>{oY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>JG(Q,Y,W,G)});function u(Q){return rW(HK,Q)}var BK=U("ZodNull",(Q,X)=>{tY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>$G(Q,Y,W,G)});function ZQ(Q){return oW(BK,Q)}var KK=U("ZodUnknown",(Q,X)=>{aY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>BG(Q,Y,W,G)});function x(){return tW(KK)}var zK=U("ZodNever",(Q,X)=>{sY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>HG(Q,Y,W,G)});function AK(Q){return aW(zK,Q)}var FK=U("ZodArray",(Q,X)=>{eY.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>LG(Q,Y,W,G),Q.element=X.element,B9(Q,"ZodArray",{min(Y,W){return this.check(E1(Y,W))},nonempty(Y){return this.check(E1(1,Y))},max(Y,W){return this.check(AQ(Y,W))},length(Y,W){return this.check(FQ(Y,W))},unwrap(){return this.element}})});function P(Q,X){return sW(FK,Q,X)}var oG=U("ZodObject",(Q,X)=>{YW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>DG(Q,Y,W,G),m.defineLazy(Q,"shape",()=>{return X.shape}),B9(Q,"ZodObject",{keyof(){return n(Object.keys(this._zod.def.shape))},catchall(Y){return this.clone({...this._zod.def,catchall:Y})},passthrough(){return this.clone({...this._zod.def,catchall:x()})},loose(){return this.clone({...this._zod.def,catchall:x()})},strict(){return this.clone({...this._zod.def,catchall:AK()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(Y){return m.extend(this,Y)},safeExtend(Y){return m.safeExtend(this,Y)},merge(Y){return m.merge(this,Y)},pick(Y){return m.pick(this,Y)},omit(Y){return m.omit(this,Y)},partial(...Y){return m.partial(sG,this,Y[0])},required(...Y){return m.required(eG,this,Y[0])}})});function V(Q,X){let Y={type:"object",shape:Q??{},...m.normalizeParams(X)};return new oG(Y)}function d(Q,X){return new oG({type:"object",shape:Q,catchall:x(),...m.normalizeParams(X)})}var tG=U("ZodUnion",(Q,X)=>{p6.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>VG(Q,Y,W,G),Q.options=X.options});function C(Q,X){return new tG({type:"union",options:Q,...m.normalizeParams(X)})}var LK=U("ZodDiscriminatedUnion",(Q,X)=>{tG.init(Q,X),WW.init(Q,X)});function b1(Q,X,Y){return new LK({type:"union",options:X,discriminator:Q,...m.normalizeParams(Y)})}var DK=U("ZodIntersection",(Q,X)=>{GW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>UG(Q,Y,W,G)});function L1(Q,X){return new DK({type:"intersection",left:Q,right:X})}var pG=U("ZodRecord",(Q,X)=>{JW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>ZG(Q,Y,W,G),Q.keyType=X.keyType,Q.valueType=X.valueType});function R(Q,X,Y){if(!X||!X._zod)return new pG({type:"record",keyType:A(),valueType:Q,...m.normalizeParams(X)});return new pG({type:"record",keyType:Q,valueType:X,...m.normalizeParams(Y)})}var D4=U("ZodEnum",(Q,X)=>{$W.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(W,G,J)=>KG(Q,W,G,J),Q.enum=X.entries,Q.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));Q.extract=(W,G)=>{let J={};for(let $ of W)if(Y.has($))J[$]=X.entries[$];else throw Error(`Key ${$} not found in enum`);return new D4({...X,checks:[],...m.normalizeParams(G),entries:J})},Q.exclude=(W,G)=>{let J={...X.entries};for(let $ of W)if(Y.has($))delete J[$];else throw Error(`Key ${$} not found in enum`);return new D4({...X,checks:[],...m.normalizeParams(G),entries:J})}});function n(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new D4({type:"enum",entries:Y,...m.normalizeParams(X)})}var VK=U("ZodLiteral",(Q,X)=>{HW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>zG(Q,Y,W,G),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 q(Q,X){return new VK({type:"literal",values:Array.isArray(Q)?Q:[Q],...m.normalizeParams(X)})}var UK=U("ZodTransform",(Q,X)=>{BW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>FG(Q,Y,W,G),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new r1(Q.constructor.name);Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(m.issue(J,Y.value,X));else{let $=J;if($.fatal)$.continue=!1;$.code??($.code="custom"),$.input??($.input=Y.value),$.inst??($.inst=Q),Y.issues.push(m.issue($))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then((J)=>{return Y.value=J,Y.fallback=!0,Y});return Y.value=G,Y.fallback=!0,Y}});function aG(Q){return new UK({type:"transform",transform:Q})}var sG=U("ZodOptional",(Q,X)=>{i6.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>K4(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function v(Q){return new sG({type:"optional",innerType:Q})}var ZK=U("ZodExactOptional",(Q,X)=>{KW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>K4(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function qK(Q){return new ZK({type:"optional",innerType:Q})}var NK=U("ZodNullable",(Q,X)=>{zW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>qG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function iG(Q){return new NK({type:"nullable",innerType:Q})}var MK=U("ZodDefault",(Q,X)=>{AW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>MG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function OK(Q,X){return new MK({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():m.shallowClone(X)}})}var wK=U("ZodPrefault",(Q,X)=>{FW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>OG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function PK(Q,X){return new wK({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():m.shallowClone(X)}})}var eG=U("ZodNonOptional",(Q,X)=>{LW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>NG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function IK(Q,X){return new eG({type:"nonoptional",innerType:Q,...m.normalizeParams(X)})}var EK=U("ZodCatch",(Q,X)=>{DW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>wG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function bK(Q,X){return new EK({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var QJ=U("ZodPipe",(Q,X)=>{d6.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>PG(Q,Y,W,G),Q.in=X.in,Q.out=X.out});function dG(Q,X){return new QJ({type:"pipe",in:Q,out:X})}var jK=U("ZodPreprocess",(Q,X)=>{QJ.init(Q,X),VW.init(Q,X)}),TK=U("ZodReadonly",(Q,X)=>{UW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>IG(Q,Y,W,G),Q.unwrap=()=>Q._zod.def.innerType});function RK(Q){return new TK({type:"readonly",innerType:Q})}var XJ=U("ZodCustom",(Q,X)=>{ZW.init(Q,X),e.init(Q,X),Q._zod.processJSONSchema=(Y,W,G)=>AG(Q,Y,W,G)});function qQ(Q,X){return eW(XJ,Q??(()=>!0),X)}function SK(Q,X={}){return QG(XJ,Q,X)}function CK(Q,X){return XG(Q,X)}function j1(Q,X){return new jK({type:"pipe",in:aG(Q),out:X})}M0(n6());var V4="2025-11-25";var YJ=[V4,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],X1="io.modelcontextprotocol/related-task",MQ="2.0",Y0=qQ((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),WJ=C([A(),E().int()]),GJ=A(),UI=d({ttl:E().optional(),pollInterval:E().optional()}),vK=V({ttl:E().optional()}),_K=V({taskId:A()}),U4=d({progressToken:WJ.optional(),[X1]:_K.optional()}),w0=V({_meta:U4.optional()}),K9=w0.extend({task:vK.optional()}),JJ=(Q)=>K9.safeParse(Q).success,J0=V({method:A(),params:w0.loose().optional()}),b0=V({_meta:U4.optional()}),j0=V({method:A(),params:b0.loose().optional()}),$0=d({_meta:U4.optional()}),OQ=C([A(),E().int()]),$J=V({jsonrpc:q(MQ),id:OQ,...J0.shape}).strict(),Z4=(Q)=>$J.safeParse(Q).success,HJ=V({jsonrpc:q(MQ),...j0.shape}).strict(),BJ=(Q)=>HJ.safeParse(Q).success,q4=V({jsonrpc:q(MQ),id:OQ,result:$0}).strict(),z9=(Q)=>q4.safeParse(Q).success;var f;(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"})(f||(f={}));var N4=V({jsonrpc:q(MQ),id:OQ.optional(),error:V({code:E().int(),message:A(),data:x().optional()})}).strict();var KJ=(Q)=>N4.safeParse(Q).success;var zJ=C([$J,HJ,q4,N4]),ZI=C([q4,N4]),wQ=$0.strict(),xK=b0.extend({requestId:OQ.optional(),reason:A().optional()}),PQ=j0.extend({method:q("notifications/cancelled"),params:xK}),gK=V({src:A(),mimeType:A().optional(),sizes:P(A()).optional(),theme:n(["light","dark"]).optional()}),A9=V({icons:P(gK).optional()}),T1=V({name:A(),title:A().optional()}),AJ=T1.extend({...T1.shape,...A9.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),yK=L1(V({applyDefaults:u().optional()}),R(A(),x())),hK=j1((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},L1(V({form:yK.optional(),url:Y0.optional()}),R(A(),x()).optional())),uK=d({list:Y0.optional(),cancel:Y0.optional(),requests:d({sampling:d({createMessage:Y0.optional()}).optional(),elicitation:d({create:Y0.optional()}).optional()}).optional()}),fK=d({list:Y0.optional(),cancel:Y0.optional(),requests:d({tools:d({call:Y0.optional()}).optional()}).optional()}),lK=V({experimental:R(A(),Y0).optional(),sampling:V({context:Y0.optional(),tools:Y0.optional()}).optional(),elicitation:hK.optional(),roots:V({listChanged:u().optional()}).optional(),tasks:uK.optional(),extensions:R(A(),Y0).optional()}),mK=w0.extend({protocolVersion:A(),capabilities:lK,clientInfo:AJ}),M4=J0.extend({method:q("initialize"),params:mK});var cK=V({experimental:R(A(),Y0).optional(),logging:Y0.optional(),completions:Y0.optional(),prompts:V({listChanged:u().optional()}).optional(),resources:V({subscribe:u().optional(),listChanged:u().optional()}).optional(),tools:V({listChanged:u().optional()}).optional(),tasks:fK.optional(),extensions:R(A(),Y0).optional()}),pK=$0.extend({protocolVersion:A(),capabilities:cK,serverInfo:AJ,instructions:A().optional()}),O4=j0.extend({method:q("notifications/initialized"),params:b0.optional()});var IQ=J0.extend({method:q("ping"),params:w0.optional()}),iK=V({progress:E(),total:v(E()),message:v(A())}),dK=V({...b0.shape,...iK.shape,progressToken:WJ}),EQ=j0.extend({method:q("notifications/progress"),params:dK}),nK=w0.extend({cursor:GJ.optional()}),F9=J0.extend({params:nK.optional()}),L9=$0.extend({nextCursor:GJ.optional()}),rK=n(["working","input_required","completed","failed","cancelled"]),D9=V({taskId:A(),status:rK,ttl:C([E(),ZQ()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:v(E()),statusMessage:v(A())}),R1=$0.extend({task:D9}),oK=b0.merge(D9),V9=j0.extend({method:q("notifications/tasks/status"),params:oK}),bQ=J0.extend({method:q("tasks/get"),params:w0.extend({taskId:A()})}),jQ=$0.merge(D9),TQ=J0.extend({method:q("tasks/result"),params:w0.extend({taskId:A()})}),qI=$0.loose(),RQ=F9.extend({method:q("tasks/list")}),SQ=L9.extend({tasks:P(D9)}),CQ=J0.extend({method:q("tasks/cancel"),params:w0.extend({taskId:A()})}),FJ=$0.merge(D9),LJ=V({uri:A(),mimeType:v(A()),_meta:R(A(),x()).optional()}),DJ=LJ.extend({text:A()}),w4=A().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),VJ=LJ.extend({blob:w4}),U9=n(["user","assistant"]),S1=V({audience:P(U9).optional(),priority:E().min(0).max(1).optional(),lastModified:F1.datetime({offset:!0}).optional()}),UJ=V({...T1.shape,...A9.shape,uri:A(),description:v(A()),mimeType:v(A()),size:v(E()),annotations:S1.optional(),_meta:v(d({}))}),tK=V({...T1.shape,...A9.shape,uriTemplate:A(),description:v(A()),mimeType:v(A()),annotations:S1.optional(),_meta:v(d({}))}),aK=F9.extend({method:q("resources/list")}),sK=L9.extend({resources:P(UJ)}),eK=F9.extend({method:q("resources/templates/list")}),Qz=L9.extend({resourceTemplates:P(tK)}),P4=w0.extend({uri:A()}),Xz=P4,Yz=J0.extend({method:q("resources/read"),params:Xz}),Wz=$0.extend({contents:P(C([DJ,VJ]))}),Gz=j0.extend({method:q("notifications/resources/list_changed"),params:b0.optional()}),Jz=P4,$z=J0.extend({method:q("resources/subscribe"),params:Jz}),Hz=P4,Bz=J0.extend({method:q("resources/unsubscribe"),params:Hz}),Kz=b0.extend({uri:A()}),zz=j0.extend({method:q("notifications/resources/updated"),params:Kz}),Az=V({name:A(),description:v(A()),required:v(u())}),Fz=V({...T1.shape,...A9.shape,description:v(A()),arguments:v(P(Az)),_meta:v(d({}))}),Lz=F9.extend({method:q("prompts/list")}),Dz=L9.extend({prompts:P(Fz)}),Vz=w0.extend({name:A(),arguments:R(A(),A()).optional()}),Uz=J0.extend({method:q("prompts/get"),params:Vz}),I4=V({type:q("text"),text:A(),annotations:S1.optional(),_meta:R(A(),x()).optional()}),E4=V({type:q("image"),data:w4,mimeType:A(),annotations:S1.optional(),_meta:R(A(),x()).optional()}),b4=V({type:q("audio"),data:w4,mimeType:A(),annotations:S1.optional(),_meta:R(A(),x()).optional()}),Zz=V({type:q("tool_use"),name:A(),id:A(),input:R(A(),x()),_meta:R(A(),x()).optional()}),qz=V({type:q("resource"),resource:C([DJ,VJ]),annotations:S1.optional(),_meta:R(A(),x()).optional()}),Nz=UJ.extend({type:q("resource_link")}),j4=C([I4,E4,b4,Nz,qz]),Mz=V({role:U9,content:j4}),Oz=$0.extend({description:A().optional(),messages:P(Mz)}),wz=j0.extend({method:q("notifications/prompts/list_changed"),params:b0.optional()}),Pz=V({title:A().optional(),readOnlyHint:u().optional(),destructiveHint:u().optional(),idempotentHint:u().optional(),openWorldHint:u().optional()}),Iz=V({taskSupport:n(["required","optional","forbidden"]).optional()}),ZJ=V({...T1.shape,...A9.shape,description:A().optional(),inputSchema:V({type:q("object"),properties:R(A(),Y0).optional(),required:P(A()).optional()}).catchall(x()),outputSchema:V({type:q("object"),properties:R(A(),Y0).optional(),required:P(A()).optional()}).catchall(x()).optional(),annotations:Pz.optional(),execution:Iz.optional(),_meta:R(A(),x()).optional()}),Ez=F9.extend({method:q("tools/list")}),bz=L9.extend({tools:P(ZJ)}),kQ=$0.extend({content:P(j4).default([]),structuredContent:R(A(),x()).optional(),isError:u().optional()}),NI=kQ.or($0.extend({toolResult:x()})),jz=K9.extend({name:A(),arguments:R(A(),x()).optional()}),T4=J0.extend({method:q("tools/call"),params:jz}),Tz=j0.extend({method:q("notifications/tools/list_changed"),params:b0.optional()}),MI=V({autoRefresh:u().default(!0),debounceMs:E().int().nonnegative().default(300)}),Z9=n(["debug","info","notice","warning","error","critical","alert","emergency"]),Rz=w0.extend({level:Z9}),R4=J0.extend({method:q("logging/setLevel"),params:Rz}),Sz=b0.extend({level:Z9,logger:A().optional(),data:x()}),Cz=j0.extend({method:q("notifications/message"),params:Sz}),kz=V({name:A().optional()}),vz=V({hints:P(kz).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),_z=V({mode:n(["auto","required","none"]).optional()}),xz=V({type:q("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:P(j4).default([]),structuredContent:V({}).loose().optional(),isError:u().optional(),_meta:R(A(),x()).optional()}),gz=b1("type",[I4,E4,b4]),NQ=b1("type",[I4,E4,b4,Zz,xz]),yz=V({role:U9,content:C([NQ,P(NQ)]),_meta:R(A(),x()).optional()}),hz=K9.extend({messages:P(yz),modelPreferences:vz.optional(),systemPrompt:A().optional(),includeContext:n(["none","thisServer","allServers"]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:P(A()).optional(),metadata:Y0.optional(),tools:P(ZJ).optional(),toolChoice:_z.optional()}),uz=J0.extend({method:q("sampling/createMessage"),params:hz}),q9=$0.extend({model:A(),stopReason:v(n(["endTurn","stopSequence","maxTokens"]).or(A())),role:U9,content:gz}),S4=$0.extend({model:A(),stopReason:v(n(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:U9,content:C([NQ,P(NQ)])}),fz=V({type:q("boolean"),title:A().optional(),description:A().optional(),default:u().optional()}),lz=V({type:q("string"),title:A().optional(),description:A().optional(),minLength:E().optional(),maxLength:E().optional(),format:n(["email","uri","date","date-time"]).optional(),default:A().optional()}),mz=V({type:n(["number","integer"]),title:A().optional(),description:A().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),cz=V({type:q("string"),title:A().optional(),description:A().optional(),enum:P(A()),default:A().optional()}),pz=V({type:q("string"),title:A().optional(),description:A().optional(),oneOf:P(V({const:A(),title:A()})),default:A().optional()}),iz=V({type:q("string"),title:A().optional(),description:A().optional(),enum:P(A()),enumNames:P(A()).optional(),default:A().optional()}),dz=C([cz,pz]),nz=V({type:q("array"),title:A().optional(),description:A().optional(),minItems:E().optional(),maxItems:E().optional(),items:V({type:q("string"),enum:P(A())}),default:P(A()).optional()}),rz=V({type:q("array"),title:A().optional(),description:A().optional(),minItems:E().optional(),maxItems:E().optional(),items:V({anyOf:P(V({const:A(),title:A()}))}),default:P(A()).optional()}),oz=C([nz,rz]),tz=C([iz,dz,oz]),az=C([tz,fz,lz,mz]),sz=K9.extend({mode:q("form").optional(),message:A(),requestedSchema:V({type:q("object"),properties:R(A(),az),required:P(A()).optional()})}),ez=K9.extend({mode:q("url"),message:A(),elicitationId:A(),url:A().url()}),QA=C([sz,ez]),XA=J0.extend({method:q("elicitation/create"),params:QA}),YA=b0.extend({elicitationId:A()}),WA=j0.extend({method:q("notifications/elicitation/complete"),params:YA}),C1=$0.extend({action:n(["accept","decline","cancel"]),content:j1((Q)=>Q===null?void 0:Q,R(A(),C([A(),E(),u(),P(A())])).optional())}),GA=V({type:q("ref/resource"),uri:A()});var JA=V({type:q("ref/prompt"),name:A()}),$A=w0.extend({ref:C([JA,GA]),argument:V({name:A(),value:A()}),context:V({arguments:R(A(),A()).optional()}).optional()}),HA=J0.extend({method:q("completion/complete"),params:$A});var BA=$0.extend({completion:d({values:P(A()).max(100),total:v(E().int()),hasMore:v(u())})}),KA=V({uri:A().startsWith("file://"),name:A().optional(),_meta:R(A(),x()).optional()}),zA=J0.extend({method:q("roots/list"),params:w0.optional()}),C4=$0.extend({roots:P(KA)}),AA=j0.extend({method:q("notifications/roots/list_changed"),params:b0.optional()}),OI=C([IQ,M4,HA,R4,Uz,Lz,aK,eK,Yz,$z,Bz,T4,Ez,bQ,TQ,RQ,CQ]),wI=C([PQ,EQ,O4,AA,V9]),PI=C([wQ,q9,S4,C1,C4,jQ,SQ,R1]),II=C([IQ,uz,XA,zA,bQ,TQ,RQ,CQ]),EI=C([PQ,EQ,Cz,zz,Gz,Tz,wz,V9,WA]),bI=C([wQ,pK,BA,Oz,Dz,sK,Qz,Wz,kQ,bz,jQ,SQ,R1]);class g 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===f.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new qJ(W.elicitations,X)}return new g(Q,X,Y)}}class qJ extends g{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(f.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function Y1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var FA=Symbol("Let zodToJsonSchema decide on which parser to use");var JE=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function k4(Q){let Y=DQ(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=VQ(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function v4(Q,X){let Y=Q1(Q,X);if(!Y.success)throw Y.error;return Y.data}var qA=60000;class _4{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(PQ,(X)=>{this._oncancel(X)}),this.setNotificationHandler(EQ,(X)=>{this._onprogress(X)}),this.setRequestHandler(IQ,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(bQ,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new g(f.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(TQ,async(X,Y)=>{let W=async()=>{let G=X.params.taskId;if(this._taskMessageQueue){let $;while($=await this._taskMessageQueue.dequeue(G,Y.sessionId)){if($.type==="response"||$.type==="error"){let H=$.message,B=H.id,K=this._requestResolvers.get(B);if(K)if(this._requestResolvers.delete(B),$.type==="response")K(H);else{let z=H,F=new g(z.error.code,z.error.message,z.error.data);K(F)}else{let z=$.type==="response"?"Response":"Error";this._onerror(Error(`${z} handler missing for request ${B}`))}continue}await this._transport?.send($.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask(G,Y.sessionId);if(!J)throw new g(f.InvalidParams,`Task not found: ${G}`);if(!Y1(J.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(Y1(J.status)){let $=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...$,_meta:{...$._meta,[X1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(RQ,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 g(f.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(CQ,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new g(f.InvalidParams,`Task not found: ${X.params.taskId}`);if(Y1(W.status))throw new g(f.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 g(f.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof g)throw W;throw new g(f.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),g.fromError(f.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:Y});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout(Q){let X=this._timeoutInfo.get(Q);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete(Q)}async connect(Q){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=Q;let X=this.transport?.onclose;this._transport.onclose=()=>{X?.(),this._onclose()};let Y=this.transport?.onerror;this._transport.onerror=(G)=>{Y?.(G),this._onerror(G)};let W=this._transport?.onmessage;this._transport.onmessage=(G,J)=>{if(W?.(G,J),z9(G)||KJ(G))this._onresponse(G);else if(Z4(G))this._onrequest(G,J);else if(BJ(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();for(let Y of this._timeoutInfo.values())clearTimeout(Y.timeoutId);this._timeoutInfo.clear();for(let Y of this._requestHandlerAbortControllers.values())Y.abort();this._requestHandlerAbortControllers.clear();let X=g.fromError(f.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?.[X1]?.taskId;if(Y===void 0){let K={jsonrpc:"2.0",id:Q.id,error:{code:f.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:K,timestamp:Date.now()},W?.sessionId).catch((z)=>this._onerror(Error(`Failed to enqueue error response: ${z}`)));else W?.send(K).catch((z)=>this._onerror(Error(`Failed to send an error response: ${z}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let $=JJ(Q.params)?Q.params.task:void 0,H=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,B={signal:J.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(K)=>{if(J.signal.aborted)return;let z={relatedRequestId:Q.id};if(G)z.relatedTask={taskId:G};await this.notification(K,z)},sendRequest:async(K,z,F)=>{if(J.signal.aborted)throw new g(f.ConnectionClosed,"Request was cancelled");let L={...F,relatedRequestId:Q.id};if(G&&!L.relatedTask)L.relatedTask={taskId:G};let D=L.relatedTask?.taskId??G;if(D&&H)await H.updateTaskStatus(D,"input_required");return await this.request(K,z,L)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:G,taskStore:H,taskRequestedTtl:$?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if($)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,B)).then(async(K)=>{if(J.signal.aborted)return;let z={result:K,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:z,timestamp:Date.now()},W?.sessionId);else await W?.send(z)},async(K)=>{if(J.signal.aborted)return;let z={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(K.code)?K.code:f.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:z,timestamp:Date.now()},W?.sessionId);else await W?.send(z)}).catch((K)=>this._onerror(Error(`Failed to send response: ${K}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(Q.id)===J)this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:X,...Y}=Q.params,W=Number(X),G=this._progressHandlers.get(W);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(Q)}`));return}let J=this._responseHandlers.get(W),$=this._timeoutInfo.get(W);if($&&J&&$.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(H){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),J(H);return}G(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),z9(Q))Y(Q);else{let J=new g(Q.error.code,Q.error.message,Q.error.data);Y(J)}return}let W=this._responseHandlers.get(X);if(W===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(X),this._cleanupTimeout(X);let G=!1;if(z9(Q)&&Q.result&&typeof Q.result==="object"){let J=Q.result;if(J.task&&typeof J.task==="object"){let $=J.task;if(typeof $.taskId==="string")G=!0,this._taskProgressTokens.set($.taskId,X)}}if(!G)this._progressHandlers.delete(X);if(z9(Q))W(Q);else{let J=g.fromError(Q.error.code,Q.error.message,Q.error.data);W(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(Q,X,Y){let{task:W}=Y??{};if(!W){try{yield{type:"result",result:await this.request(Q,X,Y)}}catch(J){yield{type:"error",error:J instanceof g?J:new g(f.InternalError,String(J))}}return}let G;try{let J=await this.request(Q,R1,Y);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new g(f.InternalError,"Task creation did not return a task");while(!0){let $=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:$},Y1($.status)){if($.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if($.status==="failed")yield{type:"error",error:new g(f.InternalError,`Task ${G} failed`)};else if($.status==="cancelled")yield{type:"error",error:new g(f.InternalError,`Task ${G} was cancelled`)};return}if($.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};return}let H=$.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((B)=>setTimeout(B,H)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof g?J:new g(f.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J,task:$,relatedTask:H}=Y??{};return new Promise((B,K)=>{let z=(O)=>{K(O)};if(!this._transport){z(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),$)this.assertTaskCapability(Q.method)}catch(O){z(O);return}Y?.signal?.throwIfAborted();let F=this._requestMessageId++,L={...Q,jsonrpc:"2.0",id:F};if(Y?.onprogress)this._progressHandlers.set(F,Y.onprogress),L.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:F}};if($)L.params={...L.params,task:$};if(H)L.params={...L.params,_meta:{...L.params?._meta||{},[X1]:H}};let D=(O)=>{this._responseHandlers.delete(F),this._progressHandlers.delete(F),this._cleanupTimeout(F),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:F,reason:String(O)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((j)=>this._onerror(Error(`Failed to send cancellation: ${j}`)));let k=O instanceof g?O:new g(f.RequestTimeout,String(O));K(k)};this._responseHandlers.set(F,(O)=>{if(Y?.signal?.aborted)return;if(O instanceof Error)return K(O);try{let k=Q1(X,O.result);if(!k.success)K(k.error);else B(k.data)}catch(k){K(k)}}),Y?.signal?.addEventListener("abort",()=>{D(Y?.signal?.reason)});let Z=Y?.timeout??qA,N=()=>D(g.fromError(f.RequestTimeout,"Request timed out",{timeout:Z}));this._setupTimeout(F,Z,Y?.maxTotalTimeout,N,Y?.resetTimeoutOnProgress??!1);let M=H?.taskId;if(M){let O=(k)=>{let j=this._responseHandlers.get(F);if(j)j(k);else this._onerror(Error(`Response handler missing for side-channeled request ${F}`))};this._requestResolvers.set(F,O),this._enqueueTaskMessage(M,{type:"request",message:L,timestamp:Date.now()}).catch((k)=>{this._cleanupTimeout(F),K(k)})}else this._transport.send(L,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((O)=>{this._cleanupTimeout(F),K(O)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},jQ,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},SQ,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},FJ,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let $={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[X1]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:$,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId&&!X?.relatedTask){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;let $={...Q,jsonrpc:"2.0"};if(X?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[X1]:X.relatedTask}}};this._transport?.send($,X).catch((H)=>this._onerror(H))});return}let J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[X1]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=k4(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let J=v4(Q,W);return Promise.resolve(X(J,G))})}removeRequestHandler(Q){this._requestHandlers.delete(Q)}assertCanSetRequestHandler(Q){if(this._requestHandlers.has(Q))throw Error(`A request handler for ${Q} already exists, which would be overridden`)}setNotificationHandler(Q,X){let Y=k4(Q);this._notificationHandlers.set(Y,(W)=>{let G=v4(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"&&Z4(W.message)){let G=W.message.id,J=this._requestResolvers.get(G);if(J)J(new g(f.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 g(f.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),G(new g(f.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 g(f.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,J)=>{await Y.storeTaskResult(W,G,J,X);let $=await Y.getTask(W,X);if($){let H=V9.parse({method:"notifications/tasks/status",params:$});if(await this.notification(H),Y1($.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,G,J)=>{let $=await Y.getTask(W,X);if(!$)throw new g(f.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(Y1($.status))throw new g(f.InvalidParams,`Cannot update task "${W}" from terminal status "${$.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(W,G,J,X);let H=await Y.getTask(W,X);if(H){let B=V9.parse({method:"notifications/tasks/status",params:H});if(await this.notification(B),Y1(H.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function NJ(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function MJ(Q,X){let Y={...Q};for(let W in X){let G=W,J=X[G];if(J===void 0)continue;let $=Y[G];if(NJ($)&&NJ(J))Y[G]={...$,...J};else Y[G]=J}return Y}var XH=JX(R8(),1),YH=JX(QH(),1);function mN(){let Q=new XH.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return YH.default(Q),Q}class u8{constructor(Q){this._ajv=Q??mN()}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 f8{constructor(Q){this._server=Q}requestStream(Q,X,Y){return this._server.requestStream(Q,X,Y)}createMessageStream(Q,X){let Y=this._server.getClientCapabilities();if((Q.tools||Q.toolChoice)&&!Y?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(Q.messages.length>0){let W=Q.messages[Q.messages.length-1],G=Array.isArray(W.content)?W.content:[W.content],J=G.some((K)=>K.type==="tool_result"),$=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,H=$?Array.isArray($.content)?$.content:[$.content]:[],B=H.some((K)=>K.type==="tool_use");if(J){if(G.some((K)=>K.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!B)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(B){let K=new Set(H.filter((F)=>F.type==="tool_use").map((F)=>F.id)),z=new Set(G.filter((F)=>F.type==="tool_result").map((F)=>F.toolUseId));if(K.size!==z.size||![...K].every((F)=>z.has(F)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:Q},q9,X)}elicitInputStream(Q,X){let Y=this._server.getClientCapabilities(),W=Q.mode??"form";switch(W){case"url":{if(!Y?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!Y?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let G=W==="form"&&Q.mode===void 0?{...Q,mode:"form"}:Q;return this.requestStream({method:"elicitation/create",params:G},C1,X)}async getTask(Q,X){return this._server.getTask({taskId:Q},X)}async getTaskResult(Q,X,Y){return this._server.getTaskResult({taskId:Q},X,Y)}async listTasks(Q,X){return this._server.listTasks(Q?{cursor:Q}:void 0,X)}async cancelTask(Q,X){return this._server.cancelTask({taskId:Q},X)}}function WH(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 GH(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 l8 extends _4{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Z9.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 u8,this.setRequestHandler(M4,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(O4,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(R4,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,$=Z9.safeParse(J);if($.success)this._loggingLevels.set(G,$.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new f8(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=MJ(this._capabilities,Q)}setRequestHandler(Q,X){let W=DQ(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G=VQ(W);if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let $=async(H,B)=>{let K=Q1(T4,H);if(!K.success){let D=K.error instanceof Error?K.error.message:String(K.error);throw new g(f.InvalidParams,`Invalid tools/call request: ${D}`)}let{params:z}=K.data,F=await Promise.resolve(X(H,B));if(z.task){let D=Q1(R1,F);if(!D.success){let Z=D.error instanceof Error?D.error.message:String(D.error);throw new g(f.InvalidParams,`Invalid task creation result: ${Z}`)}return D.data}let L=Q1(kQ,F);if(!L.success){let D=L.error instanceof Error?L.error.message:String(L.error);throw new g(f.InvalidParams,`Invalid tools/call result: ${D}`)}return L.data};return super.setRequestHandler(Q,$)}return super.setRequestHandler(Q,X)}assertCapabilityForMethod(Q){switch(Q){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${Q})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${Q})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${Q})`);break;case"ping":break}}assertNotificationCapability(Q){switch(Q){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${Q})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${Q})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${Q})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${Q})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(Q){if(!this._capabilities)return;switch(Q){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${Q})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${Q})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${Q})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${Q})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${Q})`);break;case"ping":case"initialize":break}}assertTaskCapability(Q){GH(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;WH(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:YJ.includes(X)?X:V4,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"},wQ)}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((B)=>B.type==="tool_result"),J=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,$=J?Array.isArray(J.content)?J.content:[J.content]:[],H=$.some((B)=>B.type==="tool_use");if(G){if(W.some((B)=>B.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!H)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(H){let B=new Set($.filter((z)=>z.type==="tool_use").map((z)=>z.id)),K=new Set(W.filter((z)=>z.type==="tool_result").map((z)=>z.toolUseId));if(B.size!==K.size||![...B].every((z)=>K.has(z)))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},S4,X);return this.request({method:"sampling/createMessage",params:Q},q9,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},C1,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},C1,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let $=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!$.valid)throw new g(f.InvalidParams,`Elicitation response content does not match requested schema: ${$.errorMessage}`)}catch(J){if(J instanceof g)throw J;throw new g(f.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return G}}}createElicitationCompletionNotifier(Q,X){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:Q}},X)}async listRoots(Q,X){return this.request({method:"roots/list",params:Q},C4,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 $H from"node:process";var cN=10485760;class m8{constructor(Q){this._maxBufferSize=Q?.maxBufferSize??cN}append(Q){if((this._buffer?.length??0)+Q.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
|
|
74
|
+
`);if(Q===-1)return null;let X=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),pN(X)}clear(){this._buffer=void 0}}function pN(Q){return zJ.parse(JSON.parse(Q))}function JH(Q){return JSON.stringify(Q)+`
|
|
75
|
+
`}class c8{constructor(Q=$H.stdin,X=$H.stdout,Y){this._stdin=Q,this._stdout=X,this._started=!1,this._ondata=(W)=>{try{this._readBuffer.append(W),this.processReadBuffer()}catch(G){this.onerror?.(G),this.close().catch(()=>{})}},this._onerror=(W)=>{this.onerror?.(W)},this._readBuffer=new m8({maxBufferSize:Y?.maxBufferSize})}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let 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=JH(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var iN="io.modelcontextprotocol/related-task",q6="2.0",W0=qQ((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),BH=C([A(),E().int()]),KH=A(),$S=d({ttl:E().optional(),pollInterval:E().optional()}),dN=V({ttl:E().optional()}),nN=V({taskId:A()}),p8=d({progressToken:BH.optional(),[iN]:nN.optional()}),P0=V({_meta:p8.optional()}),N6=P0.extend({task:dN.optional()});var K0=V({method:A(),params:P0.loose().optional()}),S0=V({_meta:p8.optional()}),C0=V({method:A(),params:S0.loose().optional()}),z0=d({_meta:p8.optional()}),M6=C([A(),E().int()]),rN=V({jsonrpc:q(q6),id:M6,...K0.shape}).strict();var oN=V({jsonrpc:q(q6),...C0.shape}).strict();var zH=V({jsonrpc:q(q6),id:M6,result:z0}).strict();var HH;(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"})(HH||(HH={}));var AH=V({jsonrpc:q(q6),id:M6.optional(),error:V({code:E().int(),message:A(),data:x().optional()})}).strict();var HS=C([rN,oN,zH,AH]),BS=C([zH,AH]),FH=z0.strict(),tN=S0.extend({requestId:M6.optional(),reason:A().optional()}),LH=C0.extend({method:q("notifications/cancelled"),params:tN}),aN=V({src:A(),mimeType:A().optional(),sizes:P(A()).optional(),theme:n(["light","dark"]).optional()}),c9=V({icons:P(aN).optional()}),p1=V({name:A(),title:A().optional()}),DH=p1.extend({...p1.shape,...c9.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),sN=L1(V({applyDefaults:u().optional()}),R(A(),x())),eN=j1((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},L1(V({form:sN.optional(),url:W0.optional()}),R(A(),x()).optional())),QM=d({list:W0.optional(),cancel:W0.optional(),requests:d({sampling:d({createMessage:W0.optional()}).optional(),elicitation:d({create:W0.optional()}).optional()}).optional()}),XM=d({list:W0.optional(),cancel:W0.optional(),requests:d({tools:d({call:W0.optional()}).optional()}).optional()}),YM=V({experimental:R(A(),W0).optional(),sampling:V({context:W0.optional(),tools:W0.optional()}).optional(),elicitation:eN.optional(),roots:V({listChanged:u().optional()}).optional(),tasks:QM.optional(),extensions:R(A(),W0).optional()}),WM=P0.extend({protocolVersion:A(),capabilities:YM,clientInfo:DH}),GM=K0.extend({method:q("initialize"),params:WM});var JM=V({experimental:R(A(),W0).optional(),logging:W0.optional(),completions:W0.optional(),prompts:V({listChanged:u().optional()}).optional(),resources:V({subscribe:u().optional(),listChanged:u().optional()}).optional(),tools:V({listChanged:u().optional()}).optional(),tasks:XM.optional(),extensions:R(A(),W0).optional()}),$M=z0.extend({protocolVersion:A(),capabilities:JM,serverInfo:DH,instructions:A().optional()}),HM=C0.extend({method:q("notifications/initialized"),params:S0.optional()});var VH=K0.extend({method:q("ping"),params:P0.optional()}),BM=V({progress:E(),total:v(E()),message:v(A())}),KM=V({...S0.shape,...BM.shape,progressToken:BH}),UH=C0.extend({method:q("notifications/progress"),params:KM}),zM=P0.extend({cursor:KH.optional()}),p9=K0.extend({params:zM.optional()}),i9=z0.extend({nextCursor:KH.optional()}),AM=n(["working","input_required","completed","failed","cancelled"]),d9=V({taskId:A(),status:AM,ttl:C([E(),ZQ()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:v(E()),statusMessage:v(A())}),ZH=z0.extend({task:d9}),FM=S0.merge(d9),qH=C0.extend({method:q("notifications/tasks/status"),params:FM}),NH=K0.extend({method:q("tasks/get"),params:P0.extend({taskId:A()})}),MH=z0.merge(d9),OH=K0.extend({method:q("tasks/result"),params:P0.extend({taskId:A()})}),KS=z0.loose(),wH=p9.extend({method:q("tasks/list")}),PH=i9.extend({tasks:P(d9)}),IH=K0.extend({method:q("tasks/cancel"),params:P0.extend({taskId:A()})}),zS=z0.merge(d9),EH=V({uri:A(),mimeType:v(A()),_meta:R(A(),x()).optional()}),bH=EH.extend({text:A()}),i8=A().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),jH=EH.extend({blob:i8}),n9=n(["user","assistant"]),i1=V({audience:P(n9).optional(),priority:E().min(0).max(1).optional(),lastModified:F1.datetime({offset:!0}).optional()}),TH=V({...p1.shape,...c9.shape,uri:A(),description:v(A()),mimeType:v(A()),size:v(E()),annotations:i1.optional(),_meta:v(d({}))}),LM=V({...p1.shape,...c9.shape,uriTemplate:A(),description:v(A()),mimeType:v(A()),annotations:i1.optional(),_meta:v(d({}))}),DM=p9.extend({method:q("resources/list")}),VM=i9.extend({resources:P(TH)}),UM=p9.extend({method:q("resources/templates/list")}),ZM=i9.extend({resourceTemplates:P(LM)}),d8=P0.extend({uri:A()}),qM=d8,NM=K0.extend({method:q("resources/read"),params:qM}),MM=z0.extend({contents:P(C([bH,jH]))}),OM=C0.extend({method:q("notifications/resources/list_changed"),params:S0.optional()}),wM=d8,PM=K0.extend({method:q("resources/subscribe"),params:wM}),IM=d8,EM=K0.extend({method:q("resources/unsubscribe"),params:IM}),bM=S0.extend({uri:A()}),jM=C0.extend({method:q("notifications/resources/updated"),params:bM}),TM=V({name:A(),description:v(A()),required:v(u())}),RM=V({...p1.shape,...c9.shape,description:v(A()),arguments:v(P(TM)),_meta:v(d({}))}),SM=p9.extend({method:q("prompts/list")}),CM=i9.extend({prompts:P(RM)}),kM=P0.extend({name:A(),arguments:R(A(),A()).optional()}),vM=K0.extend({method:q("prompts/get"),params:kM}),n8=V({type:q("text"),text:A(),annotations:i1.optional(),_meta:R(A(),x()).optional()}),r8=V({type:q("image"),data:i8,mimeType:A(),annotations:i1.optional(),_meta:R(A(),x()).optional()}),o8=V({type:q("audio"),data:i8,mimeType:A(),annotations:i1.optional(),_meta:R(A(),x()).optional()}),_M=V({type:q("tool_use"),name:A(),id:A(),input:R(A(),x()),_meta:R(A(),x()).optional()}),xM=V({type:q("resource"),resource:C([bH,jH]),annotations:i1.optional(),_meta:R(A(),x()).optional()}),gM=TH.extend({type:q("resource_link")}),t8=C([n8,r8,o8,gM,xM]),yM=V({role:n9,content:t8}),hM=z0.extend({description:A().optional(),messages:P(yM)}),uM=C0.extend({method:q("notifications/prompts/list_changed"),params:S0.optional()}),fM=V({title:A().optional(),readOnlyHint:u().optional(),destructiveHint:u().optional(),idempotentHint:u().optional(),openWorldHint:u().optional()}),lM=V({taskSupport:n(["required","optional","forbidden"]).optional()}),RH=V({...p1.shape,...c9.shape,description:A().optional(),inputSchema:V({type:q("object"),properties:R(A(),W0).optional(),required:P(A()).optional()}).catchall(x()),outputSchema:V({type:q("object"),properties:R(A(),W0).optional(),required:P(A()).optional()}).catchall(x()).optional(),annotations:fM.optional(),execution:lM.optional(),_meta:R(A(),x()).optional()}),a8=p9.extend({method:q("tools/list")}),mM=i9.extend({tools:P(RH)}),SH=z0.extend({content:P(t8).default([]),structuredContent:R(A(),x()).optional(),isError:u().optional()}),AS=SH.or(z0.extend({toolResult:x()})),cM=N6.extend({name:A(),arguments:R(A(),x()).optional()}),s8=K0.extend({method:q("tools/call"),params:cM}),pM=C0.extend({method:q("notifications/tools/list_changed"),params:S0.optional()}),FS=V({autoRefresh:u().default(!0),debounceMs:E().int().nonnegative().default(300)}),CH=n(["debug","info","notice","warning","error","critical","alert","emergency"]),iM=P0.extend({level:CH}),dM=K0.extend({method:q("logging/setLevel"),params:iM}),nM=S0.extend({level:CH,logger:A().optional(),data:x()}),rM=C0.extend({method:q("notifications/message"),params:nM}),oM=V({name:A().optional()}),tM=V({hints:P(oM).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),aM=V({mode:n(["auto","required","none"]).optional()}),sM=V({type:q("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:P(t8).default([]),structuredContent:V({}).loose().optional(),isError:u().optional(),_meta:R(A(),x()).optional()}),eM=b1("type",[n8,r8,o8]),Z6=b1("type",[n8,r8,o8,_M,sM]),QO=V({role:n9,content:C([Z6,P(Z6)]),_meta:R(A(),x()).optional()}),XO=N6.extend({messages:P(QO),modelPreferences:tM.optional(),systemPrompt:A().optional(),includeContext:n(["none","thisServer","allServers"]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:P(A()).optional(),metadata:W0.optional(),tools:P(RH).optional(),toolChoice:aM.optional()}),YO=K0.extend({method:q("sampling/createMessage"),params:XO}),WO=z0.extend({model:A(),stopReason:v(n(["endTurn","stopSequence","maxTokens"]).or(A())),role:n9,content:eM}),GO=z0.extend({model:A(),stopReason:v(n(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:n9,content:C([Z6,P(Z6)])}),JO=V({type:q("boolean"),title:A().optional(),description:A().optional(),default:u().optional()}),$O=V({type:q("string"),title:A().optional(),description:A().optional(),minLength:E().optional(),maxLength:E().optional(),format:n(["email","uri","date","date-time"]).optional(),default:A().optional()}),HO=V({type:n(["number","integer"]),title:A().optional(),description:A().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),BO=V({type:q("string"),title:A().optional(),description:A().optional(),enum:P(A()),default:A().optional()}),KO=V({type:q("string"),title:A().optional(),description:A().optional(),oneOf:P(V({const:A(),title:A()})),default:A().optional()}),zO=V({type:q("string"),title:A().optional(),description:A().optional(),enum:P(A()),enumNames:P(A()).optional(),default:A().optional()}),AO=C([BO,KO]),FO=V({type:q("array"),title:A().optional(),description:A().optional(),minItems:E().optional(),maxItems:E().optional(),items:V({type:q("string"),enum:P(A())}),default:P(A()).optional()}),LO=V({type:q("array"),title:A().optional(),description:A().optional(),minItems:E().optional(),maxItems:E().optional(),items:V({anyOf:P(V({const:A(),title:A()}))}),default:P(A()).optional()}),DO=C([FO,LO]),VO=C([zO,AO,DO]),UO=C([VO,JO,$O,HO]),ZO=N6.extend({mode:q("form").optional(),message:A(),requestedSchema:V({type:q("object"),properties:R(A(),UO),required:P(A()).optional()})}),qO=N6.extend({mode:q("url"),message:A(),elicitationId:A(),url:A().url()}),NO=C([ZO,qO]),MO=K0.extend({method:q("elicitation/create"),params:NO}),OO=S0.extend({elicitationId:A()}),wO=C0.extend({method:q("notifications/elicitation/complete"),params:OO}),PO=z0.extend({action:n(["accept","decline","cancel"]),content:j1((Q)=>Q===null?void 0:Q,R(A(),C([A(),E(),u(),P(A())])).optional())}),IO=V({type:q("ref/resource"),uri:A()});var EO=V({type:q("ref/prompt"),name:A()}),bO=P0.extend({ref:C([EO,IO]),argument:V({name:A(),value:A()}),context:V({arguments:R(A(),A()).optional()}).optional()}),jO=K0.extend({method:q("completion/complete"),params:bO});var TO=z0.extend({completion:d({values:P(A()).max(100),total:v(E().int()),hasMore:v(u())})}),RO=V({uri:A().startsWith("file://"),name:A().optional(),_meta:R(A(),x()).optional()}),SO=K0.extend({method:q("roots/list"),params:P0.optional()}),CO=z0.extend({roots:P(RO)}),kO=C0.extend({method:q("notifications/roots/list_changed"),params:S0.optional()}),LS=C([VH,GM,jO,dM,vM,SM,DM,UM,NM,PM,EM,s8,a8,NH,OH,wH,IH]),DS=C([LH,UH,HM,kO,qH]),VS=C([FH,WO,GO,PO,CO,MH,PH,ZH]),US=C([VH,YO,MO,SO,NH,OH,wH,IH]),ZS=C([LH,UH,rM,jM,OM,pM,uM,qH,wO]),qS=C([FH,$M,TO,hM,CM,VM,ZM,MM,SH,mM,MH,PH,ZH]);function kH(Q){let X=(Q.COMMHUB_URL||"").replace(/\/+$/,""),Y=Q.COMMHUB_TOKEN||Q.AUTH_TOKEN||"",W=[];if(!X)W.push("COMMHUB_URL");if(!Y)W.push("COMMHUB_TOKEN(或兼容名 AUTH_TOKEN)");if(W.length)return{ok:!1,missing:W};return{ok:!0,hub:X,token:Y}}import{closeSync as vO,constants as r9,existsSync as _O,fstatSync as xO,openSync as gO,readSync as vH,realpathSync as w6,readlinkSync as yO}from"node:fs";import{basename as hO,isAbsolute as uO,join as O6,relative as xH,sep as e8}from"node:path";import{homedir as fO}from"node:os";var gH=12582912,lO=65536;function mO(Q){let X=Q.toLowerCase().split(".").pop()??"";return{png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",bmp:"image/bmp",svg:"image/svg+xml",pdf:"application/pdf",txt:"text/plain",json:"application/json",md:"text/markdown",mp4:"video/mp4",webm:"video/webm"}[X]??"application/octet-stream"}function _H(Q,X="upload.bin"){return((Q&&typeof Q==="string"?Q:X).split(/[\\/]/).pop()||X).replace(/[\u0000-\u001f\u007f]/g,"_").replace(/^\.+/,"").slice(0,255)||X}function XX(Q={}){let X=Q.home??fO(),Y=Q.env??process.env,W=[],G=Q.alias?.trim();if(G)W.push(O6(X,".anet","cache","attachments",G));if(W.push(O6(X,".anet","cache","attachments")),Q.nodeDir)W.push(Q.nodeDir);if(W.push(O6(X,".grok","sessions")),W.push(O6(X,".grok","images")),W.push("/work/feishu-attachments"),Y.ANET_FEISHU_MEDIA_DIR?.trim())W.push(Y.ANET_FEISHU_MEDIA_DIR.trim());if(Y.ANET_UPLOAD_ROOTS?.trim())for(let $ of Y.ANET_UPLOAD_ROOTS.split(":")){let H=$.trim();if(H)W.push(H)}let J=Q.cwd??process.cwd();try{let $=w6(J),H=w6(X),B=xH(H,$);if(B===".anet"||B.startsWith(`.anet${e8}`)||B===".grok"||B.startsWith(`.grok${e8}`))W.push($)}catch{}return W}function QX(Q,X){for(let Y of X){if(!Y)continue;try{if(!_O(Y))continue;let W=w6(Y),G=xH(W,Q);if(G!==""&&G!==".."&&!G.startsWith(`..${e8}`)&&!uO(G))return!0}catch{}}return!1}function cO(Q,X){if(!Q||typeof Q!=="string"||!Q.trim())return{ok:!1,error:"path_required",message:"path is required"};if(Q.includes("\x00"))return{ok:!1,error:"path_nul",message:"path must not contain NUL bytes"};let Y=Q.trim();if(!Y)return{ok:!1,error:"path_required",message:"path is required"};let W;try{W=w6(Y)}catch{return{ok:!1,error:"path_not_found",message:"path does not exist or cannot be realpath'd"}}if(!QX(W,X))return{ok:!1,error:"path_untrusted",message:"path is outside this node's controlled upload roots (generated assets / attachment cache only)"};return{ok:!0,canonicalPath:W}}function pO(Q,X,Y=gH){if(!QX(Q,X))return{ok:!1,error:"path_untrusted",message:"path is outside this node's controlled upload roots"};let W=r9.O_RDONLY|(typeof r9.O_NOFOLLOW==="number"?r9.O_NOFOLLOW:0)|(typeof r9.O_CLOEXEC==="number"?r9.O_CLOEXEC:0),G;try{G=gO(Q,W)}catch(J){let $=J?.message??String(J);if(J?.code==="ELOOP"||/symlink|ELOOP/i.test($))return{ok:!1,error:"path_symlink",message:"symlink paths are not allowed for upload"};return{ok:!1,error:"path_not_found",message:$}}try{try{let K=yO(`/proc/self/fd/${G}`);if(K&&!QX(K,X))return{ok:!1,error:"path_untrusted",message:"opened fd resolved outside controlled roots"}}catch{}let J=xO(G);if(J.isSymbolicLink?.()===!0)return{ok:!1,error:"path_symlink",message:"symlink fd rejected"};if(!J.isFile())return{ok:!1,error:"path_not_regular",message:"path is not a regular file"};if(J.size<=0)return{ok:!1,error:"path_empty",message:"file is empty"};if(J.size>Y)return{ok:!1,error:"payload_too_large",message:`file exceeds ${Y} byte limit (observed ${J.size})`};let $=[],H=0,B=Buffer.alloc(Math.min(lO,Y));while(H<Y){let K=Math.min(B.length,Y-H),z;try{z=vH(G,B,0,K,H)}catch(F){return{ok:!1,error:"read_failed",message:F?.message??"read failed"}}if(z===0)break;if($.push(Buffer.from(B.subarray(0,z))),H+=z,H>Y)return{ok:!1,error:"payload_too_large",message:`file exceeds ${Y} byte limit during read`}}if(H>=Y){let K=Buffer.alloc(1),z=0;try{z=vH(G,K,0,1,H)}catch{z=0}if(z>0)return{ok:!1,error:"payload_too_large",message:`file exceeds ${Y} byte limit (extra bytes after cap)`}}if(H<=0)return{ok:!1,error:"path_empty",message:"file is empty"};return{ok:!0,bytes:Buffer.concat($,H),size:H,canonicalPath:Q}}finally{try{vO(G)}catch{}}}async function yH(Q,X,Y={}){if(!X.hubUrl?.trim())return{ok:!1,error:"hub_url_required",message:"hubUrl is required"};if(!X.authToken?.trim())return{ok:!1,error:"auth_required",message:"auth token is required (token-bound node)"};let W=X.allowedRoots??XX({home:X.home,alias:X.alias,nodeDir:X.nodeDir}),G=cO(Q,W);if(!G.ok)return G;let J=pO(G.canonicalPath,W,gH);if(!J.ok)return J;let $=_H(Y.name??hO(J.canonicalPath)),H=Y.mime&&Y.mime.slice(0,100)||mO($),B=new FormData;B.append("file",new Blob([new Uint8Array(J.bytes)],{type:H}),$);let K=`${X.hubUrl.replace(/\/+$/,"")}/api/upload`,z=X.fetch??fetch,F;try{F=await z(K,{method:"POST",headers:{Authorization:`Bearer ${X.authToken}`},body:B})}catch(Z){return{ok:!1,error:"upload_failed",message:Z?.message??"network error"}}let L;try{L=await F.json()}catch{return{ok:!1,error:"bad_response",message:`hub returned non-JSON (HTTP ${F.status})`}}if(!F.ok)return{ok:!1,error:"upload_failed",message:L?.message||L?.error||`HTTP ${F.status}`};let D=L?.file_id??L?.fileId;if(typeof D!=="string"||!/^[A-Za-z0-9_-]{8,64}$/.test(D))return{ok:!1,error:"missing_file_id",message:"hub response missing valid file_id"};return{ok:!0,file_id:D,name:typeof L?.name==="string"&&L.name?_H(L.name,$):$,mime:typeof L?.mime==="string"&&L.mime?L.mime.slice(0,100):H,size:typeof L?.size==="number"?L.size:J.size,url:typeof L?.url==="string"?L.url:`/api/files/${D}`}}var P6=kH(process.env);if(!P6.ok)console.error(`[upload-file-mcp] \u7F3A\u5C11\u5FC5\u586B\u73AF\u5883\u53D8\u91CF\uFF1A${P6.missing.join(", ")}`),console.error("[upload-file-mcp] \u62D2\u7EDD\u542F\u52A8\uFF1A\u628A\u5DE5\u5177\u5217\u51FA\u6765\u518D\u5728\u7B2C\u4E00\u6B21\u8C03\u7528\u65F6\u5931\u8D25\uFF0C\u7B49\u4E8E\u628A\u914D\u7F6E\u9519\u8BEF\u7559\u7ED9\u8FD0\u884C\u671F"),process.exit(2);var{hub:iO,token:dO}=P6,hH=process.env.ANET_UPLOAD_ALIAS||process.env.COMMHUB_ALIAS||"",uH=process.env.ANET_NODE_DIR||"",YX=new l8({name:"commhub-upload",version:"0.1.0"},{capabilities:{tools:{}}});YX.setRequestHandler(a8,async()=>({tools:[{name:"upload_file",description:"Upload a controlled local file (generated image/attachment under this node's allowlisted dirs) to CommHub. Returns {file_id,name,mime,size} for send_reply attachments. Rejects arbitrary paths, traversal, and symlinks. Max 12 MiB. Cross-host safe: bytes stream to Hub; do not pass raw paths into send_reply.",inputSchema:{type:"object",properties:{path:{type:"string",description:"Absolute or relative path to a file under this node's controlled roots (e.g. Grok images/, .anet cache attachments)"},name:{type:"string",description:"Optional display filename (basename only)"},mime:{type:"string",description:"Optional MIME type hint"}},required:["path"]}}]}));YX.setRequestHandler(s8,async(Q)=>{if(Q.params.name!=="upload_file")return{content:[{type:"text",text:JSON.stringify({ok:!1,error:"unknown_tool"})}],isError:!0};let Y=Q.params.arguments||{},W=await yH(String(Y.path||""),{hubUrl:iO,authToken:dO,alias:hH||void 0,nodeDir:uH||void 0,allowedRoots:XX({alias:hH||void 0,nodeDir:uH||void 0})},{name:Y.name,mime:Y.mime});return{content:[{type:"text",text:JSON.stringify(W)}],isError:!W.ok}});var nO=new c8;await YX.connect(nO);
|