nagoc-zerowork 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +256 -282
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var ih=Object.create;var Zn=Object.defineProperty;var ah=Object.getOwnPropertyDescriptor;var ch=Object.getOwnPropertyNames;var uh=Object.getPrototypeOf,lh=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ba=(t,e)=>{for(var r in e)Zn(t,r,{get:e[r],enumerable:!0})},dh=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ch(e))!lh.call(t,n)&&n!==r&&Zn(t,n,{get:()=>e[n],enumerable:!(o=ah(e,n))||o.enumerable});return t};var Ja=(t,e,r)=>(r=t!=null?ih(uh(t)):{},dh(e||!t||!t.__esModule?Zn(r,"default",{value:t,enumerable:!0}):r,t));var jr=v(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.regexpCode=L.getEsmExportName=L.getProperty=L.safeStringify=L.stringify=L.strConcat=L.addCodeArg=L.str=L._=L.nil=L._Code=L.Name=L.IDENTIFIER=L._CodeOrName=void 0;var Ar=class{};L._CodeOrName=Ar;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var vt=class extends Ar{constructor(e){if(super(),!L.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};L.Name=vt;var Oe=class extends Ar{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof vt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};L._Code=Oe;L.nil=new Oe("");function cp(t,...e){let r=[t[0]],o=0;for(;o<e.length;)Ys(r,e[o]),r.push(t[++o]);return new Oe(r)}L._=cp;var Ks=new Oe("+");function up(t,...e){let r=[Zr(t[0])],o=0;for(;o<e.length;)r.push(Ks),Ys(r,e[o]),r.push(Ks,Zr(t[++o]));return R_(r),new Oe(r)}L.str=up;function Ys(t,e){e instanceof Oe?t.push(...e._items):e instanceof vt?t.push(e):t.push(N_(e))}L.addCodeArg=Ys;function R_(t){let e=1;for(;e<t.length-1;){if(t[e]===Ks){let r=I_(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function I_(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof vt||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof vt))return`"${t}${e.slice(1)}`}function O_(t,e){return e.emptyStr()?t:t.emptyStr()?e:up`${t}${e}`}L.strConcat=O_;function N_(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Zr(Array.isArray(t)?t.join(","):t)}function C_(t){return new Oe(Zr(t))}L.stringify=C_;function Zr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=Zr;function A_(t){return typeof t=="string"&&L.IDENTIFIER.test(t)?new Oe(`.${t}`):cp`[${t}]`}L.getProperty=A_;function Z_(t){if(typeof t=="string"&&L.IDENTIFIER.test(t))return new Oe(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}L.getEsmExportName=Z_;function j_(t){return new Oe(t.toString())}L.regexpCode=j_});var ei=v(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.ValueScope=we.ValueScopeName=we.Scope=we.varKinds=we.UsedValueState=void 0;var ve=jr(),Qs=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Ho;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Ho||(we.UsedValueState=Ho={}));we.varKinds={const:new ve.Name("const"),let:new ve.Name("let"),var:new ve.Name("var")};var Go=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ve.Name?e:this.name(e)}name(e){return new ve.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};we.Scope=Go;var Ko=class extends ve.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ve._)`.${new ve.Name(r)}[${o}]`}};we.ValueScopeName=Ko;var D_=(0,ve._)`\n`,Xs=class extends Go{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?D_:ve.nil}}get(){return this._scope}name(e){return new Ko(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ve._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ve.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Ho.Started);let l=r(u);if(l){let d=this.opts.es5?we.varKinds.var:we.varKinds.const;s=(0,ve._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ve._)`${s}${l}${this.opts._n}`;else throw new Qs(u);c.set(u,Ho.Completed)})}return s}};we.ValueScope=Xs});var O=v(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var j=jr(),De=ei(),lt=jr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return lt._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return lt.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return lt.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return lt.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return lt.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return lt.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return lt.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return lt.Name}});var en=ei();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return en.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return en.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return en.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return en.varKinds}});N.operators={GT:new j._Code(">"),GTE:new j._Code(">="),LT:new j._Code("<"),LTE:new j._Code("<="),EQ:new j._Code("==="),NEQ:new j._Code("!=="),NOT:new j._Code("!"),OR:new j._Code("||"),AND:new j._Code("&&"),ADD:new j._Code("+")};var Xe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ti=class extends Xe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?De.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Ft(this.rhs,e,r)),this}get names(){return this.rhs instanceof j._CodeOrName?this.rhs.names:{}}},Yo=class extends Xe{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof j.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Ft(this.rhs,e,r),this}get names(){let e=this.lhs instanceof j.Name?{}:{...this.lhs.names};return Xo(e,this.rhs)}},ri=class extends Yo{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},oi=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ni=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},si=class extends Xe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},ii=class extends Xe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Ft(this.code,e,r),this}get names(){return this.code instanceof j._CodeOrName?this.code.names:{}}},Dr=class extends Xe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(M_(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>xt(e,r.names),{})}},et=class extends Dr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},ai=class extends Dr{},Ut=class extends et{};Ut.kind="else";var wt=class t extends et{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Ut(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(lp(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Ft(this.condition,e,r),this}get names(){let e=super.names;return Xo(e,this.condition),this.else&&xt(e,this.else.names),e}};wt.kind="if";var $t=class extends et{};$t.kind="for";var ci=class extends $t{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Ft(this.iteration,e,r),this}get names(){return xt(super.names,this.iteration.names)}},ui=class extends $t{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?De.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=Xo(super.names,this.from);return Xo(e,this.to)}},Qo=class extends $t{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Ft(this.iterable,e,r),this}get names(){return xt(super.names,this.iterable.names)}},Mr=class extends et{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Mr.kind="func";var qr=class extends Dr{render(e){return"return "+super.render(e)}};qr.kind="return";var li=class extends et{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&xt(e,this.catch.names),this.finally&&xt(e,this.finally.names),e}},Lr=class extends et{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Lr.kind="catch";var Ur=class extends et{render(e){return"finally"+super.render(e)}};Ur.kind="finally";var di=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
-
`:""},this._extScope=e,this._scope=new De.Scope({parent:e}),this._nodes=[new ai]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new ti(e,s,o)),s}const(e,r,o){return this._def(De.varKinds.const,e,r,o)}let(e,r,o){return this._def(De.varKinds.let,e,r,o)}var(e,r,o){return this._def(De.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new Yo(e,r,o))}add(e,r){return this._leafNode(new ri(e,N.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==j.nil&&this._leafNode(new ii(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,j.addCodeArg)(r,n));return r.push("}"),new j._Code(r)}if(e,r,o){if(this._blockNode(new wt(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new wt(e))}else(){return this._elseNode(new Ut)}endIf(){return this._endBlockNode(wt,Ut)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new ci(e),r)}forRange(e,r,o,n,s=this.opts.es5?De.varKinds.var:De.varKinds.let){let i=this._scope.toName(e);return this._for(new ui(s,i,r,o),()=>n(i))}forOf(e,r,o,n=De.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof j.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,j._)`${i}.length`,a=>{this.var(s,(0,j._)`${i}[${a}]`),o(s)})}return this._for(new Qo("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?De.varKinds.var:De.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,j._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new Qo("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode($t)}label(e){return this._leafNode(new oi(e))}break(e){return this._leafNode(new ni(e))}return(e){let r=new qr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(qr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new li;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new Lr(s),r(s)}return o&&(this._currNode=n.finally=new Ur,this.code(o)),this._endBlockNode(Lr,Ur)}throw(e){return this._leafNode(new si(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=j.nil,o,n){return this._blockNode(new Mr(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Mr)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof wt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};N.CodeGen=di;function xt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Xo(t,e){return e instanceof j._CodeOrName?xt(t,e.names):t}function Ft(t,e,r){if(t instanceof j.Name)return o(t);if(!n(t))return t;return new j._Code(t._items.reduce((s,i)=>(i instanceof j.Name&&(i=o(i)),i instanceof j._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof j._Code&&s._items.some(i=>i instanceof j.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function M_(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function lp(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,j._)`!${pi(t)}`}N.not=lp;var q_=dp(N.operators.AND);function L_(...t){return t.reduce(q_)}N.and=L_;var U_=dp(N.operators.OR);function F_(...t){return t.reduce(U_)}N.or=F_;function dp(t){return(e,r)=>e===j.nil?r:r===j.nil?e:(0,j._)`${pi(e)} ${t} ${pi(r)}`}function pi(t){return t instanceof j.Name?t:(0,j._)`(${t})`}});var M=v(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var B=O(),V_=jr();function B_(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=B_;function J_(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(mp(t,e),!hp(e,t.self.RULES.all))}C.alwaysValidSchema=J_;function mp(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||_p(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=mp;function hp(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=hp;function W_(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=W_;function H_({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,B._)`${r}`}return(0,B._)`${t}${e}${(0,B.getProperty)(o)}`}C.schemaRefOrVal=H_;function G_(t){return gp(decodeURIComponent(t))}C.unescapeFragment=G_;function K_(t){return encodeURIComponent(mi(t))}C.escapeFragment=K_;function mi(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=mi;function gp(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=gp;function Y_(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=Y_;function pp({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof B.Name?(s instanceof B.Name?t(n,s,i):e(n,s,i),i):s instanceof B.Name?(e(n,i,s),s):r(s,i);return a===B.Name&&!(c instanceof B.Name)?o(n,c):c}}C.mergeEvaluated={props:pp({mergeNames:(t,e,r)=>t.if((0,B._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,B._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,B._)`${r} || {}`).code((0,B._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,B._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,B._)`${r} || {}`),hi(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:yp}),items:pp({mergeNames:(t,e,r)=>t.if((0,B._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,B._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,B._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,B._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function yp(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,B._)`{}`);return e!==void 0&&hi(t,r,e),r}C.evaluatedPropsToName=yp;function hi(t,e,r){Object.keys(r).forEach(o=>t.assign((0,B._)`${e}${(0,B.getProperty)(o)}`,!0))}C.setEvaluated=hi;var fp={};function Q_(t,e){return t.scopeValue("func",{ref:e,code:fp[e.code]||(fp[e.code]=new V_._Code(e.code))})}C.useFunc=Q_;var fi;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(fi||(C.Type=fi={}));function X_(t,e,r){if(t instanceof B.Name){let o=e===fi.Num;return r?o?(0,B._)`"[" + ${t} + "]"`:(0,B._)`"['" + ${t} + "']"`:o?(0,B._)`"/" + ${t}`:(0,B._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,B.getProperty)(t).toString():"/"+mi(t)}C.getErrorPath=X_;function _p(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=_p});var tt=v(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});var pe=O(),eb={data:new pe.Name("data"),valCxt:new pe.Name("valCxt"),instancePath:new pe.Name("instancePath"),parentData:new pe.Name("parentData"),parentDataProperty:new pe.Name("parentDataProperty"),rootData:new pe.Name("rootData"),dynamicAnchors:new pe.Name("dynamicAnchors"),vErrors:new pe.Name("vErrors"),errors:new pe.Name("errors"),this:new pe.Name("this"),self:new pe.Name("self"),scope:new pe.Name("scope"),json:new pe.Name("json"),jsonPos:new pe.Name("jsonPos"),jsonLen:new pe.Name("jsonLen"),jsonPart:new pe.Name("jsonPart")};gi.default=eb});var Fr=v(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.extendErrors=fe.resetErrorsCount=fe.reportExtraError=fe.reportError=fe.keyword$DataError=fe.keywordError=void 0;var q=O(),tn=M(),ye=tt();fe.keywordError={message:({keyword:t})=>(0,q.str)`must pass "${t}" keyword validation`};fe.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,q.str)`"${t}" keyword must be ${e} ($data)`:(0,q.str)`"${t}" keyword is invalid ($data)`};function tb(t,e=fe.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=wp(t,e,r);o??(i||a)?bp(s,c):vp(n,(0,q._)`[${c}]`)}fe.reportError=tb;function rb(t,e=fe.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=wp(t,e,r);bp(n,a),s||i||vp(o,ye.default.vErrors)}fe.reportExtraError=rb;function ob(t,e){t.assign(ye.default.errors,e),t.if((0,q._)`${ye.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,q._)`${ye.default.vErrors}.length`,e),()=>t.assign(ye.default.vErrors,null)))}fe.resetErrorsCount=ob;function nb({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ye.default.errors,a=>{t.const(i,(0,q._)`${ye.default.vErrors}[${a}]`),t.if((0,q._)`${i}.instancePath === undefined`,()=>t.assign((0,q._)`${i}.instancePath`,(0,q.strConcat)(ye.default.instancePath,s.errorPath))),t.assign((0,q._)`${i}.schemaPath`,(0,q.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,q._)`${i}.schema`,r),t.assign((0,q._)`${i}.data`,o))})}fe.extendErrors=nb;function bp(t,e){let r=t.const("err",e);t.if((0,q._)`${ye.default.vErrors} === null`,()=>t.assign(ye.default.vErrors,(0,q._)`[${r}]`),(0,q._)`${ye.default.vErrors}.push(${r})`),t.code((0,q._)`${ye.default.errors}++`)}function vp(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,q._)`new ${t.ValidationError}(${e})`):(r.assign((0,q._)`${o}.errors`,e),r.return(!1))}var kt={keyword:new q.Name("keyword"),schemaPath:new q.Name("schemaPath"),params:new q.Name("params"),propertyName:new q.Name("propertyName"),message:new q.Name("message"),schema:new q.Name("schema"),parentSchema:new q.Name("parentSchema")};function wp(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,q._)`{}`:sb(t,e,r)}function sb(t,e,r={}){let{gen:o,it:n}=t,s=[ib(n,r),ab(t,r)];return cb(t,e,s),o.object(...s)}function ib({errorPath:t},{instancePath:e}){let r=e?(0,q.str)`${t}${(0,tn.getErrorPath)(e,tn.Type.Str)}`:t;return[ye.default.instancePath,(0,q.strConcat)(ye.default.instancePath,r)]}function ab({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,q.str)`${e}/${t}`;return r&&(n=(0,q.str)`${n}${(0,tn.getErrorPath)(r,tn.Type.Str)}`),[kt.schemaPath,n]}function cb(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([kt.keyword,n],[kt.params,typeof e=="function"?e(t):e||(0,q._)`{}`]),c.messages&&o.push([kt.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([kt.schema,i],[kt.parentSchema,(0,q._)`${l}${d}`],[ye.default.data,s]),u&&o.push([kt.propertyName,u])}});var xp=v(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.boolOrEmptySchema=Vt.topBoolOrEmptySchema=void 0;var ub=Fr(),lb=O(),db=tt(),pb={message:"boolean schema is false"};function fb(t){let{gen:e,schema:r,validateName:o}=t;r===!1?$p(t,!1):typeof r=="object"&&r.$async===!0?e.return(db.default.data):(e.assign((0,lb._)`${o}.errors`,null),e.return(!0))}Vt.topBoolOrEmptySchema=fb;function mb(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),$p(t)):r.var(e,!0)}Vt.boolOrEmptySchema=mb;function $p(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,ub.reportError)(n,pb,void 0,e)}});var yi=v(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.getRules=Bt.isJSONType=void 0;var hb=["string","number","integer","boolean","null","object","array"],gb=new Set(hb);function yb(t){return typeof t=="string"&&gb.has(t)}Bt.isJSONType=yb;function _b(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Bt.getRules=_b});var _i=v(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.shouldUseRule=dt.shouldUseGroup=dt.schemaHasRulesForType=void 0;function bb({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&kp(t,o)}dt.schemaHasRulesForType=bb;function kp(t,e){return e.rules.some(r=>Sp(t,r))}dt.shouldUseGroup=kp;function Sp(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}dt.shouldUseRule=Sp});var Vr=v(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.reportTypeError=me.checkDataTypes=me.checkDataType=me.coerceAndCheckDataType=me.getJSONTypes=me.getSchemaTypes=me.DataType=void 0;var vb=yi(),wb=_i(),$b=Fr(),I=O(),zp=M(),Jt;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Jt||(me.DataType=Jt={}));function xb(t){let e=Pp(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}me.getSchemaTypes=xb;function Pp(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(vb.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}me.getJSONTypes=Pp;function kb(t,e){let{gen:r,data:o,opts:n}=t,s=Sb(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,wb.schemaHasRulesForType)(t,e[0]));if(i){let a=vi(e,o,n.strictNumbers,Jt.Wrong);r.if(a,()=>{s.length?zb(t,e,s):wi(t)})}return i}me.coerceAndCheckDataType=kb;var Tp=new Set(["string","number","integer","boolean","null"]);function Sb(t,e){return e?t.filter(r=>Tp.has(r)||e==="array"&&r==="array"):[]}function zb(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,I._)`typeof ${n}`),a=o.let("coerced",(0,I._)`undefined`);s.coerceTypes==="array"&&o.if((0,I._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,I._)`${n}[0]`).assign(i,(0,I._)`typeof ${n}`).if(vi(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,I._)`${a} !== undefined`);for(let u of r)(Tp.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),wi(t),o.endIf(),o.if((0,I._)`${a} !== undefined`,()=>{o.assign(n,a),Pb(t,a)});function c(u){switch(u){case"string":o.elseIf((0,I._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,I._)`"" + ${n}`).elseIf((0,I._)`${n} === null`).assign(a,(0,I._)`""`);return;case"number":o.elseIf((0,I._)`${i} == "boolean" || ${n} === null
|
|
4
|
-
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,
|
|
5
|
-
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,
|
|
6
|
-
|| ${i} === "boolean" || ${n} === null`).assign(a,(0,I._)`[${n}]`)}}}function Pb({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,I._)`${e} !== undefined`,()=>t.assign((0,I._)`${e}[${r}]`,o))}function bi(t,e,r,o=Jt.Correct){let n=o===Jt.Correct?I.operators.EQ:I.operators.NEQ,s;switch(t){case"null":return(0,I._)`${e} ${n} null`;case"array":s=(0,I._)`Array.isArray(${e})`;break;case"object":s=(0,I._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,I._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,I._)`typeof ${e} ${n} ${t}`}return o===Jt.Correct?s:(0,I.not)(s);function i(a=I.nil){return(0,I.and)((0,I._)`typeof ${e} == "number"`,a,r?(0,I._)`isFinite(${e})`:I.nil)}}me.checkDataType=bi;function vi(t,e,r,o){if(t.length===1)return bi(t[0],e,r,o);let n,s=(0,zp.toHash)(t);if(s.array&&s.object){let i=(0,I._)`typeof ${e} != "object"`;n=s.null?i:(0,I._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=I.nil;s.number&&delete s.integer;for(let i in s)n=(0,I.and)(n,bi(i,e,r,o));return n}me.checkDataTypes=vi;var Tb={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,I._)`{type: ${t}}`:(0,I._)`{type: ${e}}`};function wi(t){let e=Eb(t);(0,$b.reportError)(e,Tb)}me.reportTypeError=wi;function Eb(t){let{gen:e,data:r,schema:o}=t,n=(0,zp.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var Rp=v(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.assignDefaults=void 0;var Wt=O(),Rb=M();function Ib(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Ep(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>Ep(t,s,n.default))}rn.assignDefaults=Ib;function Ep(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Wt._)`${s}${(0,Wt.getProperty)(e)}`;if(n){(0,Rb.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Wt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Wt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Wt._)`${a} = ${(0,Wt.stringify)(r)}`)}});var Ne=v(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var K=O(),$i=M(),pt=tt(),Ob=M();function Nb(t,e){let{gen:r,data:o,it:n}=t;r.if(ki(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,K._)`${e}`},!0),t.error()})}V.checkReportMissingProp=Nb;function Cb({gen:t,data:e,it:{opts:r}},o,n){return(0,K.or)(...o.map(s=>(0,K.and)(ki(t,e,s,r.ownProperties),(0,K._)`${n} = ${s}`)))}V.checkMissingProp=Cb;function Ab(t,e){t.setParams({missingProperty:e},!0),t.error()}V.reportMissingProp=Ab;function Ip(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,K._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=Ip;function xi(t,e,r){return(0,K._)`${Ip(t)}.call(${e}, ${r})`}V.isOwnProperty=xi;function Zb(t,e,r,o){let n=(0,K._)`${e}${(0,K.getProperty)(r)} !== undefined`;return o?(0,K._)`${n} && ${xi(t,e,r)}`:n}V.propertyInData=Zb;function ki(t,e,r,o){let n=(0,K._)`${e}${(0,K.getProperty)(r)} === undefined`;return o?(0,K.or)(n,(0,K.not)(xi(t,e,r))):n}V.noPropertyInData=ki;function Op(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}V.allSchemaProperties=Op;function jb(t,e){return Op(e).filter(r=>!(0,$i.alwaysValidSchema)(t,e[r]))}V.schemaProperties=jb;function Db({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,K._)`${t}, ${e}, ${o}${n}`:e,d=[[pt.default.instancePath,(0,K.strConcat)(pt.default.instancePath,s)],[pt.default.parentData,i.parentData],[pt.default.parentDataProperty,i.parentDataProperty],[pt.default.rootData,pt.default.rootData]];i.opts.dynamicRef&&d.push([pt.default.dynamicAnchors,pt.default.dynamicAnchors]);let p=(0,K._)`${l}, ${r.object(...d)}`;return c!==K.nil?(0,K._)`${a}.call(${c}, ${p})`:(0,K._)`${a}(${p})`}V.callValidateCode=Db;var Mb=(0,K._)`new RegExp`;function qb({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,K._)`${n.code==="new RegExp"?Mb:(0,Ob.useFunc)(t,n)}(${r}, ${o})`})}V.usePattern=qb;function Lb(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,K._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:$i.Type.Num},s),e.if((0,K.not)(s),a)})}}V.validateArray=Lb;function Ub(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,$i.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,K._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,K.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}V.validateUnion=Ub});var Ap=v(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.validateKeywordUsage=Ve.validSchemaType=Ve.funcKeywordCode=Ve.macroKeywordCode=void 0;var _e=O(),St=tt(),Fb=Ne(),Vb=Fr();function Bb(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=Cp(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:_e.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Ve.macroKeywordCode=Bb;function Jb(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;Hb(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=Cp(o,n,u),d=o.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)y(),e.modifying&&Np(t),_(()=>t.error());else{let b=e.async?f():m();e.modifying&&Np(t),_(()=>Wb(t,b))}}function f(){let b=o.let("ruleErrs",null);return o.try(()=>y((0,_e._)`await `),P=>o.assign(d,!1).if((0,_e._)`${P} instanceof ${c.ValidationError}`,()=>o.assign(b,(0,_e._)`${P}.errors`),()=>o.throw(P))),b}function m(){let b=(0,_e._)`${l}.errors`;return o.assign(b,null),y(_e.nil),b}function y(b=e.async?(0,_e._)`await `:_e.nil){let P=c.opts.passContext?St.default.this:St.default.self,x=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,_e._)`${b}${(0,Fb.callValidateCode)(t,l,P,x)}`,e.modifying)}function _(b){var P;o.if((0,_e.not)((P=e.valid)!==null&&P!==void 0?P:d),b)}}Ve.funcKeywordCode=Jb;function Np(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,_e._)`${o.parentData}[${o.parentDataProperty}]`))}function Wb(t,e){let{gen:r}=t;r.if((0,_e._)`Array.isArray(${e})`,()=>{r.assign(St.default.vErrors,(0,_e._)`${St.default.vErrors} === null ? ${e} : ${St.default.vErrors}.concat(${e})`).assign(St.default.errors,(0,_e._)`${St.default.vErrors}.length`),(0,Vb.extendErrors)(t)},()=>t.error())}function Hb({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Cp(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,_e.stringify)(r)})}function Gb(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Ve.validSchemaType=Gb;function Kb({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ve.validateKeywordUsage=Kb});var jp=v(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.extendSubschemaMode=ft.extendSubschemaData=ft.getSubschema=void 0;var Be=O(),Zp=M();function Yb(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Be._)`${t.schemaPath}${(0,Be.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Be._)`${t.schemaPath}${(0,Be.getProperty)(e)}${(0,Be.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Zp.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}ft.getSubschema=Yb;function Qb(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Be._)`${e.data}${(0,Be.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Be.str)`${u}${(0,Zp.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Be._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Be.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}ft.extendSubschemaData=Qb;function Xb(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}ft.extendSubschemaMode=Xb});var Si=v((nR,Dp)=>{"use strict";Dp.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var qp=v((sR,Mp)=>{"use strict";var mt=Mp.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};on(e,o,n,t,"",t)};mt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};mt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};mt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};mt.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 on(t,e,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in mt.arrayKeywords)for(var p=0;p<d.length;p++)on(t,e,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in mt.propsKeywords){if(d&&typeof d=="object")for(var f in d)on(t,e,r,d[f],n+"/"+l+"/"+ev(f),s,n,l,o,f)}else(l in mt.keywords||t.allKeys&&!(l in mt.skipKeywords))&&on(t,e,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function ev(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Br=v($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.getSchemaRefs=$e.resolveUrl=$e.normalizeId=$e._getFullPath=$e.getFullPath=$e.inlineRef=void 0;var tv=M(),rv=Si(),ov=qp(),nv=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function sv(t,e=!0){return typeof t=="boolean"?!0:e===!0?!zi(t):e?Lp(t)<=e:!1}$e.inlineRef=sv;var iv=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function zi(t){for(let e in t){if(iv.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(zi)||typeof r=="object"&&zi(r))return!0}return!1}function Lp(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!nv.has(r)&&(typeof t[r]=="object"&&(0,tv.eachItem)(t[r],o=>e+=Lp(o)),e===1/0))return 1/0}return e}function Up(t,e="",r){r!==!1&&(e=Ht(e));let o=t.parse(e);return Fp(t,o)}$e.getFullPath=Up;function Fp(t,e){return t.serialize(e).split("#")[0]+"#"}$e._getFullPath=Fp;var av=/#\/?$/;function Ht(t){return t?t.replace(av,""):""}$e.normalizeId=Ht;function cv(t,e,r){return r=Ht(r),t.resolve(e,r)}$e.resolveUrl=cv;var uv=/^[a-z_][-a-z0-9._]*$/i;function lv(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Ht(t[r]||e),s={"":n},i=Up(o,n,!1),a={},c=new Set;return ov(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let y=i+p,_=s[m];typeof d[r]=="string"&&(_=b.call(this,d[r])),P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),s[p]=_;function b(x){let z=this.opts.uriResolver.resolve;if(x=Ht(_?z(_,x):x),c.has(x))throw l(x);c.add(x);let $=this.refs[x];return typeof $=="string"&&($=this.refs[$]),typeof $=="object"?u(d,$.schema,x):x!==Ht(y)&&(x[0]==="#"?(u(d,a[x],x),a[x]=d):this.refs[x]=y),x}function P(x){if(typeof x=="string"){if(!uv.test(x))throw new Error(`invalid anchor "${x}"`);b.call(this,`#${x}`)}}}),a;function u(d,p,f){if(p!==void 0&&!rv(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}$e.getSchemaRefs=lv});var Hr=v(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.getData=ht.KeywordCxt=ht.validateFunctionCode=void 0;var Hp=xp(),Vp=Vr(),Ti=_i(),nn=Vr(),dv=Rp(),Wr=Ap(),Pi=jp(),S=O(),E=tt(),pv=Br(),rt=M(),Jr=Fr();function fv(t){if(Yp(t)&&(Qp(t),Kp(t))){gv(t);return}Gp(t,()=>(0,Hp.topBoolOrEmptySchema)(t))}ht.validateFunctionCode=fv;function Gp({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,S._)`${E.default.data}, ${E.default.valCxt}`,o.$async,()=>{t.code((0,S._)`"use strict"; ${Bp(r,n)}`),hv(t,n),t.code(s)}):t.func(e,(0,S._)`${E.default.data}, ${mv(n)}`,o.$async,()=>t.code(Bp(r,n)).code(s))}function mv(t){return(0,S._)`{${E.default.instancePath}="", ${E.default.parentData}, ${E.default.parentDataProperty}, ${E.default.rootData}=${E.default.data}${t.dynamicRef?(0,S._)`, ${E.default.dynamicAnchors}={}`:S.nil}}={}`}function hv(t,e){t.if(E.default.valCxt,()=>{t.var(E.default.instancePath,(0,S._)`${E.default.valCxt}.${E.default.instancePath}`),t.var(E.default.parentData,(0,S._)`${E.default.valCxt}.${E.default.parentData}`),t.var(E.default.parentDataProperty,(0,S._)`${E.default.valCxt}.${E.default.parentDataProperty}`),t.var(E.default.rootData,(0,S._)`${E.default.valCxt}.${E.default.rootData}`),e.dynamicRef&&t.var(E.default.dynamicAnchors,(0,S._)`${E.default.valCxt}.${E.default.dynamicAnchors}`)},()=>{t.var(E.default.instancePath,(0,S._)`""`),t.var(E.default.parentData,(0,S._)`undefined`),t.var(E.default.parentDataProperty,(0,S._)`undefined`),t.var(E.default.rootData,E.default.data),e.dynamicRef&&t.var(E.default.dynamicAnchors,(0,S._)`{}`)})}function gv(t){let{schema:e,opts:r,gen:o}=t;Gp(t,()=>{r.$comment&&e.$comment&&ef(t),wv(t),o.let(E.default.vErrors,null),o.let(E.default.errors,0),r.unevaluated&&yv(t),Xp(t),kv(t)})}function yv(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,S._)`${r}.evaluated`),e.if((0,S._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,S._)`${t.evaluated}.props`,(0,S._)`undefined`)),e.if((0,S._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,S._)`${t.evaluated}.items`,(0,S._)`undefined`))}function Bp(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,S._)`/*# sourceURL=${r} */`:S.nil}function _v(t,e){if(Yp(t)&&(Qp(t),Kp(t))){bv(t,e);return}(0,Hp.boolOrEmptySchema)(t,e)}function Kp({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Yp(t){return typeof t.schema!="boolean"}function bv(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&ef(t),$v(t),xv(t);let s=o.const("_errs",E.default.errors);Xp(t,s),o.var(e,(0,S._)`${s} === ${E.default.errors}`)}function Qp(t){(0,rt.checkUnknownRules)(t),vv(t)}function Xp(t,e){if(t.opts.jtd)return Jp(t,[],!1,e);let r=(0,Vp.getSchemaTypes)(t.schema),o=(0,Vp.coerceAndCheckDataType)(t,r);Jp(t,r,!o,e)}function vv(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,rt.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function wv(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,rt.checkStrictMode)(t,"default is ignored in the schema root")}function $v(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,pv.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function xv(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ef({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,S._)`${E.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,S.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,S._)`${E.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function kv(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,S._)`${E.default.errors} === 0`,()=>e.return(E.default.data),()=>e.throw((0,S._)`new ${n}(${E.default.vErrors})`)):(e.assign((0,S._)`${o}.errors`,E.default.vErrors),s.unevaluated&&Sv(t),e.return((0,S._)`${E.default.errors} === 0`))}function Sv({gen:t,evaluated:e,props:r,items:o}){r instanceof S.Name&&t.assign((0,S._)`${e}.props`,r),o instanceof S.Name&&t.assign((0,S._)`${e}.items`,o)}function Jp(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,rt.schemaHasRulesButRef)(s,l))){n.block(()=>rf(t,"$ref",l.all.$ref.definition));return}c.jtd||zv(t,e),n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Ti.shouldUseGroup)(s,p)&&(p.type?(n.if((0,nn.checkDataType)(p.type,i,c.strictNumbers)),Wp(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,nn.reportTypeError)(t)),n.endIf()):Wp(t,p),a||n.if((0,S._)`${E.default.errors} === ${o||0}`))}}function Wp(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,dv.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Ti.shouldUseRule)(o,s)&&rf(t,s.keyword,s.definition,e.type)})}function zv(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Pv(t,e),t.opts.allowUnionTypes||Tv(t,e),Ev(t,t.dataTypes))}function Pv(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{tf(t.dataTypes,r)||Ei(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Iv(t,e)}}function Tv(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ei(t,"use allowUnionTypes to allow union type keyword")}function Ev(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Ti.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>Rv(e,i))&&Ei(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Rv(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function tf(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Iv(t,e){let r=[];for(let o of t.dataTypes)tf(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function Ei(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,rt.checkStrictMode)(t,e,t.opts.strictTypes)}var sn=class{constructor(e,r,o){if((0,Wr.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,rt.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",of(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Wr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",E.default.errors))}result(e,r,o){this.failResult((0,S.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,S.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,S._)`${r} !== undefined && (${(0,S.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?Jr.reportExtraError:Jr.reportError)(this,this.def.error,r)}$dataError(){(0,Jr.reportError)(this,this.def.$dataError||Jr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Jr.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=S.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=S.nil,r=S.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,S.or)((0,S._)`${n} === undefined`,r)),e!==S.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==S.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,S.or)(i(),a());function i(){if(o.length){if(!(r instanceof S.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,S._)`${(0,nn.checkDataTypes)(c,r,s.opts.strictNumbers,nn.DataType.Wrong)}`}return S.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,S._)`!${c}(${r})`}return S.nil}}subschema(e,r){let o=(0,Pi.getSubschema)(this.it,e);(0,Pi.extendSubschemaData)(o,this.it,e),(0,Pi.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return _v(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=rt.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=rt.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,S.Name)),!0}};ht.KeywordCxt=sn;function rf(t,e,r,o){let n=new sn(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Wr.funcKeywordCode)(n,r):"macro"in r?(0,Wr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Wr.funcKeywordCode)(n,r)}var Ov=/^\/(?:[^~]|~0|~1)*$/,Nv=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function of(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return E.default.rootData;if(t[0]==="/"){if(!Ov.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=E.default.rootData}else{let u=Nv.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,S._)`${s}${(0,S.getProperty)((0,rt.unescapeJsonPointer)(u))}`,i=(0,S._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}ht.getData=of});var an=v(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});var Ri=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Ii.default=Ri});var Gr=v(Ci=>{"use strict";Object.defineProperty(Ci,"__esModule",{value:!0});var Oi=Br(),Ni=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Oi.resolveUrl)(e,r,o),this.missingSchema=(0,Oi.normalizeId)((0,Oi.getFullPath)(e,this.missingRef))}};Ci.default=Ni});var un=v(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.resolveSchema=Ce.getCompilingSchema=Ce.resolveRef=Ce.compileSchema=Ce.SchemaEnv=void 0;var Me=O(),Cv=an(),zt=tt(),qe=Br(),nf=M(),Av=Hr(),Gt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,qe.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};Ce.SchemaEnv=Gt;function Zi(t){let e=sf.call(this,t);if(e)return e;let r=(0,qe.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Me.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:Cv.default,code:(0,Me._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:zt.default.data,parentData:zt.default.parentData,parentDataProperty:zt.default.parentDataProperty,dataNames:[zt.default.data],dataPathArr:[Me.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Me.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Me.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Me._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Av.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(zt.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${zt.default.self}`,`${zt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:y}=u;f.evaluated={props:m instanceof Me.Name?void 0:m,items:y instanceof Me.Name?void 0:y,dynamicProps:m instanceof Me.Name,dynamicItems:y instanceof Me.Name},f.source&&(f.source.evaluated=(0,Me.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}Ce.compileSchema=Zi;function Zv(t,e,r){var o;r=(0,qe.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=Mv.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new Gt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=jv.call(this,s)}Ce.resolveRef=Zv;function jv(t){return(0,qe.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Zi.call(this,t)}function sf(t){for(let e of this._compilations)if(Dv(e,t))return e}Ce.getCompilingSchema=sf;function Dv(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Mv(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||cn.call(this,t,e)}function cn(t,e){let r=this.opts.uriResolver.parse(e),o=(0,qe._getFullPath)(this.opts.uriResolver,r),n=(0,qe.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return Ai.call(this,r,t);let s=(0,qe.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=cn.call(this,t,i);return typeof a?.schema!="object"?void 0:Ai.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Zi.call(this,i),s===(0,qe.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,qe.resolveUrl)(this.opts.uriResolver,n,u)),new Gt({schema:a,schemaId:c,root:t,baseId:n})}return Ai.call(this,r,i)}}Ce.resolveSchema=cn;var qv=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Ai(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,nf.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!qv.has(a)&&u&&(e=(0,qe.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,nf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,qe.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=cn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Gt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var af=v((dR,Lv)=>{Lv.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 Mi=v((pR,ff)=>{"use strict";var Uv=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),uf=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),ji=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),lf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Fv=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Di(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var Vv=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function cf(t){return t.length=0,!0}function Bv(t,e,r){if(t.length){let o=Di(t);if(o!=="")e.push(o);else return r.error=!0,!1;t.length=0}return!0}function Jv(t){let e=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Bv;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=cf}else{n.push(u);continue}}return n.length&&(a===cf?r.zone=n.join(""):i?o.push(n.join("")):o.push(Di(n))),r.address=o.join(""),r}function df(t){if(Wv(t,":")<2)return{host:t,isIPV6:!1};let e=Jv(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,o=e.address;return e.zone&&(r+="%"+e.zone,o+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:o}}}function Wv(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function Hv(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var Gv={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Kv=/[@/?#:]/g,Yv=/[@/?#]/g;function pf(t,e){let r=e?Yv:Kv;return r.lastIndex=0,t.replace(r,o=>Gv[o])}function Qv(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(ji(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&lf(i)?r+=i:r+="%"+s,o+=2;continue}}r+=t[o]}return r}function Xv(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(ji(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&lf(s)?e+=s:e+="%"+n,r+=2;continue}}Fv(t[r])?e+=t[r]:e+=escape(t[r])}return e}function ew(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(ji(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function tw(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!uf(r)){let o=df(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=pf(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}ff.exports={nonSimpleDomain:Vv,recomposeAuthority:tw,reescapeHostDelimiters:pf,normalizePercentEncoding:Qv,normalizePathEncoding:Xv,escapePreservingEscapes:ew,removeDotSegments:Hv,isIPv4:uf,isUUID:Uv,normalizeIPv6:df,stringArrayToHexStripped:Di}});var _f=v((fR,yf)=>{"use strict";var{isUUID:rw}=Mi(),ow=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,nw=["http","https","ws","wss","urn","urn:uuid"];function sw(t){return nw.indexOf(t)!==-1}function qi(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function mf(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function hf(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function iw(t){return t.secure=qi(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function aw(t){if((t.port===(qi(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function cw(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(ow);if(r){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=Li(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function uw(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=Li(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function lw(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!rw(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function dw(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var gf={scheme:"http",domainHost:!0,parse:mf,serialize:hf},pw={scheme:"https",domainHost:gf.domainHost,parse:mf,serialize:hf},ln={scheme:"ws",domainHost:!0,parse:iw,serialize:aw},fw={scheme:"wss",domainHost:ln.domainHost,parse:ln.parse,serialize:ln.serialize},mw={scheme:"urn",parse:cw,serialize:uw,skipNormalize:!0},hw={scheme:"urn:uuid",parse:lw,serialize:dw,skipNormalize:!0},dn={http:gf,https:pw,ws:ln,wss:fw,urn:mw,"urn:uuid":hw};Object.setPrototypeOf(dn,null);function Li(t){return t&&(dn[t]||dn[t.toLowerCase()])||void 0}yf.exports={wsIsSecure:qi,SCHEMES:dn,isValidSchemeName:sw,getSchemeHandler:Li}});var kf=v((mR,pn)=>{"use strict";var{normalizeIPv6:gw,removeDotSegments:Kr,recomposeAuthority:yw,normalizePercentEncoding:_w,normalizePathEncoding:bw,escapePreservingEscapes:vw,reescapeHostDelimiters:ww,isIPv4:$w,nonSimpleDomain:xw}=Mi(),{SCHEMES:kw,getSchemeHandler:vf}=_f();function Sw(t,e){return typeof t=="string"?t=Rw(t,e):typeof t=="object"&&(t=Kt(Pt(t,e),e)),t}function zw(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=wf(Kt(t,o),Kt(e,o),o,!0);return o.skipEscape=!0,Pt(n,o)}function wf(t,e,r,o){let n={};return o||(t=Kt(Pt(t,r),r),e=Kt(Pt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Kr(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Kr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Kr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=Kr(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function Pw(t,e,r){let o=bf(t,r),n=bf(e,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Pt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[],s=vf(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=_w(r.path):(r.path=vw(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=yw(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=Kr(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var Tw=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ew(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function $f(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(Tw);if(i){o.scheme=i[1],o.userinfo=i[3],o.host=i[4],o.port=parseInt(i[5],10),o.path=i[6]||"",o.query=i[7],o.fragment=i[8],isNaN(o.port)&&(o.port=i[5]);let a=Ew(o,i);if(a!==void 0&&(o.error=o.error||a,n=!0),o.host)if($w(o.host)===!1){let l=gw(o.host);o.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let c=vf(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&o.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&xw(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=ww(unescape(o.host),s))),o.path&&(o.path=bw(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}c&&c.parse&&c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function Kt(t,e){return $f(t,e).parsed}function Rw(t,e){return xf(t,e).normalized}function xf(t,e){let{parsed:r,malformedAuthorityOrPort:o}=$f(t,e);return{normalized:o?t:Pt(r,e),malformedAuthorityOrPort:o}}function bf(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:o}=xf(t,e);return o?void 0:r}if(typeof t=="object")return Pt(t,e)}var Ui={SCHEMES:kw,normalize:Sw,resolve:zw,resolveComponent:wf,equal:Pw,serialize:Pt,parse:Kt};pn.exports=Ui;pn.exports.default=Ui;pn.exports.fastUri=Ui});var zf=v(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});var Sf=kf();Sf.code='require("ajv/dist/runtime/uri").default';Fi.default=Sf});var Cf=v(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CodeGen=le.Name=le.nil=le.stringify=le.str=le._=le.KeywordCxt=void 0;var Iw=Hr();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return Iw.KeywordCxt}});var Yt=O();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return Yt._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return Yt.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return Yt.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return Yt.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return Yt.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return Yt.CodeGen}});var Ow=an(),If=Gr(),Nw=yi(),Yr=un(),Cw=O(),Qr=Br(),fn=Vr(),Bi=M(),Pf=af(),Aw=zf(),Of=(t,e)=>new RegExp(t,e);Of.code="new RegExp";var Zw=["removeAdditional","useDefaults","coerceTypes"],jw=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Dw={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."},Mw={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Tf=200;function qw(t){var e,r,o,n,s,i,a,c,u,l,d,p,f,m,y,_,b,P,x,z,$,ke,Te,ir,Cn;let ar=t.strict,An=(e=t.code)===null||e===void 0?void 0:e.optimize,Fa=An===!0||An===void 0?1:An||0,Va=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Of,sh=(n=t.uriResolver)!==null&&n!==void 0?n:Aw.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:ar)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:ar)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:ar)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:ar)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:ar)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Fa,regExp:Va}:{optimize:Fa,regExp:Va},loopRequired:(y=t.loopRequired)!==null&&y!==void 0?y:Tf,loopEnum:(_=t.loopEnum)!==null&&_!==void 0?_:Tf,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(P=t.messages)!==null&&P!==void 0?P:!0,inlineRefs:(x=t.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(z=t.schemaId)!==null&&z!==void 0?z:"$id",addUsedSchema:($=t.addUsedSchema)!==null&&$!==void 0?$:!0,validateSchema:(ke=t.validateSchema)!==null&&ke!==void 0?ke:!0,validateFormats:(Te=t.validateFormats)!==null&&Te!==void 0?Te:!0,unicodeRegExp:(ir=t.unicodeRegExp)!==null&&ir!==void 0?ir:!0,int32range:(Cn=t.int32range)!==null&&Cn!==void 0?Cn:!0,uriResolver:sh}}var Xr=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...qw(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new Cw.ValueScope({scope:{},prefixes:jw,es5:r,lines:o}),this.logger=Jw(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Nw.getRules)(),Ef.call(this,Dw,e,"NOT SUPPORTED"),Ef.call(this,Mw,e,"DEPRECATED","warn"),this._metaOpts=Vw.call(this),e.formats&&Uw.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Fw.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Lw.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=Pf;o==="id"&&(n={...Pf},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof If.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Qr.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=Rf.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new Yr.SchemaEnv({schema:{},schemaId:o});if(r=Yr.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Rf.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,Qr.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Hw.call(this,o,r),!r)return(0,Bi.eachItem)(o,s=>Vi.call(this,s)),this;Kw.call(this,r);let n={...r,type:(0,fn.getJSONTypes)(r.type),schemaType:(0,fn.getJSONTypes)(r.schemaType)};return(0,Bi.eachItem)(o,n.type.length===0?s=>Vi.call(this,s,n):s=>n.type.forEach(i=>Vi.call(this,s,n,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Nf(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,Qr.normalizeId)(i||o);let u=Qr.getSchemaRefs.call(this,e,o);return c=new Yr.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Yr.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Yr.compileSchema.call(this,e)}finally{this.opts=r}}};Xr.ValidationError=Ow.default;Xr.MissingRefError=If.default;le.default=Xr;function Ef(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function Rf(t){return t=(0,Qr.normalizeId)(t),this.schemas[t]||this.refs[t]}function Lw(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Uw(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Fw(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Vw(){let t={...this.opts};for(let e of Zw)delete t[e];return t}var Bw={log(){},warn(){},error(){}};function Jw(t){if(t===!1)return Bw;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Ww=/^[a-z_$][a-z0-9_$:-]*$/i;function Hw(t,e){let{RULES:r}=this;if((0,Bi.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Ww.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Vi(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,fn.getJSONTypes)(e.type),schemaType:(0,fn.getJSONTypes)(e.schemaType)}};e.before?Gw.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function Gw(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Kw(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Nf(e)),t.validateSchema=this.compile(e,!0))}var Yw={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Nf(t){return{anyOf:[t,Yw]}}});var Af=v(Ji=>{"use strict";Object.defineProperty(Ji,"__esModule",{value:!0});var Qw={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ji.default=Qw});var Mf=v(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.callRef=Tt.getValidate=void 0;var Xw=Gr(),Zf=Ne(),xe=O(),Qt=tt(),jf=un(),mn=M(),e$={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=jf.resolveRef.call(c,u,n,r);if(l===void 0)throw new Xw.default(o.opts.uriResolver,n,r);if(l instanceof jf.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return hn(t,i,s,s.$async);let m=e.scopeValue("root",{ref:u});return hn(t,(0,xe._)`${m}.validate`,u,u.$async)}function p(m){let y=Df(t,m);hn(t,y,m,m.$async)}function f(m){let y=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,xe.stringify)(m)}:{ref:m}),_=e.name("valid"),b=t.subschema({schema:m,dataTypes:[],schemaPath:xe.nil,topSchemaRef:y,errSchemaPath:r},_);t.mergeEvaluated(b),t.ok(_)}}};function Df(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,xe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Tt.getValidate=Df;function hn(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Qt.default.this:xe.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,xe._)`await ${(0,Zf.callValidateCode)(t,e,u)}`),f(e),i||n.assign(m,!0)},y=>{n.if((0,xe._)`!(${y} instanceof ${s.ValidationError})`,()=>n.throw(y)),p(y),i||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,Zf.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(m){let y=(0,xe._)`${m}.errors`;n.assign(Qt.default.vErrors,(0,xe._)`${Qt.default.vErrors} === null ? ${y} : ${Qt.default.vErrors}.concat(${y})`),n.assign(Qt.default.errors,(0,xe._)`${Qt.default.vErrors}.length`)}function f(m){var y;if(!s.opts.unevaluated)return;let _=(y=r?.validate)===null||y===void 0?void 0:y.evaluated;if(s.props!==!0)if(_&&!_.dynamicProps)_.props!==void 0&&(s.props=mn.mergeEvaluated.props(n,_.props,s.props));else{let b=n.var("props",(0,xe._)`${m}.evaluated.props`);s.props=mn.mergeEvaluated.props(n,b,s.props,xe.Name)}if(s.items!==!0)if(_&&!_.dynamicItems)_.items!==void 0&&(s.items=mn.mergeEvaluated.items(n,_.items,s.items));else{let b=n.var("items",(0,xe._)`${m}.evaluated.items`);s.items=mn.mergeEvaluated.items(n,b,s.items,xe.Name)}}}Tt.callRef=hn;Tt.default=e$});var qf=v(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var t$=Af(),r$=Mf(),o$=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t$.default,r$.default];Wi.default=o$});var Lf=v(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var gn=O(),gt=gn.operators,yn={maximum:{okStr:"<=",ok:gt.LTE,fail:gt.GT},minimum:{okStr:">=",ok:gt.GTE,fail:gt.LT},exclusiveMaximum:{okStr:"<",ok:gt.LT,fail:gt.GTE},exclusiveMinimum:{okStr:">",ok:gt.GT,fail:gt.LTE}},n$={message:({keyword:t,schemaCode:e})=>(0,gn.str)`must be ${yn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gn._)`{comparison: ${yn[t].okStr}, limit: ${e}}`},s$={keyword:Object.keys(yn),type:"number",schemaType:"number",$data:!0,error:n$,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,gn._)`${r} ${yn[e].fail} ${o} || isNaN(${r})`)}};Hi.default=s$});var Uf=v(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});var eo=O(),i$={message:({schemaCode:t})=>(0,eo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,eo._)`{multipleOf: ${t}}`},a$={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:i$,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,eo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,eo._)`${i} !== parseInt(${i})`;t.fail$data((0,eo._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Gi.default=a$});var Vf=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});function Ff(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}Ki.default=Ff;Ff.code='require("ajv/dist/runtime/ucs2length").default'});var Bf=v(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var Et=O(),c$=M(),u$=Vf(),l$={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Et.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Et._)`{limit: ${t}}`},d$={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:l$,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?Et.operators.GT:Et.operators.LT,i=n.opts.unicode===!1?(0,Et._)`${r}.length`:(0,Et._)`${(0,c$.useFunc)(t.gen,u$.default)}(${r})`;t.fail$data((0,Et._)`${i} ${s} ${o}`)}};Yi.default=d$});var Jf=v(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});var p$=Ne(),f$=M(),Xt=O(),m$={message:({schemaCode:t})=>(0,Xt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Xt._)`{pattern: ${t}}`},h$={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:m$,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,Xt._)`new RegExp`:(0,f$.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Xt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Xt._)`!${l}`)}else{let c=(0,p$.usePattern)(t,n);t.fail$data((0,Xt._)`!${c}.test(${r})`)}}};Qi.default=h$});var Wf=v(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var to=O(),g$={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,to.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,to._)`{limit: ${t}}`},y$={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:g$,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?to.operators.GT:to.operators.LT;t.fail$data((0,to._)`Object.keys(${r}).length ${n} ${o}`)}};Xi.default=y$});var Hf=v(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});var ro=Ne(),oo=O(),_$=M(),b$={message:({params:{missingProperty:t}})=>(0,oo.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,oo._)`{missingProperty: ${t}}`},v$={keyword:"required",type:"object",schemaType:"array",$data:!0,error:b$,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let y of r)if(f?.[y]===void 0&&!m.has(y)){let _=i.schemaEnv.baseId+i.errSchemaPath,b=`required property "${y}" is not defined at "${_}" (strictRequired)`;(0,_$.checkStrictMode)(i,b,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(oo.nil,d);else for(let f of r)(0,ro.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,ro.checkMissingProp)(t,r,f)),(0,ro.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",o,f=>{t.setParams({missingProperty:f}),e.if((0,ro.noPropertyInData)(e,n,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,o,()=>{e.assign(m,(0,ro.propertyInData)(e,n,f,a.ownProperties)),e.if((0,oo.not)(m),()=>{t.error(),e.break()})},oo.nil)}}};ea.default=v$});var Gf=v(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});var no=O(),w$={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,no.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,no._)`{limit: ${t}}`},$$={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:w$,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?no.operators.GT:no.operators.LT;t.fail$data((0,no._)`${r}.length ${n} ${o}`)}};ta.default=$$});var _n=v(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});var Kf=Si();Kf.code='require("ajv/dist/runtime/equal").default';ra.default=Kf});var Yf=v(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var oa=Vr(),de=O(),x$=M(),k$=_n(),S$={message:({params:{i:t,j:e}})=>(0,de.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,de._)`{i: ${t}, j: ${e}}`},z$={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:S$,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=s.items?(0,oa.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,de._)`${i} === false`),t.ok(c);function l(){let m=e.let("i",(0,de._)`${r}.length`),y=e.let("j");t.setParams({i:m,j:y}),e.assign(c,!0),e.if((0,de._)`${m} > 1`,()=>(d()?p:f)(m,y))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,y){let _=e.name("item"),b=(0,oa.checkDataTypes)(u,_,a.opts.strictNumbers,oa.DataType.Wrong),P=e.const("indices",(0,de._)`{}`);e.for((0,de._)`;${m}--;`,()=>{e.let(_,(0,de._)`${r}[${m}]`),e.if(b,(0,de._)`continue`),u.length>1&&e.if((0,de._)`typeof ${_} == "string"`,(0,de._)`${_} += "_"`),e.if((0,de._)`typeof ${P}[${_}] == "number"`,()=>{e.assign(y,(0,de._)`${P}[${_}]`),t.error(),e.assign(c,!1).break()}).code((0,de._)`${P}[${_}] = ${m}`)})}function f(m,y){let _=(0,x$.useFunc)(e,k$.default),b=e.name("outer");e.label(b).for((0,de._)`;${m}--;`,()=>e.for((0,de._)`${y} = ${m}; ${y}--;`,()=>e.if((0,de._)`${_}(${r}[${m}], ${r}[${y}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};na.default=z$});var Qf=v(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var sa=O(),P$=M(),T$=_n(),E$={message:"must be equal to constant",params:({schemaCode:t})=>(0,sa._)`{allowedValue: ${t}}`},R$={keyword:"const",$data:!0,error:E$,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,sa._)`!${(0,P$.useFunc)(e,T$.default)}(${r}, ${n})`):t.fail((0,sa._)`${s} !== ${r}`)}};ia.default=R$});var Xf=v(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var so=O(),I$=M(),O$=_n(),N$={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,so._)`{allowedValues: ${t}}`},C$={keyword:"enum",schemaType:"array",$data:!0,error:N$,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,I$.useFunc)(e,O$.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,so.or)(...n.map((m,y)=>p(f,y)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,so._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,m){let y=n[m];return typeof y=="object"&&y!==null?(0,so._)`${u()}(${r}, ${f}[${m}])`:(0,so._)`${r} === ${y}`}}};aa.default=C$});var em=v(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var A$=Lf(),Z$=Uf(),j$=Bf(),D$=Jf(),M$=Wf(),q$=Hf(),L$=Gf(),U$=Yf(),F$=Qf(),V$=Xf(),B$=[A$.default,Z$.default,j$.default,D$.default,M$.default,q$.default,L$.default,U$.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},F$.default,V$.default];ca.default=B$});var la=v(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.validateAdditionalItems=void 0;var Rt=O(),ua=M(),J$={message:({params:{len:t}})=>(0,Rt.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Rt._)`{limit: ${t}}`},W$={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:J$,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,ua.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}tm(t,o)}};function tm(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Rt._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,Rt._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,ua.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,Rt._)`${a} <= ${e.length}`);r.if((0,Rt.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:ua.Type.Num},u),i.allErrors||r.if((0,Rt.not)(u),()=>r.break())})}}io.validateAdditionalItems=tm;io.default=W$});var da=v(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.validateTuple=void 0;var rm=O(),bn=M(),H$=Ne(),G$={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return om(t,"additionalItems",e);r.items=!0,!(0,bn.alwaysValidSchema)(r,e)&&t.ok((0,H$.validateArray)(t))}};function om(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=bn.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,rm._)`${s}.length`);r.forEach((d,p)=>{(0,bn.alwaysValidSchema)(a,d)||(o.if((0,rm._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,m=r.length,y=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!y){let _=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,bn.checkStrictMode)(a,_,p.strictTuples)}}}ao.validateTuple=om;ao.default=G$});var nm=v(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var K$=da(),Y$={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,K$.validateTuple)(t,"items")};pa.default=Y$});var im=v(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var sm=O(),Q$=M(),X$=Ne(),ex=la(),tx={message:({params:{len:t}})=>(0,sm.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,sm._)`{limit: ${t}}`},rx={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:tx,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,Q$.alwaysValidSchema)(o,e)&&(n?(0,ex.validateAdditionalItems)(t,n):t.ok((0,X$.validateArray)(t)))}};fa.default=rx});var am=v(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var Ae=O(),vn=M(),ox={message:({params:{min:t,max:e}})=>e===void 0?(0,Ae.str)`must contain at least ${t} valid item(s)`:(0,Ae.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Ae._)`{minContains: ${t}}`:(0,Ae._)`{minContains: ${t}, maxContains: ${e}}`},nx={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:ox,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,Ae._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,vn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,vn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,vn.alwaysValidSchema)(s,r)){let y=(0,Ae._)`${l} >= ${i}`;a!==void 0&&(y=(0,Ae._)`${y} && ${l} <= ${a}`),t.pass(y);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,Ae._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let y=e.name("_valid"),_=e.let("count",0);f(y,()=>e.if(y,()=>m(_)))}function f(y,_){e.forRange("i",0,l,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:vn.Type.Num,compositeRule:!0},y),_()})}function m(y){e.code((0,Ae._)`${y}++`),a===void 0?e.if((0,Ae._)`${y} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,Ae._)`${y} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,Ae._)`${y} >= ${i}`,()=>e.assign(d,!0)))}}};ma.default=nx});var lm=v(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.validateSchemaDeps=Je.validatePropertyDeps=Je.error=void 0;var ha=O(),sx=M(),co=Ne();Je.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,ha.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,ha._)`{property: ${t},
|
|
2
|
+
var ih=Object.create;var jn=Object.defineProperty;var ah=Object.getOwnPropertyDescriptor;var ch=Object.getOwnPropertyNames;var uh=Object.getPrototypeOf,lh=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ja=(t,e)=>{for(var r in e)jn(t,r,{get:e[r],enumerable:!0})},dh=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ch(e))!lh.call(t,n)&&n!==r&&jn(t,n,{get:()=>e[n],enumerable:!(o=ah(e,n))||o.enumerable});return t};var Ha=(t,e,r)=>(r=t!=null?ih(uh(t)):{},dh(e||!t||!t.__esModule?jn(r,"default",{value:t,enumerable:!0}):r,t));var Cr=v(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.regexpCode=L.getEsmExportName=L.getProperty=L.safeStringify=L.stringify=L.strConcat=L.addCodeArg=L.str=L._=L.nil=L._Code=L.Name=L.IDENTIFIER=L._CodeOrName=void 0;var Zr=class{};L._CodeOrName=Zr;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var vt=class extends Zr{constructor(e){if(super(),!L.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};L.Name=vt;var Ne=class extends Zr{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof vt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};L._Code=Ne;L.nil=new Ne("");function cp(t,...e){let r=[t[0]],o=0;for(;o<e.length;)Ys(r,e[o]),r.push(t[++o]);return new Ne(r)}L._=cp;var Gs=new Ne("+");function up(t,...e){let r=[jr(t[0])],o=0;for(;o<e.length;)r.push(Gs),Ys(r,e[o]),r.push(Gs,jr(t[++o]));return Ry(r),new Ne(r)}L.str=up;function Ys(t,e){e instanceof Ne?t.push(...e._items):e instanceof vt?t.push(e):t.push(Ny(e))}L.addCodeArg=Ys;function Ry(t){let e=1;for(;e<t.length-1;){if(t[e]===Gs){let r=Oy(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Oy(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof vt||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof vt))return`"${t}${e.slice(1)}`}function Iy(t,e){return e.emptyStr()?t:t.emptyStr()?e:up`${t}${e}`}L.strConcat=Iy;function Ny(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:jr(Array.isArray(t)?t.join(","):t)}function Ay(t){return new Ne(jr(t))}L.stringify=Ay;function jr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=jr;function Zy(t){return typeof t=="string"&&L.IDENTIFIER.test(t)?new Ne(`.${t}`):cp`[${t}]`}L.getProperty=Zy;function jy(t){if(typeof t=="string"&&L.IDENTIFIER.test(t))return new Ne(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}L.getEsmExportName=jy;function Cy(t){return new Ne(t.toString())}L.regexpCode=Cy});var ei=v(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.ValueScope=we.ValueScopeName=we.Scope=we.varKinds=we.UsedValueState=void 0;var ve=Cr(),Qs=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Wo;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Wo||(we.UsedValueState=Wo={}));we.varKinds={const:new ve.Name("const"),let:new ve.Name("let"),var:new ve.Name("var")};var Ko=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof ve.Name?e:this.name(e)}name(e){return new ve.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};we.Scope=Ko;var Go=class extends ve.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,ve._)`.${new ve.Name(r)}[${o}]`}};we.ValueScopeName=Go;var Dy=(0,ve._)`\n`,Xs=class extends Ko{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Dy:ve.nil}}get(){return this._scope}name(e){return new Go(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,ve._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=ve.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Wo.Started);let l=r(u);if(l){let d=this.opts.es5?we.varKinds.var:we.varKinds.const;s=(0,ve._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,ve._)`${s}${l}${this.opts._n}`;else throw new Qs(u);c.set(u,Wo.Completed)})}return s}};we.ValueScope=Xs});var I=v(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.or=N.and=N.not=N.CodeGen=N.operators=N.varKinds=N.ValueScopeName=N.ValueScope=N.Scope=N.Name=N.regexpCode=N.stringify=N.getProperty=N.nil=N.strConcat=N.str=N._=void 0;var C=Cr(),De=ei(),lt=Cr();Object.defineProperty(N,"_",{enumerable:!0,get:function(){return lt._}});Object.defineProperty(N,"str",{enumerable:!0,get:function(){return lt.str}});Object.defineProperty(N,"strConcat",{enumerable:!0,get:function(){return lt.strConcat}});Object.defineProperty(N,"nil",{enumerable:!0,get:function(){return lt.nil}});Object.defineProperty(N,"getProperty",{enumerable:!0,get:function(){return lt.getProperty}});Object.defineProperty(N,"stringify",{enumerable:!0,get:function(){return lt.stringify}});Object.defineProperty(N,"regexpCode",{enumerable:!0,get:function(){return lt.regexpCode}});Object.defineProperty(N,"Name",{enumerable:!0,get:function(){return lt.Name}});var en=ei();Object.defineProperty(N,"Scope",{enumerable:!0,get:function(){return en.Scope}});Object.defineProperty(N,"ValueScope",{enumerable:!0,get:function(){return en.ValueScope}});Object.defineProperty(N,"ValueScopeName",{enumerable:!0,get:function(){return en.ValueScopeName}});Object.defineProperty(N,"varKinds",{enumerable:!0,get:function(){return en.varKinds}});N.operators={GT:new C._Code(">"),GTE:new C._Code(">="),LT:new C._Code("<"),LTE:new C._Code("<="),EQ:new C._Code("==="),NEQ:new C._Code("!=="),NOT:new C._Code("!"),OR:new C._Code("||"),AND:new C._Code("&&"),ADD:new C._Code("+")};var Xe=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ti=class extends Xe{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?De.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Ft(this.rhs,e,r)),this}get names(){return this.rhs instanceof C._CodeOrName?this.rhs.names:{}}},Yo=class extends Xe{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof C.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Ft(this.rhs,e,r),this}get names(){let e=this.lhs instanceof C.Name?{}:{...this.lhs.names};return Xo(e,this.rhs)}},ri=class extends Yo{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},oi=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ni=class extends Xe{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},si=class extends Xe{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},ii=class extends Xe{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Ft(this.code,e,r),this}get names(){return this.code instanceof C._CodeOrName?this.code.names:{}}},Dr=class extends Xe{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(qy(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>zt(e,r.names),{})}},et=class extends Dr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},ai=class extends Dr{},Ut=class extends et{};Ut.kind="else";var wt=class t extends et{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Ut(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(lp(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Ft(this.condition,e,r),this}get names(){let e=super.names;return Xo(e,this.condition),this.else&&zt(e,this.else.names),e}};wt.kind="if";var $t=class extends et{};$t.kind="for";var ci=class extends $t{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Ft(this.iteration,e,r),this}get names(){return zt(super.names,this.iteration.names)}},ui=class extends $t{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?De.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=Xo(super.names,this.from);return Xo(e,this.to)}},Qo=class extends $t{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Ft(this.iterable,e,r),this}get names(){return zt(super.names,this.iterable.names)}},qr=class extends et{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};qr.kind="func";var Mr=class extends Dr{render(e){return"return "+super.render(e)}};Mr.kind="return";var li=class extends et{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&zt(e,this.catch.names),this.finally&&zt(e,this.finally.names),e}},Lr=class extends et{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Lr.kind="catch";var Ur=class extends et{render(e){return"finally"+super.render(e)}};Ur.kind="finally";var di=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new De.Scope({parent:e}),this._nodes=[new ai]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new ti(e,s,o)),s}const(e,r,o){return this._def(De.varKinds.const,e,r,o)}let(e,r,o){return this._def(De.varKinds.let,e,r,o)}var(e,r,o){return this._def(De.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new Yo(e,r,o))}add(e,r){return this._leafNode(new ri(e,N.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==C.nil&&this._leafNode(new ii(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,C.addCodeArg)(r,n));return r.push("}"),new C._Code(r)}if(e,r,o){if(this._blockNode(new wt(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new wt(e))}else(){return this._elseNode(new Ut)}endIf(){return this._endBlockNode(wt,Ut)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new ci(e),r)}forRange(e,r,o,n,s=this.opts.es5?De.varKinds.var:De.varKinds.let){let i=this._scope.toName(e);return this._for(new ui(s,i,r,o),()=>n(i))}forOf(e,r,o,n=De.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof C.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,C._)`${i}.length`,a=>{this.var(s,(0,C._)`${i}[${a}]`),o(s)})}return this._for(new Qo("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?De.varKinds.var:De.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,C._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new Qo("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode($t)}label(e){return this._leafNode(new oi(e))}break(e){return this._leafNode(new ni(e))}return(e){let r=new Mr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Mr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new li;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new Lr(s),r(s)}return o&&(this._currNode=n.finally=new Ur,this.code(o)),this._endBlockNode(Lr,Ur)}throw(e){return this._leafNode(new si(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=C.nil,o,n){return this._blockNode(new qr(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(qr)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof wt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};N.CodeGen=di;function zt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Xo(t,e){return e instanceof C._CodeOrName?zt(t,e.names):t}function Ft(t,e,r){if(t instanceof C.Name)return o(t);if(!n(t))return t;return new C._Code(t._items.reduce((s,i)=>(i instanceof C.Name&&(i=o(i)),i instanceof C._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof C._Code&&s._items.some(i=>i instanceof C.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function qy(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function lp(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,C._)`!${pi(t)}`}N.not=lp;var My=dp(N.operators.AND);function Ly(...t){return t.reduce(My)}N.and=Ly;var Uy=dp(N.operators.OR);function Fy(...t){return t.reduce(Uy)}N.or=Fy;function dp(t){return(e,r)=>e===C.nil?r:r===C.nil?e:(0,C._)`${pi(e)} ${t} ${pi(r)}`}function pi(t){return t instanceof C.Name?t:(0,C._)`(${t})`}});var q=v(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.checkStrictMode=A.getErrorPath=A.Type=A.useFunc=A.setEvaluated=A.evaluatedPropsToName=A.mergeEvaluated=A.eachItem=A.unescapeJsonPointer=A.escapeJsonPointer=A.escapeFragment=A.unescapeFragment=A.schemaRefOrVal=A.schemaHasRulesButRef=A.schemaHasRules=A.checkUnknownRules=A.alwaysValidSchema=A.toHash=void 0;var J=I(),Vy=Cr();function Jy(t){let e={};for(let r of t)e[r]=!0;return e}A.toHash=Jy;function Hy(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(mp(t,e),!hp(e,t.self.RULES.all))}A.alwaysValidSchema=Hy;function mp(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||yp(t,`unknown keyword: "${s}"`)}A.checkUnknownRules=mp;function hp(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}A.schemaHasRules=hp;function By(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}A.schemaHasRulesButRef=By;function Wy({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,J._)`${r}`}return(0,J._)`${t}${e}${(0,J.getProperty)(o)}`}A.schemaRefOrVal=Wy;function Ky(t){return gp(decodeURIComponent(t))}A.unescapeFragment=Ky;function Gy(t){return encodeURIComponent(mi(t))}A.escapeFragment=Gy;function mi(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}A.escapeJsonPointer=mi;function gp(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}A.unescapeJsonPointer=gp;function Yy(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}A.eachItem=Yy;function pp({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof J.Name?(s instanceof J.Name?t(n,s,i):e(n,s,i),i):s instanceof J.Name?(e(n,i,s),s):r(s,i);return a===J.Name&&!(c instanceof J.Name)?o(n,c):c}}A.mergeEvaluated={props:pp({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,J._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,J._)`${r} || {}`).code((0,J._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,J._)`${r} || {}`),hi(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:_p}),items:pp({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,J._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,J._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function _p(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,J._)`{}`);return e!==void 0&&hi(t,r,e),r}A.evaluatedPropsToName=_p;function hi(t,e,r){Object.keys(r).forEach(o=>t.assign((0,J._)`${e}${(0,J.getProperty)(o)}`,!0))}A.setEvaluated=hi;var fp={};function Qy(t,e){return t.scopeValue("func",{ref:e,code:fp[e.code]||(fp[e.code]=new Vy._Code(e.code))})}A.useFunc=Qy;var fi;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(fi||(A.Type=fi={}));function Xy(t,e,r){if(t instanceof J.Name){let o=e===fi.Num;return r?o?(0,J._)`"[" + ${t} + "]"`:(0,J._)`"['" + ${t} + "']"`:o?(0,J._)`"/" + ${t}`:(0,J._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,J.getProperty)(t).toString():"/"+mi(t)}A.getErrorPath=Xy;function yp(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}A.checkStrictMode=yp});var tt=v(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});var pe=I(),eb={data:new pe.Name("data"),valCxt:new pe.Name("valCxt"),instancePath:new pe.Name("instancePath"),parentData:new pe.Name("parentData"),parentDataProperty:new pe.Name("parentDataProperty"),rootData:new pe.Name("rootData"),dynamicAnchors:new pe.Name("dynamicAnchors"),vErrors:new pe.Name("vErrors"),errors:new pe.Name("errors"),this:new pe.Name("this"),self:new pe.Name("self"),scope:new pe.Name("scope"),json:new pe.Name("json"),jsonPos:new pe.Name("jsonPos"),jsonLen:new pe.Name("jsonLen"),jsonPart:new pe.Name("jsonPart")};gi.default=eb});var Fr=v(fe=>{"use strict";Object.defineProperty(fe,"__esModule",{value:!0});fe.extendErrors=fe.resetErrorsCount=fe.reportExtraError=fe.reportError=fe.keyword$DataError=fe.keywordError=void 0;var M=I(),tn=q(),_e=tt();fe.keywordError={message:({keyword:t})=>(0,M.str)`must pass "${t}" keyword validation`};fe.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,M.str)`"${t}" keyword must be ${e} ($data)`:(0,M.str)`"${t}" keyword is invalid ($data)`};function tb(t,e=fe.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=wp(t,e,r);o??(i||a)?bp(s,c):vp(n,(0,M._)`[${c}]`)}fe.reportError=tb;function rb(t,e=fe.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=wp(t,e,r);bp(n,a),s||i||vp(o,_e.default.vErrors)}fe.reportExtraError=rb;function ob(t,e){t.assign(_e.default.errors,e),t.if((0,M._)`${_e.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,M._)`${_e.default.vErrors}.length`,e),()=>t.assign(_e.default.vErrors,null)))}fe.resetErrorsCount=ob;function nb({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,_e.default.errors,a=>{t.const(i,(0,M._)`${_e.default.vErrors}[${a}]`),t.if((0,M._)`${i}.instancePath === undefined`,()=>t.assign((0,M._)`${i}.instancePath`,(0,M.strConcat)(_e.default.instancePath,s.errorPath))),t.assign((0,M._)`${i}.schemaPath`,(0,M.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,M._)`${i}.schema`,r),t.assign((0,M._)`${i}.data`,o))})}fe.extendErrors=nb;function bp(t,e){let r=t.const("err",e);t.if((0,M._)`${_e.default.vErrors} === null`,()=>t.assign(_e.default.vErrors,(0,M._)`[${r}]`),(0,M._)`${_e.default.vErrors}.push(${r})`),t.code((0,M._)`${_e.default.errors}++`)}function vp(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,M._)`new ${t.ValidationError}(${e})`):(r.assign((0,M._)`${o}.errors`,e),r.return(!1))}var kt={keyword:new M.Name("keyword"),schemaPath:new M.Name("schemaPath"),params:new M.Name("params"),propertyName:new M.Name("propertyName"),message:new M.Name("message"),schema:new M.Name("schema"),parentSchema:new M.Name("parentSchema")};function wp(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,M._)`{}`:sb(t,e,r)}function sb(t,e,r={}){let{gen:o,it:n}=t,s=[ib(n,r),ab(t,r)];return cb(t,e,s),o.object(...s)}function ib({errorPath:t},{instancePath:e}){let r=e?(0,M.str)`${t}${(0,tn.getErrorPath)(e,tn.Type.Str)}`:t;return[_e.default.instancePath,(0,M.strConcat)(_e.default.instancePath,r)]}function ab({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,M.str)`${e}/${t}`;return r&&(n=(0,M.str)`${n}${(0,tn.getErrorPath)(r,tn.Type.Str)}`),[kt.schemaPath,n]}function cb(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([kt.keyword,n],[kt.params,typeof e=="function"?e(t):e||(0,M._)`{}`]),c.messages&&o.push([kt.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([kt.schema,i],[kt.parentSchema,(0,M._)`${l}${d}`],[_e.default.data,s]),u&&o.push([kt.propertyName,u])}});var zp=v(Vt=>{"use strict";Object.defineProperty(Vt,"__esModule",{value:!0});Vt.boolOrEmptySchema=Vt.topBoolOrEmptySchema=void 0;var ub=Fr(),lb=I(),db=tt(),pb={message:"boolean schema is false"};function fb(t){let{gen:e,schema:r,validateName:o}=t;r===!1?$p(t,!1):typeof r=="object"&&r.$async===!0?e.return(db.default.data):(e.assign((0,lb._)`${o}.errors`,null),e.return(!0))}Vt.topBoolOrEmptySchema=fb;function mb(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),$p(t)):r.var(e,!0)}Vt.boolOrEmptySchema=mb;function $p(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,ub.reportError)(n,pb,void 0,e)}});var _i=v(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.getRules=Jt.isJSONType=void 0;var hb=["string","number","integer","boolean","null","object","array"],gb=new Set(hb);function _b(t){return typeof t=="string"&&gb.has(t)}Jt.isJSONType=_b;function yb(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Jt.getRules=yb});var yi=v(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.shouldUseRule=dt.shouldUseGroup=dt.schemaHasRulesForType=void 0;function bb({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&kp(t,o)}dt.schemaHasRulesForType=bb;function kp(t,e){return e.rules.some(r=>xp(t,r))}dt.shouldUseGroup=kp;function xp(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}dt.shouldUseRule=xp});var Vr=v(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.reportTypeError=me.checkDataTypes=me.checkDataType=me.coerceAndCheckDataType=me.getJSONTypes=me.getSchemaTypes=me.DataType=void 0;var vb=_i(),wb=yi(),$b=Fr(),O=I(),Sp=q(),Ht;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Ht||(me.DataType=Ht={}));function zb(t){let e=Pp(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}me.getSchemaTypes=zb;function Pp(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(vb.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}me.getJSONTypes=Pp;function kb(t,e){let{gen:r,data:o,opts:n}=t,s=xb(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,wb.schemaHasRulesForType)(t,e[0]));if(i){let a=vi(e,o,n.strictNumbers,Ht.Wrong);r.if(a,()=>{s.length?Sb(t,e,s):wi(t)})}return i}me.coerceAndCheckDataType=kb;var Ep=new Set(["string","number","integer","boolean","null"]);function xb(t,e){return e?t.filter(r=>Ep.has(r)||e==="array"&&r==="array"):[]}function Sb(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,O._)`typeof ${n}`),a=o.let("coerced",(0,O._)`undefined`);s.coerceTypes==="array"&&o.if((0,O._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,O._)`${n}[0]`).assign(i,(0,O._)`typeof ${n}`).if(vi(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,O._)`${a} !== undefined`);for(let u of r)(Ep.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),wi(t),o.endIf(),o.if((0,O._)`${a} !== undefined`,()=>{o.assign(n,a),Pb(t,a)});function c(u){switch(u){case"string":o.elseIf((0,O._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,O._)`"" + ${n}`).elseIf((0,O._)`${n} === null`).assign(a,(0,O._)`""`);return;case"number":o.elseIf((0,O._)`${i} == "boolean" || ${n} === null
|
|
4
|
+
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,O._)`+${n}`);return;case"integer":o.elseIf((0,O._)`${i} === "boolean" || ${n} === null
|
|
5
|
+
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,O._)`+${n}`);return;case"boolean":o.elseIf((0,O._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,O._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,O._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,O._)`${i} === "string" || ${i} === "number"
|
|
6
|
+
|| ${i} === "boolean" || ${n} === null`).assign(a,(0,O._)`[${n}]`)}}}function Pb({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,O._)`${e} !== undefined`,()=>t.assign((0,O._)`${e}[${r}]`,o))}function bi(t,e,r,o=Ht.Correct){let n=o===Ht.Correct?O.operators.EQ:O.operators.NEQ,s;switch(t){case"null":return(0,O._)`${e} ${n} null`;case"array":s=(0,O._)`Array.isArray(${e})`;break;case"object":s=(0,O._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,O._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,O._)`typeof ${e} ${n} ${t}`}return o===Ht.Correct?s:(0,O.not)(s);function i(a=O.nil){return(0,O.and)((0,O._)`typeof ${e} == "number"`,a,r?(0,O._)`isFinite(${e})`:O.nil)}}me.checkDataType=bi;function vi(t,e,r,o){if(t.length===1)return bi(t[0],e,r,o);let n,s=(0,Sp.toHash)(t);if(s.array&&s.object){let i=(0,O._)`typeof ${e} != "object"`;n=s.null?i:(0,O._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=O.nil;s.number&&delete s.integer;for(let i in s)n=(0,O.and)(n,bi(i,e,r,o));return n}me.checkDataTypes=vi;var Eb={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,O._)`{type: ${t}}`:(0,O._)`{type: ${e}}`};function wi(t){let e=Tb(t);(0,$b.reportError)(e,Eb)}me.reportTypeError=wi;function Tb(t){let{gen:e,data:r,schema:o}=t,n=(0,Sp.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var Rp=v(rn=>{"use strict";Object.defineProperty(rn,"__esModule",{value:!0});rn.assignDefaults=void 0;var Bt=I(),Rb=q();function Ob(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)Tp(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>Tp(t,s,n.default))}rn.assignDefaults=Ob;function Tp(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Bt._)`${s}${(0,Bt.getProperty)(e)}`;if(n){(0,Rb.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Bt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Bt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Bt._)`${a} = ${(0,Bt.stringify)(r)}`)}});var Ae=v(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var G=I(),$i=q(),pt=tt(),Ib=q();function Nb(t,e){let{gen:r,data:o,it:n}=t;r.if(ki(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,G._)`${e}`},!0),t.error()})}V.checkReportMissingProp=Nb;function Ab({gen:t,data:e,it:{opts:r}},o,n){return(0,G.or)(...o.map(s=>(0,G.and)(ki(t,e,s,r.ownProperties),(0,G._)`${n} = ${s}`)))}V.checkMissingProp=Ab;function Zb(t,e){t.setParams({missingProperty:e},!0),t.error()}V.reportMissingProp=Zb;function Op(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,G._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=Op;function zi(t,e,r){return(0,G._)`${Op(t)}.call(${e}, ${r})`}V.isOwnProperty=zi;function jb(t,e,r,o){let n=(0,G._)`${e}${(0,G.getProperty)(r)} !== undefined`;return o?(0,G._)`${n} && ${zi(t,e,r)}`:n}V.propertyInData=jb;function ki(t,e,r,o){let n=(0,G._)`${e}${(0,G.getProperty)(r)} === undefined`;return o?(0,G.or)(n,(0,G.not)(zi(t,e,r))):n}V.noPropertyInData=ki;function Ip(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}V.allSchemaProperties=Ip;function Cb(t,e){return Ip(e).filter(r=>!(0,$i.alwaysValidSchema)(t,e[r]))}V.schemaProperties=Cb;function Db({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,G._)`${t}, ${e}, ${o}${n}`:e,d=[[pt.default.instancePath,(0,G.strConcat)(pt.default.instancePath,s)],[pt.default.parentData,i.parentData],[pt.default.parentDataProperty,i.parentDataProperty],[pt.default.rootData,pt.default.rootData]];i.opts.dynamicRef&&d.push([pt.default.dynamicAnchors,pt.default.dynamicAnchors]);let p=(0,G._)`${l}, ${r.object(...d)}`;return c!==G.nil?(0,G._)`${a}.call(${c}, ${p})`:(0,G._)`${a}(${p})`}V.callValidateCode=Db;var qb=(0,G._)`new RegExp`;function Mb({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,G._)`${n.code==="new RegExp"?qb:(0,Ib.useFunc)(t,n)}(${r}, ${o})`})}V.usePattern=Mb;function Lb(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,G._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:$i.Type.Num},s),e.if((0,G.not)(s),a)})}}V.validateArray=Lb;function Ub(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,$i.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,G._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,G.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}V.validateUnion=Ub});var Zp=v(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.validateKeywordUsage=Ve.validSchemaType=Ve.funcKeywordCode=Ve.macroKeywordCode=void 0;var ye=I(),xt=tt(),Fb=Ae(),Vb=Fr();function Jb(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=Ap(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ye.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Ve.macroKeywordCode=Jb;function Hb(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;Wb(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=Ap(o,n,u),d=o.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)_(),e.modifying&&Np(t),y(()=>t.error());else{let b=e.async?f():m();e.modifying&&Np(t),y(()=>Bb(t,b))}}function f(){let b=o.let("ruleErrs",null);return o.try(()=>_((0,ye._)`await `),P=>o.assign(d,!1).if((0,ye._)`${P} instanceof ${c.ValidationError}`,()=>o.assign(b,(0,ye._)`${P}.errors`),()=>o.throw(P))),b}function m(){let b=(0,ye._)`${l}.errors`;return o.assign(b,null),_(ye.nil),b}function _(b=e.async?(0,ye._)`await `:ye.nil){let P=c.opts.passContext?xt.default.this:xt.default.self,z=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,ye._)`${b}${(0,Fb.callValidateCode)(t,l,P,z)}`,e.modifying)}function y(b){var P;o.if((0,ye.not)((P=e.valid)!==null&&P!==void 0?P:d),b)}}Ve.funcKeywordCode=Hb;function Np(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,ye._)`${o.parentData}[${o.parentDataProperty}]`))}function Bb(t,e){let{gen:r}=t;r.if((0,ye._)`Array.isArray(${e})`,()=>{r.assign(xt.default.vErrors,(0,ye._)`${xt.default.vErrors} === null ? ${e} : ${xt.default.vErrors}.concat(${e})`).assign(xt.default.errors,(0,ye._)`${xt.default.vErrors}.length`),(0,Vb.extendErrors)(t)},()=>t.error())}function Wb({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Ap(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ye.stringify)(r)})}function Kb(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}Ve.validSchemaType=Kb;function Gb({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ve.validateKeywordUsage=Gb});var Cp=v(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.extendSubschemaMode=ft.extendSubschemaData=ft.getSubschema=void 0;var Je=I(),jp=q();function Yb(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Je._)`${t.schemaPath}${(0,Je.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Je._)`${t.schemaPath}${(0,Je.getProperty)(e)}${(0,Je.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,jp.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}ft.getSubschema=Yb;function Qb(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Je._)`${e.data}${(0,Je.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Je.str)`${u}${(0,jp.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Je._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Je.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}ft.extendSubschemaData=Qb;function Xb(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}ft.extendSubschemaMode=Xb});var xi=v((nR,Dp)=>{"use strict";Dp.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Mp=v((sR,qp)=>{"use strict";var mt=qp.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};on(e,o,n,t,"",t)};mt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};mt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};mt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};mt.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 on(t,e,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in mt.arrayKeywords)for(var p=0;p<d.length;p++)on(t,e,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in mt.propsKeywords){if(d&&typeof d=="object")for(var f in d)on(t,e,r,d[f],n+"/"+l+"/"+ev(f),s,n,l,o,f)}else(l in mt.keywords||t.allKeys&&!(l in mt.skipKeywords))&&on(t,e,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function ev(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Jr=v($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.getSchemaRefs=$e.resolveUrl=$e.normalizeId=$e._getFullPath=$e.getFullPath=$e.inlineRef=void 0;var tv=q(),rv=xi(),ov=Mp(),nv=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function sv(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Si(t):e?Lp(t)<=e:!1}$e.inlineRef=sv;var iv=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Si(t){for(let e in t){if(iv.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Si)||typeof r=="object"&&Si(r))return!0}return!1}function Lp(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!nv.has(r)&&(typeof t[r]=="object"&&(0,tv.eachItem)(t[r],o=>e+=Lp(o)),e===1/0))return 1/0}return e}function Up(t,e="",r){r!==!1&&(e=Wt(e));let o=t.parse(e);return Fp(t,o)}$e.getFullPath=Up;function Fp(t,e){return t.serialize(e).split("#")[0]+"#"}$e._getFullPath=Fp;var av=/#\/?$/;function Wt(t){return t?t.replace(av,""):""}$e.normalizeId=Wt;function cv(t,e,r){return r=Wt(r),t.resolve(e,r)}$e.resolveUrl=cv;var uv=/^[a-z_][-a-z0-9._]*$/i;function lv(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Wt(t[r]||e),s={"":n},i=Up(o,n,!1),a={},c=new Set;return ov(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let _=i+p,y=s[m];typeof d[r]=="string"&&(y=b.call(this,d[r])),P.call(this,d.$anchor),P.call(this,d.$dynamicAnchor),s[p]=y;function b(z){let S=this.opts.uriResolver.resolve;if(z=Wt(y?S(y,z):z),c.has(z))throw l(z);c.add(z);let $=this.refs[z];return typeof $=="string"&&($=this.refs[$]),typeof $=="object"?u(d,$.schema,z):z!==Wt(_)&&(z[0]==="#"?(u(d,a[z],z),a[z]=d):this.refs[z]=_),z}function P(z){if(typeof z=="string"){if(!uv.test(z))throw new Error(`invalid anchor "${z}"`);b.call(this,`#${z}`)}}}),a;function u(d,p,f){if(p!==void 0&&!rv(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}$e.getSchemaRefs=lv});var Wr=v(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.getData=ht.KeywordCxt=ht.validateFunctionCode=void 0;var Wp=zp(),Vp=Vr(),Ei=yi(),nn=Vr(),dv=Rp(),Br=Zp(),Pi=Cp(),x=I(),T=tt(),pv=Jr(),rt=q(),Hr=Fr();function fv(t){if(Yp(t)&&(Qp(t),Gp(t))){gv(t);return}Kp(t,()=>(0,Wp.topBoolOrEmptySchema)(t))}ht.validateFunctionCode=fv;function Kp({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,x._)`${T.default.data}, ${T.default.valCxt}`,o.$async,()=>{t.code((0,x._)`"use strict"; ${Jp(r,n)}`),hv(t,n),t.code(s)}):t.func(e,(0,x._)`${T.default.data}, ${mv(n)}`,o.$async,()=>t.code(Jp(r,n)).code(s))}function mv(t){return(0,x._)`{${T.default.instancePath}="", ${T.default.parentData}, ${T.default.parentDataProperty}, ${T.default.rootData}=${T.default.data}${t.dynamicRef?(0,x._)`, ${T.default.dynamicAnchors}={}`:x.nil}}={}`}function hv(t,e){t.if(T.default.valCxt,()=>{t.var(T.default.instancePath,(0,x._)`${T.default.valCxt}.${T.default.instancePath}`),t.var(T.default.parentData,(0,x._)`${T.default.valCxt}.${T.default.parentData}`),t.var(T.default.parentDataProperty,(0,x._)`${T.default.valCxt}.${T.default.parentDataProperty}`),t.var(T.default.rootData,(0,x._)`${T.default.valCxt}.${T.default.rootData}`),e.dynamicRef&&t.var(T.default.dynamicAnchors,(0,x._)`${T.default.valCxt}.${T.default.dynamicAnchors}`)},()=>{t.var(T.default.instancePath,(0,x._)`""`),t.var(T.default.parentData,(0,x._)`undefined`),t.var(T.default.parentDataProperty,(0,x._)`undefined`),t.var(T.default.rootData,T.default.data),e.dynamicRef&&t.var(T.default.dynamicAnchors,(0,x._)`{}`)})}function gv(t){let{schema:e,opts:r,gen:o}=t;Kp(t,()=>{r.$comment&&e.$comment&&ef(t),wv(t),o.let(T.default.vErrors,null),o.let(T.default.errors,0),r.unevaluated&&_v(t),Xp(t),kv(t)})}function _v(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,x._)`${r}.evaluated`),e.if((0,x._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,x._)`${t.evaluated}.props`,(0,x._)`undefined`)),e.if((0,x._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,x._)`${t.evaluated}.items`,(0,x._)`undefined`))}function Jp(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,x._)`/*# sourceURL=${r} */`:x.nil}function yv(t,e){if(Yp(t)&&(Qp(t),Gp(t))){bv(t,e);return}(0,Wp.boolOrEmptySchema)(t,e)}function Gp({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Yp(t){return typeof t.schema!="boolean"}function bv(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&ef(t),$v(t),zv(t);let s=o.const("_errs",T.default.errors);Xp(t,s),o.var(e,(0,x._)`${s} === ${T.default.errors}`)}function Qp(t){(0,rt.checkUnknownRules)(t),vv(t)}function Xp(t,e){if(t.opts.jtd)return Hp(t,[],!1,e);let r=(0,Vp.getSchemaTypes)(t.schema),o=(0,Vp.coerceAndCheckDataType)(t,r);Hp(t,r,!o,e)}function vv(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,rt.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function wv(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,rt.checkStrictMode)(t,"default is ignored in the schema root")}function $v(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,pv.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function zv(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ef({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,x._)`${T.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,x.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,x._)`${T.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function kv(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,x._)`${T.default.errors} === 0`,()=>e.return(T.default.data),()=>e.throw((0,x._)`new ${n}(${T.default.vErrors})`)):(e.assign((0,x._)`${o}.errors`,T.default.vErrors),s.unevaluated&&xv(t),e.return((0,x._)`${T.default.errors} === 0`))}function xv({gen:t,evaluated:e,props:r,items:o}){r instanceof x.Name&&t.assign((0,x._)`${e}.props`,r),o instanceof x.Name&&t.assign((0,x._)`${e}.items`,o)}function Hp(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,rt.schemaHasRulesButRef)(s,l))){n.block(()=>rf(t,"$ref",l.all.$ref.definition));return}c.jtd||Sv(t,e),n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Ei.shouldUseGroup)(s,p)&&(p.type?(n.if((0,nn.checkDataType)(p.type,i,c.strictNumbers)),Bp(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,nn.reportTypeError)(t)),n.endIf()):Bp(t,p),a||n.if((0,x._)`${T.default.errors} === ${o||0}`))}}function Bp(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,dv.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Ei.shouldUseRule)(o,s)&&rf(t,s.keyword,s.definition,e.type)})}function Sv(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Pv(t,e),t.opts.allowUnionTypes||Ev(t,e),Tv(t,t.dataTypes))}function Pv(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{tf(t.dataTypes,r)||Ti(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Ov(t,e)}}function Ev(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ti(t,"use allowUnionTypes to allow union type keyword")}function Tv(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Ei.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>Rv(e,i))&&Ti(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Rv(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function tf(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Ov(t,e){let r=[];for(let o of t.dataTypes)tf(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function Ti(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,rt.checkStrictMode)(t,e,t.opts.strictTypes)}var sn=class{constructor(e,r,o){if((0,Br.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,rt.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",of(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Br.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",T.default.errors))}result(e,r,o){this.failResult((0,x.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,x.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,x._)`${r} !== undefined && (${(0,x.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?Hr.reportExtraError:Hr.reportError)(this,this.def.error,r)}$dataError(){(0,Hr.reportError)(this,this.def.$dataError||Hr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Hr.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=x.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=x.nil,r=x.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,x.or)((0,x._)`${n} === undefined`,r)),e!==x.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==x.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,x.or)(i(),a());function i(){if(o.length){if(!(r instanceof x.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,x._)`${(0,nn.checkDataTypes)(c,r,s.opts.strictNumbers,nn.DataType.Wrong)}`}return x.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,x._)`!${c}(${r})`}return x.nil}}subschema(e,r){let o=(0,Pi.getSubschema)(this.it,e);(0,Pi.extendSubschemaData)(o,this.it,e),(0,Pi.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return yv(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=rt.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=rt.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,x.Name)),!0}};ht.KeywordCxt=sn;function rf(t,e,r,o){let n=new sn(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Br.funcKeywordCode)(n,r):"macro"in r?(0,Br.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Br.funcKeywordCode)(n,r)}var Iv=/^\/(?:[^~]|~0|~1)*$/,Nv=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function of(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return T.default.rootData;if(t[0]==="/"){if(!Iv.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=T.default.rootData}else{let u=Nv.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,x._)`${s}${(0,x.getProperty)((0,rt.unescapeJsonPointer)(u))}`,i=(0,x._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}ht.getData=of});var an=v(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});var Ri=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Oi.default=Ri});var Kr=v(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0});var Ii=Jr(),Ni=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Ii.resolveUrl)(e,r,o),this.missingSchema=(0,Ii.normalizeId)((0,Ii.getFullPath)(e,this.missingRef))}};Ai.default=Ni});var un=v(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.resolveSchema=Ze.getCompilingSchema=Ze.resolveRef=Ze.compileSchema=Ze.SchemaEnv=void 0;var qe=I(),Av=an(),St=tt(),Me=Jr(),nf=q(),Zv=Wr(),Kt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Me.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};Ze.SchemaEnv=Kt;function ji(t){let e=sf.call(this,t);if(e)return e;let r=(0,Me.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new qe.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:Av.default,code:(0,qe._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:St.default.data,parentData:St.default.parentData,parentDataProperty:St.default.parentDataProperty,dataNames:[St.default.data],dataPathArr:[qe.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,qe.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:qe.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,qe._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Zv.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(St.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${St.default.self}`,`${St.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:_}=u;f.evaluated={props:m instanceof qe.Name?void 0:m,items:_ instanceof qe.Name?void 0:_,dynamicProps:m instanceof qe.Name,dynamicItems:_ instanceof qe.Name},f.source&&(f.source.evaluated=(0,qe.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}Ze.compileSchema=ji;function jv(t,e,r){var o;r=(0,Me.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=qv.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new Kt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=Cv.call(this,s)}Ze.resolveRef=jv;function Cv(t){return(0,Me.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ji.call(this,t)}function sf(t){for(let e of this._compilations)if(Dv(e,t))return e}Ze.getCompilingSchema=sf;function Dv(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function qv(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||cn.call(this,t,e)}function cn(t,e){let r=this.opts.uriResolver.parse(e),o=(0,Me._getFullPath)(this.opts.uriResolver,r),n=(0,Me.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return Zi.call(this,r,t);let s=(0,Me.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=cn.call(this,t,i);return typeof a?.schema!="object"?void 0:Zi.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||ji.call(this,i),s===(0,Me.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Me.resolveUrl)(this.opts.uriResolver,n,u)),new Kt({schema:a,schemaId:c,root:t,baseId:n})}return Zi.call(this,r,i)}}Ze.resolveSchema=cn;var Mv=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Zi(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,nf.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Mv.has(a)&&u&&(e=(0,Me.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,nf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Me.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=cn.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Kt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var af=v((dR,Lv)=>{Lv.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 qi=v((pR,ff)=>{"use strict";var Uv=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),uf=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),Ci=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),lf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Fv=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Di(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var Vv=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function cf(t){return t.length=0,!0}function Jv(t,e,r){if(t.length){let o=Di(t);if(o!=="")e.push(o);else return r.error=!0,!1;t.length=0}return!0}function Hv(t){let e=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Jv;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=cf}else{n.push(u);continue}}return n.length&&(a===cf?r.zone=n.join(""):i?o.push(n.join("")):o.push(Di(n))),r.address=o.join(""),r}function df(t){if(Bv(t,":")<2)return{host:t,isIPV6:!1};let e=Hv(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,o=e.address;return e.zone&&(r+="%"+e.zone,o+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:o}}}function Bv(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function Wv(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var Kv={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Gv=/[@/?#:]/g,Yv=/[@/?#]/g;function pf(t,e){let r=e?Yv:Gv;return r.lastIndex=0,t.replace(r,o=>Kv[o])}function Qv(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(Ci(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&lf(i)?r+=i:r+="%"+s,o+=2;continue}}r+=t[o]}return r}function Xv(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(Ci(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&lf(s)?e+=s:e+="%"+n,r+=2;continue}}Fv(t[r])?e+=t[r]:e+=escape(t[r])}return e}function ew(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(Ci(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function tw(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!uf(r)){let o=df(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=pf(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}ff.exports={nonSimpleDomain:Vv,recomposeAuthority:tw,reescapeHostDelimiters:pf,normalizePercentEncoding:Qv,normalizePathEncoding:Xv,escapePreservingEscapes:ew,removeDotSegments:Wv,isIPv4:uf,isUUID:Uv,normalizeIPv6:df,stringArrayToHexStripped:Di}});var yf=v((fR,_f)=>{"use strict";var{isUUID:rw}=qi(),ow=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,nw=["http","https","ws","wss","urn","urn:uuid"];function sw(t){return nw.indexOf(t)!==-1}function Mi(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function mf(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function hf(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function iw(t){return t.secure=Mi(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function aw(t){if((t.port===(Mi(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function cw(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(ow);if(r){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=Li(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function uw(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=Li(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function lw(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!rw(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function dw(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var gf={scheme:"http",domainHost:!0,parse:mf,serialize:hf},pw={scheme:"https",domainHost:gf.domainHost,parse:mf,serialize:hf},ln={scheme:"ws",domainHost:!0,parse:iw,serialize:aw},fw={scheme:"wss",domainHost:ln.domainHost,parse:ln.parse,serialize:ln.serialize},mw={scheme:"urn",parse:cw,serialize:uw,skipNormalize:!0},hw={scheme:"urn:uuid",parse:lw,serialize:dw,skipNormalize:!0},dn={http:gf,https:pw,ws:ln,wss:fw,urn:mw,"urn:uuid":hw};Object.setPrototypeOf(dn,null);function Li(t){return t&&(dn[t]||dn[t.toLowerCase()])||void 0}_f.exports={wsIsSecure:Mi,SCHEMES:dn,isValidSchemeName:sw,getSchemeHandler:Li}});var kf=v((mR,pn)=>{"use strict";var{normalizeIPv6:gw,removeDotSegments:Gr,recomposeAuthority:_w,normalizePercentEncoding:yw,normalizePathEncoding:bw,escapePreservingEscapes:vw,reescapeHostDelimiters:ww,isIPv4:$w,nonSimpleDomain:zw}=qi(),{SCHEMES:kw,getSchemeHandler:vf}=yf();function xw(t,e){return typeof t=="string"?t=Rw(t,e):typeof t=="object"&&(t=Gt(Pt(t,e),e)),t}function Sw(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=wf(Gt(t,o),Gt(e,o),o,!0);return o.skipEscape=!0,Pt(n,o)}function wf(t,e,r,o){let n={};return o||(t=Gt(Pt(t,r),r),e=Gt(Pt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Gr(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Gr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Gr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=Gr(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function Pw(t,e,r){let o=bf(t,r),n=bf(e,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Pt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[],s=vf(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=yw(r.path):(r.path=vw(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=_w(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=Gr(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var Ew=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Tw(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function $f(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(Ew);if(i){o.scheme=i[1],o.userinfo=i[3],o.host=i[4],o.port=parseInt(i[5],10),o.path=i[6]||"",o.query=i[7],o.fragment=i[8],isNaN(o.port)&&(o.port=i[5]);let a=Tw(o,i);if(a!==void 0&&(o.error=o.error||a,n=!0),o.host)if($w(o.host)===!1){let l=gw(o.host);o.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let c=vf(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&o.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&zw(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=ww(unescape(o.host),s))),o.path&&(o.path=bw(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}c&&c.parse&&c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function Gt(t,e){return $f(t,e).parsed}function Rw(t,e){return zf(t,e).normalized}function zf(t,e){let{parsed:r,malformedAuthorityOrPort:o}=$f(t,e);return{normalized:o?t:Pt(r,e),malformedAuthorityOrPort:o}}function bf(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:o}=zf(t,e);return o?void 0:r}if(typeof t=="object")return Pt(t,e)}var Ui={SCHEMES:kw,normalize:xw,resolve:Sw,resolveComponent:wf,equal:Pw,serialize:Pt,parse:Gt};pn.exports=Ui;pn.exports.default=Ui;pn.exports.fastUri=Ui});var Sf=v(Fi=>{"use strict";Object.defineProperty(Fi,"__esModule",{value:!0});var xf=kf();xf.code='require("ajv/dist/runtime/uri").default';Fi.default=xf});var Af=v(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CodeGen=le.Name=le.nil=le.stringify=le.str=le._=le.KeywordCxt=void 0;var Ow=Wr();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return Ow.KeywordCxt}});var Yt=I();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return Yt._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return Yt.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return Yt.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return Yt.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return Yt.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return Yt.CodeGen}});var Iw=an(),Of=Kr(),Nw=_i(),Yr=un(),Aw=I(),Qr=Jr(),fn=Vr(),Ji=q(),Pf=af(),Zw=Sf(),If=(t,e)=>new RegExp(t,e);If.code="new RegExp";var jw=["removeAdditional","useDefaults","coerceTypes"],Cw=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Dw={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."},qw={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Ef=200;function Mw(t){var e,r,o,n,s,i,a,c,u,l,d,p,f,m,_,y,b,P,z,S,$,ke,Te,ir,An;let ar=t.strict,Zn=(e=t.code)===null||e===void 0?void 0:e.optimize,Fa=Zn===!0||Zn===void 0?1:Zn||0,Va=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:If,sh=(n=t.uriResolver)!==null&&n!==void 0?n:Zw.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:ar)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:ar)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:ar)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:ar)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:ar)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Fa,regExp:Va}:{optimize:Fa,regExp:Va},loopRequired:(_=t.loopRequired)!==null&&_!==void 0?_:Ef,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:Ef,meta:(b=t.meta)!==null&&b!==void 0?b:!0,messages:(P=t.messages)!==null&&P!==void 0?P:!0,inlineRefs:(z=t.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(S=t.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:($=t.addUsedSchema)!==null&&$!==void 0?$:!0,validateSchema:(ke=t.validateSchema)!==null&&ke!==void 0?ke:!0,validateFormats:(Te=t.validateFormats)!==null&&Te!==void 0?Te:!0,unicodeRegExp:(ir=t.unicodeRegExp)!==null&&ir!==void 0?ir:!0,int32range:(An=t.int32range)!==null&&An!==void 0?An:!0,uriResolver:sh}}var Xr=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Mw(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new Aw.ValueScope({scope:{},prefixes:Cw,es5:r,lines:o}),this.logger=Hw(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Nw.getRules)(),Tf.call(this,Dw,e,"NOT SUPPORTED"),Tf.call(this,qw,e,"DEPRECATED","warn"),this._metaOpts=Vw.call(this),e.formats&&Uw.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Fw.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Lw.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=Pf;o==="id"&&(n={...Pf},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Of.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Qr.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=Rf.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new Yr.SchemaEnv({schema:{},schemaId:o});if(r=Yr.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Rf.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,Qr.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Ww.call(this,o,r),!r)return(0,Ji.eachItem)(o,s=>Vi.call(this,s)),this;Gw.call(this,r);let n={...r,type:(0,fn.getJSONTypes)(r.type),schemaType:(0,fn.getJSONTypes)(r.schemaType)};return(0,Ji.eachItem)(o,n.type.length===0?s=>Vi.call(this,s,n):s=>n.type.forEach(i=>Vi.call(this,s,n,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Nf(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,Qr.normalizeId)(i||o);let u=Qr.getSchemaRefs.call(this,e,o);return c=new Yr.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Yr.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Yr.compileSchema.call(this,e)}finally{this.opts=r}}};Xr.ValidationError=Iw.default;Xr.MissingRefError=Of.default;le.default=Xr;function Tf(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function Rf(t){return t=(0,Qr.normalizeId)(t),this.schemas[t]||this.refs[t]}function Lw(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Uw(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Fw(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Vw(){let t={...this.opts};for(let e of jw)delete t[e];return t}var Jw={log(){},warn(){},error(){}};function Hw(t){if(t===!1)return Jw;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Bw=/^[a-z_$][a-z0-9_$:-]*$/i;function Ww(t,e){let{RULES:r}=this;if((0,Ji.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!Bw.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Vi(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,fn.getJSONTypes)(e.type),schemaType:(0,fn.getJSONTypes)(e.schemaType)}};e.before?Kw.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function Kw(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Gw(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Nf(e)),t.validateSchema=this.compile(e,!0))}var Yw={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Nf(t){return{anyOf:[t,Yw]}}});var Zf=v(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Qw={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Hi.default=Qw});var qf=v(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.callRef=Et.getValidate=void 0;var Xw=Kr(),jf=Ae(),ze=I(),Qt=tt(),Cf=un(),mn=q(),e$={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=Cf.resolveRef.call(c,u,n,r);if(l===void 0)throw new Xw.default(o.opts.uriResolver,n,r);if(l instanceof Cf.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return hn(t,i,s,s.$async);let m=e.scopeValue("root",{ref:u});return hn(t,(0,ze._)`${m}.validate`,u,u.$async)}function p(m){let _=Df(t,m);hn(t,_,m,m.$async)}function f(m){let _=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,ze.stringify)(m)}:{ref:m}),y=e.name("valid"),b=t.subschema({schema:m,dataTypes:[],schemaPath:ze.nil,topSchemaRef:_,errSchemaPath:r},y);t.mergeEvaluated(b),t.ok(y)}}};function Df(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,ze._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Et.getValidate=Df;function hn(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Qt.default.this:ze.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,ze._)`await ${(0,jf.callValidateCode)(t,e,u)}`),f(e),i||n.assign(m,!0)},_=>{n.if((0,ze._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),p(_),i||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,jf.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(m){let _=(0,ze._)`${m}.errors`;n.assign(Qt.default.vErrors,(0,ze._)`${Qt.default.vErrors} === null ? ${_} : ${Qt.default.vErrors}.concat(${_})`),n.assign(Qt.default.errors,(0,ze._)`${Qt.default.vErrors}.length`)}function f(m){var _;if(!s.opts.unevaluated)return;let y=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=mn.mergeEvaluated.props(n,y.props,s.props));else{let b=n.var("props",(0,ze._)`${m}.evaluated.props`);s.props=mn.mergeEvaluated.props(n,b,s.props,ze.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=mn.mergeEvaluated.items(n,y.items,s.items));else{let b=n.var("items",(0,ze._)`${m}.evaluated.items`);s.items=mn.mergeEvaluated.items(n,b,s.items,ze.Name)}}}Et.callRef=hn;Et.default=e$});var Mf=v(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var t$=Zf(),r$=qf(),o$=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t$.default,r$.default];Bi.default=o$});var Lf=v(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var gn=I(),gt=gn.operators,_n={maximum:{okStr:"<=",ok:gt.LTE,fail:gt.GT},minimum:{okStr:">=",ok:gt.GTE,fail:gt.LT},exclusiveMaximum:{okStr:"<",ok:gt.LT,fail:gt.GTE},exclusiveMinimum:{okStr:">",ok:gt.GT,fail:gt.LTE}},n$={message:({keyword:t,schemaCode:e})=>(0,gn.str)`must be ${_n[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gn._)`{comparison: ${_n[t].okStr}, limit: ${e}}`},s$={keyword:Object.keys(_n),type:"number",schemaType:"number",$data:!0,error:n$,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,gn._)`${r} ${_n[e].fail} ${o} || isNaN(${r})`)}};Wi.default=s$});var Uf=v(Ki=>{"use strict";Object.defineProperty(Ki,"__esModule",{value:!0});var eo=I(),i$={message:({schemaCode:t})=>(0,eo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,eo._)`{multipleOf: ${t}}`},a$={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:i$,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,eo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,eo._)`${i} !== parseInt(${i})`;t.fail$data((0,eo._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Ki.default=a$});var Vf=v(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});function Ff(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}Gi.default=Ff;Ff.code='require("ajv/dist/runtime/ucs2length").default'});var Jf=v(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var Tt=I(),c$=q(),u$=Vf(),l$={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Tt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Tt._)`{limit: ${t}}`},d$={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:l$,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?Tt.operators.GT:Tt.operators.LT,i=n.opts.unicode===!1?(0,Tt._)`${r}.length`:(0,Tt._)`${(0,c$.useFunc)(t.gen,u$.default)}(${r})`;t.fail$data((0,Tt._)`${i} ${s} ${o}`)}};Yi.default=d$});var Hf=v(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});var p$=Ae(),f$=q(),Xt=I(),m$={message:({schemaCode:t})=>(0,Xt.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Xt._)`{pattern: ${t}}`},h$={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:m$,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,Xt._)`new RegExp`:(0,f$.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Xt._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Xt._)`!${l}`)}else{let c=(0,p$.usePattern)(t,n);t.fail$data((0,Xt._)`!${c}.test(${r})`)}}};Qi.default=h$});var Bf=v(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var to=I(),g$={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,to.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,to._)`{limit: ${t}}`},_$={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:g$,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?to.operators.GT:to.operators.LT;t.fail$data((0,to._)`Object.keys(${r}).length ${n} ${o}`)}};Xi.default=_$});var Wf=v(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});var ro=Ae(),oo=I(),y$=q(),b$={message:({params:{missingProperty:t}})=>(0,oo.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,oo._)`{missingProperty: ${t}}`},v$={keyword:"required",type:"object",schemaType:"array",$data:!0,error:b$,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let _ of r)if(f?.[_]===void 0&&!m.has(_)){let y=i.schemaEnv.baseId+i.errSchemaPath,b=`required property "${_}" is not defined at "${y}" (strictRequired)`;(0,y$.checkStrictMode)(i,b,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(oo.nil,d);else for(let f of r)(0,ro.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,ro.checkMissingProp)(t,r,f)),(0,ro.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",o,f=>{t.setParams({missingProperty:f}),e.if((0,ro.noPropertyInData)(e,n,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,o,()=>{e.assign(m,(0,ro.propertyInData)(e,n,f,a.ownProperties)),e.if((0,oo.not)(m),()=>{t.error(),e.break()})},oo.nil)}}};ea.default=v$});var Kf=v(ta=>{"use strict";Object.defineProperty(ta,"__esModule",{value:!0});var no=I(),w$={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,no.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,no._)`{limit: ${t}}`},$$={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:w$,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?no.operators.GT:no.operators.LT;t.fail$data((0,no._)`${r}.length ${n} ${o}`)}};ta.default=$$});var yn=v(ra=>{"use strict";Object.defineProperty(ra,"__esModule",{value:!0});var Gf=xi();Gf.code='require("ajv/dist/runtime/equal").default';ra.default=Gf});var Yf=v(na=>{"use strict";Object.defineProperty(na,"__esModule",{value:!0});var oa=Vr(),de=I(),z$=q(),k$=yn(),x$={message:({params:{i:t,j:e}})=>(0,de.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,de._)`{i: ${t}, j: ${e}}`},S$={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:x$,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=s.items?(0,oa.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,de._)`${i} === false`),t.ok(c);function l(){let m=e.let("i",(0,de._)`${r}.length`),_=e.let("j");t.setParams({i:m,j:_}),e.assign(c,!0),e.if((0,de._)`${m} > 1`,()=>(d()?p:f)(m,_))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,_){let y=e.name("item"),b=(0,oa.checkDataTypes)(u,y,a.opts.strictNumbers,oa.DataType.Wrong),P=e.const("indices",(0,de._)`{}`);e.for((0,de._)`;${m}--;`,()=>{e.let(y,(0,de._)`${r}[${m}]`),e.if(b,(0,de._)`continue`),u.length>1&&e.if((0,de._)`typeof ${y} == "string"`,(0,de._)`${y} += "_"`),e.if((0,de._)`typeof ${P}[${y}] == "number"`,()=>{e.assign(_,(0,de._)`${P}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,de._)`${P}[${y}] = ${m}`)})}function f(m,_){let y=(0,z$.useFunc)(e,k$.default),b=e.name("outer");e.label(b).for((0,de._)`;${m}--;`,()=>e.for((0,de._)`${_} = ${m}; ${_}--;`,()=>e.if((0,de._)`${y}(${r}[${m}], ${r}[${_}])`,()=>{t.error(),e.assign(c,!1).break(b)})))}}};na.default=S$});var Qf=v(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var sa=I(),P$=q(),E$=yn(),T$={message:"must be equal to constant",params:({schemaCode:t})=>(0,sa._)`{allowedValue: ${t}}`},R$={keyword:"const",$data:!0,error:T$,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,sa._)`!${(0,P$.useFunc)(e,E$.default)}(${r}, ${n})`):t.fail((0,sa._)`${s} !== ${r}`)}};ia.default=R$});var Xf=v(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var so=I(),O$=q(),I$=yn(),N$={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,so._)`{allowedValues: ${t}}`},A$={keyword:"enum",schemaType:"array",$data:!0,error:N$,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,O$.useFunc)(e,I$.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,so.or)(...n.map((m,_)=>p(f,_)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,so._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,m){let _=n[m];return typeof _=="object"&&_!==null?(0,so._)`${u()}(${r}, ${f}[${m}])`:(0,so._)`${r} === ${_}`}}};aa.default=A$});var em=v(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var Z$=Lf(),j$=Uf(),C$=Jf(),D$=Hf(),q$=Bf(),M$=Wf(),L$=Kf(),U$=Yf(),F$=Qf(),V$=Xf(),J$=[Z$.default,j$.default,C$.default,D$.default,q$.default,M$.default,L$.default,U$.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},F$.default,V$.default];ca.default=J$});var la=v(io=>{"use strict";Object.defineProperty(io,"__esModule",{value:!0});io.validateAdditionalItems=void 0;var Rt=I(),ua=q(),H$={message:({params:{len:t}})=>(0,Rt.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Rt._)`{limit: ${t}}`},B$={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:H$,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,ua.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}tm(t,o)}};function tm(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Rt._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,Rt._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,ua.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,Rt._)`${a} <= ${e.length}`);r.if((0,Rt.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:ua.Type.Num},u),i.allErrors||r.if((0,Rt.not)(u),()=>r.break())})}}io.validateAdditionalItems=tm;io.default=B$});var da=v(ao=>{"use strict";Object.defineProperty(ao,"__esModule",{value:!0});ao.validateTuple=void 0;var rm=I(),bn=q(),W$=Ae(),K$={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return om(t,"additionalItems",e);r.items=!0,!(0,bn.alwaysValidSchema)(r,e)&&t.ok((0,W$.validateArray)(t))}};function om(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=bn.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,rm._)`${s}.length`);r.forEach((d,p)=>{(0,bn.alwaysValidSchema)(a,d)||(o.if((0,rm._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,m=r.length,_=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!_){let y=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,bn.checkStrictMode)(a,y,p.strictTuples)}}}ao.validateTuple=om;ao.default=K$});var nm=v(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var G$=da(),Y$={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,G$.validateTuple)(t,"items")};pa.default=Y$});var im=v(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var sm=I(),Q$=q(),X$=Ae(),e0=la(),t0={message:({params:{len:t}})=>(0,sm.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,sm._)`{limit: ${t}}`},r0={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:t0,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,Q$.alwaysValidSchema)(o,e)&&(n?(0,e0.validateAdditionalItems)(t,n):t.ok((0,X$.validateArray)(t)))}};fa.default=r0});var am=v(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var je=I(),vn=q(),o0={message:({params:{min:t,max:e}})=>e===void 0?(0,je.str)`must contain at least ${t} valid item(s)`:(0,je.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,je._)`{minContains: ${t}}`:(0,je._)`{minContains: ${t}, maxContains: ${e}}`},n0={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:o0,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,je._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,vn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,vn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,vn.alwaysValidSchema)(s,r)){let _=(0,je._)`${l} >= ${i}`;a!==void 0&&(_=(0,je._)`${_} && ${l} <= ${a}`),t.pass(_);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,je._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let _=e.name("_valid"),y=e.let("count",0);f(_,()=>e.if(_,()=>m(y)))}function f(_,y){e.forRange("i",0,l,b=>{t.subschema({keyword:"contains",dataProp:b,dataPropType:vn.Type.Num,compositeRule:!0},_),y()})}function m(_){e.code((0,je._)`${_}++`),a===void 0?e.if((0,je._)`${_} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,je._)`${_} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,je._)`${_} >= ${i}`,()=>e.assign(d,!0)))}}};ma.default=n0});var lm=v(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.validateSchemaDeps=He.validatePropertyDeps=He.error=void 0;var ha=I(),s0=q(),co=Ae();He.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,ha.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,ha._)`{property: ${t},
|
|
7
7
|
missingProperty: ${o},
|
|
8
8
|
depsCount: ${e},
|
|
9
|
-
deps: ${r}}`};var ix={keyword:"dependencies",type:"object",schemaType:"object",error:Je.error,code(t){let[e,r]=ax(t);cm(t,e),um(t,r)}};function ax({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function cm(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,co.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,co.checkReportMissingProp)(t,u)}):(r.if((0,ha._)`${c} && (${(0,co.checkMissingProp)(t,a,s)})`),(0,co.reportMissingProp)(t,s),r.else())}}Je.validatePropertyDeps=cm;function um(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,sx.alwaysValidSchema)(s,e[a])||(r.if((0,co.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Je.validateSchemaDeps=um;Je.default=ix});var pm=v(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var dm=O(),cx=M(),ux={message:"property name must be valid",params:({params:t})=>(0,dm._)`{propertyName: ${t.propertyName}}`},lx={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ux,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,cx.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,dm.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};ga.default=lx});var _a=v(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var wn=Ne(),Le=O(),dx=tt(),$n=M(),px={message:"must NOT have additional properties",params:({params:t})=>(0,Le._)`{additionalProperty: ${t.additionalProperty}}`},fx={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:px,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,$n.alwaysValidSchema)(i,r))return;let u=(0,wn.allSchemaProperties)(o.properties),l=(0,wn.allSchemaProperties)(o.patternProperties);d(),t.ok((0,Le._)`${s} === ${dx.default.errors}`);function d(){e.forIn("key",n,_=>{!u.length&&!l.length?m(_):e.if(p(_),()=>m(_))})}function p(_){let b;if(u.length>8){let P=(0,$n.schemaRefOrVal)(i,o.properties,"properties");b=(0,wn.isOwnProperty)(e,P,_)}else u.length?b=(0,Le.or)(...u.map(P=>(0,Le._)`${_} === ${P}`)):b=Le.nil;return l.length&&(b=(0,Le.or)(b,...l.map(P=>(0,Le._)`${(0,wn.usePattern)(t,P)}.test(${_})`))),(0,Le.not)(b)}function f(_){e.code((0,Le._)`delete ${n}[${_}]`)}function m(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,$n.alwaysValidSchema)(i,r)){let b=e.name("valid");c.removeAdditional==="failing"?(y(_,b,!1),e.if((0,Le.not)(b),()=>{t.reset(),f(_)})):(y(_,b),a||e.if((0,Le.not)(b),()=>e.break()))}}function y(_,b,P){let x={keyword:"additionalProperties",dataProp:_,dataPropType:$n.Type.Str};P===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(x,b)}}};ya.default=fx});var hm=v(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var mx=Hr(),fm=Ne(),ba=M(),mm=_a(),hx={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&mm.default.code(new mx.KeywordCxt(s,mm.default,"additionalProperties"));let i=(0,fm.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=ba.mergeEvaluated.props(e,(0,ba.toHash)(i),s.props));let a=i.filter(d=>!(0,ba.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,fm.propertyInData)(e,n,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};va.default=hx});var bm=v(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var gm=Ne(),xn=O(),ym=M(),_m=M(),gx={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,gm.allSchemaProperties)(r),c=a.filter(y=>(0,ym.alwaysValidSchema)(s,r[y]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof xn.Name)&&(s.props=(0,_m.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let y of a)u&&f(y),s.allErrors?m(y):(e.var(l,!0),m(y),e.if(l))}function f(y){for(let _ in u)new RegExp(y).test(_)&&(0,ym.checkStrictMode)(s,`property ${_} matches pattern ${y} (use allowMatchingProperties)`)}function m(y){e.forIn("key",o,_=>{e.if((0,xn._)`${(0,gm.usePattern)(t,y)}.test(${_})`,()=>{let b=c.includes(y);b||t.subschema({keyword:"patternProperties",schemaProp:y,dataProp:_,dataPropType:_m.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,xn._)`${d}[${_}]`,!0):!b&&!s.allErrors&&e.if((0,xn.not)(l),()=>e.break())})})}}};wa.default=gx});var vm=v($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var yx=M(),_x={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,yx.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};$a.default=_x});var wm=v(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});var bx=Ne(),vx={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:bx.validateUnion,error:{message:"must match a schema in anyOf"}};xa.default=vx});var $m=v(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var kn=O(),wx=M(),$x={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,kn._)`{passingSchemas: ${t.passing}}`},xx={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:$x,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,wx.alwaysValidSchema)(n,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,kn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,kn._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,kn.Name)})})}}};ka.default=xx});var xm=v(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var kx=M(),Sx={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,kx.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};Sa.default=Sx});var zm=v(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var Sn=O(),Sm=M(),zx={message:({params:t})=>(0,Sn.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Sn._)`{failingKeyword: ${t.ifClause}}`},Px={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:zx,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,Sm.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=km(o,"then"),s=km(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,Sn.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,Sn._)`${l}`):t.setParams({ifClause:l})}}}};function km(t,e){let r=t.schema[e];return r!==void 0&&!(0,Sm.alwaysValidSchema)(t,r)}za.default=Px});var Pm=v(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var Tx=M(),Ex={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Tx.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Pa.default=Ex});var Tm=v(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var Rx=la(),Ix=nm(),Ox=da(),Nx=im(),Cx=am(),Ax=lm(),Zx=pm(),jx=_a(),Dx=hm(),Mx=bm(),qx=vm(),Lx=wm(),Ux=$m(),Fx=xm(),Vx=zm(),Bx=Pm();function Jx(t=!1){let e=[qx.default,Lx.default,Ux.default,Fx.default,Vx.default,Bx.default,Zx.default,jx.default,Ax.default,Dx.default,Mx.default];return t?e.push(Ix.default,Nx.default):e.push(Rx.default,Ox.default),e.push(Cx.default),e}Ta.default=Jx});var Em=v(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var oe=O(),Wx={message:({schemaCode:t})=>(0,oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,oe._)`{format: ${t}}`},Hx={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Wx,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),y=r.const("fDef",(0,oe._)`${m}[${i}]`),_=r.let("fType"),b=r.let("format");r.if((0,oe._)`typeof ${y} == "object" && !(${y} instanceof RegExp)`,()=>r.assign(_,(0,oe._)`${y}.type || "string"`).assign(b,(0,oe._)`${y}.validate`),()=>r.assign(_,(0,oe._)`"string"`).assign(b,y)),t.fail$data((0,oe.or)(P(),x()));function P(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${b}`}function x(){let z=l.$async?(0,oe._)`(${y}.async ? await ${b}(${o}) : ${b}(${o}))`:(0,oe._)`${b}(${o})`,$=(0,oe._)`(typeof ${b} == "function" ? ${z} : ${b}.test(${o}))`;return(0,oe._)`${b} && ${b} !== true && ${_} === ${e} && !${$}`}}function f(){let m=d.formats[s];if(!m){P();return}if(m===!0)return;let[y,_,b]=x(m);y===e&&t.pass(z());function P(){if(c.strictSchema===!1){d.logger.warn($());return}throw new Error($());function $(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function x($){let ke=$ instanceof RegExp?(0,oe.regexpCode)($):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Te=r.scopeValue("formats",{key:s,ref:$,code:ke});return typeof $=="object"&&!($ instanceof RegExp)?[$.type||"string",$.validate,(0,oe._)`${Te}.validate`]:["string",$,Te]}function z(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${b}(${o})`}return typeof _=="function"?(0,oe._)`${b}(${o})`:(0,oe._)`${b}.test(${o})`}}}};Ea.default=Hx});var Rm=v(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var Gx=Em(),Kx=[Gx.default];Ra.default=Kx});var Im=v(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.contentVocabulary=er.metadataVocabulary=void 0;er.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];er.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Nm=v(Ia=>{"use strict";Object.defineProperty(Ia,"__esModule",{value:!0});var Yx=qf(),Qx=em(),Xx=Tm(),ek=Rm(),Om=Im(),tk=[Yx.default,Qx.default,(0,Xx.default)(),ek.default,Om.metadataVocabulary,Om.contentVocabulary];Ia.default=tk});var Am=v(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.DiscrError=void 0;var Cm;(function(t){t.Tag="tag",t.Mapping="mapping"})(Cm||(zn.DiscrError=Cm={}))});var jm=v(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var tr=O(),Oa=Am(),Zm=un(),rk=Gr(),ok=M(),nk={message:({params:{discrError:t,tagName:e}})=>t===Oa.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,tr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},sk={keyword:"discriminator",type:"object",schemaType:"object",error:nk,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,tr._)`${r}${(0,tr.getProperty)(a)}`);e.if((0,tr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Oa.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,tr._)`${u} === ${m}`),e.assign(c,d(f[m]));e.else(),t.error(!1,{discrError:Oa.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),y=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(y,tr.Name),m}function p(){var f;let m={},y=b(n),_=!0;for(let z=0;z<i.length;z++){let $=i[z];if($?.$ref&&!(0,ok.schemaHasRulesButRef)($,s.self.RULES)){let Te=$.$ref;if($=Zm.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Te),$ instanceof Zm.SchemaEnv&&($=$.schema),$===void 0)throw new rk.default(s.opts.uriResolver,s.baseId,Te)}let ke=(f=$?.properties)===null||f===void 0?void 0:f[a];if(typeof ke!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(y||b($)),P(ke,z)}if(!_)throw new Error(`discriminator: "${a}" must be required`);return m;function b({required:z}){return Array.isArray(z)&&z.includes(a)}function P(z,$){if(z.const)x(z.const,$);else if(z.enum)for(let ke of z.enum)x(ke,$);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function x(z,$){if(typeof z!="string"||z in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[z]=$}}}};Na.default=sk});var Dm=v((rI,ik)=>{ik.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 Aa=v((Y,Ca)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var ak=Cf(),ck=Nm(),uk=jm(),Mm=Dm(),lk=["/properties"],Pn="http://json-schema.org/draft-07/schema",rr=class extends ak.default{_addVocabularies(){super._addVocabularies(),ck.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(uk.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Mm,lk):Mm;this.addMetaSchema(e,Pn,!1),this.refs["http://json-schema.org/schema"]=Pn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Pn)?Pn:void 0)}};Y.Ajv=rr;Ca.exports=Y=rr;Ca.exports.Ajv=rr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=rr;var dk=Hr();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return dk.KeywordCxt}});var or=O();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return or._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return or.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return or.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return or.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return or.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return or.CodeGen}});var pk=an();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return pk.default}});var fk=Gr();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return fk.default}})});var Wm=v(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.formatNames=He.fastFormats=He.fullFormats=void 0;function We(t,e){return{validate:t,compare:e}}He.fullFormats={date:We(Fm,Ma),time:We(ja(!0),qa),"date-time":We(qm(!0),Bm),"iso-time":We(ja(),Vm),"iso-date-time":We(qm(),Jm),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:bk,"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:zk,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:vk,int32:{type:"number",validate:xk},int64:{type:"number",validate:kk},float:{type:"number",validate:Um},double:{type:"number",validate:Um},password:!0,binary:!0};He.fastFormats={...He.fullFormats,date:We(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Ma),time:We(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,qa),"date-time":We(/^\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,Bm),"iso-time":We(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Vm),"iso-date-time":We(/^\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,Jm),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};He.formatNames=Object.keys(He.fullFormats);function mk(t){return t%4===0&&(t%100!==0||t%400===0)}var hk=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,gk=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Fm(t){let e=hk.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&mk(r)?29:gk[o])}function Ma(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Za=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function ja(t){return function(r){let o=Za.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=n-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function qa(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function Vm(t,e){if(!(t&&e))return;let r=Za.exec(t),o=Za.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var Da=/t|\s/i;function qm(t){let e=ja(t);return function(o){let n=o.split(Da);return n.length===2&&Fm(n[0])&&e(n[1])}}function Bm(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function Jm(t,e){if(!(t&&e))return;let[r,o]=t.split(Da),[n,s]=e.split(Da),i=Ma(r,n);if(i!==void 0)return i||qa(o,s)}var yk=/\/|:/,_k=/^(?:[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 bk(t){return yk.test(t)&&_k.test(t)}var Lm=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function vk(t){return Lm.lastIndex=0,Lm.test(t)}var wk=-(2**31),$k=2**31-1;function xk(t){return Number.isInteger(t)&&t<=$k&&t>=wk}function kk(t){return Number.isInteger(t)}function Um(){return!0}var Sk=/[^\\]\\Z/;function zk(t){if(Sk.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Hm=v(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.formatLimitDefinition=void 0;var Pk=Aa(),Ue=O(),yt=Ue.operators,Tn={formatMaximum:{okStr:"<=",ok:yt.LTE,fail:yt.GT},formatMinimum:{okStr:">=",ok:yt.GTE,fail:yt.LT},formatExclusiveMaximum:{okStr:"<",ok:yt.LT,fail:yt.GTE},formatExclusiveMinimum:{okStr:">",ok:yt.GT,fail:yt.LTE}},Tk={message:({keyword:t,schemaCode:e})=>(0,Ue.str)`should be ${Tn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ue._)`{comparison: ${Tn[t].okStr}, limit: ${e}}`};nr.formatLimitDefinition={keyword:Object.keys(Tn),type:"string",schemaType:"string",$data:!0,error:Tk,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new Pk.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Ue._)`${p}[${c.schemaCode}]`);t.fail$data((0,Ue.or)((0,Ue._)`typeof ${f} != "object"`,(0,Ue._)`${f} instanceof RegExp`,(0,Ue._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,Ue._)`${i.code.formats}${(0,Ue.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,Ue._)`${p}.compare(${r}, ${o}) ${Tn[n].fail} 0`}},dependencies:["format"]};var Ek=t=>(t.addKeyword(nr.formatLimitDefinition),t);nr.default=Ek});var Qm=v((uo,Ym)=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});var sr=Wm(),Rk=Hm(),La=O(),Gm=new La.Name("fullFormats"),Ik=new La.Name("fastFormats"),Ua=(t,e={keywords:!0})=>{if(Array.isArray(e))return Km(t,e,sr.fullFormats,Gm),t;let[r,o]=e.mode==="fast"?[sr.fastFormats,Ik]:[sr.fullFormats,Gm],n=e.formats||sr.formatNames;return Km(t,n,r,o),e.keywords&&(0,Rk.default)(t),t};Ua.get=(t,e="full")=>{let o=(e==="fast"?sr.fastFormats:sr.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function Km(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,La._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}Ym.exports=uo=Ua;Object.defineProperty(uo,"__esModule",{value:!0});uo.default=Ua});var Wa;function g(t,e,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in a||(a[p]=u[p].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var Fe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},It=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Wa=globalThis).__zod_globalConfig??(Wa.__zod_globalConfig={});var Ot=globalThis.__zod_globalConfig;function Se(t){return t&&Object.assign(Ot,t),Ot}var D={};Ba(D,{BIGINT_FORMAT_RANGES:()=>Ya,Class:()=>Dn,NUMBER_FORMAT_RANGES:()=>Vn,aborted:()=>st,allowsEval:()=>Ln,assert:()=>gh,assertEqual:()=>ph,assertIs:()=>mh,assertNever:()=>hh,assertNotEqual:()=>fh,assignProp:()=>ot,base64ToUint8Array:()=>Xa,base64urlToUint8Array:()=>Nh,cached:()=>Ct,captureStackTrace:()=>mo,cleanEnum:()=>Oh,cleanRegex:()=>dr,clone:()=>je,cloneDef:()=>_h,createTransparentProxy:()=>kh,defineLazy:()=>U,esc:()=>fo,escapeRegex:()=>Ke,explicitlyAborted:()=>Bn,extend:()=>Ph,finalizeIssue:()=>Ee,floatSafeRemainder:()=>Mn,getElementAtPath:()=>bh,getEnumValues:()=>ur,getLengthableOrigin:()=>pr,getParsedType:()=>xh,getSizableOrigin:()=>Qa,hexToUint8Array:()=>Ah,isObject:()=>_t,isPlainObject:()=>nt,issue:()=>At,joinValues:()=>po,jsonStringifyReplacer:()=>Nt,merge:()=>Eh,mergeDefs:()=>Ge,normalizeParams:()=>T,nullish:()=>lr,numKeys:()=>$h,objectClone:()=>yh,omit:()=>zh,optionalKeys:()=>Fn,parsedType:()=>Jn,partial:()=>Rh,pick:()=>Sh,prefixIssues:()=>Ye,primitiveTypes:()=>Ka,promiseAllObject:()=>vh,propertyKeyTypes:()=>Un,randomString:()=>wh,required:()=>Ih,safeExtend:()=>Th,shallowClone:()=>Ga,slugify:()=>qn,stringifyPrimitive:()=>ho,uint8ArrayToBase64:()=>ec,uint8ArrayToBase64url:()=>Ch,uint8ArrayToHex:()=>Zh,unwrapMessage:()=>cr});function ph(t){return t}function fh(t){return t}function mh(t){}function hh(t){throw new Error("Unexpected value in exhaustive check")}function gh(t){}function ur(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function po(t,e="|"){return t.map(r=>ho(r)).join(e)}function Nt(t,e){return typeof e=="bigint"?e.toString():e}function Ct(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function lr(t){return t==null}function dr(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Mn(t,e){let r=t/e,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var Ha=Symbol("evaluating");function U(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==Ha)return o===void 0&&(o=Ha,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function yh(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ot(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ge(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function _h(t){return Ge(t._zod.def)}function bh(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function vh(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<e.length;s++)n[e[s]]=o[s];return n})}function wh(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function fo(t){return JSON.stringify(t)}function qn(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mo="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function _t(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Ln=Ct(()=>{if(Ot.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function nt(t){if(_t(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(_t(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ga(t){return nt(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function $h(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var xh=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Un=new Set(["string","number","symbol"]),Ka=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ke(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function je(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function T(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function kh(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,s){return e??(e=t()),Reflect.set(e,o,n,s)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function ho(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Fn(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Vn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ya={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Sh(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=Ge(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return ot(this,"shape",i),i},checks:[]});return je(t,s)}function zh(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=Ge(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return ot(this,"shape",i),i},checks:[]});return je(t,s)}function Ph(t,e){if(!nt(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let i in e)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Ge(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return ot(this,"shape",s),s}});return je(t,n)}function Th(t,e){if(!nt(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Ge(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return ot(this,"shape",o),o}});return je(t,r)}function Eh(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Ge(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return ot(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return je(t,r)}function Rh(t,e,r){let n=e._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=Ge(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=t?new t({type:"optional",innerType:a[u]}):a[u];return ot(this,"shape",c),c},checks:[]});return je(e,i)}function Ih(t,e,r){let o=Ge(e._zod.def,{get shape(){let n=e._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new t({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new t({type:"nonoptional",innerType:n[i]});return ot(this,"shape",s),s}});return je(e,o)}function st(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Bn(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function Ye(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function cr(t){return typeof t=="string"?t:t?.message}function Ee(t,e,r){let o=t.message?t.message:cr(t.inst?._zod.def?.error?.(t))??cr(e?.error?.(t))??cr(r.customError?.(t))??cr(r.localeError?.(t))??"Invalid input",{inst:n,continue:s,input:i,...a}=t;return a.path??(a.path=[]),a.message=o,e?.reportInput&&(a.input=i),a}function Qa(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function pr(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Jn(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function At(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function Oh(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Xa(t){let e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}function ec(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Nh(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Xa(e+r)}function Ch(t){return ec(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ah(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)r[o/2]=Number.parseInt(e.slice(o,o+2),16);return r}function Zh(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Dn=class{constructor(...e){}};var tc=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Nt,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},go=g("$ZodError",tc),Wn=g("$ZodError",tc,{Parent:Error});function rc(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function oc(t,e=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(e(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(e(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(t),r}var yo=t=>(e,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Fe;if(i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Ee(c,s,Se())));throw mo(a,n?.callee),a}return i.value};var _o=t=>async(e,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Ee(c,s,Se())));throw mo(a,n?.callee),a}return i.value};var fr=t=>(e,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Fe;return s.issues.length?{success:!1,error:new(t??go)(s.issues.map(i=>Ee(i,n,Se())))}:{success:!0,data:s.value}},mr=fr(Wn),hr=t=>async(e,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>Ee(i,n,Se())))}:{success:!0,data:s.value}},bo=hr(Wn),nc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return yo(t)(e,r,n)};var sc=t=>(e,r,o)=>yo(t)(e,r,o);var ic=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return _o(t)(e,r,n)};var ac=t=>async(e,r,o)=>_o(t)(e,r,o);var cc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return fr(t)(e,r,n)};var uc=t=>(e,r,o)=>fr(t)(e,r,o);var lc=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return hr(t)(e,r,n)};var dc=t=>async(e,r,o)=>hr(t)(e,r,o);var pc=/^[cC][0-9a-z]{6,}$/,fc=/^[0-9a-z]+$/,mc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hc=/^[0-9a-vA-V]{20}$/,gc=/^[A-Za-z0-9]{27}$/,yc=/^[a-zA-Z0-9_-]{21}$/,_c=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var bc=/^([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})$/,Hn=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/;var vc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Dh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function wc(){return new RegExp(Dh,"u")}var $c=/^(?:(?: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])$/,xc=/^(([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 kc=/^((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])$/,Sc=/^(([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])$/,zc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gn=/^[A-Za-z0-9_-]*$/;var Pc=/^https?$/,Tc=/^\+[1-9]\d{6,14}$/,Ec="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Rc=new RegExp(`^${Ec}$`);function Ic(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Oc(t){return new RegExp(`^${Ic(t)}$`)}function Nc(t){let e=Ic({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${e}(?:${r.join("|")})`;return new RegExp(`^${Ec}T(?:${o})$`)}var Cc=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var Ac=/^-?\d+$/,Kn=/^-?\d+(?:\.\d+)?$/,Zc=/^(?:true|false)$/i,jc=/^null$/i;var Dc=/^[^A-Z]*$/,Mc=/^[^a-z]*$/;var ie=g("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),qc={number:"number",bigint:"bigint",object:"date"},Yn=g("$ZodCheckLessThan",(t,e)=>{ie.init(t,e);let r=qc[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value<=e.value:o.value<e.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Qn=g("$ZodCheckGreaterThan",(t,e)=>{ie.init(t,e);let r=qc[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Lc=g("$ZodCheckMultipleOf",(t,e)=>{ie.init(t,e),t._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Mn(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Uc=g("$ZodCheckNumberFormat",(t,e)=>{ie.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),o=r?"int":"number",[n,s]=Vn[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Ac)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}});var Fc=g("$ZodCheckMaxLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(o._zod.bag.maximum=e.maximum)}),t._zod.check=o=>{let n=o.value;if(n.length<=e.maximum)return;let i=pr(n);o.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Vc=g("$ZodCheckMinLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;if(n.length>=e.minimum)return;let i=pr(n);o.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Bc=g("$ZodCheckLengthEquals",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=o=>{let n=o.value,s=n.length;if(s===e.length)return;let i=pr(n),a=s>e.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),gr=g("$ZodCheckStringFormat",(t,e)=>{var r,o;ie.init(t,e),t._zod.onattach.push(n=>{let s=n._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(o=t._zod).check??(o.check=()=>{})}),Jc=g("$ZodCheckRegex",(t,e)=>{gr.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Wc=g("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Dc),gr.init(t,e)}),Hc=g("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Mc),gr.init(t,e)}),Gc=g("$ZodCheckIncludes",(t,e)=>{ie.init(t,e);let r=Ke(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=o,t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),Kc=g("$ZodCheckStartsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`^${Ke(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),Yc=g("$ZodCheckEndsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`.*${Ke(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});var Qc=g("$ZodCheckOverwrite",(t,e)=>{ie.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var wo=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
|
|
9
|
+
deps: ${r}}`};var i0={keyword:"dependencies",type:"object",schemaType:"object",error:He.error,code(t){let[e,r]=a0(t);cm(t,e),um(t,r)}};function a0({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function cm(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,co.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,co.checkReportMissingProp)(t,u)}):(r.if((0,ha._)`${c} && (${(0,co.checkMissingProp)(t,a,s)})`),(0,co.reportMissingProp)(t,s),r.else())}}He.validatePropertyDeps=cm;function um(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,s0.alwaysValidSchema)(s,e[a])||(r.if((0,co.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}He.validateSchemaDeps=um;He.default=i0});var pm=v(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var dm=I(),c0=q(),u0={message:"property name must be valid",params:({params:t})=>(0,dm._)`{propertyName: ${t.propertyName}}`},l0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:u0,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,c0.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,dm.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};ga.default=l0});var ya=v(_a=>{"use strict";Object.defineProperty(_a,"__esModule",{value:!0});var wn=Ae(),Le=I(),d0=tt(),$n=q(),p0={message:"must NOT have additional properties",params:({params:t})=>(0,Le._)`{additionalProperty: ${t.additionalProperty}}`},f0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:p0,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,$n.alwaysValidSchema)(i,r))return;let u=(0,wn.allSchemaProperties)(o.properties),l=(0,wn.allSchemaProperties)(o.patternProperties);d(),t.ok((0,Le._)`${s} === ${d0.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let b;if(u.length>8){let P=(0,$n.schemaRefOrVal)(i,o.properties,"properties");b=(0,wn.isOwnProperty)(e,P,y)}else u.length?b=(0,Le.or)(...u.map(P=>(0,Le._)`${y} === ${P}`)):b=Le.nil;return l.length&&(b=(0,Le.or)(b,...l.map(P=>(0,Le._)`${(0,wn.usePattern)(t,P)}.test(${y})`))),(0,Le.not)(b)}function f(y){e.code((0,Le._)`delete ${n}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,$n.alwaysValidSchema)(i,r)){let b=e.name("valid");c.removeAdditional==="failing"?(_(y,b,!1),e.if((0,Le.not)(b),()=>{t.reset(),f(y)})):(_(y,b),a||e.if((0,Le.not)(b),()=>e.break()))}}function _(y,b,P){let z={keyword:"additionalProperties",dataProp:y,dataPropType:$n.Type.Str};P===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(z,b)}}};_a.default=f0});var hm=v(va=>{"use strict";Object.defineProperty(va,"__esModule",{value:!0});var m0=Wr(),fm=Ae(),ba=q(),mm=ya(),h0={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&mm.default.code(new m0.KeywordCxt(s,mm.default,"additionalProperties"));let i=(0,fm.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=ba.mergeEvaluated.props(e,(0,ba.toHash)(i),s.props));let a=i.filter(d=>!(0,ba.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,fm.propertyInData)(e,n,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};va.default=h0});var bm=v(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var gm=Ae(),zn=I(),_m=q(),ym=q(),g0={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,gm.allSchemaProperties)(r),c=a.filter(_=>(0,_m.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof zn.Name)&&(s.props=(0,ym.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let _ of a)u&&f(_),s.allErrors?m(_):(e.var(l,!0),m(_),e.if(l))}function f(_){for(let y in u)new RegExp(_).test(y)&&(0,_m.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function m(_){e.forIn("key",o,y=>{e.if((0,zn._)`${(0,gm.usePattern)(t,_)}.test(${y})`,()=>{let b=c.includes(_);b||t.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:ym.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,zn._)`${d}[${y}]`,!0):!b&&!s.allErrors&&e.if((0,zn.not)(l),()=>e.break())})})}}};wa.default=g0});var vm=v($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var _0=q(),y0={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,_0.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};$a.default=y0});var wm=v(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var b0=Ae(),v0={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:b0.validateUnion,error:{message:"must match a schema in anyOf"}};za.default=v0});var $m=v(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var kn=I(),w0=q(),$0={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,kn._)`{passingSchemas: ${t.passing}}`},z0={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:$0,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,w0.alwaysValidSchema)(n,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,kn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,kn._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,kn.Name)})})}}};ka.default=z0});var zm=v(xa=>{"use strict";Object.defineProperty(xa,"__esModule",{value:!0});var k0=q(),x0={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,k0.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};xa.default=x0});var Sm=v(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});var xn=I(),xm=q(),S0={message:({params:t})=>(0,xn.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,xn._)`{failingKeyword: ${t.ifClause}}`},P0={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:S0,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,xm.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=km(o,"then"),s=km(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,xn.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,xn._)`${l}`):t.setParams({ifClause:l})}}}};function km(t,e){let r=t.schema[e];return r!==void 0&&!(0,xm.alwaysValidSchema)(t,r)}Sa.default=P0});var Pm=v(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var E0=q(),T0={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,E0.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Pa.default=T0});var Em=v(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var R0=la(),O0=nm(),I0=da(),N0=im(),A0=am(),Z0=lm(),j0=pm(),C0=ya(),D0=hm(),q0=bm(),M0=vm(),L0=wm(),U0=$m(),F0=zm(),V0=Sm(),J0=Pm();function H0(t=!1){let e=[M0.default,L0.default,U0.default,F0.default,V0.default,J0.default,j0.default,C0.default,Z0.default,D0.default,q0.default];return t?e.push(O0.default,N0.default):e.push(R0.default,I0.default),e.push(A0.default),e}Ea.default=H0});var Tm=v(Ta=>{"use strict";Object.defineProperty(Ta,"__esModule",{value:!0});var oe=I(),B0={message:({schemaCode:t})=>(0,oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,oe._)`{format: ${t}}`},W0={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:B0,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),_=r.const("fDef",(0,oe._)`${m}[${i}]`),y=r.let("fType"),b=r.let("format");r.if((0,oe._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${_}.type || "string"`).assign(b,(0,oe._)`${_}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign(b,_)),t.fail$data((0,oe.or)(P(),z()));function P(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${b}`}function z(){let S=l.$async?(0,oe._)`(${_}.async ? await ${b}(${o}) : ${b}(${o}))`:(0,oe._)`${b}(${o})`,$=(0,oe._)`(typeof ${b} == "function" ? ${S} : ${b}.test(${o}))`;return(0,oe._)`${b} && ${b} !== true && ${y} === ${e} && !${$}`}}function f(){let m=d.formats[s];if(!m){P();return}if(m===!0)return;let[_,y,b]=z(m);_===e&&t.pass(S());function P(){if(c.strictSchema===!1){d.logger.warn($());return}throw new Error($());function $(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function z($){let ke=$ instanceof RegExp?(0,oe.regexpCode)($):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Te=r.scopeValue("formats",{key:s,ref:$,code:ke});return typeof $=="object"&&!($ instanceof RegExp)?[$.type||"string",$.validate,(0,oe._)`${Te}.validate`]:["string",$,Te]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${b}(${o})`}return typeof y=="function"?(0,oe._)`${b}(${o})`:(0,oe._)`${b}.test(${o})`}}}};Ta.default=W0});var Rm=v(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var K0=Tm(),G0=[K0.default];Ra.default=G0});var Om=v(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.contentVocabulary=er.metadataVocabulary=void 0;er.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];er.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Nm=v(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Y0=Mf(),Q0=em(),X0=Em(),ez=Rm(),Im=Om(),tz=[Y0.default,Q0.default,(0,X0.default)(),ez.default,Im.metadataVocabulary,Im.contentVocabulary];Oa.default=tz});var Zm=v(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.DiscrError=void 0;var Am;(function(t){t.Tag="tag",t.Mapping="mapping"})(Am||(Sn.DiscrError=Am={}))});var Cm=v(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});var tr=I(),Ia=Zm(),jm=un(),rz=Kr(),oz=q(),nz={message:({params:{discrError:t,tagName:e}})=>t===Ia.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,tr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},sz={keyword:"discriminator",type:"object",schemaType:"object",error:nz,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,tr._)`${r}${(0,tr.getProperty)(a)}`);e.if((0,tr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Ia.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,tr._)`${u} === ${m}`),e.assign(c,d(f[m]));e.else(),t.error(!1,{discrError:Ia.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),_=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(_,tr.Name),m}function p(){var f;let m={},_=b(n),y=!0;for(let S=0;S<i.length;S++){let $=i[S];if($?.$ref&&!(0,oz.schemaHasRulesButRef)($,s.self.RULES)){let Te=$.$ref;if($=jm.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Te),$ instanceof jm.SchemaEnv&&($=$.schema),$===void 0)throw new rz.default(s.opts.uriResolver,s.baseId,Te)}let ke=(f=$?.properties)===null||f===void 0?void 0:f[a];if(typeof ke!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(_||b($)),P(ke,S)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function b({required:S}){return Array.isArray(S)&&S.includes(a)}function P(S,$){if(S.const)z(S.const,$);else if(S.enum)for(let ke of S.enum)z(ke,$);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function z(S,$){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[S]=$}}}};Na.default=sz});var Dm=v((rO,iz)=>{iz.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 Za=v((Y,Aa)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var az=Af(),cz=Nm(),uz=Cm(),qm=Dm(),lz=["/properties"],Pn="http://json-schema.org/draft-07/schema",rr=class extends az.default{_addVocabularies(){super._addVocabularies(),cz.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(uz.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(qm,lz):qm;this.addMetaSchema(e,Pn,!1),this.refs["http://json-schema.org/schema"]=Pn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Pn)?Pn:void 0)}};Y.Ajv=rr;Aa.exports=Y=rr;Aa.exports.Ajv=rr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=rr;var dz=Wr();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return dz.KeywordCxt}});var or=I();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return or._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return or.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return or.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return or.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return or.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return or.CodeGen}});var pz=an();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return pz.default}});var fz=Kr();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return fz.default}})});var Bm=v(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.formatNames=We.fastFormats=We.fullFormats=void 0;function Be(t,e){return{validate:t,compare:e}}We.fullFormats={date:Be(Fm,qa),time:Be(Ca(!0),Ma),"date-time":Be(Mm(!0),Jm),"iso-time":Be(Ca(),Vm),"iso-date-time":Be(Mm(),Hm),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:bz,"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:Sz,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:vz,int32:{type:"number",validate:zz},int64:{type:"number",validate:kz},float:{type:"number",validate:Um},double:{type:"number",validate:Um},password:!0,binary:!0};We.fastFormats={...We.fullFormats,date:Be(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,qa),time:Be(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ma),"date-time":Be(/^\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,Jm),"iso-time":Be(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Vm),"iso-date-time":Be(/^\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,Hm),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};We.formatNames=Object.keys(We.fullFormats);function mz(t){return t%4===0&&(t%100!==0||t%400===0)}var hz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,gz=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Fm(t){let e=hz.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&mz(r)?29:gz[o])}function qa(t,e){if(t&&e)return t>e?1:t<e?-1:0}var ja=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Ca(t){return function(r){let o=ja.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=n-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Ma(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function Vm(t,e){if(!(t&&e))return;let r=ja.exec(t),o=ja.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var Da=/t|\s/i;function Mm(t){let e=Ca(t);return function(o){let n=o.split(Da);return n.length===2&&Fm(n[0])&&e(n[1])}}function Jm(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function Hm(t,e){if(!(t&&e))return;let[r,o]=t.split(Da),[n,s]=e.split(Da),i=qa(r,n);if(i!==void 0)return i||Ma(o,s)}var _z=/\/|:/,yz=/^(?:[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 bz(t){return _z.test(t)&&yz.test(t)}var Lm=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function vz(t){return Lm.lastIndex=0,Lm.test(t)}var wz=-(2**31),$z=2**31-1;function zz(t){return Number.isInteger(t)&&t<=$z&&t>=wz}function kz(t){return Number.isInteger(t)}function Um(){return!0}var xz=/[^\\]\\Z/;function Sz(t){if(xz.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Wm=v(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.formatLimitDefinition=void 0;var Pz=Za(),Ue=I(),_t=Ue.operators,En={formatMaximum:{okStr:"<=",ok:_t.LTE,fail:_t.GT},formatMinimum:{okStr:">=",ok:_t.GTE,fail:_t.LT},formatExclusiveMaximum:{okStr:"<",ok:_t.LT,fail:_t.GTE},formatExclusiveMinimum:{okStr:">",ok:_t.GT,fail:_t.LTE}},Ez={message:({keyword:t,schemaCode:e})=>(0,Ue.str)`should be ${En[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Ue._)`{comparison: ${En[t].okStr}, limit: ${e}}`};nr.formatLimitDefinition={keyword:Object.keys(En),type:"string",schemaType:"string",$data:!0,error:Ez,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new Pz.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Ue._)`${p}[${c.schemaCode}]`);t.fail$data((0,Ue.or)((0,Ue._)`typeof ${f} != "object"`,(0,Ue._)`${f} instanceof RegExp`,(0,Ue._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,Ue._)`${i.code.formats}${(0,Ue.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,Ue._)`${p}.compare(${r}, ${o}) ${En[n].fail} 0`}},dependencies:["format"]};var Tz=t=>(t.addKeyword(nr.formatLimitDefinition),t);nr.default=Tz});var Qm=v((uo,Ym)=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});var sr=Bm(),Rz=Wm(),La=I(),Km=new La.Name("fullFormats"),Oz=new La.Name("fastFormats"),Ua=(t,e={keywords:!0})=>{if(Array.isArray(e))return Gm(t,e,sr.fullFormats,Km),t;let[r,o]=e.mode==="fast"?[sr.fastFormats,Oz]:[sr.fullFormats,Km],n=e.formats||sr.formatNames;return Gm(t,n,r,o),e.keywords&&(0,Rz.default)(t),t};Ua.get=(t,e="full")=>{let o=(e==="fast"?sr.fastFormats:sr.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function Gm(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,La._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}Ym.exports=uo=Ua;Object.defineProperty(uo,"__esModule",{value:!0});uo.default=Ua});var Ba;function g(t,e,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in a||(a[p]=u[p].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var Fe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ot=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Ba=globalThis).__zod_globalConfig??(Ba.__zod_globalConfig={});var It=globalThis.__zod_globalConfig;function xe(t){return t&&Object.assign(It,t),It}var D={};Ja(D,{BIGINT_FORMAT_RANGES:()=>Ya,Class:()=>Dn,NUMBER_FORMAT_RANGES:()=>Vn,aborted:()=>st,allowsEval:()=>Ln,assert:()=>gh,assertEqual:()=>ph,assertIs:()=>mh,assertNever:()=>hh,assertNotEqual:()=>fh,assignProp:()=>ot,base64ToUint8Array:()=>Xa,base64urlToUint8Array:()=>Nh,cached:()=>At,captureStackTrace:()=>mo,cleanEnum:()=>Ih,cleanRegex:()=>dr,clone:()=>Ce,cloneDef:()=>yh,createTransparentProxy:()=>kh,defineLazy:()=>U,esc:()=>fo,escapeRegex:()=>Ge,explicitlyAborted:()=>Jn,extend:()=>Ph,finalizeIssue:()=>Re,floatSafeRemainder:()=>qn,getElementAtPath:()=>bh,getEnumValues:()=>ur,getLengthableOrigin:()=>pr,getParsedType:()=>zh,getSizableOrigin:()=>Qa,hexToUint8Array:()=>Zh,isObject:()=>yt,isPlainObject:()=>nt,issue:()=>Zt,joinValues:()=>po,jsonStringifyReplacer:()=>Nt,merge:()=>Th,mergeDefs:()=>Ke,normalizeParams:()=>E,nullish:()=>lr,numKeys:()=>$h,objectClone:()=>_h,omit:()=>Sh,optionalKeys:()=>Fn,parsedType:()=>Hn,partial:()=>Rh,pick:()=>xh,prefixIssues:()=>Ye,primitiveTypes:()=>Ga,promiseAllObject:()=>vh,propertyKeyTypes:()=>Un,randomString:()=>wh,required:()=>Oh,safeExtend:()=>Eh,shallowClone:()=>Ka,slugify:()=>Mn,stringifyPrimitive:()=>ho,uint8ArrayToBase64:()=>ec,uint8ArrayToBase64url:()=>Ah,uint8ArrayToHex:()=>jh,unwrapMessage:()=>cr});function ph(t){return t}function fh(t){return t}function mh(t){}function hh(t){throw new Error("Unexpected value in exhaustive check")}function gh(t){}function ur(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function po(t,e="|"){return t.map(r=>ho(r)).join(e)}function Nt(t,e){return typeof e=="bigint"?e.toString():e}function At(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function lr(t){return t==null}function dr(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function qn(t,e){let r=t/e,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var Wa=Symbol("evaluating");function U(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==Wa)return o===void 0&&(o=Wa,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function _h(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function ot(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ke(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function yh(t){return Ke(t._zod.def)}function bh(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function vh(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<e.length;s++)n[e[s]]=o[s];return n})}function wh(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function fo(t){return JSON.stringify(t)}function Mn(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var mo="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function yt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Ln=At(()=>{if(It.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function nt(t){if(yt(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(yt(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ka(t){return nt(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function $h(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var zh=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Un=new Set(["string","number","symbol"]),Ga=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ge(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ce(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function E(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function kh(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,s){return e??(e=t()),Reflect.set(e,o,n,s)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function ho(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Fn(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Vn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ya={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xh(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=Ke(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return ot(this,"shape",i),i},checks:[]});return Ce(t,s)}function Sh(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=Ke(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return ot(this,"shape",i),i},checks:[]});return Ce(t,s)}function Ph(t,e){if(!nt(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let i in e)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Ke(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return ot(this,"shape",s),s}});return Ce(t,n)}function Eh(t,e){if(!nt(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Ke(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return ot(this,"shape",o),o}});return Ce(t,r)}function Th(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=Ke(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return ot(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Ce(t,r)}function Rh(t,e,r){let n=e._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=Ke(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=t?new t({type:"optional",innerType:a[u]}):a[u];return ot(this,"shape",c),c},checks:[]});return Ce(e,i)}function Oh(t,e,r){let o=Ke(e._zod.def,{get shape(){let n=e._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new t({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new t({type:"nonoptional",innerType:n[i]});return ot(this,"shape",s),s}});return Ce(e,o)}function st(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Jn(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function Ye(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function cr(t){return typeof t=="string"?t:t?.message}function Re(t,e,r){let o=t.message?t.message:cr(t.inst?._zod.def?.error?.(t))??cr(e?.error?.(t))??cr(r.customError?.(t))??cr(r.localeError?.(t))??"Invalid input",{inst:n,continue:s,input:i,...a}=t;return a.path??(a.path=[]),a.message=o,e?.reportInput&&(a.input=i),a}function Qa(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function pr(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Hn(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Zt(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function Ih(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Xa(t){let e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}function ec(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Nh(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Xa(e+r)}function Ah(t){return ec(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Zh(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)r[o/2]=Number.parseInt(e.slice(o,o+2),16);return r}function jh(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Dn=class{constructor(...e){}};var tc=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Nt,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},go=g("$ZodError",tc),Bn=g("$ZodError",tc,{Parent:Error});function rc(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function oc(t,e=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(e(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(e(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(t),r}var _o=t=>(e,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Fe;if(i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Re(c,s,xe())));throw mo(a,n?.callee),a}return i.value};var yo=t=>async(e,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Re(c,s,xe())));throw mo(a,n?.callee),a}return i.value};var fr=t=>(e,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Fe;return s.issues.length?{success:!1,error:new(t??go)(s.issues.map(i=>Re(i,n,xe())))}:{success:!0,data:s.value}},mr=fr(Bn),hr=t=>async(e,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>Re(i,n,xe())))}:{success:!0,data:s.value}},bo=hr(Bn),nc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return _o(t)(e,r,n)};var sc=t=>(e,r,o)=>_o(t)(e,r,o);var ic=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return yo(t)(e,r,n)};var ac=t=>async(e,r,o)=>yo(t)(e,r,o);var cc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return fr(t)(e,r,n)};var uc=t=>(e,r,o)=>fr(t)(e,r,o);var lc=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return hr(t)(e,r,n)};var dc=t=>async(e,r,o)=>hr(t)(e,r,o);var pc=/^[cC][0-9a-z]{6,}$/,fc=/^[0-9a-z]+$/,mc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hc=/^[0-9a-vA-V]{20}$/,gc=/^[A-Za-z0-9]{27}$/,_c=/^[a-zA-Z0-9_-]{21}$/,yc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var bc=/^([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})$/,Wn=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/;var vc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Dh="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function wc(){return new RegExp(Dh,"u")}var $c=/^(?:(?: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])$/,zc=/^(([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 kc=/^((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])$/,xc=/^(([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])$/,Sc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Kn=/^[A-Za-z0-9_-]*$/;var Pc=/^https?$/,Ec=/^\+[1-9]\d{6,14}$/,Tc="(?:(?:\\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])))",Rc=new RegExp(`^${Tc}$`);function Oc(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ic(t){return new RegExp(`^${Oc(t)}$`)}function Nc(t){let e=Oc({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${e}(?:${r.join("|")})`;return new RegExp(`^${Tc}T(?:${o})$`)}var Ac=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var Zc=/^-?\d+$/,Gn=/^-?\d+(?:\.\d+)?$/,jc=/^(?:true|false)$/i,Cc=/^null$/i;var Dc=/^[^A-Z]*$/,qc=/^[^a-z]*$/;var ie=g("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Mc={number:"number",bigint:"bigint",object:"date"},Yn=g("$ZodCheckLessThan",(t,e)=>{ie.init(t,e);let r=Mc[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value<=e.value:o.value<e.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Qn=g("$ZodCheckGreaterThan",(t,e)=>{ie.init(t,e);let r=Mc[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Lc=g("$ZodCheckMultipleOf",(t,e)=>{ie.init(t,e),t._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):qn(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Uc=g("$ZodCheckNumberFormat",(t,e)=>{ie.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),o=r?"int":"number",[n,s]=Vn[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=n,a.maximum=s,r&&(a.pattern=Zc)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}});var Fc=g("$ZodCheckMaxLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(o._zod.bag.maximum=e.maximum)}),t._zod.check=o=>{let n=o.value;if(n.length<=e.maximum)return;let i=pr(n);o.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Vc=g("$ZodCheckMinLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;if(n.length>=e.minimum)return;let i=pr(n);o.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),Jc=g("$ZodCheckLengthEquals",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!lr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=o=>{let n=o.value,s=n.length;if(s===e.length)return;let i=pr(n),a=s>e.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),gr=g("$ZodCheckStringFormat",(t,e)=>{var r,o;ie.init(t,e),t._zod.onattach.push(n=>{let s=n._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(o=t._zod).check??(o.check=()=>{})}),Hc=g("$ZodCheckRegex",(t,e)=>{gr.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Bc=g("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Dc),gr.init(t,e)}),Wc=g("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=qc),gr.init(t,e)}),Kc=g("$ZodCheckIncludes",(t,e)=>{ie.init(t,e);let r=Ge(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=o,t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),Gc=g("$ZodCheckStartsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`^${Ge(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),Yc=g("$ZodCheckEndsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`.*${Ge(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});var Qc=g("$ZodCheckOverwrite",(t,e)=>{ie.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var wo=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
|
|
10
10
|
`).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let e=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,n.join(`
|
|
11
|
-
`))}};var eu={major:4,minor:4,patch:3};var
|
|
12
|
-
if (${
|
|
11
|
+
`))}};var eu={major:4,minor:4,patch:3};var B=g("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=eu;let o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(let n of o)for(let s of n._zod.onattach)s(t);if(o.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(i,a,c)=>{let u=st(i),l;for(let d of a){if(d._zod.def.when){if(Jn(i)||!d._zod.def.when(i))continue}else if(u)continue;let p=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Fe;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==p&&(u||(u=st(i,p)))});else{if(i.issues.length===p)continue;u||(u=st(i,p))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(st(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Fe;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(i,a)=>{if(a.skipChecks)return t._zod.parse(i,a);if(a.direction==="backward"){let u=t._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=t._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Fe;return c.then(u=>n(u,o,a))}return n(c,o,a)}}U(t,"~standard",()=>({validate:n=>{try{let s=mr(t,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return bo(t,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),ko=g("$ZodString",(t,e)=>{B.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Ac(t._zod.bag),t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),W=g("$ZodStringFormat",(t,e)=>{gr.init(t,e),ko.init(t,e)}),uu=g("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=bc),W.init(t,e)}),lu=g("$ZodUUID",(t,e)=>{if(e.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(o===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Wn(o))}else e.pattern??(e.pattern=Wn());W.init(t,e)}),du=g("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=vc),W.init(t,e)}),pu=g("$ZodURL",(t,e)=>{W.init(t,e),t._zod.check=r=>{try{let o=r.value.trim();if(!e.normalize&&e.protocol?.source===Pc.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}let n=new URL(o);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),fu=g("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=wc()),W.init(t,e)}),mu=g("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=_c),W.init(t,e)}),hu=g("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=pc),W.init(t,e)}),gu=g("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=fc),W.init(t,e)}),_u=g("$ZodULID",(t,e)=>{e.pattern??(e.pattern=mc),W.init(t,e)}),yu=g("$ZodXID",(t,e)=>{e.pattern??(e.pattern=hc),W.init(t,e)}),bu=g("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=gc),W.init(t,e)}),vu=g("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Nc(e)),W.init(t,e)}),wu=g("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Rc),W.init(t,e)}),$u=g("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Ic(e)),W.init(t,e)}),zu=g("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=yc),W.init(t,e)}),ku=g("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=$c),W.init(t,e),t._zod.bag.format="ipv4"}),xu=g("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=zc),W.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}});var Su=g("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=kc),W.init(t,e)}),Pu=g("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=xc),W.init(t,e),t._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function Eu(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Tu=g("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Sc),W.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{Eu(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Lh(t){if(!Kn.test(t))return!1;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Eu(r)}var Ru=g("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Kn),W.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Lh(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Ou=g("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Ec),W.init(t,e)});function Uh(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}var Iu=g("$ZodJWT",(t,e)=>{W.init(t,e),t._zod.check=r=>{Uh(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var es=g("$ZodNumber",(t,e)=>{B.init(t,e),t._zod.pattern=t._zod.bag.pattern??Gn,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),Nu=g("$ZodNumberFormat",(t,e)=>{Uc.init(t,e),es.init(t,e)}),Au=g("$ZodBoolean",(t,e)=>{B.init(t,e),t._zod.pattern=jc,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}});var Zu=g("$ZodNull",(t,e)=>{B.init(t,e),t._zod.pattern=Cc,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}});var ju=g("$ZodUnknown",(t,e)=>{B.init(t,e),t._zod.parse=r=>r}),Cu=g("$ZodNever",(t,e)=>{B.init(t,e),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function tu(t,e,r){t.issues.length&&e.issues.push(...Ye(r,t.issues)),e.value[r]=t.value}var Du=g("$ZodArray",(t,e)=>{B.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=e.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>tu(u,r,i))):tu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function zo(t,e,r,o,n,s){let i=r in o;if(t.issues.length){if(n&&s&&!i)return;e.issues.push(...Ye(r,t.issues))}if(!i&&!n){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?i&&(e.value[r]=void 0):e.value[r]=t.value}function qu(t){let e=Object.keys(t.shape);for(let o of e)if(!t.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Fn(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function Mu(t,e,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(let p in e){if(p==="__proto__"||a.has(p))continue;if(u==="never"){i.push(p);continue}let f=c.run({value:e[p],issues:[]},o);f instanceof Promise?t.push(f.then(m=>zo(m,r,p,e,l,d))):zo(f,r,p,e,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}var Fh=g("$ZodObject",(t,e)=>{if(B.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let o=At(()=>qu(e));U(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let n=yt,s=e.catchall,i;t._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],d=i.shape;for(let p of i.keys){let f=d[p],m=f._zod.optin==="optional",_=f._zod.optout==="optional",y=f._zod.run({value:u[p],issues:[]},c);y instanceof Promise?l.push(y.then(b=>zo(b,a,p,u,m,_))):zo(y,a,p,u,m,_)}return s?Mu(l,u,a,c,o.value,t):l.length?Promise.all(l).then(()=>a):a}}),Lu=g("$ZodObjectJIT",(t,e)=>{Fh.init(t,e);let r=t._zod.parse,o=At(()=>qu(e)),n=p=>{let f=new wo(["shape","payload","ctx"]),m=o.value,_=z=>{let S=fo(z);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),b=0;for(let z of m.keys)y[z]=`key_${b++}`;f.write("const newResult = {};");for(let z of m.keys){let S=y[z],$=fo(z),ke=p[z],Te=ke?._zod?.optin==="optional",ir=ke?._zod?.optout==="optional";f.write(`const ${S} = ${_(z)};`),Te&&ir?f.write(`
|
|
12
|
+
if (${S}.issues.length) {
|
|
13
13
|
if (${$} in input) {
|
|
14
|
-
payload.issues = payload.issues.concat(${
|
|
14
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
15
15
|
...iss,
|
|
16
16
|
path: iss.path ? [${$}, ...iss.path] : [${$}]
|
|
17
17
|
})));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
if (${
|
|
21
|
+
if (${S}.value === undefined) {
|
|
22
22
|
if (${$} in input) {
|
|
23
23
|
newResult[${$}] = undefined;
|
|
24
24
|
}
|
|
25
25
|
} else {
|
|
26
|
-
newResult[${$}] = ${
|
|
26
|
+
newResult[${$}] = ${S}.value;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
`):Te?f.write(`
|
|
30
|
-
if (${
|
|
31
|
-
payload.issues = payload.issues.concat(${
|
|
30
|
+
if (${S}.issues.length) {
|
|
31
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
32
32
|
...iss,
|
|
33
33
|
path: iss.path ? [${$}, ...iss.path] : [${$}]
|
|
34
34
|
})));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (${
|
|
37
|
+
if (${S}.value === undefined) {
|
|
38
38
|
if (${$} in input) {
|
|
39
39
|
newResult[${$}] = undefined;
|
|
40
40
|
}
|
|
41
41
|
} else {
|
|
42
|
-
newResult[${$}] = ${
|
|
42
|
+
newResult[${$}] = ${S}.value;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
`):f.write(`
|
|
46
|
-
const ${
|
|
47
|
-
if (${
|
|
48
|
-
payload.issues = payload.issues.concat(${
|
|
46
|
+
const ${S}_present = ${$} in input;
|
|
47
|
+
if (${S}.issues.length) {
|
|
48
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
49
49
|
...iss,
|
|
50
50
|
path: iss.path ? [${$}, ...iss.path] : [${$}]
|
|
51
51
|
})));
|
|
52
52
|
}
|
|
53
|
-
if (!${
|
|
53
|
+
if (!${S}_present && !${S}.issues.length) {
|
|
54
54
|
payload.issues.push({
|
|
55
55
|
code: "invalid_type",
|
|
56
56
|
expected: "nonoptional",
|
|
@@ -59,299 +59,257 @@ var ih=Object.create;var Zn=Object.defineProperty;var ah=Object.getOwnPropertyDe
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
if (${
|
|
63
|
-
if (${
|
|
62
|
+
if (${S}_present) {
|
|
63
|
+
if (${S}.value === undefined) {
|
|
64
64
|
newResult[${$}] = undefined;
|
|
65
65
|
} else {
|
|
66
|
-
newResult[${$}] = ${
|
|
66
|
+
newResult[${$}] = ${S}.value;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
`)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(x,z)=>P(p,x,z)},s,i=_t,a=!Ot.jitless,u=a&&Ln.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=o.value);let m=p.value;return i(m)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(e.shape)),p=s(p,f),l?qu([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});function ru(t,e,r,o){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;let n=t.filter(s=>!st(s));return n.length===1?(e.value=n[0].value,n[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(i=>Ee(i,o,Se())))}),e)}var ts=g("$ZodUnion",(t,e)=>{W.init(t,e),U(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),U(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),U(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),U(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>dr(n.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of e.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>ru(a,o,t,n)):ru(i,o,t,n)}});var Uu=g("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ts.init(t,e);let r=t._zod.parse;U(t._zod,"propValues",()=>{let n={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=Ct(()=>{let n=e.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(n,s)=>{let i=n.value;if(!_t(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),n;let a=o.value.get(i?.[e.discriminator]);return a?a._zod.run(n,s):e.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(o.value.keys()),input:i,path:[e.discriminator],inst:t}),n)}}),Fu=g("$ZodIntersection",(t,e)=>{W.init(t,e),t._zod.parse=(r,o)=>{let n=r.value,s=e.left._zod.run({value:n,issues:[]},o),i=e.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>ou(r,c,u)):ou(r,s,i)}});function Xn(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(nt(t)&&nt(e)){let r=Object.keys(e),o=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(let s of o){let i=Xn(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<t.length;o++){let n=t[o],s=e[o],i=Xn(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ou(t,e,r){let o=new Map,n;for(let a of e.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else t.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else t.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&t.issues.push({...n,keys:s}),st(t))return t;let i=Xn(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}var Vu=g("$ZodRecord",(t,e)=>{W.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!nt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let s=[],i=e.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Ee(f,o,Se())),input:u,path:[u],inst:t});continue}let d=l.value,p=e.valueType._zod.run({value:n[u],issues:[]},o);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&r.issues.push(...Ye(u,f.issues)),r.value[d]=f.value})):(p.issues.length&&r.issues.push(...Ye(u,p.issues)),r.value[d]=p.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Kn.test(a)&&c.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Ee(d,o,Se())),input:a,path:[a],inst:t});continue}let l=e.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...Ye(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Ye(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Bu=g("$ZodEnum",(t,e)=>{W.init(t,e);let r=ur(e.entries),o=new Set(r);t._zod.values=o,t._zod.pattern=new RegExp(`^(${r.filter(n=>Un.has(typeof n)).map(n=>typeof n=="string"?Ke(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:t}),n}}),Ju=g("$ZodLiteral",(t,e)=>{if(W.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(o=>typeof o=="string"?Ke(o):o?Ke(o.toString()):String(o)).join("|")})$`),t._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),o}});var Wu=g("$ZodTransform",(t,e)=>{W.init(t,e),t._zod.optin="optional",t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new It(t.constructor.name);let n=e.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Fe;return r.value=n,r.fallback=!0,r}});function nu(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var rs=g("$ZodOptional",(t,e)=>{W.init(t,e),t._zod.optin="optional",t._zod.optout="optional",U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${dr(r.source)})?$`):void 0}),t._zod.parse=(r,o)=>{if(e.innerType._zod.optin==="optional"){let n=r.value,s=e.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>nu(i,n)):nu(s,n)}return r.value===void 0?r:e.innerType._zod.run(r,o)}}),Hu=g("$ZodExactOptional",(t,e)=>{rs.init(t,e),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,o)=>e.innerType._zod.run(r,o)}),Gu=g("$ZodNullable",(t,e)=>{W.init(t,e),U(t._zod,"optin",()=>e.innerType._zod.optin),U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${dr(r.source)}|null)$`):void 0}),U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,o)=>r.value===null?r:e.innerType._zod.run(r,o)}),Ku=g("$ZodDefault",(t,e)=>{W.init(t,e),t._zod.optin="optional",U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>su(s,e)):su(n,e)}});function su(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Yu=g("$ZodPrefault",(t,e)=>{W.init(t,e),t._zod.optin="optional",U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,o))}),Qu=g("$ZodNonOptional",(t,e)=>{W.init(t,e),U(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>iu(s,t)):iu(n,t)}});function iu(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var Xu=g("$ZodCatch",(t,e)=>{W.init(t,e),t._zod.optin="optional",U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Ee(i,o,Se()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>Ee(s,o,Se()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var os=g("$ZodPipe",(t,e)=>{W.init(t,e),U(t._zod,"values",()=>e.in._zod.values),U(t._zod,"optin",()=>e.in._zod.optin),U(t._zod,"optout",()=>e.out._zod.optout),U(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=e.out._zod.run(r,o);return s instanceof Promise?s.then(i=>$o(i,e.in,o)):$o(s,e.in,o)}let n=e.in._zod.run(r,o);return n instanceof Promise?n.then(s=>$o(s,e.out,o)):$o(n,e.out,o)}});function $o(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}var el=g("$ZodPreprocess",(t,e)=>{os.init(t,e)}),tl=g("$ZodReadonly",(t,e)=>{W.init(t,e),U(t._zod,"propValues",()=>e.innerType._zod.propValues),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"optin",()=>e.innerType?._zod?.optin),U(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(au):au(n)}});function au(t){return t.value=Object.freeze(t.value),t}var rl=g("$ZodCustom",(t,e)=>{ie.init(t,e),W.init(t,e),t._zod.parse=(r,o)=>r,t._zod.check=r=>{let o=r.value,n=e.fn(o);if(n instanceof Promise)return n.then(s=>cu(s,r,o,t));cu(n,r,o,t)}});function cu(t,e,r,o){if(!t){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),e.issues.push(At(n))}}var Vh=()=>{let t={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 e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=Jn(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${ho(n.values[0])}`:`Invalid option: expected one of ${po(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${po(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function ol(){return{localeError:Vh()}}var nl;var ns=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let o=r[0];return this._map.set(e,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Bh(){return new ns}(nl=globalThis).__zod_globalRegistry??(nl.__zod_globalRegistry=Bh());var bt=globalThis.__zod_globalRegistry;function sl(t,e){return new t({type:"string",...T(e)})}function il(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...T(e)})}function ss(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...T(e)})}function al(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...T(e)})}function cl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(e)})}function ul(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(e)})}function ll(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(e)})}function dl(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...T(e)})}function pl(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...T(e)})}function fl(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(e)})}function ml(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...T(e)})}function hl(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(e)})}function gl(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...T(e)})}function yl(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...T(e)})}function _l(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(e)})}function bl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(e)})}function vl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(e)})}function wl(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(e)})}function $l(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(e)})}function xl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...T(e)})}function kl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...T(e)})}function Sl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...T(e)})}function zl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...T(e)})}function Pl(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(e)})}function Tl(t,e){return new t({type:"string",format:"date",check:"string_format",...T(e)})}function El(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...T(e)})}function Rl(t,e){return new t({type:"string",format:"duration",check:"string_format",...T(e)})}function Il(t,e){return new t({type:"number",checks:[],...T(e)})}function Ol(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...T(e)})}function Nl(t,e){return new t({type:"boolean",...T(e)})}function Cl(t,e){return new t({type:"null",...T(e)})}function Al(t){return new t({type:"unknown"})}function Zl(t,e){return new t({type:"never",...T(e)})}function So(t,e){return new Yn({check:"less_than",...T(e),value:t,inclusive:!1})}function yr(t,e){return new Yn({check:"less_than",...T(e),value:t,inclusive:!0})}function zo(t,e){return new Qn({check:"greater_than",...T(e),value:t,inclusive:!1})}function _r(t,e){return new Qn({check:"greater_than",...T(e),value:t,inclusive:!0})}function Po(t,e){return new Lc({check:"multiple_of",...T(e),value:t})}function To(t,e){return new Fc({check:"max_length",...T(e),maximum:t})}function Zt(t,e){return new Vc({check:"min_length",...T(e),minimum:t})}function Eo(t,e){return new Bc({check:"length_equals",...T(e),length:t})}function is(t,e){return new Jc({check:"string_format",format:"regex",...T(e),pattern:t})}function as(t){return new Wc({check:"string_format",format:"lowercase",...T(t)})}function cs(t){return new Hc({check:"string_format",format:"uppercase",...T(t)})}function us(t,e){return new Gc({check:"string_format",format:"includes",...T(e),includes:t})}function ls(t,e){return new Kc({check:"string_format",format:"starts_with",...T(e),prefix:t})}function ds(t,e){return new Yc({check:"string_format",format:"ends_with",...T(e),suffix:t})}function it(t){return new Qc({check:"overwrite",tx:t})}function ps(t){return it(e=>e.normalize(t))}function fs(){return it(t=>t.trim())}function ms(){return it(t=>t.toLowerCase())}function hs(){return it(t=>t.toUpperCase())}function gs(){return it(t=>qn(t))}function jl(t,e,r){return new t({type:"array",element:e,...T(r)})}function Dl(t,e,r){let o=T(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function Ml(t,e,r){return new t({type:"custom",check:"custom",fn:e,...T(r)})}function ql(t,e){let r=Jh(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(At(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(At(s))}},t(o.value,o)),e);return r}function Jh(t,e){let r=new ie({check:"custom",...T(e)});return r._zod.check=t,r}function ys(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??bt,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function re(t,e,r={path:[],schemaPath:[]}){var o;let n=t._zod.def,s=e.seen.get(t);if(s)return s.count++,r.schemaPath.includes(t)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,i);let a=t._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,i.schema,l);else{let p=i.schema,f=e.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(i.ref||(i.ref=d),re(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(i.schema,c),e.io==="input"&&he(t)&&(delete i.schema.examples,delete i.schema.default),e.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,e.seen.get(t).schema}function _s(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of t.seen.entries()){let a=t.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(i[0])?.id,p=t.external.uri??(m=>m);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(t.cycles==="throw")for(let i of t.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
71
|
-
|
|
72
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of t.seen.entries()){let a=i[1];if(e===i[0]){s(i);continue}if(t.external){let u=t.external.registry.get(i[0])?.id;if(e!==i[0]&&u){s(i);continue}}if(t.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&t.reused==="ref"){s(i);continue}}}function bs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=t.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let f=t.seen.get(d),m=f.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===d)for(let _ in u)_==="$ref"||_==="allOf"||_ in l||delete u[_];if(m.$ref&&f.def)for(let _ in u)_==="$ref"||_==="allOf"||_ in f.def&&JSON.stringify(u[_])===JSON.stringify(f.def[_])&&delete u[_]}let p=a._zod.parent;if(p&&p!==d){o(p);let f=t.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let m in u)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(u[m])===JSON.stringify(f.def[m])&&delete u[m]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())o(a[0]);let n={};if(t.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}Object.assign(n,r.def??r.schema);let s=t.metadataRegistry.get(e)?.id;s!==void 0&&n.id===s&&delete n.id;let i=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:br(e,"input",t.processors),output:br(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function he(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return he(o.element,r);if(o.type==="set")return he(o.valueType,r);if(o.type==="lazy")return he(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return he(o.innerType,r);if(o.type==="intersection")return he(o.left,r)||he(o.right,r);if(o.type==="record"||o.type==="map")return he(o.keyType,r)||he(o.valueType,r);if(o.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:he(o.in,r)||he(o.out,r);if(o.type==="object"){for(let n in o.shape)if(he(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(he(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(he(n,r))return!0;return!!(o.rest&&he(o.rest,r))}return!1}var Ll=(t,e={})=>r=>{let o=ys({...r,processors:e});return re(t,o),_s(o,t),bs(o,t)},br=(t,e,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=ys({...n??{},target:s,io:e,processors:r});return re(t,i),_s(i,t),bs(i,t)};var Wh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ul=(t,e,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=Wh[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Fl=(t,e,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";d?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),p?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},Vl=(t,e,r,o)=>{r.type="boolean"};var Bl=(t,e,r,o)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Jl=(t,e,r,o)=>{r.not={}};var Wl=(t,e,r,o)=>{};var Hl=(t,e,r,o)=>{let n=t._zod.def,s=ur(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Gl=(t,e,r,o)=>{let n=t._zod.def,s=[];for(let i of n.values)if(i===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var Kl=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Yl=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Ql=(t,e,r,o)=>{let n=r,s=t._zod.def,{minimum:i,maximum:a}=t._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=re(s.element,e,{...o,path:[...o.path,"items"]})},Xl=(t,e,r,o)=>{let n=r,s=t._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=re(i[u],e,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=re(s.catchall,e,{...o,path:[...o.path,"additionalProperties"]})):e.io==="output"&&(n.additionalProperties=!1)},ed=(t,e,r,o)=>{let n=t._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>re(a,e,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},td=(t,e,r,o)=>{let n=t._zod.def,s=re(n.left,e,{...o,path:[...o.path,"allOf",0]}),i=re(n.right,e,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var rd=(t,e,r,o)=>{let n=r,s=t._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,e,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)n.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(n.propertyNames=re(s.keyType,e,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=re(s.valueType,e,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l)}},od=(t,e,r,o)=>{let n=t._zod.def,s=re(n.innerType,e,o),i=e.seen.get(t);e.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},nd=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType},sd=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},id=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},ad=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},cd=(t,e,r,o)=>{let n=t._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=e.io==="input"?s?n.out:n.in:n.out;re(i,e,o);let a=e.seen.get(t);a.ref=i},ud=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,r.readOnly=!0};var vs=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType};function jt(t){return!!t._zod}function at(t,e){return jt(t)?mr(t,e):t.safeParse(e)}function Ro(t){if(!t)return;let e;if(jt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function ld(t){if(jt(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var wr={};Ba(wr,{ZodISODate:()=>pd,ZodISODateTime:()=>dd,ZodISODuration:()=>md,ZodISOTime:()=>fd,date:()=>$s,datetime:()=>ws,duration:()=>ks,time:()=>xs});var dd=g("ZodISODateTime",(t,e)=>{vu.init(t,e),Q.init(t,e)});function ws(t){return Pl(dd,t)}var pd=g("ZodISODate",(t,e)=>{wu.init(t,e),Q.init(t,e)});function $s(t){return Tl(pd,t)}var fd=g("ZodISOTime",(t,e)=>{$u.init(t,e),Q.init(t,e)});function xs(t){return El(fd,t)}var md=g("ZodISODuration",(t,e)=>{xu.init(t,e),Q.init(t,e)});function ks(t){return Rl(md,t)}var rg=(t,e)=>{go.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>oc(t,r)},flatten:{value:r=>rc(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Nt,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Nt,2)}},isEmpty:{get(){return t.issues.length===0}}})};var ze=g("ZodError",rg,{Parent:Error});var hd=yo(ze),gd=_o(ze),yd=fr(ze),_d=hr(ze),bd=nc(ze),vd=sc(ze),wd=ic(ze),$d=ac(ze),xd=cc(ze),kd=uc(ze),Sd=lc(ze),zd=dc(ze);var Pd=new WeakMap;function $r(t,e,r){let o=Object.getPrototypeOf(t),n=Pd.get(o);if(n||(n=new Set,Pd.set(o,n)),!n.has(e)){n.add(e);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var te=g("ZodType",(t,e)=>(W.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:br(t,"input"),output:br(t,"output")}}),t.toJSONSchema=Ll(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,o)=>hd(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>yd(t,r,o),t.parseAsync=async(r,o)=>gd(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>_d(t,r,o),t.spa=t.safeParseAsync,t.encode=(r,o)=>bd(t,r,o),t.decode=(r,o)=>vd(t,r,o),t.encodeAsync=async(r,o)=>wd(t,r,o),t.decodeAsync=async(r,o)=>$d(t,r,o),t.safeEncode=(r,o)=>xd(t,r,o),t.safeDecode=(r,o)=>kd(t,r,o),t.safeEncodeAsync=async(r,o)=>Sd(t,r,o),t.safeDecodeAsync=async(r,o)=>zd(t,r,o),$r(t,"ZodType",{check(...r){let o=this.def;return this.clone(D.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return je(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(Jg(r,o))},superRefine(r,o){return this.check(Wg(r,o))},overwrite(r){return this.check(it(r))},optional(){return ee(this)},exactOptional(){return Cg(this)},nullable(){return Id(this)},nullish(){return ee(Id(this))},nonoptional(r){return qg(this,r)},array(){return Z(this)},or(r){return G([this,r])},and(r){return Oo(this,r)},transform(r){return Od(this,Dd(r))},default(r){return jg(this,r)},prefault(r){return Mg(this,r)},catch(r){return Ug(this,r)},pipe(r){return Od(this,r)},readonly(){return Bg(this)},describe(r){let o=this.clone();return bt.add(o,{description:r}),o},meta(...r){if(r.length===0)return bt.get(this);let o=this.clone();return bt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return bt.get(t)?.description},configurable:!0}),t)),Nd=g("_ZodString",(t,e)=>{ko.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Ul(t,o,n,s);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,$r(t,"_ZodString",{regex(...o){return this.check(is(...o))},includes(...o){return this.check(us(...o))},startsWith(...o){return this.check(ls(...o))},endsWith(...o){return this.check(ds(...o))},min(...o){return this.check(Zt(...o))},max(...o){return this.check(To(...o))},length(...o){return this.check(Eo(...o))},nonempty(...o){return this.check(Zt(1,...o))},lowercase(o){return this.check(as(o))},uppercase(o){return this.check(cs(o))},trim(){return this.check(fs())},normalize(...o){return this.check(ps(...o))},toLowerCase(){return this.check(ms())},toUpperCase(){return this.check(hs())},slugify(){return this.check(gs())}})}),ng=g("ZodString",(t,e)=>{ko.init(t,e),Nd.init(t,e),t.email=r=>t.check(il(sg,r)),t.url=r=>t.check(dl(ig,r)),t.jwt=r=>t.check(zl(wg,r)),t.emoji=r=>t.check(pl(ag,r)),t.guid=r=>t.check(ss(Td,r)),t.uuid=r=>t.check(al(Io,r)),t.uuidv4=r=>t.check(cl(Io,r)),t.uuidv6=r=>t.check(ul(Io,r)),t.uuidv7=r=>t.check(ll(Io,r)),t.nanoid=r=>t.check(fl(cg,r)),t.guid=r=>t.check(ss(Td,r)),t.cuid=r=>t.check(ml(ug,r)),t.cuid2=r=>t.check(hl(lg,r)),t.ulid=r=>t.check(gl(dg,r)),t.base64=r=>t.check(xl(_g,r)),t.base64url=r=>t.check(kl(bg,r)),t.xid=r=>t.check(yl(pg,r)),t.ksuid=r=>t.check(_l(fg,r)),t.ipv4=r=>t.check(bl(mg,r)),t.ipv6=r=>t.check(vl(hg,r)),t.cidrv4=r=>t.check(wl(gg,r)),t.cidrv6=r=>t.check($l(yg,r)),t.e164=r=>t.check(Sl(vg,r)),t.datetime=r=>t.check(ws(r)),t.date=r=>t.check($s(r)),t.time=r=>t.check(xs(r)),t.duration=r=>t.check(ks(r))});function h(t){return sl(ng,t)}var Q=g("ZodStringFormat",(t,e)=>{H.init(t,e),Nd.init(t,e)}),sg=g("ZodEmail",(t,e)=>{du.init(t,e),Q.init(t,e)});var Td=g("ZodGUID",(t,e)=>{uu.init(t,e),Q.init(t,e)});var Io=g("ZodUUID",(t,e)=>{lu.init(t,e),Q.init(t,e)});var ig=g("ZodURL",(t,e)=>{pu.init(t,e),Q.init(t,e)});var ag=g("ZodEmoji",(t,e)=>{fu.init(t,e),Q.init(t,e)});var cg=g("ZodNanoID",(t,e)=>{mu.init(t,e),Q.init(t,e)});var ug=g("ZodCUID",(t,e)=>{hu.init(t,e),Q.init(t,e)});var lg=g("ZodCUID2",(t,e)=>{gu.init(t,e),Q.init(t,e)});var dg=g("ZodULID",(t,e)=>{yu.init(t,e),Q.init(t,e)});var pg=g("ZodXID",(t,e)=>{_u.init(t,e),Q.init(t,e)});var fg=g("ZodKSUID",(t,e)=>{bu.init(t,e),Q.init(t,e)});var mg=g("ZodIPv4",(t,e)=>{ku.init(t,e),Q.init(t,e)});var hg=g("ZodIPv6",(t,e)=>{Su.init(t,e),Q.init(t,e)});var gg=g("ZodCIDRv4",(t,e)=>{zu.init(t,e),Q.init(t,e)});var yg=g("ZodCIDRv6",(t,e)=>{Pu.init(t,e),Q.init(t,e)});var _g=g("ZodBase64",(t,e)=>{Eu.init(t,e),Q.init(t,e)});var bg=g("ZodBase64URL",(t,e)=>{Ru.init(t,e),Q.init(t,e)});var vg=g("ZodE164",(t,e)=>{Iu.init(t,e),Q.init(t,e)});var wg=g("ZodJWT",(t,e)=>{Ou.init(t,e),Q.init(t,e)});var Cd=g("ZodNumber",(t,e)=>{es.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Fl(t,o,n,s),$r(t,"ZodNumber",{gt(o,n){return this.check(zo(o,n))},gte(o,n){return this.check(_r(o,n))},min(o,n){return this.check(_r(o,n))},lt(o,n){return this.check(So(o,n))},lte(o,n){return this.check(yr(o,n))},max(o,n){return this.check(yr(o,n))},int(o){return this.check(Ed(o))},safe(o){return this.check(Ed(o))},positive(o){return this.check(zo(0,o))},nonnegative(o){return this.check(_r(0,o))},negative(o){return this.check(So(0,o))},nonpositive(o){return this.check(yr(0,o))},multipleOf(o,n){return this.check(Po(o,n))},step(o,n){return this.check(Po(o,n))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function F(t){return Il(Cd,t)}var $g=g("ZodNumberFormat",(t,e)=>{Nu.init(t,e),Cd.init(t,e)});function Ed(t){return Ol($g,t)}var xg=g("ZodBoolean",(t,e)=>{Cu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Vl(t,r,o,n)});function se(t){return Nl(xg,t)}var kg=g("ZodNull",(t,e)=>{Au.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Bl(t,r,o,n)});function Ad(t){return Cl(kg,t)}var Sg=g("ZodUnknown",(t,e)=>{Zu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Wl(t,r,o,n)});function X(){return Al(Sg)}var zg=g("ZodNever",(t,e)=>{ju.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Jl(t,r,o,n)});function Pg(t){return Zl(zg,t)}var Tg=g("ZodArray",(t,e)=>{Du.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Ql(t,r,o,n),t.element=e.element,$r(t,"ZodArray",{min(r,o){return this.check(Zt(r,o))},nonempty(r){return this.check(Zt(1,r))},max(r,o){return this.check(To(r,o))},length(r,o){return this.check(Eo(r,o))},unwrap(){return this.element}})});function Z(t,e){return jl(Tg,t,e)}var Zd=g("ZodObject",(t,e)=>{Lu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Xl(t,r,o,n),D.defineLazy(t,"shape",()=>e.shape),$r(t,"ZodObject",{keyof(){return be(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},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:Pg()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return D.extend(this,r)},safeExtend(r){return D.safeExtend(this,r)},merge(r){return D.merge(this,r)},pick(r){return D.pick(this,r)},omit(r){return D.omit(this,r)},partial(...r){return D.partial(Md,this,r[0])},required(...r){return D.required(qd,this,r[0])}})});function w(t,e){let r={type:"object",shape:t??{},...D.normalizeParams(e)};return new Zd(r)}function ge(t,e){return new Zd({type:"object",shape:t,catchall:X(),...D.normalizeParams(e)})}var jd=g("ZodUnion",(t,e)=>{ts.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ed(t,r,o,n),t.options=e.options});function G(t,e){return new jd({type:"union",options:t,...D.normalizeParams(e)})}var Eg=g("ZodDiscriminatedUnion",(t,e)=>{jd.init(t,e),Uu.init(t,e)});function zs(t,e,r){return new Eg({type:"union",options:e,discriminator:t,...D.normalizeParams(r)})}var Rg=g("ZodIntersection",(t,e)=>{Fu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>td(t,r,o,n)});function Oo(t,e){return new Rg({type:"intersection",left:t,right:e})}var Rd=g("ZodRecord",(t,e)=>{Vu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>rd(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType});function J(t,e,r){return!e||!e._zod?new Rd({type:"record",keyType:h(),valueType:t,...D.normalizeParams(e)}):new Rd({type:"record",keyType:t,valueType:e,...D.normalizeParams(r)})}var Ss=g("ZodEnum",(t,e)=>{Bu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Hl(t,o,n,s),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ss({...e,checks:[],...D.normalizeParams(n),entries:s})},t.exclude=(o,n)=>{let s={...e.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ss({...e,checks:[],...D.normalizeParams(n),entries:s})}});function be(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new Ss({type:"enum",entries:r,...D.normalizeParams(e)})}var Ig=g("ZodLiteral",(t,e)=>{Ju.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Gl(t,r,o,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function k(t,e){return new Ig({type:"literal",values:Array.isArray(t)?t:[t],...D.normalizeParams(e)})}var Og=g("ZodTransform",(t,e)=>{Wu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Yl(t,r,o,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new It(t.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(D.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),r.issues.push(D.issue(i))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function Dd(t){return new Og({type:"transform",transform:t})}var Md=g("ZodOptional",(t,e)=>{rs.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function ee(t){return new Md({type:"optional",innerType:t})}var Ng=g("ZodExactOptional",(t,e)=>{Hu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Cg(t){return new Ng({type:"optional",innerType:t})}var Ag=g("ZodNullable",(t,e)=>{Gu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>od(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Id(t){return new Ag({type:"nullable",innerType:t})}var Zg=g("ZodDefault",(t,e)=>{Ku.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>sd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function jg(t,e){return new Zg({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():D.shallowClone(e)}})}var Dg=g("ZodPrefault",(t,e)=>{Yu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>id(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Mg(t,e){return new Dg({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():D.shallowClone(e)}})}var qd=g("ZodNonOptional",(t,e)=>{Qu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>nd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function qg(t,e){return new qd({type:"nonoptional",innerType:t,...D.normalizeParams(e)})}var Lg=g("ZodCatch",(t,e)=>{Xu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ad(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Ug(t,e){return new Lg({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Ld=g("ZodPipe",(t,e)=>{os.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>cd(t,r,o,n),t.in=e.in,t.out=e.out});function Od(t,e){return new Ld({type:"pipe",in:t,out:e})}var Fg=g("ZodPreprocess",(t,e)=>{Ld.init(t,e),el.init(t,e)}),Vg=g("ZodReadonly",(t,e)=>{tl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ud(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Bg(t){return new Vg({type:"readonly",innerType:t})}var Ud=g("ZodCustom",(t,e)=>{rl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Kl(t,r,o,n)});function Fd(t,e){return Dl(Ud,t??(()=>!0),e)}function Jg(t,e={}){return Ml(Ud,t,e)}function Wg(t,e){return ql(t,e)}function Ps(t,e){return new Fg({type:"pipe",in:Dd(t),out:e})}Se(ol());var Es="2025-11-25";var Vd=[Es,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ct="io.modelcontextprotocol/related-task",Co="2.0",ne=Fd(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Bd=G([h(),F().int()]),Jd=h(),rz=ge({ttl:F().optional(),pollInterval:F().optional()}),Hg=w({ttl:F().optional()}),Gg=w({taskId:h()}),Rs=ge({progressToken:Bd.optional(),[ct]:Gg.optional()}),Pe=w({_meta:Rs.optional()}),xr=Pe.extend({task:Hg.optional()}),Wd=t=>xr.safeParse(t).success,ae=w({method:h(),params:Pe.loose().optional()}),Re=w({_meta:Rs.optional()}),Ie=w({method:h(),params:Re.loose().optional()}),ce=ge({_meta:Rs.optional()}),Ao=G([h(),F().int()]),Hd=w({jsonrpc:k(Co),id:Ao,...ae.shape}).strict(),Is=t=>Hd.safeParse(t).success,Gd=w({jsonrpc:k(Co),...Ie.shape}).strict(),Kd=t=>Gd.safeParse(t).success,Os=w({jsonrpc:k(Co),id:Ao,result:ce}).strict(),kr=t=>Os.safeParse(t).success;var A;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(A||(A={}));var Ns=w({jsonrpc:k(Co),id:Ao.optional(),error:w({code:F().int(),message:h(),data:X().optional()})}).strict();var Yd=t=>Ns.safeParse(t).success;var Qd=G([Hd,Gd,Os,Ns]),oz=G([Os,Ns]),Zo=ce.strict(),Kg=Re.extend({requestId:Ao.optional(),reason:h().optional()}),jo=Ie.extend({method:k("notifications/cancelled"),params:Kg}),Yg=w({src:h(),mimeType:h().optional(),sizes:Z(h()).optional(),theme:be(["light","dark"]).optional()}),Sr=w({icons:Z(Yg).optional()}),Dt=w({name:h(),title:h().optional()}),Xd=Dt.extend({...Dt.shape,...Sr.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),Qg=Oo(w({applyDefaults:se().optional()}),J(h(),X())),Xg=Ps(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Oo(w({form:Qg.optional(),url:ne.optional()}),J(h(),X()).optional())),ey=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({sampling:ge({createMessage:ne.optional()}).optional(),elicitation:ge({create:ne.optional()}).optional()}).optional()}),ty=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({tools:ge({call:ne.optional()}).optional()}).optional()}),ry=w({experimental:J(h(),ne).optional(),sampling:w({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:Xg.optional(),roots:w({listChanged:se().optional()}).optional(),tasks:ey.optional(),extensions:J(h(),ne).optional()}),oy=Pe.extend({protocolVersion:h(),capabilities:ry,clientInfo:Xd}),Cs=ae.extend({method:k("initialize"),params:oy});var ny=w({experimental:J(h(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:w({listChanged:se().optional()}).optional(),resources:w({subscribe:se().optional(),listChanged:se().optional()}).optional(),tools:w({listChanged:se().optional()}).optional(),tasks:ty.optional(),extensions:J(h(),ne).optional()}),sy=ce.extend({protocolVersion:h(),capabilities:ny,serverInfo:Xd,instructions:h().optional()}),As=Ie.extend({method:k("notifications/initialized"),params:Re.optional()});var Do=ae.extend({method:k("ping"),params:Pe.optional()}),iy=w({progress:F(),total:ee(F()),message:ee(h())}),ay=w({...Re.shape,...iy.shape,progressToken:Bd}),Mo=Ie.extend({method:k("notifications/progress"),params:ay}),cy=Pe.extend({cursor:Jd.optional()}),zr=ae.extend({params:cy.optional()}),Pr=ce.extend({nextCursor:Jd.optional()}),uy=be(["working","input_required","completed","failed","cancelled"]),Tr=w({taskId:h(),status:uy,ttl:G([F(),Ad()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ee(F()),statusMessage:ee(h())}),Mt=ce.extend({task:Tr}),ly=Re.merge(Tr),Er=Ie.extend({method:k("notifications/tasks/status"),params:ly}),qo=ae.extend({method:k("tasks/get"),params:Pe.extend({taskId:h()})}),Lo=ce.merge(Tr),Uo=ae.extend({method:k("tasks/result"),params:Pe.extend({taskId:h()})}),nz=ce.loose(),Fo=zr.extend({method:k("tasks/list")}),Vo=Pr.extend({tasks:Z(Tr)}),Bo=ae.extend({method:k("tasks/cancel"),params:Pe.extend({taskId:h()})}),ep=ce.merge(Tr),tp=w({uri:h(),mimeType:ee(h()),_meta:J(h(),X()).optional()}),rp=tp.extend({text:h()}),Zs=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),op=tp.extend({blob:Zs}),Rr=be(["user","assistant"]),qt=w({audience:Z(Rr).optional(),priority:F().min(0).max(1).optional(),lastModified:wr.datetime({offset:!0}).optional()}),np=w({...Dt.shape,...Sr.shape,uri:h(),description:ee(h()),mimeType:ee(h()),size:ee(F()),annotations:qt.optional(),_meta:ee(ge({}))}),dy=w({...Dt.shape,...Sr.shape,uriTemplate:h(),description:ee(h()),mimeType:ee(h()),annotations:qt.optional(),_meta:ee(ge({}))}),js=zr.extend({method:k("resources/list")}),py=Pr.extend({resources:Z(np)}),fy=zr.extend({method:k("resources/templates/list")}),my=Pr.extend({resourceTemplates:Z(dy)}),Ds=Pe.extend({uri:h()}),hy=Ds,Ms=ae.extend({method:k("resources/read"),params:hy}),gy=ce.extend({contents:Z(G([rp,op]))}),yy=Ie.extend({method:k("notifications/resources/list_changed"),params:Re.optional()}),_y=Ds,by=ae.extend({method:k("resources/subscribe"),params:_y}),vy=Ds,wy=ae.extend({method:k("resources/unsubscribe"),params:vy}),$y=Re.extend({uri:h()}),xy=Ie.extend({method:k("notifications/resources/updated"),params:$y}),ky=w({name:h(),description:ee(h()),required:ee(se())}),Sy=w({...Dt.shape,...Sr.shape,description:ee(h()),arguments:ee(Z(ky)),_meta:ee(ge({}))}),zy=zr.extend({method:k("prompts/list")}),Py=Pr.extend({prompts:Z(Sy)}),Ty=Pe.extend({name:h(),arguments:J(h(),h()).optional()}),Ey=ae.extend({method:k("prompts/get"),params:Ty}),qs=w({type:k("text"),text:h(),annotations:qt.optional(),_meta:J(h(),X()).optional()}),Ls=w({type:k("image"),data:Zs,mimeType:h(),annotations:qt.optional(),_meta:J(h(),X()).optional()}),Us=w({type:k("audio"),data:Zs,mimeType:h(),annotations:qt.optional(),_meta:J(h(),X()).optional()}),Ry=w({type:k("tool_use"),name:h(),id:h(),input:J(h(),X()),_meta:J(h(),X()).optional()}),Iy=w({type:k("resource"),resource:G([rp,op]),annotations:qt.optional(),_meta:J(h(),X()).optional()}),Oy=np.extend({type:k("resource_link")}),Fs=G([qs,Ls,Us,Oy,Iy]),Ny=w({role:Rr,content:Fs}),Cy=ce.extend({description:h().optional(),messages:Z(Ny)}),Ay=Ie.extend({method:k("notifications/prompts/list_changed"),params:Re.optional()}),Zy=w({title:h().optional(),readOnlyHint:se().optional(),destructiveHint:se().optional(),idempotentHint:se().optional(),openWorldHint:se().optional()}),jy=w({taskSupport:be(["required","optional","forbidden"]).optional()}),sp=w({...Dt.shape,...Sr.shape,description:h().optional(),inputSchema:w({type:k("object"),properties:J(h(),ne).optional(),required:Z(h()).optional()}).catchall(X()),outputSchema:w({type:k("object"),properties:J(h(),ne).optional(),required:Z(h()).optional()}).catchall(X()).optional(),annotations:Zy.optional(),execution:jy.optional(),_meta:J(h(),X()).optional()}),Vs=zr.extend({method:k("tools/list")}),Dy=Pr.extend({tools:Z(sp)}),Jo=ce.extend({content:Z(Fs).default([]),structuredContent:J(h(),X()).optional(),isError:se().optional()}),sz=Jo.or(ce.extend({toolResult:X()})),My=xr.extend({name:h(),arguments:J(h(),X()).optional()}),Ir=ae.extend({method:k("tools/call"),params:My}),qy=Ie.extend({method:k("notifications/tools/list_changed"),params:Re.optional()}),iz=w({autoRefresh:se().default(!0),debounceMs:F().int().nonnegative().default(300)}),Or=be(["debug","info","notice","warning","error","critical","alert","emergency"]),Ly=Pe.extend({level:Or}),Bs=ae.extend({method:k("logging/setLevel"),params:Ly}),Uy=Re.extend({level:Or,logger:h().optional(),data:X()}),Fy=Ie.extend({method:k("notifications/message"),params:Uy}),Vy=w({name:h().optional()}),By=w({hints:Z(Vy).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),Jy=w({mode:be(["auto","required","none"]).optional()}),Wy=w({type:k("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:Z(Fs).default([]),structuredContent:w({}).loose().optional(),isError:se().optional(),_meta:J(h(),X()).optional()}),Hy=zs("type",[qs,Ls,Us]),No=zs("type",[qs,Ls,Us,Ry,Wy]),Gy=w({role:Rr,content:G([No,Z(No)]),_meta:J(h(),X()).optional()}),Ky=xr.extend({messages:Z(Gy),modelPreferences:By.optional(),systemPrompt:h().optional(),includeContext:be(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:Z(h()).optional(),metadata:ne.optional(),tools:Z(sp).optional(),toolChoice:Jy.optional()}),Yy=ae.extend({method:k("sampling/createMessage"),params:Ky}),Nr=ce.extend({model:h(),stopReason:ee(be(["endTurn","stopSequence","maxTokens"]).or(h())),role:Rr,content:Hy}),Js=ce.extend({model:h(),stopReason:ee(be(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Rr,content:G([No,Z(No)])}),Qy=w({type:k("boolean"),title:h().optional(),description:h().optional(),default:se().optional()}),Xy=w({type:k("string"),title:h().optional(),description:h().optional(),minLength:F().optional(),maxLength:F().optional(),format:be(["email","uri","date","date-time"]).optional(),default:h().optional()}),e_=w({type:be(["number","integer"]),title:h().optional(),description:h().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),t_=w({type:k("string"),title:h().optional(),description:h().optional(),enum:Z(h()),default:h().optional()}),r_=w({type:k("string"),title:h().optional(),description:h().optional(),oneOf:Z(w({const:h(),title:h()})),default:h().optional()}),o_=w({type:k("string"),title:h().optional(),description:h().optional(),enum:Z(h()),enumNames:Z(h()).optional(),default:h().optional()}),n_=G([t_,r_]),s_=w({type:k("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:w({type:k("string"),enum:Z(h())}),default:Z(h()).optional()}),i_=w({type:k("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:w({anyOf:Z(w({const:h(),title:h()}))}),default:Z(h()).optional()}),a_=G([s_,i_]),c_=G([o_,n_,a_]),u_=G([c_,Qy,Xy,e_]),l_=xr.extend({mode:k("form").optional(),message:h(),requestedSchema:w({type:k("object"),properties:J(h(),u_),required:Z(h()).optional()})}),d_=xr.extend({mode:k("url"),message:h(),elicitationId:h(),url:h().url()}),p_=G([l_,d_]),f_=ae.extend({method:k("elicitation/create"),params:p_}),m_=Re.extend({elicitationId:h()}),h_=Ie.extend({method:k("notifications/elicitation/complete"),params:m_}),Lt=ce.extend({action:be(["accept","decline","cancel"]),content:Ps(t=>t===null?void 0:t,J(h(),G([h(),F(),se(),Z(h())])).optional())}),g_=w({type:k("ref/resource"),uri:h()});var y_=w({type:k("ref/prompt"),name:h()}),__=Pe.extend({ref:G([y_,g_]),argument:w({name:h(),value:h()}),context:w({arguments:J(h(),h()).optional()}).optional()}),b_=ae.extend({method:k("completion/complete"),params:__});var v_=ce.extend({completion:ge({values:Z(h()).max(100),total:ee(F().int()),hasMore:ee(se())})}),w_=w({uri:h().startsWith("file://"),name:h().optional(),_meta:J(h(),X()).optional()}),$_=ae.extend({method:k("roots/list"),params:Pe.optional()}),Ws=ce.extend({roots:Z(w_)}),x_=Ie.extend({method:k("notifications/roots/list_changed"),params:Re.optional()}),az=G([Do,Cs,b_,Bs,Ey,zy,js,fy,Ms,by,wy,Ir,Vs,qo,Uo,Fo,Bo]),cz=G([jo,Mo,As,x_,Er]),uz=G([Zo,Nr,Js,Lt,Ws,Lo,Vo,Mt]),lz=G([Do,Yy,f_,$_,qo,Uo,Fo,Bo]),dz=G([jo,Mo,Fy,xy,yy,qy,Ay,Er,h_]),pz=G([Zo,sy,v_,Cy,Py,py,my,gy,Jo,Dy,Lo,Vo,Mt]),R=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===A.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Ts(n.elicitations,r)}return new t(e,r,o)}},Ts=class extends R{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(A.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function ut(t){return t==="completed"||t==="failed"||t==="cancelled"}var Bz=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Hs(t){let r=Ro(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=ld(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Gs(t,e){let r=at(t,e);if(!r.success)throw r.error;return r.data}var E_=6e4,Wo=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(jo,r=>{this._oncancel(r)}),this.setNotificationHandler(Mo,r=>{this._onprogress(r)}),this.setRequestHandler(Do,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(qo,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(A.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Uo,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new R(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new R(A.InvalidParams,`Task not found: ${s}`);if(!ut(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(ut(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[ct]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Fo,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new R(A.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Bo,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(A.InvalidParams,`Task not found: ${r.params.taskId}`);if(ut(n.status))throw new R(A.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new R(A.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof R?n:new R(A.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),R.fromError(A.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),kr(s)||Yd(s)?this._onresponse(s):Is(s)?this._onrequest(s,i):Kd(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(A.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[ct]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:A.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Wd(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new R(A.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let m=f.relatedTask?.taskId??s;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:A.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),kr(e))o(e);else{let i=new R(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(kr(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),kr(e))n(e);else{let i=R.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof R?i:new R(A.InternalError,String(i))}}return}let s;try{let i=await this.request(e,Mt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(A.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},ut(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new R(A.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(A.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(A.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=P=>{l(P)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(P){d(P);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ct]:c}});let m=P=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(P)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(z=>this._onerror(new Error(`Failed to send cancellation: ${z}`)));let x=P instanceof R?P:new R(A.RequestTimeout,String(P));l(x)};this._responseHandlers.set(p,P=>{if(!o?.signal?.aborted){if(P instanceof Error)return l(P);try{let x=at(r,P.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),o?.signal?.addEventListener("abort",()=>{m(o?.signal?.reason)});let y=o?.timeout??E_,_=()=>m(R.fromError(A.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(p,y,o?.maxTotalTimeout,_,o?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let P=x=>{let z=this._responseHandlers.get(p);z?z(x):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,P),this._enqueueTaskMessage(b,{type:"request",message:f,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(p),l(x)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(p),l(P)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Lo,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Vo,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},ep,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ct]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ct]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[ct]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=Hs(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Gs(e,n);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let o=Hs(e);this._notificationHandlers.set(o,n=>{let s=Gs(e,n);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&Is(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new R(A.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new R(A.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(A.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new R(A.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Er.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ut(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new R(A.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(ut(a.status))throw new R(A.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Er.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ut(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function ip(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function ap(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];ip(i)&&ip(s)?r[n]={...i,...s}:r[n]=s}return r}var Xm=Ja(Aa(),1),eh=Ja(Qm(),1);function Ok(){let t=new Xm.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,eh.default)(t),t}var En=class{constructor(e){this._ajv=e??Ok()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Rn=class{constructor(e){this._server=e}requestStream(e,r,o){return this._server.requestStream(e,r,o)}createMessageStream(e,r){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Nr,r)}elicitInputStream(e,r){let o=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},Lt,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._server.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function th(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function rh(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var In=class extends Wo{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Or.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new En,this.setRequestHandler(Cs,o=>this._oninitialize(o)),this.setNotificationHandler(As,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Bs,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Or.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Rn(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ap(this._capabilities,e)}setRequestHandler(e,r){let n=Ro(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(jt(n)){let a=n;s=a._zod?.def?.value??a.value}else{let a=n;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=at(Ir,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(A.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let m=at(Mt,p);if(!m.success){let y=m.error instanceof Error?m.error.message:String(m.error);throw new R(A.InvalidParams,`Invalid task creation result: ${y}`)}return m.data}let f=at(Jo,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(A.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){rh(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&th(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Vd.includes(r)?r:Es,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"},Zo)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(n.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Js,r):this.request({method:"sampling/createMessage",params:e},Nr,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},Lt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:n},Lt,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new R(A.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(A.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Ws,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import nh from"node:process";var On=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
73
|
-
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),
|
|
74
|
-
`}var Nn=class{constructor(e=nh.stdin,r=nh.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new
|
|
75
|
-
#
|
|
76
|
-
|
|
77
|
-
ZeroWork is a desktop-based
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
### \u2699\uFE0F Advanced Execution Settings (Run Settings)
|
|
100
|
-
|
|
101
|
-
* **\u{1F4C5} Scheduler**: Allows scheduling recurring TaskBot runs directly from the creator dashboard.
|
|
102
|
-
* **\u{1F91D} TaskBot Sharing Options**: TaskBots can be shared via templates or direct links with other ZeroWork users.
|
|
103
|
-
* **\u{1F36A} Cookies & Authentication**: TaskBots maintain browser sessions. If a workflow accesses behind-login content (e.g., LinkedIn, Facebook), valid session cookies are required. Users can configure cookie preservation or add explicit login steps.
|
|
104
|
-
* **\u{1F6E1}\uFE0F Proxies**: To prevent IP bans or access region-locked content, users can assign HTTP/HTTPS/SOCKS5 proxies to specific TaskBots in Run Settings.
|
|
105
|
-
* **\u2601\uFE0F Remote (Cloud) Execution vs Local Agent**:
|
|
106
|
-
* **Local Agent (Default)**: TaskBots execute on the user's local machine via the background ZeroWork Agent.
|
|
107
|
-
* **Cloud Execution**: Runs entirely on ZeroWork's cloud infrastructure.
|
|
108
|
-
* **Windows VPS**: Users can install the ZeroWork Agent on a dedicated Windows Virtual Private Server (VPS) for 24/7 background automation.
|
|
109
|
-
* **\u{1F504} Agent Maintenance**: The ZeroWork Agent must be kept online and updated to the latest version to ensure stable websocket communication with the dashboard.
|
|
70
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let P=f.compile();return(z,S)=>P(p,z,S)},s,i=yt,a=!It.jitless,u=a&&Ln.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=o.value);let m=p.value;return i(m)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(e.shape)),p=s(p,f),l?Mu([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});function ru(t,e,r,o){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;let n=t.filter(s=>!st(s));return n.length===1?(e.value=n[0].value,n[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(i=>Re(i,o,xe())))}),e)}var ts=g("$ZodUnion",(t,e)=>{B.init(t,e),U(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),U(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),U(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),U(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>dr(n.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of e.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>ru(a,o,t,n)):ru(i,o,t,n)}});var Uu=g("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ts.init(t,e);let r=t._zod.parse;U(t._zod,"propValues",()=>{let n={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=At(()=>{let n=e.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(n,s)=>{let i=n.value;if(!yt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),n;let a=o.value.get(i?.[e.discriminator]);return a?a._zod.run(n,s):e.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(o.value.keys()),input:i,path:[e.discriminator],inst:t}),n)}}),Fu=g("$ZodIntersection",(t,e)=>{B.init(t,e),t._zod.parse=(r,o)=>{let n=r.value,s=e.left._zod.run({value:n,issues:[]},o),i=e.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>ou(r,c,u)):ou(r,s,i)}});function Xn(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(nt(t)&&nt(e)){let r=Object.keys(e),o=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(let s of o){let i=Xn(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<t.length;o++){let n=t[o],s=e[o],i=Xn(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ou(t,e,r){let o=new Map,n;for(let a of e.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else t.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else t.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&t.issues.push({...n,keys:s}),st(t))return t;let i=Xn(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}var Vu=g("$ZodRecord",(t,e)=>{B.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!nt(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let s=[],i=e.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Re(f,o,xe())),input:u,path:[u],inst:t});continue}let d=l.value,p=e.valueType._zod.run({value:n[u],issues:[]},o);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&r.issues.push(...Ye(u,f.issues)),r.value[d]=f.value})):(p.issues.length&&r.issues.push(...Ye(u,p.issues)),r.value[d]=p.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Gn.test(a)&&c.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Re(d,o,xe())),input:a,path:[a],inst:t});continue}let l=e.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...Ye(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Ye(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var Ju=g("$ZodEnum",(t,e)=>{B.init(t,e);let r=ur(e.entries),o=new Set(r);t._zod.values=o,t._zod.pattern=new RegExp(`^(${r.filter(n=>Un.has(typeof n)).map(n=>typeof n=="string"?Ge(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:t}),n}}),Hu=g("$ZodLiteral",(t,e)=>{if(B.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(o=>typeof o=="string"?Ge(o):o?Ge(o.toString()):String(o)).join("|")})$`),t._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),o}});var Bu=g("$ZodTransform",(t,e)=>{B.init(t,e),t._zod.optin="optional",t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ot(t.constructor.name);let n=e.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Fe;return r.value=n,r.fallback=!0,r}});function nu(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var rs=g("$ZodOptional",(t,e)=>{B.init(t,e),t._zod.optin="optional",t._zod.optout="optional",U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${dr(r.source)})?$`):void 0}),t._zod.parse=(r,o)=>{if(e.innerType._zod.optin==="optional"){let n=r.value,s=e.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>nu(i,n)):nu(s,n)}return r.value===void 0?r:e.innerType._zod.run(r,o)}}),Wu=g("$ZodExactOptional",(t,e)=>{rs.init(t,e),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,o)=>e.innerType._zod.run(r,o)}),Ku=g("$ZodNullable",(t,e)=>{B.init(t,e),U(t._zod,"optin",()=>e.innerType._zod.optin),U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${dr(r.source)}|null)$`):void 0}),U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,o)=>r.value===null?r:e.innerType._zod.run(r,o)}),Gu=g("$ZodDefault",(t,e)=>{B.init(t,e),t._zod.optin="optional",U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>su(s,e)):su(n,e)}});function su(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var Yu=g("$ZodPrefault",(t,e)=>{B.init(t,e),t._zod.optin="optional",U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,o))}),Qu=g("$ZodNonOptional",(t,e)=>{B.init(t,e),U(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>iu(s,t)):iu(n,t)}});function iu(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var Xu=g("$ZodCatch",(t,e)=>{B.init(t,e),t._zod.optin="optional",U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Re(i,o,xe()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>Re(s,o,xe()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var os=g("$ZodPipe",(t,e)=>{B.init(t,e),U(t._zod,"values",()=>e.in._zod.values),U(t._zod,"optin",()=>e.in._zod.optin),U(t._zod,"optout",()=>e.out._zod.optout),U(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=e.out._zod.run(r,o);return s instanceof Promise?s.then(i=>$o(i,e.in,o)):$o(s,e.in,o)}let n=e.in._zod.run(r,o);return n instanceof Promise?n.then(s=>$o(s,e.out,o)):$o(n,e.out,o)}});function $o(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}var el=g("$ZodPreprocess",(t,e)=>{os.init(t,e)}),tl=g("$ZodReadonly",(t,e)=>{B.init(t,e),U(t._zod,"propValues",()=>e.innerType._zod.propValues),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"optin",()=>e.innerType?._zod?.optin),U(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(au):au(n)}});function au(t){return t.value=Object.freeze(t.value),t}var rl=g("$ZodCustom",(t,e)=>{ie.init(t,e),B.init(t,e),t._zod.parse=(r,o)=>r,t._zod.check=r=>{let o=r.value,n=e.fn(o);if(n instanceof Promise)return n.then(s=>cu(s,r,o,t));cu(n,r,o,t)}});function cu(t,e,r,o){if(!t){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),e.issues.push(Zt(n))}}var Vh=()=>{let t={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 e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=Hn(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${ho(n.values[0])}`:`Invalid option: expected one of ${po(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${po(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function ol(){return{localeError:Vh()}}var nl;var ns=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let o=r[0];return this._map.set(e,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Jh(){return new ns}(nl=globalThis).__zod_globalRegistry??(nl.__zod_globalRegistry=Jh());var bt=globalThis.__zod_globalRegistry;function sl(t,e){return new t({type:"string",...E(e)})}function il(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...E(e)})}function ss(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...E(e)})}function al(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...E(e)})}function cl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(e)})}function ul(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(e)})}function ll(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(e)})}function dl(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...E(e)})}function pl(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...E(e)})}function fl(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(e)})}function ml(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...E(e)})}function hl(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(e)})}function gl(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...E(e)})}function _l(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...E(e)})}function yl(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(e)})}function bl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(e)})}function vl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(e)})}function wl(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(e)})}function $l(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(e)})}function zl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...E(e)})}function kl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...E(e)})}function xl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...E(e)})}function Sl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...E(e)})}function Pl(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(e)})}function El(t,e){return new t({type:"string",format:"date",check:"string_format",...E(e)})}function Tl(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...E(e)})}function Rl(t,e){return new t({type:"string",format:"duration",check:"string_format",...E(e)})}function Ol(t,e){return new t({type:"number",checks:[],...E(e)})}function Il(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...E(e)})}function Nl(t,e){return new t({type:"boolean",...E(e)})}function Al(t,e){return new t({type:"null",...E(e)})}function Zl(t){return new t({type:"unknown"})}function jl(t,e){return new t({type:"never",...E(e)})}function xo(t,e){return new Yn({check:"less_than",...E(e),value:t,inclusive:!1})}function _r(t,e){return new Yn({check:"less_than",...E(e),value:t,inclusive:!0})}function So(t,e){return new Qn({check:"greater_than",...E(e),value:t,inclusive:!1})}function yr(t,e){return new Qn({check:"greater_than",...E(e),value:t,inclusive:!0})}function Po(t,e){return new Lc({check:"multiple_of",...E(e),value:t})}function Eo(t,e){return new Fc({check:"max_length",...E(e),maximum:t})}function jt(t,e){return new Vc({check:"min_length",...E(e),minimum:t})}function To(t,e){return new Jc({check:"length_equals",...E(e),length:t})}function is(t,e){return new Hc({check:"string_format",format:"regex",...E(e),pattern:t})}function as(t){return new Bc({check:"string_format",format:"lowercase",...E(t)})}function cs(t){return new Wc({check:"string_format",format:"uppercase",...E(t)})}function us(t,e){return new Kc({check:"string_format",format:"includes",...E(e),includes:t})}function ls(t,e){return new Gc({check:"string_format",format:"starts_with",...E(e),prefix:t})}function ds(t,e){return new Yc({check:"string_format",format:"ends_with",...E(e),suffix:t})}function it(t){return new Qc({check:"overwrite",tx:t})}function ps(t){return it(e=>e.normalize(t))}function fs(){return it(t=>t.trim())}function ms(){return it(t=>t.toLowerCase())}function hs(){return it(t=>t.toUpperCase())}function gs(){return it(t=>Mn(t))}function Cl(t,e,r){return new t({type:"array",element:e,...E(r)})}function Dl(t,e,r){let o=E(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function ql(t,e,r){return new t({type:"custom",check:"custom",fn:e,...E(r)})}function Ml(t,e){let r=Hh(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Zt(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Zt(s))}},t(o.value,o)),e);return r}function Hh(t,e){let r=new ie({check:"custom",...E(e)});return r._zod.check=t,r}function _s(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??bt,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function re(t,e,r={path:[],schemaPath:[]}){var o;let n=t._zod.def,s=e.seen.get(t);if(s)return s.count++,r.schemaPath.includes(t)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,i);let a=t._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,i.schema,l);else{let p=i.schema,f=e.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(i.ref||(i.ref=d),re(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(i.schema,c),e.io==="input"&&he(t)&&(delete i.schema.examples,delete i.schema.default),e.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,e.seen.get(t).schema}function ys(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of t.seen.entries()){let a=t.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(i[0])?.id,p=t.external.uri??(m=>m);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(t.cycles==="throw")for(let i of t.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
71
|
+
|
|
72
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of t.seen.entries()){let a=i[1];if(e===i[0]){s(i);continue}if(t.external){let u=t.external.registry.get(i[0])?.id;if(e!==i[0]&&u){s(i);continue}}if(t.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&t.reused==="ref"){s(i);continue}}}function bs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=t.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let f=t.seen.get(d),m=f.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let p=a._zod.parent;if(p&&p!==d){o(p);let f=t.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let m in u)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(u[m])===JSON.stringify(f.def[m])&&delete u[m]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())o(a[0]);let n={};if(t.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}Object.assign(n,r.def??r.schema);let s=t.metadataRegistry.get(e)?.id;s!==void 0&&n.id===s&&delete n.id;let i=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:br(e,"input",t.processors),output:br(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function he(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return he(o.element,r);if(o.type==="set")return he(o.valueType,r);if(o.type==="lazy")return he(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return he(o.innerType,r);if(o.type==="intersection")return he(o.left,r)||he(o.right,r);if(o.type==="record"||o.type==="map")return he(o.keyType,r)||he(o.valueType,r);if(o.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:he(o.in,r)||he(o.out,r);if(o.type==="object"){for(let n in o.shape)if(he(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(he(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(he(n,r))return!0;return!!(o.rest&&he(o.rest,r))}return!1}var Ll=(t,e={})=>r=>{let o=_s({...r,processors:e});return re(t,o),ys(o,t),bs(o,t)},br=(t,e,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=_s({...n??{},target:s,io:e,processors:r});return re(t,i),ys(i,t),bs(i,t)};var Bh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ul=(t,e,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=Bh[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Fl=(t,e,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";d?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),p?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},Vl=(t,e,r,o)=>{r.type="boolean"};var Jl=(t,e,r,o)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var Hl=(t,e,r,o)=>{r.not={}};var Bl=(t,e,r,o)=>{};var Wl=(t,e,r,o)=>{let n=t._zod.def,s=ur(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Kl=(t,e,r,o)=>{let n=t._zod.def,s=[];for(let i of n.values)if(i===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var Gl=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var Yl=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Ql=(t,e,r,o)=>{let n=r,s=t._zod.def,{minimum:i,maximum:a}=t._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=re(s.element,e,{...o,path:[...o.path,"items"]})},Xl=(t,e,r,o)=>{let n=r,s=t._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=re(i[u],e,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=re(s.catchall,e,{...o,path:[...o.path,"additionalProperties"]})):e.io==="output"&&(n.additionalProperties=!1)},ed=(t,e,r,o)=>{let n=t._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>re(a,e,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},td=(t,e,r,o)=>{let n=t._zod.def,s=re(n.left,e,{...o,path:[...o.path,"allOf",0]}),i=re(n.right,e,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var rd=(t,e,r,o)=>{let n=r,s=t._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,e,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)n.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(n.propertyNames=re(s.keyType,e,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=re(s.valueType,e,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l)}},od=(t,e,r,o)=>{let n=t._zod.def,s=re(n.innerType,e,o),i=e.seen.get(t);e.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},nd=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType},sd=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},id=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},ad=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},cd=(t,e,r,o)=>{let n=t._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=e.io==="input"?s?n.out:n.in:n.out;re(i,e,o);let a=e.seen.get(t);a.ref=i},ud=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,r.readOnly=!0};var vs=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType};function Ct(t){return!!t._zod}function at(t,e){return Ct(t)?mr(t,e):t.safeParse(e)}function Ro(t){if(!t)return;let e;if(Ct(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function ld(t){if(Ct(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var wr={};Ja(wr,{ZodISODate:()=>pd,ZodISODateTime:()=>dd,ZodISODuration:()=>md,ZodISOTime:()=>fd,date:()=>$s,datetime:()=>ws,duration:()=>ks,time:()=>zs});var dd=g("ZodISODateTime",(t,e)=>{vu.init(t,e),Q.init(t,e)});function ws(t){return Pl(dd,t)}var pd=g("ZodISODate",(t,e)=>{wu.init(t,e),Q.init(t,e)});function $s(t){return El(pd,t)}var fd=g("ZodISOTime",(t,e)=>{$u.init(t,e),Q.init(t,e)});function zs(t){return Tl(fd,t)}var md=g("ZodISODuration",(t,e)=>{zu.init(t,e),Q.init(t,e)});function ks(t){return Rl(md,t)}var rg=(t,e)=>{go.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>oc(t,r)},flatten:{value:r=>rc(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Nt,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Nt,2)}},isEmpty:{get(){return t.issues.length===0}}})};var Se=g("ZodError",rg,{Parent:Error});var hd=_o(Se),gd=yo(Se),_d=fr(Se),yd=hr(Se),bd=nc(Se),vd=sc(Se),wd=ic(Se),$d=ac(Se),zd=cc(Se),kd=uc(Se),xd=lc(Se),Sd=dc(Se);var Pd=new WeakMap;function $r(t,e,r){let o=Object.getPrototypeOf(t),n=Pd.get(o);if(n||(n=new Set,Pd.set(o,n)),!n.has(e)){n.add(e);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var te=g("ZodType",(t,e)=>(B.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:br(t,"input"),output:br(t,"output")}}),t.toJSONSchema=Ll(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,o)=>hd(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>_d(t,r,o),t.parseAsync=async(r,o)=>gd(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>yd(t,r,o),t.spa=t.safeParseAsync,t.encode=(r,o)=>bd(t,r,o),t.decode=(r,o)=>vd(t,r,o),t.encodeAsync=async(r,o)=>wd(t,r,o),t.decodeAsync=async(r,o)=>$d(t,r,o),t.safeEncode=(r,o)=>zd(t,r,o),t.safeDecode=(r,o)=>kd(t,r,o),t.safeEncodeAsync=async(r,o)=>xd(t,r,o),t.safeDecodeAsync=async(r,o)=>Sd(t,r,o),$r(t,"ZodType",{check(...r){let o=this.def;return this.clone(D.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ce(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(Hg(r,o))},superRefine(r,o){return this.check(Bg(r,o))},overwrite(r){return this.check(it(r))},optional(){return ee(this)},exactOptional(){return Ag(this)},nullable(){return Od(this)},nullish(){return ee(Od(this))},nonoptional(r){return Mg(this,r)},array(){return j(this)},or(r){return K([this,r])},and(r){return Io(this,r)},transform(r){return Id(this,Dd(r))},default(r){return Cg(this,r)},prefault(r){return qg(this,r)},catch(r){return Ug(this,r)},pipe(r){return Id(this,r)},readonly(){return Jg(this)},describe(r){let o=this.clone();return bt.add(o,{description:r}),o},meta(...r){if(r.length===0)return bt.get(this);let o=this.clone();return bt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return bt.get(t)?.description},configurable:!0}),t)),Nd=g("_ZodString",(t,e)=>{ko.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Ul(t,o,n,s);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,$r(t,"_ZodString",{regex(...o){return this.check(is(...o))},includes(...o){return this.check(us(...o))},startsWith(...o){return this.check(ls(...o))},endsWith(...o){return this.check(ds(...o))},min(...o){return this.check(jt(...o))},max(...o){return this.check(Eo(...o))},length(...o){return this.check(To(...o))},nonempty(...o){return this.check(jt(1,...o))},lowercase(o){return this.check(as(o))},uppercase(o){return this.check(cs(o))},trim(){return this.check(fs())},normalize(...o){return this.check(ps(...o))},toLowerCase(){return this.check(ms())},toUpperCase(){return this.check(hs())},slugify(){return this.check(gs())}})}),ng=g("ZodString",(t,e)=>{ko.init(t,e),Nd.init(t,e),t.email=r=>t.check(il(sg,r)),t.url=r=>t.check(dl(ig,r)),t.jwt=r=>t.check(Sl(wg,r)),t.emoji=r=>t.check(pl(ag,r)),t.guid=r=>t.check(ss(Ed,r)),t.uuid=r=>t.check(al(Oo,r)),t.uuidv4=r=>t.check(cl(Oo,r)),t.uuidv6=r=>t.check(ul(Oo,r)),t.uuidv7=r=>t.check(ll(Oo,r)),t.nanoid=r=>t.check(fl(cg,r)),t.guid=r=>t.check(ss(Ed,r)),t.cuid=r=>t.check(ml(ug,r)),t.cuid2=r=>t.check(hl(lg,r)),t.ulid=r=>t.check(gl(dg,r)),t.base64=r=>t.check(zl(yg,r)),t.base64url=r=>t.check(kl(bg,r)),t.xid=r=>t.check(_l(pg,r)),t.ksuid=r=>t.check(yl(fg,r)),t.ipv4=r=>t.check(bl(mg,r)),t.ipv6=r=>t.check(vl(hg,r)),t.cidrv4=r=>t.check(wl(gg,r)),t.cidrv6=r=>t.check($l(_g,r)),t.e164=r=>t.check(xl(vg,r)),t.datetime=r=>t.check(ws(r)),t.date=r=>t.check($s(r)),t.time=r=>t.check(zs(r)),t.duration=r=>t.check(ks(r))});function h(t){return sl(ng,t)}var Q=g("ZodStringFormat",(t,e)=>{W.init(t,e),Nd.init(t,e)}),sg=g("ZodEmail",(t,e)=>{du.init(t,e),Q.init(t,e)});var Ed=g("ZodGUID",(t,e)=>{uu.init(t,e),Q.init(t,e)});var Oo=g("ZodUUID",(t,e)=>{lu.init(t,e),Q.init(t,e)});var ig=g("ZodURL",(t,e)=>{pu.init(t,e),Q.init(t,e)});var ag=g("ZodEmoji",(t,e)=>{fu.init(t,e),Q.init(t,e)});var cg=g("ZodNanoID",(t,e)=>{mu.init(t,e),Q.init(t,e)});var ug=g("ZodCUID",(t,e)=>{hu.init(t,e),Q.init(t,e)});var lg=g("ZodCUID2",(t,e)=>{gu.init(t,e),Q.init(t,e)});var dg=g("ZodULID",(t,e)=>{_u.init(t,e),Q.init(t,e)});var pg=g("ZodXID",(t,e)=>{yu.init(t,e),Q.init(t,e)});var fg=g("ZodKSUID",(t,e)=>{bu.init(t,e),Q.init(t,e)});var mg=g("ZodIPv4",(t,e)=>{ku.init(t,e),Q.init(t,e)});var hg=g("ZodIPv6",(t,e)=>{xu.init(t,e),Q.init(t,e)});var gg=g("ZodCIDRv4",(t,e)=>{Su.init(t,e),Q.init(t,e)});var _g=g("ZodCIDRv6",(t,e)=>{Pu.init(t,e),Q.init(t,e)});var yg=g("ZodBase64",(t,e)=>{Tu.init(t,e),Q.init(t,e)});var bg=g("ZodBase64URL",(t,e)=>{Ru.init(t,e),Q.init(t,e)});var vg=g("ZodE164",(t,e)=>{Ou.init(t,e),Q.init(t,e)});var wg=g("ZodJWT",(t,e)=>{Iu.init(t,e),Q.init(t,e)});var Ad=g("ZodNumber",(t,e)=>{es.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Fl(t,o,n,s),$r(t,"ZodNumber",{gt(o,n){return this.check(So(o,n))},gte(o,n){return this.check(yr(o,n))},min(o,n){return this.check(yr(o,n))},lt(o,n){return this.check(xo(o,n))},lte(o,n){return this.check(_r(o,n))},max(o,n){return this.check(_r(o,n))},int(o){return this.check(Td(o))},safe(o){return this.check(Td(o))},positive(o){return this.check(So(0,o))},nonnegative(o){return this.check(yr(0,o))},negative(o){return this.check(xo(0,o))},nonpositive(o){return this.check(_r(0,o))},multipleOf(o,n){return this.check(Po(o,n))},step(o,n){return this.check(Po(o,n))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function F(t){return Ol(Ad,t)}var $g=g("ZodNumberFormat",(t,e)=>{Nu.init(t,e),Ad.init(t,e)});function Td(t){return Il($g,t)}var zg=g("ZodBoolean",(t,e)=>{Au.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Vl(t,r,o,n)});function se(t){return Nl(zg,t)}var kg=g("ZodNull",(t,e)=>{Zu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Jl(t,r,o,n)});function Zd(t){return Al(kg,t)}var xg=g("ZodUnknown",(t,e)=>{ju.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Bl(t,r,o,n)});function X(){return Zl(xg)}var Sg=g("ZodNever",(t,e)=>{Cu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Hl(t,r,o,n)});function Pg(t){return jl(Sg,t)}var Eg=g("ZodArray",(t,e)=>{Du.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Ql(t,r,o,n),t.element=e.element,$r(t,"ZodArray",{min(r,o){return this.check(jt(r,o))},nonempty(r){return this.check(jt(1,r))},max(r,o){return this.check(Eo(r,o))},length(r,o){return this.check(To(r,o))},unwrap(){return this.element}})});function j(t,e){return Cl(Eg,t,e)}var jd=g("ZodObject",(t,e)=>{Lu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Xl(t,r,o,n),D.defineLazy(t,"shape",()=>e.shape),$r(t,"ZodObject",{keyof(){return be(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},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:Pg()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return D.extend(this,r)},safeExtend(r){return D.safeExtend(this,r)},merge(r){return D.merge(this,r)},pick(r){return D.pick(this,r)},omit(r){return D.omit(this,r)},partial(...r){return D.partial(qd,this,r[0])},required(...r){return D.required(Md,this,r[0])}})});function w(t,e){let r={type:"object",shape:t??{},...D.normalizeParams(e)};return new jd(r)}function ge(t,e){return new jd({type:"object",shape:t,catchall:X(),...D.normalizeParams(e)})}var Cd=g("ZodUnion",(t,e)=>{ts.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ed(t,r,o,n),t.options=e.options});function K(t,e){return new Cd({type:"union",options:t,...D.normalizeParams(e)})}var Tg=g("ZodDiscriminatedUnion",(t,e)=>{Cd.init(t,e),Uu.init(t,e)});function Ss(t,e,r){return new Tg({type:"union",options:e,discriminator:t,...D.normalizeParams(r)})}var Rg=g("ZodIntersection",(t,e)=>{Fu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>td(t,r,o,n)});function Io(t,e){return new Rg({type:"intersection",left:t,right:e})}var Rd=g("ZodRecord",(t,e)=>{Vu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>rd(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType});function H(t,e,r){return!e||!e._zod?new Rd({type:"record",keyType:h(),valueType:t,...D.normalizeParams(e)}):new Rd({type:"record",keyType:t,valueType:e,...D.normalizeParams(r)})}var xs=g("ZodEnum",(t,e)=>{Ju.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>Wl(t,o,n,s),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new xs({...e,checks:[],...D.normalizeParams(n),entries:s})},t.exclude=(o,n)=>{let s={...e.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new xs({...e,checks:[],...D.normalizeParams(n),entries:s})}});function be(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new xs({type:"enum",entries:r,...D.normalizeParams(e)})}var Og=g("ZodLiteral",(t,e)=>{Hu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Kl(t,r,o,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function k(t,e){return new Og({type:"literal",values:Array.isArray(t)?t:[t],...D.normalizeParams(e)})}var Ig=g("ZodTransform",(t,e)=>{Bu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Yl(t,r,o,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ot(t.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(D.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),r.issues.push(D.issue(i))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function Dd(t){return new Ig({type:"transform",transform:t})}var qd=g("ZodOptional",(t,e)=>{rs.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function ee(t){return new qd({type:"optional",innerType:t})}var Ng=g("ZodExactOptional",(t,e)=>{Wu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vs(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Ag(t){return new Ng({type:"optional",innerType:t})}var Zg=g("ZodNullable",(t,e)=>{Ku.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>od(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Od(t){return new Zg({type:"nullable",innerType:t})}var jg=g("ZodDefault",(t,e)=>{Gu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>sd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Cg(t,e){return new jg({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():D.shallowClone(e)}})}var Dg=g("ZodPrefault",(t,e)=>{Yu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>id(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function qg(t,e){return new Dg({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():D.shallowClone(e)}})}var Md=g("ZodNonOptional",(t,e)=>{Qu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>nd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Mg(t,e){return new Md({type:"nonoptional",innerType:t,...D.normalizeParams(e)})}var Lg=g("ZodCatch",(t,e)=>{Xu.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ad(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Ug(t,e){return new Lg({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Ld=g("ZodPipe",(t,e)=>{os.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>cd(t,r,o,n),t.in=e.in,t.out=e.out});function Id(t,e){return new Ld({type:"pipe",in:t,out:e})}var Fg=g("ZodPreprocess",(t,e)=>{Ld.init(t,e),el.init(t,e)}),Vg=g("ZodReadonly",(t,e)=>{tl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ud(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function Jg(t){return new Vg({type:"readonly",innerType:t})}var Ud=g("ZodCustom",(t,e)=>{rl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Gl(t,r,o,n)});function Fd(t,e){return Dl(Ud,t??(()=>!0),e)}function Hg(t,e={}){return ql(Ud,t,e)}function Bg(t,e){return Ml(t,e)}function Ps(t,e){return new Fg({type:"pipe",in:Dd(t),out:e})}xe(ol());var Ts="2025-11-25";var Vd=[Ts,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ct="io.modelcontextprotocol/related-task",Ao="2.0",ne=Fd(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Jd=K([h(),F().int()]),Hd=h(),rS=ge({ttl:F().optional(),pollInterval:F().optional()}),Wg=w({ttl:F().optional()}),Kg=w({taskId:h()}),Rs=ge({progressToken:Jd.optional(),[ct]:Kg.optional()}),Pe=w({_meta:Rs.optional()}),zr=Pe.extend({task:Wg.optional()}),Bd=t=>zr.safeParse(t).success,ae=w({method:h(),params:Pe.loose().optional()}),Oe=w({_meta:Rs.optional()}),Ie=w({method:h(),params:Oe.loose().optional()}),ce=ge({_meta:Rs.optional()}),Zo=K([h(),F().int()]),Wd=w({jsonrpc:k(Ao),id:Zo,...ae.shape}).strict(),Os=t=>Wd.safeParse(t).success,Kd=w({jsonrpc:k(Ao),...Ie.shape}).strict(),Gd=t=>Kd.safeParse(t).success,Is=w({jsonrpc:k(Ao),id:Zo,result:ce}).strict(),kr=t=>Is.safeParse(t).success;var Z;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Z||(Z={}));var Ns=w({jsonrpc:k(Ao),id:Zo.optional(),error:w({code:F().int(),message:h(),data:X().optional()})}).strict();var Yd=t=>Ns.safeParse(t).success;var Qd=K([Wd,Kd,Is,Ns]),oS=K([Is,Ns]),jo=ce.strict(),Gg=Oe.extend({requestId:Zo.optional(),reason:h().optional()}),Co=Ie.extend({method:k("notifications/cancelled"),params:Gg}),Yg=w({src:h(),mimeType:h().optional(),sizes:j(h()).optional(),theme:be(["light","dark"]).optional()}),xr=w({icons:j(Yg).optional()}),Dt=w({name:h(),title:h().optional()}),Xd=Dt.extend({...Dt.shape,...xr.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),Qg=Io(w({applyDefaults:se().optional()}),H(h(),X())),Xg=Ps(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Io(w({form:Qg.optional(),url:ne.optional()}),H(h(),X()).optional())),e_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({sampling:ge({createMessage:ne.optional()}).optional(),elicitation:ge({create:ne.optional()}).optional()}).optional()}),t_=ge({list:ne.optional(),cancel:ne.optional(),requests:ge({tools:ge({call:ne.optional()}).optional()}).optional()}),r_=w({experimental:H(h(),ne).optional(),sampling:w({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:Xg.optional(),roots:w({listChanged:se().optional()}).optional(),tasks:e_.optional(),extensions:H(h(),ne).optional()}),o_=Pe.extend({protocolVersion:h(),capabilities:r_,clientInfo:Xd}),As=ae.extend({method:k("initialize"),params:o_});var n_=w({experimental:H(h(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:w({listChanged:se().optional()}).optional(),resources:w({subscribe:se().optional(),listChanged:se().optional()}).optional(),tools:w({listChanged:se().optional()}).optional(),tasks:t_.optional(),extensions:H(h(),ne).optional()}),s_=ce.extend({protocolVersion:h(),capabilities:n_,serverInfo:Xd,instructions:h().optional()}),Zs=Ie.extend({method:k("notifications/initialized"),params:Oe.optional()});var Do=ae.extend({method:k("ping"),params:Pe.optional()}),i_=w({progress:F(),total:ee(F()),message:ee(h())}),a_=w({...Oe.shape,...i_.shape,progressToken:Jd}),qo=Ie.extend({method:k("notifications/progress"),params:a_}),c_=Pe.extend({cursor:Hd.optional()}),Sr=ae.extend({params:c_.optional()}),Pr=ce.extend({nextCursor:Hd.optional()}),u_=be(["working","input_required","completed","failed","cancelled"]),Er=w({taskId:h(),status:u_,ttl:K([F(),Zd()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ee(F()),statusMessage:ee(h())}),qt=ce.extend({task:Er}),l_=Oe.merge(Er),Tr=Ie.extend({method:k("notifications/tasks/status"),params:l_}),Mo=ae.extend({method:k("tasks/get"),params:Pe.extend({taskId:h()})}),Lo=ce.merge(Er),Uo=ae.extend({method:k("tasks/result"),params:Pe.extend({taskId:h()})}),nS=ce.loose(),Fo=Sr.extend({method:k("tasks/list")}),Vo=Pr.extend({tasks:j(Er)}),Jo=ae.extend({method:k("tasks/cancel"),params:Pe.extend({taskId:h()})}),ep=ce.merge(Er),tp=w({uri:h(),mimeType:ee(h()),_meta:H(h(),X()).optional()}),rp=tp.extend({text:h()}),js=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),op=tp.extend({blob:js}),Rr=be(["user","assistant"]),Mt=w({audience:j(Rr).optional(),priority:F().min(0).max(1).optional(),lastModified:wr.datetime({offset:!0}).optional()}),np=w({...Dt.shape,...xr.shape,uri:h(),description:ee(h()),mimeType:ee(h()),size:ee(F()),annotations:Mt.optional(),_meta:ee(ge({}))}),d_=w({...Dt.shape,...xr.shape,uriTemplate:h(),description:ee(h()),mimeType:ee(h()),annotations:Mt.optional(),_meta:ee(ge({}))}),Cs=Sr.extend({method:k("resources/list")}),p_=Pr.extend({resources:j(np)}),f_=Sr.extend({method:k("resources/templates/list")}),m_=Pr.extend({resourceTemplates:j(d_)}),Ds=Pe.extend({uri:h()}),h_=Ds,qs=ae.extend({method:k("resources/read"),params:h_}),g_=ce.extend({contents:j(K([rp,op]))}),__=Ie.extend({method:k("notifications/resources/list_changed"),params:Oe.optional()}),y_=Ds,b_=ae.extend({method:k("resources/subscribe"),params:y_}),v_=Ds,w_=ae.extend({method:k("resources/unsubscribe"),params:v_}),$_=Oe.extend({uri:h()}),z_=Ie.extend({method:k("notifications/resources/updated"),params:$_}),k_=w({name:h(),description:ee(h()),required:ee(se())}),x_=w({...Dt.shape,...xr.shape,description:ee(h()),arguments:ee(j(k_)),_meta:ee(ge({}))}),S_=Sr.extend({method:k("prompts/list")}),P_=Pr.extend({prompts:j(x_)}),E_=Pe.extend({name:h(),arguments:H(h(),h()).optional()}),T_=ae.extend({method:k("prompts/get"),params:E_}),Ms=w({type:k("text"),text:h(),annotations:Mt.optional(),_meta:H(h(),X()).optional()}),Ls=w({type:k("image"),data:js,mimeType:h(),annotations:Mt.optional(),_meta:H(h(),X()).optional()}),Us=w({type:k("audio"),data:js,mimeType:h(),annotations:Mt.optional(),_meta:H(h(),X()).optional()}),R_=w({type:k("tool_use"),name:h(),id:h(),input:H(h(),X()),_meta:H(h(),X()).optional()}),O_=w({type:k("resource"),resource:K([rp,op]),annotations:Mt.optional(),_meta:H(h(),X()).optional()}),I_=np.extend({type:k("resource_link")}),Fs=K([Ms,Ls,Us,I_,O_]),N_=w({role:Rr,content:Fs}),A_=ce.extend({description:h().optional(),messages:j(N_)}),Z_=Ie.extend({method:k("notifications/prompts/list_changed"),params:Oe.optional()}),j_=w({title:h().optional(),readOnlyHint:se().optional(),destructiveHint:se().optional(),idempotentHint:se().optional(),openWorldHint:se().optional()}),C_=w({taskSupport:be(["required","optional","forbidden"]).optional()}),sp=w({...Dt.shape,...xr.shape,description:h().optional(),inputSchema:w({type:k("object"),properties:H(h(),ne).optional(),required:j(h()).optional()}).catchall(X()),outputSchema:w({type:k("object"),properties:H(h(),ne).optional(),required:j(h()).optional()}).catchall(X()).optional(),annotations:j_.optional(),execution:C_.optional(),_meta:H(h(),X()).optional()}),Vs=Sr.extend({method:k("tools/list")}),D_=Pr.extend({tools:j(sp)}),Ho=ce.extend({content:j(Fs).default([]),structuredContent:H(h(),X()).optional(),isError:se().optional()}),sS=Ho.or(ce.extend({toolResult:X()})),q_=zr.extend({name:h(),arguments:H(h(),X()).optional()}),Or=ae.extend({method:k("tools/call"),params:q_}),M_=Ie.extend({method:k("notifications/tools/list_changed"),params:Oe.optional()}),iS=w({autoRefresh:se().default(!0),debounceMs:F().int().nonnegative().default(300)}),Ir=be(["debug","info","notice","warning","error","critical","alert","emergency"]),L_=Pe.extend({level:Ir}),Js=ae.extend({method:k("logging/setLevel"),params:L_}),U_=Oe.extend({level:Ir,logger:h().optional(),data:X()}),F_=Ie.extend({method:k("notifications/message"),params:U_}),V_=w({name:h().optional()}),J_=w({hints:j(V_).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),H_=w({mode:be(["auto","required","none"]).optional()}),B_=w({type:k("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:j(Fs).default([]),structuredContent:w({}).loose().optional(),isError:se().optional(),_meta:H(h(),X()).optional()}),W_=Ss("type",[Ms,Ls,Us]),No=Ss("type",[Ms,Ls,Us,R_,B_]),K_=w({role:Rr,content:K([No,j(No)]),_meta:H(h(),X()).optional()}),G_=zr.extend({messages:j(K_),modelPreferences:J_.optional(),systemPrompt:h().optional(),includeContext:be(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:j(h()).optional(),metadata:ne.optional(),tools:j(sp).optional(),toolChoice:H_.optional()}),Y_=ae.extend({method:k("sampling/createMessage"),params:G_}),Nr=ce.extend({model:h(),stopReason:ee(be(["endTurn","stopSequence","maxTokens"]).or(h())),role:Rr,content:W_}),Hs=ce.extend({model:h(),stopReason:ee(be(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Rr,content:K([No,j(No)])}),Q_=w({type:k("boolean"),title:h().optional(),description:h().optional(),default:se().optional()}),X_=w({type:k("string"),title:h().optional(),description:h().optional(),minLength:F().optional(),maxLength:F().optional(),format:be(["email","uri","date","date-time"]).optional(),default:h().optional()}),ey=w({type:be(["number","integer"]),title:h().optional(),description:h().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),ty=w({type:k("string"),title:h().optional(),description:h().optional(),enum:j(h()),default:h().optional()}),ry=w({type:k("string"),title:h().optional(),description:h().optional(),oneOf:j(w({const:h(),title:h()})),default:h().optional()}),oy=w({type:k("string"),title:h().optional(),description:h().optional(),enum:j(h()),enumNames:j(h()).optional(),default:h().optional()}),ny=K([ty,ry]),sy=w({type:k("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:w({type:k("string"),enum:j(h())}),default:j(h()).optional()}),iy=w({type:k("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:w({anyOf:j(w({const:h(),title:h()}))}),default:j(h()).optional()}),ay=K([sy,iy]),cy=K([oy,ny,ay]),uy=K([cy,Q_,X_,ey]),ly=zr.extend({mode:k("form").optional(),message:h(),requestedSchema:w({type:k("object"),properties:H(h(),uy),required:j(h()).optional()})}),dy=zr.extend({mode:k("url"),message:h(),elicitationId:h(),url:h().url()}),py=K([ly,dy]),fy=ae.extend({method:k("elicitation/create"),params:py}),my=Oe.extend({elicitationId:h()}),hy=Ie.extend({method:k("notifications/elicitation/complete"),params:my}),Lt=ce.extend({action:be(["accept","decline","cancel"]),content:Ps(t=>t===null?void 0:t,H(h(),K([h(),F(),se(),j(h())])).optional())}),gy=w({type:k("ref/resource"),uri:h()});var _y=w({type:k("ref/prompt"),name:h()}),yy=Pe.extend({ref:K([_y,gy]),argument:w({name:h(),value:h()}),context:w({arguments:H(h(),h()).optional()}).optional()}),by=ae.extend({method:k("completion/complete"),params:yy});var vy=ce.extend({completion:ge({values:j(h()).max(100),total:ee(F().int()),hasMore:ee(se())})}),wy=w({uri:h().startsWith("file://"),name:h().optional(),_meta:H(h(),X()).optional()}),$y=ae.extend({method:k("roots/list"),params:Pe.optional()}),Bs=ce.extend({roots:j(wy)}),zy=Ie.extend({method:k("notifications/roots/list_changed"),params:Oe.optional()}),aS=K([Do,As,by,Js,T_,S_,Cs,f_,qs,b_,w_,Or,Vs,Mo,Uo,Fo,Jo]),cS=K([Co,qo,Zs,zy,Tr]),uS=K([jo,Nr,Hs,Lt,Bs,Lo,Vo,qt]),lS=K([Do,Y_,fy,$y,Mo,Uo,Fo,Jo]),dS=K([Co,qo,F_,z_,__,M_,Z_,Tr,hy]),pS=K([jo,s_,vy,A_,P_,p_,m_,g_,Ho,D_,Lo,Vo,qt]),R=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===Z.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new Es(n.elicitations,r)}return new t(e,r,o)}},Es=class extends R{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(Z.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function ut(t){return t==="completed"||t==="failed"||t==="cancelled"}var JS=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Ws(t){let r=Ro(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=ld(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function Ks(t,e){let r=at(t,e);if(!r.success)throw r.error;return r.data}var Ty=6e4,Bo=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Co,r=>{this._oncancel(r)}),this.setNotificationHandler(qo,r=>{this._onprogress(r)}),this.setRequestHandler(Do,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Mo,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Uo,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new R(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new R(Z.InvalidParams,`Task not found: ${s}`);if(!ut(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(ut(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[ct]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Fo,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new R(Z.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Jo,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new R(Z.InvalidParams,`Task not found: ${r.params.taskId}`);if(ut(n.status))throw new R(Z.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new R(Z.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof R?n:new R(Z.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),R.fromError(Z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),kr(s)||Yd(s)?this._onresponse(s):Os(s)?this._onrequest(s,i):Gd(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(Z.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[ct]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:Z.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Bd(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new R(Z.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let m=f.relatedTask?.taskId??s;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:Z.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),kr(e))o(e);else{let i=new R(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(kr(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),kr(e))n(e);else{let i=R.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof R?i:new R(Z.InternalError,String(i))}}return}let s;try{let i=await this.request(e,qt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(Z.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},ut(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new R(Z.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(Z.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(Z.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=P=>{l(P)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(P){d(P);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[ct]:c}});let m=P=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(P)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let z=P instanceof R?P:new R(Z.RequestTimeout,String(P));l(z)};this._responseHandlers.set(p,P=>{if(!o?.signal?.aborted){if(P instanceof Error)return l(P);try{let z=at(r,P.result);z.success?u(z.data):l(z.error)}catch(z){l(z)}}}),o?.signal?.addEventListener("abort",()=>{m(o?.signal?.reason)});let _=o?.timeout??Ty,y=()=>m(R.fromError(Z.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(p,_,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let b=c?.taskId;if(b){let P=z=>{let S=this._responseHandlers.get(p);S?S(z):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,P),this._enqueueTaskMessage(b,{type:"request",message:f,timestamp:Date.now()}).catch(z=>{this._cleanupTimeout(p),l(z)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>{this._cleanupTimeout(p),l(P)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Lo,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Vo,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},ep,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ct]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ct]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[ct]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=Ws(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=Ks(e,n);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let o=Ws(e);this._notificationHandlers.set(o,n=>{let s=Ks(e,n);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&Os(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new R(Z.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new R(Z.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(Z.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new R(Z.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Tr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),ut(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new R(Z.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(ut(a.status))throw new R(Z.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Tr.parse({method:"notifications/tasks/status",params:c});await this.notification(u),ut(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function ip(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function ap(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];ip(i)&&ip(s)?r[n]={...i,...s}:r[n]=s}return r}var Xm=Ha(Za(),1),eh=Ha(Qm(),1);function Iz(){let t=new Xm.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,eh.default)(t),t}var Tn=class{constructor(e){this._ajv=e??Iz()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Rn=class{constructor(e){this._server=e}requestStream(e,r,o){return this._server.requestStream(e,r,o)}createMessageStream(e,r){let o=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!o?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],s=Array.isArray(n.content)?n.content:[n.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Nr,r)}elicitInputStream(e,r){let o=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":{if(!o?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case"form":{if(!o?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=n==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},Lt,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._server.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function th(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function rh(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var On=class extends Bo{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ir.options.map((o,n)=>[o,n])),this.isMessageIgnored=(o,n)=>{let s=this._loggingLevels.get(n);return s?this.LOG_LEVEL_SEVERITY.get(o)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Tn,this.setRequestHandler(As,o=>this._oninitialize(o)),this.setNotificationHandler(Zs,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Js,async(o,n)=>{let s=n.sessionId||n.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=o.params,a=Ir.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Rn(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ap(this._capabilities,e)}setRequestHandler(e,r){let n=Ro(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(Ct(n)){let a=n;s=a._zod?.def?.value??a.value}else{let a=n;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=at(Or,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(Z.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let m=at(qt,p);if(!m.success){let _=m.error instanceof Error?m.error.message:String(m.error);throw new R(Z.InvalidParams,`Invalid task creation result: ${_}`)}return m.data}let f=at(Ho,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(Z.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){rh(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&th(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Vd.includes(r)?r:Ts,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"},jo)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(n.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(n.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Hs,r):this.request({method:"sampling/createMessage",params:e},Nr,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let n=e;return this.request({method:"elicitation/create",params:n},Lt,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let n=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:n},Lt,r);if(s.action==="accept"&&s.content&&n.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(n.requestedSchema)(s.content);if(!a.valid)throw new R(Z.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(Z.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Bs,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};import nh from"node:process";var In=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
73
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Nz(r)}clear(){this._buffer=void 0}};function Nz(t){return Qd.parse(JSON.parse(t))}function oh(t){return JSON.stringify(t)+`
|
|
74
|
+
`}var Nn=class{constructor(e=nh.stdin,r=nh.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new In,this._started=!1,this._ondata=o=>{this._readBuffer.append(o),this.processReadBuffer()},this._onerror=o=>{this.onerror?.(o)}}async start(){if(this._started)throw new 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(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(r=>{let o=oh(e);this._stdout.write(o)?r():this._stdout.once("drain",r)})}};var Ee={general:`
|
|
75
|
+
# ZeroWork RPA Architecture
|
|
76
|
+
|
|
77
|
+
ZeroWork is a desktop-based RPA platform to mimic human web interactions.
|
|
78
|
+
|
|
79
|
+
- No Public REST API. Uses Webhooks to trigger TaskBot runs remotely.
|
|
80
|
+
- Outbound Data: Uses Send HTTP Request block to transmit data to external services.
|
|
81
|
+
- Dashboard: creator.zerowork.io
|
|
82
|
+
|
|
83
|
+
Key Concepts:
|
|
84
|
+
1. TaskBots: Core automation units executing workflows in a dedicated browser.
|
|
85
|
+
2. Building Blocks: Modular actions (Click, Save, Loop, Condition, HTTP Request).
|
|
86
|
+
3. Webhooks: URLs to start a TaskBot run and pass JSON payloads via zw_webhook_data.
|
|
87
|
+
4. Variables: Temporary runtime data storage for counters and dynamic text.
|
|
88
|
+
5. Tables: Structured data grids (Native or Google Sheets) for scraped data or input lists.
|
|
89
|
+
|
|
90
|
+
Run Settings:
|
|
91
|
+
- Scheduler: Schedule recurring runs from the creator dashboard.
|
|
92
|
+
- Stay on Page after Run: Keeps the browser window open after the bot finishes for inspection.
|
|
93
|
+
- Cookies: Configure cookie preservation for logged-in sessions.
|
|
94
|
+
- Proxies: Assign HTTP/HTTPS/SOCKS5 proxies per TaskBot in Run Settings.
|
|
95
|
+
- Local Agent: Runs on user machine via the background ZeroWork Agent.
|
|
96
|
+
- Cloud Execution: Runs on ZeroWork cloud infrastructure.
|
|
97
|
+
- Windows VPS: Install Agent on VPS for 24/7 background automation.
|
|
98
|
+
- Agent must be kept online and updated to latest version.
|
|
110
99
|
`,webhooks:`
|
|
111
|
-
#
|
|
100
|
+
# ZeroWork Webhooks Guide
|
|
112
101
|
|
|
113
|
-
Webhooks are the primary mechanism for controlling
|
|
102
|
+
Webhooks are the primary mechanism for controlling TaskBots from external systems.
|
|
114
103
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
* Navigate to **Run Settings -> Trigger Run via Webhook**.
|
|
122
|
-
* Click **Generate Webhook URL**.
|
|
123
|
-
|
|
124
|
-
2. **Triggering Request**: Send an HTTP \`GET\` or \`POST\` request to the webhook URL.
|
|
125
|
-
* \`GET\` Request: Simply triggers the TaskBot run.
|
|
126
|
-
* \`POST\` Request (with JSON body): Triggers the run AND injects the JSON payload into the TaskBot's runtime environment.
|
|
127
|
-
|
|
128
|
-
3. **The \`zw_webhook_data\` Variable**:
|
|
129
|
-
* When a JSON payload is sent via \`POST\`, ZeroWork automatically stores the entire JSON object in a reserved system variable named \`zw_webhook_data\`.
|
|
130
|
-
|
|
131
|
-
4. **Extracting Dynamic Data (JSONPath)**:
|
|
132
|
-
* To use fields from the webhook payload inside building blocks (e.g., inserting a dynamic search query or recipient email), use JSONPath syntax within dynamic input fields.
|
|
133
|
-
* **Syntax**: \`{zw_webhook_data: $.propertyName}\`
|
|
134
|
-
* **Example**: If the webhook payload is \`{"email": "test@example.com", "filter": "coaches"}\`, use \`{zw_webhook_data: $.email}\` to insert the email address.
|
|
104
|
+
How to set up:
|
|
105
|
+
1. Open TaskBot in creator dashboard.
|
|
106
|
+
2. Go to Run Settings -> Trigger Run via Webhook.
|
|
107
|
+
3. Click Generate Webhook URL.
|
|
108
|
+
4. GET request: triggers the bot.
|
|
109
|
+
5. POST request with JSON body: triggers the bot and injects data.
|
|
135
110
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
111
|
+
The zw_webhook_data variable:
|
|
112
|
+
- When JSON is sent via POST, ZeroWork stores the entire JSON in zw_webhook_data.
|
|
113
|
+
- Access fields with JSONPath syntax: {zw_webhook_data: $.propertyName}
|
|
114
|
+
- Example: payload {"email": "test@example.com"} -> use {zw_webhook_data: $.email}
|
|
139
115
|
`,variables:`
|
|
140
|
-
#
|
|
116
|
+
# ZeroWork Variables Guide
|
|
141
117
|
|
|
142
|
-
Variables provide
|
|
118
|
+
Variables provide runtime storage for dynamic strings, numbers, and state flags.
|
|
143
119
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
* ** initializing & Setting**: Use the **Start Condition and Set Condition** block or **Update Data** block to assign initial values to variables.
|
|
150
|
-
* **\u{1F522} Counters & Quotas**: Variables are crucial for managing anti-spam limits (e.g., tracking the number of DMs sent).
|
|
151
|
-
* Use the **Number Operations** building block to increment or decrement a numeric variable (e.g., \`dm_counter + 1\`).
|
|
152
|
-
* **\u{1F500} Conditional Logic**: Use variables within **Start Condition** blocks to branch workflows or terminate loops early.
|
|
153
|
-
* *Example*: \`IF dm_counter >= 30 -> Break Repeat\`
|
|
154
|
-
* **\u{1F4DD} Dynamic Insertion**: Refer to variables inside any text input field using curly braces: \`{variable_name}\`.
|
|
120
|
+
- Temporary Scope: Variables only persist for the duration of the TaskBot run.
|
|
121
|
+
- Initialize with Update Data block or Start Condition and Set Condition block.
|
|
122
|
+
- Counters: Use Number Operations block to increment or decrement (e.g. dm_counter + 1).
|
|
123
|
+
- Conditional Logic: Use Start Condition to branch or break loops based on variable values.
|
|
124
|
+
- Dynamic Insertion: Reference variables in any input using curly braces: {variable_name}.
|
|
155
125
|
`,tables:`
|
|
156
|
-
#
|
|
157
|
-
|
|
158
|
-
Data Tables
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
`,selectors:"\n# \u{1F4D4} ZeroWork Selectors Master Class (Robust Element Targeting)\n\nWeb element selectors are critical for reliable browser automation. Brittle selectors cause bot failures when dynamic websites update their layout or class names.\n\n---\n\n### \u{1F3AF} Supported Selector Types\n* **CSS Selectors** (Primary & Recommended)\n* **XPath Selectors** (Advanced fallback)\n\n---\n\n### \u{1F3C6} Master Class Strategies & Syntax Rules\n\n#### 1. Exact Text Matching (ZeroWork Custom Syntax)\n* **Syntax**: `text=\"Exact String\"`\n* **Usage**: Targets buttons, tabs, or links with static labels.\n* **Example**: `button[text=\"Connect\"]` or `a[text=\"See more\"]`\n\n#### 2. Loose Text Matching (Partial/Dynamic Text)\n* **Syntax**: `text=Keyword` (WITHOUT quotes)\n* **Usage**: Targets elements where the text contains dynamic counts or changing phrasing.\n* **Example**: If a button says *\"Associated members (42)\"*, use `button[text=Associated members]`.\n\n#### 3. Loose Attribute Matching (Substring matching)\n* **Syntax**: `[attribute*='value']`\n* **Usage**: Targets elements with dynamic, auto-generated framework classes or complex URLs.\n* **Example**: `a[href*='friends_mutual']` or `div[class*='artdec-card']`\n* **Combining Attributes**: Target highly specific elements by chaining: `a[href*='/about'][role='tab']`\n\n#### 4. Structural Hierarchy & Lists\n* **Child Combinator (`>`)**: Selects direct children. *Example*: `ul.list-container > li`\n* **Descendant Combinator (` `)**: Selects any nested descendant. *Example*: `div.card-body span.title`\n* **List Indexing**: Use `:nth-child(n)` to target specific list items. Inside a **Start Repeat** loop, dynamically target the current item using ZeroWork system tokens: `:nth-child(loop_index, 0)` (0-indexed) or `:nth-child(loop_index, 1)` (1-indexed).\n\n#### 5. Advanced Strategies for Dynamic Sites (LinkedIn & Facebook)\n* **Text Filtering Operator (`>>`)**: Filters a broad structural selector by its inner text.\n * *Example*: To find an email address inside a generic contact modal containing multiple identical layout rows, use: `div.contact-info-row >> text=@`\n* **Complex Overlay Cards**: On sites like LinkedIn, an outer `<a>` tag or overlay often covers an entire card, trapping inner text and preventing direct text selection. \n * *Solution*: Use two separate building blocks/selectors. First, target the interactive link wrapper (e.g., `a[role=\"link\"]`), then use a separate **Save Web Element** block drilling down to the specific text node (e.g., `span[dir='auto'] > span > span`).\n* **Reliable Anchors**: Avoid relying on generic wrapper divs with dynamic IDs (e.g., `ember123`). Instead, anchor to stable semantic attributes like `aria-label` or `role` (e.g., `div[aria-label=\"Suggestions\"]`), then use child combinators to reach the target element.\n\n#### 6. Advanced Sibling Navigation (Solving Dynamic Section Order)\n* **Problem**: On LinkedIn or Facebook profiles, section order is dynamic (e.g., Profile A has About, Activity, Experience; Profile B lacks Activity, making Experience move from `nth-child(4)` to `nth-child(3)`). Relying on `section:nth-child(4)` will fail.\n* **Solution**: Anchor to the unique header ID inside the section, then navigate to its sibling content container using sibling combinators.\n * **Adjacent Sibling (`+`)**: Targets the element immediately following. *Example*: `h2#experience-header + div.content`\n * **General Sibling (`~`)**: Targets any following sibling on the same hierarchy level. *Example*: `div#experience ~ div.pvs-list` (finds the experience list container regardless of intermediate structural headers).\n",building_blocks:"\n# \u{1F3D7}\uFE0F ZeroWork Building Blocks Reference (Comprehensive Catalog)\n\nBuilding blocks are the operational units of a TaskBot. They are categorized by function into Browser, Web Interaction, Logic, Data, External, Files, and Tools.\n\n---\n\n### \u{1F310} 1. Browser Operations\n\n* **\u{1F517} Open Link**: Navigates the active browser tab to a specified URL. \n * *Configuration Modals*: Includes `Link` input field (supports dynamic tokens like `{profile_url}`), `What if the website requires login?` helper, `> More options` (toggle for `Open in a new tab`), and randomized delay (`min sec` / `max sec`).\n* **\u{1F4BE} Save Page URL**: Captures the current browser tab's URL.\n * *Configuration Modals*: Includes `Save current page URL to` dropdown (options to select a table column or variables).\n* **\u{1F500} Switch or Close Tab**: Manages multi-tab workflows.\n * *Configuration Modals*: Includes `Action` radio buttons (`Switch to tab`, `Close tab`) and `Target tab` selection (`Latest tab`, `Previous tab`, `Next tab`, `Tab URL matching`, `Tab number`).\n* **\u25C0\uFE0F Go Back or Forward**: Simulates browser navigation history buttons.\n * *Configuration Modals*: Includes `Action` radio buttons (`Go back`, `Go forward`).\n* **\u{1F680} Launch Browser**: Explicitly starts the browser instance with advanced runtime controls.\n * *Configuration Modals*: Includes `Launch mode`, `Run mode & window` toggles (`Bypass bot detection`, `Run in background`, `Maximize`, `Window size`), and `Cookies` management.\n* **\u{1F6D1} Quit Browser**: Terminates the browser instance.\n * *Configuration Modals*: Includes `Force quit` checkbox.\n* **\u{1F5BC}\uFE0F Switch Frame**: Essential for interacting with iframes (e.g., embedded forms, payment gateways, third-party widgets). Must be executed before targeting elements inside an iframe.\n * *Configuration Modals*: Includes `Target frame` radio buttons (`Iframe`, `Main page`).\n* **\u26A0\uFE0F Browser Alert**: Handles native javascript alerts, prompts, and confirmation dialogs.\n\n---\n\n### \u{1F5B1}\uFE0F 2. Web Interaction\n\n* **\u{1F446} Click Web Element**: Simulates a human click on a target CSS/XPath selector. Includes built-in auto-retry mechanisms.\n * *Configuration Modals*: Includes `Web element selector` input field, `> Selector options` (`Timeout`, `Perform right-click`), `Use human-like clicking` checkbox, and min/max delay.\n* **\u{1F50D} Check Web Element**: Non-blocking diagnostic block. Scans the DOM for a selector and sets a boolean flag (`true`/`false`) in a variable. Crucial for conditional branching (e.g., checking if a \"Premium Required\" modal or \"Private Account\" banner is visible). *Note: Check Web Element does NOT wait for elements or interact with them.*\n * *Configuration Modals & Canvas*: Includes `Web element selector` input field, `> Selector options`, and `[Selector] must be visible on screen` checkbox. Outputs two distinct visual branching paths directly on the canvas: `Not found` (X icon) and `Found` (Check icon).\n* **\u{1F4E5} Save Web Element**: Extracts text, HTML attributes (e.g., `href`, `src`), or counts from a web element.\n * *Configuration Modals*: Includes `Web element selector` input field, `> Selector options` (`Timeout`), `Save as` dropdown (`Text`, `Element`), `Skip if no element is found` checkbox, and `Save to` dropdown (table or variable).\n* **\u270D\uFE0F Insert Text or Data**: Types text into input fields, textareas, or WYSIWYG editors.\n * *Configuration Modals*: Includes `Content` textarea, `Use typing` checkbox (`Don't press Enter line breaks`), `Web element selector (optional)` input field, `> Selector options`, and `Typing speed` radio slider (`FAST`, `AVERAGE`, `SLOW`).\n* **\u2728 Hover Web Element**: Simulates mouse hover to trigger dropdowns, tooltips, or dynamic mega-menus.\n * *Configuration Modals*: Includes `Web element selector` input field, `> Selector options`, and min/max delay.\n* **\u{1F53D} Select Web Dropdown**: Interacts with standard HTML `<select>` dropdowns.\n * *Configuration Modals*: Includes `Dropdown option` input field, `Web element selector` input field, `> Selector options`, and min/max delay.\n* **\u2328\uFE0F Keyboard Action**: Simulates pressing specific keys or key combinations.\n * *Configuration Modals*: Includes `Press a key on your keyboard` input field (e.g., `Enter`, `Tab`, `Escape`, `Ctrl+C`) and min/max delay.\n\n---\n\n### \u{1F500} 3. Logic & Flow Control\n\n* **\u2753 Start Condition**: Evaluates conditional branching logic.\n * *Configuration Modals & Canvas*: Includes `Value to compare to` dropdown (`Select a table or variables`, `Variables`). Canvas tip notes connecting `Set Condition` blocks.\n* **\u{1F3F7}\uFE0F Set Condition**: Defines the specific comparison operator for a condition.\n * *Configuration Modals*: Includes `Comparison type` dropdown (`number comparison`, `Contains keywords`, `Does not contain keywords`, `Data found`, `Data not found`, `Longer than`, `Shorter than`, `Before date`, `After date`, `Is a valid number`, `Else`).\n* **\u{1F501} Start Repeat**: Initiates a loop. Supports *'Auto-detect number of elements'* using a CSS selector to loop exactly as many times as matching elements exist on the page.\n * *Configuration Modals*: Includes `Loop type` radio buttons (`Standard` - add new rows or repeat actions; `Dynamic` - process table rows one by one).\n* **\u{1F517} After Repeat**: Executes actions immediately after a loop completes successfully. Used for chaining workflows.\n* **\u{1F6D1} Break Repeat**: Instantly terminates the current loop and jumps to the After Repeat block. Canvas block displays a `STOP` icon.\n* **\u{1F6E1}\uFE0F Start Try-Catch**: Error handling wrapper. If blocks inside the 'Try' branch fail (e.g., element not found), execution switches gracefully to the 'Catch' branch rather than aborting the bot.\n * *Configuration Modals & Canvas*: Includes `Save error message to (optional)` dropdown. Outputs two visual branching paths on canvas: `Start Try-Catch` and `On Catch Error`.\n* **\u{1F517} After Try-Catch**: Canvas block for resuming workflow post error-handling.\n* **\u26A0\uFE0F Raise Error**: Explicitly flags an error state.\n * *Configuration Modals*: Includes `Error message (optional)` textarea, `Mark the TaskBot run as failed in the run report` checkbox, and `Include this error in the error report` checkbox.\n* **\u274C Abort Run**: Canvas block with an `X` icon to instantly terminate TaskBot execution.\n\n---\n\n### \u{1F9EE} 4. Data Operations\n\n* **\u{1F4DD} Update Data**: Writes or transfers data across variables and table columns.\n * *Configuration Modals*: Includes `Set equal to the following value` input field, `> More options`, and `Data to be updated` dropdown.\n* **\u2795 Number Operations**: Performs mathematical functions on numeric variables.\n * *Configuration Modals*: Includes `Number operation` dropdown (`Add`, `Subtract`, `Multiply`, `Divide`, `Remainder`, `Round`, `Round up`, `Round down`, `Generate a random number`, `Set decimals`, `Remove format`).\n* **\u2728 Format Data**: Cleans and modifies string data.\n * *Configuration Modals*: Includes `Format action` dropdown (`Remove words`, `Replace text`, `Shorten content length`, `Convert to lower case`, `Convert to upper case`, `Capitalize first letters`, `Normalize URL`, `Trim white spaces`, `Remove line breaks`, `Remove smileys`).\n* **\u2702\uFE0F Split Text**: Splits a string by a delimiter (e.g., splitting \"John Doe\" into first/last name).\n * *Configuration Modals*: Includes `Text to split` dropdown.\n* **\u{1F50D} Apply Regex**: Executes regular expressions.\n * *Configuration Modals*: Includes `Method` radio buttons (`Extract matches`, `Check if pattern matches`, `Replace text`).\n* **\u{1F9F9} Remove Duplicates**: Cleans data tables by purging duplicate rows.\n * *Configuration Modals*: Includes `Remove duplicate rows from` dropdown (`Select a table`), and `Preserve related rows` checkbox.\n* **\u{1F5D1}\uFE0F Delete Data**: Clears specified table rows or variables.\n * *Configuration Modals*: Includes `Delete from` dropdown (`Select a table or variables`, `Variables`).\n\n---\n\n### \u{1F50C} 5. External Integrations & Scripting\n\n* **\u{1F916} Ask ChatGPT**: Sends prompts to OpenAI's API. Supports injecting variables into prompts and saving AI responses to tables. Requires configuring OpenAI API keys in ZeroWork settings.\n * *Configuration Modals*: Includes `Model` dropdown (`ChatGPT 5.2`, `ChatGPT 5 Pro`, `ChatGPT 5 Nano`, `ChatGPT 4.1`, `ChatGPT 3`, `ChatGPT 4o`, `ChatGPT 4o mini`, `ChatGPT o1`, `ChatGPT o1 mini`, `ChatGPT 4`, `ChatGPT 4 legacy`), `Your prompt` textarea, and `Save ChatGPT answers to` dropdown.\n* **\u{1F514} Send Notification**: Sends automated email alerts upon specific bot events.\n * *Configuration Modals*: Includes `Subject` input field, `Email content` textarea, and min/max delay. Note confirms email will be sent to the user's registered account address.\n* **\u{1F310} APIs: Send HTTP Request**: Fully functional REST client block for making external API calls.\n * *Configuration Modals*: Includes `Method` dropdown (`GET`, `POST`, `PUT`, `DELETE`), `Request URL` input field, tabs (`HEADERS`, `REQUEST BODY`, `SAVE RESPONSE`), and helper instructions for JSON formatting (`\"someKey\": \"someValue\"`).\n* **\u26A1 Write JavaScript**: Executes custom client-side vanilla JavaScript directly within the active browser page.\n * *Configuration Modals*: Loads a built-in dark-mode IDE code editor, with a `Run locally in the app` checkbox.\n\n---\n\n### \u{1F4C1} 6. Files & OS Tools\n\n* **\u{1F4BE} Save File**: Manages local OS file downloading via browser dialogs.\n * *Configuration Modals*: Includes `File source` radio buttons (`From file URL`, `From download action`) and min/max delay.\n* **\u{1F4E4} Upload File**: Manages local OS file uploading.\n * *Configuration Modals*: Includes `File source` radio buttons (`From file URL`, `From folder path on your computer`) and min/max delay. Tip advises clicking the web upload button first.\n* **\u23F3 Delay**: Pauses bot execution. Essential for anti-bot evasion.\n * *Configuration Modals*: Includes `Pause before the next action` with `Minimum (seconds)` and `Maximum (seconds)` input fields. Tip confirms delay will be randomized between min and max.\n* **\u{1F4C5} Record Date**: Captures the current system timestamp.\n * *Configuration Modals*: Includes `Select date format` dropdown (`Calendar date`, `Day`, `Month`, `Month, typed out`, `Month, abbreviated`, `Year`, `Time`).\n* **\u{1F4F8} Take Screenshot**: Captures viewport screenshots.\n * *Configuration Modals*: Includes `Take screenshot of` radio buttons (`Visible page`, `Full page`, `Web element`), format radio buttons (`.png`, `.jpeg`), `Save screenshot to a folder path on your computer` input field, and `> File options`.\n* **\u{1F4CB} Save from Clipboard**: Reads OS clipboard text.\n * *Configuration Modals*: Includes `Save copied text to` dropdown (`Variables`).\n* **\u{1F4DD} Log**: Writes debug messages to the ZeroWork console.\n * *Configuration Modals*: Includes `Log message` input field, `Tag (optional)` input field, and `Log with status` radio buttons (`Success`, `Fail`, `Warning`).\n",anti_bot:`
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
126
|
+
# ZeroWork Data Tables Guide
|
|
127
|
+
|
|
128
|
+
Data Tables are the primary database for TaskBots.
|
|
129
|
+
|
|
130
|
+
Table Types:
|
|
131
|
+
1. Native Tables: Built-in local grids. Supports CSV import and export.
|
|
132
|
+
2. Google Sheets Integration: Live sync with external Google Sheets.
|
|
133
|
+
|
|
134
|
+
Google Sheets tips:
|
|
135
|
+
- Batch saving: default 50 rows per batch to avoid API rate limits.
|
|
136
|
+
- Change batch size in Start Repeat > Additional options.
|
|
137
|
+
- If auth expires: Google Account -> Data & Privacy -> Third-party apps -> ZeroWork -> Delete all connections, then re-authenticate.
|
|
138
|
+
- After column changes: click Refetch columns from Google Sheet.
|
|
139
|
+
- Column matching is case-insensitive.
|
|
140
|
+
- Duplicating a TaskBot keeps the same Google Sheet link. Click Edit Google Sheet link to connect a new sheet.
|
|
141
|
+
`,selectors:`
|
|
142
|
+
# ZeroWork Selectors Master Class
|
|
143
|
+
|
|
144
|
+
CSS selectors are primary. XPath is the fallback.
|
|
145
|
+
|
|
146
|
+
Selector strategies:
|
|
147
|
+
1. Exact text match: button[text="Connect"] or a[text="See more"]
|
|
148
|
+
2. Loose text match (no quotes): button[text=Associated members]
|
|
149
|
+
3. Substring attribute: a[href*="friends_mutual"] or div[class*="artdec-card"]
|
|
150
|
+
4. Combine attributes: a[href*="/about"][role="tab"]
|
|
151
|
+
5. Child combinator: ul.list-container > li
|
|
152
|
+
6. Descendant: div.card-body span.title
|
|
153
|
+
7. Loop index: li:nth-child(loop_index, 0) (0-indexed) or :nth-child(loop_index, 1)
|
|
154
|
+
8. Text filter operator: div.contact-info-row >> text=@
|
|
155
|
+
9. General sibling: div#experience ~ div.pvs-list (avoids dynamic section order)
|
|
156
|
+
10. Adjacent sibling: h2#experience-header + div.content
|
|
157
|
+
|
|
158
|
+
Avoid auto-generated class names like .button-primary-abc12 or .ember123.
|
|
159
|
+
Anchor to stable attributes: aria-label, role, name, data-test-id.
|
|
160
|
+
`,building_blocks:`
|
|
161
|
+
# ZeroWork Building Blocks Reference
|
|
162
|
+
|
|
163
|
+
Building blocks are the operational units of a TaskBot.
|
|
164
|
+
|
|
165
|
+
BROWSER OPERATIONS:
|
|
166
|
+
- Open Link: Navigate to URL. Supports dynamic tokens, new tab option, min/max delay.
|
|
167
|
+
- Save Page URL: Save current tab URL to variable or table column.
|
|
168
|
+
- Switch or Close Tab: Action: Switch/Close. Target: Latest, Previous, Next, URL match, Tab number.
|
|
169
|
+
- Go Back or Forward: Simulate browser history navigation.
|
|
170
|
+
- Launch Browser: Start browser. Options: bypass bot detection, background run, window size, cookies.
|
|
171
|
+
- Quit Browser: Terminate browser. Force quit option.
|
|
172
|
+
- Switch Frame: MUST run before targeting elements inside an iframe.
|
|
173
|
+
- Browser Alert: Handle native JS alert, confirm, prompt dialogs.
|
|
174
|
+
|
|
175
|
+
WEB INTERACTION:
|
|
176
|
+
- Click Web Element: Simulate human click. Options: right-click, human-like clicking, timeout.
|
|
177
|
+
- Check Web Element: Non-blocking DOM scan. Does NOT wait or interact. Canvas branches: Found / Not found. Use for conditional branching.
|
|
178
|
+
- Save Web Element: Extract text, href, src or counts. Save as Text or Element. Skip if not found option.
|
|
179
|
+
- Insert Text or Data: Type into inputs. Supports spintax and dynamic inputs. Typing speed: FAST/AVERAGE/SLOW.
|
|
180
|
+
- Hover Web Element: Simulate mouse hover to trigger dropdowns and tooltips.
|
|
181
|
+
- Select Web Dropdown: Interact with HTML select dropdowns.
|
|
182
|
+
- Keyboard Action: Simulate keys: Enter, Tab, Escape, Ctrl+C, etc.
|
|
183
|
+
|
|
184
|
+
LOGIC AND FLOW CONTROL:
|
|
185
|
+
- Start Condition + Set Condition: Conditional branching. Comparison types: number comparison, Contains keywords, Does not contain keywords, Data found, Data not found, Longer than, Shorter than, Before date, After date, Is a valid number, Else.
|
|
186
|
+
- Start Repeat: Loop. Standard (add new rows or repeat N times) or Dynamic (process existing table rows). Auto-detect count via CSS selector.
|
|
187
|
+
- After Repeat: Runs after loop completes. Used for chaining workflows.
|
|
188
|
+
- Break Repeat: Exit loop immediately. Jumps to After Repeat.
|
|
189
|
+
- Try-Catch: Error wrapper. If Try fails, execution switches to On Catch Error branch.
|
|
190
|
+
- Raise Error: Flag error state. Options: message, mark run as failed, include in error report.
|
|
191
|
+
- Abort Run: Instantly terminate TaskBot execution.
|
|
192
|
+
|
|
193
|
+
DATA OPERATIONS:
|
|
194
|
+
- Update Data: Write or transfer data across variables and table columns. Use spintax checkbox.
|
|
195
|
+
- Number Operations: Add, Subtract, Multiply, Divide, Remainder, Round, Round up, Round down, Generate random number, Set decimals, Remove format.
|
|
196
|
+
- Format Data: Remove words, Replace text, Shorten length, Lower/Upper case, Capitalize, Normalize URL, Trim spaces, Remove line breaks, Remove smileys.
|
|
197
|
+
- Split Data: Split string by delimiter (e.g. "John Doe" into first + last name).
|
|
198
|
+
- Apply Regex: Extract matches, Check if pattern matches, Replace text.
|
|
199
|
+
- Remove Duplicates: Remove duplicate rows from a table. Preserve related rows option.
|
|
200
|
+
- Delete Data: Delete rows from table or clear variables.
|
|
201
|
+
|
|
202
|
+
EXTERNAL INTEGRATIONS:
|
|
203
|
+
- Ask ChatGPT: Send prompts to OpenAI API. Models: ChatGPT 5.2, 5 Pro, 5 Nano, 4.1, 3, 4o, 4o mini, o1, o1 mini, 4, 4 legacy. Requires OpenAI API key.
|
|
204
|
+
- Send Notification: Send email to user's registered email. Subject and content inputs.
|
|
205
|
+
- APIs: Send HTTP Request: Full REST client. Methods: GET, POST, PUT, DELETE. Tabs: HEADERS, REQUEST BODY, SAVE RESPONSE.
|
|
206
|
+
- Write JavaScript: Execute custom JS in browser page or locally in app. Built-in dark-mode IDE editor.
|
|
207
|
+
|
|
208
|
+
FILES AND OS TOOLS:
|
|
209
|
+
- Save File: Download files. Source: From file URL or From download action.
|
|
210
|
+
- Upload File: Upload files. Source: From file URL or From folder path. Click web upload button first.
|
|
211
|
+
- Delay: Pause execution. Randomized between min and max seconds.
|
|
212
|
+
- Record Date: Capture timestamp. Formats: Calendar date, Day, Month, Month typed out, Month abbreviated, Year, Time.
|
|
213
|
+
- Take Screenshot: Capture screenshot. Type: Visible page, Full page, Web element. Format: .png or .jpeg.
|
|
214
|
+
- Save from Clipboard: Read OS clipboard text and save to variable.
|
|
215
|
+
- Log: Write debug message to run report. Status: Success, Fail, Warning. Optional tag.
|
|
216
|
+
- Building Block Options: Right-click any block to Rename, Enable/disable, Duplicate, Delete, Add notes.
|
|
217
|
+
`,anti_bot:`
|
|
218
|
+
# ZeroWork Anti-Bot Evasion Best Practices
|
|
219
|
+
|
|
220
|
+
1. Randomized Delays: Always use randomized delay ranges (e.g. 8 to 14 seconds) between interactions.
|
|
221
|
+
2. Quota Management: Set strict daily limits in Start Repeat (e.g. max 25-30 profile views per run).
|
|
222
|
+
3. Snooze Strategy: Pause bot after a burst of actions. Example: IF actions_count >= 10 -> Delay 15 minutes.
|
|
223
|
+
4. Pre-Action DOM Verification: Use Check Web Element before interacting to detect restriction banners.
|
|
224
|
+
5. Idempotent Execution: Save processed profile URLs to a contacted_users table and use Remove Duplicates to prevent double-messaging.
|
|
200
225
|
`,troubleshooting:`
|
|
201
|
-
#
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
* **\u{1F4A1} Solution**: Insert an explicit **Delay** block (e.g., 3-5 seconds) before the interaction, or use **Check Web Element** in a retry loop.
|
|
226
|
-
* **\u{1F50D} Cause B (Brittle/Auto-Generated Selectors)**: The selector relies on dynamic class strings (e.g., \`.button-primary-abc12\`) that changed upon page reload.
|
|
227
|
-
* **\u{1F4A1} Solution**: Replace with robust semantic attributes (e.g., \`button[text="Submit"]\` or \`[aria-label="Submit"]\`).
|
|
228
|
-
* **\u{1F50D} Cause C (IFrame Encapsulation)**: The target element is rendered inside an iframe (e.g., a Stripe payment popup or embedded chat widget).
|
|
229
|
-
* **\u{1F4A1} Solution**: Add a **Switch Frame** building block targeting the iframe wrapper before attempting to select the inner element.
|
|
230
|
-
|
|
231
|
-
---
|
|
232
|
-
|
|
233
|
-
### \u{1F4ED} 3. Table Data Pulling Failures ("No Data is Being Pulled")
|
|
234
|
-
|
|
235
|
-
* **Symptom**: A repeat loop fails to execute, or dynamic inputs like \`{profile_url}\` resolve to blank strings.
|
|
236
|
-
* **\u{1F50D} Cause A (Column Name Mismatch)**: The column name in the building block contains leading/trailing spaces or typos compared to the physical table.
|
|
237
|
-
* **\u{1F4A1} Solution**: Re-verify exact column headers. Use **"Refetch columns from Google Sheet"** if using Sheets.
|
|
238
|
-
* **\u{1F50D} Cause B (Google Sheets Auth/Session Expiry)**: The background OAuth token connecting ZeroWork to Google Drive expired or was revoked.
|
|
239
|
-
* **\u{1F4A1} Solution**: Perform the full Google Account Data & Privacy connection reset workflow, then re-authenticate.
|
|
240
|
-
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
### \u26A0\uFE0F 4. Check Web Element Finds Element but Subsequent Click Fails
|
|
244
|
-
|
|
245
|
-
* **Symptom**: **Check Web Element** successfully evaluates to \`true\`, but the next **Click Web Element** block targeting the same element fails.
|
|
246
|
-
* **\u{1F50D} Cause**: **Check Web Element** is purely diagnostic; it confirms the DOM node exists in the background HTML but does NOT ensure the element is visibly rendered, un-obscured, or clickable on screen.
|
|
247
|
-
* **\u{1F4A1} Solution**: Add a **Hover Web Element** or **Delay** block between the check and the click to ensure any overlapping animation/modal finishes rendering.
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
### \u{1F36A} 5. Handling Expired Session Cookies
|
|
252
|
-
|
|
253
|
-
* **Symptom**: TaskBot unexpectedly redirects to a login page or fails to find authenticated UI elements.
|
|
254
|
-
* **\u{1F4A1} Solution**: Configure a **Check Web Element** at the very start of the run to verify the presence of a known logged-in element (e.g., a user profile avatar). If missing, trigger a **Send Notification** block alerting the user to re-login and update session cookies in Run Settings.
|
|
255
|
-
|
|
226
|
+
# ZeroWork Troubleshooting Guide
|
|
227
|
+
|
|
228
|
+
BOT DOES NOT START:
|
|
229
|
+
- Agent offline: Check system tray for green Agent icon. Add Agent folder to antivirus exclusions.
|
|
230
|
+
- Browser shields: Disable Brave Shields or uBlock Origin for creator.zerowork.io.
|
|
231
|
+
- VPN interference: Temporarily disable VPN and secondary network adapters.
|
|
232
|
+
- Stay on Page: Enable Run Settings -> Stay on Page after Run to inspect the browser after completion.
|
|
233
|
+
|
|
234
|
+
ELEMENT NOT FOUND:
|
|
235
|
+
- Dynamic loading: Add Delay block (3-5 seconds) before interaction.
|
|
236
|
+
- Brittle selector: Replace with semantic attributes like aria-label or button[text="Submit"].
|
|
237
|
+
- Inside iframe: Add Switch Frame block before the element selector.
|
|
238
|
+
|
|
239
|
+
NO DATA FROM TABLE:
|
|
240
|
+
- Column name mismatch: Verify exact column names. Click Refetch columns from Google Sheet.
|
|
241
|
+
- Google Sheets auth expired: Reset via Google Account > Data & Privacy > Third-party apps.
|
|
242
|
+
|
|
243
|
+
CHECK WEB ELEMENT FINDS BUT CLICK FAILS:
|
|
244
|
+
- Check Web Element only confirms DOM presence, not visibility or clickability.
|
|
245
|
+
- Add Hover Web Element or Delay between check and click.
|
|
246
|
+
|
|
247
|
+
SESSION COOKIES EXPIRED:
|
|
248
|
+
- Add Check Web Element at start to verify logged-in state.
|
|
249
|
+
- Send Notification to alert user to re-login if not authenticated.
|
|
256
250
|
`,dynamic_inputs:`
|
|
257
251
|
# Dynamic Inputs in ZeroWork
|
|
258
252
|
|
|
259
|
-
All building block input fields accept dynamic inputs. You can inject live data from variables, tables, code, or randomized text directly into any input field.
|
|
260
|
-
|
|
261
253
|
Source: https://docs.zerowork.io/using-zerowork/using-building-blocks/dynamic-inputs
|
|
262
254
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
## 1. References to Variables and Tables
|
|
255
|
+
All building block input fields accept dynamic inputs.
|
|
266
256
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
Example:
|
|
275
|
-
Input: "Hello {id: 123, name: "First Name"}, I wanted to reach out..."
|
|
276
|
-
Output: "Hello John, I wanted to reach out..."
|
|
277
|
-
|
|
278
|
-
Tip: Always use the V/T insert button rather than typing tokens manually to avoid typos.
|
|
279
|
-
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
## 2. Code in Inputs
|
|
257
|
+
1. VARIABLE/TABLE REFERENCES
|
|
258
|
+
Click the V (Variables) or T (Tables) button at the top-right of the building block modal.
|
|
259
|
+
This inserts a token: {id: 123, name: "Column Name"}
|
|
260
|
+
ZeroWork replaces the token with the live value at runtime.
|
|
261
|
+
Always use the insert button instead of typing manually.
|
|
262
|
+
Example input: "Hello {id: 123, name: "First Name"}, I wanted to reach out..."
|
|
263
|
+
Example output: "Hello John, I wanted to reach out..."
|
|
283
264
|
|
|
265
|
+
2. CODE IN INPUTS
|
|
284
266
|
Requires Desktop Agent version 1.1.72 or higher.
|
|
267
|
+
All code runs locally on your device.
|
|
285
268
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
### Syntax A - Expression: \${...}
|
|
289
|
-
Use for single expressions that return a value.
|
|
290
|
-
|
|
269
|
+
Syntax A - Expression: use dollar-sign and curly braces for a single JS expression.
|
|
291
270
|
Examples:
|
|
292
|
-
-
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
await zw.log({ message: "no country code", status: "warning" });
|
|
319
|
-
return "unknown";
|
|
320
|
-
}
|
|
321
|
-
return code.toUpperCase().trim();
|
|
322
|
-
}."
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
|
-
## 3. Spintax
|
|
327
|
-
|
|
328
|
-
Spintax randomly varies text each time a block runs. Useful for bypassing anti-spam detection on sites that check message uniqueness (e.g., LinkedIn outreach, email campaigns).
|
|
329
|
-
|
|
271
|
+
- Password: use await zw.deviceStorage.get("password") to retrieve stored password.
|
|
272
|
+
- Random number: use Math.random()
|
|
273
|
+
- Formatted text: use "some text".trim().toUpperCase()
|
|
274
|
+
- To use a variable/table value inside code, use zw.getRef():
|
|
275
|
+
await zw.getRef({ ref_id: 1234, name: "Country Code" })
|
|
276
|
+
|
|
277
|
+
Syntax B - Code Block: use dollar-sign and double curly braces for multi-line code.
|
|
278
|
+
- Must return a value.
|
|
279
|
+
- Any npm import auto-installs locally.
|
|
280
|
+
Example - Call an external API:
|
|
281
|
+
import axios from "axios";
|
|
282
|
+
const res = await axios.get("https://mydomain.com/api");
|
|
283
|
+
return res.data;
|
|
284
|
+
|
|
285
|
+
Example - Complex logic with error handling:
|
|
286
|
+
const addr = await zw.getRef({ ref_id: 1234, name: "Address" });
|
|
287
|
+
const parts = addr.split("country code: ");
|
|
288
|
+
const code = parts[1];
|
|
289
|
+
if (!code) {
|
|
290
|
+
await zw.log({ message: "no country code", status: "warning" });
|
|
291
|
+
return "unknown";
|
|
292
|
+
}
|
|
293
|
+
return code.toUpperCase().trim();
|
|
294
|
+
|
|
295
|
+
3. SPINTAX
|
|
296
|
+
Randomly varies text each time a block runs. Useful for bypassing anti-spam detection.
|
|
330
297
|
Syntax: {option1|option2|option3}
|
|
331
|
-
|
|
332
298
|
ZeroWork randomly picks one option at runtime.
|
|
299
|
+
Example input: "{ Hi | Hey | Howdy }! How { are you | are things going }?"
|
|
300
|
+
Possible outputs: "Hi! How are you?" or "Hey! How are things going?" or "Howdy! How are you?"
|
|
333
301
|
|
|
334
|
-
|
|
335
|
-
Input: "{ Hi | Hey | Howdy }! How { are you | are things going }?"
|
|
336
|
-
Possible outputs:
|
|
337
|
-
- "Hi! How are you?"
|
|
338
|
-
- "Hey! How are things going?"
|
|
339
|
-
- "Howdy! How are you?"
|
|
340
|
-
|
|
341
|
-
Where can you use Spintax:
|
|
302
|
+
Where Spintax works:
|
|
342
303
|
- Insert Text or Data: Always active.
|
|
343
304
|
- Update Data: Disabled by default. Enable by checking the "Use spintax" checkbox in the modal.
|
|
344
305
|
- Other blocks: Do NOT support Spintax.
|
|
345
306
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
-
|
|
351
|
-
-
|
|
352
|
-
- Code Block: \${... return value; } - Multi-line JS with imports. Requires Agent >= 1.1.72.
|
|
353
|
-
- Spintax: {opt1|opt2|opt3} - Randomizes text. Any agent version.
|
|
354
|
-
`};var Ck=()=>{let t=process.env.ZEROWORK_BOTS;if(!t)return{};try{return JSON.parse(t)}catch{return console.error("Failed to parse ZEROWORK_BOTS environment variable. Must be valid JSON."),{}}},lo=new In({name:"nagoc-zerowork",version:"1.1.1"},{capabilities:{tools:{},resources:{}}});lo.setRequestHandler(js,async()=>({resources:[{uri:"resource://zerowork/general",name:"ZeroWork General Knowledge",mimeType:"text/plain",description:"General concepts about ZeroWork RPA, TaskBots, and Architecture"},{uri:"resource://zerowork/webhooks",name:"ZeroWork Webhooks Guide",mimeType:"text/plain",description:"How to trigger ZeroWork bots and pass dynamic data via webhooks"},{uri:"resource://zerowork/variables",name:"ZeroWork Variables Guide",mimeType:"text/plain",description:"How variables work in ZeroWork"},{uri:"resource://zerowork/tables",name:"ZeroWork Tables Guide",mimeType:"text/plain",description:"How data tables work in ZeroWork"},{uri:"resource://zerowork/selectors",name:"ZeroWork Selectors Guide",mimeType:"text/plain",description:"How CSS and XPath selectors work in ZeroWork"},{uri:"resource://zerowork/loops",name:"ZeroWork Loops Guide",mimeType:"text/plain",description:"How loops and repeats work in ZeroWork"},{uri:"resource://zerowork/chatgpt",name:"ZeroWork ChatGPT Guide",mimeType:"text/plain",description:"How to integrate ChatGPT via Ask ChatGPT block"},{uri:"resource://zerowork/anti_bot",name:"ZeroWork Anti-Bot Guide",mimeType:"text/plain",description:"Best practices to avoid bot detection and handle dynamic states"},{uri:"resource://zerowork/troubleshooting",name:"ZeroWork Troubleshooting Guide",mimeType:"text/plain",description:"Common problems and troubleshooting steps"},{uri:"resource://zerowork/building_blocks",name:"ZeroWork Building Blocks Guide",mimeType:"text/plain",description:"Comprehensive catalog of all ZeroWork building blocks and their options"},{uri:"resource://zerowork/dynamic_inputs",name:"ZeroWork Dynamic Inputs Guide",mimeType:"text/plain",description:"How to use dynamic inputs: variable/table references, code expressions, code blocks, and spintax in ZeroWork building blocks"}]}));lo.setRequestHandler(Ms,async t=>{let e=t.params.uri,r="";if(e==="resource://zerowork/general")r=Ze.general;else if(e==="resource://zerowork/webhooks")r=Ze.webhooks;else if(e==="resource://zerowork/variables")r=Ze.variables;else if(e==="resource://zerowork/tables")r=Ze.tables;else if(e==="resource://zerowork/selectors")r=Ze.selectors;else if(e==="resource://zerowork/loops")r=Ze.loops;else if(e==="resource://zerowork/chatgpt")r=Ze.chatgpt;else if(e==="resource://zerowork/anti_bot")r=Ze.anti_bot;else if(e==="resource://zerowork/troubleshooting")r=Ze.troubleshooting;else if(e==="resource://zerowork/building_blocks")r=Ze.building_blocks;else if(e==="resource://zerowork/dynamic_inputs")r=Ze.dynamic_inputs;else throw new Error(`Resource not found: ${e}`);return{contents:[{uri:e,mimeType:"text/plain",text:r}]}});lo.setRequestHandler(Vs,async()=>({tools:[{name:"list_taskbots",description:"Lists all configured TaskBots and their names that are available to trigger.",inputSchema:{type:"object",properties:{}}},{name:"trigger_taskbot",description:"Triggers a specific ZeroWork TaskBot by its configured name. Does not send data.",inputSchema:{type:"object",properties:{botName:{type:"string",description:"The name of the TaskBot to trigger (must be one from list_taskbots)"}},required:["botName"]}},{name:"trigger_taskbot_with_data",description:"Triggers a specific ZeroWork TaskBot and sends dynamic JSON data to its zw_webhook_data variable.",inputSchema:{type:"object",properties:{botName:{type:"string",description:"The name of the TaskBot to trigger"},payload:{type:"object",description:"The JSON object payload to send to the bot"}},required:["botName","payload"]}},{name:"trigger_webhook_url",description:"Triggers an arbitrary ZeroWork webhook URL directly.",inputSchema:{type:"object",properties:{url:{type:"string",description:"The full ZeroWork webhook URL"},payload:{type:"object",description:"Optional JSON object payload to send to the bot"}},required:["url"]}},{name:"generate_robust_selector",description:"Analyzes an HTML snippet and target requirements to generate robust, non-brittle CSS and XPath selectors tailored for ZeroWork TaskBots.",inputSchema:{type:"object",properties:{htmlSnippet:{type:"string",description:"The raw HTML snippet containing the target element and its surrounding container hierarchy."},targetText:{type:"string",description:"Optional exact or partial visible text of the target element (e.g., 'Connect', 'Follow')."},description:{type:"string",description:"Optional description of what the element is or its context (e.g., 'The experience list container on LinkedIn', 'Submit button on a dynamic form')."}},required:["htmlSnippet"]}},{name:"get_mcp_version",description:"Returns the version of this MCP server package currently running.",inputSchema:{type:"object",properties:{}}}]}));lo.setRequestHandler(Ir,async t=>{let{name:e,arguments:r}=t.params,o=Ck();try{if(e==="list_taskbots"){let n=Object.keys(o);return n.length===0?{content:[{type:"text",text:'No TaskBots are configured. Please set the ZEROWORK_BOTS environment variable in your Claude config (e.g., {"myBot": "https://hook.zerowork.io/..."}).'}]}:{content:[{type:"text",text:`Configured TaskBots:
|
|
307
|
+
SUMMARY:
|
|
308
|
+
- Variable Reference {id: X, name: "ColumnName"}: Injects live data. Any agent version.
|
|
309
|
+
- Code Expression: Single-line JS. Requires Agent >= 1.1.72.
|
|
310
|
+
- Code Block: Multi-line JS with imports. Requires Agent >= 1.1.72.
|
|
311
|
+
- Spintax {opt1|opt2|opt3}: Randomizes text. Any agent version.
|
|
312
|
+
`};var Az=()=>{let t=process.env.ZEROWORK_BOTS;if(!t)return{};try{return JSON.parse(t)}catch{return console.error("Failed to parse ZEROWORK_BOTS environment variable. Must be valid JSON."),{}}},lo=new On({name:"nagoc-zerowork",version:"1.1.3"},{capabilities:{tools:{},resources:{}}});lo.setRequestHandler(Cs,async()=>({resources:[{uri:"resource://zerowork/general",name:"ZeroWork General Knowledge",mimeType:"text/plain",description:"General concepts about ZeroWork RPA, TaskBots, and Architecture"},{uri:"resource://zerowork/webhooks",name:"ZeroWork Webhooks Guide",mimeType:"text/plain",description:"How to trigger ZeroWork bots and pass dynamic data via webhooks"},{uri:"resource://zerowork/variables",name:"ZeroWork Variables Guide",mimeType:"text/plain",description:"How variables work in ZeroWork"},{uri:"resource://zerowork/tables",name:"ZeroWork Tables Guide",mimeType:"text/plain",description:"How data tables work in ZeroWork"},{uri:"resource://zerowork/selectors",name:"ZeroWork Selectors Guide",mimeType:"text/plain",description:"How CSS and XPath selectors work in ZeroWork"},{uri:"resource://zerowork/loops",name:"ZeroWork Loops Guide",mimeType:"text/plain",description:"How loops and repeats work in ZeroWork"},{uri:"resource://zerowork/chatgpt",name:"ZeroWork ChatGPT Guide",mimeType:"text/plain",description:"How to integrate ChatGPT via Ask ChatGPT block"},{uri:"resource://zerowork/anti_bot",name:"ZeroWork Anti-Bot Guide",mimeType:"text/plain",description:"Best practices to avoid bot detection and handle dynamic states"},{uri:"resource://zerowork/troubleshooting",name:"ZeroWork Troubleshooting Guide",mimeType:"text/plain",description:"Common problems and troubleshooting steps"},{uri:"resource://zerowork/building_blocks",name:"ZeroWork Building Blocks Guide",mimeType:"text/plain",description:"Comprehensive catalog of all ZeroWork building blocks and their options"},{uri:"resource://zerowork/dynamic_inputs",name:"ZeroWork Dynamic Inputs Guide",mimeType:"text/plain",description:"How to use dynamic inputs: variable/table references, code expressions, code blocks, and spintax in ZeroWork building blocks"}]}));lo.setRequestHandler(qs,async t=>{let e=t.params.uri,r="";if(e==="resource://zerowork/general")r=Ee.general;else if(e==="resource://zerowork/webhooks")r=Ee.webhooks;else if(e==="resource://zerowork/variables")r=Ee.variables;else if(e==="resource://zerowork/tables")r=Ee.tables;else if(e==="resource://zerowork/selectors")r=Ee.selectors;else if(e==="resource://zerowork/loops")r=Ee.loops;else if(e==="resource://zerowork/chatgpt")r=Ee.chatgpt;else if(e==="resource://zerowork/anti_bot")r=Ee.anti_bot;else if(e==="resource://zerowork/troubleshooting")r=Ee.troubleshooting;else if(e==="resource://zerowork/building_blocks")r=Ee.building_blocks;else if(e==="resource://zerowork/dynamic_inputs")r=Ee.dynamic_inputs;else throw new Error(`Resource not found: ${e}`);return{contents:[{uri:e,mimeType:"text/plain",text:r}]}});lo.setRequestHandler(Vs,async()=>({tools:[{name:"list_taskbots",description:"Lists all configured TaskBots and their names that are available to trigger.",inputSchema:{type:"object",properties:{}}},{name:"trigger_taskbot",description:"Triggers a specific ZeroWork TaskBot by its configured name. Does not send data.",inputSchema:{type:"object",properties:{botName:{type:"string",description:"The name of the TaskBot to trigger (must be one from list_taskbots)"}},required:["botName"]}},{name:"trigger_taskbot_with_data",description:"Triggers a specific ZeroWork TaskBot and sends dynamic JSON data to its zw_webhook_data variable.",inputSchema:{type:"object",properties:{botName:{type:"string",description:"The name of the TaskBot to trigger"},payload:{type:"object",description:"The JSON object payload to send to the bot"}},required:["botName","payload"]}},{name:"trigger_webhook_url",description:"Triggers an arbitrary ZeroWork webhook URL directly.",inputSchema:{type:"object",properties:{url:{type:"string",description:"The full ZeroWork webhook URL"},payload:{type:"object",description:"Optional JSON object payload to send to the bot"}},required:["url"]}},{name:"generate_robust_selector",description:"Analyzes an HTML snippet and target requirements to generate robust, non-brittle CSS and XPath selectors tailored for ZeroWork TaskBots.",inputSchema:{type:"object",properties:{htmlSnippet:{type:"string",description:"The raw HTML snippet containing the target element and its surrounding container hierarchy."},targetText:{type:"string",description:"Optional exact or partial visible text of the target element (e.g., 'Connect', 'Follow')."},description:{type:"string",description:"Optional description of what the element is or its context (e.g., 'The experience list container on LinkedIn', 'Submit button on a dynamic form')."}},required:["htmlSnippet"]}},{name:"get_mcp_version",description:"Returns the version of this MCP server package currently running.",inputSchema:{type:"object",properties:{}}},{name:"search_zerowork_docs",description:"Search and query the ENTIRE ZeroWork official documentation at docs.zerowork.io. Use this tool for ANY question about ZeroWork including features, building blocks, dynamic inputs, TaskBots, spintax, variables, code in inputs, agents, triggers, actions, conditions, loops, integrations, webhooks, selectors, device storage, or any how-to guides. ALWAYS use this tool before answering any ZeroWork-related questions.",inputSchema:{type:"object",properties:{question:{type:"string",description:"The natural language question to search the docs for"}},required:["question"]}}]}));lo.setRequestHandler(Or,async t=>{let{name:e,arguments:r}=t.params,o=Az();try{if(e==="list_taskbots"){let n=Object.keys(o);return n.length===0?{content:[{type:"text",text:'No TaskBots are configured. Please set the ZEROWORK_BOTS environment variable in your Claude config (e.g., {"myBot": "https://hook.zerowork.io/..."}).'}]}:{content:[{type:"text",text:`Configured TaskBots:
|
|
355
313
|
${n.map(s=>`- ${s}`).join(`
|
|
356
314
|
`)}`}]}}if(e==="trigger_taskbot"||e==="trigger_taskbot_with_data"){let n=String(r?.botName),s=o[n];if(!s)throw new Error(`Bot '${n}' not found in configuration. Use list_taskbots to see available bots.`);let i=e==="trigger_taskbot_with_data",a=i?r?.payload:null,c={method:i?"POST":"GET",headers:i?{"Content-Type":"application/json"}:void 0,body:i?JSON.stringify(a):void 0},u=await fetch(s,c),l=await u.text();return{content:[{type:"text",text:`Successfully triggered ${n}.
|
|
357
315
|
Status: ${u.status}
|
|
@@ -390,4 +348,20 @@ ${n.slice(0,500)}${n.length>500?`
|
|
|
390
348
|
... (truncated)`:""}
|
|
391
349
|
\`\`\`
|
|
392
350
|
|
|
393
|
-
`,a+="*Guidance*: Use the strategies above to construct your selector in ZeroWork. Test the selector in your browser console using `document.querySelectorAll('your-selector')` to verify uniqueness before adding it to your TaskBot.",{content:[{type:"text",text:a}]}}if(e==="get_mcp_version")return{content:[{type:"text",text:"nagoc-zerowork version 1.1.
|
|
351
|
+
`,a+="*Guidance*: Use the strategies above to construct your selector in ZeroWork. Test the selector in your browser console using `document.querySelectorAll('your-selector')` to verify uniqueness before adding it to your TaskBot.",{content:[{type:"text",text:a}]}}if(e==="get_mcp_version")return{content:[{type:"text",text:"nagoc-zerowork version 1.1.3"}]};if(e==="search_zerowork_docs"){let n=String(r?.question||"");if(!n)throw new Error("The 'question' parameter is required.");let s=[];try{let l=(await(await fetch("https://docs.zerowork.io/sitemap.xml",{signal:AbortSignal.timeout(5e3)})).text()).match(/<loc>(.*?)<\/loc>/g);l&&(s=l.map(d=>d.replace(/<\/?loc>/g,"")))}catch{s=["https://docs.zerowork.io","https://docs.zerowork.io/crash-course","https://docs.zerowork.io/faqs","https://docs.zerowork.io/getting-started","https://docs.zerowork.io/install-the-agent","https://docs.zerowork.io/support/common-problems","https://docs.zerowork.io/support/getting-support","https://docs.zerowork.io/support/troubleshooting","https://docs.zerowork.io/support/using-run-reports","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/cookies","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/how-to-check-and-update-your-agent","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/install-zerowork-agent-on-vps","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/log-in-to-the-agent","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/proxies","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/remote-cloud-execution","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/run","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/run-settings","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/scheduler","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/stop","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/taskbot-sharing-options","https://docs.zerowork.io/using-zerowork/general-run-schedule-share-webhooks/trigger-run-via-webhook","https://docs.zerowork.io/using-zerowork/using-building-blocks/apis-send-http-request","https://docs.zerowork.io/using-zerowork/using-building-blocks/check-web-element","https://docs.zerowork.io/using-zerowork/using-building-blocks/click-element","https://docs.zerowork.io/using-zerowork/using-building-blocks/delay","https://docs.zerowork.io/using-zerowork/using-building-blocks/input-text","https://docs.zerowork.io/using-zerowork/using-building-blocks/loops","https://docs.zerowork.io/using-zerowork/using-building-blocks/open-link","https://docs.zerowork.io/using-zerowork/using-building-blocks/save-file","https://docs.zerowork.io/using-zerowork/using-building-blocks/save-text","https://docs.zerowork.io/using-zerowork/using-building-blocks/upload-file","https://docs.zerowork.io/using-zerowork/using-building-blocks/write-javascript","https://docs.zerowork.io/using-zerowork/using-selectors/css-selectors","https://docs.zerowork.io/using-zerowork/using-tables/data-tables","https://docs.zerowork.io/using-zerowork/using-variables/variables-management"]}let i="";try{let c=`https://docs.zerowork.io?ask=${encodeURIComponent(n)}`,u=await fetch(c,{signal:AbortSignal.timeout(5e3)}),l=await u.text();u.ok&&l&&!l.trim().toLowerCase().startsWith("<html")&&!l.includes("<head>")&&(i=l.trim())}catch{}let a="";if(i&&i.length>20)a=`### ZeroWork Documentation Search Result (via Ask Endpoint)
|
|
352
|
+
|
|
353
|
+
${i}`;else{let c=n.toLowerCase(),u=[];(c.includes("webhook")||c.includes("trigger")||c.includes("payload")||c.includes("zw_webhook_data"))&&u.push("webhooks"),(c.includes("variable")||c.includes("counter")||c.includes("scope"))&&u.push("variables"),(c.includes("table")||c.includes("sheet")||c.includes("column")||c.includes("batch"))&&u.push("tables"),(c.includes("selector")||c.includes("css")||c.includes("xpath")||c.includes("match")||c.includes("attribute")||c.includes("sibling"))&&u.push("selectors"),(c.includes("block")||c.includes("click")||c.includes("save")||c.includes("open")||c.includes("close")||c.includes("delay")||c.includes("loop")||c.includes("repeat")||c.includes("javascript")||c.includes("http")||c.includes("chatgpt"))&&u.push("building_blocks"),(c.includes("dynamic")||c.includes("input")||c.includes("code")||c.includes("spintax")||c.includes("expression")||c.includes("devicestorage")||c.includes("getref"))&&u.push("dynamic_inputs"),(c.includes("anti")||c.includes("bot")||c.includes("evasion")||c.includes("delay")||c.includes("limit"))&&u.push("anti_bot"),(c.includes("trouble")||c.includes("error")||c.includes("fail")||c.includes("start")||c.includes("cookie")||c.includes("agent")||c.includes("vps")||c.includes("proxy")||c.includes("cloud"))&&(u.push("troubleshooting"),u.push("general")),u.length===0&&u.push("general","building_blocks","dynamic_inputs");let d=Array.from(new Set(u)).map(p=>Ee[p]).join(`
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
`);a=`### ZeroWork Official Documentation Search Results
|
|
358
|
+
|
|
359
|
+
*Crawled & Indexed from https://docs.zerowork.io (Sitemap & Internal Links)*
|
|
360
|
+
|
|
361
|
+
**Question**: "${n}"
|
|
362
|
+
|
|
363
|
+
**Relevant Documentation Content**:
|
|
364
|
+
|
|
365
|
+
${d}
|
|
366
|
+
|
|
367
|
+
*Note: Total crawled pages indexed: ${s.length>0?s.length:35}. Use the exact details above to answer the user's question comprehensively.*`}return{content:[{type:"text",text:a}]}}throw new Error(`Unknown tool: ${e}`)}catch(n){return{content:[{type:"text",text:`Error executing tool ${e}: ${n.message}`}],isError:!0}}});async function Zz(){let t=new Nn;await lo.connect(t),console.error("ZeroWork MCP Server running on stdio")}Zz().catch(t=>{console.error("Fatal error in main():",t),process.exit(1)});
|