pmx-canvas 0.9.0 → 0.9.2
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/.github/extensions/pmx-canvas/runtime.json +1 -1
- package/.github/extensions/pmx-canvas/start-mcp.mjs +29 -29
- package/CHANGELOG.md +17 -0
- package/Readme.md +1 -1
- package/dist/canvas/index.js +90 -90
- package/dist/canvas/mcp-app.html +96 -96
- package/dist/json-render/index.js +50 -50
- package/dist/types/client/state/human-store.d.ts +2 -1
- package/docs/bun-webview-integration.md +2 -2
- package/package.json +2 -2
- package/plugins/pmx-canvas/com.github.copilot/extensions/pmx-canvas/runtime.json +1 -1
- package/plugins/pmx-canvas/plugin.json +1 -1
- package/plugins/pmx-canvas/runtime.json +1 -1
- package/plugins/pmx-canvas/start-mcp.mjs +29 -29
- package/skills/pmx-canvas/SKILL.md +1 -1
- package/skills/pmx-canvas/evals/evals.json +224 -0
- package/skills/pmx-canvas/references/installing-pmx-canvas.md +11 -6
- package/src/cli/commands/boards.ts +1 -0
- package/src/client/canvas/LifecyclePanel.tsx +26 -16
- package/src/client/nodes/ExtAppFrame.tsx +6 -2
- package/src/client/state/human-store.ts +13 -7
- package/src/client/state/sse-bridge.ts +30 -4
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import{createRequire as n_}from"node:module";var Yg=Object.create;var{getPrototypeOf:Qg,defineProperty:fa,getOwnPropertyNames:e_}=Object;var ma=Object.prototype.hasOwnProperty;function t_(e){return this[e]}var r_,o_,kn=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?r_??=new WeakMap:o_??=new WeakMap,s=n.get(e);if(s)return s}r=e!=null?Yg(Qg(e)):{};let i=t||!e||!e.__esModule||!ma.call(e,"default")?fa(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of e_(e))if(!ma.call(i,a))fa(i,a,{get:t_.bind(e,a),enumerable:!0})}if(o)n.set(e,i);return i};var b=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ge=n_(import.meta.url);var xr=b(function(kd){Object.defineProperty(kd,"__esModule",{value:!0});kd.regexpCode=kd.getEsmExportName=kd.getProperty=kd.safeStringify=kd.stringify=kd.strConcat=kd.addCodeArg=kd.str=kd._=kd.nil=kd._Code=kd.Name=kd.IDENTIFIER=kd._CodeOrName=void 0;class Ro{}kd._CodeOrName=Ro;kd.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class Tt extends Ro{constructor(e){super();if(!kd.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}kd.Name=Tt;class Pe extends Ro{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof Tt)t[r.str]=(t[r.str]||0)+1;return t},{})}}kd._Code=Pe;kd.nil=new Pe("");function zd(e,...t){let r=[e[0]],o=0;while(o<t.length)Hs(r,t[o]),r.push(e[++o]);return new Pe(r)}kd._=zd;var Vs=new Pe("+");function Sd(e,...t){let r=[wr(e[0])],o=0;while(o<t.length)r.push(Vs),Hs(r,t[o]),r.push(Vs,wr(e[++o]));return Bv(r),new Pe(r)}kd.str=Sd;function Hs(e,t){if(t instanceof Pe)e.push(...t._items);else if(t instanceof Tt)e.push(t);else e.push(Xv(t))}kd.addCodeArg=Hs;function Bv(e){let t=1;while(t<e.length-1){if(e[t]===Vs){let r=Gv(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function Gv(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof Tt||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof Tt))return`"${e}${t.slice(1)}`;return}function Wv(e,t){return t.emptyStr()?e:e.emptyStr()?t:Sd`${e}${t}`}kd.strConcat=Wv;function Xv(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:wr(Array.isArray(e)?e.join(","):e)}function Yv(e){return new Pe(wr(e))}kd.stringify=Yv;function wr(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}kd.safeStringify=wr;function Qv(e){return typeof e=="string"&&kd.IDENTIFIER.test(e)?new Pe(`.${e}`):zd`[${e}]`}kd.getProperty=Qv;function eb(e){if(typeof e=="string"&&kd.IDENTIFIER.test(e))return new Pe(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}kd.getEsmExportName=eb;function tb(e){return new Pe(e.toString())}kd.regexpCode=tb});var Gs=b(function(Rd){Object.defineProperty(Rd,"__esModule",{value:!0});Rd.ValueScope=Rd.ValueScopeName=Rd.Scope=Rd.varKinds=Rd.UsedValueState=void 0;var me=xr();class Ed extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var Io;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Io||(Rd.UsedValueState=Io={}));Rd.varKinds={const:new me.Name("const"),let:new me.Name("let"),var:new me.Name("var")};class Ks{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof me.Name?e:this.name(e)}name(e){return new me.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}Rd.Scope=Ks;class Bs extends me.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=me._`.${new me.Name(t)}[${r}]`}}Rd.ValueScopeName=Bs;var mb=me._`\n`;class Td extends Ks{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?mb:me.nil}}get(){return this._scope}name(e){return new Bs(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:n}=o,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[n];if(i){let c=i.get(s);if(c)return c}else i=this._values[n]=new Map;i.set(s,o);let a=this._scope[n]||(this._scope[n]=[]),u=a.length;return a[u]=t.ref,o.setValue(t,{property:n,itemIndex:u}),o}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return me._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(o)=>{if(o.value===void 0)throw Error(`CodeGen: name "${o}" has no value`);return o.value.code},t,r)}_reduceValues(e,t,r={},o){let n=me.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((u)=>{if(a.has(u))return;a.set(u,Io.Started);let c=t(u);if(c){let l=this.opts.es5?Rd.varKinds.var:Rd.varKinds.const;n=me._`${n}${l} ${u} = ${c};${this.opts._n}`}else if(c=o===null||o===void 0?void 0:o(u))n=me._`${n}${c}${this.opts._n}`;else throw new Ed(u);a.set(u,Io.Completed)})}return n}}Rd.ValueScope=Td});var C=b(function(he){Object.defineProperty(he,"__esModule",{value:!0});he.or=he.and=he.not=he.CodeGen=he.operators=he.varKinds=he.ValueScopeName=he.ValueScope=he.Scope=he.Name=he.regexpCode=he.stringify=he.getProperty=he.nil=he.strConcat=he.str=he._=void 0;var A=xr(),Ee=Gs(),nt=xr();Object.defineProperty(he,"_",{enumerable:!0,get:function(){return nt._}});Object.defineProperty(he,"str",{enumerable:!0,get:function(){return nt.str}});Object.defineProperty(he,"strConcat",{enumerable:!0,get:function(){return nt.strConcat}});Object.defineProperty(he,"nil",{enumerable:!0,get:function(){return nt.nil}});Object.defineProperty(he,"getProperty",{enumerable:!0,get:function(){return nt.getProperty}});Object.defineProperty(he,"stringify",{enumerable:!0,get:function(){return nt.stringify}});Object.defineProperty(he,"regexpCode",{enumerable:!0,get:function(){return nt.regexpCode}});Object.defineProperty(he,"Name",{enumerable:!0,get:function(){return nt.Name}});var qo=Gs();Object.defineProperty(he,"Scope",{enumerable:!0,get:function(){return qo.Scope}});Object.defineProperty(he,"ValueScope",{enumerable:!0,get:function(){return qo.ValueScope}});Object.defineProperty(he,"ValueScopeName",{enumerable:!0,get:function(){return qo.ValueScopeName}});Object.defineProperty(he,"varKinds",{enumerable:!0,get:function(){return qo.varKinds}});he.operators={GT:new A._Code(">"),GTE:new A._Code(">="),LT:new A._Code("<"),LTE:new A._Code("<="),EQ:new A._Code("==="),NEQ:new A._Code("!=="),NOT:new A._Code("!"),OR:new A._Code("||"),AND:new A._Code("&&"),ADD:new A._Code("+")};class st{optimizeNodes(){return this}optimizeNames(e,t){return this}}class Id extends st{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?Ee.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=Ot(this.rhs,e,t);return this}get names(){return this.rhs instanceof A._CodeOrName?this.rhs.names:{}}}class Ys extends st{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof A.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=Ot(this.rhs,e,t),this}get names(){let e=this.lhs instanceof A.Name?{}:{...this.lhs.names};return Zo(e,this.rhs)}}class Nd extends Ys{constructor(e,t,r,o){super(e,r,o);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class Cd extends st{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class jd extends st{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class Ad extends st{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class Zd extends st{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=Ot(this.code,e,t),this}get names(){return this.code instanceof A._CodeOrName?this.code.names:{}}}class Mo extends st{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;while(o--){let n=r[o];if(n.optimizeNames(e,t))continue;yb(e,n.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>yt(e,t.names),{})}}class it extends Mo{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class qd extends Mo{}class zr extends it{}zr.kind="else";class Ve extends it{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new zr(r):r}if(t){if(e===!1)return t instanceof Ve?t:t.nodes;if(this.nodes.length)return this;return new Ve(Fd(e),t instanceof Ve?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=Ot(this.condition,e,t),this}get names(){let e=super.names;if(Zo(e,this.condition),this.else)yt(e,this.else.names);return e}}Ve.kind="if";class Rt extends it{}Rt.kind="for";class Md extends Rt{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=Ot(this.iteration,e,t),this}get names(){return yt(super.names,this.iteration.names)}}class Dd extends Rt{constructor(e,t,r,o){super();this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?Ee.varKinds.var:this.varKind,{name:r,from:o,to:n}=this;return`for(${t} ${r}=${o}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){let e=Zo(super.names,this.from);return Zo(e,this.to)}}class Ws extends Rt{constructor(e,t,r,o){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=Ot(this.iterable,e,t),this}get names(){return yt(super.names,this.iterable.names)}}class No extends it{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}No.kind="func";class Co extends Mo{render(e){return"return "+super.render(e)}}Co.kind="return";class Ld extends it{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(o=this.finally)===null||o===void 0||o.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)yt(e,this.catch.names);if(this.finally)yt(e,this.finally.names);return e}}class jo extends it{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}jo.kind="catch";class Ao extends it{render(e){return"finally"+super.render(e)}}Ao.kind="finally";class Ud{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
2
|
-
`:""},this._extScope=e,this._scope=new Ee.Scope({parent:e}),this._nodes=[new qd]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){let n=this._scope.toName(t);if(r!==void 0&&o)this._constants[n.str]=r;return this._leafNode(new Id(e,n,r)),n}const(e,t,r){return this._def(Ee.varKinds.const,e,t,r)}let(e,t,r){return this._def(Ee.varKinds.let,e,t,r)}var(e,t,r){return this._def(Ee.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Ys(e,t,r))}add(e,t){return this._leafNode(new Nd(e,he.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==A.nil)this._leafNode(new Zd(e));return this}object(...e){let t=["{"];for(let[r,o]of e){if(t.length>1)t.push(",");if(t.push(r),r!==o||this.opts.es5)t.push(":"),A.addCodeArg(t,o)}return t.push("}"),new A._Code(t)}if(e,t,r){if(this._blockNode(new Ve(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Ve(e))}else(){return this._elseNode(new zr)}endIf(){return this._endBlockNode(Ve,zr)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new Md(e),t)}forRange(e,t,r,o,n=this.opts.es5?Ee.varKinds.var:Ee.varKinds.let){let s=this._scope.toName(e);return this._for(new Dd(n,s,t,r),()=>o(s))}forOf(e,t,r,o=Ee.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let s=t instanceof A.Name?t:this.var("_arr",t);return this.forRange("_i",0,A._`${s}.length`,(i)=>{this.var(n,A._`${s}[${i}]`),r(n)})}return this._for(new Ws("of",o,n,t),()=>r(n))}forIn(e,t,r,o=this.opts.es5?Ee.varKinds.var:Ee.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,A._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new Ws("in",o,n,t),()=>r(n))}endFor(){return this._endBlockNode(Rt)}label(e){return this._leafNode(new Cd(e))}break(e){return this._leafNode(new jd(e))}return(e){let t=new Co;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(Co)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new Ld;if(this._blockNode(o),this.code(e),t){let n=this.name("e");this._currNode=o.catch=new jo(n),t(n)}if(r)this._currNode=o.finally=new Ao,this.code(r);return this._endBlockNode(jo,Ao)}throw(e){return this._leafNode(new Ad(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=A.nil,r,o){if(this._blockNode(new No(e,t,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(No)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof Ve))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}he.CodeGen=Ud;function yt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Zo(e,t){return t instanceof A._CodeOrName?yt(e,t.names):e}function Ot(e,t,r){if(e instanceof A.Name)return o(e);if(!n(e))return e;return new A._Code(e._items.reduce((s,i)=>{if(i instanceof A.Name)i=o(i);if(i instanceof A._Code)s.push(...i._items);else s.push(i);return s},[]));function o(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function n(s){return s instanceof A._Code&&s._items.some((i)=>i instanceof A.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function yb(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function Fd(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:A._`!${Xs(e)}`}he.not=Fd;var vb=Vd(he.operators.AND);function bb(...e){return e.reduce(vb)}he.and=bb;var $b=Vd(he.operators.OR);function wb(...e){return e.reduce($b)}he.or=wb;function Vd(e){return(t,r)=>t===A.nil?r:r===A.nil?t:A._`${Xs(t)} ${e} ${Xs(r)}`}function Xs(e){return e instanceof A.Name?e:A._`(${e})`}});var Z=b(function(Qd){Object.defineProperty(Qd,"__esModule",{value:!0});Qd.checkStrictMode=Qd.getErrorPath=Qd.Type=Qd.useFunc=Qd.setEvaluated=Qd.evaluatedPropsToName=Qd.mergeEvaluated=Qd.eachItem=Qd.unescapeJsonPointer=Qd.escapeJsonPointer=Qd.escapeFragment=Qd.unescapeFragment=Qd.schemaRefOrVal=Qd.schemaHasRulesButRef=Qd.schemaHasRules=Qd.checkUnknownRules=Qd.alwaysValidSchema=Qd.toHash=void 0;var L=C(),kb=xr();function Pb(e){let t={};for(let r of e)t[r]=!0;return t}Qd.toHash=Pb;function Eb(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return Bd(e,t),!Gd(t,e.self.RULES.all)}Qd.alwaysValidSchema=Eb;function Bd(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=o.RULES.keywords;for(let s in t)if(!n[s])Yd(e,`unknown keyword: "${s}"`)}Qd.checkUnknownRules=Bd;function Gd(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Qd.schemaHasRules=Gd;function Tb(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Qd.schemaHasRulesButRef=Tb;function Rb({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return L._`${r}`}return L._`${e}${t}${L.getProperty(o)}`}Qd.schemaRefOrVal=Rb;function Ob(e){return Wd(decodeURIComponent(e))}Qd.unescapeFragment=Ob;function Ib(e){return encodeURIComponent(ei(e))}Qd.escapeFragment=Ib;function ei(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}Qd.escapeJsonPointer=ei;function Wd(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Qd.unescapeJsonPointer=Wd;function Nb(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Qd.eachItem=Nb;function Jd({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let u=i===void 0?s:i instanceof L.Name?(s instanceof L.Name?e(n,s,i):t(n,s,i),i):s instanceof L.Name?(t(n,i,s),s):r(s,i);return a===L.Name&&!(u instanceof L.Name)?o(n,u):u}}Qd.mergeEvaluated={props:Jd({mergeNames:(e,t,r)=>e.if(L._`${r} !== true && ${t} !== undefined`,()=>{e.if(L._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,L._`${r} || {}`).code(L._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(L._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,L._`${r} || {}`),ti(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:Xd}),items:Jd({mergeNames:(e,t,r)=>e.if(L._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,L._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(L._`${r} !== true`,()=>e.assign(r,t===!0?!0:L._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function Xd(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",L._`{}`);if(t!==void 0)ti(e,r,t);return r}Qd.evaluatedPropsToName=Xd;function ti(e,t,r){Object.keys(r).forEach((o)=>e.assign(L._`${t}${L.getProperty(o)}`,!0))}Qd.setEvaluated=ti;var Kd={};function Cb(e,t){return e.scopeValue("func",{ref:t,code:Kd[t.code]||(Kd[t.code]=new kb._Code(t.code))})}Qd.useFunc=Cb;var Qs;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Qs||(Qd.Type=Qs={}));function jb(e,t,r){if(e instanceof L.Name){let o=t===Qs.Num;return r?o?L._`"[" + ${e} + "]"`:L._`"['" + ${e} + "']"`:o?L._`"/" + ${e}`:L._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?L.getProperty(e).toString():"/"+ei(e)}Qd.getErrorPath=jb;function Yd(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}Qd.checkStrictMode=Yd});var He=b(function(tp){Object.defineProperty(tp,"__esModule",{value:!0});var ae=C(),Qb={data:new ae.Name("data"),valCxt:new ae.Name("valCxt"),instancePath:new ae.Name("instancePath"),parentData:new ae.Name("parentData"),parentDataProperty:new ae.Name("parentDataProperty"),rootData:new ae.Name("rootData"),dynamicAnchors:new ae.Name("dynamicAnchors"),vErrors:new ae.Name("vErrors"),errors:new ae.Name("errors"),this:new ae.Name("this"),self:new ae.Name("self"),scope:new ae.Name("scope"),json:new ae.Name("json"),jsonPos:new ae.Name("jsonPos"),jsonLen:new ae.Name("jsonLen"),jsonPart:new ae.Name("jsonPart")};tp.default=Qb});var Sr=b(function(sp){Object.defineProperty(sp,"__esModule",{value:!0});sp.extendErrors=sp.resetErrorsCount=sp.reportExtraError=sp.reportError=sp.keyword$DataError=sp.keywordError=void 0;var q=C(),Lo=Z(),de=He();sp.keywordError={message:({keyword:e})=>q.str`must pass "${e}" keyword validation`};sp.keyword$DataError={message:({keyword:e,schemaType:t})=>t?q.str`"${e}" keyword must be ${t} ($data)`:q.str`"${e}" keyword is invalid ($data)`};function t$(e,t=sp.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,u=np(e,t,r);if(o!==null&&o!==void 0?o:i||a)rp(s,u);else op(n,q._`[${u}]`)}sp.reportError=t$;function r$(e,t=sp.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=np(e,t,r);if(rp(n,a),!(s||i))op(o,de.default.vErrors)}sp.reportExtraError=r$;function o$(e,t){e.assign(de.default.errors,t),e.if(q._`${de.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(q._`${de.default.vErrors}.length`,t),()=>e.assign(de.default.vErrors,null)))}sp.resetErrorsCount=o$;function n$({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,de.default.errors,(a)=>{if(e.const(i,q._`${de.default.vErrors}[${a}]`),e.if(q._`${i}.instancePath === undefined`,()=>e.assign(q._`${i}.instancePath`,q.strConcat(de.default.instancePath,s.errorPath))),e.assign(q._`${i}.schemaPath`,q.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(q._`${i}.schema`,r),e.assign(q._`${i}.data`,o)})}sp.extendErrors=n$;function rp(e,t){let r=e.const("err",t);e.if(q._`${de.default.vErrors} === null`,()=>e.assign(de.default.vErrors,q._`[${r}]`),q._`${de.default.vErrors}.push(${r})`),e.code(q._`${de.default.errors}++`)}function op(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;if(n.$async)r.throw(q._`new ${e.ValidationError}(${t})`);else r.assign(q._`${o}.errors`,t),r.return(!1)}var vt={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 np(e,t,r){let{createErrors:o}=e.it;if(o===!1)return q._`{}`;return s$(e,t,r)}function s$(e,t,r={}){let{gen:o,it:n}=e,s=[i$(n,r),a$(e,r)];return c$(e,t,s),o.object(...s)}function i$({errorPath:e},{instancePath:t}){let r=t?q.str`${e}${Lo.getErrorPath(t,Lo.Type.Str)}`:e;return[de.default.instancePath,q.strConcat(de.default.instancePath,r)]}function a$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:q.str`${t}/${e}`;if(r)n=q.str`${n}${Lo.getErrorPath(r,Lo.Type.Str)}`;return[vt.schemaPath,n]}function c$(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:u,propertyName:c,topSchemaRef:l,schemaPath:d}=a;if(o.push([vt.keyword,n],[vt.params,typeof t=="function"?t(e):t||q._`{}`]),u.messages)o.push([vt.message,typeof r=="function"?r(e):r]);if(u.verbose)o.push([vt.schema,i],[vt.parentSchema,q._`${l}${d}`],[de.default.data,s]);if(c)o.push([vt.propertyName,c])}});var lp=b(function(cp){Object.defineProperty(cp,"__esModule",{value:!0});cp.boolOrEmptySchema=cp.topBoolOrEmptySchema=void 0;var f$=Sr(),m$=C(),h$=He(),g$={message:"boolean schema is false"};function _$(e){let{gen:t,schema:r,validateName:o}=e;if(r===!1)ap(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(h$.default.data);else t.assign(m$._`${o}.errors`,null),t.return(!0)}cp.topBoolOrEmptySchema=_$;function y$(e,t){let{gen:r,schema:o}=e;if(o===!1)r.var(t,!1),ap(e);else r.var(t,!0)}cp.boolOrEmptySchema=y$;function ap(e,t){let{gen:r,data:o}=e;f$.reportError({gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},g$,void 0,t)}});var oi=b(function(dp){Object.defineProperty(dp,"__esModule",{value:!0});dp.getRules=dp.isJSONType=void 0;var b$=["string","number","integer","boolean","null","object","array"],$$=new Set(b$);function w$(e){return typeof e=="string"&&$$.has(e)}dp.isJSONType=w$;function x$(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}dp.getRules=x$});var ni=b(function(hp){Object.defineProperty(hp,"__esModule",{value:!0});hp.shouldUseRule=hp.shouldUseGroup=hp.schemaHasRulesForType=void 0;function S$({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&fp(e,o)}hp.schemaHasRulesForType=S$;function fp(e,t){return t.rules.some((r)=>mp(e,r))}hp.shouldUseGroup=fp;function mp(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((o)=>e[o]!==void 0))}hp.shouldUseRule=mp});var kr=b(function(bp){Object.defineProperty(bp,"__esModule",{value:!0});bp.reportTypeError=bp.checkDataTypes=bp.checkDataType=bp.coerceAndCheckDataType=bp.getJSONTypes=bp.getSchemaTypes=bp.DataType=void 0;var E$=oi(),T$=ni(),R$=Sr(),N=C(),_p=Z(),It;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(It||(bp.DataType=It={}));function O$(e){let t=yp(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}bp.getSchemaTypes=O$;function yp(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(E$.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}bp.getJSONTypes=yp;function I$(e,t){let{gen:r,data:o,opts:n}=e,s=N$(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&T$.schemaHasRulesForType(e,t[0]));if(i){let a=ii(t,o,n.strictNumbers,It.Wrong);r.if(a,()=>{if(s.length)C$(e,t,s);else ai(e)})}return i}bp.coerceAndCheckDataType=I$;var vp=new Set(["string","number","integer","boolean","null"]);function N$(e,t){return t?e.filter((r)=>vp.has(r)||t==="array"&&r==="array"):[]}function C$(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",N._`typeof ${n}`),a=o.let("coerced",N._`undefined`);if(s.coerceTypes==="array")o.if(N._`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,N._`${n}[0]`).assign(i,N._`typeof ${n}`).if(ii(t,n,s.strictNumbers),()=>o.assign(a,n)));o.if(N._`${a} !== undefined`);for(let c of r)if(vp.has(c)||c==="array"&&s.coerceTypes==="array")u(c);o.else(),ai(e),o.endIf(),o.if(N._`${a} !== undefined`,()=>{o.assign(n,a),j$(e,a)});function u(c){switch(c){case"string":o.elseIf(N._`${i} == "number" || ${i} == "boolean"`).assign(a,N._`"" + ${n}`).elseIf(N._`${n} === null`).assign(a,N._`""`);return;case"number":o.elseIf(N._`${i} == "boolean" || ${n} === null
|
|
3
|
-
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,
|
|
4
|
-
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,
|
|
5
|
-
|| ${i} === "boolean" || ${n} === null`).assign(a,N._`[${n}]`)}}}function j$({gen:e,parentData:t,parentDataProperty:r},o){e.if(N._`${t} !== undefined`,()=>e.assign(N._`${t}[${r}]`,o))}function si(e,t,r,o=It.Correct){let n=o===It.Correct?N.operators.EQ:N.operators.NEQ,s;switch(e){case"null":return N._`${t} ${n} null`;case"array":s=N._`Array.isArray(${t})`;break;case"object":s=N._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(N._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return N._`typeof ${t} ${n} ${e}`}return o===It.Correct?s:N.not(s);function i(a=N.nil){return N.and(N._`typeof ${t} == "number"`,a,r?N._`isFinite(${t})`:N.nil)}}bp.checkDataType=si;function ii(e,t,r,o){if(e.length===1)return si(e[0],t,r,o);let n,s=_p.toHash(e);if(s.array&&s.object){let i=N._`typeof ${t} != "object"`;n=s.null?i:N._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=N.nil;if(s.number)delete s.integer;for(let i in s)n=N.and(n,si(i,t,r,o));return n}bp.checkDataTypes=ii;var A$={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?N._`{type: ${e}}`:N._`{type: ${t}}`};function ai(e){let t=Z$(e);R$.reportError(t,A$)}bp.reportTypeError=ai;function Z$(e){let{gen:t,data:r,schema:o}=e,n=_p.schemaRefOrVal(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var Sp=b(function(xp){Object.defineProperty(xp,"__esModule",{value:!0});xp.assignDefaults=void 0;var Nt=C(),V$=Z();function H$(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)wp(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,s)=>wp(e,s,n.default))}xp.assignDefaults=H$;function wp(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=Nt._`${s}${Nt.getProperty(t)}`;if(n){V$.checkStrictMode(e,`default is ignored for: ${a}`);return}let u=Nt._`${a} === undefined`;if(i.useDefaults==="empty")u=Nt._`${u} || ${a} === null || ${a} === ""`;o.if(u,Nt._`${a} = ${Nt.stringify(r)}`)}});var xe=b(function(Ep){Object.defineProperty(Ep,"__esModule",{value:!0});Ep.validateUnion=Ep.validateArray=Ep.usePattern=Ep.callValidateCode=Ep.schemaProperties=Ep.allSchemaProperties=Ep.noPropertyInData=Ep.propertyInData=Ep.isOwnProperty=Ep.hasPropFunc=Ep.reportMissingProp=Ep.checkMissingProp=Ep.checkReportMissingProp=void 0;var H=C(),ci=Z(),at=He(),J$=Z();function K$(e,t){let{gen:r,data:o,it:n}=e;r.if(li(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:H._`${t}`},!0),e.error()})}Ep.checkReportMissingProp=K$;function B$({gen:e,data:t,it:{opts:r}},o,n){return H.or(...o.map((s)=>H.and(li(e,t,s,r.ownProperties),H._`${n} = ${s}`)))}Ep.checkMissingProp=B$;function G$(e,t){e.setParams({missingProperty:t},!0),e.error()}Ep.reportMissingProp=G$;function kp(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:H._`Object.prototype.hasOwnProperty`})}Ep.hasPropFunc=kp;function ui(e,t,r){return H._`${kp(e)}.call(${t}, ${r})`}Ep.isOwnProperty=ui;function W$(e,t,r,o){let n=H._`${t}${H.getProperty(r)} !== undefined`;return o?H._`${n} && ${ui(e,t,r)}`:n}Ep.propertyInData=W$;function li(e,t,r,o){let n=H._`${t}${H.getProperty(r)} === undefined`;return o?H.or(n,H.not(ui(e,t,r))):n}Ep.noPropertyInData=li;function Pp(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}Ep.allSchemaProperties=Pp;function X$(e,t){return Pp(t).filter((r)=>!ci.alwaysValidSchema(e,t[r]))}Ep.schemaProperties=X$;function Y$({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,u,c){let l=c?H._`${e}, ${t}, ${o}${n}`:t,d=[[at.default.instancePath,H.strConcat(at.default.instancePath,s)],[at.default.parentData,i.parentData],[at.default.parentDataProperty,i.parentDataProperty],[at.default.rootData,at.default.rootData]];if(i.opts.dynamicRef)d.push([at.default.dynamicAnchors,at.default.dynamicAnchors]);let p=H._`${l}, ${r.object(...d)}`;return u!==H.nil?H._`${a}.call(${u}, ${p})`:H._`${a}(${p})`}Ep.callValidateCode=Y$;var Q$=H._`new RegExp`;function ew({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:H._`${n.code==="new RegExp"?Q$:J$.useFunc(e,n)}(${r}, ${o})`})}Ep.usePattern=ew;function tw(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let u=t.const("len",H._`${r}.length`);t.forRange("i",0,u,(c)=>{e.subschema({keyword:o,dataProp:c,dataPropType:ci.Type.Num},s),t.if(H.not(s),a)})}}Ep.validateArray=tw;function rw(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((u)=>ci.alwaysValidSchema(n,u))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:o,schemaProp:c,compositeRule:!0},a);if(t.assign(i,H._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(H.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}Ep.validateUnion=rw});var Cp=b(function(Ip){Object.defineProperty(Ip,"__esModule",{value:!0});Ip.validateKeywordUsage=Ip.validSchemaType=Ip.funcKeywordCode=Ip.macroKeywordCode=void 0;var pe=C(),bt=He(),hw=xe(),gw=Sr();function _w(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),u=Op(r,o,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:pe.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}Ip.macroKeywordCode=_w;function yw(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:u}=e;bw(u,t);let c=!a&&t.compile?t.compile.call(u.self,s,i,u):t.validate,l=Op(o,n,c),d=o.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1){if(g(),t.modifying)Rp(e);v(()=>e.error())}else{let y=t.async?f():h();if(t.modifying)Rp(e);v(()=>vw(e,y))}}function f(){let y=o.let("ruleErrs",null);return o.try(()=>g(pe._`await `),(R)=>o.assign(d,!1).if(pe._`${R} instanceof ${u.ValidationError}`,()=>o.assign(y,pe._`${R}.errors`),()=>o.throw(R))),y}function h(){let y=pe._`${l}.errors`;return o.assign(y,null),g(pe.nil),y}function g(y=t.async?pe._`await `:pe.nil){let R=u.opts.passContext?bt.default.this:bt.default.self,T=!(("compile"in t)&&!a||t.schema===!1);o.assign(d,pe._`${y}${hw.callValidateCode(e,l,R,T)}`,t.modifying)}function v(y){var R;o.if(pe.not((R=t.valid)!==null&&R!==void 0?R:d),y)}}Ip.funcKeywordCode=yw;function Rp(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,pe._`${o.parentData}[${o.parentDataProperty}]`))}function vw(e,t){let{gen:r}=e;r.if(pe._`Array.isArray(${t})`,()=>{r.assign(bt.default.vErrors,pe._`${bt.default.vErrors} === null ? ${t} : ${bt.default.vErrors}.concat(${t})`).assign(bt.default.errors,pe._`${bt.default.vErrors}.length`),gw.extendErrors(e)},()=>e.error())}function bw({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function Op(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:pe.stringify(r)})}function $w(e,t,r=!1){return!t.length||t.some((o)=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}Ip.validSchemaType=$w;function ww({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw Error("ajv implementation error");let i=n.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[s])){let u=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw Error(u)}}}Ip.validateKeywordUsage=ww});var qp=b(function(Ap){Object.defineProperty(Ap,"__esModule",{value:!0});Ap.extendSubschemaMode=Ap.extendSubschemaData=Ap.getSubschema=void 0;var Ae=C(),jp=Z();function kw(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:Ae._`${e.schemaPath}${Ae.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:Ae._`${e.schemaPath}${Ae.getProperty(t)}${Ae.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${jp.escapeFragment(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}Ap.getSubschema=kw;function Pw(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:l,opts:d}=t,p=a.let("data",Ae._`${t.data}${Ae.getProperty(r)}`,!0);u(p),e.errorPath=Ae.str`${c}${jp.getErrorPath(r,o,d.jsPropertySyntax)}`,e.parentDataProperty=Ae._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let c=n instanceof Ae.Name?n:a.let("data",n,!0);if(u(c),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}Ap.extendSubschemaData=Pw;function Ew(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){if(o!==void 0)e.compositeRule=o;if(n!==void 0)e.createErrors=n;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}Ap.extendSubschemaMode=Ew});var di=b(function(CN,Mp){Mp.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var Lp=b(function(jN,Dp){var ct=Dp.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};Uo(t,o,n,e,"",e)};ct.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ct.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ct.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ct.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 Uo(e,t,r,o,n,s,i,a,u,c){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,u,c);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in ct.arrayKeywords)for(var p=0;p<d.length;p++)Uo(e,t,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in ct.propsKeywords){if(d&&typeof d=="object")for(var f in d)Uo(e,t,r,d[f],n+"/"+l+"/"+Ow(f),s,n,l,o,f)}else if(l in ct.keywords||e.allKeys&&!(l in ct.skipKeywords))Uo(e,t,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,u,c)}}function Ow(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Pr=b(function(Hp){Object.defineProperty(Hp,"__esModule",{value:!0});Hp.getSchemaRefs=Hp.resolveUrl=Hp.normalizeId=Hp._getFullPath=Hp.getFullPath=Hp.inlineRef=void 0;var Iw=Z(),Nw=di(),Cw=Lp(),jw=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Aw(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!pi(e);if(!t)return!1;return Up(e)<=t}Hp.inlineRef=Aw;var Zw=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function pi(e){for(let t in e){if(Zw.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(pi))return!0;if(typeof r=="object"&&pi(r))return!0}return!1}function Up(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,jw.has(r))continue;if(typeof e[r]=="object")Iw.eachItem(e[r],(o)=>t+=Up(o));if(t===1/0)return 1/0}return t}function Fp(e,t="",r){if(r!==!1)t=Ct(t);let o=e.parse(t);return Vp(e,o)}Hp.getFullPath=Fp;function Vp(e,t){return e.serialize(t).split("#")[0]+"#"}Hp._getFullPath=Vp;var qw=/#\/?$/;function Ct(e){return e?e.replace(qw,""):""}Hp.normalizeId=Ct;function Mw(e,t,r){return r=Ct(r),e.resolve(t,r)}Hp.resolveUrl=Mw;var Dw=/^[a-z_][-a-z0-9._]*$/i;function Lw(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Ct(e[r]||t),s={"":n},i=Fp(o,n,!1),a={},u=new Set;return Cw(e,{allKeys:!0},(d,p,f,h)=>{if(h===void 0)return;let g=i+p,v=s[h];if(typeof d[r]=="string")v=y.call(this,d[r]);R.call(this,d.$anchor),R.call(this,d.$dynamicAnchor),s[p]=v;function y(T){let I=this.opts.uriResolver.resolve;if(T=Ct(v?I(v,T):T),u.has(T))throw l(T);u.add(T);let E=this.refs[T];if(typeof E=="string")E=this.refs[E];if(typeof E=="object")c(d,E.schema,T);else if(T!==Ct(g))if(T[0]==="#")c(d,a[T],T),a[T]=d;else this.refs[T]=g;return T}function R(T){if(typeof T=="string"){if(!Dw.test(T))throw Error(`invalid anchor "${T}"`);y.call(this,`#${T}`)}}}),a;function c(d,p,f){if(p!==void 0&&!Nw(d,p))throw l(f)}function l(d){return Error(`reference "${d}" resolves to more than one schema`)}}Hp.getSchemaRefs=Lw});var Rr=b(function(cf){Object.defineProperty(cf,"__esModule",{value:!0});cf.getData=cf.KeywordCxt=cf.validateFunctionCode=void 0;var Wp=lp(),Xp=kr(),fi=ni(),Fo=kr(),Kw=Sp(),Er=Cp(),mi=qp(),P=C(),O=He(),Bw=Pr(),Je=Z(),Tr=Sr();function Gw(e){if(ef(e)){if(tf(e),Qp(e)){Yw(e);return}}Yp(e,()=>Wp.topBoolOrEmptySchema(e))}cf.validateFunctionCode=Gw;function Yp({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){if(n.code.es5)e.func(t,P._`${O.default.data}, ${O.default.valCxt}`,o.$async,()=>{e.code(P._`"use strict"; ${Kp(r,n)}`),Xw(e,n),e.code(s)});else e.func(t,P._`${O.default.data}, ${Ww(n)}`,o.$async,()=>e.code(Kp(r,n)).code(s))}function Ww(e){return P._`{${O.default.instancePath}="", ${O.default.parentData}, ${O.default.parentDataProperty}, ${O.default.rootData}=${O.default.data}${e.dynamicRef?P._`, ${O.default.dynamicAnchors}={}`:P.nil}}={}`}function Xw(e,t){e.if(O.default.valCxt,()=>{if(e.var(O.default.instancePath,P._`${O.default.valCxt}.${O.default.instancePath}`),e.var(O.default.parentData,P._`${O.default.valCxt}.${O.default.parentData}`),e.var(O.default.parentDataProperty,P._`${O.default.valCxt}.${O.default.parentDataProperty}`),e.var(O.default.rootData,P._`${O.default.valCxt}.${O.default.rootData}`),t.dynamicRef)e.var(O.default.dynamicAnchors,P._`${O.default.valCxt}.${O.default.dynamicAnchors}`)},()=>{if(e.var(O.default.instancePath,P._`""`),e.var(O.default.parentData,P._`undefined`),e.var(O.default.parentDataProperty,P._`undefined`),e.var(O.default.rootData,O.default.data),t.dynamicRef)e.var(O.default.dynamicAnchors,P._`{}`)})}function Yw(e){let{schema:t,opts:r,gen:o}=e;Yp(e,()=>{if(r.$comment&&t.$comment)of(e);if(ox(e),o.let(O.default.vErrors,null),o.let(O.default.errors,0),r.unevaluated)Qw(e);rf(e),ix(e)});return}function Qw(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",P._`${r}.evaluated`),t.if(P._`${e.evaluated}.dynamicProps`,()=>t.assign(P._`${e.evaluated}.props`,P._`undefined`)),t.if(P._`${e.evaluated}.dynamicItems`,()=>t.assign(P._`${e.evaluated}.items`,P._`undefined`))}function Kp(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?P._`/*# sourceURL=${r} */`:P.nil}function ex(e,t){if(ef(e)){if(tf(e),Qp(e)){tx(e,t);return}}Wp.boolOrEmptySchema(e,t)}function Qp({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function ef(e){return typeof e.schema!="boolean"}function tx(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)of(e);nx(e),sx(e);let s=o.const("_errs",O.default.errors);rf(e,s),o.var(t,P._`${s} === ${O.default.errors}`)}function tf(e){Je.checkUnknownRules(e),rx(e)}function rf(e,t){if(e.opts.jtd)return Bp(e,[],!1,t);let r=Xp.getSchemaTypes(e.schema),o=Xp.coerceAndCheckDataType(e,r);Bp(e,r,!o,t)}function rx(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&Je.schemaHasRulesButRef(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function ox(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)Je.checkStrictMode(e,"default is ignored in the schema root")}function nx(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=Bw.resolveUrl(e.opts.uriResolver,e.baseId,t)}function sx(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function of({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code(P._`${O.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=P.str`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(P._`${O.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function ix(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;if(r.$async)t.if(P._`${O.default.errors} === 0`,()=>t.return(O.default.data),()=>t.throw(P._`new ${n}(${O.default.vErrors})`));else{if(t.assign(P._`${o}.errors`,O.default.vErrors),s.unevaluated)ax(e);t.return(P._`${O.default.errors} === 0`)}}function ax({gen:e,evaluated:t,props:r,items:o}){if(r instanceof P.Name)e.assign(P._`${t}.props`,r);if(o instanceof P.Name)e.assign(P._`${t}.items`,o)}function Bp(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:u,self:c}=e,{RULES:l}=c;if(s.$ref&&(u.ignoreKeywordsWithRef||!Je.schemaHasRulesButRef(s,l))){n.block(()=>sf(e,"$ref",l.all.$ref.definition));return}if(!u.jtd)cx(e,t);n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){if(!fi.shouldUseGroup(s,p))return;if(p.type){if(n.if(Fo.checkDataType(p.type,i,u.strictNumbers)),Gp(e,p),t.length===1&&t[0]===p.type&&r)n.else(),Fo.reportTypeError(e);n.endIf()}else Gp(e,p);if(!a)n.if(P._`${O.default.errors} === ${o||0}`)}}function Gp(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)Kw.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(fi.shouldUseRule(o,s))sf(e,s.keyword,s.definition,t.type)})}function cx(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(ux(e,t),!e.opts.allowUnionTypes)lx(e,t);dx(e,e.dataTypes)}function ux(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!nf(e.dataTypes,r))hi(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),fx(e,t)}function lx(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))hi(e,"use allowUnionTypes to allow union type keyword")}function dx(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&fi.shouldUseRule(e.schema,n)){let{type:s}=n.definition;if(s.length&&!s.some((i)=>px(t,i)))hi(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function px(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function nf(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function fx(e,t){let r=[];for(let o of e.dataTypes)if(nf(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function hi(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,Je.checkStrictMode(e,t,e.opts.strictTypes)}class gi{constructor(e,t,r){if(Er.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=Je.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",af(this.$data,e));else if(this.schemaCode=this.schemaValue,!Er.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",O.default.errors)}result(e,t,r){this.failResult(P.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(P.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(P._`${t} !== undefined && (${P.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Tr.reportExtraError:Tr.reportError)(this,this.def.error,t)}$dataError(){Tr.reportError(this,this.def.$dataError||Tr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Tr.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=P.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=P.nil,t=P.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:s}=this;if(r.if(P.or(P._`${o} === undefined`,t)),e!==P.nil)r.assign(e,!0);if(n.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==P.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return P.or(s(),i());function s(){if(r.length){if(!(t instanceof P.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return P._`${Fo.checkDataTypes(a,t,n.opts.strictNumbers,Fo.DataType.Wrong)}`}return P.nil}function i(){if(o.validateSchema){let a=e.scopeValue("validate$data",{ref:o.validateSchema});return P._`!${a}(${t})`}return P.nil}}subschema(e,t){let r=mi.getSubschema(this.it,e);mi.extendSubschemaData(r,this.it,e),mi.extendSubschemaMode(r,e);let o={...this.it,...r,items:void 0,props:void 0};return ex(o,t),o}mergeEvaluated(e,t){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=Je.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=Je.mergeEvaluated.items(o,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(t,()=>this.mergeEvaluated(e,P.Name)),!0}}cf.KeywordCxt=gi;function sf(e,t,r,o){let n=new gi(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)Er.funcKeywordCode(n,r);else if("macro"in r)Er.macroKeywordCode(n,r);else if(r.compile||r.validate)Er.funcKeywordCode(n,r)}var mx=/^\/(?:[^~]|~0|~1)*$/,hx=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function af(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return O.default.rootData;if(e[0]==="/"){if(!mx.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,s=O.default.rootData}else{let c=hx.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(n=c[2],n==="#"){if(l>=t)throw Error(u("property/index",l));return o[t-l]}if(l>t)throw Error(u("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let c of a)if(c)s=P._`${s}${P.getProperty(Je.unescapeJsonPointer(c))}`,i=P._`${i} && ${s}`;return i;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}cf.getData=af});var Vo=b(function(df){Object.defineProperty(df,"__esModule",{value:!0});class lf extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}df.default=lf});var Or=b(function(ff){Object.defineProperty(ff,"__esModule",{value:!0});var _i=Pr();class pf extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=_i.resolveUrl(e,t,r),this.missingSchema=_i.normalizeId(_i.getFullPath(e,this.missingRef))}}ff.default=pf});var Jo=b(function(gf){Object.defineProperty(gf,"__esModule",{value:!0});gf.resolveSchema=gf.getCompilingSchema=gf.resolveRef=gf.compileSchema=gf.SchemaEnv=void 0;var Te=C(),bx=Vo(),$t=He(),Re=Pr(),mf=Z(),$x=Rr();class Ir{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:Re.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}gf.SchemaEnv=Ir;function vi(e){let t=hf.call(this,e);if(t)return t;let r=Re.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new Te.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:bx.default,code:Te._`require("ajv/dist/runtime/validation_error").default`});let u=i.scopeName("validate");e.validateName=u;let c={gen:i,allErrors:this.opts.allErrors,data:$t.default.data,parentData:$t.default.parentData,parentDataProperty:$t.default.parentDataProperty,dataNames:[$t.default.data],dataPathArr:[Te.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:Te.stringify(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Te.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Te._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),$x.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let d=i.toString();if(l=`${i.scopeRefs($t.default.scope)}return ${d}`,this.opts.code.process)l=this.opts.code.process(l,e);let f=Function(`${$t.default.self}`,`${$t.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async)f.$async=!0;if(this.opts.code.source===!0)f.source={validateName:u,validateCode:d,scopeValues:i._values};if(this.opts.unevaluated){let{props:h,items:g}=c;if(f.evaluated={props:h instanceof Te.Name?void 0:h,items:g instanceof Te.Name?void 0:g,dynamicProps:h instanceof Te.Name,dynamicItems:g instanceof Te.Name},f.source)f.source.evaluated=Te.stringify(f.evaluated)}return e.validate=f,e}catch(d){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw d}finally{this._compilations.delete(e)}}gf.compileSchema=vi;function wx(e,t,r){var o;r=Re.resolveUrl(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=Sx.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;if(i)s=new Ir({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=xx.call(this,s)}gf.resolveRef=wx;function xx(e){if(Re.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:vi.call(this,e)}function hf(e){for(let t of this._compilations)if(zx(t,e))return t}gf.getCompilingSchema=hf;function zx(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Sx(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||Ho.call(this,e,t)}function Ho(e,t){let r=this.opts.uriResolver.parse(t),o=Re._getFullPath(this.opts.uriResolver,r),n=Re.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return yi.call(this,r,e);let s=Re.normalizeId(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=Ho.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return yi.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)vi.call(this,i);if(s===Re.normalizeId(t)){let{schema:a}=i,{schemaId:u}=this.opts,c=a[u];if(c)n=Re.resolveUrl(this.opts.uriResolver,n,c);return new Ir({schema:a,schemaId:u,root:e,baseId:n})}return yi.call(this,r,i)}gf.resolveSchema=Ho;var kx=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function yi(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let u=r[mf.unescapeFragment(a)];if(u===void 0)return;r=u;let c=typeof r==="object"&&r[this.opts.schemaId];if(!kx.has(a)&&c)t=Re.resolveUrl(this.opts.uriResolver,t,c)}let s;if(typeof r!="boolean"&&r.$ref&&!mf.schemaHasRulesButRef(r,this.RULES)){let a=Re.resolveUrl(this.opts.uriResolver,t,r.$ref);s=Ho.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Ir({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s;return}});var yf=b(function(LN,Ox){Ox.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 $i=b(function(UN,wf){var Ix=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),bf=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function bi(e){let t="",r=0,o=0;for(o=0;o<e.length;o++){if(r=e[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var Nx=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function vf(e){return e.length=0,!0}function Cx(e,t,r){if(e.length){let o=bi(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function jx(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=Cx;for(let u=0;u<e.length;u++){let c=e[u];if(c==="["||c==="]")continue;if(c===":"){if(s===!0)i=!0;if(!a(n,o,r))break;if(++t>7){r.error=!0;break}if(u>0&&e[u-1]===":")s=!0;o.push(":");continue}else if(c==="%"){if(!a(n,o,r))break;a=vf}else{n.push(c);continue}}if(n.length)if(a===vf)r.zone=n.join("");else if(i)o.push(n.join(""));else o.push(bi(n));return r.address=o.join(""),r}function $f(e){if(Ax(e,":")<2)return{host:e,isIPV6:!1};let t=jx(e);if(!t.error){let{address:r,address:o}=t;if(t.zone)r+="%"+t.zone,o+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:o}}else return{host:e,isIPV6:!1}}function Ax(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function Zx(e){let t=e,r=[],o=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}function qx(e,t){let r=t!==!0?escape:unescape;if(e.scheme!==void 0)e.scheme=r(e.scheme);if(e.userinfo!==void 0)e.userinfo=r(e.userinfo);if(e.host!==void 0)e.host=r(e.host);if(e.path!==void 0)e.path=r(e.path);if(e.query!==void 0)e.query=r(e.query);if(e.fragment!==void 0)e.fragment=r(e.fragment);return e}function Mx(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!bf(r)){let o=$f(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=e.host}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}wf.exports={nonSimpleDomain:Nx,recomposeAuthority:Mx,normalizeComponentEncoding:qx,removeDotSegments:Zx,isIPv4:bf,isUUID:Ix,normalizeIPv6:$f,stringArrayToHexStripped:bi}});var Pf=b(function(FN,kf){var{isUUID:Dx}=$i(),Lx=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Ux=["http","https","ws","wss","urn","urn:uuid"];function Fx(e){return Ux.indexOf(e)!==-1}function wi(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function xf(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function zf(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function Vx(e){return e.secure=wi(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Hx(e){if(e.port===(wi(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function Jx(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Lx);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=xi(n);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function Kx(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=xi(n);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function Bx(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Dx(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function Gx(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var Sf={scheme:"http",domainHost:!0,parse:xf,serialize:zf},Wx={scheme:"https",domainHost:Sf.domainHost,parse:xf,serialize:zf},Ko={scheme:"ws",domainHost:!0,parse:Vx,serialize:Hx},Xx={scheme:"wss",domainHost:Ko.domainHost,parse:Ko.parse,serialize:Ko.serialize},Yx={scheme:"urn",parse:Jx,serialize:Kx,skipNormalize:!0},Qx={scheme:"urn:uuid",parse:Bx,serialize:Gx,skipNormalize:!0},Bo={http:Sf,https:Wx,ws:Ko,wss:Xx,urn:Yx,"urn:uuid":Qx};Object.setPrototypeOf(Bo,null);function xi(e){return e&&(Bo[e]||Bo[e.toLowerCase()])||void 0}kf.exports={wsIsSecure:wi,SCHEMES:Bo,isValidSchemeName:Fx,getSchemeHandler:xi}});var Rf=b(function(VN,Wo){var{normalizeIPv6:e0,removeDotSegments:Nr,recomposeAuthority:t0,normalizeComponentEncoding:Go,isIPv4:r0,nonSimpleDomain:o0}=$i(),{SCHEMES:n0,getSchemeHandler:Ef}=Pf();function s0(e,t){if(typeof e==="string")e=Ze(Ke(e,t),t);else if(typeof e==="object")e=Ke(Ze(e,t),t);return e}function i0(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=Tf(Ke(e,o),Ke(t,o),o,!0);return o.skipEscape=!0,Ze(n,o)}function Tf(e,t,r,o){let n={};if(!o)e=Ke(Ze(e,r),r),t=Ke(Ze(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=Nr(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=Nr(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=Nr(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=Nr(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function a0(e,t,r){if(typeof e==="string")e=unescape(e),e=Ze(Go(Ke(e,r),!0),{...r,skipEscape:!0});else if(typeof e==="object")e=Ze(Go(e,!0),{...r,skipEscape:!0});if(typeof t==="string")t=unescape(t),t=Ze(Go(Ke(t,r),!0),{...r,skipEscape:!0});else if(typeof t==="object")t=Ze(Go(t,!0),{...r,skipEscape:!0});return e.toLowerCase()===t.toLowerCase()}function Ze(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[],s=Ef(o.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=escape(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=unescape(r.path);if(o.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let i=t0(r);if(i!==void 0){if(o.reference!=="suffix")n.push("//");if(n.push(i),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let a=r.path;if(!o.absolutePath&&(!s||!s.absolutePath))a=Nr(a);if(i===void 0&&a[0]==="/"&&a[1]==="/")a="/%2F"+a.slice(2);n.push(a)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var c0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Ke(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(c0);if(s){if(o.scheme=s[1],o.userinfo=s[3],o.host=s[4],o.port=parseInt(s[5],10),o.path=s[6]||"",o.query=s[7],o.fragment=s[8],isNaN(o.port))o.port=s[5];if(o.host)if(r0(o.host)===!1){let u=e0(o.host);o.host=u.host.toLowerCase(),n=u.isIPV6}else n=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let i=Ef(r.scheme||o.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)){if(o.host&&(r.domainHost||i&&i.domainHost)&&n===!1&&o0(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(a){o.error=o.error||"Host's domain name can not be converted to ASCII: "+a}}if(!i||i&&!i.skipNormalize){if(e.indexOf("%")!==-1){if(o.scheme!==void 0)o.scheme=unescape(o.scheme);if(o.host!==void 0)o.host=unescape(o.host)}if(o.path)o.path=escape(unescape(o.path));if(o.fragment)o.fragment=encodeURI(decodeURIComponent(o.fragment))}if(i&&i.parse)i.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return o}var zi={SCHEMES:n0,normalize:s0,resolve:i0,resolveComponent:Tf,equal:a0,serialize:Ze,parse:Ke};Wo.exports=zi;Wo.exports.default=zi;Wo.exports.fastUri=zi});var Nf=b(function(If){Object.defineProperty(If,"__esModule",{value:!0});var Of=Rf();Of.code='require("ajv/dist/runtime/uri").default';If.default=Of});var Lf=b(function(Be){Object.defineProperty(Be,"__esModule",{value:!0});Be.CodeGen=Be.Name=Be.nil=Be.stringify=Be.str=Be._=Be.KeywordCxt=void 0;var l0=Rr();Object.defineProperty(Be,"KeywordCxt",{enumerable:!0,get:function(){return l0.KeywordCxt}});var jt=C();Object.defineProperty(Be,"_",{enumerable:!0,get:function(){return jt._}});Object.defineProperty(Be,"str",{enumerable:!0,get:function(){return jt.str}});Object.defineProperty(Be,"stringify",{enumerable:!0,get:function(){return jt.stringify}});Object.defineProperty(Be,"nil",{enumerable:!0,get:function(){return jt.nil}});Object.defineProperty(Be,"Name",{enumerable:!0,get:function(){return jt.Name}});Object.defineProperty(Be,"CodeGen",{enumerable:!0,get:function(){return jt.CodeGen}});var d0=Vo(),qf=Or(),p0=oi(),jr=Jo(),f0=C(),Cr=Pr(),Xo=kr(),ki=Z(),Cf=yf(),m0=Nf(),Mf=(e,t)=>new RegExp(e,t);Mf.code="new RegExp";var h0=["removeAdditional","useDefaults","coerceTypes"],g0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),_0={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."},y0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},jf=200;function v0(e){var t,r,o,n,s,i,a,u,c,l,d,p,f,h,g,v,y,R,T,I,E,Se,ke,xn,zn;let Ht=e.strict,Sn=(t=e.code)===null||t===void 0?void 0:t.optimize,da=Sn===!0||Sn===void 0?1:Sn||0,pa=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:Mf,Xg=(n=e.uriResolver)!==null&&n!==void 0?n:m0.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:Ht)!==null&&i!==void 0?i:!0,strictNumbers:(u=(a=e.strictNumbers)!==null&&a!==void 0?a:Ht)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:Ht)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:Ht)!==null&&p!==void 0?p:"log",strictRequired:(h=(f=e.strictRequired)!==null&&f!==void 0?f:Ht)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:da,regExp:pa}:{optimize:da,regExp:pa},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:jf,loopEnum:(v=e.loopEnum)!==null&&v!==void 0?v:jf,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(R=e.messages)!==null&&R!==void 0?R:!0,inlineRefs:(T=e.inlineRefs)!==null&&T!==void 0?T:!0,schemaId:(I=e.schemaId)!==null&&I!==void 0?I:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(Se=e.validateSchema)!==null&&Se!==void 0?Se:!0,validateFormats:(ke=e.validateFormats)!==null&&ke!==void 0?ke:!0,unicodeRegExp:(xn=e.unicodeRegExp)!==null&&xn!==void 0?xn:!0,int32range:(zn=e.int32range)!==null&&zn!==void 0?zn:!0,uriResolver:Xg}}class Yo{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v0(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new f0.ValueScope({scope:{},prefixes:g0,es5:t,lines:r}),this.logger=S0(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=p0.getRules(),Af.call(this,_0,e,"NOT SUPPORTED"),Af.call(this,y0,e,"DEPRECATED","warn"),this._metaOpts=x0.call(this),e.formats)$0.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)w0.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);b0.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=Cf;if(r==="id")o={...Cf},o.id=o.$id,delete o.$id;if(t&&e)this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);if(!("$async"in r))this.errors=r.errors;return o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(c,l){await n.call(this,c.$schema);let d=this._addSchema(c,l);return d.validate||s.call(this,d)}async function n(c){if(c&&!this.getSchema(c))await o.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(l){if(!(l instanceof qf.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,c)}}function i({missingSchema:c,missingRef:l}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${l} cannot be resolved`)}async function a(c){let l=await u.call(this,c);if(!this.refs[c])await n.call(this,l.$schema);if(!this.refs[c])this.addSchema(l,c,t)}async function u(c){let l=this._loading[c];if(l)return l;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,o);return this}let n;if(typeof e==="object"){let{schemaId:s}=this.opts;if(n=e[s],n!==void 0&&typeof n!="string")throw Error(`schema ${s} must be string`)}return t=Cr.normalizeId(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return o}getSchema(e){let t;while(typeof(t=Zf.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new jr.SchemaEnv({schema:{},schemaId:r});if(t=jr.resolveSchema.call(this,o,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=Zf.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=Cr.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(P0.call(this,r,t),!t)return ki.eachItem(r,(n)=>Si.call(this,n)),this;T0.call(this,t);let o={...t,type:Xo.getJSONTypes(t.type),schemaType:Xo.getJSONTypes(t.schemaType)};return ki.eachItem(r,o.type.length===0?(n)=>Si.call(this,n,o):(n)=>o.type.forEach((s)=>Si.call(this,n,o,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let o=r.rules.findIndex((n)=>n.keyword===e);if(o>=0)r.rules.splice(o,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,n)=>o+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of t){let n=o.split("/").slice(1),s=e;for(let i of n)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:u}=a.definition,c=s[i];if(u&&c)s[i]=Df(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];if(!t||t.test(r)){if(typeof o=="string")delete e[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete e[r]}}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=Cr.normalizeId(s||r);let u=Cr.getSchemaRefs.call(this,e,r);if(a=new jr.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:u}),this._cache.set(a.schema,a),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(o)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else jr.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{jr.compileSchema.call(this,e)}finally{this.opts=t}}}Yo.ValidationError=d0.default;Yo.MissingRefError=qf.default;Be.default=Yo;function Af(e,t,r,o="error"){for(let n in e){let s=n;if(s in t)this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function Zf(e){return e=Cr.normalizeId(e),this.schemas[e]||this.refs[e]}function b0(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function $0(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function w0(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function x0(){let e={...this.opts};for(let t of h0)delete e[t];return e}var z0={log(){},warn(){},error(){}};function S0(e){if(e===!1)return z0;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var k0=/^[a-z_$][a-z0-9_$:-]*$/i;function P0(e,t){let{RULES:r}=this;if(ki.eachItem(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!k0.test(o))throw Error(`Keyword ${o} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function Si(e,t,r){var o;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:u})=>u===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Xo.getJSONTypes(t.type),schemaType:Xo.getJSONTypes(t.schemaType)}};if(t.before)E0.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach((u)=>this.addKeyword(u))}function E0(e,t,r){let o=e.rules.findIndex((n)=>n.keyword===r);if(o>=0)e.rules.splice(o,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function T0(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=Df(t);e.validateSchema=this.compile(t,!0)}var R0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Df(e){return{anyOf:[e,R0]}}});var Ff=b(function(Uf){Object.defineProperty(Uf,"__esModule",{value:!0});var N0={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Uf.default=N0});var Gf=b(function(Kf){Object.defineProperty(Kf,"__esModule",{value:!0});Kf.callRef=Kf.getValidate=void 0;var j0=Or(),Vf=xe(),ge=C(),At=He(),Hf=Jo(),Qo=Z(),A0={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:u}=o,{root:c}=s;if((r==="#"||r==="#/")&&n===c.baseId)return d();let l=Hf.resolveRef.call(u,c,n,r);if(l===void 0)throw new j0.default(o.opts.uriResolver,n,r);if(l instanceof Hf.SchemaEnv)return p(l);return f(l);function d(){if(s===c)return en(e,i,s,s.$async);let h=t.scopeValue("root",{ref:c});return en(e,ge._`${h}.validate`,c,c.$async)}function p(h){let g=Jf(e,h);en(e,g,h,h.$async)}function f(h){let g=t.scopeValue("schema",a.code.source===!0?{ref:h,code:ge.stringify(h)}:{ref:h}),v=t.name("valid"),y=e.subschema({schema:h,dataTypes:[],schemaPath:ge.nil,topSchemaRef:g,errSchemaPath:r},v);e.mergeEvaluated(y),e.ok(v)}}};function Jf(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):ge._`${r.scopeValue("wrapper",{ref:t})}.validate`}Kf.getValidate=Jf;function en(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:u}=s,c=u.passContext?At.default.this:ge.nil;if(o)l();else d();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{if(n.code(ge._`await ${Vf.callValidateCode(e,t,c)}`),f(t),!i)n.assign(h,!0)},(g)=>{if(n.if(ge._`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),p(g),!i)n.assign(h,!1)}),e.ok(h)}function d(){e.result(Vf.callValidateCode(e,t,c),()=>f(t),()=>p(t))}function p(h){let g=ge._`${h}.errors`;n.assign(At.default.vErrors,ge._`${At.default.vErrors} === null ? ${g} : ${At.default.vErrors}.concat(${g})`),n.assign(At.default.errors,ge._`${At.default.vErrors}.length`)}function f(h){var g;if(!s.opts.unevaluated)return;let v=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(v&&!v.dynamicProps){if(v.props!==void 0)s.props=Qo.mergeEvaluated.props(n,v.props,s.props)}else{let y=n.var("props",ge._`${h}.evaluated.props`);s.props=Qo.mergeEvaluated.props(n,y,s.props,ge.Name)}if(s.items!==!0)if(v&&!v.dynamicItems){if(v.items!==void 0)s.items=Qo.mergeEvaluated.items(n,v.items,s.items)}else{let y=n.var("items",ge._`${h}.evaluated.items`);s.items=Qo.mergeEvaluated.items(n,y,s.items,ge.Name)}}}Kf.callRef=en;Kf.default=A0});var Xf=b(function(Wf){Object.defineProperty(Wf,"__esModule",{value:!0});var M0=Ff(),D0=Gf(),L0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",M0.default,D0.default];Wf.default=L0});var Qf=b(function(Yf){Object.defineProperty(Yf,"__esModule",{value:!0});var rn=C(),ut=rn.operators,tn={maximum:{okStr:"<=",ok:ut.LTE,fail:ut.GT},minimum:{okStr:">=",ok:ut.GTE,fail:ut.LT},exclusiveMaximum:{okStr:"<",ok:ut.LT,fail:ut.GTE},exclusiveMinimum:{okStr:">",ok:ut.GT,fail:ut.LTE}},F0={message:({keyword:e,schemaCode:t})=>rn.str`must be ${tn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>rn._`{comparison: ${tn[e].okStr}, limit: ${t}}`},V0={keyword:Object.keys(tn),type:"number",schemaType:"number",$data:!0,error:F0,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(rn._`${r} ${tn[t].fail} ${o} || isNaN(${r})`)}};Yf.default=V0});var tm=b(function(em){Object.defineProperty(em,"__esModule",{value:!0});var Ar=C(),J0={message:({schemaCode:e})=>Ar.str`must be multiple of ${e}`,params:({schemaCode:e})=>Ar._`{multipleOf: ${e}}`},K0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:J0,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?Ar._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:Ar._`${i} !== parseInt(${i})`;e.fail$data(Ar._`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};em.default=K0});var nm=b(function(om){Object.defineProperty(om,"__esModule",{value:!0});function rm(e){let t=e.length,r=0,o=0,n;while(o<t)if(r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t){if(n=e.charCodeAt(o),(n&64512)===56320)o++}return r}om.default=rm;rm.code='require("ajv/dist/runtime/ucs2length").default'});var im=b(function(sm){Object.defineProperty(sm,"__esModule",{value:!0});var wt=C(),W0=Z(),X0=nm(),Y0={message({keyword:e,schemaCode:t}){return wt.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>wt._`{limit: ${e}}`},Q0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Y0,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?wt.operators.GT:wt.operators.LT,i=n.opts.unicode===!1?wt._`${r}.length`:wt._`${W0.useFunc(e.gen,X0.default)}(${r})`;e.fail$data(wt._`${i} ${s} ${o}`)}};sm.default=Q0});var cm=b(function(am){Object.defineProperty(am,"__esModule",{value:!0});var tz=xe(),rz=Z(),Zt=C(),oz={message:({schemaCode:e})=>Zt.str`must match pattern "${e}"`,params:({schemaCode:e})=>Zt._`{pattern: ${e}}`},nz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:oz,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:u}=i.opts.code,c=u.code==="new RegExp"?Zt._`new RegExp`:rz.useFunc(t,u),l=t.let("valid");t.try(()=>t.assign(l,Zt._`${c}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(Zt._`!${l}`)}else{let u=tz.usePattern(e,n);e.fail$data(Zt._`!${u}.test(${r})`)}}};am.default=nz});var lm=b(function(um){Object.defineProperty(um,"__esModule",{value:!0});var Zr=C(),iz={message({keyword:e,schemaCode:t}){return Zr.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>Zr._`{limit: ${e}}`},az={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:iz,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?Zr.operators.GT:Zr.operators.LT;e.fail$data(Zr._`Object.keys(${r}).length ${n} ${o}`)}};um.default=az});var pm=b(function(dm){Object.defineProperty(dm,"__esModule",{value:!0});var Mr=xe(),qr=C(),uz=Z(),lz={message:({params:{missingProperty:e}})=>qr.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>qr._`{missingProperty: ${e}}`},dz={keyword:"required",type:"object",schemaType:"array",$data:!0,error:lz,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let u=r.length>=a.loopRequired;if(i.allErrors)c();else l();if(a.strictRequired){let f=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if((f===null||f===void 0?void 0:f[g])===void 0&&!h.has(g)){let v=i.schemaEnv.baseId+i.errSchemaPath,y=`required property "${g}" is not defined at "${v}" (strictRequired)`;uz.checkStrictMode(i,y,i.opts.strictRequired)}}function c(){if(u||s)e.block$data(qr.nil,d);else for(let f of r)Mr.checkReportMissingProp(e,f)}function l(){let f=t.let("missing");if(u||s){let h=t.let("valid",!0);e.block$data(h,()=>p(f,h)),e.ok(h)}else t.if(Mr.checkMissingProp(e,r,f)),Mr.reportMissingProp(e,f),t.else()}function d(){t.forOf("prop",o,(f)=>{e.setParams({missingProperty:f}),t.if(Mr.noPropertyInData(t,n,f,a.ownProperties),()=>e.error())})}function p(f,h){e.setParams({missingProperty:f}),t.forOf(f,o,()=>{t.assign(h,Mr.propertyInData(t,n,f,a.ownProperties)),t.if(qr.not(h),()=>{e.error(),t.break()})},qr.nil)}}};dm.default=dz});var mm=b(function(fm){Object.defineProperty(fm,"__esModule",{value:!0});var Dr=C(),fz={message({keyword:e,schemaCode:t}){return Dr.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Dr._`{limit: ${e}}`},mz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:fz,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?Dr.operators.GT:Dr.operators.LT;e.fail$data(Dr._`${r}.length ${n} ${o}`)}};fm.default=mz});var on=b(function(gm){Object.defineProperty(gm,"__esModule",{value:!0});var hm=di();hm.code='require("ajv/dist/runtime/equal").default';gm.default=hm});var ym=b(function(_m){Object.defineProperty(_m,"__esModule",{value:!0});var Pi=kr(),ie=C(),_z=Z(),yz=on(),vz={message:({params:{i:e,j:t}})=>ie.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>ie._`{i: ${e}, j: ${t}}`},bz={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:vz,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let u=t.let("valid"),c=s.items?Pi.getSchemaTypes(s.items):[];e.block$data(u,l,ie._`${i} === false`),e.ok(u);function l(){let h=t.let("i",ie._`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(u,!0),t.if(ie._`${h} > 1`,()=>(d()?p:f)(h,g))}function d(){return c.length>0&&!c.some((h)=>h==="object"||h==="array")}function p(h,g){let v=t.name("item"),y=Pi.checkDataTypes(c,v,a.opts.strictNumbers,Pi.DataType.Wrong),R=t.const("indices",ie._`{}`);t.for(ie._`;${h}--;`,()=>{if(t.let(v,ie._`${r}[${h}]`),t.if(y,ie._`continue`),c.length>1)t.if(ie._`typeof ${v} == "string"`,ie._`${v} += "_"`);t.if(ie._`typeof ${R}[${v}] == "number"`,()=>{t.assign(g,ie._`${R}[${v}]`),e.error(),t.assign(u,!1).break()}).code(ie._`${R}[${v}] = ${h}`)})}function f(h,g){let v=_z.useFunc(t,yz.default),y=t.name("outer");t.label(y).for(ie._`;${h}--;`,()=>t.for(ie._`${g} = ${h}; ${g}--;`,()=>t.if(ie._`${v}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(u,!1).break(y)})))}}};_m.default=bz});var bm=b(function(vm){Object.defineProperty(vm,"__esModule",{value:!0});var Ei=C(),wz=Z(),xz=on(),zz={message:"must be equal to constant",params:({schemaCode:e})=>Ei._`{allowedValue: ${e}}`},Sz={keyword:"const",$data:!0,error:zz,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;if(o||s&&typeof s=="object")e.fail$data(Ei._`!${wz.useFunc(t,xz.default)}(${r}, ${n})`);else e.fail(Ei._`${s} !== ${r}`)}};vm.default=Sz});var wm=b(function($m){Object.defineProperty($m,"__esModule",{value:!0});var Lr=C(),Pz=Z(),Ez=on(),Tz={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>Lr._`{allowedValues: ${e}}`},Rz={keyword:"enum",schemaType:"array",$data:!0,error:Tz,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,u,c=()=>u!==null&&u!==void 0?u:u=Pz.useFunc(t,Ez.default),l;if(a||o)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(n))throw Error("ajv implementation error");let f=t.const("vSchema",s);l=Lr.or(...n.map((h,g)=>p(f,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",s,(f)=>t.if(Lr._`${c()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,h){let g=n[h];return typeof g==="object"&&g!==null?Lr._`${c()}(${r}, ${f}[${h}])`:Lr._`${r} === ${g}`}}};$m.default=Rz});var zm=b(function(xm){Object.defineProperty(xm,"__esModule",{value:!0});var Iz=Qf(),Nz=tm(),Cz=im(),jz=cm(),Az=lm(),Zz=pm(),qz=mm(),Mz=ym(),Dz=bm(),Lz=wm(),Uz=[Iz.default,Nz.default,Cz.default,jz.default,Az.default,Zz.default,qz.default,Mz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Dz.default,Lz.default];xm.default=Uz});var Ri=b(function(km){Object.defineProperty(km,"__esModule",{value:!0});km.validateAdditionalItems=void 0;var xt=C(),Ti=Z(),Vz={message:({params:{len:e}})=>xt.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>xt._`{limit: ${e}}`},Hz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Vz,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){Ti.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Sm(e,o)}};function Sm(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",xt._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass(xt._`${a} <= ${t.length}`);else if(typeof o=="object"&&!Ti.alwaysValidSchema(i,o)){let c=r.var("valid",xt._`${a} <= ${t.length}`);r.if(xt.not(c),()=>u(c)),e.ok(c)}function u(c){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:Ti.Type.Num},c),!i.allErrors)r.if(xt.not(c),()=>r.break())})}}km.validateAdditionalItems=Sm;km.default=Hz});var Oi=b(function(Rm){Object.defineProperty(Rm,"__esModule",{value:!0});Rm.validateTuple=void 0;var Em=C(),nn=Z(),Kz=xe(),Bz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return Tm(e,"additionalItems",t);if(r.items=!0,nn.alwaysValidSchema(r,t))return;e.ok(Kz.validateArray(e))}};function Tm(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;if(l(n),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=nn.mergeEvaluated.items(o,r.length,a.items);let u=o.name("valid"),c=o.const("len",Em._`${s}.length`);r.forEach((d,p)=>{if(nn.alwaysValidSchema(a,d))return;o.if(Em._`${c} > ${p}`,()=>e.subschema({keyword:i,schemaProp:p,dataProp:p},u)),e.ok(u)});function l(d){let{opts:p,errSchemaPath:f}=a,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(p.strictTuples&&!g){let v=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;nn.checkStrictMode(a,v,p.strictTuples)}}}Rm.validateTuple=Tm;Rm.default=Bz});var Nm=b(function(Im){Object.defineProperty(Im,"__esModule",{value:!0});var Wz=Oi(),Xz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>Wz.validateTuple(e,"items")};Im.default=Xz});var Am=b(function(jm){Object.defineProperty(jm,"__esModule",{value:!0});var Cm=C(),Qz=Z(),eS=xe(),tS=Ri(),rS={message:({params:{len:e}})=>Cm.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Cm._`{limit: ${e}}`},oS={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:rS,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,Qz.alwaysValidSchema(o,t))return;if(n)tS.validateAdditionalItems(e,n);else e.ok(eS.validateArray(e))}};jm.default=oS});var qm=b(function(Zm){Object.defineProperty(Zm,"__esModule",{value:!0});var ze=C(),sn=Z(),sS={message:({params:{min:e,max:t}})=>t===void 0?ze.str`must contain at least ${e} valid item(s)`:ze.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?ze._`{minContains: ${e}}`:ze._`{minContains: ${e}, maxContains: ${t}}`},iS={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:sS,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:u,maxContains:c}=o;if(s.opts.next)i=u===void 0?1:u,a=c;else i=1;let l=t.const("len",ze._`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){sn.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){sn.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(sn.alwaysValidSchema(s,r)){let g=ze._`${l} >= ${i}`;if(a!==void 0)g=ze._`${g} && ${l} <= ${a}`;e.pass(g);return}s.items=!0;let d=t.name("valid");if(a===void 0&&i===1)f(d,()=>t.if(d,()=>t.break()));else if(i===0){if(t.let(d,!0),a!==void 0)t.if(ze._`${n}.length > 0`,p)}else t.let(d,!1),p();e.result(d,()=>e.reset());function p(){let g=t.name("_valid"),v=t.let("count",0);f(g,()=>t.if(g,()=>h(v)))}function f(g,v){t.forRange("i",0,l,(y)=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:sn.Type.Num,compositeRule:!0},g),v()})}function h(g){if(t.code(ze._`${g}++`),a===void 0)t.if(ze._`${g} >= ${i}`,()=>t.assign(d,!0).break());else if(t.if(ze._`${g} > ${a}`,()=>t.assign(d,!1).break()),i===1)t.assign(d,!0);else t.if(ze._`${g} >= ${i}`,()=>t.assign(d,!0))}}};Zm.default=iS});var Vm=b(function(Lm){Object.defineProperty(Lm,"__esModule",{value:!0});Lm.validateSchemaDeps=Lm.validatePropertyDeps=Lm.error=void 0;var Ii=C(),cS=Z(),Ur=xe();Lm.error={message:({params:{property:e,depsCount:t,deps:r}})=>Ii.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>Ii._`{property: ${e},
|
|
1
|
+
import{createRequire as V_}from"node:module";var q_=Object.create;var{getPrototypeOf:M_,defineProperty:ja,getOwnPropertyNames:D_}=Object;var Aa=Object.prototype.hasOwnProperty;function L_(e){return this[e]}var U_,F_,as=(e,t,r)=>{var o=e!=null&&typeof e==="object";if(o){var n=t?U_??=new WeakMap:F_??=new WeakMap,s=n.get(e);if(s)return s}r=e!=null?q_(M_(e)):{};let i=t||!e||!e.__esModule||!Aa.call(e,"default")?ja(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of D_(e))if(!Aa.call(i,a))ja(i,a,{get:L_.bind(e,a),enumerable:!0})}if(o)n.set(e,i);return i};var w=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var dt=V_(import.meta.url);var so=w(function(Bp){Object.defineProperty(Bp,"__esModule",{value:!0});Bp.regexpCode=Bp.getEsmExportName=Bp.getProperty=Bp.safeStringify=Bp.stringify=Bp.strConcat=Bp.addCodeArg=Bp.str=Bp._=Bp.nil=Bp._Code=Bp.Name=Bp.IDENTIFIER=Bp._CodeOrName=void 0;class rn{}Bp._CodeOrName=rn;Bp.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class rr extends rn{constructor(e){super();if(!Bp.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Bp.Name=rr;class De extends rn{constructor(e){super();this._items=typeof e==="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((t,r)=>`${t}${r}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((t,r)=>{if(r instanceof rr)t[r.str]=(t[r.str]||0)+1;return t},{})}}Bp._Code=De;Bp.nil=new De("");function Jp(e,...t){let r=[e[0]],o=0;while(o<t.length)ki(r,t[o]),r.push(e[++o]);return new De(r)}Bp._=Jp;var Si=new De("+");function Kp(e,...t){let r=[no(e[0])],o=0;while(o<t.length)r.push(Si),ki(r,t[o]),r.push(Si,no(e[++o]));return Cb(r),new De(r)}Bp.str=Kp;function ki(e,t){if(t instanceof De)e.push(...t._items);else if(t instanceof rr)e.push(t);else e.push(Zb(t))}Bp.addCodeArg=ki;function Cb(e){let t=1;while(t<e.length-1){if(e[t]===Si){let r=jb(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function jb(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof rr||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof rr))return`"${e}${t.slice(1)}`;return}function Ab(e,t){return t.emptyStr()?e:e.emptyStr()?t:Kp`${e}${t}`}Bp.strConcat=Ab;function Zb(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:no(Array.isArray(e)?e.join(","):e)}function qb(e){return new De(no(e))}Bp.stringify=qb;function no(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Bp.safeStringify=no;function Mb(e){return typeof e=="string"&&Bp.IDENTIFIER.test(e)?new De(`.${e}`):Jp`[${e}]`}Bp.getProperty=Mb;function Db(e){if(typeof e=="string"&&Bp.IDENTIFIER.test(e))return new De(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}Bp.getEsmExportName=Db;function Lb(e){return new De(e.toString())}Bp.regexpCode=Lb});var Ri=w(function(Yp){Object.defineProperty(Yp,"__esModule",{value:!0});Yp.ValueScope=Yp.ValueScopeName=Yp.Scope=Yp.varKinds=Yp.UsedValueState=void 0;var K=so();class Wp extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`);this.value=e.value}}var nn;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(nn||(Yp.UsedValueState=nn={}));Yp.varKinds={const:new K.Name("const"),let:new K.Name("let"),var:new K.Name("var")};class Ei{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof K.Name?e:this.name(e)}name(e){return new K.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if(((r=(t=this._parent)===null||t===void 0?void 0:t._prefixes)===null||r===void 0?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}Yp.Scope=Ei;class Ti extends K.Name{constructor(e,t){super(t);this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=K._`.${new K.Name(t)}[${r}]`}}Yp.ValueScopeName=Ti;var e$=K._`\n`;class Xp extends Ei{constructor(e){super(e);this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?e$:K.nil}}get(){return this._scope}name(e){return new Ti(e,this._newName(e))}value(e,t){var r;if(t.ref===void 0)throw Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:n}=o,s=(r=t.key)!==null&&r!==void 0?r:t.ref,i=this._values[n];if(i){let c=i.get(s);if(c)return c}else i=this._values[n]=new Map;i.set(s,o);let a=this._scope[n]||(this._scope[n]=[]),u=a.length;return a[u]=t.ref,o.setValue(t,{property:n,itemIndex:u}),o}getValue(e,t){let r=this._values[e];if(!r)return;return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,(r)=>{if(r.scopePath===void 0)throw Error(`CodeGen: name "${r}" has no value`);return K._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,(o)=>{if(o.value===void 0)throw Error(`CodeGen: name "${o}" has no value`);return o.value.code},t,r)}_reduceValues(e,t,r={},o){let n=K.nil;for(let s in e){let i=e[s];if(!i)continue;let a=r[s]=r[s]||new Map;i.forEach((u)=>{if(a.has(u))return;a.set(u,nn.Started);let c=t(u);if(c){let l=this.opts.es5?Yp.varKinds.var:Yp.varKinds.const;n=K._`${n}${l} ${u} = ${c};${this.opts._n}`}else if(c=o===null||o===void 0?void 0:o(u))n=K._`${n}${c}${this.opts._n}`;else throw new Wp(u);a.set(u,nn.Completed)})}return n}}Yp.ValueScope=Xp});var M=w(function(ze){Object.defineProperty(ze,"__esModule",{value:!0});ze.or=ze.and=ze.not=ze.CodeGen=ze.operators=ze.varKinds=ze.ValueScopeName=ze.ValueScope=ze.Scope=ze.Name=ze.regexpCode=ze.stringify=ze.getProperty=ze.nil=ze.strConcat=ze.str=ze._=void 0;var z=so(),ne=Ri(),$t=so();Object.defineProperty(ze,"_",{enumerable:!0,get:function(){return $t._}});Object.defineProperty(ze,"str",{enumerable:!0,get:function(){return $t.str}});Object.defineProperty(ze,"strConcat",{enumerable:!0,get:function(){return $t.strConcat}});Object.defineProperty(ze,"nil",{enumerable:!0,get:function(){return $t.nil}});Object.defineProperty(ze,"getProperty",{enumerable:!0,get:function(){return $t.getProperty}});Object.defineProperty(ze,"stringify",{enumerable:!0,get:function(){return $t.stringify}});Object.defineProperty(ze,"regexpCode",{enumerable:!0,get:function(){return $t.regexpCode}});Object.defineProperty(ze,"Name",{enumerable:!0,get:function(){return $t.Name}});var pn=Ri();Object.defineProperty(ze,"Scope",{enumerable:!0,get:function(){return pn.Scope}});Object.defineProperty(ze,"ValueScope",{enumerable:!0,get:function(){return pn.ValueScope}});Object.defineProperty(ze,"ValueScopeName",{enumerable:!0,get:function(){return pn.ValueScopeName}});Object.defineProperty(ze,"varKinds",{enumerable:!0,get:function(){return pn.varKinds}});ze.operators={GT:new z._Code(">"),GTE:new z._Code(">="),LT:new z._Code("<"),LTE:new z._Code("<="),EQ:new z._Code("==="),NEQ:new z._Code("!=="),NOT:new z._Code("!"),OR:new z._Code("||"),AND:new z._Code("&&"),ADD:new z._Code("+")};class wt{optimizeNodes(){return this}optimizeNames(e,t){return this}}class ed extends wt{constructor(e,t,r){super();this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?ne.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${r} ${this.name}${o};`+t}optimizeNames(e,t){if(!e[this.name.str])return;if(this.rhs)this.rhs=nr(this.rhs,e,t);return this}get names(){return this.rhs instanceof z._CodeOrName?this.rhs.names:{}}}class Ni extends wt{constructor(e,t,r){super();this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(this.lhs instanceof z.Name&&!e[this.lhs.str]&&!this.sideEffects)return;return this.rhs=nr(this.rhs,e,t),this}get names(){let e=this.lhs instanceof z.Name?{}:{...this.lhs.names};return ln(e,this.rhs)}}class td extends Ni{constructor(e,t,r,o){super(e,r,o);this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class rd extends wt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class od extends wt{constructor(e){super();this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class nd extends wt{constructor(e){super();this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class sd extends wt{constructor(e){super();this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=nr(this.code,e,t),this}get names(){return this.code instanceof z._CodeOrName?this.code.names:{}}}class dn extends wt{constructor(e=[]){super();this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;while(t--){let r=e[t].optimizeNodes();if(Array.isArray(r))e.splice(t,1,...r);else if(r)e[t]=r;else e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,o=r.length;while(o--){let n=r[o];if(n.optimizeNames(e,t))continue;n$(e,n.names),r.splice(o,1)}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>Kt(e,t.names),{})}}class xt extends dn{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class id extends dn{}class io extends xt{}io.kind="else";class ct extends xt{constructor(e,t){super(t);this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);if(this.else)t+="else "+this.else.render(e);return t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let t=this.else;if(t){let r=t.optimizeNodes();t=this.else=Array.isArray(r)?new io(r):r}if(t){if(e===!1)return t instanceof ct?t:t.nodes;if(this.nodes.length)return this;return new ct(pd(e),t instanceof ct?[t]:t.nodes)}if(e===!1||!this.nodes.length)return;return this}optimizeNames(e,t){var r;if(this.else=(r=this.else)===null||r===void 0?void 0:r.optimizeNames(e,t),!(super.optimizeNames(e,t)||this.else))return;return this.condition=nr(this.condition,e,t),this}get names(){let e=super.names;if(ln(e,this.condition),this.else)Kt(e,this.else.names);return e}}ct.kind="if";class or extends xt{}or.kind="for";class ad extends or{constructor(e){super();this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iteration=nr(this.iteration,e,t),this}get names(){return Kt(super.names,this.iteration.names)}}class cd extends or{constructor(e,t,r,o){super();this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){let t=e.es5?ne.varKinds.var:this.varKind,{name:r,from:o,to:n}=this;return`for(${t} ${r}=${o}; ${r}<${n}; ${r}++)`+super.render(e)}get names(){let e=ln(super.names,this.from);return ln(e,this.to)}}class Oi extends or{constructor(e,t,r,o){super();this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(!super.optimizeNames(e,t))return;return this.iterable=nr(this.iterable,e,t),this}get names(){return Kt(super.names,this.iterable.names)}}class sn extends xt{constructor(e,t,r){super();this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}sn.kind="func";class an extends dn{render(e){return"return "+super.render(e)}}an.kind="return";class ud extends xt{render(e){let t="try"+super.render(e);if(this.catch)t+=this.catch.render(e);if(this.finally)t+=this.finally.render(e);return t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(t=this.finally)===null||t===void 0||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),(r=this.catch)===null||r===void 0||r.optimizeNames(e,t),(o=this.finally)===null||o===void 0||o.optimizeNames(e,t),this}get names(){let e=super.names;if(this.catch)Kt(e,this.catch.names);if(this.finally)Kt(e,this.finally.names);return e}}class cn extends xt{constructor(e){super();this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}cn.kind="catch";class un extends xt{render(e){return"finally"+super.render(e)}}un.kind="finally";class ld{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
2
|
+
`:""},this._extScope=e,this._scope=new ne.Scope({parent:e}),this._nodes=[new id]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){let n=this._scope.toName(t);if(r!==void 0&&o)this._constants[n.str]=r;return this._leafNode(new ed(e,n,r)),n}const(e,t,r){return this._def(ne.varKinds.const,e,t,r)}let(e,t,r){return this._def(ne.varKinds.let,e,t,r)}var(e,t,r){return this._def(ne.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new Ni(e,t,r))}add(e,t){return this._leafNode(new td(e,ze.operators.ADD,t))}code(e){if(typeof e=="function")e();else if(e!==z.nil)this._leafNode(new sd(e));return this}object(...e){let t=["{"];for(let[r,o]of e){if(t.length>1)t.push(",");if(t.push(r),r!==o||this.opts.es5)t.push(":"),z.addCodeArg(t,o)}return t.push("}"),new z._Code(t)}if(e,t,r){if(this._blockNode(new ct(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ct(e))}else(){return this._elseNode(new io)}endIf(){return this._endBlockNode(ct,io)}_for(e,t){if(this._blockNode(e),t)this.code(t).endFor();return this}for(e,t){return this._for(new ad(e),t)}forRange(e,t,r,o,n=this.opts.es5?ne.varKinds.var:ne.varKinds.let){let s=this._scope.toName(e);return this._for(new cd(n,s,t,r),()=>o(s))}forOf(e,t,r,o=ne.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let s=t instanceof z.Name?t:this.var("_arr",t);return this.forRange("_i",0,z._`${s}.length`,(i)=>{this.var(n,z._`${s}[${i}]`),r(n)})}return this._for(new Oi("of",o,n,t),()=>r(n))}forIn(e,t,r,o=this.opts.es5?ne.varKinds.var:ne.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,z._`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new Oi("in",o,n,t),()=>r(n))}endFor(){return this._endBlockNode(or)}label(e){return this._leafNode(new rd(e))}break(e){return this._leafNode(new od(e))}return(e){let t=new an;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(an)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let o=new ud;if(this._blockNode(o),this.code(e),t){let n=this.name("e");this._currNode=o.catch=new cn(n),t(n)}if(r)this._currNode=o.finally=new un,this.code(r);return this._endBlockNode(cn,un)}throw(e){return this._leafNode(new nd(e))}block(e,t){if(this._blockStarts.push(this._nodes.length),e)this.code(e).endBlock(t);return this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||e!==void 0&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=z.nil,r,o){if(this._blockNode(new sn(e,t,r)),o)this.code(o).endFunc();return this}endFunc(){return this._endBlockNode(sn)}optimize(e=1){while(e-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof ct))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}}ze.CodeGen=ld;function Kt(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function ln(e,t){return t instanceof z._CodeOrName?Kt(e,t.names):e}function nr(e,t,r){if(e instanceof z.Name)return o(e);if(!n(e))return e;return new z._Code(e._items.reduce((s,i)=>{if(i instanceof z.Name)i=o(i);if(i instanceof z._Code)s.push(...i._items);else s.push(i);return s},[]));function o(s){let i=r[s.str];if(i===void 0||t[s.str]!==1)return s;return delete t[s.str],i}function n(s){return s instanceof z._Code&&s._items.some((i)=>i instanceof z.Name&&t[i.str]===1&&r[i.str]!==void 0)}}function n$(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function pd(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:z._`!${Ii(e)}`}ze.not=pd;var s$=dd(ze.operators.AND);function i$(...e){return e.reduce(s$)}ze.and=i$;var a$=dd(ze.operators.OR);function c$(...e){return e.reduce(a$)}ze.or=c$;function dd(e){return(t,r)=>t===z.nil?r:r===z.nil?t:z._`${Ii(t)} ${e} ${Ii(r)}`}function Ii(e){return e instanceof z.Name?e:z._`(${e})`}});var L=w(function(wd){Object.defineProperty(wd,"__esModule",{value:!0});wd.checkStrictMode=wd.getErrorPath=wd.Type=wd.useFunc=wd.setEvaluated=wd.evaluatedPropsToName=wd.mergeEvaluated=wd.eachItem=wd.unescapeJsonPointer=wd.escapeJsonPointer=wd.escapeFragment=wd.unescapeFragment=wd.schemaRefOrVal=wd.schemaHasRulesButRef=wd.schemaHasRules=wd.checkUnknownRules=wd.alwaysValidSchema=wd.toHash=void 0;var I=M(),gd=so();function d$(e){let t={};for(let r of e)t[r]=!0;return t}wd.toHash=d$;function f$(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return!0;return _d(e,t),!yd(t,e.self.RULES.all)}wd.alwaysValidSchema=f$;function _d(e,t=e.schema){let{opts:r,self:o}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;let n=o.RULES.keywords;for(let s in t)if(!n[s])$d(e,`unknown keyword: "${s}"`)}wd.checkUnknownRules=_d;function yd(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}wd.schemaHasRules=yd;function m$(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}wd.schemaHasRulesButRef=m$;function h$({topSchemaRef:e,schemaPath:t},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return I._`${r}`}return I._`${e}${t}${I.getProperty(o)}`}wd.schemaRefOrVal=h$;function g$(e){return vd(decodeURIComponent(e))}wd.unescapeFragment=g$;function _$(e){return encodeURIComponent(ji(e))}wd.escapeFragment=_$;function ji(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}wd.escapeJsonPointer=ji;function vd(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}wd.unescapeJsonPointer=vd;function y$(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}wd.eachItem=y$;function md({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let u=i===void 0?s:i instanceof I.Name?(s instanceof I.Name?e(n,s,i):t(n,s,i),i):s instanceof I.Name?(t(n,i,s),s):r(s,i);return a===I.Name&&!(u instanceof I.Name)?o(n,u):u}}wd.mergeEvaluated={props:md({mergeNames:(e,t,r)=>e.if(I._`${r} !== true && ${t} !== undefined`,()=>{e.if(I._`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,I._`${r} || {}`).code(I._`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if(I._`${r} !== true`,()=>{if(t===!0)e.assign(r,!0);else e.assign(r,I._`${r} || {}`),Ai(e,r,t)}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:bd}),items:md({mergeNames:(e,t,r)=>e.if(I._`${r} !== true && ${t} !== undefined`,()=>e.assign(r,I._`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if(I._`${r} !== true`,()=>e.assign(r,t===!0?!0:I._`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function bd(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",I._`{}`);if(t!==void 0)Ai(e,r,t);return r}wd.evaluatedPropsToName=bd;function Ai(e,t,r){Object.keys(r).forEach((o)=>e.assign(I._`${t}${I.getProperty(o)}`,!0))}wd.setEvaluated=Ai;var hd={};function v$(e,t){return e.scopeValue("func",{ref:t,code:hd[t.code]||(hd[t.code]=new gd._Code(t.code))})}wd.useFunc=v$;var Ci;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Ci||(wd.Type=Ci={}));function b$(e,t,r){if(e instanceof I.Name){let o=t===Ci.Num;return r?o?I._`"[" + ${e} + "]"`:I._`"['" + ${e} + "']"`:o?I._`"/" + ${e}`:I._`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?I.getProperty(e).toString():"/"+ji(e)}wd.getErrorPath=b$;function $d(e,t,r=e.opts.strictSchema){if(!r)return;if(t=`strict mode: ${t}`,r===!0)throw Error(t);e.self.logger.warn(t)}wd.checkStrictMode=$d});var ut=w(function(zd){Object.defineProperty(zd,"__esModule",{value:!0});var F=M(),q$={data:new F.Name("data"),valCxt:new F.Name("valCxt"),instancePath:new F.Name("instancePath"),parentData:new F.Name("parentData"),parentDataProperty:new F.Name("parentDataProperty"),rootData:new F.Name("rootData"),dynamicAnchors:new F.Name("dynamicAnchors"),vErrors:new F.Name("vErrors"),errors:new F.Name("errors"),this:new F.Name("this"),self:new F.Name("self"),scope:new F.Name("scope"),json:new F.Name("json"),jsonPos:new F.Name("jsonPos"),jsonLen:new F.Name("jsonLen"),jsonPart:new F.Name("jsonPart")};zd.default=q$});var ao=w(function(Ed){Object.defineProperty(Ed,"__esModule",{value:!0});Ed.extendErrors=Ed.resetErrorsCount=Ed.reportExtraError=Ed.reportError=Ed.keyword$DataError=Ed.keywordError=void 0;var k=M(),zt=L(),we=ut();Ed.keywordError={message:({keyword:e})=>k.str`must pass "${e}" keyword validation`};Ed.keyword$DataError={message:({keyword:e,schemaType:t})=>t?k.str`"${e}" keyword must be ${t} ($data)`:k.str`"${e}" keyword is invalid ($data)`};function D$(e,t=Ed.keywordError,r,o){let{it:n}=e,{gen:s,compositeRule:i,allErrors:a}=n,u=Pd(e,t,r);if(o!==null&&o!==void 0?o:i||a)Sd(s,u);else kd(n,k._`[${u}]`)}Ed.reportError=D$;function L$(e,t=Ed.keywordError,r){let{it:o}=e,{gen:n,compositeRule:s,allErrors:i}=o,a=Pd(e,t,r);if(Sd(n,a),!(s||i))kd(o,we.default.vErrors)}Ed.reportExtraError=L$;function U$(e,t){e.assign(we.default.errors,t),e.if(k._`${we.default.vErrors} !== null`,()=>e.if(t,()=>e.assign(k._`${we.default.vErrors}.length`,t),()=>e.assign(we.default.vErrors,null)))}Ed.resetErrorsCount=U$;function F$({gen:e,keyword:t,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw Error("ajv implementation error");let i=e.name("err");e.forRange("i",n,we.default.errors,(a)=>{if(e.const(i,k._`${we.default.vErrors}[${a}]`),e.if(k._`${i}.instancePath === undefined`,()=>e.assign(k._`${i}.instancePath`,k.strConcat(we.default.instancePath,s.errorPath))),e.assign(k._`${i}.schemaPath`,k.str`${s.errSchemaPath}/${t}`),s.opts.verbose)e.assign(k._`${i}.schema`,r),e.assign(k._`${i}.data`,o)})}Ed.extendErrors=F$;function Sd(e,t){let r=e.const("err",t);e.if(k._`${we.default.vErrors} === null`,()=>e.assign(we.default.vErrors,k._`[${r}]`),k._`${we.default.vErrors}.push(${r})`),e.code(k._`${we.default.errors}++`)}function kd(e,t){let{gen:r,validateName:o,schemaEnv:n}=e;if(n.$async)r.throw(k._`new ${e.ValidationError}(${t})`);else r.assign(k._`${o}.errors`,t),r.return(!1)}var Bt={keyword:new k.Name("keyword"),schemaPath:new k.Name("schemaPath"),params:new k.Name("params"),propertyName:new k.Name("propertyName"),message:new k.Name("message"),schema:new k.Name("schema"),parentSchema:new k.Name("parentSchema")};function Pd(e,t,r){let{createErrors:o}=e.it;if(o===!1)return k._`{}`;return V$(e,t,r)}function V$(e,t,r={}){let{gen:o,it:n}=e,s=[H$(n,r),J$(e,r)];return K$(e,t,s),o.object(...s)}function H$({errorPath:e},{instancePath:t}){let r=t?k.str`${e}${zt.getErrorPath(t,zt.Type.Str)}`:e;return[we.default.instancePath,k.strConcat(we.default.instancePath,r)]}function J$({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:o}){let n=o?t:k.str`${t}/${e}`;if(r)n=k.str`${n}${zt.getErrorPath(r,zt.Type.Str)}`;return[Bt.schemaPath,n]}function K$(e,{params:t,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=e,{opts:u,propertyName:c,topSchemaRef:l,schemaPath:p}=a;if(o.push([Bt.keyword,n],[Bt.params,typeof t=="function"?t(e):t||k._`{}`]),u.messages)o.push([Bt.message,typeof r=="function"?r(e):r]);if(u.verbose)o.push([Bt.schema,i],[Bt.parentSchema,k._`${l}${p}`],[we.default.data,s]);if(c)o.push([Bt.propertyName,c])}});var jd=w(function(Nd){Object.defineProperty(Nd,"__esModule",{value:!0});Nd.boolOrEmptySchema=Nd.topBoolOrEmptySchema=void 0;var Rd=ao(),Od=M(),Y$=ut(),Q$={message:"boolean schema is false"};function ew(e){let{gen:t,schema:r,validateName:o}=e;if(r===!1)Id(e,!1);else if(typeof r=="object"&&r.$async===!0)t.return(Y$.default.data);else t.assign(Od._`${o}.errors`,null),t.return(!0)}Nd.topBoolOrEmptySchema=ew;function tw(e,t){let{gen:r,schema:o}=e;if(o===!1)r.var(t,!1),Id(e);else r.var(t,!0)}Nd.boolOrEmptySchema=tw;function Id(e,t){let{gen:r,data:o}=e;Rd.reportError({gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},Q$,void 0,t)}});var qi=w(function(Ad){Object.defineProperty(Ad,"__esModule",{value:!0});Ad.getRules=Ad.isJSONType=void 0;var ow=["string","number","integer","boolean","null","object","array"],nw=new Set(ow);function sw(e){return typeof e=="string"&&nw.has(e)}Ad.isJSONType=sw;function iw(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}Ad.getRules=iw});var Mi=w(function(Dd){Object.defineProperty(Dd,"__esModule",{value:!0});Dd.shouldUseRule=Dd.shouldUseGroup=Dd.schemaHasRulesForType=void 0;function cw({schema:e,self:t},r){let o=t.RULES.types[r];return o&&o!==!0&&qd(e,o)}Dd.schemaHasRulesForType=cw;function qd(e,t){return t.rules.some((r)=>Md(e,r))}Dd.shouldUseGroup=qd;function Md(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some((o)=>e[o]!==void 0))}Dd.shouldUseRule=Md});var co=w(function(Kd){Object.defineProperty(Kd,"__esModule",{value:!0});Kd.reportTypeError=Kd.checkDataTypes=Kd.checkDataType=Kd.coerceAndCheckDataType=Kd.getJSONTypes=Kd.getSchemaTypes=Kd.DataType=void 0;var Ud=qi(),Fd=Mi(),Vd=ao(),x=M(),mn=L(),sr;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(sr||(Kd.DataType=sr={}));function pw(e){let t=Hd(e.type);if(t.includes("null")){if(e.nullable===!1)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw Error('"nullable" cannot be used without "type"');if(e.nullable===!0)t.push("null")}return t}Kd.getSchemaTypes=pw;function Hd(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(Ud.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}Kd.getJSONTypes=Hd;function dw(e,t){let{gen:r,data:o,opts:n}=e,s=fw(t,n.coerceTypes),i=t.length>0&&!(s.length===0&&t.length===1&&Fd.schemaHasRulesForType(e,t[0]));if(i){let a=Li(t,o,n.strictNumbers,sr.Wrong);r.if(a,()=>{if(s.length)mw(e,t,s);else Ui(e)})}return i}Kd.coerceAndCheckDataType=dw;var Jd=new Set(["string","number","integer","boolean","null"]);function fw(e,t){return t?e.filter((r)=>Jd.has(r)||t==="array"&&r==="array"):[]}function mw(e,t,r){let{gen:o,data:n,opts:s}=e,i=o.let("dataType",x._`typeof ${n}`),a=o.let("coerced",x._`undefined`);if(s.coerceTypes==="array")o.if(x._`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,x._`${n}[0]`).assign(i,x._`typeof ${n}`).if(Li(t,n,s.strictNumbers),()=>o.assign(a,n)));o.if(x._`${a} !== undefined`);for(let c of r)if(Jd.has(c)||c==="array"&&s.coerceTypes==="array")u(c);o.else(),Ui(e),o.endIf(),o.if(x._`${a} !== undefined`,()=>{o.assign(n,a),hw(e,a)});function u(c){switch(c){case"string":o.elseIf(x._`${i} == "number" || ${i} == "boolean"`).assign(a,x._`"" + ${n}`).elseIf(x._`${n} === null`).assign(a,x._`""`);return;case"number":o.elseIf(x._`${i} == "boolean" || ${n} === null
|
|
3
|
+
|| (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,x._`+${n}`);return;case"integer":o.elseIf(x._`${i} === "boolean" || ${n} === null
|
|
4
|
+
|| (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,x._`+${n}`);return;case"boolean":o.elseIf(x._`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf(x._`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf(x._`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf(x._`${i} === "string" || ${i} === "number"
|
|
5
|
+
|| ${i} === "boolean" || ${n} === null`).assign(a,x._`[${n}]`)}}}function hw({gen:e,parentData:t,parentDataProperty:r},o){e.if(x._`${t} !== undefined`,()=>e.assign(x._`${t}[${r}]`,o))}function Di(e,t,r,o=sr.Correct){let n=o===sr.Correct?x.operators.EQ:x.operators.NEQ,s;switch(e){case"null":return x._`${t} ${n} null`;case"array":s=x._`Array.isArray(${t})`;break;case"object":s=x._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":s=i(x._`!(${t} % 1) && !isNaN(${t})`);break;case"number":s=i();break;default:return x._`typeof ${t} ${n} ${e}`}return o===sr.Correct?s:x.not(s);function i(a=x.nil){return x.and(x._`typeof ${t} == "number"`,a,r?x._`isFinite(${t})`:x.nil)}}Kd.checkDataType=Di;function Li(e,t,r,o){if(e.length===1)return Di(e[0],t,r,o);let n,s=mn.toHash(e);if(s.array&&s.object){let i=x._`typeof ${t} != "object"`;n=s.null?i:x._`!${t} || ${i}`,delete s.null,delete s.array,delete s.object}else n=x.nil;if(s.number)delete s.integer;for(let i in s)n=x.and(n,Di(i,t,r,o));return n}Kd.checkDataTypes=Li;var gw={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?x._`{type: ${e}}`:x._`{type: ${t}}`};function Ui(e){let t=_w(e);Vd.reportError(t,gw)}Kd.reportTypeError=Ui;function _w(e){let{gen:t,data:r,schema:o}=e,n=mn.schemaRefOrVal(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var Qd=w(function(Xd){Object.defineProperty(Xd,"__esModule",{value:!0});Xd.assignDefaults=void 0;var Ne=M(),Wd=L();function zw(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)Gd(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,s)=>Gd(e,s,n.default))}Xd.assignDefaults=zw;function Gd(e,t,r){let{gen:o,compositeRule:n,data:s,opts:i}=e;if(r===void 0)return;let a=Ne._`${s}${Ne.getProperty(t)}`;if(n){Wd.checkStrictMode(e,`default is ignored for: ${a}`);return}let u=Ne._`${a} === undefined`;if(i.useDefaults==="empty")u=Ne._`${u} || ${a} === null || ${a} === ""`;o.if(u,Ne._`${a} = ${Ne.stringify(r)}`)}});var Ce=w(function(of){Object.defineProperty(of,"__esModule",{value:!0});of.validateUnion=of.validateArray=of.usePattern=of.callValidateCode=of.schemaProperties=of.allSchemaProperties=of.noPropertyInData=of.propertyInData=of.isOwnProperty=of.hasPropFunc=of.reportMissingProp=of.checkMissingProp=of.checkReportMissingProp=void 0;var j=M(),ir=L(),St=ut(),ef=L();function Sw(e,t){let{gen:r,data:o,it:n}=e;r.if(Vi(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:j._`${t}`},!0),e.error()})}of.checkReportMissingProp=Sw;function kw({gen:e,data:t,it:{opts:r}},o,n){return j.or(...o.map((s)=>j.and(Vi(e,t,s,r.ownProperties),j._`${n} = ${s}`)))}of.checkMissingProp=kw;function Pw(e,t){e.setParams({missingProperty:t},!0),e.error()}of.reportMissingProp=Pw;function tf(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:j._`Object.prototype.hasOwnProperty`})}of.hasPropFunc=tf;function Fi(e,t,r){return j._`${tf(e)}.call(${t}, ${r})`}of.isOwnProperty=Fi;function Ew(e,t,r,o){let n=j._`${t}${j.getProperty(r)} !== undefined`;return o?j._`${n} && ${Fi(e,t,r)}`:n}of.propertyInData=Ew;function Vi(e,t,r,o){let n=j._`${t}${j.getProperty(r)} === undefined`;return o?j.or(n,j.not(Fi(e,t,r))):n}of.noPropertyInData=Vi;function rf(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}of.allSchemaProperties=rf;function Tw(e,t){return rf(t).filter((r)=>!ir.alwaysValidSchema(e,t[r]))}of.schemaProperties=Tw;function Rw({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,u,c){let l=c?j._`${e}, ${t}, ${o}${n}`:t,p=[[St.default.instancePath,j.strConcat(St.default.instancePath,s)],[St.default.parentData,i.parentData],[St.default.parentDataProperty,i.parentDataProperty],[St.default.rootData,St.default.rootData]];if(i.opts.dynamicRef)p.push([St.default.dynamicAnchors,St.default.dynamicAnchors]);let d=j._`${l}, ${r.object(...p)}`;return u!==j.nil?j._`${a}.call(${u}, ${d})`:j._`${a}(${d})`}of.callValidateCode=Rw;var Ow=j._`new RegExp`;function Iw({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,s=n(r,o);return e.scopeValue("pattern",{key:s.toString(),ref:s,code:j._`${n.code==="new RegExp"?Ow:ef.useFunc(e,n)}(${r}, ${o})`})}of.usePattern=Iw;function Nw(e){let{gen:t,data:r,keyword:o,it:n}=e,s=t.name("valid");if(n.allErrors){let a=t.let("valid",!0);return i(()=>t.assign(a,!1)),a}return t.var(s,!0),i(()=>t.break()),s;function i(a){let u=t.const("len",j._`${r}.length`);t.forRange("i",0,u,(c)=>{e.subschema({keyword:o,dataProp:c,dataPropType:ir.Type.Num},s),t.if(j.not(s),a)})}}of.validateArray=Nw;function Cw(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((u)=>ir.alwaysValidSchema(n,u))&&!n.opts.unevaluated)return;let i=t.let("valid",!1),a=t.name("_valid");t.block(()=>r.forEach((u,c)=>{let l=e.subschema({keyword:o,schemaProp:c,compositeRule:!0},a);if(t.assign(i,j._`${i} || ${a}`),!e.mergeValidEvaluated(l,a))t.if(j.not(i))})),e.result(i,()=>e.reset(),()=>e.error(!0))}of.validateUnion=Cw});var df=w(function(lf){Object.defineProperty(lf,"__esModule",{value:!0});lf.validateKeywordUsage=lf.validSchemaType=lf.funcKeywordCode=lf.macroKeywordCode=void 0;var H=M(),Gt=ut(),af=Ce(),cf=ao();function Kw(e,t){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=e,a=t.macro.call(i.self,n,s,i),u=uf(r,o,a);if(i.opts.validateSchema!==!1)i.self.validateSchema(a,!0);let c=r.name("valid");e.subschema({schema:a,schemaPath:H.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))}lf.macroKeywordCode=Kw;function Bw(e,t){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:u}=e;Ww(u,t);let c=!a&&t.compile?t.compile.call(u.self,s,i,u):t.validate,l=uf(o,n,c),p=o.let("valid");e.block$data(p,d),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function d(){if(t.errors===!1){if(g(),t.modifying)sf(e);b(()=>e.error())}else{let v=t.async?f():h();if(t.modifying)sf(e);b(()=>Gw(e,v))}}function f(){let v=o.let("ruleErrs",null);return o.try(()=>g(H._`await `),(C)=>o.assign(p,!1).if(H._`${C} instanceof ${u.ValidationError}`,()=>o.assign(v,H._`${C}.errors`),()=>o.throw(C))),v}function h(){let v=H._`${l}.errors`;return o.assign(v,null),g(H.nil),v}function g(v=t.async?H._`await `:H.nil){let C=u.opts.passContext?Gt.default.this:Gt.default.self,N=!(("compile"in t)&&!a||t.schema===!1);o.assign(p,H._`${v}${af.callValidateCode(e,l,C,N)}`,t.modifying)}function b(v){var C;o.if(H.not((C=t.valid)!==null&&C!==void 0?C:p),v)}}lf.funcKeywordCode=Bw;function sf(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,H._`${o.parentData}[${o.parentDataProperty}]`))}function Gw(e,t){let{gen:r}=e;r.if(H._`Array.isArray(${t})`,()=>{r.assign(Gt.default.vErrors,H._`${Gt.default.vErrors} === null ? ${t} : ${Gt.default.vErrors}.concat(${t})`).assign(Gt.default.errors,H._`${Gt.default.vErrors}.length`),cf.extendErrors(e)},()=>e.error())}function Ww({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function uf(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:H.stringify(r)})}function Xw(e,t,r=!1){return!t.length||t.some((o)=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}lf.validSchemaType=Xw;function Yw({schema:e,opts:t,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw Error("ajv implementation error");let i=n.dependencies;if(i===null||i===void 0?void 0:i.some((a)=>!Object.prototype.hasOwnProperty.call(e,a)))throw Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[s])){let u=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(u);else throw Error(u)}}}lf.validateKeywordUsage=Yw});var hf=w(function(ff){Object.defineProperty(ff,"__esModule",{value:!0});ff.extendSubschemaMode=ff.extendSubschemaData=ff.getSubschema=void 0;var le=M(),hn=L();function rx(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(t!==void 0&&o!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let a=e.schema[t];return r===void 0?{schema:a,schemaPath:le._`${e.schemaPath}${le.getProperty(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:a[r],schemaPath:le._`${e.schemaPath}${le.getProperty(t)}${le.getProperty(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${hn.escapeFragment(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw Error('either "keyword" or "schema" must be passed')}ff.getSubschema=rx;function ox(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=t;if(r!==void 0){let{errorPath:c,dataPathArr:l,opts:p}=t,d=a.let("data",le._`${t.data}${le.getProperty(r)}`,!0);u(d),e.errorPath=le.str`${c}${hn.getErrorPath(r,o,p.jsPropertySyntax)}`,e.parentDataProperty=le._`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(n!==void 0){let c=n instanceof le.Name?n:a.let("data",n,!0);if(u(c),i!==void 0)e.propertyName=i}if(s)e.dataTypes=s;function u(c){e.data=c,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,c]}}ff.extendSubschemaData=ox;function nx(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){if(o!==void 0)e.compositeRule=o;if(n!==void 0)e.createErrors=n;if(s!==void 0)e.allErrors=s;e.jtdDiscriminator=t,e.jtdMetadata=r}ff.extendSubschemaMode=nx});var Hi=w(function(CN,gf){gf.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(s=Object.keys(t),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!e(t[i],r[i]))return!1}return!0}return t!==t&&r!==r}});var yf=w(function(jN,_f){var kt=_f.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};gn(t,o,n,e,"",e)};kt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};kt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};kt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};kt.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 gn(e,t,r,o,n,s,i,a,u,c){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,s,i,a,u,c);for(var l in o){var p=o[l];if(Array.isArray(p)){if(l in kt.arrayKeywords)for(var d=0;d<p.length;d++)gn(e,t,r,p[d],n+"/"+l+"/"+d,s,n,l,o,d)}else if(l in kt.propsKeywords){if(p&&typeof p=="object")for(var f in p)gn(e,t,r,p[f],n+"/"+l+"/"+ax(f),s,n,l,o,f)}else if(l in kt.keywords||e.allKeys&&!(l in kt.skipKeywords))gn(e,t,r,p,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,u,c)}}function ax(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var uo=w(function(xf){Object.defineProperty(xf,"__esModule",{value:!0});xf.getSchemaRefs=xf.resolveUrl=xf.normalizeId=xf._getFullPath=xf.getFullPath=xf.inlineRef=void 0;var vf=L(),cx=Hi(),ux=yf(),lx=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function px(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!Ji(e);if(!t)return!1;return bf(e)<=t}xf.inlineRef=px;var dx=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ji(e){for(let t in e){if(dx.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(Ji))return!0;if(typeof r=="object"&&Ji(r))return!0}return!1}function bf(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,lx.has(r))continue;if(typeof e[r]=="object")vf.eachItem(e[r],(o)=>t+=bf(o));if(t===1/0)return 1/0}return t}function $f(e,t="",r){if(r!==!1)t=ar(t);let o=e.parse(t);return wf(e,o)}xf.getFullPath=$f;function wf(e,t){return e.serialize(t).split("#")[0]+"#"}xf._getFullPath=wf;var fx=/#\/?$/;function ar(e){return e?e.replace(fx,""):""}xf.normalizeId=ar;function mx(e,t,r){return r=ar(r),e.resolve(t,r)}xf.resolveUrl=mx;var hx=/^[a-z_][-a-z0-9._]*$/i;function gx(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=ar(e[r]||t),s={"":n},i=$f(o,n,!1),a={},u=new Set;return ux(e,{allKeys:!0},(p,d,f,h)=>{if(h===void 0)return;let g=i+d,b=s[h];if(typeof p[r]=="string")b=v.call(this,p[r]);C.call(this,p.$anchor),C.call(this,p.$dynamicAnchor),s[d]=b;function v(N){let q=this.opts.uriResolver.resolve;if(N=ar(b?q(b,N):N),u.has(N))throw l(N);u.add(N);let O=this.refs[N];if(typeof O=="string")O=this.refs[O];if(typeof O=="object")c(p,O.schema,N);else if(N!==ar(g))if(N[0]==="#")c(p,a[N],N),a[N]=p;else this.refs[N]=g;return N}function C(N){if(typeof N=="string"){if(!hx.test(N))throw Error(`invalid anchor "${N}"`);v.call(this,`#${N}`)}}}),a;function c(p,d,f){if(d!==void 0&&!cx(p,d))throw l(f)}function l(p){return Error(`reference "${p}" resolves to more than one schema`)}}xf.getSchemaRefs=gx});var lo=w(function(Mf){Object.defineProperty(Mf,"__esModule",{value:!0});Mf.getData=Mf.KeywordCxt=Mf.validateFunctionCode=void 0;var yn=jd(),_n=co(),ur=Mi(),Pt=co(),Ef=Qd(),He=df(),cr=hf(),y=M(),A=ut(),Tf=uo(),fe=L(),Ve=ao();function wx(e){if(If(e)){if(Nf(e),Of(e)){Sx(e);return}}Rf(e,()=>yn.topBoolOrEmptySchema(e))}Mf.validateFunctionCode=wx;function Rf({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},s){if(n.code.es5)e.func(t,y._`${A.default.data}, ${A.default.valCxt}`,o.$async,()=>{e.code(y._`"use strict"; ${Sf(r,n)}`),zx(e,n),e.code(s)});else e.func(t,y._`${A.default.data}, ${xx(n)}`,o.$async,()=>e.code(Sf(r,n)).code(s))}function xx(e){return y._`{${A.default.instancePath}="", ${A.default.parentData}, ${A.default.parentDataProperty}, ${A.default.rootData}=${A.default.data}${e.dynamicRef?y._`, ${A.default.dynamicAnchors}={}`:y.nil}}={}`}function zx(e,t){e.if(A.default.valCxt,()=>{if(e.var(A.default.instancePath,y._`${A.default.valCxt}.${A.default.instancePath}`),e.var(A.default.parentData,y._`${A.default.valCxt}.${A.default.parentData}`),e.var(A.default.parentDataProperty,y._`${A.default.valCxt}.${A.default.parentDataProperty}`),e.var(A.default.rootData,y._`${A.default.valCxt}.${A.default.rootData}`),t.dynamicRef)e.var(A.default.dynamicAnchors,y._`${A.default.valCxt}.${A.default.dynamicAnchors}`)},()=>{if(e.var(A.default.instancePath,y._`""`),e.var(A.default.parentData,y._`undefined`),e.var(A.default.parentDataProperty,y._`undefined`),e.var(A.default.rootData,A.default.data),t.dynamicRef)e.var(A.default.dynamicAnchors,y._`{}`)})}function Sx(e){let{schema:t,opts:r,gen:o}=e;Rf(e,()=>{if(r.$comment&&t.$comment)jf(e);if(Rx(e),o.let(A.default.vErrors,null),o.let(A.default.errors,0),r.unevaluated)kx(e);Cf(e),Nx(e)});return}function kx(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",y._`${r}.evaluated`),t.if(y._`${e.evaluated}.dynamicProps`,()=>t.assign(y._`${e.evaluated}.props`,y._`undefined`)),t.if(y._`${e.evaluated}.dynamicItems`,()=>t.assign(y._`${e.evaluated}.items`,y._`undefined`))}function Sf(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?y._`/*# sourceURL=${r} */`:y.nil}function Px(e,t){if(If(e)){if(Nf(e),Of(e)){Ex(e,t);return}}yn.boolOrEmptySchema(e,t)}function Of({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function If(e){return typeof e.schema!="boolean"}function Ex(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)jf(e);Ox(e),Ix(e);let s=o.const("_errs",A.default.errors);Cf(e,s),o.var(t,y._`${s} === ${A.default.errors}`)}function Nf(e){fe.checkUnknownRules(e),Tx(e)}function Cf(e,t){if(e.opts.jtd)return kf(e,[],!1,t);let r=_n.getSchemaTypes(e.schema),o=_n.coerceAndCheckDataType(e,r);kf(e,r,!o,t)}function Tx(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&fe.schemaHasRulesButRef(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Rx(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)fe.checkStrictMode(e,"default is ignored in the schema root")}function Ox(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=Tf.resolveUrl(e.opts.uriResolver,e.baseId,t)}function Ix(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function jf({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)e.code(y._`${A.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=y.str`${o}/$comment`,a=e.scopeValue("root",{ref:t.root});e.code(y._`${A.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Nx(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=e;if(r.$async)t.if(y._`${A.default.errors} === 0`,()=>t.return(A.default.data),()=>t.throw(y._`new ${n}(${A.default.vErrors})`));else{if(t.assign(y._`${o}.errors`,A.default.vErrors),s.unevaluated)Cx(e);t.return(y._`${A.default.errors} === 0`)}}function Cx({gen:e,evaluated:t,props:r,items:o}){if(r instanceof y.Name)e.assign(y._`${t}.props`,r);if(o instanceof y.Name)e.assign(y._`${t}.items`,o)}function kf(e,t,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:u,self:c}=e,{RULES:l}=c;if(s.$ref&&(u.ignoreKeywordsWithRef||!fe.schemaHasRulesButRef(s,l))){n.block(()=>Zf(e,"$ref",l.all.$ref.definition));return}if(!u.jtd)jx(e,t);n.block(()=>{for(let d of l.rules)p(d);p(l.post)});function p(d){if(!ur.shouldUseGroup(s,d))return;if(d.type){if(n.if(Pt.checkDataType(d.type,i,u.strictNumbers)),Pf(e,d),t.length===1&&t[0]===d.type&&r)n.else(),Pt.reportTypeError(e);n.endIf()}else Pf(e,d);if(!a)n.if(y._`${A.default.errors} === ${o||0}`)}}function Pf(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)Ef.assignDefaults(e,t.type);r.block(()=>{for(let s of t.rules)if(ur.shouldUseRule(o,s))Zf(e,s.keyword,s.definition,t.type)})}function jx(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(Ax(e,t),!e.opts.allowUnionTypes)Zx(e,t);qx(e,e.dataTypes)}function Ax(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!Af(e.dataTypes,r))Ki(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Dx(e,t)}function Zx(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))Ki(e,"use allowUnionTypes to allow union type keyword")}function qx(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&ur.shouldUseRule(e.schema,n)){let{type:s}=n.definition;if(s.length&&!s.some((i)=>Mx(t,i)))Ki(e,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Mx(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Af(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Dx(e,t){let r=[];for(let o of e.dataTypes)if(Af(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function Ki(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,fe.checkStrictMode(e,t,e.opts.strictTypes)}class Bi{constructor(e,t,r){if(He.validateKeywordUsage(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=fe.schemaRefOrVal(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",qf(this.$data,e));else if(this.schemaCode=this.schemaValue,!He.validSchemaType(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",A.default.errors)}result(e,t,r){this.failResult(y.not(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult(y.not(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(y._`${t} !== undefined && (${y.or(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?Ve.reportExtraError:Ve.reportError)(this,this.def.error,t)}$dataError(){Ve.reportError(this,this.def.$dataError||Ve.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');Ve.resetErrorsCount(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=y.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=y.nil,t=y.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:s}=this;if(r.if(y.or(y._`${o} === undefined`,t)),e!==y.nil)r.assign(e,!0);if(n.length||s.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==y.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return y.or(s(),i());function s(){if(r.length){if(!(t instanceof y.Name))throw Error("ajv implementation error");let a=Array.isArray(r)?r:[r];return y._`${Pt.checkDataTypes(a,t,n.opts.strictNumbers,Pt.DataType.Wrong)}`}return y.nil}function i(){if(o.validateSchema){let a=e.scopeValue("validate$data",{ref:o.validateSchema});return y._`!${a}(${t})`}return y.nil}}subschema(e,t){let r=cr.getSubschema(this.it,e);cr.extendSubschemaData(r,this.it,e),cr.extendSubschemaMode(r,e);let o={...this.it,...r,items:void 0,props:void 0};return Px(o,t),o}mergeEvaluated(e,t){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=fe.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=fe.mergeEvaluated.items(o,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(t,()=>this.mergeEvaluated(e,y.Name)),!0}}Mf.KeywordCxt=Bi;function Zf(e,t,r,o){let n=new Bi(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)He.funcKeywordCode(n,r);else if("macro"in r)He.macroKeywordCode(n,r);else if(r.compile||r.validate)He.funcKeywordCode(n,r)}var Lx=/^\/(?:[^~]|~0|~1)*$/,Ux=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function qf(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,s;if(e==="")return A.default.rootData;if(e[0]==="/"){if(!Lx.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,s=A.default.rootData}else{let c=Ux.exec(e);if(!c)throw Error(`Invalid JSON-pointer: ${e}`);let l=+c[1];if(n=c[2],n==="#"){if(l>=t)throw Error(u("property/index",l));return o[t-l]}if(l>t)throw Error(u("data",l));if(s=r[t-l],!n)return s}let i=s,a=n.split("/");for(let c of a)if(c)s=y._`${s}${y.getProperty(fe.unescapeJsonPointer(c))}`,i=y._`${i} && ${s}`;return i;function u(c,l){return`Cannot access ${c} ${l} levels up, current level is ${t}`}}Mf.getData=qf});var vn=w(function(Uf){Object.defineProperty(Uf,"__esModule",{value:!0});class Lf extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}Uf.default=Lf});var po=w(function(Vf){Object.defineProperty(Vf,"__esModule",{value:!0});var lr=uo();class Ff extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=lr.resolveUrl(e,t,r),this.missingSchema=lr.normalizeId(lr.getFullPath(e,this.missingRef))}}Vf.default=Ff});var wn=w(function(Kf){Object.defineProperty(Kf,"__esModule",{value:!0});Kf.resolveSchema=Kf.getCompilingSchema=Kf.resolveRef=Kf.compileSchema=Kf.SchemaEnv=void 0;var se=M(),Kx=vn(),Wt=ut(),ie=uo(),bn=L(),Hf=lo();class fo{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:ie.normalizeId(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}Kf.SchemaEnv=fo;function Wi(e){let t=Jf.call(this,e);if(t)return t;let r=ie.getFullPath(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new se.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;if(e.$async)a=i.scopeValue("Error",{ref:Kx.default,code:se._`require("ajv/dist/runtime/validation_error").default`});let u=i.scopeName("validate");e.validateName=u;let c={gen:i,allErrors:this.opts.allErrors,data:Wt.default.data,parentData:Wt.default.parentData,parentDataProperty:Wt.default.parentDataProperty,dataNames:[Wt.default.data],dataPathArr:[se.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:se.stringify(e.schema)}:{ref:e.schema}),validateName:u,ValidationError:a,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:se.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:se._`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),Hf.validateFunctionCode(c),i.optimize(this.opts.code.optimize);let p=i.toString();if(l=`${i.scopeRefs(Wt.default.scope)}return ${p}`,this.opts.code.process)l=this.opts.code.process(l,e);let f=Function(`${Wt.default.self}`,`${Wt.default.scope}`,l)(this,this.scope.get());if(this.scope.value(u,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async)f.$async=!0;if(this.opts.code.source===!0)f.source={validateName:u,validateCode:p,scopeValues:i._values};if(this.opts.unevaluated){let{props:h,items:g}=c;if(f.evaluated={props:h instanceof se.Name?void 0:h,items:g instanceof se.Name?void 0:g,dynamicProps:h instanceof se.Name,dynamicItems:g instanceof se.Name},f.source)f.source.evaluated=se.stringify(f.evaluated)}return e.validate=f,e}catch(p){if(delete e.validate,delete e.validateName,l)this.logger.error("Error compiling schema, function code:",l);throw p}finally{this._compilations.delete(e)}}Kf.compileSchema=Wi;function Bx(e,t,r){var o;r=ie.resolveUrl(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let s=Xx.call(this,e,r);if(s===void 0){let i=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;if(i)s=new fo({schema:i,schemaId:a,root:e,baseId:t})}if(s===void 0)return;return e.refs[r]=Gx.call(this,s)}Kf.resolveRef=Bx;function Gx(e){if(ie.inlineRef(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:Wi.call(this,e)}function Jf(e){for(let t of this._compilations)if(Wx(t,e))return t}Kf.getCompilingSchema=Jf;function Wx(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Xx(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||$n.call(this,e,t)}function $n(e,t){let r=this.opts.uriResolver.parse(t),o=ie._getFullPath(this.opts.uriResolver,r),n=ie.getFullPath(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return Gi.call(this,r,e);let s=ie.normalizeId(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=$n.call(this,e,i);if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;return Gi.call(this,r,a)}if(typeof(i===null||i===void 0?void 0:i.schema)!=="object")return;if(!i.validate)Wi.call(this,i);if(s===ie.normalizeId(t)){let{schema:a}=i,{schemaId:u}=this.opts,c=a[u];if(c)n=ie.resolveUrl(this.opts.uriResolver,n,c);return new fo({schema:a,schemaId:u,root:e,baseId:n})}return Gi.call(this,r,i)}Kf.resolveSchema=$n;var Yx=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Gi(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let u=r[bn.unescapeFragment(a)];if(u===void 0)return;r=u;let c=typeof r==="object"&&r[this.opts.schemaId];if(!Yx.has(a)&&c)t=ie.resolveUrl(this.opts.uriResolver,t,c)}let s;if(typeof r!="boolean"&&r.$ref&&!bn.schemaHasRulesButRef(r,this.RULES)){let a=ie.resolveUrl(this.opts.uriResolver,t,r.$ref);s=$n.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new fo({schema:r,schemaId:i,root:o,baseId:t}),s.schema!==s.root.schema)return s;return}});var Gf=w(function(LN,o0){o0.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 Yi=w(function(UN,Qf){var n0=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Xf=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function Xi(e){let t="",r=0,o=0;for(o=0;o<e.length;o++){if(r=e[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var s0=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Wf(e){return e.length=0,!0}function i0(e,t,r){if(e.length){let o=Xi(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function a0(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=i0;for(let u=0;u<e.length;u++){let c=e[u];if(c==="["||c==="]")continue;if(c===":"){if(s===!0)i=!0;if(!a(n,o,r))break;if(++t>7){r.error=!0;break}if(u>0&&e[u-1]===":")s=!0;o.push(":");continue}else if(c==="%"){if(!a(n,o,r))break;a=Wf}else{n.push(c);continue}}if(n.length)if(a===Wf)r.zone=n.join("");else if(i)o.push(n.join(""));else o.push(Xi(n));return r.address=o.join(""),r}function Yf(e){if(c0(e,":")<2)return{host:e,isIPV6:!1};let t=a0(e);if(!t.error){let{address:r,address:o}=t;if(t.zone)r+="%"+t.zone,o+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:o}}else return{host:e,isIPV6:!1}}function c0(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function u0(e){let t=e,r=[],o=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}function l0(e,t){let r=t!==!0?escape:unescape;if(e.scheme!==void 0)e.scheme=r(e.scheme);if(e.userinfo!==void 0)e.userinfo=r(e.userinfo);if(e.host!==void 0)e.host=r(e.host);if(e.path!==void 0)e.path=r(e.path);if(e.query!==void 0)e.query=r(e.query);if(e.fragment!==void 0)e.fragment=r(e.fragment);return e}function p0(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!Xf(r)){let o=Yf(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=e.host}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}Qf.exports={nonSimpleDomain:s0,recomposeAuthority:p0,normalizeComponentEncoding:l0,removeDotSegments:u0,isIPv4:Xf,isUUID:n0,normalizeIPv6:Yf,stringArrayToHexStripped:Xi}});var nm=w(function(FN,om){var{isUUID:d0}=Yi(),f0=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,m0=["http","https","ws","wss","urn","urn:uuid"];function h0(e){return m0.indexOf(e)!==-1}function Qi(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function em(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function tm(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function g0(e){return e.secure=Qi(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function _0(e){if(e.port===(Qi(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function y0(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(f0);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,s=ea(n);if(e.path=void 0,s)e=s.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function v0(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,s=ea(n);if(s)e=s.serialize(e,t);let i=e,a=e.nss;return i.path=`${o||t.nid}:${a}`,t.skipEscape=!0,i}function b0(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!d0(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function $0(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var rm={scheme:"http",domainHost:!0,parse:em,serialize:tm},w0={scheme:"https",domainHost:rm.domainHost,parse:em,serialize:tm},xn={scheme:"ws",domainHost:!0,parse:g0,serialize:_0},x0={scheme:"wss",domainHost:xn.domainHost,parse:xn.parse,serialize:xn.serialize},z0={scheme:"urn",parse:y0,serialize:v0,skipNormalize:!0},S0={scheme:"urn:uuid",parse:b0,serialize:$0,skipNormalize:!0},zn={http:rm,https:w0,ws:xn,wss:x0,urn:z0,"urn:uuid":S0};Object.setPrototypeOf(zn,null);function ea(e){return e&&(zn[e]||zn[e.toLowerCase()])||void 0}om.exports={wsIsSecure:Qi,SCHEMES:zn,isValidSchemeName:h0,getSchemeHandler:ea}});var am=w(function(VN,kn){var{normalizeIPv6:k0,removeDotSegments:mo,recomposeAuthority:P0,normalizeComponentEncoding:Sn,isIPv4:E0,nonSimpleDomain:T0}=Yi(),{SCHEMES:R0,getSchemeHandler:sm}=nm();function O0(e,t){if(typeof e==="string")e=Je(lt(e,t),t);else if(typeof e==="object")e=lt(Je(e,t),t);return e}function I0(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=im(lt(e,o),lt(t,o),o,!0);return o.skipEscape=!0,Je(n,o)}function im(e,t,r,o){let n={};if(!o)e=lt(Je(e,r),r),t=lt(Je(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mo(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=mo(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=mo(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=mo(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function N0(e,t,r){if(typeof e==="string")e=unescape(e),e=Je(Sn(lt(e,r),!0),{...r,skipEscape:!0});else if(typeof e==="object")e=Je(Sn(e,!0),{...r,skipEscape:!0});if(typeof t==="string")t=unescape(t),t=Je(Sn(lt(t,r),!0),{...r,skipEscape:!0});else if(typeof t==="object")t=Je(Sn(t,!0),{...r,skipEscape:!0});return e.toLowerCase()===t.toLowerCase()}function Je(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[],s=sm(o.scheme||r.scheme);if(s&&s.serialize)s.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=escape(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=unescape(r.path);if(o.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let i=P0(r);if(i!==void 0){if(o.reference!=="suffix")n.push("//");if(n.push(i),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let a=r.path;if(!o.absolutePath&&(!s||!s.absolutePath))a=mo(a);if(i===void 0&&a[0]==="/"&&a[1]==="/")a="/%2F"+a.slice(2);n.push(a)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var C0=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function lt(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let s=e.match(C0);if(s){if(o.scheme=s[1],o.userinfo=s[3],o.host=s[4],o.port=parseInt(s[5],10),o.path=s[6]||"",o.query=s[7],o.fragment=s[8],isNaN(o.port))o.port=s[5];if(o.host)if(E0(o.host)===!1){let u=k0(o.host);o.host=u.host.toLowerCase(),n=u.isIPV6}else n=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let i=sm(r.scheme||o.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)){if(o.host&&(r.domainHost||i&&i.domainHost)&&n===!1&&T0(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(a){o.error=o.error||"Host's domain name can not be converted to ASCII: "+a}}if(!i||i&&!i.skipNormalize){if(e.indexOf("%")!==-1){if(o.scheme!==void 0)o.scheme=unescape(o.scheme);if(o.host!==void 0)o.host=unescape(o.host)}if(o.path)o.path=escape(unescape(o.path));if(o.fragment)o.fragment=encodeURI(decodeURIComponent(o.fragment))}if(i&&i.parse)i.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return o}var ta={SCHEMES:R0,normalize:O0,resolve:I0,resolveComponent:im,equal:N0,serialize:Je,parse:lt};kn.exports=ta;kn.exports.default=ta;kn.exports.fastUri=ta});var lm=w(function(um){Object.defineProperty(um,"__esModule",{value:!0});var cm=am();cm.code='require("ajv/dist/runtime/uri").default';um.default=cm});var bm=w(function(pt){Object.defineProperty(pt,"__esModule",{value:!0});pt.CodeGen=pt.Name=pt.nil=pt.stringify=pt.str=pt._=pt.KeywordCxt=void 0;var A0=lo();Object.defineProperty(pt,"KeywordCxt",{enumerable:!0,get:function(){return A0.KeywordCxt}});var dr=M();Object.defineProperty(pt,"_",{enumerable:!0,get:function(){return dr._}});Object.defineProperty(pt,"str",{enumerable:!0,get:function(){return dr.str}});Object.defineProperty(pt,"stringify",{enumerable:!0,get:function(){return dr.stringify}});Object.defineProperty(pt,"nil",{enumerable:!0,get:function(){return dr.nil}});Object.defineProperty(pt,"Name",{enumerable:!0,get:function(){return dr.Name}});Object.defineProperty(pt,"CodeGen",{enumerable:!0,get:function(){return dr.CodeGen}});var Z0=vn(),hm=po(),gm=qi(),Ke=wn(),_m=M(),Be=uo(),Et=co(),pr=L(),pm=Gf(),q0=lm(),ym=(e,t)=>new RegExp(e,t);ym.code="new RegExp";var M0=["removeAdditional","useDefaults","coerceTypes"],D0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),L0={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."},U0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},dm=200;function F0(e){var t,r,o,n,s,i,a,u,c,l,p,d,f,h,g,b,v,C,N,q,O,qe,Me,ns,ss;let Pr=e.strict,is=(t=e.code)===null||t===void 0?void 0:t.optimize,Na=is===!0||is===void 0?1:is||0,Ca=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:ym,Z_=(n=e.uriResolver)!==null&&n!==void 0?n:q0.default;return{strictSchema:(i=(s=e.strictSchema)!==null&&s!==void 0?s:Pr)!==null&&i!==void 0?i:!0,strictNumbers:(u=(a=e.strictNumbers)!==null&&a!==void 0?a:Pr)!==null&&u!==void 0?u:!0,strictTypes:(l=(c=e.strictTypes)!==null&&c!==void 0?c:Pr)!==null&&l!==void 0?l:"log",strictTuples:(d=(p=e.strictTuples)!==null&&p!==void 0?p:Pr)!==null&&d!==void 0?d:"log",strictRequired:(h=(f=e.strictRequired)!==null&&f!==void 0?f:Pr)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:Na,regExp:Ca}:{optimize:Na,regExp:Ca},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:dm,loopEnum:(b=e.loopEnum)!==null&&b!==void 0?b:dm,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(C=e.messages)!==null&&C!==void 0?C:!0,inlineRefs:(N=e.inlineRefs)!==null&&N!==void 0?N:!0,schemaId:(q=e.schemaId)!==null&&q!==void 0?q:"$id",addUsedSchema:(O=e.addUsedSchema)!==null&&O!==void 0?O:!0,validateSchema:(qe=e.validateSchema)!==null&&qe!==void 0?qe:!0,validateFormats:(Me=e.validateFormats)!==null&&Me!==void 0?Me:!0,unicodeRegExp:(ns=e.unicodeRegExp)!==null&&ns!==void 0?ns:!0,int32range:(ss=e.int32range)!==null&&ss!==void 0?ss:!0,uriResolver:Z_}}class Pn{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...F0(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new _m.ValueScope({scope:{},prefixes:D0,es5:t,lines:r}),this.logger=G0(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=gm.getRules(),fm.call(this,L0,e,"NOT SUPPORTED"),fm.call(this,U0,e,"DEPRECATED","warn"),this._metaOpts=K0.call(this),e.formats)H0.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)J0.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);V0.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=pm;if(r==="id")o={...pm},o.id=o.$id,delete o.$id;if(t&&e)this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);if(!("$async"in r))this.errors=r.errors;return o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(c,l){await n.call(this,c.$schema);let p=this._addSchema(c,l);return p.validate||s.call(this,p)}async function n(c){if(c&&!this.getSchema(c))await o.call(this,{$ref:c},!0)}async function s(c){try{return this._compileSchemaEnv(c)}catch(l){if(!(l instanceof hm.default))throw l;return i.call(this,l),await a.call(this,l.missingSchema),s.call(this,c)}}function i({missingSchema:c,missingRef:l}){if(this.refs[c])throw Error(`AnySchema ${c} is loaded but ${l} cannot be resolved`)}async function a(c){let l=await u.call(this,c);if(!this.refs[c])await n.call(this,l.$schema);if(!this.refs[c])this.addSchema(l,c,t)}async function u(c){let l=this._loading[c];if(l)return l;try{return await(this._loading[c]=r(c))}finally{delete this._loading[c]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let s of e)this.addSchema(s,void 0,r,o);return this}let n;if(typeof e==="object"){let{schemaId:s}=this.opts;if(n=e[s],n!==void 0&&typeof n!="string")throw Error(`schema ${s} must be string`)}return t=Be.normalizeId(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return o}getSchema(e){let t;while(typeof(t=mm.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new Ke.SchemaEnv({schema:{},schemaId:r});if(t=Ke.resolveSchema.call(this,o,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=mm.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=Be.normalizeId(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(X0.call(this,r,t),!t)return pr.eachItem(r,(n)=>ra.call(this,n)),this;Q0.call(this,t);let o={...t,type:Et.getJSONTypes(t.type),schemaType:Et.getJSONTypes(t.schemaType)};return pr.eachItem(r,o.type.length===0?(n)=>ra.call(this,n,o):(n)=>o.type.forEach((s)=>ra.call(this,n,o,s))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let o=r.rules.findIndex((n)=>n.keyword===e);if(o>=0)r.rules.splice(o,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,n)=>o+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of t){let n=o.split("/").slice(1),s=e;for(let i of n)s=s[i];for(let i in r){let a=r[i];if(typeof a!="object")continue;let{$data:u}=a.definition,c=s[i];if(u&&c)s[i]=vm(c)}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];if(!t||t.test(r)){if(typeof o=="string")delete e[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete e[r]}}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let s,{schemaId:i}=this.opts;if(typeof e=="object")s=e[i];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let a=this._cache.get(e);if(a!==void 0)return a;r=Be.normalizeId(s||r);let u=Be.getSchemaRefs.call(this,e,r);if(a=new Ke.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:u}),this._cache.set(a.schema,a),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=a}if(o)this.validateSchema(e,!0);return a}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Ke.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Ke.compileSchema.call(this,e)}finally{this.opts=t}}}Pn.ValidationError=Z0.default;Pn.MissingRefError=hm.default;pt.default=Pn;function fm(e,t,r,o="error"){for(let n in e){let s=n;if(s in t)this.logger[o](`${r}: option ${n}. ${e[s]}`)}}function mm(e){return e=Be.normalizeId(e),this.schemas[e]||this.refs[e]}function V0(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function H0(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function J0(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function K0(){let e={...this.opts};for(let t of M0)delete e[t];return e}var B0={log(){},warn(){},error(){}};function G0(e){if(e===!1)return B0;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var W0=/^[a-z_$][a-z0-9_$:-]*$/i;function X0(e,t){let{RULES:r}=this;if(pr.eachItem(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!W0.test(o))throw Error(`Keyword ${o} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function ra(e,t,r){var o;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:u})=>u===r);if(!i)i={type:r,rules:[]},s.rules.push(i);if(s.keywords[e]=!0,!t)return;let a={keyword:e,definition:{...t,type:Et.getJSONTypes(t.type),schemaType:Et.getJSONTypes(t.schemaType)}};if(t.before)Y0.call(this,i,a,t.before);else i.rules.push(a);s.all[e]=a,(o=t.implements)===null||o===void 0||o.forEach((u)=>this.addKeyword(u))}function Y0(e,t,r){let o=e.rules.findIndex((n)=>n.keyword===r);if(o>=0)e.rules.splice(o,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function Q0(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=vm(t);e.validateSchema=this.compile(t,!0)}var ez={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function vm(e){return{anyOf:[e,ez]}}});var wm=w(function($m){Object.defineProperty($m,"__esModule",{value:!0});var oz={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};$m.default=oz});var km=w(function(zm){Object.defineProperty(zm,"__esModule",{value:!0});zm.callRef=zm.getValidate=void 0;var sz=po(),Tn=Ce(),B=M(),fr=ut(),Rn=wn(),Tt=L(),iz={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:u}=o,{root:c}=s;if((r==="#"||r==="#/")&&n===c.baseId)return p();let l=Rn.resolveRef.call(u,c,n,r);if(l===void 0)throw new sz.default(o.opts.uriResolver,n,r);if(l instanceof Rn.SchemaEnv)return d(l);return f(l);function p(){if(s===c)return En(e,i,s,s.$async);let h=t.scopeValue("root",{ref:c});return En(e,B._`${h}.validate`,c,c.$async)}function d(h){let g=xm(e,h);En(e,g,h,h.$async)}function f(h){let g=t.scopeValue("schema",a.code.source===!0?{ref:h,code:B.stringify(h)}:{ref:h}),b=t.name("valid"),v=e.subschema({schema:h,dataTypes:[],schemaPath:B.nil,topSchemaRef:g,errSchemaPath:r},b);e.mergeEvaluated(v),e.ok(b)}}};function xm(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):B._`${r.scopeValue("wrapper",{ref:t})}.validate`}zm.getValidate=xm;function En(e,t,r,o){let{gen:n,it:s}=e,{allErrors:i,schemaEnv:a,opts:u}=s,c=u.passContext?fr.default.this:B.nil;if(o)l();else p();function l(){if(!a.$async)throw Error("async schema referenced by sync schema");let h=n.let("valid");n.try(()=>{if(n.code(B._`await ${Tn.callValidateCode(e,t,c)}`),f(t),!i)n.assign(h,!0)},(g)=>{if(n.if(B._`!(${g} instanceof ${s.ValidationError})`,()=>n.throw(g)),d(g),!i)n.assign(h,!1)}),e.ok(h)}function p(){e.result(Tn.callValidateCode(e,t,c),()=>f(t),()=>d(t))}function d(h){let g=B._`${h}.errors`;n.assign(fr.default.vErrors,B._`${fr.default.vErrors} === null ? ${g} : ${fr.default.vErrors}.concat(${g})`),n.assign(fr.default.errors,B._`${fr.default.vErrors}.length`)}function f(h){var g;if(!s.opts.unevaluated)return;let b=(g=r===null||r===void 0?void 0:r.validate)===null||g===void 0?void 0:g.evaluated;if(s.props!==!0)if(b&&!b.dynamicProps){if(b.props!==void 0)s.props=Tt.mergeEvaluated.props(n,b.props,s.props)}else{let v=n.var("props",B._`${h}.evaluated.props`);s.props=Tt.mergeEvaluated.props(n,v,s.props,B.Name)}if(s.items!==!0)if(b&&!b.dynamicItems){if(b.items!==void 0)s.items=Tt.mergeEvaluated.items(n,b.items,s.items)}else{let v=n.var("items",B._`${h}.evaluated.items`);s.items=Tt.mergeEvaluated.items(n,v,s.items,B.Name)}}}zm.callRef=En;zm.default=iz});var Em=w(function(Pm){Object.defineProperty(Pm,"__esModule",{value:!0});var uz=wm(),lz=km(),pz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",uz.default,lz.default];Pm.default=pz});var Rm=w(function(Tm){Object.defineProperty(Tm,"__esModule",{value:!0});var Ot=M(),Rt=Ot.operators,On={maximum:{okStr:"<=",ok:Rt.LTE,fail:Rt.GT},minimum:{okStr:">=",ok:Rt.GTE,fail:Rt.LT},exclusiveMaximum:{okStr:"<",ok:Rt.LT,fail:Rt.GTE},exclusiveMinimum:{okStr:">",ok:Rt.GT,fail:Rt.LTE}},fz={message:({keyword:e,schemaCode:t})=>Ot.str`must be ${On[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ot._`{comparison: ${On[e].okStr}, limit: ${t}}`},mz={keyword:Object.keys(On),type:"number",schemaType:"number",$data:!0,error:fz,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(Ot._`${r} ${On[t].fail} ${o} || isNaN(${r})`)}};Tm.default=mz});var Im=w(function(Om){Object.defineProperty(Om,"__esModule",{value:!0});var Ge=M(),gz={message:({schemaCode:e})=>Ge.str`must be multiple of ${e}`,params:({schemaCode:e})=>Ge._`{multipleOf: ${e}}`},_z={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:gz,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,s=n.opts.multipleOfPrecision,i=t.let("res"),a=s?Ge._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:Ge._`${i} !== parseInt(${i})`;e.fail$data(Ge._`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};Om.default=_z});var jm=w(function(Cm){Object.defineProperty(Cm,"__esModule",{value:!0});function Nm(e){let t=e.length,r=0,o=0,n;while(o<t)if(r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t){if(n=e.charCodeAt(o),(n&64512)===56320)o++}return r}Cm.default=Nm;Nm.code='require("ajv/dist/runtime/ucs2length").default'});var qm=w(function(Zm){Object.defineProperty(Zm,"__esModule",{value:!0});var Se=M(),Am=L(),bz=jm(),$z={message({keyword:e,schemaCode:t}){return Se.str`must NOT have ${e==="maxLength"?"more":"fewer"} than ${t} characters`},params:({schemaCode:e})=>Se._`{limit: ${e}}`},wz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:$z,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,s=t==="maxLength"?Se.operators.GT:Se.operators.LT,i=n.opts.unicode===!1?Se._`${r}.length`:Se._`${Am.useFunc(e.gen,bz.default)}(${r})`;e.fail$data(Se._`${i} ${s} ${o}`)}};Zm.default=wz});var Um=w(function(Lm){Object.defineProperty(Lm,"__esModule",{value:!0});var Mm=Ce(),Dm=L(),je=M(),zz={message:({schemaCode:e})=>je.str`must match pattern "${e}"`,params:({schemaCode:e})=>je._`{pattern: ${e}}`},Sz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:zz,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:u}=i.opts.code,c=u.code==="new RegExp"?je._`new RegExp`:Dm.useFunc(t,u),l=t.let("valid");t.try(()=>t.assign(l,je._`${c}(${s}, ${a}).test(${r})`),()=>t.assign(l,!1)),e.fail$data(je._`!${l}`)}else{let u=Mm.usePattern(e,n);e.fail$data(je._`!${u}.test(${r})`)}}};Lm.default=Sz});var Vm=w(function(Fm){Object.defineProperty(Fm,"__esModule",{value:!0});var We=M(),Pz={message({keyword:e,schemaCode:t}){return We.str`must NOT have ${e==="maxProperties"?"more":"fewer"} than ${t} properties`},params:({schemaCode:e})=>We._`{limit: ${e}}`},Ez={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Pz,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?We.operators.GT:We.operators.LT;e.fail$data(We._`Object.keys(${r}).length ${n} ${o}`)}};Fm.default=Ez});var Km=w(function(Jm){Object.defineProperty(Jm,"__esModule",{value:!0});var Xe=Ce(),Ye=M(),Hm=L(),Rz={message:({params:{missingProperty:e}})=>Ye.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Ye._`{missingProperty: ${e}}`},Oz={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Rz,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:s,it:i}=e,{opts:a}=i;if(!s&&r.length===0)return;let u=r.length>=a.loopRequired;if(i.allErrors)c();else l();if(a.strictRequired){let f=e.parentSchema.properties,{definedProperties:h}=e.it;for(let g of r)if((f===null||f===void 0?void 0:f[g])===void 0&&!h.has(g)){let b=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${g}" is not defined at "${b}" (strictRequired)`;Hm.checkStrictMode(i,v,i.opts.strictRequired)}}function c(){if(u||s)e.block$data(Ye.nil,p);else for(let f of r)Xe.checkReportMissingProp(e,f)}function l(){let f=t.let("missing");if(u||s){let h=t.let("valid",!0);e.block$data(h,()=>d(f,h)),e.ok(h)}else t.if(Xe.checkMissingProp(e,r,f)),Xe.reportMissingProp(e,f),t.else()}function p(){t.forOf("prop",o,(f)=>{e.setParams({missingProperty:f}),t.if(Xe.noPropertyInData(t,n,f,a.ownProperties),()=>e.error())})}function d(f,h){e.setParams({missingProperty:f}),t.forOf(f,o,()=>{t.assign(h,Xe.propertyInData(t,n,f,a.ownProperties)),t.if(Ye.not(h),()=>{e.error(),t.break()})},Ye.nil)}}};Jm.default=Oz});var Gm=w(function(Bm){Object.defineProperty(Bm,"__esModule",{value:!0});var Qe=M(),Nz={message({keyword:e,schemaCode:t}){return Qe.str`must NOT have ${e==="maxItems"?"more":"fewer"} than ${t} items`},params:({schemaCode:e})=>Qe._`{limit: ${e}}`},Cz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Nz,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?Qe.operators.GT:Qe.operators.LT;e.fail$data(Qe._`${r}.length ${n} ${o}`)}};Bm.default=Cz});var In=w(function(Xm){Object.defineProperty(Xm,"__esModule",{value:!0});var Wm=Hi();Wm.code='require("ajv/dist/runtime/equal").default';Xm.default=Wm});var eh=w(function(Qm){Object.defineProperty(Qm,"__esModule",{value:!0});var mr=co(),U=M(),Ym=L(),Zz=In(),qz={message:({params:{i:e,j:t}})=>U.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>U._`{i: ${e}, j: ${t}}`},Mz={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:qz,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=e;if(!o&&!n)return;let u=t.let("valid"),c=s.items?mr.getSchemaTypes(s.items):[];e.block$data(u,l,U._`${i} === false`),e.ok(u);function l(){let h=t.let("i",U._`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(u,!0),t.if(U._`${h} > 1`,()=>(p()?d:f)(h,g))}function p(){return c.length>0&&!c.some((h)=>h==="object"||h==="array")}function d(h,g){let b=t.name("item"),v=mr.checkDataTypes(c,b,a.opts.strictNumbers,mr.DataType.Wrong),C=t.const("indices",U._`{}`);t.for(U._`;${h}--;`,()=>{if(t.let(b,U._`${r}[${h}]`),t.if(v,U._`continue`),c.length>1)t.if(U._`typeof ${b} == "string"`,U._`${b} += "_"`);t.if(U._`typeof ${C}[${b}] == "number"`,()=>{t.assign(g,U._`${C}[${b}]`),e.error(),t.assign(u,!1).break()}).code(U._`${C}[${b}] = ${h}`)})}function f(h,g){let b=Ym.useFunc(t,Zz.default),v=t.name("outer");t.label(v).for(U._`;${h}--;`,()=>t.for(U._`${g} = ${h}; ${g}--;`,()=>t.if(U._`${b}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(u,!1).break(v)})))}}};Qm.default=Mz});var oh=w(function(rh){Object.defineProperty(rh,"__esModule",{value:!0});var hr=M(),th=L(),Lz=In(),Uz={message:"must be equal to constant",params:({schemaCode:e})=>hr._`{allowedValue: ${e}}`},Fz={keyword:"const",$data:!0,error:Uz,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:s}=e;if(o||s&&typeof s=="object")e.fail$data(hr._`!${th.useFunc(t,Lz.default)}(${r}, ${n})`);else e.fail(hr._`${s} !== ${r}`)}};rh.default=Fz});var ih=w(function(sh){Object.defineProperty(sh,"__esModule",{value:!0});var et=M(),nh=L(),Hz=In(),Jz={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>et._`{allowedValues: ${e}}`},Kz={keyword:"enum",schemaType:"array",$data:!0,error:Jz,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:s,it:i}=e;if(!o&&n.length===0)throw Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,u,c=()=>u!==null&&u!==void 0?u:u=nh.useFunc(t,Hz.default),l;if(a||o)l=t.let("valid"),e.block$data(l,p);else{if(!Array.isArray(n))throw Error("ajv implementation error");let f=t.const("vSchema",s);l=et.or(...n.map((h,g)=>d(f,g)))}e.pass(l);function p(){t.assign(l,!1),t.forOf("v",s,(f)=>t.if(et._`${c()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function d(f,h){let g=n[h];return typeof g==="object"&&g!==null?et._`${c()}(${r}, ${f}[${h}])`:et._`${r} === ${g}`}}};sh.default=Kz});var ch=w(function(ah){Object.defineProperty(ah,"__esModule",{value:!0});var Gz=Rm(),Wz=Im(),Xz=qm(),Yz=Um(),Qz=Vm(),eS=Km(),tS=Gm(),rS=eh(),oS=oh(),nS=ih(),sS=[Gz.default,Wz.default,Xz.default,Yz.default,Qz.default,eS.default,tS.default,rS.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},oS.default,nS.default];ah.default=sS});var oa=w(function(lh){Object.defineProperty(lh,"__esModule",{value:!0});lh.validateAdditionalItems=void 0;var ke=M(),gr=L(),aS={message:({params:{len:e}})=>ke.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>ke._`{limit: ${e}}`},cS={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:aS,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){gr.checkStrictMode(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}uh(e,o)}};function uh(e,t){let{gen:r,schema:o,data:n,keyword:s,it:i}=e;i.items=!0;let a=r.const("len",ke._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass(ke._`${a} <= ${t.length}`);else if(typeof o=="object"&&!gr.alwaysValidSchema(i,o)){let c=r.var("valid",ke._`${a} <= ${t.length}`);r.if(ke.not(c),()=>u(c)),e.ok(c)}function u(c){r.forRange("i",t.length,a,(l)=>{if(e.subschema({keyword:s,dataProp:l,dataPropType:gr.Type.Num},c),!i.allErrors)r.if(ke.not(c),()=>r.break())})}}lh.validateAdditionalItems=uh;lh.default=cS});var na=w(function(mh){Object.defineProperty(mh,"__esModule",{value:!0});mh.validateTuple=void 0;var Nn=M(),It=L(),dh=Ce(),lS={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return fh(e,"additionalItems",t);if(r.items=!0,It.alwaysValidSchema(r,t))return;e.ok(dh.validateArray(e))}};function fh(e,t,r=e.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=e;if(l(n),a.opts.unevaluated&&r.length&&a.items!==!0)a.items=It.mergeEvaluated.items(o,r.length,a.items);let u=o.name("valid"),c=o.const("len",Nn._`${s}.length`);r.forEach((p,d)=>{if(It.alwaysValidSchema(a,p))return;o.if(Nn._`${c} > ${d}`,()=>e.subschema({keyword:i,schemaProp:d,dataProp:d},u)),e.ok(u)});function l(p){let{opts:d,errSchemaPath:f}=a,h=r.length,g=h===p.minItems&&(h===p.maxItems||p[t]===!1);if(d.strictTuples&&!g){let b=`"${i}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;It.checkStrictMode(a,b,d.strictTuples)}}}mh.validateTuple=fh;mh.default=lS});var yh=w(function(_h){Object.defineProperty(_h,"__esModule",{value:!0});var gh=na(),dS={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>gh.validateTuple(e,"items")};_h.default=dS});var xh=w(function(wh){Object.defineProperty(wh,"__esModule",{value:!0});var Cn=M(),vh=L(),bh=Ce(),$h=oa(),mS={message:({params:{len:e}})=>Cn.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>Cn._`{limit: ${e}}`},hS={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:mS,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,vh.alwaysValidSchema(o,t))return;if(n)$h.validateAdditionalItems(e,n);else e.ok(bh.validateArray(e))}};wh.default=hS});var Sh=w(function(zh){Object.defineProperty(zh,"__esModule",{value:!0});var re=M(),Nt=L(),_S={message:({params:{min:e,max:t}})=>t===void 0?re.str`must contain at least ${e} valid item(s)`:re.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?re._`{minContains: ${e}}`:re._`{minContains: ${e}, maxContains: ${t}}`},yS={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:_S,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e,i,a,{minContains:u,maxContains:c}=o;if(s.opts.next)i=u===void 0?1:u,a=c;else i=1;let l=t.const("len",re._`${n}.length`);if(e.setParams({min:i,max:a}),a===void 0&&i===0){Nt.checkStrictMode(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){Nt.checkStrictMode(s,'"minContains" > "maxContains" is always invalid'),e.fail();return}if(Nt.alwaysValidSchema(s,r)){let g=re._`${l} >= ${i}`;if(a!==void 0)g=re._`${g} && ${l} <= ${a}`;e.pass(g);return}s.items=!0;let p=t.name("valid");if(a===void 0&&i===1)f(p,()=>t.if(p,()=>t.break()));else if(i===0){if(t.let(p,!0),a!==void 0)t.if(re._`${n}.length > 0`,d)}else t.let(p,!1),d();e.result(p,()=>e.reset());function d(){let g=t.name("_valid"),b=t.let("count",0);f(g,()=>t.if(g,()=>h(b)))}function f(g,b){t.forRange("i",0,l,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:Nt.Type.Num,compositeRule:!0},g),b()})}function h(g){if(t.code(re._`${g}++`),a===void 0)t.if(re._`${g} >= ${i}`,()=>t.assign(p,!0).break());else if(t.if(re._`${g} > ${a}`,()=>t.assign(p,!1).break()),i===1)t.assign(p,!0);else t.if(re._`${g} >= ${i}`,()=>t.assign(p,!0))}}};zh.default=yS});var Ih=w(function(Th){Object.defineProperty(Th,"__esModule",{value:!0});Th.validateSchemaDeps=Th.validatePropertyDeps=Th.error=void 0;var _r=M(),kh=L(),tt=Ce();Th.error={message:({params:{property:e,depsCount:t,deps:r}})=>_r.str`must have ${t===1?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>_r._`{property: ${e},
|
|
6
6
|
missingProperty: ${o},
|
|
7
7
|
depsCount: ${t},
|
|
8
|
-
deps: ${r}}`};var uS={keyword:"dependencies",type:"object",schemaType:"object",error:Lm.error,code(e){let[t,r]=lS(e);Mm(e,t),Dm(e,r)}};function lS({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Mm(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let u=Ur.propertyInData(r,o,i,n.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors)r.if(u,()=>{for(let c of a)Ur.checkReportMissingProp(e,c)});else r.if(Ii._`${u} && (${Ur.checkMissingProp(e,a,s)})`),Ur.reportMissingProp(e,s),r.else()}}Lm.validatePropertyDeps=Mm;function Dm(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t){if(cS.alwaysValidSchema(s,t[a]))continue;r.if(Ur.propertyInData(r,o,a,s.opts.ownProperties),()=>{let u=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(u,i)},()=>r.var(i,!0)),e.ok(i)}}Lm.validateSchemaDeps=Dm;Lm.default=uS});var Km=b(function(Jm){Object.defineProperty(Jm,"__esModule",{value:!0});var Hm=C(),fS=Z(),mS={message:"property name must be valid",params:({params:e})=>Hm._`{propertyName: ${e.propertyName}}`},hS={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:mS,code(e){let{gen:t,schema:r,data:o,it:n}=e;if(fS.alwaysValidSchema(n,r))return;let s=t.name("valid");t.forIn("key",o,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if(Hm.not(s),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(s)}};Jm.default=hS});var Ni=b(function(Bm){Object.defineProperty(Bm,"__esModule",{value:!0});var an=xe(),Oe=C(),_S=He(),cn=Z(),yS={message:"must NOT have additional properties",params:({params:e})=>Oe._`{additionalProperty: ${e.additionalProperty}}`},vS={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:yS,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:u}=i;if(i.props=!0,u.removeAdditional!=="all"&&cn.alwaysValidSchema(i,r))return;let c=an.allSchemaProperties(o.properties),l=an.allSchemaProperties(o.patternProperties);d(),e.ok(Oe._`${s} === ${_S.default.errors}`);function d(){t.forIn("key",n,(v)=>{if(!c.length&&!l.length)h(v);else t.if(p(v),()=>h(v))})}function p(v){let y;if(c.length>8){let R=cn.schemaRefOrVal(i,o.properties,"properties");y=an.isOwnProperty(t,R,v)}else if(c.length)y=Oe.or(...c.map((R)=>Oe._`${v} === ${R}`));else y=Oe.nil;if(l.length)y=Oe.or(y,...l.map((R)=>Oe._`${an.usePattern(e,R)}.test(${v})`));return Oe.not(y)}function f(v){t.code(Oe._`delete ${n}[${v}]`)}function h(v){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){f(v);return}if(r===!1){if(e.setParams({additionalProperty:v}),e.error(),!a)t.break();return}if(typeof r=="object"&&!cn.alwaysValidSchema(i,r)){let y=t.name("valid");if(u.removeAdditional==="failing")g(v,y,!1),t.if(Oe.not(y),()=>{e.reset(),f(v)});else if(g(v,y),!a)t.if(Oe.not(y),()=>t.break())}}function g(v,y,R){let T={keyword:"additionalProperties",dataProp:v,dataPropType:cn.Type.Str};if(R===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(T,y)}}};Bm.default=vS});var Ym=b(function(Xm){Object.defineProperty(Xm,"__esModule",{value:!0});var $S=Rr(),Wm=xe(),Ci=Z(),Gm=Ni(),wS={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;if(s.opts.removeAdditional==="all"&&o.additionalProperties===void 0)Gm.default.code(new $S.KeywordCxt(s,Gm.default,"additionalProperties"));let i=Wm.allSchemaProperties(r);for(let d of i)s.definedProperties.add(d);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=Ci.mergeEvaluated.props(t,Ci.toHash(i),s.props);let a=i.filter((d)=>!Ci.alwaysValidSchema(s,r[d]));if(a.length===0)return;let u=t.name("valid");for(let d of a){if(c(d))l(d);else{if(t.if(Wm.propertyInData(t,n,d,s.opts.ownProperties)),l(d),!s.allErrors)t.else().var(u,!0);t.endIf()}e.it.definedProperties.add(d),e.ok(u)}function c(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},u)}}};Xm.default=wS});var oh=b(function(rh){Object.defineProperty(rh,"__esModule",{value:!0});var Qm=xe(),un=C(),eh=Z(),th=Z(),zS={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=Qm.allSchemaProperties(r),u=a.filter((g)=>eh.alwaysValidSchema(s,r[g]));if(a.length===0||u.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof un.Name))s.props=th.evaluatedPropsToName(t,s.props);let{props:d}=s;p();function p(){for(let g of a){if(c)f(g);if(s.allErrors)h(g);else t.var(l,!0),h(g),t.if(l)}}function f(g){for(let v in c)if(new RegExp(g).test(v))eh.checkStrictMode(s,`property ${v} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",o,(v)=>{t.if(un._`${Qm.usePattern(e,g)}.test(${v})`,()=>{let y=u.includes(g);if(!y)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:v,dataPropType:th.Type.Str},l);if(s.opts.unevaluated&&d!==!0)t.assign(un._`${d}[${v}]`,!0);else if(!y&&!s.allErrors)t.if(un.not(l),()=>t.break())})})}}};rh.default=zS});var sh=b(function(nh){Object.defineProperty(nh,"__esModule",{value:!0});var kS=Z(),PS={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if(kS.alwaysValidSchema(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};nh.default=PS});var ah=b(function(ih){Object.defineProperty(ih,"__esModule",{value:!0});var TS=xe(),RS={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:TS.validateUnion,error:{message:"must match a schema in anyOf"}};ih.default=RS});var uh=b(function(ch){Object.defineProperty(ch,"__esModule",{value:!0});var ln=C(),IS=Z(),NS={message:"must match exactly one schema in oneOf",params:({params:e})=>ln._`{passingSchemas: ${e.passing}}`},CS={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:NS,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),u=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){s.forEach((l,d)=>{let p;if(IS.alwaysValidSchema(n,l))t.var(u,!0);else p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},u);if(d>0)t.if(ln._`${u} && ${i}`).assign(i,!1).assign(a,ln._`[${a}, ${d}]`).else();t.if(u,()=>{if(t.assign(i,!0),t.assign(a,d),p)e.mergeEvaluated(p,ln.Name)})})}}};ch.default=CS});var dh=b(function(lh){Object.defineProperty(lh,"__esModule",{value:!0});var AS=Z(),ZS={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if(AS.alwaysValidSchema(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};lh.default=ZS});var hh=b(function(mh){Object.defineProperty(mh,"__esModule",{value:!0});var dn=C(),fh=Z(),MS={message:({params:e})=>dn.str`must match "${e.ifClause}" schema`,params:({params:e})=>dn._`{failingKeyword: ${e.ifClause}}`},DS={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:MS,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)fh.checkStrictMode(o,'"if" without "then" and "else" is ignored');let n=ph(o,"then"),s=ph(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(u(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,c("then",l),c("else",l))}else if(n)t.if(a,c("then"));else t.if(dn.not(a),c("else"));e.pass(i,()=>e.error(!0));function u(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function c(l,d){return()=>{let p=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),d)t.assign(d,dn._`${l}`);else e.setParams({ifClause:l})}}}};function ph(e,t){let r=e.schema[t];return r!==void 0&&!fh.alwaysValidSchema(e,r)}mh.default=DS});var _h=b(function(gh){Object.defineProperty(gh,"__esModule",{value:!0});var US=Z(),FS={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)US.checkStrictMode(r,`"${e}" without "if" is ignored`)}};gh.default=FS});var vh=b(function(yh){Object.defineProperty(yh,"__esModule",{value:!0});var HS=Ri(),JS=Nm(),KS=Oi(),BS=Am(),GS=qm(),WS=Vm(),XS=Km(),YS=Ni(),QS=Ym(),e1=oh(),t1=sh(),r1=ah(),o1=uh(),n1=dh(),s1=hh(),i1=_h();function a1(e=!1){let t=[t1.default,r1.default,o1.default,n1.default,s1.default,i1.default,XS.default,YS.default,WS.default,QS.default,e1.default];if(e)t.push(JS.default,BS.default);else t.push(HS.default,KS.default);return t.push(GS.default),t}yh.default=a1});var $h=b(function(bh){Object.defineProperty(bh,"__esModule",{value:!0});var Y=C(),u1={message:({schemaCode:e})=>Y.str`must match format "${e}"`,params:({schemaCode:e})=>Y._`{format: ${e}}`},l1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:u1,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:d}=a;if(!u.validateFormats)return;if(n)p();else f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:u.code.formats}),g=r.const("fDef",Y._`${h}[${i}]`),v=r.let("fType"),y=r.let("format");r.if(Y._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(v,Y._`${g}.type || "string"`).assign(y,Y._`${g}.validate`),()=>r.assign(v,Y._`"string"`).assign(y,g)),e.fail$data(Y.or(R(),T()));function R(){if(u.strictSchema===!1)return Y.nil;return Y._`${i} && !${y}`}function T(){let I=l.$async?Y._`(${g}.async ? await ${y}(${o}) : ${y}(${o}))`:Y._`${y}(${o})`,E=Y._`(typeof ${y} == "function" ? ${I} : ${y}.test(${o}))`;return Y._`${y} && ${y} !== true && ${v} === ${t} && !${E}`}}function f(){let h=d.formats[s];if(!h){R();return}if(h===!0)return;let[g,v,y]=T(h);if(g===t)e.pass(I());function R(){if(u.strictSchema===!1){d.logger.warn(E());return}throw Error(E());function E(){return`unknown format "${s}" ignored in schema at path "${c}"`}}function T(E){let Se=E instanceof RegExp?Y.regexpCode(E):u.code.formats?Y._`${u.code.formats}${Y.getProperty(s)}`:void 0,ke=r.scopeValue("formats",{key:s,ref:E,code:Se});if(typeof E=="object"&&!(E instanceof RegExp))return[E.type||"string",E.validate,Y._`${ke}.validate`];return["string",E,ke]}function I(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw Error("async format in sync schema");return Y._`await ${y}(${o})`}return typeof v=="function"?Y._`${y}(${o})`:Y._`${y}.test(${o})`}}}};bh.default=l1});var xh=b(function(wh){Object.defineProperty(wh,"__esModule",{value:!0});var p1=$h(),f1=[p1.default];wh.default=f1});var kh=b(function(zh){Object.defineProperty(zh,"__esModule",{value:!0});zh.contentVocabulary=zh.metadataVocabulary=void 0;zh.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];zh.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Th=b(function(Eh){Object.defineProperty(Eh,"__esModule",{value:!0});var g1=Xf(),_1=zm(),y1=vh(),v1=xh(),Ph=kh(),b1=[g1.default,_1.default,(0,y1.default)(),v1.default,Ph.metadataVocabulary,Ph.contentVocabulary];Eh.default=b1});var Nh=b(function(Oh){Object.defineProperty(Oh,"__esModule",{value:!0});Oh.DiscrError=void 0;var Rh;(function(e){e.Tag="tag",e.Mapping="mapping"})(Rh||(Oh.DiscrError=Rh={}))});var Ah=b(function(jh){Object.defineProperty(jh,"__esModule",{value:!0});var qt=C(),ji=Nh(),Ch=Jo(),w1=Or(),x1=Z(),z1={message:({params:{discrError:e,tagName:t}})=>e===ji.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>qt._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},S1={keyword:"discriminator",type:"object",schemaType:"object",error:z1,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let u=t.let("valid",!1),c=t.const("tag",qt._`${r}${qt.getProperty(a)}`);t.if(qt._`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:ji.DiscrError.Tag,tag:c,tagName:a})),e.ok(u);function l(){let f=p();t.if(!1);for(let h in f)t.elseIf(qt._`${c} === ${h}`),t.assign(u,d(f[h]));t.else(),e.error(!1,{discrError:ji.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function d(f){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(g,qt.Name),h}function p(){var f;let h={},g=y(n),v=!0;for(let I=0;I<i.length;I++){let E=i[I];if((E===null||E===void 0?void 0:E.$ref)&&!x1.schemaHasRulesButRef(E,s.self.RULES)){let ke=E.$ref;if(E=Ch.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,ke),E instanceof Ch.SchemaEnv)E=E.schema;if(E===void 0)throw new w1.default(s.opts.uriResolver,s.baseId,ke)}let Se=(f=E===null||E===void 0?void 0:E.properties)===null||f===void 0?void 0:f[a];if(typeof Se!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);v=v&&(g||y(E)),R(Se,I)}if(!v)throw Error(`discriminator: "${a}" must be required`);return h;function y({required:I}){return Array.isArray(I)&&I.includes(a)}function R(I,E){if(I.const)T(I.const,E);else if(I.enum)for(let Se of I.enum)T(Se,E);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function T(I,E){if(typeof I!="string"||I in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[I]=E}}}};jh.default=S1});var Zh=b(function(qC,P1){P1.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 Zi=b(function(_e,Ai){Object.defineProperty(_e,"__esModule",{value:!0});_e.MissingRefError=_e.ValidationError=_e.CodeGen=_e.Name=_e.nil=_e.stringify=_e.str=_e._=_e.KeywordCxt=_e.Ajv=void 0;var E1=Lf(),T1=Th(),R1=Ah(),qh=Zh(),O1=["/properties"],pn="http://json-schema.org/draft-07/schema";class Fr extends E1.default{_addVocabularies(){if(super._addVocabularies(),T1.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(R1.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(qh,O1):qh;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)}}_e.Ajv=Fr;Ai.exports=_e=Fr;Ai.exports.Ajv=Fr;Object.defineProperty(_e,"__esModule",{value:!0});_e.default=Fr;var I1=Rr();Object.defineProperty(_e,"KeywordCxt",{enumerable:!0,get:function(){return I1.KeywordCxt}});var Mt=C();Object.defineProperty(_e,"_",{enumerable:!0,get:function(){return Mt._}});Object.defineProperty(_e,"str",{enumerable:!0,get:function(){return Mt.str}});Object.defineProperty(_e,"stringify",{enumerable:!0,get:function(){return Mt.stringify}});Object.defineProperty(_e,"nil",{enumerable:!0,get:function(){return Mt.nil}});Object.defineProperty(_e,"Name",{enumerable:!0,get:function(){return Mt.Name}});Object.defineProperty(_e,"CodeGen",{enumerable:!0,get:function(){return Mt.CodeGen}});var N1=Vo();Object.defineProperty(_e,"ValidationError",{enumerable:!0,get:function(){return N1.default}});var C1=Or();Object.defineProperty(_e,"MissingRefError",{enumerable:!0,get:function(){return C1.default}})});var Bh=b(function(Jh){Object.defineProperty(Jh,"__esModule",{value:!0});Jh.formatNames=Jh.fastFormats=Jh.fullFormats=void 0;function qe(e,t){return{validate:e,compare:t}}Jh.fullFormats={date:qe(Uh,Li),time:qe(Mi(!0),Ui),"date-time":qe(Mh(!0),Vh),"iso-time":qe(Mi(),Fh),"iso-date-time":qe(Mh(),Hh),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:U1,"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:G1,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:F1,int32:{type:"number",validate:J1},int64:{type:"number",validate:K1},float:{type:"number",validate:Lh},double:{type:"number",validate:Lh},password:!0,binary:!0};Jh.fastFormats={...Jh.fullFormats,date:qe(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Li),time:qe(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ui),"date-time":qe(/^\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,Vh),"iso-time":qe(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Fh),"iso-date-time":qe(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Hh),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Jh.formatNames=Object.keys(Jh.fullFormats);function Z1(e){return e%4===0&&(e%100!==0||e%400===0)}var q1=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,M1=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Uh(e){let t=q1.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&Z1(r)?29:M1[o])}function Li(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var qi=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Mi(e){return function(r){let o=qi.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],u=o[5]==="-"?-1:1,c=+(o[6]||0),l=+(o[7]||0);if(c>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*u,p=n-c*u-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function Ui(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function Fh(e,t){if(!(e&&t))return;let r=qi.exec(e),o=qi.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var Di=/t|\s/i;function Mh(e){let t=Mi(e);return function(o){let n=o.split(Di);return n.length===2&&Uh(n[0])&&t(n[1])}}function Vh(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function Hh(e,t){if(!(e&&t))return;let[r,o]=e.split(Di),[n,s]=t.split(Di),i=Li(r,n);if(i===void 0)return;return i||Ui(o,s)}var D1=/\/|:/,L1=/^(?:[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 U1(e){return D1.test(e)&&L1.test(e)}var Dh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function F1(e){return Dh.lastIndex=0,Dh.test(e)}var V1=-2147483648,H1=2147483647;function J1(e){return Number.isInteger(e)&&e<=H1&&e>=V1}function K1(e){return Number.isInteger(e)}function Lh(){return!0}var B1=/[^\\]\\Z/;function G1(e){if(B1.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Wh=b(function(Gh){Object.defineProperty(Gh,"__esModule",{value:!0});Gh.formatLimitDefinition=void 0;var X1=Zi(),Ie=C(),lt=Ie.operators,fn={formatMaximum:{okStr:"<=",ok:lt.LTE,fail:lt.GT},formatMinimum:{okStr:">=",ok:lt.GTE,fail:lt.LT},formatExclusiveMaximum:{okStr:"<",ok:lt.LT,fail:lt.GTE},formatExclusiveMinimum:{okStr:">",ok:lt.GT,fail:lt.LTE}},Y1={message:({keyword:e,schemaCode:t})=>Ie.str`should be ${fn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ie._`{comparison: ${fn[e].okStr}, limit: ${t}}`};Gh.formatLimitDefinition={keyword:Object.keys(fn),type:"string",schemaType:"string",$data:!0,error:Y1,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let u=new X1.KeywordCxt(s,a.RULES.all.format.definition,"format");if(u.$data)c();else l();function c(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",Ie._`${p}[${u.schemaCode}]`);e.fail$data(Ie.or(Ie._`typeof ${f} != "object"`,Ie._`${f} instanceof RegExp`,Ie._`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=u.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw Error(`"${n}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:f,code:i.code.formats?Ie._`${i.code.formats}${Ie.getProperty(p)}`:void 0});e.fail$data(d(h))}function d(p){return Ie._`${p}.compare(${r}, ${o}) ${fn[n].fail} 0`}},dependencies:["format"]};var Q1=(e)=>(e.addKeyword(Gh.formatLimitDefinition),e);Gh.default=Q1});var eg=b(function(Vr,Qh){Object.defineProperty(Vr,"__esModule",{value:!0});var Dt=Bh(),tk=Wh(),Hi=C(),Xh=new Hi.Name("fullFormats"),rk=new Hi.Name("fastFormats"),Ji=(e,t={keywords:!0})=>{if(Array.isArray(t))return Yh(e,t,Dt.fullFormats,Xh),e;let[r,o]=t.mode==="fast"?[Dt.fastFormats,rk]:[Dt.fullFormats,Xh],n=t.formats||Dt.formatNames;if(Yh(e,n,r,o),t.keywords)(0,tk.default)(e);return e};Ji.get=(e,t="full")=>{let o=(t==="fast"?Dt.fastFormats:Dt.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function Yh(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=Hi._`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}Qh.exports=Vr=Ji;Object.defineProperty(Vr,"__esModule",{value:!0});Vr.default=Ji});var ag=b(function(ij,ig){ig.exports=sg;sg.sync=ik;var og=Ge("fs");function sk(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r)return!0;if(r=r.split(";"),r.indexOf("")!==-1)return!0;for(var o=0;o<r.length;o++){var n=r[o].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function ng(e,t,r){if(!e.isSymbolicLink()&&!e.isFile())return!1;return sk(t,r)}function sg(e,t,r){og.stat(e,function(o,n){r(o,o?!1:ng(n,e,t))})}function ik(e,t){return ng(og.statSync(e),e,t)}});var pg=b(function(aj,dg){dg.exports=ug;ug.sync=ak;var cg=Ge("fs");function ug(e,t,r){cg.stat(e,function(o,n){r(o,o?!1:lg(n,t))})}function ak(e,t){return lg(cg.statSync(e),t)}function lg(e,t){return e.isFile()&&ck(e,t)}function ck(e,t){var{mode:r,uid:o,gid:n}=e,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,d=r&c||r&u&&n===i||r&a&&o===s||r&l&&s===0;return d}});var mg=b(function(uj,fg){var cj=Ge("fs"),_n;if(process.platform==="win32"||global.TESTING_WINDOWS)_n=ag();else _n=pg();fg.exports=Gi;Gi.sync=uk;function Gi(e,t,r){if(typeof t==="function")r=t,t={};if(!r){if(typeof Promise!=="function")throw TypeError("callback not provided");return new Promise(function(o,n){Gi(e,t||{},function(s,i){if(s)n(s);else o(i)})})}_n(e,t||{},function(o,n){if(o){if(o.code==="EACCES"||t&&t.ignoreErrors)o=null,n=!1}r(o,n)})}function uk(e,t){try{return _n.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;else throw r}}});var $g=b(function(lj,bg){var Lt=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",hg=Ge("path"),lk=Lt?";":":",gg=mg(),_g=(e)=>Object.assign(Error(`not found: ${e}`),{code:"ENOENT"}),yg=(e,t)=>{let r=t.colon||lk,o=e.match(/\//)||Lt&&e.match(/\\/)?[""]:[...Lt?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=Lt?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Lt?n.split(r):[""];if(Lt){if(e.indexOf(".")!==-1&&s[0]!=="")s.unshift("")}return{pathEnv:o,pathExt:s,pathExtExe:n}},vg=(e,t,r)=>{if(typeof t==="function")r=t,t={};if(!t)t={};let{pathEnv:o,pathExt:n,pathExtExe:s}=yg(e,t),i=[],a=(c)=>new Promise((l,d)=>{if(c===o.length)return t.all&&i.length?l(i):d(_g(e));let p=o[c],f=/^".*"$/.test(p)?p.slice(1,-1):p,h=hg.join(f,e),g=!f&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;l(u(g,c,0))}),u=(c,l,d)=>new Promise((p,f)=>{if(d===n.length)return p(a(l+1));let h=n[d];gg(c+h,{pathExt:s},(g,v)=>{if(!g&&v)if(t.all)i.push(c+h);else return p(c+h);return p(u(c,l,d+1))})});return r?a(0).then((c)=>r(null,c),r):a(0)},dk=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:o,pathExtExe:n}=yg(e,t),s=[];for(let i=0;i<r.length;i++){let a=r[i],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=hg.join(u,e),l=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let d=0;d<o.length;d++){let p=l+o[d];try{if(gg.sync(p,{pathExt:n}))if(t.all)s.push(p);else return p}catch(f){}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw _g(e)};bg.exports=vg;vg.sync=dk});var xg=b(function(dj,Wi){var wg=(e={})=>{let t=e.env||process.env;if((e.platform||process.platform)!=="win32")return"PATH";return Object.keys(t).reverse().find((o)=>o.toUpperCase()==="PATH")||"Path"};Wi.exports=wg;Wi.exports.default=wg});var Pg=b(function(pj,kg){var Sg=Ge("path"),pk=$g(),fk=xg();function zg(e,t){let r=e.options.env||process.env,o=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch(a){}let i;try{i=pk.sync(e.command,{path:r[fk({env:r})],pathExt:t?Sg.delimiter:void 0})}catch(a){}finally{if(s)process.chdir(o)}if(i)i=Sg.resolve(n?e.options.cwd:"",i);return i}function mk(e){return zg(e)||zg(e,!0)}kg.exports=mk});var Eg=b(function(_k,Yi){var Xi=/([()\][%!^"`<>&|;, *?])/g;function hk(e){return e=e.replace(Xi,"^$1"),e}function gk(e,t){if(e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(Xi,"^$1"),t)e=e.replace(Xi,"^$1");return e}_k.command=hk;_k.argument=gk});var Rg=b(function(fj,Tg){Tg.exports=/^#!(.*)/});var Ig=b(function(mj,Og){var bk=Rg();Og.exports=(e="")=>{let t=e.match(bk);if(!t)return null;let[r,o]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();if(n==="env")return o;return o?`${n} ${o}`:n}});var Cg=b(function(hj,Ng){var Qi=Ge("fs"),$k=Ig();function wk(e){let r=Buffer.alloc(150),o;try{o=Qi.openSync(e,"r"),Qi.readSync(o,r,0,150,0),Qi.closeSync(o)}catch(n){}return $k(r.toString())}Ng.exports=wk});var qg=b(function(gj,Zg){var xk=Ge("path"),jg=Pg(),Ag=Eg(),zk=Cg(),Sk=process.platform==="win32",kk=/\.(?:com|exe)$/i,Pk=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Ek(e){e.file=jg(e);let t=e.file&&zk(e.file);if(t)return e.args.unshift(e.file),e.command=t,jg(e);return e.file}function Tk(e){if(!Sk)return e;let t=Ek(e),r=!kk.test(t);if(e.options.forceShell||r){let o=Pk.test(t);e.command=xk.normalize(e.command),e.command=Ag.command(e.command),e.args=e.args.map((s)=>Ag.argument(s,o));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Rk(e,t,r){if(t&&!Array.isArray(t))r=t,t=null;t=t?t.slice(0):[],r=Object.assign({},r);let o={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?o:Tk(o)}Zg.exports=Rk});var Lg=b(function(_j,Dg){var ea=process.platform==="win32";function ta(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function Ok(e,t){if(!ea)return;let r=e.emit;e.emit=function(o,n){if(o==="exit"){let s=Mg(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function Mg(e,t){if(ea&&e===1&&!t.file)return ta(t.original,"spawn");return null}function Ik(e,t){if(ea&&e===1&&!t.file)return ta(t.original,"spawnSync");return null}Dg.exports={hookChildProcess:Ok,verifyENOENT:Mg,verifyENOENTSync:Ik,notFoundError:ta}});var Vg=b(function(yj,Ut){var Ug=Ge("child_process"),ra=qg(),oa=Lg();function Fg(e,t,r){let o=ra(e,t,r),n=Ug.spawn(o.command,o.args,o.options);return oa.hookChildProcess(n,o),n}function Nk(e,t,r){let o=ra(e,t,r),n=Ug.spawnSync(o.command,o.args,o.options);return n.error=n.error||oa.verifyENOENTSync(n.status,o),n}Ut.exports=Fg;Ut.exports.spawn=Fg;Ut.exports.sync=Nk;Ut.exports._parse=ra;Ut.exports._enoent=oa});var Wk=Object.freeze({status:"aborted"});function _(e,t,r){function o(a,u){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);let c=i.prototype,l=Object.keys(c);for(let d=0;d<l.length;d++){let p=l[d];if(!(p in a))a[p]=c[p].bind(a)}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var u;let c=r?.Parent?new s:this;o(c,a),(u=c._zod).deferred??(u.deferred=[]);for(let l of c._zod.deferred)l();return c}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var Xk=Symbol("zod_brand");class Me extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Jt extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}var Br={};function be(e){if(e)Object.assign(Br,e);return Br}function Wr(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function En(e,t="|"){return e.map((r)=>In(r)).join(t)}function Kt(e,t){if(typeof t==="bigint")return t.toString();return t}function Bt(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function Xr(e){return e===null||e===void 0}function Yr(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function ga(e,t){let r=(e.toString().split(".")[1]||"").length,o=t.toString(),n=(o.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(o)){let u=o.match(/\d?e-(\d?)/);if(u?.[1])n=Number.parseInt(u[1])}let s=r>n?r:n,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}var ha=Symbol("evaluating");function M(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===ha)return;if(o===void 0)o=ha,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function pt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function We(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function Tn(e){return JSON.stringify(e)}function _a(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Rn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function zt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var ya=Bt(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ft(e){if(zt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(zt(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function On(e){if(ft(e))return{...e};if(Array.isArray(e))return[...e];return e}var va=new Set(["string","number","symbol"]);function Xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ne(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function z(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function In(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ba(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var $a={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function s_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=We(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;i[a]=r.shape[a]}return pt(this,"shape",i),i},checks:[]});return Ne(e,s)}function i_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=We(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete i[a]}return pt(this,"shape",i),i},checks:[]});return Ne(e,s)}function a_(e,t){if(!ft(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=We(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return pt(this,"shape",s),s}});return Ne(e,n)}function c_(e,t){if(!ft(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=We(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return pt(this,"shape",o),o}});return Ne(e,r)}function u_(e,t){let r=We(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return pt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return Ne(e,r)}function l_(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=We(t._zod.def,{get shape(){let a=t._zod.def.shape,u={...a};if(r)for(let c in r){if(!(c in a))throw Error(`Unrecognized key: "${c}"`);if(!r[c])continue;u[c]=e?new e({type:"optional",innerType:a[c]}):a[c]}else for(let c in a)u[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return pt(this,"shape",u),u},checks:[]});return Ne(t,i)}function d_(e,t,r){let o=We(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;s[i]=new e({type:"nonoptional",innerType:n[i]})}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return pt(this,"shape",s),s}});return Ne(t,o)}function mt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ye(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Gr(e){return typeof e==="string"?e:e?.message}function Ce(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=Gr(e.inst?._zod.def?.error?.(e))??Gr(t?.error?.(e))??Gr(r.customError?.(e))??Gr(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function Qr(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function wa(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ht(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var xa=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Kt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eo=_("$ZodError",xa),Nn=_("$ZodError",xa,{Parent:Error});function za(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Sa(e,t=(r)=>r.message){let r={_errors:[]},o=(n)=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((i)=>o({issues:i}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;while(a<s.path.length){let u=s.path[a];if(a!==s.path.length-1)i[u]=i[u]||{_errors:[]};else i[u]=i[u]||{_errors:[]},i[u]._errors.push(t(s));i=i[u],a++}}};return o(e),r}var to=(e)=>(t,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Me;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((u)=>Ce(u,s,be())));throw Rn(a,n?.callee),a}return i.value};var ro=(e)=>async(t,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((u)=>Ce(u,s,be())));throw Rn(a,n?.callee),a}return i.value};var Gt=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Me;return s.issues.length?{success:!1,error:new(e??eo)(s.issues.map((i)=>Ce(i,n,be())))}:{success:!0,data:s.value}},Wt=Gt(Nn),Xt=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>Ce(i,n,be())))}:{success:!0,data:s.value}},oo=Xt(Nn),ka=(e)=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return to(e)(t,r,n)};var Pa=(e)=>(t,r,o)=>to(e)(t,r,o);var Ea=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ro(e)(t,r,n)};var Ta=(e)=>async(t,r,o)=>ro(e)(t,r,o);var Ra=(e)=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Gt(e)(t,r,n)};var Oa=(e)=>(t,r,o)=>Gt(e)(t,r,o);var Ia=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Xt(e)(t,r,n)};var Na=(e)=>async(t,r,o)=>Xt(e)(t,r,o);var Ca=/^[cC][^\s-]{8,}$/,ja=/^[0-9a-z]+$/,Aa=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Za=/^[0-9a-vA-V]{20}$/,qa=/^[A-Za-z0-9]{27}$/,Ma=/^[a-zA-Z0-9_-]{21}$/,Da=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var La=/^([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})$/,Cn=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Ua=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var f_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Fa(){return new RegExp(f_,"u")}var Va=/^(?:(?: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])$/,Ha=/^(([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 Ja=/^((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])$/,Ka=/^(([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])$/,Ba=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jn=/^[A-Za-z0-9_-]*$/;var Ga=/^\+[1-9]\d{6,14}$/,Wa="(?:(?:\\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])))",Xa=new RegExp(`^${Wa}$`);function Ya(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Qa(e){return new RegExp(`^${Ya(e)}$`)}function ec(e){let t=Ya({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${Wa}T(?:${o})$`)}var tc=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var rc=/^-?\d+$/,An=/^-?\d+(?:\.\d+)?$/,oc=/^(?:true|false)$/i,nc=/^null$/i;var sc=/^[^A-Z]*$/,ic=/^[^a-z]*$/;var te=_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ac={number:"number",bigint:"bigint",object:"date"},Zn=_("$ZodCheckLessThan",(e,t)=>{te.init(e,t);let r=ac[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qn=_("$ZodCheckGreaterThan",(e,t)=>{te.init(e,t);let r=ac[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cc=_("$ZodCheckMultipleOf",(e,t)=>{te.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):ga(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),uc=_("$ZodCheckNumberFormat",(e,t)=>{te.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=$a[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=s,r)a.pattern=rc}),e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(a<n)i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var lc=_("$ZodCheckMaxLength",(e,t)=>{var r;te.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Xr(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let i=Qr(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),dc=_("$ZodCheckMinLength",(e,t)=>{var r;te.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Xr(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let i=Qr(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),pc=_("$ZodCheckLengthEquals",(e,t)=>{var r;te.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!Xr(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,s=n.length;if(s===t.length)return;let i=Qr(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Yt=_("$ZodCheckStringFormat",(e,t)=>{var r,o;if(te.init(e,t),e._zod.onattach.push((n)=>{let s=n._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),fc=_("$ZodCheckRegex",(e,t)=>{Yt.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),mc=_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sc),Yt.init(e,t)}),hc=_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ic),Yt.init(e,t)}),gc=_("$ZodCheckIncludes",(e,t)=>{te.init(e,t);let r=Xe(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),_c=_("$ZodCheckStartsWith",(e,t)=>{te.init(e,t);let r=new RegExp(`^${Xe(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),yc=_("$ZodCheckEndsWith",(e,t)=>{te.init(e,t);let r=new RegExp(`.*${Xe(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var vc=_("$ZodCheckOverwrite",(e,t)=>{te.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class Mn{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
8
|
+
deps: ${r}}`};var bS={keyword:"dependencies",type:"object",schemaType:"object",error:Th.error,code(e){let[t,r]=$S(e);Ph(e,t),Eh(e,r)}};function $S({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function Ph(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let s=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let u=tt.propertyInData(r,o,i,n.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors)r.if(u,()=>{for(let c of a)tt.checkReportMissingProp(e,c)});else r.if(_r._`${u} && (${tt.checkMissingProp(e,a,s)})`),tt.reportMissingProp(e,s),r.else()}}Th.validatePropertyDeps=Ph;function Eh(e,t=e.schema){let{gen:r,data:o,keyword:n,it:s}=e,i=r.name("valid");for(let a in t){if(kh.alwaysValidSchema(s,t[a]))continue;r.if(tt.propertyInData(r,o,a,s.opts.ownProperties),()=>{let u=e.subschema({keyword:n,schemaProp:a},i);e.mergeValidEvaluated(u,i)},()=>r.var(i,!0)),e.ok(i)}}Th.validateSchemaDeps=Eh;Th.default=bS});var jh=w(function(Ch){Object.defineProperty(Ch,"__esModule",{value:!0});var jn=M(),Nh=L(),zS={message:"property name must be valid",params:({params:e})=>jn._`{propertyName: ${e.propertyName}}`},SS={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:zS,code(e){let{gen:t,schema:r,data:o,it:n}=e;if(Nh.alwaysValidSchema(n,r))return;let s=t.name("valid");t.forIn("key",o,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),t.if(jn.not(s),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(s)}};Ch.default=SS});var sa=w(function(Ah){Object.defineProperty(Ah,"__esModule",{value:!0});var Ct=Ce(),ae=M(),PS=ut(),jt=L(),ES={message:"must NOT have additional properties",params:({params:e})=>ae._`{additionalProperty: ${e.additionalProperty}}`},TS={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:ES,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=e;if(!s)throw Error("ajv implementation error");let{allErrors:a,opts:u}=i;if(i.props=!0,u.removeAdditional!=="all"&&jt.alwaysValidSchema(i,r))return;let c=Ct.allSchemaProperties(o.properties),l=Ct.allSchemaProperties(o.patternProperties);p(),e.ok(ae._`${s} === ${PS.default.errors}`);function p(){t.forIn("key",n,(b)=>{if(!c.length&&!l.length)h(b);else t.if(d(b),()=>h(b))})}function d(b){let v;if(c.length>8){let C=jt.schemaRefOrVal(i,o.properties,"properties");v=Ct.isOwnProperty(t,C,b)}else if(c.length)v=ae.or(...c.map((C)=>ae._`${b} === ${C}`));else v=ae.nil;if(l.length)v=ae.or(v,...l.map((C)=>ae._`${Ct.usePattern(e,C)}.test(${b})`));return ae.not(v)}function f(b){t.code(ae._`delete ${n}[${b}]`)}function h(b){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){f(b);return}if(r===!1){if(e.setParams({additionalProperty:b}),e.error(),!a)t.break();return}if(typeof r=="object"&&!jt.alwaysValidSchema(i,r)){let v=t.name("valid");if(u.removeAdditional==="failing")g(b,v,!1),t.if(ae.not(v),()=>{e.reset(),f(b)});else if(g(b,v),!a)t.if(ae.not(v),()=>t.break())}}function g(b,v,C){let N={keyword:"additionalProperties",dataProp:b,dataPropType:jt.Type.Str};if(C===!1)Object.assign(N,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(N,v)}}};Ah.default=TS});var Dh=w(function(Mh){Object.defineProperty(Mh,"__esModule",{value:!0});var qh=lo(),An=Ce(),yr=L(),Zh=sa(),OS={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:s}=e;if(s.opts.removeAdditional==="all"&&o.additionalProperties===void 0)Zh.default.code(new qh.KeywordCxt(s,Zh.default,"additionalProperties"));let i=An.allSchemaProperties(r);for(let p of i)s.definedProperties.add(p);if(s.opts.unevaluated&&i.length&&s.props!==!0)s.props=yr.mergeEvaluated.props(t,yr.toHash(i),s.props);let a=i.filter((p)=>!yr.alwaysValidSchema(s,r[p]));if(a.length===0)return;let u=t.name("valid");for(let p of a){if(c(p))l(p);else{if(t.if(An.propertyInData(t,n,p,s.opts.ownProperties)),l(p),!s.allErrors)t.else().var(u,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(u)}function c(p){return s.opts.useDefaults&&!s.compositeRule&&r[p].default!==void 0}function l(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},u)}}};Mh.default=OS});var Uh=w(function(Lh){Object.defineProperty(Lh,"__esModule",{value:!0});var Zn=Ce(),At=M(),qn=L(),Mn=L(),NS={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:s}=e,{opts:i}=s,a=Zn.allSchemaProperties(r),u=a.filter((g)=>qn.alwaysValidSchema(s,r[g]));if(a.length===0||u.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let c=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=t.name("valid");if(s.props!==!0&&!(s.props instanceof At.Name))s.props=Mn.evaluatedPropsToName(t,s.props);let{props:p}=s;d();function d(){for(let g of a){if(c)f(g);if(s.allErrors)h(g);else t.var(l,!0),h(g),t.if(l)}}function f(g){for(let b in c)if(new RegExp(g).test(b))qn.checkStrictMode(s,`property ${b} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",o,(b)=>{t.if(At._`${Zn.usePattern(e,g)}.test(${b})`,()=>{let v=u.includes(g);if(!v)e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:b,dataPropType:Mn.Type.Str},l);if(s.opts.unevaluated&&p!==!0)t.assign(At._`${p}[${b}]`,!0);else if(!v&&!s.allErrors)t.if(At.not(l),()=>t.break())})})}}};Lh.default=NS});var Hh=w(function(Vh){Object.defineProperty(Vh,"__esModule",{value:!0});var Fh=L(),jS={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if(Fh.alwaysValidSchema(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};Vh.default=jS});var Bh=w(function(Kh){Object.defineProperty(Kh,"__esModule",{value:!0});var Jh=Ce(),ZS={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Jh.validateUnion,error:{message:"must match a schema in anyOf"}};Kh.default=ZS});var Xh=w(function(Wh){Object.defineProperty(Wh,"__esModule",{value:!0});var Zt=M(),Gh=L(),MS={message:"must match exactly one schema in oneOf",params:({params:e})=>Zt._`{passingSchemas: ${e.passing}}`},DS={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:MS,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=t.let("valid",!1),a=t.let("passing",null),u=t.name("_valid");e.setParams({passing:a}),t.block(c),e.result(i,()=>e.reset(),()=>e.error(!0));function c(){s.forEach((l,p)=>{let d;if(Gh.alwaysValidSchema(n,l))t.var(u,!0);else d=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},u);if(p>0)t.if(Zt._`${u} && ${i}`).assign(i,!1).assign(a,Zt._`[${a}, ${p}]`).else();t.if(u,()=>{if(t.assign(i,!0),t.assign(a,p),d)e.mergeEvaluated(d,Zt.Name)})})}}};Wh.default=DS});var eg=w(function(Qh){Object.defineProperty(Qh,"__esModule",{value:!0});var Yh=L(),US={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((s,i)=>{if(Yh.alwaysValidSchema(o,s))return;let a=e.subschema({keyword:"allOf",schemaProp:i},n);e.ok(n),e.mergeEvaluated(a)})}};Qh.default=US});var og=w(function(rg){Object.defineProperty(rg,"__esModule",{value:!0});var qt=M(),Dn=L(),VS={message:({params:e})=>qt.str`must match "${e.ifClause}" schema`,params:({params:e})=>qt._`{failingKeyword: ${e.ifClause}}`},HS={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:VS,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)Dn.checkStrictMode(o,'"if" without "then" and "else" is ignored');let n=tg(o,"then"),s=tg(o,"else");if(!n&&!s)return;let i=t.let("valid",!0),a=t.name("_valid");if(u(),e.reset(),n&&s){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(a,c("then",l),c("else",l))}else if(n)t.if(a,c("then"));else t.if(qt.not(a),c("else"));e.pass(i,()=>e.error(!0));function u(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(l)}function c(l,p){return()=>{let d=e.subschema({keyword:l},a);if(t.assign(i,a),e.mergeValidEvaluated(d,i),p)t.assign(p,qt._`${l}`);else e.setParams({ifClause:l})}}}};function tg(e,t){let r=e.schema[t];return r!==void 0&&!Dn.alwaysValidSchema(e,r)}rg.default=HS});var ig=w(function(sg){Object.defineProperty(sg,"__esModule",{value:!0});var ng=L(),KS={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)ng.checkStrictMode(r,`"${e}" without "if" is ignored`)}};sg.default=KS});var cg=w(function(ag){Object.defineProperty(ag,"__esModule",{value:!0});var GS=oa(),WS=yh(),XS=na(),YS=xh(),QS=Sh(),ek=Ih(),tk=jh(),rk=sa(),ok=Dh(),nk=Uh(),sk=Hh(),ik=Bh(),ak=Xh(),ck=eg(),uk=og(),lk=ig();function pk(e=!1){let t=[sk.default,ik.default,ak.default,ck.default,uk.default,lk.default,tk.default,rk.default,ek.default,ok.default,nk.default];if(e)t.push(WS.default,YS.default);else t.push(GS.default,XS.default);return t.push(QS.default),t}ag.default=pk});var lg=w(function(ug){Object.defineProperty(ug,"__esModule",{value:!0});var Z=M(),fk={message:({schemaCode:e})=>Z.str`must match format "${e}"`,params:({schemaCode:e})=>Z._`{format: ${e}}`},mk={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:fk,code(e,t){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=e,{opts:u,errSchemaPath:c,schemaEnv:l,self:p}=a;if(!u.validateFormats)return;if(n)d();else f();function d(){let h=r.scopeValue("formats",{ref:p.formats,code:u.code.formats}),g=r.const("fDef",Z._`${h}[${i}]`),b=r.let("fType"),v=r.let("format");r.if(Z._`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(b,Z._`${g}.type || "string"`).assign(v,Z._`${g}.validate`),()=>r.assign(b,Z._`"string"`).assign(v,g)),e.fail$data(Z.or(C(),N()));function C(){if(u.strictSchema===!1)return Z.nil;return Z._`${i} && !${v}`}function N(){let q=l.$async?Z._`(${g}.async ? await ${v}(${o}) : ${v}(${o}))`:Z._`${v}(${o})`,O=Z._`(typeof ${v} == "function" ? ${q} : ${v}.test(${o}))`;return Z._`${v} && ${v} !== true && ${b} === ${t} && !${O}`}}function f(){let h=p.formats[s];if(!h){C();return}if(h===!0)return;let[g,b,v]=N(h);if(g===t)e.pass(q());function C(){if(u.strictSchema===!1){p.logger.warn(O());return}throw Error(O());function O(){return`unknown format "${s}" ignored in schema at path "${c}"`}}function N(O){let qe=O instanceof RegExp?Z.regexpCode(O):u.code.formats?Z._`${u.code.formats}${Z.getProperty(s)}`:void 0,Me=r.scopeValue("formats",{key:s,ref:O,code:qe});if(typeof O=="object"&&!(O instanceof RegExp))return[O.type||"string",O.validate,Z._`${Me}.validate`];return["string",O,Me]}function q(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw Error("async format in sync schema");return Z._`await ${v}(${o})`}return typeof b=="function"?Z._`${v}(${o})`:Z._`${v}.test(${o})`}}}};ug.default=mk});var dg=w(function(pg){Object.defineProperty(pg,"__esModule",{value:!0});var gk=lg(),_k=[gk.default];pg.default=_k});var hg=w(function(fg){Object.defineProperty(fg,"__esModule",{value:!0});fg.contentVocabulary=fg.metadataVocabulary=void 0;fg.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];fg.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var _g=w(function(gg){Object.defineProperty(gg,"__esModule",{value:!0});var bk=Em(),$k=ch(),wk=cg(),xk=dg(),Ln=hg(),zk=[bk.default,$k.default,(0,wk.default)(),xk.default,Ln.metadataVocabulary,Ln.contentVocabulary];gg.default=zk});var $g=w(function(vg){Object.defineProperty(vg,"__esModule",{value:!0});vg.DiscrError=void 0;var yg;(function(e){e.Tag="tag",e.Mapping="mapping"})(yg||(vg.DiscrError=yg={}))});var zg=w(function(xg){Object.defineProperty(xg,"__esModule",{value:!0});var Ae=M(),vr=$g(),Un=wn(),kk=po(),wg=L(),Pk={message:({params:{discrError:e,tagName:t}})=>e===vr.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Ae._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},Ek={keyword:"discriminator",type:"object",schemaType:"object",error:Pk,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:s}=e,{oneOf:i}=n;if(!s.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let u=t.let("valid",!1),c=t.const("tag",Ae._`${r}${Ae.getProperty(a)}`);t.if(Ae._`typeof ${c} == "string"`,()=>l(),()=>e.error(!1,{discrError:vr.DiscrError.Tag,tag:c,tagName:a})),e.ok(u);function l(){let f=d();t.if(!1);for(let h in f)t.elseIf(Ae._`${c} === ${h}`),t.assign(u,p(f[h]));t.else(),e.error(!1,{discrError:vr.DiscrError.Mapping,tag:c,tagName:a}),t.endIf()}function p(f){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(g,Ae.Name),h}function d(){var f;let h={},g=v(n),b=!0;for(let q=0;q<i.length;q++){let O=i[q];if((O===null||O===void 0?void 0:O.$ref)&&!wg.schemaHasRulesButRef(O,s.self.RULES)){let Me=O.$ref;if(O=Un.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Me),O instanceof Un.SchemaEnv)O=O.schema;if(O===void 0)throw new kk.default(s.opts.uriResolver,s.baseId,Me)}let qe=(f=O===null||O===void 0?void 0:O.properties)===null||f===void 0?void 0:f[a];if(typeof qe!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);b=b&&(g||v(O)),C(qe,q)}if(!b)throw Error(`discriminator: "${a}" must be required`);return h;function v({required:q}){return Array.isArray(q)&&q.includes(a)}function C(q,O){if(q.const)N(q.const,O);else if(q.enum)for(let qe of q.enum)N(qe,O);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function N(q,O){if(typeof q!="string"||q in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[q]=O}}}};xg.default=Ek});var Sg=w(function(qC,Rk){Rk.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=w(function(Pe,ia){Object.defineProperty(Pe,"__esModule",{value:!0});Pe.MissingRefError=Pe.ValidationError=Pe.CodeGen=Pe.Name=Pe.nil=Pe.stringify=Pe.str=Pe._=Pe.KeywordCxt=Pe.Ajv=void 0;var Ok=bm(),Ik=_g(),Nk=zg(),kg=Sg(),Ck=["/properties"],Fn="http://json-schema.org/draft-07/schema";class ho extends Ok.default{_addVocabularies(){if(super._addVocabularies(),Ik.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(Nk.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(kg,Ck):kg;this.addMetaSchema(e,Fn,!1),this.refs["http://json-schema.org/schema"]=Fn}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Fn)?Fn:void 0)}}Pe.Ajv=ho;ia.exports=Pe=ho;ia.exports.Ajv=ho;Object.defineProperty(Pe,"__esModule",{value:!0});Pe.default=ho;var jk=lo();Object.defineProperty(Pe,"KeywordCxt",{enumerable:!0,get:function(){return jk.KeywordCxt}});var br=M();Object.defineProperty(Pe,"_",{enumerable:!0,get:function(){return br._}});Object.defineProperty(Pe,"str",{enumerable:!0,get:function(){return br.str}});Object.defineProperty(Pe,"stringify",{enumerable:!0,get:function(){return br.stringify}});Object.defineProperty(Pe,"nil",{enumerable:!0,get:function(){return br.nil}});Object.defineProperty(Pe,"Name",{enumerable:!0,get:function(){return br.Name}});Object.defineProperty(Pe,"CodeGen",{enumerable:!0,get:function(){return br.CodeGen}});var Ak=vn();Object.defineProperty(Pe,"ValidationError",{enumerable:!0,get:function(){return Ak.default}});var Zk=po();Object.defineProperty(Pe,"MissingRefError",{enumerable:!0,get:function(){return Zk.default}})});var Ag=w(function(Cg){Object.defineProperty(Cg,"__esModule",{value:!0});Cg.formatNames=Cg.fastFormats=Cg.fullFormats=void 0;function rt(e,t){return{validate:e,compare:t}}Cg.fullFormats={date:rt(Rg,pa),time:rt(ua(!0),da),"date-time":rt(Pg(!0),Ig),"iso-time":rt(ua(),Og),"iso-date-time":rt(Pg(),Ng),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Hk,"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:Yk,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:Jk,int32:{type:"number",validate:Gk},int64:{type:"number",validate:Wk},float:{type:"number",validate:Tg},double:{type:"number",validate:Tg},password:!0,binary:!0};Cg.fastFormats={...Cg.fullFormats,date:rt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,pa),time:rt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,da),"date-time":rt(/^\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,Ig),"iso-time":rt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Og),"iso-date-time":rt(/^\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,Ng),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};Cg.formatNames=Object.keys(Cg.fullFormats);function Dk(e){return e%4===0&&(e%100!==0||e%400===0)}var Lk=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Uk=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Rg(e){let t=Lk.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&Dk(r)?29:Uk[o])}function pa(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var ca=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function ua(e){return function(r){let o=ca.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],u=o[5]==="-"?-1:1,c=+(o[6]||0),l=+(o[7]||0);if(c>23||l>59||e&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let p=s-l*u,d=n-c*u-(p<0?1:0);return(d===23||d===-1)&&(p===59||p===-1)&&i<61}}function da(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function Og(e,t){if(!(e&&t))return;let r=ca.exec(e),o=ca.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var la=/t|\s/i;function Pg(e){let t=ua(e);return function(o){let n=o.split(la);return n.length===2&&Rg(n[0])&&t(n[1])}}function Ig(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function Ng(e,t){if(!(e&&t))return;let[r,o]=e.split(la),[n,s]=t.split(la),i=pa(r,n);if(i===void 0)return;return i||da(o,s)}var Fk=/\/|:/,Vk=/^(?:[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 Hk(e){return Fk.test(e)&&Vk.test(e)}var Eg=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Jk(e){return Eg.lastIndex=0,Eg.test(e)}var Kk=-2147483648,Bk=2147483647;function Gk(e){return Number.isInteger(e)&&e<=Bk&&e>=Kk}function Wk(e){return Number.isInteger(e)}function Tg(){return!0}var Xk=/[^\\]\\Z/;function Yk(e){if(Xk.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var Mg=w(function(qg){Object.defineProperty(qg,"__esModule",{value:!0});qg.formatLimitDefinition=void 0;var Zg=aa(),ce=M(),Mt=ce.operators,Vn={formatMaximum:{okStr:"<=",ok:Mt.LTE,fail:Mt.GT},formatMinimum:{okStr:">=",ok:Mt.GTE,fail:Mt.LT},formatExclusiveMaximum:{okStr:"<",ok:Mt.LT,fail:Mt.GTE},formatExclusiveMinimum:{okStr:">",ok:Mt.GT,fail:Mt.LTE}},eP={message:({keyword:e,schemaCode:t})=>ce.str`should be ${Vn[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>ce._`{comparison: ${Vn[e].okStr}, limit: ${t}}`};qg.formatLimitDefinition={keyword:Object.keys(Vn),type:"string",schemaType:"string",$data:!0,error:eP,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:s}=e,{opts:i,self:a}=s;if(!i.validateFormats)return;let u=new Zg.KeywordCxt(s,a.RULES.all.format.definition,"format");if(u.$data)c();else l();function c(){let d=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",ce._`${d}[${u.schemaCode}]`);e.fail$data(ce.or(ce._`typeof ${f} != "object"`,ce._`${f} instanceof RegExp`,ce._`typeof ${f}.compare != "function"`,p(f)))}function l(){let d=u.schema,f=a.formats[d];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw Error(`"${n}": format "${d}" does not define "compare" function`);let h=t.scopeValue("formats",{key:d,ref:f,code:i.code.formats?ce._`${i.code.formats}${ce.getProperty(d)}`:void 0});e.fail$data(p(h))}function p(d){return ce._`${d}.compare(${r}, ${o}) ${Vn[n].fail} 0`}},dependencies:["format"]};var tP=(e)=>(e.addKeyword(qg.formatLimitDefinition),e);qg.default=tP});var Fg=w(function(go,Ug){Object.defineProperty(go,"__esModule",{value:!0});var Ze=Ag(),oP=Mg(),$r=M(),Dg=new $r.Name("fullFormats"),nP=new $r.Name("fastFormats"),ha=(e,t={keywords:!0})=>{if(Array.isArray(t))return Lg(e,t,Ze.fullFormats,Dg),e;let[r,o]=t.mode==="fast"?[Ze.fastFormats,nP]:[Ze.fullFormats,Dg],n=t.formats||Ze.formatNames;if(Lg(e,n,r,o),t.keywords)(0,oP.default)(e);return e};ha.get=(e,t="full")=>{let o=(t==="fast"?Ze.fastFormats:Ze.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function Lg(e,t,r,o){var n,s;(n=(s=e.opts.code).formats)!==null&&n!==void 0||(s.formats=$r._`require("ajv-formats/dist/formats").${o}`);for(let i of t)e.addFormat(i,r[i])}Ug.exports=go=ha;Object.defineProperty(go,"__esModule",{value:!0});go.default=ha});var Wg=w(function(ij,Gg){Gg.exports=Bg;Bg.sync=cP;var Jg=dt("fs");function aP(e,t){var r=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!r)return!0;if(r=r.split(";"),r.indexOf("")!==-1)return!0;for(var o=0;o<r.length;o++){var n=r[o].toLowerCase();if(n&&e.substr(-n.length).toLowerCase()===n)return!0}return!1}function Kg(e,t,r){if(!e.isSymbolicLink()&&!e.isFile())return!1;return aP(t,r)}function Bg(e,t,r){Jg.stat(e,function(o,n){r(o,o?!1:Kg(n,e,t))})}function cP(e,t){return Kg(Jg.statSync(e),e,t)}});var t_=w(function(aj,e_){e_.exports=Yg;Yg.sync=uP;var Xg=dt("fs");function Yg(e,t,r){Xg.stat(e,function(o,n){r(o,o?!1:Qg(n,t))})}function uP(e,t){return Qg(Xg.statSync(e),t)}function Qg(e,t){return e.isFile()&&lP(e,t)}function lP(e,t){var{mode:r,uid:o,gid:n}=e,s=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),i=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),a=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),l=a|u,p=r&c||r&u&&n===i||r&a&&o===s||r&l&&s===0;return p}});var o_=w(function(uj,r_){var cj=dt("fs"),Bn;if(process.platform==="win32"||global.TESTING_WINDOWS)Bn=Wg();else Bn=t_();r_.exports=ya;ya.sync=pP;function ya(e,t,r){if(typeof t==="function")r=t,t={};if(!r){if(typeof Promise!=="function")throw TypeError("callback not provided");return new Promise(function(o,n){ya(e,t||{},function(s,i){if(s)n(s);else o(i)})})}Bn(e,t||{},function(o,n){if(o){if(o.code==="EACCES"||t&&t.ignoreErrors)o=null,n=!1}r(o,n)})}function pP(e,t){try{return Bn.sync(e,t||{})}catch(r){if(t&&t.ignoreErrors||r.code==="EACCES")return!1;else throw r}}});var c_=w(function(lj,a_){var wr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Gn=dt("path"),dP=wr?";":":",va=o_(),n_=(e)=>Object.assign(Error(`not found: ${e}`),{code:"ENOENT"}),s_=(e,t)=>{let r=t.colon||dP,o=e.match(/\//)||wr&&e.match(/\\/)?[""]:[...wr?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(r)],n=wr?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=wr?n.split(r):[""];if(wr){if(e.indexOf(".")!==-1&&s[0]!=="")s.unshift("")}return{pathEnv:o,pathExt:s,pathExtExe:n}},i_=(e,t,r)=>{if(typeof t==="function")r=t,t={};if(!t)t={};let{pathEnv:o,pathExt:n,pathExtExe:s}=s_(e,t),i=[],a=(c)=>new Promise((l,p)=>{if(c===o.length)return t.all&&i.length?l(i):p(n_(e));let d=o[c],f=/^".*"$/.test(d)?d.slice(1,-1):d,h=Gn.join(f,e),g=!f&&/^\.[\\\/]/.test(e)?e.slice(0,2)+h:h;l(u(g,c,0))}),u=(c,l,p)=>new Promise((d,f)=>{if(p===n.length)return d(a(l+1));let h=n[p];va(c+h,{pathExt:s},(g,b)=>{if(!g&&b)if(t.all)i.push(c+h);else return d(c+h);return d(u(c,l,p+1))})});return r?a(0).then((c)=>r(null,c),r):a(0)},fP=(e,t)=>{t=t||{};let{pathEnv:r,pathExt:o,pathExtExe:n}=s_(e,t),s=[];for(let i=0;i<r.length;i++){let a=r[i],u=/^".*"$/.test(a)?a.slice(1,-1):a,c=Gn.join(u,e),l=!u&&/^\.[\\\/]/.test(e)?e.slice(0,2)+c:c;for(let p=0;p<o.length;p++){let d=l+o[p];try{if(va.sync(d,{pathExt:n}))if(t.all)s.push(d);else return d}catch(f){}}}if(t.all&&s.length)return s;if(t.nothrow)return null;throw n_(e)};a_.exports=i_;i_.sync=fP});var l_=w(function(pj,ba){var u_=(e={})=>{let t=e.env||process.env;if((e.platform||process.platform)!=="win32")return"PATH";return Object.keys(t).reverse().find((o)=>o.toUpperCase()==="PATH")||"Path"};ba.exports=u_;ba.exports.default=u_});var m_=w(function(dj,f_){var Wn=dt("path"),d_=c_(),mP=l_();function p_(e,t){let r=e.options.env||process.env,o=process.cwd(),n=e.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch(a){}let i;try{i=d_.sync(e.command,{path:r[mP({env:r})],pathExt:t?Wn.delimiter:void 0})}catch(a){}finally{if(s)process.chdir(o)}if(i)i=Wn.resolve(n?e.options.cwd:"",i);return i}function hP(e){return p_(e)||p_(e,!0)}f_.exports=hP});var h_=w(function(yP,wa){var $a=/([()\][%!^"`<>&|;, *?])/g;function gP(e){return e=e.replace($a,"^$1"),e}function _P(e,t){if(e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace($a,"^$1"),t)e=e.replace($a,"^$1");return e}yP.command=gP;yP.argument=_P});var __=w(function(fj,g_){g_.exports=/^#!(.*)/});var v_=w(function(mj,y_){var $P=__();y_.exports=(e="")=>{let t=e.match($P);if(!t)return null;let[r,o]=t[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();if(n==="env")return o;return o?`${n} ${o}`:n}});var $_=w(function(hj,b_){var xr=dt("fs"),wP=v_();function xP(e){let r=Buffer.alloc(150),o;try{o=xr.openSync(e,"r"),xr.readSync(o,r,0,150,0),xr.closeSync(o)}catch(n){}return wP(r.toString())}b_.exports=xP});var S_=w(function(gj,z_){var x_=dt("path"),w_=m_(),Xn=h_(),zP=$_(),SP=process.platform==="win32",kP=/\.(?:com|exe)$/i,PP=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function EP(e){e.file=w_(e);let t=e.file&&zP(e.file);if(t)return e.args.unshift(e.file),e.command=t,w_(e);return e.file}function TP(e){if(!SP)return e;let t=EP(e),r=!kP.test(t);if(e.options.forceShell||r){let o=PP.test(t);e.command=x_.normalize(e.command),e.command=Xn.command(e.command),e.args=e.args.map((s)=>Xn.argument(s,o));let n=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${n}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function RP(e,t,r){if(t&&!Array.isArray(t))r=t,t=null;t=t?t.slice(0):[],r=Object.assign({},r);let o={command:e,args:t,options:r,file:void 0,original:{command:e,args:t}};return r.shell?o:TP(o)}z_.exports=RP});var E_=w(function(_j,P_){var xa=process.platform==="win32";function za(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function OP(e,t){if(!xa)return;let r=e.emit;e.emit=function(o,n){if(o==="exit"){let s=k_(n,t);if(s)return r.call(e,"error",s)}return r.apply(e,arguments)}}function k_(e,t){if(xa&&e===1&&!t.file)return za(t.original,"spawn");return null}function IP(e,t){if(xa&&e===1&&!t.file)return za(t.original,"spawnSync");return null}P_.exports={hookChildProcess:OP,verifyENOENT:k_,verifyENOENTSync:IP,notFoundError:za}});var R_=w(function(yj,zr){var Yn=dt("child_process"),Sa=S_(),yo=E_();function T_(e,t,r){let o=Sa(e,t,r),n=Yn.spawn(o.command,o.args,o.options);return yo.hookChildProcess(n,o),n}function NP(e,t,r){let o=Sa(e,t,r),n=Yn.spawnSync(o.command,o.args,o.options);return n.error=n.error||yo.verifyENOENTSync(n.status,o),n}zr.exports=T_;zr.exports.spawn=T_;zr.exports.sync=NP;zr.exports._parse=Sa;zr.exports._enoent=yo});var WP=Object.freeze({status:"aborted"});function _(e,t,r){function o(a,u){if(!a._zod)Object.defineProperty(a,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1});if(a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,u);let c=i.prototype,l=Object.keys(c);for(let p=0;p<l.length;p++){let d=l[p];if(!(d in a))a[d]=c[d].bind(a)}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(a){var u;let c=r?.Parent?new s:this;o(c,a),(u=c._zod).deferred??(u.deferred=[]);for(let l of c._zod.deferred)l();return c}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:(a)=>{if(r?.Parent&&a instanceof r.Parent)return!0;return a?._zod?.traits?.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}var XP=Symbol("zod_brand");class ot extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Er extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}var $o={};function Re(e){if(e)Object.assign($o,e);return $o}function xo(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function us(e,t="|"){return e.map((r)=>fs(r)).join(t)}function Tr(e,t){if(typeof t==="bigint")return t.toString();return t}function Rr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function zo(e){return e===null||e===void 0}function So(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function qa(e,t){let r=(e.toString().split(".")[1]||"").length,o=t.toString(),n=(o.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(o)){let u=o.match(/\d?e-(\d?)/);if(u?.[1])n=Number.parseInt(u[1])}let s=r>n?r:n,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}var Za=Symbol("evaluating");function V(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===Za)return;if(o===void 0)o=Za,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Lt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ft(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function ls(e){return JSON.stringify(e)}function Ma(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ps="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Xt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Da=Rr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Ut(e){if(Xt(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Xt(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ds(e){if(Ut(e))return{...e};if(Array.isArray(e))return[...e];return e}var La=new Set(["string","number","symbol"]);function mt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Le(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function E(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function fs(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Ua(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Fa={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function H_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let s=ft(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;i[a]=r.shape[a]}return Lt(this,"shape",i),i},checks:[]});return Le(e,s)}function J_(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let s=ft(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);if(!t[a])continue;delete i[a]}return Lt(this,"shape",i),i},checks:[]});return Le(e,s)}function K_(e,t){if(!Ut(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=ft(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return Lt(this,"shape",s),s}});return Le(e,n)}function B_(e,t){if(!Ut(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ft(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Lt(this,"shape",o),o}});return Le(e,r)}function G_(e,t){let r=ft(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return Lt(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return Le(e,r)}function W_(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let i=ft(t._zod.def,{get shape(){let a=t._zod.def.shape,u={...a};if(r)for(let c in r){if(!(c in a))throw Error(`Unrecognized key: "${c}"`);if(!r[c])continue;u[c]=e?new e({type:"optional",innerType:a[c]}):a[c]}else for(let c in a)u[c]=e?new e({type:"optional",innerType:a[c]}):a[c];return Lt(this,"shape",u),u},checks:[]});return Le(t,i)}function X_(e,t,r){let o=ft(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw Error(`Unrecognized key: "${i}"`);if(!r[i])continue;s[i]=new e({type:"nonoptional",innerType:n[i]})}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return Lt(this,"shape",s),s}});return Le(t,o)}function Ft(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ht(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function wo(e){return typeof e==="string"?e:e?.message}function Ue(e,t,r){let o={...e,path:e.path??[]};if(!e.message){let n=wo(e.inst?._zod.def?.error?.(e))??wo(t?.error?.(e))??wo(r.customError?.(e))??wo(r.localeError?.(e))??"Invalid input";o.message=n}if(delete o.inst,delete o.continue,!t?.reportInput)delete o.input;return o}function ko(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Va(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Vt(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}var Ha=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Tr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Po=_("$ZodError",Ha),ms=_("$ZodError",Ha,{Parent:Error});function Ja(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function Ka(e,t=(r)=>r.message){let r={_errors:[]},o=(n)=>{for(let s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((i)=>o({issues:i}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,a=0;while(a<s.path.length){let u=s.path[a];if(a!==s.path.length-1)i[u]=i[u]||{_errors:[]};else i[u]=i[u]||{_errors:[]},i[u]._errors.push(t(s));i=i[u],a++}}};return o(e),r}var Eo=(e)=>(t,r,o,n)=>{let s=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new ot;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((u)=>Ue(u,s,Re())));throw ps(a,n?.callee),a}return i.value};var To=(e)=>async(t,r,o,n)=>{let s=o?Object.assign(o,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(n?.Err??e)(i.issues.map((u)=>Ue(u,s,Re())));throw ps(a,n?.callee),a}return i.value};var Or=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new ot;return s.issues.length?{success:!1,error:new(e??Po)(s.issues.map((i)=>Ue(i,n,Re())))}:{success:!0,data:s.value}},Ir=Or(ms),Nr=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{async:!0}):{async:!0},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)s=await s;return s.issues.length?{success:!1,error:new e(s.issues.map((i)=>Ue(i,n,Re())))}:{success:!0,data:s.value}},Ro=Nr(ms),Ba=(e)=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Eo(e)(t,r,n)};var Ga=(e)=>(t,r,o)=>Eo(e)(t,r,o);var Wa=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return To(e)(t,r,n)};var Xa=(e)=>async(t,r,o)=>To(e)(t,r,o);var Ya=(e)=>(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Or(e)(t,r,n)};var Qa=(e)=>(t,r,o)=>Or(e)(t,r,o);var ec=(e)=>async(t,r,o)=>{let n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Nr(e)(t,r,n)};var tc=(e)=>async(t,r,o)=>Nr(e)(t,r,o);var rc=/^[cC][^\s-]{8,}$/,oc=/^[0-9a-z]+$/,nc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,sc=/^[0-9a-vA-V]{20}$/,ic=/^[A-Za-z0-9]{27}$/,ac=/^[a-zA-Z0-9_-]{21}$/,cc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var uc=/^([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})$/,hs=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var lc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Q_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function pc(){return new RegExp(Q_,"u")}var dc=/^(?:(?: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])$/,fc=/^(([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 mc=/^((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])$/,hc=/^(([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])$/,gc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,gs=/^[A-Za-z0-9_-]*$/;var _c=/^\+[1-9]\d{6,14}$/,yc="(?:(?:\\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])))",vc=new RegExp(`^${yc}$`);function bc(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function $c(e){return new RegExp(`^${bc(e)}$`)}function wc(e){let t=bc({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${yc}T(?:${o})$`)}var xc=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var zc=/^-?\d+$/,_s=/^-?\d+(?:\.\d+)?$/,Sc=/^(?:true|false)$/i,kc=/^null$/i;var Pc=/^[^A-Z]*$/,Ec=/^[^a-z]*$/;var me=_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Tc={number:"number",bigint:"bigint",object:"date"},ys=_("$ZodCheckLessThan",(e,t)=>{me.init(e,t);let r=Tc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<s)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vs=_("$ZodCheckGreaterThan",(e,t)=>{me.init(e,t);let r=Tc[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>s)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Rc=_("$ZodCheckMultipleOf",(e,t)=>{me.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):qa(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Oc=_("$ZodCheckNumberFormat",(e,t)=>{me.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,s]=Fa[t.format];e._zod.onattach.push((i)=>{let a=i._zod.bag;if(a.format=t.format,a.minimum=n,a.maximum=s,r)a.pattern=zc}),e._zod.check=(i)=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(a<n)i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(a>s)i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var Ic=_("$ZodCheckMaxLength",(e,t)=>{var r;me.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!zo(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let i=ko(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Nc=_("$ZodCheckMinLength",(e,t)=>{var r;me.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!zo(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let i=ko(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Cc=_("$ZodCheckLengthEquals",(e,t)=>{var r;me.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!zo(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,s=n.length;if(s===t.length)return;let i=ko(n),a=s>t.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Cr=_("$ZodCheckStringFormat",(e,t)=>{var r,o;if(me.init(e,t),e._zod.onattach.push((n)=>{let s=n._zod.bag;if(s.format=t.format,t.pattern)s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),jc=_("$ZodCheckRegex",(e,t)=>{Cr.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ac=_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Pc),Cr.init(e,t)}),Zc=_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ec),Cr.init(e,t)}),qc=_("$ZodCheckIncludes",(e,t)=>{me.init(e,t);let r=mt(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Mc=_("$ZodCheckStartsWith",(e,t)=>{me.init(e,t);let r=new RegExp(`^${mt(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Dc=_("$ZodCheckEndsWith",(e,t)=>{me.init(e,t);let r=new RegExp(`.*${mt(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});var Lc=_("$ZodCheckOverwrite",(e,t)=>{me.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class bs{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
9
9
|
`).filter((s)=>s),o=Math.min(...r.map((s)=>s.length-s.trimStart().length)),n=r.map((s)=>s.slice(o)).map((s)=>" ".repeat(this.indent*2)+s);for(let s of n)this.content.push(s)}compile(){let e=Function,t=this?.args,o=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,o.join(`
|
|
10
|
-
`))}}var
|
|
11
|
-
if (${
|
|
12
|
-
if (${
|
|
13
|
-
payload.issues = payload.issues.concat(${
|
|
10
|
+
`))}}var Fc={major:4,minor:3,patch:6};var W=_("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fc;let o=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,a,u)=>{let c=Ft(i),l;for(let p of a){if(p._zod.def.when){if(!p._zod.def.when(i))continue}else if(c)continue;let d=i.issues.length,f=p._zod.check(i);if(f instanceof Promise&&u?.async===!1)throw new ot;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await f,i.issues.length===d)return;if(!c)c=Ft(i,d)});else{if(i.issues.length===d)continue;if(!c)c=Ft(i,d)}}if(l)return l.then(()=>i);return i},s=(i,a,u)=>{if(Ft(i))return i.aborted=!0,i;let c=n(a,o,u);if(c instanceof Promise){if(u.async===!1)throw new ot;return c.then((l)=>e._zod.parse(l,u))}return e._zod.parse(c,u)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let c=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});if(c instanceof Promise)return c.then((l)=>s(l,i,a));return s(c,i,a)}let u=e._zod.parse(i,a);if(u instanceof Promise){if(a.async===!1)throw new ot;return u.then((c)=>n(c,o,a))}return n(u,o,a)}}V(e,"~standard",()=>({validate:(n)=>{try{let s=Ir(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch(s){return Ro(e,n).then((i)=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Co=_("$ZodString",(e,t)=>{W.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??xc(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),X=_("$ZodStringFormat",(e,t)=>{Cr.init(e,t),Co.init(e,t)}),Yc=_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=uc),X.init(e,t)}),Qc=_("$ZodUUID",(e,t)=>{if(t.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=hs(o))}else t.pattern??(t.pattern=hs());X.init(e,t)}),eu=_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=lc),X.init(e,t)}),tu=_("$ZodURL",(e,t)=>{X.init(e,t),e._zod.check=(r)=>{try{let o=r.value.trim(),n=new URL(o);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})}if(t.normalize)r.value=n.href;else r.value=o;return}catch(o){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ru=_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=pc()),X.init(e,t)}),ou=_("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ac),X.init(e,t)}),nu=_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=rc),X.init(e,t)}),su=_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=oc),X.init(e,t)}),iu=_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nc),X.init(e,t)}),au=_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=sc),X.init(e,t)}),cu=_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ic),X.init(e,t)}),uu=_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=wc(t)),X.init(e,t)}),lu=_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=vc),X.init(e,t)}),pu=_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$c(t)),X.init(e,t)}),du=_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cc),X.init(e,t)}),fu=_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dc),X.init(e,t),e._zod.bag.format="ipv4"}),mu=_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fc),X.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(r)=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}});var hu=_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=mc),X.init(e,t)}),gu=_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hc),X.init(e,t),e._zod.check=(r)=>{let o=r.value.split("/");try{if(o.length!==2)throw Error();let[n,s]=o;if(!s)throw Error();let i=Number(s);if(`${i}`!==s)throw Error();if(i<0||i>128)throw Error();new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function _u(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var yu=_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gc),X.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(r)=>{if(_u(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function ry(e){if(!gs.test(e))return!1;let t=e.replace(/[-_]/g,(o)=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return _u(r)}var vu=_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=gs),X.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(r)=>{if(ry(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),bu=_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_c),X.init(e,t)});function oy(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var $u=_("$ZodJWT",(e,t)=>{X.init(e,t),e._zod.check=(r)=>{if(oy(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var ws=_("$ZodNumber",(e,t)=>{W.init(e,t),e._zod.pattern=e._zod.bag.pattern??_s,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(i){}let n=r.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}}),wu=_("$ZodNumberFormat",(e,t)=>{Oc.init(e,t),ws.init(e,t)}),xu=_("$ZodBoolean",(e,t)=>{W.init(e,t),e._zod.pattern=Sc,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}let n=r.value;if(typeof n==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});var zu=_("$ZodNull",(e,t)=>{W.init(e,t),e._zod.pattern=kc,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{let n=r.value;if(n===null)return r;return r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}});var Su=_("$ZodUnknown",(e,t)=>{W.init(e,t),e._zod.parse=(r)=>r}),ku=_("$ZodNever",(e,t)=>{W.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Vc(e,t,r){if(e.issues.length)t.issues.push(...ht(r,e.issues));t.value[r]=e.value}var Pu=_("$ZodArray",(e,t)=>{W.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],u=t.element._zod.run({value:a,issues:[]},o);if(u instanceof Promise)s.push(u.then((c)=>Vc(c,r,i)));else Vc(u,r,i)}if(s.length)return Promise.all(s).then(()=>r);return r}});function No(e,t,r,o,n){if(e.issues.length){if(n&&!(r in o))return;t.issues.push(...ht(r,e.issues))}if(e.value===void 0){if(r in o)t.value[r]=void 0}else t.value[r]=e.value}function Eu(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Ua(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Tu(e,t,r,o,n,s){let i=[],a=n.keySet,u=n.catchall._zod,c=u.def.type,l=u.optout==="optional";for(let p in t){if(a.has(p))continue;if(c==="never"){i.push(p);continue}let d=u.run({value:t[p],issues:[]},o);if(d instanceof Promise)e.push(d.then((f)=>No(f,r,p,t,l)));else No(d,r,p,t,l)}if(i.length)r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s});if(!e.length)return r;return Promise.all(e).then(()=>r)}var ny=_("$ZodObject",(e,t)=>{if(W.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...a};return Object.defineProperty(t,"shape",{value:u}),u}})}let o=Rr(()=>Eu(t));V(e._zod,"propValues",()=>{let a=t.shape,u={};for(let c in a){let l=a[c]._zod;if(l.values){u[c]??(u[c]=new Set);for(let p of l.values)u[c].add(p)}}return u});let n=Xt,s=t.catchall,i;e._zod.parse=(a,u)=>{i??(i=o.value);let c=a.value;if(!n(c))return a.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),a;a.value={};let l=[],p=i.shape;for(let d of i.keys){let f=p[d],h=f._zod.optout==="optional",g=f._zod.run({value:c[d],issues:[]},u);if(g instanceof Promise)l.push(g.then((b)=>No(b,a,d,c,h)));else No(g,a,d,c,h)}if(!s)return l.length?Promise.all(l).then(()=>a):a;return Tu(l,c,a,u,o.value,e)}}),Ru=_("$ZodObjectJIT",(e,t)=>{ny.init(e,t);let r=e._zod.parse,o=Rr(()=>Eu(t)),n=(d)=>{let f=new bs(["shape","payload","ctx"]),h=o.value,g=(N)=>{let q=ls(N);return`shape[${q}]._zod.run({ value: input[${q}], issues: [] }, ctx)`};f.write("const input = payload.value;");let b=Object.create(null),v=0;for(let N of h.keys)b[N]=`key_${v++}`;f.write("const newResult = {};");for(let N of h.keys){let q=b[N],O=ls(N),Me=d[N]?._zod?.optout==="optional";if(f.write(`const ${q} = ${g(N)};`),Me)f.write(`
|
|
11
|
+
if (${q}.issues.length) {
|
|
12
|
+
if (${O} in input) {
|
|
13
|
+
payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
|
|
14
14
|
...iss,
|
|
15
|
-
path: iss.path ? [${
|
|
15
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
16
16
|
})));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
if (${
|
|
21
|
-
if (${
|
|
22
|
-
newResult[${
|
|
20
|
+
if (${q}.value === undefined) {
|
|
21
|
+
if (${O} in input) {
|
|
22
|
+
newResult[${O}] = undefined;
|
|
23
23
|
}
|
|
24
24
|
} else {
|
|
25
|
-
newResult[${
|
|
25
|
+
newResult[${O}] = ${q}.value;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
`);else f.write(`
|
|
29
|
-
if (${
|
|
30
|
-
payload.issues = payload.issues.concat(${
|
|
29
|
+
if (${q}.issues.length) {
|
|
30
|
+
payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
|
|
31
31
|
...iss,
|
|
32
|
-
path: iss.path ? [${
|
|
32
|
+
path: iss.path ? [${O}, ...iss.path] : [${O}]
|
|
33
33
|
})));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
if (${
|
|
37
|
-
if (${
|
|
38
|
-
newResult[${
|
|
36
|
+
if (${q}.value === undefined) {
|
|
37
|
+
if (${O} in input) {
|
|
38
|
+
newResult[${O}] = undefined;
|
|
39
39
|
}
|
|
40
40
|
} else {
|
|
41
|
-
newResult[${
|
|
41
|
+
newResult[${O}] = ${q}.value;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
`)}f.write("payload.value = newResult;"),f.write("return payload;");let R=f.compile();return(T,I)=>R(p,T,I)},s,i=zt,a=!Br.jitless,c=a&&ya.value,l=t.catchall,d;e._zod.parse=(p,f)=>{d??(d=o.value);let h=p.value;if(!i(h))return p.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),p;if(a&&c&&f?.async===!1&&f.jitless!==!0){if(!s)s=n(t.shape);if(p=s(p,f),!l)return p;return au([],h,p,f,d,e)}return r(p,f)}});function xc(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter((s)=>!mt(s));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>Ce(i,o,be())))}),t}var Un=_("$ZodUnion",(e,t)=>{F.init(e,t),M(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),M(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),M(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),M(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((s)=>s._zod.pattern);return new RegExp(`^(${n.map((s)=>Yr(s.source)).join("|")})$`)}return});let r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,s)=>{if(r)return o(n,s);let i=!1,a=[];for(let u of t.options){let c=u._zod.run({value:n.value,issues:[]},s);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}if(!i)return xc(a,n,e,s);return Promise.all(a).then((u)=>xc(u,n,e,s))}});var uu=_("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Un.init(e,t);let r=e._zod.parse;M(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,u]of Object.entries(i)){if(!n[a])n[a]=new Set;for(let c of u)n[a].add(c)}}return n});let o=Bt(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let u of a){if(s.has(u))throw Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!zt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);if(a)return a._zod.run(n,s);if(t.unionFallback)return r(n,s);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),n}}),lu=_("$ZodIntersection",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([u,c])=>zc(r,u,c));return zc(r,s,i)}});function Dn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ft(e)&&ft(t)){let r=Object.keys(t),o=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=Dn(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=Dn(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 zc(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let u of a.keys){if(!o.has(u))o.set(u,{});o.get(u).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let u of a.keys){if(!o.has(u))o.set(u,{});o.get(u).r=!0}else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n)e.issues.push({...n,keys:s});if(mt(e))return e;let i=Dn(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var du=_("$ZodRecord",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!ft(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let c of i)if(typeof c==="string"||typeof c==="number"||typeof c==="symbol"){a.add(typeof c==="number"?c.toString():c);let l=t.valueType._zod.run({value:n[c],issues:[]},o);if(l instanceof Promise)s.push(l.then((d)=>{if(d.issues.length)r.issues.push(...Ye(c,d.issues));r.value[c]=d.value}));else{if(l.issues.length)r.issues.push(...Ye(c,l.issues));r.value[c]=l.value}}let u;for(let c in n)if(!a.has(c))u=u??[],u.push(c);if(u&&u.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:u})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__")continue;let u=t.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&An.test(a)&&u.issues.length){let d=t.keyType._zod.run({value:Number(a),issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length===0)u=d}if(u.issues.length){if(t.mode==="loose")r.value[a]=n[a];else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((d)=>Ce(d,o,be())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);if(l instanceof Promise)s.push(l.then((d)=>{if(d.issues.length)r.issues.push(...Ye(a,d.issues));r.value[u.value]=d.value}));else{if(l.issues.length)r.issues.push(...Ye(a,l.issues));r.value[u.value]=l.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var pu=_("$ZodEnum",(e,t)=>{F.init(e,t);let r=Wr(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((n)=>va.has(typeof n)).map((n)=>typeof n==="string"?Xe(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;if(o.has(i))return n;return n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),fu=_("$ZodLiteral",(e,t)=>{if(F.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?Xe(o):o?Xe(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var mu=_("$ZodTransform",(e,t)=>{F.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Jt(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((i)=>(r.value=i,r));if(n instanceof Promise)throw new Me;return r.value=n,r}});function Sc(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var Fn=_("$ZodOptional",(e,t)=>{F.init(e,t),e._zod.optin="optional",e._zod.optout="optional",M(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),M(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Yr(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Sc(s,r.value));return Sc(n,r.value)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),hu=_("$ZodExactOptional",(e,t)=>{Fn.init(e,t),M(e._zod,"values",()=>t.innerType._zod.values),M(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),gu=_("$ZodNullable",(e,t)=>{F.init(e,t),M(e._zod,"optin",()=>t.innerType._zod.optin),M(e._zod,"optout",()=>t.innerType._zod.optout),M(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Yr(r.source)}|null)$`):void 0}),M(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),_u=_("$ZodDefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",M(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>kc(s,t));return kc(n,t)}});function kc(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var yu=_("$ZodPrefault",(e,t)=>{F.init(e,t),e._zod.optin="optional",M(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),vu=_("$ZodNonOptional",(e,t)=>{F.init(e,t),M(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Pc(s,e));return Pc(n,e)}});function Pc(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var bu=_("$ZodCatch",(e,t)=>{F.init(e,t),M(e._zod,"optin",()=>t.innerType._zod.optin),M(e._zod,"optout",()=>t.innerType._zod.optout),M(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>Ce(i,o,be()))},input:r.value}),r.issues=[];return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((s)=>Ce(s,o,be()))},input:r.value}),r.issues=[];return r}});var $u=_("$ZodPipe",(e,t)=>{F.init(e,t),M(e._zod,"values",()=>t.in._zod.values),M(e._zod,"optin",()=>t.in._zod.optin),M(e._zod,"optout",()=>t.out._zod.optout),M(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);if(s instanceof Promise)return s.then((i)=>so(i,t.in,o));return so(s,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>so(s,t.out,o));return so(n,t.out,o)}});function so(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var wu=_("$ZodReadonly",(e,t)=>{F.init(e,t),M(e._zod,"propValues",()=>t.innerType._zod.propValues),M(e._zod,"values",()=>t.innerType._zod.values),M(e._zod,"optin",()=>t.innerType?._zod?.optin),M(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Ec);return Ec(n)}});function Ec(e){return e.value=Object.freeze(e.value),e}var xu=_("$ZodCustom",(e,t)=>{te.init(e,t),F.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((s)=>Tc(s,r,o,e));Tc(n,r,o,e);return}});function Tc(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(ht(n))}}var v_=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[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=wa(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${In(n.values[0])}`;return`Invalid option: expected one of ${En(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);if(i)return`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);if(i)return`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`;return`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`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":""}: ${En(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Vn(){return{localeError:v_()}}var zu,hP=Symbol("ZodOutput"),gP=Symbol("ZodInput");class Su{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function b_(){return new Su}(zu=globalThis).__zod_globalRegistry??(zu.__zod_globalRegistry=b_());var gt=globalThis.__zod_globalRegistry;function ku(e,t){return new e({type:"string",...z(t)})}function Pu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}function Hn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function Eu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}function Tu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}function Ru(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}function Ou(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}function Iu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function Nu(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}function Cu(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}function ju(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}function Au(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}function Zu(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}function qu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}function Mu(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}function Du(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function Lu(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function Uu(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}function Fu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}function Vu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}function Hu(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}function Ju(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}function Ku(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}function Bu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}function Gu(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}function Wu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}function Xu(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}function Yu(e,t){return new e({type:"number",checks:[],...z(t)})}function Qu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}function el(e,t){return new e({type:"boolean",...z(t)})}function tl(e,t){return new e({type:"null",...z(t)})}function rl(e){return new e({type:"unknown"})}function ol(e,t){return new e({type:"never",...z(t)})}function co(e,t){return new Zn({check:"less_than",...z(t),value:e,inclusive:!1})}function Qt(e,t){return new Zn({check:"less_than",...z(t),value:e,inclusive:!0})}function uo(e,t){return new qn({check:"greater_than",...z(t),value:e,inclusive:!1})}function er(e,t){return new qn({check:"greater_than",...z(t),value:e,inclusive:!0})}function lo(e,t){return new cc({check:"multiple_of",...z(t),value:e})}function po(e,t){return new lc({check:"max_length",...z(t),maximum:e})}function St(e,t){return new dc({check:"min_length",...z(t),minimum:e})}function fo(e,t){return new pc({check:"length_equals",...z(t),length:e})}function Jn(e,t){return new fc({check:"string_format",format:"regex",...z(t),pattern:e})}function Kn(e){return new mc({check:"string_format",format:"lowercase",...z(e)})}function Bn(e){return new hc({check:"string_format",format:"uppercase",...z(e)})}function Gn(e,t){return new gc({check:"string_format",format:"includes",...z(t),includes:e})}function Wn(e,t){return new _c({check:"string_format",format:"starts_with",...z(t),prefix:e})}function Xn(e,t){return new yc({check:"string_format",format:"ends_with",...z(t),suffix:e})}function Qe(e){return new vc({check:"overwrite",tx:e})}function Yn(e){return Qe((t)=>t.normalize(e))}function Qn(){return Qe((e)=>e.trim())}function es(){return Qe((e)=>e.toLowerCase())}function ts(){return Qe((e)=>e.toUpperCase())}function rs(){return Qe((e)=>_a(e))}function nl(e,t,r){return new e({type:"array",element:t,...z(r)})}function sl(e,t,r){let o=z(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function il(e,t,r){return new e({type:"custom",check:"custom",fn:t,...z(r)})}function al(e){let t=$_((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(ht(o,r.value,t._zod.def));else{let n=o;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(ht(n))}},e(r.value,r)));return t}function $_(e,t){let r=new te({check:"custom",...z(t)});return r._zod.check=e,r}function os(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??gt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function X(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let p=i.schema,f=t.processors[n.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,p,l)}let d=e._zod.parent;if(d){if(!i.ref)i.ref=d;X(d,t,l),t.seen.get(d).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)Object.assign(i.schema,u);if(t.io==="input"&&ce(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&i.schema._prefault)(o=i.schema).default??(o.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function ns(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let u=o.get(a);if(u&&u!==i[0])throw 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=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(i[0])?.id,p=e.external.uri??((h)=>h);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let c=`${"#"}/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+l}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:u,defId:c}=n(i);if(a.def={...a.schema},c)a.defId=c;let l=a.schema;for(let d in l)delete l[d];l.$ref=u};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
44
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let C=f.compile();return(N,q)=>C(d,N,q)},s,i=Xt,a=!$o.jitless,c=a&&Da.value,l=t.catchall,p;e._zod.parse=(d,f)=>{p??(p=o.value);let h=d.value;if(!i(h))return d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d;if(a&&c&&f?.async===!1&&f.jitless!==!0){if(!s)s=n(t.shape);if(d=s(d,f),!l)return d;return Tu([],h,d,f,p,e)}return r(d,f)}});function Hc(e,t,r,o){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter((s)=>!Ft(s));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((s)=>s.issues.map((i)=>Ue(i,o,Re())))}),t}var xs=_("$ZodUnion",(e,t)=>{W.init(e,t),V(e._zod,"optin",()=>t.options.some((n)=>n._zod.optin==="optional")?"optional":void 0),V(e._zod,"optout",()=>t.options.some((n)=>n._zod.optout==="optional")?"optional":void 0),V(e._zod,"values",()=>{if(t.options.every((n)=>n._zod.values))return new Set(t.options.flatMap((n)=>Array.from(n._zod.values)));return}),V(e._zod,"pattern",()=>{if(t.options.every((n)=>n._zod.pattern)){let n=t.options.map((s)=>s._zod.pattern);return new RegExp(`^(${n.map((s)=>So(s.source)).join("|")})$`)}return});let r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,s)=>{if(r)return o(n,s);let i=!1,a=[];for(let u of t.options){let c=u._zod.run({value:n.value,issues:[]},s);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}if(!i)return Hc(a,n,e,s);return Promise.all(a).then((u)=>Hc(u,n,e,s))}});var Ou=_("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,xs.init(e,t);let r=e._zod.parse;V(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,u]of Object.entries(i)){if(!n[a])n[a]=new Set;for(let c of u)n[a].add(c)}}return n});let o=Rr(()=>{let n=t.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let u of a){if(s.has(u))throw Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!Xt(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let a=o.value.get(i?.[t.discriminator]);if(a)return a._zod.run(n,s);if(t.unionFallback)return r(n,s);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),n}}),Iu=_("$ZodIntersection",(e,t)=>{W.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,s=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);if(s instanceof Promise||i instanceof Promise)return Promise.all([s,i]).then(([u,c])=>Jc(r,u,c));return Jc(r,s,i)}});function $s(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Ut(e)&&Ut(t)){let r=Object.keys(t),o=Object.keys(e).filter((s)=>r.indexOf(s)!==-1),n={...e,...t};for(let s of o){let i=$s(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],s=t[o],i=$s(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 Jc(e,t,r){let o=new Map,n;for(let a of t.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let u of a.keys){if(!o.has(u))o.set(u,{});o.get(u).l=!0}}else e.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let u of a.keys){if(!o.has(u))o.set(u,{});o.get(u).r=!0}else e.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n)e.issues.push({...n,keys:s});if(Ft(e))return e;let i=$s(t.value,r.value);if(!i.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var Nu=_("$ZodRecord",(e,t)=>{W.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Ut(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let s=[],i=t.keyType._zod.values;if(i){r.value={};let a=new Set;for(let c of i)if(typeof c==="string"||typeof c==="number"||typeof c==="symbol"){a.add(typeof c==="number"?c.toString():c);let l=t.valueType._zod.run({value:n[c],issues:[]},o);if(l instanceof Promise)s.push(l.then((p)=>{if(p.issues.length)r.issues.push(...ht(c,p.issues));r.value[c]=p.value}));else{if(l.issues.length)r.issues.push(...ht(c,l.issues));r.value[c]=l.value}}let u;for(let c in n)if(!a.has(c))u=u??[],u.push(c);if(u&&u.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:u})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__")continue;let u=t.keyType._zod.run({value:a,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&_s.test(a)&&u.issues.length){let p=t.keyType._zod.run({value:Number(a),issues:[]},o);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length===0)u=p}if(u.issues.length){if(t.mode==="loose")r.value[a]=n[a];else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((p)=>Ue(p,o,Re())),input:a,path:[a],inst:e});continue}let l=t.valueType._zod.run({value:n[a],issues:[]},o);if(l instanceof Promise)s.push(l.then((p)=>{if(p.issues.length)r.issues.push(...ht(a,p.issues));r.value[u.value]=p.value}));else{if(l.issues.length)r.issues.push(...ht(a,l.issues));r.value[u.value]=l.value}}}if(s.length)return Promise.all(s).then(()=>r);return r}});var Cu=_("$ZodEnum",(e,t)=>{W.init(e,t);let r=xo(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((n)=>La.has(typeof n)).map((n)=>typeof n==="string"?mt(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;if(o.has(i))return n;return n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),ju=_("$ZodLiteral",(e,t)=>{if(W.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?mt(o):o?mt(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),o}});var Au=_("$ZodTransform",(e,t)=>{W.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Er(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((i)=>(r.value=i,r));if(n instanceof Promise)throw new ot;return r.value=n,r}});function Kc(e,t){if(e.issues.length&&t===void 0)return{issues:[],value:void 0};return e}var zs=_("$ZodOptional",(e,t)=>{W.init(e,t),e._zod.optin="optional",e._zod.optout="optional",V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${So(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Kc(s,r.value));return Kc(n,r.value)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),Zu=_("$ZodExactOptional",(e,t)=>{zs.init(e,t),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),qu=_("$ZodNullable",(e,t)=>{W.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${So(r.source)}|null)$`):void 0}),V(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),Mu=_("$ZodDefault",(e,t)=>{W.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Bc(s,t));return Bc(n,t)}});function Bc(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Du=_("$ZodPrefault",(e,t)=>{W.init(e,t),e._zod.optin="optional",V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),Lu=_("$ZodNonOptional",(e,t)=>{W.init(e,t),V(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Gc(s,e));return Gc(n,e)}});function Gc(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Uu=_("$ZodCatch",(e,t)=>{W.init(e,t),V(e._zod,"optin",()=>t.innerType._zod.optin),V(e._zod,"optout",()=>t.innerType._zod.optout),V(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>{if(r.value=s.value,s.issues.length)r.value=t.catchValue({...r,error:{issues:s.issues.map((i)=>Ue(i,o,Re()))},input:r.value}),r.issues=[];return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((s)=>Ue(s,o,Re()))},input:r.value}),r.issues=[];return r}});var Fu=_("$ZodPipe",(e,t)=>{W.init(e,t),V(e._zod,"values",()=>t.in._zod.values),V(e._zod,"optin",()=>t.in._zod.optin),V(e._zod,"optout",()=>t.out._zod.optout),V(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=t.out._zod.run(r,o);if(s instanceof Promise)return s.then((i)=>Io(i,t.in,o));return Io(s,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((s)=>Io(s,t.out,o));return Io(n,t.out,o)}});function Io(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var Vu=_("$ZodReadonly",(e,t)=>{W.init(e,t),V(e._zod,"propValues",()=>t.innerType._zod.propValues),V(e._zod,"values",()=>t.innerType._zod.values),V(e._zod,"optin",()=>t.innerType?._zod?.optin),V(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(Wc);return Wc(n)}});function Wc(e){return e.value=Object.freeze(e.value),e}var Hu=_("$ZodCustom",(e,t)=>{me.init(e,t),W.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((s)=>Xc(s,r,o,e));Xc(n,r,o,e);return}});function Xc(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(Vt(n))}}var sy=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[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=Va(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${fs(n.values[0])}`;return`Invalid option: expected one of ${us(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);if(i)return`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);if(i)return`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`;return`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`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":""}: ${us(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Ss(){return{localeError:sy()}}var Ju,hE=Symbol("ZodOutput"),gE=Symbol("ZodInput");class Ku{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function iy(){return new Ku}(Ju=globalThis).__zod_globalRegistry??(Ju.__zod_globalRegistry=iy());var Ht=globalThis.__zod_globalRegistry;function Bu(e,t){return new e({type:"string",...E(t)})}function Gu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}function ks(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function Wu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}function Xu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}function Yu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}function Qu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}function el(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function tl(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}function rl(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}function ol(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}function nl(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}function sl(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}function il(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}function al(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}function cl(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function ul(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function ll(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}function pl(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}function dl(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}function fl(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}function ml(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}function hl(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}function gl(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}function _l(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}function yl(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}function vl(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}function bl(e,t){return new e({type:"number",checks:[],...E(t)})}function $l(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...E(t)})}function wl(e,t){return new e({type:"boolean",...E(t)})}function xl(e,t){return new e({type:"null",...E(t)})}function zl(e){return new e({type:"unknown"})}function Sl(e,t){return new e({type:"never",...E(t)})}function jo(e,t){return new ys({check:"less_than",...E(t),value:e,inclusive:!1})}function jr(e,t){return new ys({check:"less_than",...E(t),value:e,inclusive:!0})}function Ao(e,t){return new vs({check:"greater_than",...E(t),value:e,inclusive:!1})}function Ar(e,t){return new vs({check:"greater_than",...E(t),value:e,inclusive:!0})}function Zo(e,t){return new Rc({check:"multiple_of",...E(t),value:e})}function qo(e,t){return new Ic({check:"max_length",...E(t),maximum:e})}function Yt(e,t){return new Nc({check:"min_length",...E(t),minimum:e})}function Mo(e,t){return new Cc({check:"length_equals",...E(t),length:e})}function Ps(e,t){return new jc({check:"string_format",format:"regex",...E(t),pattern:e})}function Es(e){return new Ac({check:"string_format",format:"lowercase",...E(e)})}function Ts(e){return new Zc({check:"string_format",format:"uppercase",...E(e)})}function Rs(e,t){return new qc({check:"string_format",format:"includes",...E(t),includes:e})}function Os(e,t){return new Mc({check:"string_format",format:"starts_with",...E(t),prefix:e})}function Is(e,t){return new Dc({check:"string_format",format:"ends_with",...E(t),suffix:e})}function gt(e){return new Lc({check:"overwrite",tx:e})}function Ns(e){return gt((t)=>t.normalize(e))}function Cs(){return gt((e)=>e.trim())}function js(){return gt((e)=>e.toLowerCase())}function As(){return gt((e)=>e.toUpperCase())}function Zs(){return gt((e)=>Ma(e))}function kl(e,t,r){return new e({type:"array",element:t,...E(r)})}function Pl(e,t,r){let o=E(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function El(e,t,r){return new e({type:"custom",check:"custom",fn:t,...E(r)})}function Tl(e){let t=ay((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Vt(o,r.value,t._zod.def));else{let n=o;if(n.fatal)n.continue=!1;n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Vt(n))}},e(r.value,r)));return t}function ay(e,t){let r=new me({check:"custom",...E(t)});return r._zod.check=e,r}function qs(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Ht,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ue(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,s=t.seen.get(e);if(s){if(s.count++,r.schemaPath.includes(e))s.cycle=r.path;return s.schema}let i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,l);else{let d=i.schema,f=t.processors[n.type];if(!f)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,d,l)}let p=e._zod.parent;if(p){if(!i.ref)i.ref=p;ue(p,t,l),t.seen.get(p).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)Object.assign(i.schema,u);if(t.io==="input"&&ve(e))delete i.schema.examples,delete i.schema.default;if(t.io==="input"&&i.schema._prefault)(o=i.schema).default??(o.default=i.schema._prefault);return delete i.schema._prefault,t.seen.get(e).schema}function Ms(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let u=o.get(a);if(u&&u!==i[0])throw 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=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(i[0])?.id,d=e.external.uri??((h)=>h);if(p)return{ref:d(p)};let f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${d("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let c=`${"#"}/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+l}},s=(i)=>{if(i[1].schema.$ref)return;let a=i[1],{ref:u,defId:c}=n(i);if(a.def={...a.schema},c)a.defId=c;let l=a.schema;for(let p in l)delete l[p];l.$ref=u};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
45
45
|
|
|
46
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref"){s(i);continue}}}}function ss(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(i)=>{let a=e.seen.get(i);if(a.ref===null)return;let u=a.def??a.schema,c={...u},l=a.ref;if(a.ref=null,l){o(l);let p=e.seen.get(l),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(f);else Object.assign(u,f);if(Object.assign(u,c),i._zod.parent===l)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(!(g in c))delete u[g]}if(f.$ref&&p.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in p.def&&JSON.stringify(u[g])===JSON.stringify(p.def[g]))delete u[g]}}let d=i._zod.parent;if(d&&d!==l){o(d);let p=e.seen.get(d);if(p?.schema.$ref){if(u.$ref=p.schema.$ref,p.def)for(let f in u){if(f==="$ref"||f==="allOf")continue;if(f in p.def&&JSON.stringify(u[f])===JSON.stringify(p.def[f]))delete u[f]}}}e.override({zodSchema:i,jsonSchema:u,path:a.path??[]})};for(let i of[...e.seen.entries()].reverse())o(i[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let i=e.external.registry.get(t)?.id;if(!i)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(i)}Object.assign(n,r.def??r.schema);let s=e.external?.defs??{};for(let i of e.seen.entries()){let a=i[1];if(a.def&&a.defId)s[a.defId]=a.def}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let i=JSON.parse(JSON.stringify(n));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:tr(t,"input",e.processors),output:tr(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch(i){throw Error("Error converting schema to JSON.")}}function ce(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ce(o.element,r);if(o.type==="set")return ce(o.valueType,r);if(o.type==="lazy")return ce(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 ce(o.innerType,r);if(o.type==="intersection")return ce(o.left,r)||ce(o.right,r);if(o.type==="record"||o.type==="map")return ce(o.keyType,r)||ce(o.valueType,r);if(o.type==="pipe")return ce(o.in,r)||ce(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ce(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ce(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ce(n,r))return!0;if(o.rest&&ce(o.rest,r))return!0;return!1}return!1}var cl=(e,t={})=>(r)=>{let o=os({...r,processors:t});return X(e,o),ns(o,e),ss(o,e)},tr=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:s}=o??{},i=os({...n??{},target:s,io:t,processors:r});return X(e,i),ns(i,e),ss(i,e)};var w_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ul=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof s==="number")n.minLength=s;if(typeof i==="number")n.maxLength=i;if(a){if(n.format=w_[a]??a,n.format==="")delete n.format;if(a==="time")delete n.format}if(c)n.contentEncoding=c;if(u&&u.size>0){let l=[...u];if(l.length===1)n.pattern=l[0].source;else if(l.length>1)n.allOf=[...l.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}},ll=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))n.type="integer";else n.type="number";if(typeof l==="number")if(t.target==="draft-04"||t.target==="openapi-3.0")n.minimum=l,n.exclusiveMinimum=!0;else n.exclusiveMinimum=l;if(typeof s==="number"){if(n.minimum=s,typeof l==="number"&&t.target!=="draft-04")if(l>=s)delete n.minimum;else delete n.exclusiveMinimum}if(typeof c==="number")if(t.target==="draft-04"||t.target==="openapi-3.0")n.maximum=c,n.exclusiveMaximum=!0;else n.exclusiveMaximum=c;if(typeof i==="number"){if(n.maximum=i,typeof c==="number"&&t.target!=="draft-04")if(c<=i)delete n.maximum;else delete n.exclusiveMaximum}if(typeof u==="number")n.multipleOf=u},dl=(e,t,r,o)=>{r.type="boolean"};var pl=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var fl=(e,t,r,o)=>{r.not={}};var ml=(e,t,r,o)=>{};var hl=(e,t,r,o)=>{let n=e._zod.def,s=Wr(n.entries);if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},gl=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(i));else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}};var _l=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var yl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var vl=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;if(typeof i==="number")n.minItems=i;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=X(s.element,t,{...o,path:[...o.path,"items"]})},bl=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let c in i)n.properties[c]=X(i[c],t,{...o,path:[...o.path,"properties",c]});let a=new Set(Object.keys(i)),u=new Set([...a].filter((c)=>{let l=s.shape[c]._zod;if(t.io==="input")return l.optin===void 0;else return l.optout===void 0}));if(u.size>0)n.required=Array.from(u);if(s.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")n.additionalProperties=!1}else if(s.catchall)n.additionalProperties=X(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},$l=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,u)=>X(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",u]}));if(s)r.oneOf=i;else r.anyOf=i},wl=(e,t,r,o)=>{let n=e._zod.def,s=X(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=X(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(c)=>("allOf"in c)&&Object.keys(c).length===1,u=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=u};var xl=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,u=i._zod.bag?.patterns;if(s.mode==="loose"&&u&&u.size>0){let l=X(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of u)n.patternProperties[d.source]=l}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=X(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=X(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=i._zod.values;if(c){let l=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(l.length>0)n.required=l}},zl=(e,t,r,o)=>{let n=e._zod.def,s=X(n.innerType,t,o),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=n.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},Sl=(e,t,r,o)=>{let n=e._zod.def;X(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},kl=(e,t,r,o)=>{let n=e._zod.def;X(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Pl=(e,t,r,o)=>{let n=e._zod.def;X(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},El=(e,t,r,o)=>{let n=e._zod.def;X(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Tl=(e,t,r,o)=>{let n=e._zod.def,s=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;X(s,t,o);let i=t.seen.get(e);i.ref=s},Rl=(e,t,r,o)=>{let n=e._zod.def;X(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var is=(e,t,r,o)=>{let n=e._zod.def;X(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType};function et(e){return!!e._zod}function ue(e,t){if(et(e))return Wt(e,t);return e.safeParse(t)}function kt(e){if(!e)return;let t;if(et(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Ol(e){if(et(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o;return}var R_=_("ZodISODateTime",(e,t)=>{Lc.init(e,t),J.init(e,t)});function as(e){return Bu(R_,e)}var O_=_("ZodISODate",(e,t)=>{Uc.init(e,t),J.init(e,t)});function Il(e){return Gu(O_,e)}var I_=_("ZodISOTime",(e,t)=>{Fc.init(e,t),J.init(e,t)});function Nl(e){return Wu(I_,e)}var N_=_("ZodISODuration",(e,t)=>{Vc.init(e,t),J.init(e,t)});function Cl(e){return Xu(N_,e)}var jl=(e,t)=>{eo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Sa(e,r)},flatten:{value:(r)=>za(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Kt,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Kt,2)}},isEmpty:{get(){return e.issues.length===0}}})},sE=_("ZodError",jl),ye=_("ZodError",jl,{Parent:Error});var Al=to(ye),Zl=ro(ye),ql=Gt(ye),Ml=Xt(ye),Dl=ka(ye),Ll=Pa(ye),Ul=Ea(ye),Fl=Ta(ye),Vl=Ra(ye),Hl=Oa(ye),Jl=Ia(ye),Kl=Na(ye);var B=_("ZodType",(e,t)=>(F.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:tr(e,"input"),output:tr(e,"output")}}),e.toJSONSchema=cl(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(We(t,{checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(r,o)=>Ne(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.parse=(r,o)=>Al(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>ql(e,r,o),e.parseAsync=async(r,o)=>Zl(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Ml(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Dl(e,r,o),e.decode=(r,o)=>Ll(e,r,o),e.encodeAsync=async(r,o)=>Ul(e,r,o),e.decodeAsync=async(r,o)=>Fl(e,r,o),e.safeEncode=(r,o)=>Vl(e,r,o),e.safeDecode=(r,o)=>Hl(e,r,o),e.safeEncodeAsync=async(r,o)=>Jl(e,r,o),e.safeDecodeAsync=async(r,o)=>Kl(e,r,o),e.refine=(r,o)=>e.check(Sy(r,o)),e.superRefine=(r)=>e.check(ky(r)),e.overwrite=(r)=>e.check(Qe(r)),e.optional=()=>W(e),e.exactOptional=()=>fy(e),e.nullable=()=>Wl(e),e.nullish=()=>W(Wl(e)),e.nonoptional=(r)=>vy(e,r),e.array=()=>j(e),e.or=(r)=>U([e,r]),e.and=(r)=>ho(e,r),e.transform=(r)=>ls(e,td(r)),e.default=(r)=>gy(e,r),e.prefault=(r)=>yy(e,r),e.catch=(r)=>$y(e,r),e.pipe=(r)=>ls(e,r),e.readonly=()=>zy(e),e.describe=(r)=>{let o=e.clone();return gt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return gt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return gt.get(e);let o=e.clone();return gt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=(r)=>r(e),e)),Xl=_("_ZodString",(e,t)=>{ao.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>ul(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(Jn(...o)),e.includes=(...o)=>e.check(Gn(...o)),e.startsWith=(...o)=>e.check(Wn(...o)),e.endsWith=(...o)=>e.check(Xn(...o)),e.min=(...o)=>e.check(St(...o)),e.max=(...o)=>e.check(po(...o)),e.length=(...o)=>e.check(fo(...o)),e.nonempty=(...o)=>e.check(St(1,...o)),e.lowercase=(o)=>e.check(Kn(o)),e.uppercase=(o)=>e.check(Bn(o)),e.trim=()=>e.check(Qn()),e.normalize=(...o)=>e.check(Yn(...o)),e.toLowerCase=()=>e.check(es()),e.toUpperCase=()=>e.check(ts()),e.slugify=()=>e.check(rs())}),A_=_("ZodString",(e,t)=>{ao.init(e,t),Xl.init(e,t),e.email=(r)=>e.check(Pu(Z_,r)),e.url=(r)=>e.check(Iu(q_,r)),e.jwt=(r)=>e.check(Ku(Q_,r)),e.emoji=(r)=>e.check(Nu(M_,r)),e.guid=(r)=>e.check(Hn(Bl,r)),e.uuid=(r)=>e.check(Eu(mo,r)),e.uuidv4=(r)=>e.check(Tu(mo,r)),e.uuidv6=(r)=>e.check(Ru(mo,r)),e.uuidv7=(r)=>e.check(Ou(mo,r)),e.nanoid=(r)=>e.check(Cu(D_,r)),e.guid=(r)=>e.check(Hn(Bl,r)),e.cuid=(r)=>e.check(ju(L_,r)),e.cuid2=(r)=>e.check(Au(U_,r)),e.ulid=(r)=>e.check(Zu(F_,r)),e.base64=(r)=>e.check(Vu(W_,r)),e.base64url=(r)=>e.check(Hu(X_,r)),e.xid=(r)=>e.check(qu(V_,r)),e.ksuid=(r)=>e.check(Mu(H_,r)),e.ipv4=(r)=>e.check(Du(J_,r)),e.ipv6=(r)=>e.check(Lu(K_,r)),e.cidrv4=(r)=>e.check(Uu(B_,r)),e.cidrv6=(r)=>e.check(Fu(G_,r)),e.e164=(r)=>e.check(Ju(Y_,r)),e.datetime=(r)=>e.check(as(r)),e.date=(r)=>e.check(Il(r)),e.time=(r)=>e.check(Nl(r)),e.duration=(r)=>e.check(Cl(r))});function m(e){return ku(A_,e)}var J=_("ZodStringFormat",(e,t)=>{V.init(e,t),Xl.init(e,t)}),Z_=_("ZodEmail",(e,t)=>{Ic.init(e,t),J.init(e,t)});var Bl=_("ZodGUID",(e,t)=>{Rc.init(e,t),J.init(e,t)});var mo=_("ZodUUID",(e,t)=>{Oc.init(e,t),J.init(e,t)});var q_=_("ZodURL",(e,t)=>{Nc.init(e,t),J.init(e,t)});var M_=_("ZodEmoji",(e,t)=>{Cc.init(e,t),J.init(e,t)});var D_=_("ZodNanoID",(e,t)=>{jc.init(e,t),J.init(e,t)});var L_=_("ZodCUID",(e,t)=>{Ac.init(e,t),J.init(e,t)});var U_=_("ZodCUID2",(e,t)=>{Zc.init(e,t),J.init(e,t)});var F_=_("ZodULID",(e,t)=>{qc.init(e,t),J.init(e,t)});var V_=_("ZodXID",(e,t)=>{Mc.init(e,t),J.init(e,t)});var H_=_("ZodKSUID",(e,t)=>{Dc.init(e,t),J.init(e,t)});var J_=_("ZodIPv4",(e,t)=>{Hc.init(e,t),J.init(e,t)});var K_=_("ZodIPv6",(e,t)=>{Jc.init(e,t),J.init(e,t)});var B_=_("ZodCIDRv4",(e,t)=>{Kc.init(e,t),J.init(e,t)});var G_=_("ZodCIDRv6",(e,t)=>{Bc.init(e,t),J.init(e,t)});var W_=_("ZodBase64",(e,t)=>{Wc.init(e,t),J.init(e,t)});var X_=_("ZodBase64URL",(e,t)=>{Xc.init(e,t),J.init(e,t)});var Y_=_("ZodE164",(e,t)=>{Yc.init(e,t),J.init(e,t)});var Q_=_("ZodJWT",(e,t)=>{Qc.init(e,t),J.init(e,t)});var Yl=_("ZodNumber",(e,t)=>{Ln.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>ll(e,o,n,s),e.gt=(o,n)=>e.check(uo(o,n)),e.gte=(o,n)=>e.check(er(o,n)),e.min=(o,n)=>e.check(er(o,n)),e.lt=(o,n)=>e.check(co(o,n)),e.lte=(o,n)=>e.check(Qt(o,n)),e.max=(o,n)=>e.check(Qt(o,n)),e.int=(o)=>e.check(Gl(o)),e.safe=(o)=>e.check(Gl(o)),e.positive=(o)=>e.check(uo(0,o)),e.nonnegative=(o)=>e.check(er(0,o)),e.negative=(o)=>e.check(co(0,o)),e.nonpositive=(o)=>e.check(Qt(0,o)),e.multipleOf=(o,n)=>e.check(lo(o,n)),e.step=(o,n)=>e.check(lo(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function D(e){return Yu(Yl,e)}var ey=_("ZodNumberFormat",(e,t)=>{eu.init(e,t),Yl.init(e,t)});function Gl(e){return Qu(ey,e)}var ty=_("ZodBoolean",(e,t)=>{tu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dl(e,r,o,n)});function ee(e){return el(ty,e)}var ry=_("ZodNull",(e,t)=>{ru.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pl(e,r,o,n)});function ds(e){return tl(ry,e)}var oy=_("ZodUnknown",(e,t)=>{ou.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ml(e,r,o,n)});function K(){return rl(oy)}var ny=_("ZodNever",(e,t)=>{nu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fl(e,r,o,n)});function sy(e){return ol(ny,e)}var iy=_("ZodArray",(e,t)=>{su.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vl(e,r,o,n),e.element=t.element,e.min=(r,o)=>e.check(St(r,o)),e.nonempty=(r)=>e.check(St(1,r)),e.max=(r,o)=>e.check(po(r,o)),e.length=(r,o)=>e.check(fo(r,o)),e.unwrap=()=>e.element});function j(e,t){return nl(iy,e,t)}var Ql=_("ZodObject",(e,t)=>{cu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bl(e,r,o,n),M(e,"shape",()=>t.shape),e.keyof=()=>fe(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:K()}),e.loose=()=>e.clone({...e._zod.def,catchall:K()}),e.strict=()=>e.clone({...e._zod.def,catchall:sy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>a_(e,r),e.safeExtend=(r)=>c_(e,r),e.merge=(r)=>u_(e,r),e.pick=(r)=>s_(e,r),e.omit=(r)=>i_(e,r),e.partial=(...r)=>l_(rd,e,r[0]),e.required=(...r)=>d_(od,e,r[0])});function w(e,t){let r={type:"object",shape:e??{},...z(t)};return new Ql(r)}function le(e,t){return new Ql({type:"object",shape:e,catchall:K(),...z(t)})}var ed=_("ZodUnion",(e,t)=>{Un.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$l(e,r,o,n),e.options=t.options});function U(e,t){return new ed({type:"union",options:e,...z(t)})}var ay=_("ZodDiscriminatedUnion",(e,t)=>{ed.init(e,t),uu.init(e,t)});function ps(e,t,r){return new ay({type:"union",options:t,discriminator:e,...z(r)})}var cy=_("ZodIntersection",(e,t)=>{lu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wl(e,r,o,n)});function ho(e,t){return new cy({type:"intersection",left:e,right:t})}var uy=_("ZodRecord",(e,t)=>{du.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xl(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function G(e,t,r){return new uy({type:"record",keyType:e,valueType:t,...z(r)})}var us=_("ZodEnum",(e,t)=>{pu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(o,n,s)=>hl(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new us({...t,checks:[],...z(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new us({...t,checks:[],...z(n),entries:s})}});function fe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new us({type:"enum",entries:r,...z(t)})}var ly=_("ZodLiteral",(e,t)=>{fu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gl(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function k(e,t){return new ly({type:"literal",values:Array.isArray(e)?e:[e],...z(t)})}var dy=_("ZodTransform",(e,t)=>{mu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yl(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Jt(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(ht(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(ht(i))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((s)=>(r.value=s,r));return r.value=n,r}});function td(e){return new dy({type:"transform",transform:e})}var rd=_("ZodOptional",(e,t)=>{Fn.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>is(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function W(e){return new rd({type:"optional",innerType:e})}var py=_("ZodExactOptional",(e,t)=>{hu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>is(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function fy(e){return new py({type:"optional",innerType:e})}var my=_("ZodNullable",(e,t)=>{gu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>zl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Wl(e){return new my({type:"nullable",innerType:e})}var hy=_("ZodDefault",(e,t)=>{_u.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>kl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gy(e,t){return new hy({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():On(t)}})}var _y=_("ZodPrefault",(e,t)=>{yu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Pl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function yy(e,t){return new _y({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():On(t)}})}var od=_("ZodNonOptional",(e,t)=>{vu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Sl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function vy(e,t){return new od({type:"nonoptional",innerType:e,...z(t)})}var by=_("ZodCatch",(e,t)=>{bu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>El(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function $y(e,t){return new by({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var wy=_("ZodPipe",(e,t)=>{$u.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Tl(e,r,o,n),e.in=t.in,e.out=t.out});function ls(e,t){return new wy({type:"pipe",in:e,out:t})}var xy=_("ZodReadonly",(e,t)=>{wu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Rl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function zy(e){return new xy({type:"readonly",innerType:e})}var nd=_("ZodCustom",(e,t)=>{xu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_l(e,r,o,n)});function sd(e,t){return sl(nd,e??(()=>!0),t)}function Sy(e,t={}){return il(nd,e,t)}function ky(e){return al(e)}function fs(e,t){return ls(td(e),t)}be(Vn());var or="2025-11-25";var _o=[or,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],tt="io.modelcontextprotocol/related-task",yo="2.0",re=sd((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),id=U([m(),D().int()]),ad=m(),wT=le({ttl:U([D(),ds()]).optional(),pollInterval:D().optional()}),Py=w({ttl:D().optional()}),Ey=w({taskId:m()}),ms=le({progressToken:id.optional(),[tt]:Ey.optional()}),ve=w({_meta:ms.optional()}),nr=ve.extend({task:Py.optional()}),cd=(e)=>nr.safeParse(e).success,oe=w({method:m(),params:ve.loose().optional()}),$e=w({_meta:ms.optional()}),we=w({method:m(),params:$e.loose().optional()}),ne=le({_meta:ms.optional()}),vo=U([m(),D().int()]),ud=w({jsonrpc:k(yo),id:vo,...oe.shape}).strict(),hs=(e)=>ud.safeParse(e).success,ld=w({jsonrpc:k(yo),...we.shape}).strict(),dd=(e)=>ld.safeParse(e).success,gs=w({jsonrpc:k(yo),id:vo,result:ne}).strict(),sr=(e)=>gs.safeParse(e).success;var S;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(S||(S={}));var _s=w({jsonrpc:k(yo),id:vo.optional(),error:w({code:D().int(),message:m(),data:K().optional()})}).strict();var pd=(e)=>_s.safeParse(e).success;var fd=U([ud,ld,gs,_s]),xT=U([gs,_s]),Le=ne.strict(),Ty=$e.extend({requestId:vo.optional(),reason:m().optional()}),bo=we.extend({method:k("notifications/cancelled"),params:Ty}),Ry=w({src:m(),mimeType:m().optional(),sizes:j(m()).optional(),theme:fe(["light","dark"]).optional()}),ir=w({icons:j(Ry).optional()}),Pt=w({name:m(),title:m().optional()}),md=Pt.extend({...Pt.shape,...ir.shape,version:m(),websiteUrl:m().optional(),description:m().optional()}),Oy=ho(w({applyDefaults:ee().optional()}),G(m(),K())),Iy=fs((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},ho(w({form:Oy.optional(),url:re.optional()}),G(m(),K()).optional())),Ny=le({list:re.optional(),cancel:re.optional(),requests:le({sampling:le({createMessage:re.optional()}).optional(),elicitation:le({create:re.optional()}).optional()}).optional()}),Cy=le({list:re.optional(),cancel:re.optional(),requests:le({tools:le({call:re.optional()}).optional()}).optional()}),jy=w({experimental:G(m(),re).optional(),sampling:w({context:re.optional(),tools:re.optional()}).optional(),elicitation:Iy.optional(),roots:w({listChanged:ee().optional()}).optional(),tasks:Ny.optional()}),Ay=ve.extend({protocolVersion:m(),capabilities:jy,clientInfo:md}),ys=oe.extend({method:k("initialize"),params:Ay});var Zy=w({experimental:G(m(),re).optional(),logging:re.optional(),completions:re.optional(),prompts:w({listChanged:ee().optional()}).optional(),resources:w({subscribe:ee().optional(),listChanged:ee().optional()}).optional(),tools:w({listChanged:ee().optional()}).optional(),tasks:Cy.optional()}),vs=ne.extend({protocolVersion:m(),capabilities:Zy,serverInfo:md,instructions:m().optional()}),bs=we.extend({method:k("notifications/initialized"),params:$e.optional()});var $o=oe.extend({method:k("ping"),params:ve.optional()}),qy=w({progress:D(),total:W(D()),message:W(m())}),My=w({...$e.shape,...qy.shape,progressToken:id}),wo=we.extend({method:k("notifications/progress"),params:My}),Dy=ve.extend({cursor:ad.optional()}),ar=oe.extend({params:Dy.optional()}),cr=ne.extend({nextCursor:ad.optional()}),Ly=fe(["working","input_required","completed","failed","cancelled"]),ur=w({taskId:m(),status:Ly,ttl:U([D(),ds()]),createdAt:m(),lastUpdatedAt:m(),pollInterval:W(D()),statusMessage:W(m())}),Ue=ne.extend({task:ur}),Uy=$e.merge(ur),lr=we.extend({method:k("notifications/tasks/status"),params:Uy}),xo=oe.extend({method:k("tasks/get"),params:ve.extend({taskId:m()})}),zo=ne.merge(ur),So=oe.extend({method:k("tasks/result"),params:ve.extend({taskId:m()})}),zT=ne.loose(),ko=ar.extend({method:k("tasks/list")}),Po=cr.extend({tasks:j(ur)}),Eo=oe.extend({method:k("tasks/cancel"),params:ve.extend({taskId:m()})}),hd=ne.merge(ur),gd=w({uri:m(),mimeType:W(m()),_meta:G(m(),K()).optional()}),_d=gd.extend({text:m()}),$s=m().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),yd=gd.extend({blob:$s}),dr=fe(["user","assistant"]),Et=w({audience:j(dr).optional(),priority:D().min(0).max(1).optional(),lastModified:as({offset:!0}).optional()}),vd=w({...Pt.shape,...ir.shape,uri:m(),description:W(m()),mimeType:W(m()),annotations:Et.optional(),_meta:W(le({}))}),Fy=w({...Pt.shape,...ir.shape,uriTemplate:m(),description:W(m()),mimeType:W(m()),annotations:Et.optional(),_meta:W(le({}))}),ws=ar.extend({method:k("resources/list")}),xs=cr.extend({resources:j(vd)}),zs=ar.extend({method:k("resources/templates/list")}),Ss=cr.extend({resourceTemplates:j(Fy)}),ks=ve.extend({uri:m()}),Vy=ks,Ps=oe.extend({method:k("resources/read"),params:Vy}),Es=ne.extend({contents:j(U([_d,yd]))}),pr=we.extend({method:k("notifications/resources/list_changed"),params:$e.optional()}),Hy=ks,Jy=oe.extend({method:k("resources/subscribe"),params:Hy}),Ky=ks,By=oe.extend({method:k("resources/unsubscribe"),params:Ky}),Gy=$e.extend({uri:m()}),Ts=we.extend({method:k("notifications/resources/updated"),params:Gy}),Wy=w({name:m(),description:W(m()),required:W(ee())}),Xy=w({...Pt.shape,...ir.shape,description:W(m()),arguments:W(j(Wy)),_meta:W(le({}))}),Yy=ar.extend({method:k("prompts/list")}),Rs=cr.extend({prompts:j(Xy)}),Qy=ve.extend({name:m(),arguments:G(m(),m()).optional()}),ev=oe.extend({method:k("prompts/get"),params:Qy}),Os=w({type:k("text"),text:m(),annotations:Et.optional(),_meta:G(m(),K()).optional()}),Is=w({type:k("image"),data:$s,mimeType:m(),annotations:Et.optional(),_meta:G(m(),K()).optional()}),Ns=w({type:k("audio"),data:$s,mimeType:m(),annotations:Et.optional(),_meta:G(m(),K()).optional()}),tv=w({type:k("tool_use"),name:m(),id:m(),input:G(m(),K()),_meta:G(m(),K()).optional()}),rv=w({type:k("resource"),resource:U([_d,yd]),annotations:Et.optional(),_meta:G(m(),K()).optional()}),ov=vd.extend({type:k("resource_link")}),Cs=U([Os,Is,Ns,ov,rv]),nv=w({role:dr,content:Cs}),js=ne.extend({description:m().optional(),messages:j(nv)}),As=we.extend({method:k("notifications/prompts/list_changed"),params:$e.optional()}),sv=w({title:m().optional(),readOnlyHint:ee().optional(),destructiveHint:ee().optional(),idempotentHint:ee().optional(),openWorldHint:ee().optional()}),iv=w({taskSupport:fe(["required","optional","forbidden"]).optional()}),bd=w({...Pt.shape,...ir.shape,description:m().optional(),inputSchema:w({type:k("object"),properties:G(m(),re).optional(),required:j(m()).optional()}).catchall(K()),outputSchema:w({type:k("object"),properties:G(m(),re).optional(),required:j(m()).optional()}).catchall(K()).optional(),annotations:sv.optional(),execution:iv.optional(),_meta:G(m(),K()).optional()}),Zs=ar.extend({method:k("tools/list")}),fr=cr.extend({tools:j(bd)}),je=ne.extend({content:j(Cs).default([]),structuredContent:G(m(),K()).optional(),isError:ee().optional()}),ST=je.or(ne.extend({toolResult:K()})),av=nr.extend({name:m(),arguments:G(m(),K()).optional()}),mr=oe.extend({method:k("tools/call"),params:av}),hr=we.extend({method:k("notifications/tools/list_changed"),params:$e.optional()}),$d=w({autoRefresh:ee().default(!0),debounceMs:D().int().nonnegative().default(300)}),gr=fe(["debug","info","notice","warning","error","critical","alert","emergency"]),cv=ve.extend({level:gr}),qs=oe.extend({method:k("logging/setLevel"),params:cv}),uv=$e.extend({level:gr,logger:m().optional(),data:K()}),lv=we.extend({method:k("notifications/message"),params:uv}),dv=w({name:m().optional()}),pv=w({hints:j(dv).optional(),costPriority:D().min(0).max(1).optional(),speedPriority:D().min(0).max(1).optional(),intelligencePriority:D().min(0).max(1).optional()}),fv=w({mode:fe(["auto","required","none"]).optional()}),mv=w({type:k("tool_result"),toolUseId:m().describe("The unique identifier for the corresponding tool call."),content:j(Cs).default([]),structuredContent:w({}).loose().optional(),isError:ee().optional(),_meta:G(m(),K()).optional()}),hv=ps("type",[Os,Is,Ns]),go=ps("type",[Os,Is,Ns,tv,mv]),gv=w({role:dr,content:U([go,j(go)]),_meta:G(m(),K()).optional()}),_v=nr.extend({messages:j(gv),modelPreferences:pv.optional(),systemPrompt:m().optional(),includeContext:fe(["none","thisServer","allServers"]).optional(),temperature:D().optional(),maxTokens:D().int(),stopSequences:j(m()).optional(),metadata:re.optional(),tools:j(bd).optional(),toolChoice:fv.optional()}),_r=oe.extend({method:k("sampling/createMessage"),params:_v}),_t=ne.extend({model:m(),stopReason:W(fe(["endTurn","stopSequence","maxTokens"]).or(m())),role:dr,content:hv}),yr=ne.extend({model:m(),stopReason:W(fe(["endTurn","stopSequence","maxTokens","toolUse"]).or(m())),role:dr,content:U([go,j(go)])}),yv=w({type:k("boolean"),title:m().optional(),description:m().optional(),default:ee().optional()}),vv=w({type:k("string"),title:m().optional(),description:m().optional(),minLength:D().optional(),maxLength:D().optional(),format:fe(["email","uri","date","date-time"]).optional(),default:m().optional()}),bv=w({type:fe(["number","integer"]),title:m().optional(),description:m().optional(),minimum:D().optional(),maximum:D().optional(),default:D().optional()}),$v=w({type:k("string"),title:m().optional(),description:m().optional(),enum:j(m()),default:m().optional()}),wv=w({type:k("string"),title:m().optional(),description:m().optional(),oneOf:j(w({const:m(),title:m()})),default:m().optional()}),xv=w({type:k("string"),title:m().optional(),description:m().optional(),enum:j(m()),enumNames:j(m()).optional(),default:m().optional()}),zv=U([$v,wv]),Sv=w({type:k("array"),title:m().optional(),description:m().optional(),minItems:D().optional(),maxItems:D().optional(),items:w({type:k("string"),enum:j(m())}),default:j(m()).optional()}),kv=w({type:k("array"),title:m().optional(),description:m().optional(),minItems:D().optional(),maxItems:D().optional(),items:w({anyOf:j(w({const:m(),title:m()}))}),default:j(m()).optional()}),Pv=U([Sv,kv]),Ev=U([xv,zv,Pv]),Tv=U([Ev,yv,vv,bv]),Rv=nr.extend({mode:k("form").optional(),message:m(),requestedSchema:w({type:k("object"),properties:G(m(),Tv),required:j(m()).optional()})}),Ov=nr.extend({mode:k("url"),message:m(),elicitationId:m(),url:m().url()}),Iv=U([Rv,Ov]),vr=oe.extend({method:k("elicitation/create"),params:Iv}),Nv=$e.extend({elicitationId:m()}),Cv=we.extend({method:k("notifications/elicitation/complete"),params:Nv}),rt=ne.extend({action:fe(["accept","decline","cancel"]),content:fs((e)=>e===null?void 0:e,G(m(),U([m(),D(),ee(),j(m())])).optional())}),jv=w({type:k("ref/resource"),uri:m()});var Av=w({type:k("ref/prompt"),name:m()}),Zv=ve.extend({ref:U([Av,jv]),argument:w({name:m(),value:m()}),context:w({arguments:G(m(),m()).optional()}).optional()}),qv=oe.extend({method:k("completion/complete"),params:Zv});var Ms=ne.extend({completion:le({values:j(m()).max(100),total:W(D().int()),hasMore:W(ee())})}),Mv=w({uri:m().startsWith("file://"),name:m().optional(),_meta:G(m(),K()).optional()}),Ds=oe.extend({method:k("roots/list"),params:ve.optional()}),Ls=ne.extend({roots:j(Mv)}),Dv=we.extend({method:k("notifications/roots/list_changed"),params:$e.optional()}),kT=U([$o,ys,qv,qs,ev,Yy,ws,zs,Ps,Jy,By,mr,Zs,xo,So,ko,Eo]),PT=U([bo,wo,bs,Dv,lr]),ET=U([Le,_t,yr,rt,Ls,zo,Po,Ue]),TT=U([$o,_r,vr,Ds,xo,So,ko,Eo]),RT=U([bo,wo,lv,Ts,pr,hr,As,lr,Cv]),OT=U([Le,vs,Ms,js,Rs,xs,Ss,Es,je,fr,zo,Po,Ue]);class x extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===S.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new wd(o.elicitations,t)}return new x(e,t,r)}}class wd extends x{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(S.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function ot(e){return e==="completed"||e==="failed"||e==="cancelled"}var Lv=Symbol("Let zodToJsonSchema decide on which parser to use");var lR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Us(e){let r=kt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=Ol(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function Fs(e,t){let r=ue(e,t);if(!r.success)throw r.error;return r.data}var Kv=60000;class $r{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(bo,(t)=>{this._oncancel(t)}),this.setNotificationHandler(wo,(t)=>{this._onprogress(t)}),this.setRequestHandler($o,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(xo,async(t,r)=>{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new x(S.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(So,async(t,r)=>{let o=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,u=a.id,c=this._requestResolvers.get(u);if(c)if(this._requestResolvers.delete(u),i.type==="response")c(a);else{let l=a,d=new x(l.error.code,l.error.message,l.error.data);c(d)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${u}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(n,r.sessionId);if(!s)throw new x(S.InvalidParams,`Task not found: ${n}`);if(!ot(s.status))return await this._waitForTaskUpdate(n,r.signal),await o();if(ot(s.status)){let i=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...i,_meta:{...i._meta,[tt]:{taskId:n}}}}return await o()};return await o()}),this.setRequestHandler(ko,async(t,r)=>{try{let{tasks:o,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:n,_meta:{}}}catch(o){throw new x(S.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Eo,async(t,r)=>{try{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new x(S.InvalidParams,`Task not found: ${t.params.taskId}`);if(ot(o.status))throw new x(S.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new x(S.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(o){if(o instanceof x)throw o;throw new x(S.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),x.fromError(S.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{if(o?.(n,s),sr(n)||pd(n))this._onresponse(n);else if(hs(n))this._onrequest(n,s);else if(dd(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=x.fromError(S.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,n=e.params?._meta?.[tt]?.taskId;if(r===void 0){let c={jsonrpc:"2.0",id:e.id,error:{code:S.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:c,timestamp:Date.now()},o?.sessionId).catch((l)=>this._onerror(Error(`Failed to enqueue error response: ${l}`)));else o?.send(c).catch((l)=>this._onerror(Error(`Failed to send an error response: ${l}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=cd(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:s.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async(c)=>{if(s.signal.aborted)return;let l={relatedRequestId:e.id};if(n)l.relatedTask={taskId:n};await this.notification(c,l)},sendRequest:async(c,l,d)=>{if(s.signal.aborted)throw new x(S.ConnectionClosed,"Request was cancelled");let p={...d,relatedRequestId:e.id};if(n&&!p.relatedTask)p.relatedTask={taskId:n};let f=p.relatedTask?.taskId??n;if(f&&a)await a.updateTaskStatus(f,"input_required");return await this.request(c,l,p)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:a,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(i)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,u)).then(async(c)=>{if(s.signal.aborted)return;let l={result:c,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)},async(c)=>{if(s.signal.aborted)return;let l={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:S.InternalError,message:c.message??"Internal error",...c.data!==void 0&&{data:c.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)}).catch((c)=>this._onerror(Error(`Failed to send response: ${c}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===s)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),sr(e))r(e);else{let s=new x(e.error.code,e.error.message,e.error.data);r(s)}return}let o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(sr(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")n=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(sr(e))o(e);else{let s=x.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(s){yield{type:"error",error:s instanceof x?s:new x(S.InternalError,String(s))}}return}let n;try{let s=await this.request(e,Ue,r);if(s.task)n=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new x(S.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:i},ot(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(i.status==="failed")yield{type:"error",error:new x(S.InternalError,`Task ${n} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new x(S.InternalError,`Task ${n} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((u)=>setTimeout(u,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof x?s:new x(S.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((u,c)=>{let l=(y)=>{c(y)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(y){l(y);return}r?.signal?.throwIfAborted();let d=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:d};if(r?.onprogress)this._progressHandlers.set(d,r.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}};if(i)p.params={...p.params,task:i};if(a)p.params={...p.params,_meta:{...p.params?._meta||{},[tt]:a}};let f=(y)=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:d,reason:String(y)}},{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((T)=>this._onerror(Error(`Failed to send cancellation: ${T}`)));let R=y instanceof x?y:new x(S.RequestTimeout,String(y));c(R)};this._responseHandlers.set(d,(y)=>{if(r?.signal?.aborted)return;if(y instanceof Error)return c(y);try{let R=ue(t,y.result);if(!R.success)c(R.error);else u(R.data)}catch(R){c(R)}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let h=r?.timeout??Kv,g=()=>f(x.fromError(S.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(d,h,r?.maxTotalTimeout,g,r?.resetTimeoutOnProgress??!1);let v=a?.taskId;if(v){let y=(R)=>{let T=this._responseHandlers.get(d);if(T)T(R);else this._onerror(Error(`Response handler missing for side-channeled request ${d}`))};this._requestResolvers.set(d,y),this._enqueueTaskMessage(v,{type:"request",message:p,timestamp:Date.now()}).catch((R)=>{this._cleanupTimeout(d),c(R)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((y)=>{this._cleanupTimeout(d),c(y)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},zo,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Po,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},hd,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[tt]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[tt]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[tt]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=Us(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,n)=>{let s=Fs(e,o);return Promise.resolve(t(s,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=Us(e);this._notificationHandlers.set(r,(o)=>{let n=Fs(e,o);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let o of r)if(o.type==="request"&&hs(o.message)){let n=o.message.id,s=this._requestResolvers.get(n);if(s)s(new x(S.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e);if(o?.pollInterval)r=o.pollInterval}catch{}return new Promise((o,n)=>{if(t.aborted){n(new x(S.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(s),n(new x(S.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(o)=>{if(!e)throw Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async(o)=>{let n=await r.getTask(o,t);if(!n)throw new x(S.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(o,n,s)=>{await r.storeTaskResult(o,n,s,t);let i=await r.getTask(o,t);if(i){let a=lr.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),ot(i.status))this._cleanupTaskProgressHandler(o)}},getTaskResult:(o)=>r.getTaskResult(o,t),updateTaskStatus:async(o,n,s)=>{let i=await r.getTask(o,t);if(!i)throw new x(S.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(ot(i.status))throw new x(S.InvalidParams,`Cannot update task "${o}" from terminal status "${i.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,n,s,t);let a=await r.getTask(o,t);if(a){let u=lr.parse({method:"notifications/tasks/status",params:a});if(await this.notification(u),ot(a.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>r.listTasks(o,t)}}}function xd(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function To(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];if(xd(i)&&xd(s))r[n]={...i,...s};else r[n]=s}return r}var tg=kn(Zi(),1),rg=kn(eg(),1);function ok(){let e=new tg.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return rg.default(e),e}class Hr{constructor(e){this._ajv=e??ok()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class Ki{constructor(e){this._client=e}async*callToolStream(e,t=je,r){let o=this._client,n={...r,task:r?.task??(o.isToolTask(e.name)?{}:void 0)},s=o.requestStream({method:"tools/call",params:e},t,n),i=o.getToolOutputValidator(e.name);for await(let a of s){if(a.type==="result"&&i){let u=a.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new x(S.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let c=i(u.structuredContent);if(!c.valid){yield{type:"error",error:new x(S.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)};return}}catch(c){if(c instanceof x){yield{type:"error",error:c};return}yield{type:"error",error:new x(S.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)};return}}yield a}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function mn(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function hn(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function gn(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];if(r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default"))r[n]=s.default;if(r[n]!==void 0)gn(s,r[n])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")gn(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")gn(r,t)}}function nk(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}class Bi extends $r{constructor(e,t){super(t);if(this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new Hr,t?.listChanged)this._pendingListChangedConfig=t.listChanged}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",hr,e.tools,async()=>(await this.listTools()).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",As,e.prompts,async()=>(await this.listPrompts()).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",pr,e.resources,async()=>(await this.listResources()).resources)}get experimental(){if(!this._experimental)this._experimental={tasks:new Ki(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=To(this._capabilities,e)}setRequestHandler(e,t){let o=kt(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(et(o)){let i=o;n=i._zod?.def?.value??i.value}else{let i=o;n=i._def?.value??i.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");let s=n;if(s==="elicitation/create"){let i=async(a,u)=>{let c=ue(vr,a);if(!c.success){let y=c.error instanceof Error?c.error.message:String(c.error);throw new x(S.InvalidParams,`Invalid elicitation request: ${y}`)}let{params:l}=c.data;l.mode=l.mode??"form";let{supportsFormMode:d,supportsUrlMode:p}=nk(this._capabilities.elicitation);if(l.mode==="form"&&!d)throw new x(S.InvalidParams,"Client does not support form-mode elicitation requests");if(l.mode==="url"&&!p)throw new x(S.InvalidParams,"Client does not support URL-mode elicitation requests");let f=await Promise.resolve(t(a,u));if(l.task){let y=ue(Ue,f);if(!y.success){let R=y.error instanceof Error?y.error.message:String(y.error);throw new x(S.InvalidParams,`Invalid task creation result: ${R}`)}return y.data}let h=ue(rt,f);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new x(S.InvalidParams,`Invalid elicitation result: ${y}`)}let g=h.data,v=l.mode==="form"?l.requestedSchema:void 0;if(l.mode==="form"&&g.action==="accept"&&g.content&&v){if(this._capabilities.elicitation?.form?.applyDefaults)try{gn(v,g.content)}catch{}}return g};return super.setRequestHandler(e,i)}if(s==="sampling/createMessage"){let i=async(a,u)=>{let c=ue(_r,a);if(!c.success){let g=c.error instanceof Error?c.error.message:String(c.error);throw new x(S.InvalidParams,`Invalid sampling request: ${g}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let g=ue(Ue,d);if(!g.success){let v=g.error instanceof Error?g.error.message:String(g.error);throw new x(S.InvalidParams,`Invalid task creation result: ${v}`)}return g.data}let f=l.tools||l.toolChoice?yr:_t,h=ue(f,d);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new x(S.InvalidParams,`Invalid sampling result: ${g}`)}return h.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId!==void 0)return;try{let r=await this.request({method:"initialize",params:{protocolVersion:or,capabilities:this._capabilities,clientInfo:this._clientInfo}},vs,t);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);if(!_o.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);if(this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion)e.setProtocolVersion(r.protocolVersion);if(this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){mn(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){if(!this._capabilities)return;hn(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Le,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Ms,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},Le,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},js,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},Rs,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},xs,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},Ss,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},Es,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},Le,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},Le,t)}async callTool(e,t=je,r){if(this.isToolTaskRequired(e.name))throw new x(S.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},t,r),n=this.getToolOutputValidator(e.name);if(n){if(!o.structuredContent&&!o.isError)throw new x(S.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=n(o.structuredContent);if(!s.valid)throw new x(S.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){if(s instanceof x)throw s;throw new x(S.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let t of e){if(t.outputSchema){let o=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,o)}let r=t.execution?.taskSupport;if(r==="required"||r==="optional")this._cachedKnownTaskTools.add(t.name);if(r==="required")this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},fr,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,o){let n=$d.safeParse(r);if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof r.onChanged!=="function")throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=n.data,{onChanged:a}=r,u=async()=>{if(!s){a(null,null);return}try{let l=await o();a(null,l)}catch(l){let d=l instanceof Error?l:Error(String(l));a(d,null)}},c=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);if(l)clearTimeout(l);let d=setTimeout(u,i);this._listChangedDebounceTimers.set(e,d)}else u()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}var Hg=kn(Vg(),1);import vn from"node:process";import{PassThrough as jk}from"node:stream";class Jr{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
47
|
-
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),
|
|
48
|
-
`}var Ak=vn.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function Zk(){let e={};for(let t of Ak){let r=vn.env[t];if(r===void 0)continue;if(r.startsWith("()"))continue;e[t]=r}return e}class na{constructor(e){if(this._readBuffer=new Jr,this._stderrStream=null,this._serverParams=e,e.stderr==="pipe"||e.stderr==="overlapped")this._stderrStream=new jk}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{if(this._process=Hg.default(this._serverParams.command,this._serverParams.args??[],{env:{...Zk(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:vn.platform==="win32"&&qk(),cwd:this._serverParams.cwd}),this._process.on("error",(r)=>{t(r),this.onerror?.(r)}),this._process.on("spawn",()=>{e()}),this._process.on("close",(r)=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",(r)=>{this.onerror?.(r)}),this._process.stdout?.on("data",(r)=>{this._readBuffer.append(r),this.processReadBuffer()}),this._process.stdout?.on("error",(r)=>{this.onerror?.(r)}),this._stderrStream&&this._process.stderr)this._process.stderr.pipe(this._stderrStream)})}get stderr(){if(this._stderrStream)return this._stderrStream;return this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise((r)=>{e.once("close",()=>{r()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise((r)=>setTimeout(r,2000).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([t,new Promise((r)=>setTimeout(r,2000).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise((t)=>{if(!this._process?.stdin)throw Error("Not connected");let r=yn(e);if(this._process.stdin.write(r))t();else this._process.stdin.once("drain",t)})}}function qk(){return"type"in vn}class sa{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some((c)=>c.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],u=a.some((c)=>c.type==="tool_use");if(s){if(n.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!u)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let c=new Set(a.filter((d)=>d.type==="tool_use").map((d)=>d.id)),l=new Set(n.filter((d)=>d.type==="tool_result").map((d)=>d.toolUseId));if(c.size!==l.size||![...c].every((d)=>l.has(d)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},_t,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},rt,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class ia extends $r{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(gr.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let n=this._loggingLevels.get(o);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Hr,this.setRequestHandler(ys,(r)=>this._oninitialize(r)),this.setNotificationHandler(bs,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(qs,async(r,o)=>{let n=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=gr.safeParse(s);if(i.success)this._loggingLevels.set(n,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new sa(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=To(this._capabilities,e)}setRequestHandler(e,t){let o=kt(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(et(o)){let i=o;n=i._zod?.def?.value??i.value}else{let i=o;n=i._def?.value??i.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let i=async(a,u)=>{let c=ue(mr,a);if(!c.success){let f=c.error instanceof Error?c.error.message:String(c.error);throw new x(S.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:l}=c.data,d=await Promise.resolve(t(a,u));if(l.task){let f=ue(Ue,d);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new x(S.InvalidParams,`Invalid task creation result: ${h}`)}return f.data}let p=ue(je,d);if(!p.success){let f=p.error instanceof Error?p.error.message:String(p.error);throw new x(S.InvalidParams,`Invalid tools/call result: ${f}`)}return p.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){hn(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;mn(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:_o.includes(t)?t:or,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"},Le)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],n=o.some((u)=>u.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((u)=>u.type==="tool_use");if(n){if(o.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let u=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),c=new Set(o.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(u.size!==c.size||![...u].every((l)=>c.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},yr,t);return this.request({method:"sampling/createMessage",params:e},_t,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},rt,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:o},rt,t);if(n.action==="accept"&&n.content&&o.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(o.requestedSchema)(n.content);if(!i.valid)throw new x(S.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof x)throw s;throw new x(S.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ls,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import Jg from"node:process";class aa{constructor(e=Jg.stdin,t=Jg.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new Jr,this._started=!1,this._ondata=(r)=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=(r)=>{this.onerror?.(r)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise((t)=>{let r=yn(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}import{isAbsolute as Kg,dirname as Mk,relative as Dk,sep as Lk}from"node:path";import{fileURLToPath as Bg}from"node:url";import{readFileSync as Uk}from"node:fs";import{canonicalWorkspace as Gg,ensurePmxServer as Fk,probePmxServer as Vk,runtimeCommand as Hk,runtimeVersion as Wg}from"./runtime.mjs";var wn="canvas_connect_workspace",Jk=Gg(Mk(Bg(import.meta.url))),Kk=fr.parse(JSON.parse(Uk(new URL("./tools.json",import.meta.url),"utf8"))),Q=new ia({name:"pmx-canvas-plugin",version:Wg},{capabilities:{tools:{listChanged:!0},resources:{listChanged:!0}},instructions:`Before using any PMX board tool, call ${wn} with the absolute active project directory. Never use the plugin installation directory as the workspace. Then read skill://pmx-canvas/SKILL.md for workbench guidance. The connection returns a browser workbench URL; the native Copilot canvas is client-specific.`}),dt,ca,Kr,Ft,bn;async function Vt(){if(!dt||!bn||!Ft)throw new x(S.InvalidRequest,`Call ${wn} with your absolute project directory first.`);let e=await Vk(bn,Ft);if(!e.ok)throw new x(S.InvalidRequest,`The bound PMX server is unavailable or belongs to another workspace: ${e.error}`);return dt}async function ua(e){if(!Kg(e))throw new x(S.InvalidParams,"workspaceRoot must be an absolute project directory.");e=Gg(e);let t=Dk(Jk,e);if(!t||t!==".."&&!t.startsWith(`..${Lk}`)&&!Kg(t))throw new x(S.InvalidParams,"The plugin installation directory is not a project workspace.");if(Ft&&Ft!==e)throw new x(S.InvalidParams,"This MCP session is already bound to another workspace. Start a new session.");if(Kr){let r=await Kr;return await Vt(),r}Ft=e,Kr=(async()=>{let r=await Fk(e);if(!r.ok||!r.baseUrl||!r.health)throw Error(r.error??"PMX Canvas is unavailable.");if($n)throw Error("MCP session closed while connecting the workspace.");let o=Hk(),n=new na({command:o.command,args:[...o.args,"--mcp"],cwd:e,env:{...Object.fromEntries(Object.entries(process.env).filter((a)=>a[1]!==void 0)),PMX_CANVAS_URL:r.baseUrl,PMX_CANVAS_WORKSPACE_ROOT:e,PMX_CANVAS_DISABLE_BROWSER_OPEN:"1"},stderr:"inherit"}),s=Q.getClientCapabilities()??{},i=new Bi({name:"pmx-canvas-plugin",version:Wg},{capabilities:s});if(s.roots)i.setRequestHandler(Ds,()=>Q.listRoots());if(s.sampling)i.setRequestHandler(_r,(a)=>Q.createMessage(a.params));if(s.elicitation)i.setRequestHandler(vr,(a)=>Q.elicitInput(a.params));i.setNotificationHandler(hr,()=>Q.sendToolListChanged()),i.setNotificationHandler(pr,()=>Q.sendResourceListChanged()),i.setNotificationHandler(Ts,(a)=>Q.notification(a));try{if(await i.connect(n),$n)throw Error("MCP session closed while connecting the workspace.");dt=i,ca=n,bn=r.baseUrl,await Q.sendToolListChanged(),await Q.sendResourceListChanged()}catch(a){throw dt=void 0,ca=void 0,bn=void 0,await i.close(),await n.close(),a}return{workspaceRoot:e,serverUrl:r.baseUrl}})();try{return await Kr}catch(r){throw Kr=void 0,Ft=void 0,r}}Q.setRequestHandler(Zs,async(e)=>({tools:[{name:wn,description:"Connect PMX Canvas to the user-selected project BEFORE using board tools. Pass the absolute active project directory, never the plugin installation folder. Returns the browser workbench URL and enables the PMX tools for this MCP session.",inputSchema:{type:"object",properties:{workspaceRoot:{type:"string",description:"Absolute directory of the intended project."}},required:["workspaceRoot"],additionalProperties:!1}},...dt?(await(await Vt()).listTools(e.params)).tools:Kk.tools]}));Q.setRequestHandler(mr,async(e,t)=>{if(e.params.name!==wn)return await(await Vt()).request(e,je,{signal:t.signal});let r=e.params.arguments?.workspaceRoot;if(typeof r!=="string")throw new x(S.InvalidParams,"workspaceRoot is required.");try{let o=await ua(r);return{content:[{type:"text",text:JSON.stringify({...o,workbenchUrl:`${o.serverUrl}/workbench`})}],structuredContent:{...o,workbenchUrl:`${o.serverUrl}/workbench`}}}catch(o){let n=o instanceof Error?o.message:String(o);return process.stderr.write(`[pmx-canvas] Workspace connection failed: ${n}
|
|
49
|
-
`),{isError:!0,content:[{type:"text",text:n}]}}});
|
|
50
|
-
`)}};var
|
|
51
|
-
`),process.exitCode=1}}
|
|
46
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1){if(e.reused==="ref"){s(i);continue}}}}function Ds(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(i)=>{let a=e.seen.get(i);if(a.ref===null)return;let u=a.def??a.schema,c={...u},l=a.ref;if(a.ref=null,l){o(l);let d=e.seen.get(l),f=d.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(f);else Object.assign(u,f);if(Object.assign(u,c),i._zod.parent===l)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(!(g in c))delete u[g]}if(f.$ref&&d.def)for(let g in u){if(g==="$ref"||g==="allOf")continue;if(g in d.def&&JSON.stringify(u[g])===JSON.stringify(d.def[g]))delete u[g]}}let p=i._zod.parent;if(p&&p!==l){o(p);let d=e.seen.get(p);if(d?.schema.$ref){if(u.$ref=d.schema.$ref,d.def)for(let f in u){if(f==="$ref"||f==="allOf")continue;if(f in d.def&&JSON.stringify(u[f])===JSON.stringify(d.def[f]))delete u[f]}}}e.override({zodSchema:i,jsonSchema:u,path:a.path??[]})};for(let i of[...e.seen.entries()].reverse())o(i[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let i=e.external.registry.get(t)?.id;if(!i)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(i)}Object.assign(n,r.def??r.schema);let s=e.external?.defs??{};for(let i of e.seen.entries()){let a=i[1];if(a.def&&a.defId)s[a.defId]=a.def}if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")n.$defs=s;else n.definitions=s;try{let i=JSON.parse(JSON.stringify(n));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:Zr(t,"input",e.processors),output:Zr(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch(i){throw Error("Error converting schema to JSON.")}}function ve(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ve(o.element,r);if(o.type==="set")return ve(o.valueType,r);if(o.type==="lazy")return ve(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 ve(o.innerType,r);if(o.type==="intersection")return ve(o.left,r)||ve(o.right,r);if(o.type==="record"||o.type==="map")return ve(o.keyType,r)||ve(o.valueType,r);if(o.type==="pipe")return ve(o.in,r)||ve(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ve(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ve(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ve(n,r))return!0;if(o.rest&&ve(o.rest,r))return!0;return!1}return!1}var Rl=(e,t={})=>(r)=>{let o=qs({...r,processors:t});return ue(e,o),Ms(o,e),Ds(o,e)},Zr=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:s}=o??{},i=qs({...n??{},target:s,io:t,processors:r});return ue(e,i),Ms(i,e),Ds(i,e)};var cy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ol=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof s==="number")n.minLength=s;if(typeof i==="number")n.maxLength=i;if(a){if(n.format=cy[a]??a,n.format==="")delete n.format;if(a==="time")delete n.format}if(c)n.contentEncoding=c;if(u&&u.size>0){let l=[...u];if(l.length===1)n.pattern=l[0].source;else if(l.length>1)n.allOf=[...l.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},Il=(e,t,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;if(typeof a==="string"&&a.includes("int"))n.type="integer";else n.type="number";if(typeof l==="number")if(t.target==="draft-04"||t.target==="openapi-3.0")n.minimum=l,n.exclusiveMinimum=!0;else n.exclusiveMinimum=l;if(typeof s==="number"){if(n.minimum=s,typeof l==="number"&&t.target!=="draft-04")if(l>=s)delete n.minimum;else delete n.exclusiveMinimum}if(typeof c==="number")if(t.target==="draft-04"||t.target==="openapi-3.0")n.maximum=c,n.exclusiveMaximum=!0;else n.exclusiveMaximum=c;if(typeof i==="number"){if(n.maximum=i,typeof c==="number"&&t.target!=="draft-04")if(c<=i)delete n.maximum;else delete n.exclusiveMaximum}if(typeof u==="number")n.multipleOf=u},Nl=(e,t,r,o)=>{r.type="boolean"};var Cl=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"};var jl=(e,t,r,o)=>{r.not={}};var Al=(e,t,r,o)=>{};var Zl=(e,t,r,o)=>{let n=e._zod.def,s=xo(n.entries);if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";r.enum=s},ql=(e,t,r,o)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else s.push(Number(i));else s.push(i);if(s.length===0);else if(s.length===1){let i=s[0];if(r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[i];else r.const=i}else{if(s.every((i)=>typeof i==="number"))r.type="number";if(s.every((i)=>typeof i==="string"))r.type="string";if(s.every((i)=>typeof i==="boolean"))r.type="boolean";if(s.every((i)=>i===null))r.type="null";r.enum=s}};var Ml=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var Dl=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var Ll=(e,t,r,o)=>{let n=r,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;if(typeof i==="number")n.minItems=i;if(typeof a==="number")n.maxItems=a;n.type="array",n.items=ue(s.element,t,{...o,path:[...o.path,"items"]})},Ul=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let c in i)n.properties[c]=ue(i[c],t,{...o,path:[...o.path,"properties",c]});let a=new Set(Object.keys(i)),u=new Set([...a].filter((c)=>{let l=s.shape[c]._zod;if(t.io==="input")return l.optin===void 0;else return l.optout===void 0}));if(u.size>0)n.required=Array.from(u);if(s.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!s.catchall){if(t.io==="output")n.additionalProperties=!1}else if(s.catchall)n.additionalProperties=ue(s.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Fl=(e,t,r,o)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((a,u)=>ue(a,t,{...o,path:[...o.path,s?"oneOf":"anyOf",u]}));if(s)r.oneOf=i;else r.anyOf=i},Vl=(e,t,r,o)=>{let n=e._zod.def,s=ue(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=ue(n.right,t,{...o,path:[...o.path,"allOf",1]}),a=(c)=>("allOf"in c)&&Object.keys(c).length===1,u=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=u};var Hl=(e,t,r,o)=>{let n=r,s=e._zod.def;n.type="object";let i=s.keyType,u=i._zod.bag?.patterns;if(s.mode==="loose"&&u&&u.size>0){let l=ue(s.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of u)n.patternProperties[p.source]=l}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=ue(s.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=ue(s.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let c=i._zod.values;if(c){let l=[...c].filter((p)=>typeof p==="string"||typeof p==="number");if(l.length>0)n.required=l}},Jl=(e,t,r,o)=>{let n=e._zod.def,s=ue(n.innerType,t,o),i=t.seen.get(e);if(t.target==="openapi-3.0")i.ref=n.innerType,r.nullable=!0;else r.anyOf=[s,{type:"null"}]},Kl=(e,t,r,o)=>{let n=e._zod.def;ue(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType},Bl=(e,t,r,o)=>{let n=e._zod.def;ue(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Gl=(e,t,r,o)=>{let n=e._zod.def;ue(n.innerType,t,o);let s=t.seen.get(e);if(s.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},Wl=(e,t,r,o)=>{let n=e._zod.def;ue(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Xl=(e,t,r,o)=>{let n=e._zod.def,s=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;ue(s,t,o);let i=t.seen.get(e);i.ref=s},Yl=(e,t,r,o)=>{let n=e._zod.def;ue(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0};var Ls=(e,t,r,o)=>{let n=e._zod.def;ue(n.innerType,t,o);let s=t.seen.get(e);s.ref=n.innerType};function _t(e){return!!e._zod}function be(e,t){if(_t(e))return Ir(e,t);return e.safeParse(t)}function Qt(e){if(!e)return;let t;if(_t(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function Ql(e){if(_t(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o;return}var gy=_("ZodISODateTime",(e,t)=>{uu.init(e,t),Y.init(e,t)});function Us(e){return gl(gy,e)}var _y=_("ZodISODate",(e,t)=>{lu.init(e,t),Y.init(e,t)});function ep(e){return _l(_y,e)}var yy=_("ZodISOTime",(e,t)=>{pu.init(e,t),Y.init(e,t)});function tp(e){return yl(yy,e)}var vy=_("ZodISODuration",(e,t)=>{du.init(e,t),Y.init(e,t)});function rp(e){return vl(vy,e)}var op=(e,t)=>{Po.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>Ka(e,r)},flatten:{value:(r)=>Ja(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Tr,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Tr,2)}},isEmpty:{get(){return e.issues.length===0}}})},sT=_("ZodError",op),Ee=_("ZodError",op,{Parent:Error});var np=Eo(Ee),sp=To(Ee),ip=Or(Ee),ap=Nr(Ee),cp=Ba(Ee),up=Ga(Ee),lp=Wa(Ee),pp=Xa(Ee),dp=Ya(Ee),fp=Qa(Ee),mp=ec(Ee),hp=tc(Ee);var ee=_("ZodType",(e,t)=>(W.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Zr(e,"input"),output:Zr(e,"output")}}),e.toJSONSchema=Rl(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ft(t,{checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(r,o)=>Le(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.parse=(r,o)=>np(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>ip(e,r,o),e.parseAsync=async(r,o)=>sp(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>ap(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>cp(e,r,o),e.decode=(r,o)=>up(e,r,o),e.encodeAsync=async(r,o)=>lp(e,r,o),e.decodeAsync=async(r,o)=>pp(e,r,o),e.safeEncode=(r,o)=>dp(e,r,o),e.safeDecode=(r,o)=>fp(e,r,o),e.safeEncodeAsync=async(r,o)=>mp(e,r,o),e.safeDecodeAsync=async(r,o)=>hp(e,r,o),e.refine=(r,o)=>e.check(pv(r,o)),e.superRefine=(r)=>e.check(dv(r)),e.overwrite=(r)=>e.check(gt(r)),e.optional=()=>oe(e),e.exactOptional=()=>Qy(e),e.nullable=()=>yp(e),e.nullish=()=>oe(yp(e)),e.nonoptional=(r)=>sv(e,r),e.array=()=>D(e),e.or=(r)=>G([e,r]),e.and=(r)=>Lo(e,r),e.transform=(r)=>Hs(e,xp(r)),e.default=(r)=>rv(e,r),e.prefault=(r)=>nv(e,r),e.catch=(r)=>av(e,r),e.pipe=(r)=>Hs(e,r),e.readonly=()=>lv(e),e.describe=(r)=>{let o=e.clone();return Ht.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Ht.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ht.get(e);let o=e.clone();return Ht.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=(r)=>r(e),e)),vp=_("_ZodString",(e,t)=>{Co.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Ol(e,o,n,s);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(Ps(...o)),e.includes=(...o)=>e.check(Rs(...o)),e.startsWith=(...o)=>e.check(Os(...o)),e.endsWith=(...o)=>e.check(Is(...o)),e.min=(...o)=>e.check(Yt(...o)),e.max=(...o)=>e.check(qo(...o)),e.length=(...o)=>e.check(Mo(...o)),e.nonempty=(...o)=>e.check(Yt(1,...o)),e.lowercase=(o)=>e.check(Es(o)),e.uppercase=(o)=>e.check(Ts(o)),e.trim=()=>e.check(Cs()),e.normalize=(...o)=>e.check(Ns(...o)),e.toLowerCase=()=>e.check(js()),e.toUpperCase=()=>e.check(As()),e.slugify=()=>e.check(Zs())}),wy=_("ZodString",(e,t)=>{Co.init(e,t),vp.init(e,t),e.email=(r)=>e.check(Gu(xy,r)),e.url=(r)=>e.check(el(zy,r)),e.jwt=(r)=>e.check(hl(My,r)),e.emoji=(r)=>e.check(tl(Sy,r)),e.guid=(r)=>e.check(ks(gp,r)),e.uuid=(r)=>e.check(Wu(Do,r)),e.uuidv4=(r)=>e.check(Xu(Do,r)),e.uuidv6=(r)=>e.check(Yu(Do,r)),e.uuidv7=(r)=>e.check(Qu(Do,r)),e.nanoid=(r)=>e.check(rl(ky,r)),e.guid=(r)=>e.check(ks(gp,r)),e.cuid=(r)=>e.check(ol(Py,r)),e.cuid2=(r)=>e.check(nl(Ey,r)),e.ulid=(r)=>e.check(sl(Ty,r)),e.base64=(r)=>e.check(dl(Ay,r)),e.base64url=(r)=>e.check(fl(Zy,r)),e.xid=(r)=>e.check(il(Ry,r)),e.ksuid=(r)=>e.check(al(Oy,r)),e.ipv4=(r)=>e.check(cl(Iy,r)),e.ipv6=(r)=>e.check(ul(Ny,r)),e.cidrv4=(r)=>e.check(ll(Cy,r)),e.cidrv6=(r)=>e.check(pl(jy,r)),e.e164=(r)=>e.check(ml(qy,r)),e.datetime=(r)=>e.check(Us(r)),e.date=(r)=>e.check(ep(r)),e.time=(r)=>e.check(tp(r)),e.duration=(r)=>e.check(rp(r))});function m(e){return Bu(wy,e)}var Y=_("ZodStringFormat",(e,t)=>{X.init(e,t),vp.init(e,t)}),xy=_("ZodEmail",(e,t)=>{eu.init(e,t),Y.init(e,t)});var gp=_("ZodGUID",(e,t)=>{Yc.init(e,t),Y.init(e,t)});var Do=_("ZodUUID",(e,t)=>{Qc.init(e,t),Y.init(e,t)});var zy=_("ZodURL",(e,t)=>{tu.init(e,t),Y.init(e,t)});var Sy=_("ZodEmoji",(e,t)=>{ru.init(e,t),Y.init(e,t)});var ky=_("ZodNanoID",(e,t)=>{ou.init(e,t),Y.init(e,t)});var Py=_("ZodCUID",(e,t)=>{nu.init(e,t),Y.init(e,t)});var Ey=_("ZodCUID2",(e,t)=>{su.init(e,t),Y.init(e,t)});var Ty=_("ZodULID",(e,t)=>{iu.init(e,t),Y.init(e,t)});var Ry=_("ZodXID",(e,t)=>{au.init(e,t),Y.init(e,t)});var Oy=_("ZodKSUID",(e,t)=>{cu.init(e,t),Y.init(e,t)});var Iy=_("ZodIPv4",(e,t)=>{fu.init(e,t),Y.init(e,t)});var Ny=_("ZodIPv6",(e,t)=>{mu.init(e,t),Y.init(e,t)});var Cy=_("ZodCIDRv4",(e,t)=>{hu.init(e,t),Y.init(e,t)});var jy=_("ZodCIDRv6",(e,t)=>{gu.init(e,t),Y.init(e,t)});var Ay=_("ZodBase64",(e,t)=>{yu.init(e,t),Y.init(e,t)});var Zy=_("ZodBase64URL",(e,t)=>{vu.init(e,t),Y.init(e,t)});var qy=_("ZodE164",(e,t)=>{bu.init(e,t),Y.init(e,t)});var My=_("ZodJWT",(e,t)=>{$u.init(e,t),Y.init(e,t)});var bp=_("ZodNumber",(e,t)=>{ws.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Il(e,o,n,s),e.gt=(o,n)=>e.check(Ao(o,n)),e.gte=(o,n)=>e.check(Ar(o,n)),e.min=(o,n)=>e.check(Ar(o,n)),e.lt=(o,n)=>e.check(jo(o,n)),e.lte=(o,n)=>e.check(jr(o,n)),e.max=(o,n)=>e.check(jr(o,n)),e.int=(o)=>e.check(_p(o)),e.safe=(o)=>e.check(_p(o)),e.positive=(o)=>e.check(Ao(0,o)),e.nonnegative=(o)=>e.check(Ar(0,o)),e.negative=(o)=>e.check(jo(0,o)),e.nonpositive=(o)=>e.check(jr(0,o)),e.multipleOf=(o,n)=>e.check(Zo(o,n)),e.step=(o,n)=>e.check(Zo(o,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function J(e){return bl(bp,e)}var Dy=_("ZodNumberFormat",(e,t)=>{wu.init(e,t),bp.init(e,t)});function _p(e){return $l(Dy,e)}var Ly=_("ZodBoolean",(e,t)=>{xu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Nl(e,r,o,n)});function de(e){return wl(Ly,e)}var Uy=_("ZodNull",(e,t)=>{zu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Cl(e,r,o,n)});function Js(e){return xl(Uy,e)}var Fy=_("ZodUnknown",(e,t)=>{Su.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Al(e,r,o,n)});function Q(){return zl(Fy)}var Vy=_("ZodNever",(e,t)=>{ku.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>jl(e,r,o,n)});function Hy(e){return Sl(Vy,e)}var Jy=_("ZodArray",(e,t)=>{Pu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ll(e,r,o,n),e.element=t.element,e.min=(r,o)=>e.check(Yt(r,o)),e.nonempty=(r)=>e.check(Yt(1,r)),e.max=(r,o)=>e.check(qo(r,o)),e.length=(r,o)=>e.check(Mo(r,o)),e.unwrap=()=>e.element});function D(e,t){return kl(Jy,e,t)}var $p=_("ZodObject",(e,t)=>{Ru.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ul(e,r,o,n),V(e,"shape",()=>t.shape),e.keyof=()=>xe(Object.keys(e._zod.def.shape)),e.catchall=(r)=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Q()}),e.loose=()=>e.clone({...e._zod.def,catchall:Q()}),e.strict=()=>e.clone({...e._zod.def,catchall:Hy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=(r)=>K_(e,r),e.safeExtend=(r)=>B_(e,r),e.merge=(r)=>G_(e,r),e.pick=(r)=>H_(e,r),e.omit=(r)=>J_(e,r),e.partial=(...r)=>W_(zp,e,r[0]),e.required=(...r)=>X_(Sp,e,r[0])});function S(e,t){let r={type:"object",shape:e??{},...E(t)};return new $p(r)}function $e(e,t){return new $p({type:"object",shape:e,catchall:Q(),...E(t)})}var wp=_("ZodUnion",(e,t)=>{xs.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Fl(e,r,o,n),e.options=t.options});function G(e,t){return new wp({type:"union",options:e,...E(t)})}var Ky=_("ZodDiscriminatedUnion",(e,t)=>{wp.init(e,t),Ou.init(e,t)});function Ks(e,t,r){return new Ky({type:"union",options:t,discriminator:e,...E(r)})}var By=_("ZodIntersection",(e,t)=>{Iu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Vl(e,r,o,n)});function Lo(e,t){return new By({type:"intersection",left:e,right:t})}var Gy=_("ZodRecord",(e,t)=>{Nu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Hl(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function te(e,t,r){return new Gy({type:"record",keyType:e,valueType:t,...E(r)})}var Vs=_("ZodEnum",(e,t)=>{Cu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(o,n,s)=>Zl(e,o,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=t.entries[i];else throw Error(`Key ${i} not found in enum`);return new Vs({...t,checks:[],...E(n),entries:s})},e.exclude=(o,n)=>{let s={...t.entries};for(let i of o)if(r.has(i))delete s[i];else throw Error(`Key ${i} not found in enum`);return new Vs({...t,checks:[],...E(n),entries:s})}});function xe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new Vs({type:"enum",entries:r,...E(t)})}var Wy=_("ZodLiteral",(e,t)=>{ju.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ql(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function R(e,t){return new Wy({type:"literal",values:Array.isArray(e)?e:[e],...E(t)})}var Xy=_("ZodTransform",(e,t)=>{Au.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Dl(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Er(e.constructor.name);r.addIssue=(s)=>{if(typeof s==="string")r.issues.push(Vt(s,r.value,t));else{let i=s;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(Vt(i))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((s)=>(r.value=s,r));return r.value=n,r}});function xp(e){return new Xy({type:"transform",transform:e})}var zp=_("ZodOptional",(e,t)=>{zs.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ls(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function oe(e){return new zp({type:"optional",innerType:e})}var Yy=_("ZodExactOptional",(e,t)=>{Zu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ls(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Qy(e){return new Yy({type:"optional",innerType:e})}var ev=_("ZodNullable",(e,t)=>{qu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Jl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function yp(e){return new ev({type:"nullable",innerType:e})}var tv=_("ZodDefault",(e,t)=>{Mu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Bl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rv(e,t){return new tv({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ds(t)}})}var ov=_("ZodPrefault",(e,t)=>{Du.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Gl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function nv(e,t){return new ov({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ds(t)}})}var Sp=_("ZodNonOptional",(e,t)=>{Lu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function sv(e,t){return new Sp({type:"nonoptional",innerType:e,...E(t)})}var iv=_("ZodCatch",(e,t)=>{Uu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function av(e,t){return new iv({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var cv=_("ZodPipe",(e,t)=>{Fu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xl(e,r,o,n),e.in=t.in,e.out=t.out});function Hs(e,t){return new cv({type:"pipe",in:e,out:t})}var uv=_("ZodReadonly",(e,t)=>{Vu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yl(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function lv(e){return new uv({type:"readonly",innerType:e})}var kp=_("ZodCustom",(e,t)=>{Hu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ml(e,r,o,n)});function Pp(e,t){return Pl(kp,e??(()=>!0),t)}function pv(e,t={}){return El(kp,e,t)}function dv(e){return Tl(e)}function Bs(e,t){return Hs(xp(e),t)}Re(Ss());var Mr="2025-11-25";var Fo=[Mr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],yt="io.modelcontextprotocol/related-task",Vo="2.0",he=Pp((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),Ep=G([m(),J().int()]),Tp=m(),wR=$e({ttl:G([J(),Js()]).optional(),pollInterval:J().optional()}),fv=S({ttl:J().optional()}),mv=S({taskId:m()}),Gs=$e({progressToken:Ep.optional(),[yt]:mv.optional()}),Te=S({_meta:Gs.optional()}),Dr=Te.extend({task:fv.optional()}),Rp=(e)=>Dr.safeParse(e).success,ge=S({method:m(),params:Te.loose().optional()}),Oe=S({_meta:Gs.optional()}),Ie=S({method:m(),params:Oe.loose().optional()}),_e=$e({_meta:Gs.optional()}),Ho=G([m(),J().int()]),Op=S({jsonrpc:R(Vo),id:Ho,...ge.shape}).strict(),Ws=(e)=>Op.safeParse(e).success,Ip=S({jsonrpc:R(Vo),...Ie.shape}).strict(),Np=(e)=>Ip.safeParse(e).success,Xs=S({jsonrpc:R(Vo),id:Ho,result:_e}).strict(),Lr=(e)=>Xs.safeParse(e).success;var T;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(T||(T={}));var Ys=S({jsonrpc:R(Vo),id:Ho.optional(),error:S({code:J().int(),message:m(),data:Q().optional()})}).strict();var Cp=(e)=>Ys.safeParse(e).success;var jp=G([Op,Ip,Xs,Ys]),xR=G([Xs,Ys]),st=_e.strict(),hv=Oe.extend({requestId:Ho.optional(),reason:m().optional()}),Jo=Ie.extend({method:R("notifications/cancelled"),params:hv}),gv=S({src:m(),mimeType:m().optional(),sizes:D(m()).optional(),theme:xe(["light","dark"]).optional()}),Ur=S({icons:D(gv).optional()}),er=S({name:m(),title:m().optional()}),Ap=er.extend({...er.shape,...Ur.shape,version:m(),websiteUrl:m().optional(),description:m().optional()}),_v=Lo(S({applyDefaults:de().optional()}),te(m(),Q())),yv=Bs((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},Lo(S({form:_v.optional(),url:he.optional()}),te(m(),Q()).optional())),vv=$e({list:he.optional(),cancel:he.optional(),requests:$e({sampling:$e({createMessage:he.optional()}).optional(),elicitation:$e({create:he.optional()}).optional()}).optional()}),bv=$e({list:he.optional(),cancel:he.optional(),requests:$e({tools:$e({call:he.optional()}).optional()}).optional()}),$v=S({experimental:te(m(),he).optional(),sampling:S({context:he.optional(),tools:he.optional()}).optional(),elicitation:yv.optional(),roots:S({listChanged:de().optional()}).optional(),tasks:vv.optional()}),wv=Te.extend({protocolVersion:m(),capabilities:$v,clientInfo:Ap}),Qs=ge.extend({method:R("initialize"),params:wv});var xv=S({experimental:te(m(),he).optional(),logging:he.optional(),completions:he.optional(),prompts:S({listChanged:de().optional()}).optional(),resources:S({subscribe:de().optional(),listChanged:de().optional()}).optional(),tools:S({listChanged:de().optional()}).optional(),tasks:bv.optional()}),ei=_e.extend({protocolVersion:m(),capabilities:xv,serverInfo:Ap,instructions:m().optional()}),ti=Ie.extend({method:R("notifications/initialized"),params:Oe.optional()});var Ko=ge.extend({method:R("ping"),params:Te.optional()}),zv=S({progress:J(),total:oe(J()),message:oe(m())}),Sv=S({...Oe.shape,...zv.shape,progressToken:Ep}),Bo=Ie.extend({method:R("notifications/progress"),params:Sv}),kv=Te.extend({cursor:Tp.optional()}),Fr=ge.extend({params:kv.optional()}),Vr=_e.extend({nextCursor:Tp.optional()}),Pv=xe(["working","input_required","completed","failed","cancelled"]),Hr=S({taskId:m(),status:Pv,ttl:G([J(),Js()]),createdAt:m(),lastUpdatedAt:m(),pollInterval:oe(J()),statusMessage:oe(m())}),it=_e.extend({task:Hr}),Ev=Oe.merge(Hr),Jr=Ie.extend({method:R("notifications/tasks/status"),params:Ev}),Go=ge.extend({method:R("tasks/get"),params:Te.extend({taskId:m()})}),Wo=_e.merge(Hr),Xo=ge.extend({method:R("tasks/result"),params:Te.extend({taskId:m()})}),zR=_e.loose(),Yo=Fr.extend({method:R("tasks/list")}),Qo=Vr.extend({tasks:D(Hr)}),en=ge.extend({method:R("tasks/cancel"),params:Te.extend({taskId:m()})}),Zp=_e.merge(Hr),qp=S({uri:m(),mimeType:oe(m()),_meta:te(m(),Q()).optional()}),Mp=qp.extend({text:m()}),ri=m().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Dp=qp.extend({blob:ri}),Kr=xe(["user","assistant"]),tr=S({audience:D(Kr).optional(),priority:J().min(0).max(1).optional(),lastModified:Us({offset:!0}).optional()}),Lp=S({...er.shape,...Ur.shape,uri:m(),description:oe(m()),mimeType:oe(m()),annotations:tr.optional(),_meta:oe($e({}))}),Tv=S({...er.shape,...Ur.shape,uriTemplate:m(),description:oe(m()),mimeType:oe(m()),annotations:tr.optional(),_meta:oe($e({}))}),oi=Fr.extend({method:R("resources/list")}),ni=Vr.extend({resources:D(Lp)}),si=Fr.extend({method:R("resources/templates/list")}),ii=Vr.extend({resourceTemplates:D(Tv)}),ai=Te.extend({uri:m()}),Rv=ai,ci=ge.extend({method:R("resources/read"),params:Rv}),ui=_e.extend({contents:D(G([Mp,Dp]))}),Br=Ie.extend({method:R("notifications/resources/list_changed"),params:Oe.optional()}),Ov=ai,Iv=ge.extend({method:R("resources/subscribe"),params:Ov}),Nv=ai,Cv=ge.extend({method:R("resources/unsubscribe"),params:Nv}),jv=Oe.extend({uri:m()}),li=Ie.extend({method:R("notifications/resources/updated"),params:jv}),Av=S({name:m(),description:oe(m()),required:oe(de())}),Zv=S({...er.shape,...Ur.shape,description:oe(m()),arguments:oe(D(Av)),_meta:oe($e({}))}),qv=Fr.extend({method:R("prompts/list")}),pi=Vr.extend({prompts:D(Zv)}),Mv=Te.extend({name:m(),arguments:te(m(),m()).optional()}),Dv=ge.extend({method:R("prompts/get"),params:Mv}),di=S({type:R("text"),text:m(),annotations:tr.optional(),_meta:te(m(),Q()).optional()}),fi=S({type:R("image"),data:ri,mimeType:m(),annotations:tr.optional(),_meta:te(m(),Q()).optional()}),mi=S({type:R("audio"),data:ri,mimeType:m(),annotations:tr.optional(),_meta:te(m(),Q()).optional()}),Lv=S({type:R("tool_use"),name:m(),id:m(),input:te(m(),Q()),_meta:te(m(),Q()).optional()}),Uv=S({type:R("resource"),resource:G([Mp,Dp]),annotations:tr.optional(),_meta:te(m(),Q()).optional()}),Fv=Lp.extend({type:R("resource_link")}),hi=G([di,fi,mi,Fv,Uv]),Vv=S({role:Kr,content:hi}),gi=_e.extend({description:m().optional(),messages:D(Vv)}),_i=Ie.extend({method:R("notifications/prompts/list_changed"),params:Oe.optional()}),Hv=S({title:m().optional(),readOnlyHint:de().optional(),destructiveHint:de().optional(),idempotentHint:de().optional(),openWorldHint:de().optional()}),Jv=S({taskSupport:xe(["required","optional","forbidden"]).optional()}),Up=S({...er.shape,...Ur.shape,description:m().optional(),inputSchema:S({type:R("object"),properties:te(m(),he).optional(),required:D(m()).optional()}).catchall(Q()),outputSchema:S({type:R("object"),properties:te(m(),he).optional(),required:D(m()).optional()}).catchall(Q()).optional(),annotations:Hv.optional(),execution:Jv.optional(),_meta:te(m(),Q()).optional()}),yi=Fr.extend({method:R("tools/list")}),Gr=Vr.extend({tools:D(Up)}),Fe=_e.extend({content:D(hi).default([]),structuredContent:te(m(),Q()).optional(),isError:de().optional()}),SR=Fe.or(_e.extend({toolResult:Q()})),Kv=Dr.extend({name:m(),arguments:te(m(),Q()).optional()}),Wr=ge.extend({method:R("tools/call"),params:Kv}),Xr=Ie.extend({method:R("notifications/tools/list_changed"),params:Oe.optional()}),Fp=S({autoRefresh:de().default(!0),debounceMs:J().int().nonnegative().default(300)}),Yr=xe(["debug","info","notice","warning","error","critical","alert","emergency"]),Bv=Te.extend({level:Yr}),vi=ge.extend({method:R("logging/setLevel"),params:Bv}),Gv=Oe.extend({level:Yr,logger:m().optional(),data:Q()}),Wv=Ie.extend({method:R("notifications/message"),params:Gv}),Xv=S({name:m().optional()}),Yv=S({hints:D(Xv).optional(),costPriority:J().min(0).max(1).optional(),speedPriority:J().min(0).max(1).optional(),intelligencePriority:J().min(0).max(1).optional()}),Qv=S({mode:xe(["auto","required","none"]).optional()}),eb=S({type:R("tool_result"),toolUseId:m().describe("The unique identifier for the corresponding tool call."),content:D(hi).default([]),structuredContent:S({}).loose().optional(),isError:de().optional(),_meta:te(m(),Q()).optional()}),tb=Ks("type",[di,fi,mi]),Uo=Ks("type",[di,fi,mi,Lv,eb]),rb=S({role:Kr,content:G([Uo,D(Uo)]),_meta:te(m(),Q()).optional()}),ob=Dr.extend({messages:D(rb),modelPreferences:Yv.optional(),systemPrompt:m().optional(),includeContext:xe(["none","thisServer","allServers"]).optional(),temperature:J().optional(),maxTokens:J().int(),stopSequences:D(m()).optional(),metadata:he.optional(),tools:D(Up).optional(),toolChoice:Qv.optional()}),Qr=ge.extend({method:R("sampling/createMessage"),params:ob}),Jt=_e.extend({model:m(),stopReason:oe(xe(["endTurn","stopSequence","maxTokens"]).or(m())),role:Kr,content:tb}),eo=_e.extend({model:m(),stopReason:oe(xe(["endTurn","stopSequence","maxTokens","toolUse"]).or(m())),role:Kr,content:G([Uo,D(Uo)])}),nb=S({type:R("boolean"),title:m().optional(),description:m().optional(),default:de().optional()}),sb=S({type:R("string"),title:m().optional(),description:m().optional(),minLength:J().optional(),maxLength:J().optional(),format:xe(["email","uri","date","date-time"]).optional(),default:m().optional()}),ib=S({type:xe(["number","integer"]),title:m().optional(),description:m().optional(),minimum:J().optional(),maximum:J().optional(),default:J().optional()}),ab=S({type:R("string"),title:m().optional(),description:m().optional(),enum:D(m()),default:m().optional()}),cb=S({type:R("string"),title:m().optional(),description:m().optional(),oneOf:D(S({const:m(),title:m()})),default:m().optional()}),ub=S({type:R("string"),title:m().optional(),description:m().optional(),enum:D(m()),enumNames:D(m()).optional(),default:m().optional()}),lb=G([ab,cb]),pb=S({type:R("array"),title:m().optional(),description:m().optional(),minItems:J().optional(),maxItems:J().optional(),items:S({type:R("string"),enum:D(m())}),default:D(m()).optional()}),db=S({type:R("array"),title:m().optional(),description:m().optional(),minItems:J().optional(),maxItems:J().optional(),items:S({anyOf:D(S({const:m(),title:m()}))}),default:D(m()).optional()}),fb=G([pb,db]),mb=G([ub,lb,fb]),hb=G([mb,nb,sb,ib]),gb=Dr.extend({mode:R("form").optional(),message:m(),requestedSchema:S({type:R("object"),properties:te(m(),hb),required:D(m()).optional()})}),_b=Dr.extend({mode:R("url"),message:m(),elicitationId:m(),url:m().url()}),yb=G([gb,_b]),to=ge.extend({method:R("elicitation/create"),params:yb}),vb=Oe.extend({elicitationId:m()}),bb=Ie.extend({method:R("notifications/elicitation/complete"),params:vb}),vt=_e.extend({action:xe(["accept","decline","cancel"]),content:Bs((e)=>e===null?void 0:e,te(m(),G([m(),J(),de(),D(m())])).optional())}),$b=S({type:R("ref/resource"),uri:m()});var wb=S({type:R("ref/prompt"),name:m()}),xb=Te.extend({ref:G([wb,$b]),argument:S({name:m(),value:m()}),context:S({arguments:te(m(),m()).optional()}).optional()}),zb=ge.extend({method:R("completion/complete"),params:xb});var bi=_e.extend({completion:$e({values:D(m()).max(100),total:oe(J().int()),hasMore:oe(de())})}),Sb=S({uri:m().startsWith("file://"),name:m().optional(),_meta:te(m(),Q()).optional()}),$i=ge.extend({method:R("roots/list"),params:Te.optional()}),wi=_e.extend({roots:D(Sb)}),kb=Ie.extend({method:R("notifications/roots/list_changed"),params:Oe.optional()}),kR=G([Ko,Qs,zb,vi,Dv,qv,oi,si,ci,Iv,Cv,Wr,yi,Go,Xo,Yo,en]),PR=G([Jo,Bo,ti,kb,Jr]),ER=G([st,Jt,eo,vt,wi,Wo,Qo,it]),TR=G([Ko,Qr,to,$i,Go,Xo,Yo,en]),RR=G([Jo,Bo,Wv,li,Br,Xr,_i,Jr,bb]),OR=G([st,ei,bi,gi,pi,ni,ii,ui,Fe,Gr,Wo,Qo,it]);class P extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===T.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new Vp(o.elicitations,t)}return new P(e,t,r)}}class Vp extends P{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(T.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function bt(e){return e==="completed"||e==="failed"||e==="cancelled"}var Pb=Symbol("Let zodToJsonSchema decide on which parser to use");var lO=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function xi(e){let r=Qt(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=Ql(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function zi(e,t){let r=be(e,t);if(!r.success)throw r.error;return r.data}var Nb=60000;class oo{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Jo,(t)=>{this._oncancel(t)}),this.setNotificationHandler(Bo,(t)=>{this._onprogress(t)}),this.setRequestHandler(Ko,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(Go,async(t,r)=>{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new P(T.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Xo,async(t,r)=>{let o=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let i;while(i=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(i.type==="response"||i.type==="error"){let a=i.message,u=a.id,c=this._requestResolvers.get(u);if(c)if(this._requestResolvers.delete(u),i.type==="response")c(a);else{let l=a,p=new P(l.error.code,l.error.message,l.error.data);c(p)}else{let l=i.type==="response"?"Response":"Error";this._onerror(Error(`${l} handler missing for request ${u}`))}continue}await this._transport?.send(i.message,{relatedRequestId:r.requestId})}}let s=await this._taskStore.getTask(n,r.sessionId);if(!s)throw new P(T.InvalidParams,`Task not found: ${n}`);if(!bt(s.status))return await this._waitForTaskUpdate(n,r.signal),await o();if(bt(s.status)){let i=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...i,_meta:{...i._meta,[yt]:{taskId:n}}}}return await o()};return await o()}),this.setRequestHandler(Yo,async(t,r)=>{try{let{tasks:o,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:n,_meta:{}}}catch(o){throw new P(T.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(en,async(t,r)=>{try{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new P(T.InvalidParams,`Task not found: ${t.params.taskId}`);if(bt(o.status))throw new P(T.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new P(T.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(o){if(o instanceof P)throw o;throw new P(T.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),P.fromError(T.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{if(o?.(n,s),Lr(n)||Cp(n))this._onresponse(n);else if(Ws(n))this._onrequest(n,s);else if(Np(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=P.fromError(T.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,n=e.params?._meta?.[yt]?.taskId;if(r===void 0){let c={jsonrpc:"2.0",id:e.id,error:{code:T.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:c,timestamp:Date.now()},o?.sessionId).catch((l)=>this._onerror(Error(`Failed to enqueue error response: ${l}`)));else o?.send(c).catch((l)=>this._onerror(Error(`Failed to send an error response: ${l}`)));return}let s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);let i=Rp(e.params)?e.params.task:void 0,a=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:s.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async(c)=>{if(s.signal.aborted)return;let l={relatedRequestId:e.id};if(n)l.relatedTask={taskId:n};await this.notification(c,l)},sendRequest:async(c,l,p)=>{if(s.signal.aborted)throw new P(T.ConnectionClosed,"Request was cancelled");let d={...p,relatedRequestId:e.id};if(n&&!d.relatedTask)d.relatedTask={taskId:n};let f=d.relatedTask?.taskId??n;if(f&&a)await a.updateTaskStatus(f,"input_required");return await this.request(c,l,d)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:a,taskRequestedTtl:i?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(i)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,u)).then(async(c)=>{if(s.signal.aborted)return;let l={result:c,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)},async(c)=>{if(s.signal.aborted)return;let l={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:T.InternalError,message:c.message??"Internal error",...c.data!==void 0&&{data:c.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:l,timestamp:Date.now()},o?.sessionId);else await o?.send(l)}).catch((c)=>this._onerror(Error(`Failed to send response: ${c}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===s)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(o),i=this._timeoutInfo.get(o);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(a){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),s(a);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Lr(e))r(e);else{let s=new P(e.error.code,e.error.message,e.error.data);r(s)}return}let o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(Lr(e)&&e.result&&typeof e.result==="object"){let s=e.result;if(s.task&&typeof s.task==="object"){let i=s.task;if(typeof i.taskId==="string")n=!0,this._taskProgressTokens.set(i.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(Lr(e))o(e);else{let s=P.fromError(e.error.code,e.error.message,e.error.data);o(s)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(s){yield{type:"error",error:s instanceof P?s:new P(T.InternalError,String(s))}}return}let n;try{let s=await this.request(e,it,r);if(s.task)n=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new P(T.InternalError,"Task creation did not return a task");while(!0){let i=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:i},bt(i.status)){if(i.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(i.status==="failed")yield{type:"error",error:new P(T.InternalError,`Task ${n} failed`)};else if(i.status==="cancelled")yield{type:"error",error:new P(T.InternalError,`Task ${n} was cancelled`)};return}if(i.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let a=i.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((u)=>setTimeout(u,a)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof P?s:new P(T.InternalError,String(s))}}}request(e,t,r){let{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s,task:i,relatedTask:a}=r??{};return new Promise((u,c)=>{let l=(v)=>{c(v)};if(!this._transport){l(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),i)this.assertTaskCapability(e.method)}catch(v){l(v);return}r?.signal?.throwIfAborted();let p=this._requestMessageId++,d={...e,jsonrpc:"2.0",id:p};if(r?.onprogress)this._progressHandlers.set(p,r.onprogress),d.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}};if(i)d.params={...d.params,task:i};if(a)d.params={...d.params,_meta:{...d.params?._meta||{},[yt]:a}};let f=(v)=>{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(v)}},{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((N)=>this._onerror(Error(`Failed to send cancellation: ${N}`)));let C=v instanceof P?v:new P(T.RequestTimeout,String(v));c(C)};this._responseHandlers.set(p,(v)=>{if(r?.signal?.aborted)return;if(v instanceof Error)return c(v);try{let C=be(t,v.result);if(!C.success)c(C.error);else u(C.data)}catch(C){c(C)}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});let h=r?.timeout??Nb,g=()=>f(P.fromError(T.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,r?.maxTotalTimeout,g,r?.resetTimeoutOnProgress??!1);let b=a?.taskId;if(b){let v=(C)=>{let N=this._responseHandlers.get(p);if(N)N(C);else this._onerror(Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,v),this._enqueueTaskMessage(b,{type:"request",message:d,timestamp:Date.now()}).catch((C)=>{this._cleanupTimeout(p),c(C)})}else this._transport.send(d,{relatedRequestId:o,resumptionToken:n,onresumptiontoken:s}).catch((v)=>{this._cleanupTimeout(p),c(v)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Wo,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Qo,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},Zp,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let i={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[yt]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:i,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[yt]:t.relatedTask}}};this._transport?.send(i,t).catch((a)=>this._onerror(a))});return}let s={...e,jsonrpc:"2.0"};if(t?.relatedTask)s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[yt]:t.relatedTask}}};await this._transport.send(s,t)}setRequestHandler(e,t){let r=xi(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,n)=>{let s=zi(e,o);return Promise.resolve(t(s,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=xi(e);this._notificationHandlers.set(r,(o)=>{let n=zi(e,o);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let o of r)if(o.type==="request"&&Ws(o.message)){let n=o.message.id,s=this._requestResolvers.get(n);if(s)s(new P(T.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e);if(o?.pollInterval)r=o.pollInterval}catch{}return new Promise((o,n)=>{if(t.aborted){n(new P(T.InvalidRequest,"Request cancelled"));return}let s=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(s),n(new P(T.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(o)=>{if(!e)throw Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async(o)=>{let n=await r.getTask(o,t);if(!n)throw new P(T.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(o,n,s)=>{await r.storeTaskResult(o,n,s,t);let i=await r.getTask(o,t);if(i){let a=Jr.parse({method:"notifications/tasks/status",params:i});if(await this.notification(a),bt(i.status))this._cleanupTaskProgressHandler(o)}},getTaskResult:(o)=>r.getTaskResult(o,t),updateTaskStatus:async(o,n,s)=>{let i=await r.getTask(o,t);if(!i)throw new P(T.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(bt(i.status))throw new P(T.InvalidParams,`Cannot update task "${o}" from terminal status "${i.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,n,s,t);let a=await r.getTask(o,t);if(a){let u=Jr.parse({method:"notifications/tasks/status",params:a});if(await this.notification(u),bt(a.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>r.listTasks(o,t)}}}function Hp(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function tn(e,t){let r={...e};for(let o in t){let n=o,s=t[n];if(s===void 0)continue;let i=r[n];if(Hp(i)&&Hp(s))r[n]={...i,...s};else r[n]=s}return r}var Vg=as(aa(),1),Hg=as(Fg(),1);function sP(){let e=new Vg.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Hg.default(e),e}class _o{constructor(e){this._ajv=e??sP()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class ga{constructor(e){this._client=e}async*callToolStream(e,t=Fe,r){let o=this._client,n={...r,task:r?.task??(o.isToolTask(e.name)?{}:void 0)},s=o.requestStream({method:"tools/call",params:e},t,n),i=o.getToolOutputValidator(e.name);for await(let a of s){if(a.type==="result"&&i){let u=a.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new P(T.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let c=i(u.structuredContent);if(!c.valid){yield{type:"error",error:new P(T.InvalidParams,`Structured content does not match the tool's output schema: ${c.errorMessage}`)};return}}catch(c){if(c instanceof P){yield{type:"error",error:c};return}yield{type:"error",error:new P(T.InvalidParams,`Failed to validate structured content: ${c instanceof Error?c.message:String(c)}`)};return}}yield a}}async getTask(e,t){return this._client.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._client.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._client.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._client.cancelTask({taskId:e},t)}requestStream(e,t,r){return this._client.requestStream(e,t,r)}}function Hn(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function Jn(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}function Kn(e,t){if(!e||t===null||typeof t!=="object")return;if(e.type==="object"&&e.properties&&typeof e.properties==="object"){let r=t,o=e.properties;for(let n of Object.keys(o)){let s=o[n];if(r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default"))r[n]=s.default;if(r[n]!==void 0)Kn(s,r[n])}}if(Array.isArray(e.anyOf)){for(let r of e.anyOf)if(typeof r!=="boolean")Kn(r,t)}if(Array.isArray(e.oneOf)){for(let r of e.oneOf)if(typeof r!=="boolean")Kn(r,t)}}function iP(e){if(!e)return{supportsFormMode:!1,supportsUrlMode:!1};let t=e.form!==void 0,r=e.url!==void 0;return{supportsFormMode:t||!t&&!r,supportsUrlMode:r}}class _a extends oo{constructor(e,t){super(t);if(this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=t?.capabilities??{},this._jsonSchemaValidator=t?.jsonSchemaValidator??new _o,t?.listChanged)this._pendingListChangedConfig=t.listChanged}_setupListChangedHandlers(e){if(e.tools&&this._serverCapabilities?.tools?.listChanged)this._setupListChangedHandler("tools",Xr,e.tools,async()=>(await this.listTools()).tools);if(e.prompts&&this._serverCapabilities?.prompts?.listChanged)this._setupListChangedHandler("prompts",_i,e.prompts,async()=>(await this.listPrompts()).prompts);if(e.resources&&this._serverCapabilities?.resources?.listChanged)this._setupListChangedHandler("resources",Br,e.resources,async()=>(await this.listResources()).resources)}get experimental(){if(!this._experimental)this._experimental={tasks:new ga(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=tn(this._capabilities,e)}setRequestHandler(e,t){let o=Qt(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(_t(o)){let i=o;n=i._zod?.def?.value??i.value}else{let i=o;n=i._def?.value??i.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");let s=n;if(s==="elicitation/create"){let i=async(a,u)=>{let c=be(to,a);if(!c.success){let v=c.error instanceof Error?c.error.message:String(c.error);throw new P(T.InvalidParams,`Invalid elicitation request: ${v}`)}let{params:l}=c.data;l.mode=l.mode??"form";let{supportsFormMode:p,supportsUrlMode:d}=iP(this._capabilities.elicitation);if(l.mode==="form"&&!p)throw new P(T.InvalidParams,"Client does not support form-mode elicitation requests");if(l.mode==="url"&&!d)throw new P(T.InvalidParams,"Client does not support URL-mode elicitation requests");let f=await Promise.resolve(t(a,u));if(l.task){let v=be(it,f);if(!v.success){let C=v.error instanceof Error?v.error.message:String(v.error);throw new P(T.InvalidParams,`Invalid task creation result: ${C}`)}return v.data}let h=be(vt,f);if(!h.success){let v=h.error instanceof Error?h.error.message:String(h.error);throw new P(T.InvalidParams,`Invalid elicitation result: ${v}`)}let g=h.data,b=l.mode==="form"?l.requestedSchema:void 0;if(l.mode==="form"&&g.action==="accept"&&g.content&&b){if(this._capabilities.elicitation?.form?.applyDefaults)try{Kn(b,g.content)}catch{}}return g};return super.setRequestHandler(e,i)}if(s==="sampling/createMessage"){let i=async(a,u)=>{let c=be(Qr,a);if(!c.success){let g=c.error instanceof Error?c.error.message:String(c.error);throw new P(T.InvalidParams,`Invalid sampling request: ${g}`)}let{params:l}=c.data,p=await Promise.resolve(t(a,u));if(l.task){let g=be(it,p);if(!g.success){let b=g.error instanceof Error?g.error.message:String(g.error);throw new P(T.InvalidParams,`Invalid task creation result: ${b}`)}return g.data}let f=l.tools||l.toolChoice?eo:Jt,h=be(f,p);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new P(T.InvalidParams,`Invalid sampling result: ${g}`)}return h.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapability(e,t){if(!this._serverCapabilities?.[e])throw Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId!==void 0)return;try{let r=await this.request({method:"initialize",params:{protocolVersion:Mr,capabilities:this._capabilities,clientInfo:this._clientInfo}},ei,t);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);if(!Fo.includes(r.protocolVersion))throw Error(`Server's protocol version is not supported: ${r.protocolVersion}`);if(this._serverCapabilities=r.capabilities,this._serverVersion=r.serverInfo,e.setProtocolVersion)e.setProtocolVersion(r.protocolVersion);if(this._instructions=r.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig)this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0}catch(r){throw this.close(),r}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw Error(`Client does not support roots capability (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){Hn(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Jn(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},st,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},bi,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},st,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},gi,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},pi,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},ni,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},ii,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},ui,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},st,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},st,t)}async callTool(e,t=Fe,r){if(this.isToolTaskRequired(e.name))throw new P(T.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},t,r),n=this.getToolOutputValidator(e.name);if(n){if(!o.structuredContent&&!o.isError)throw new P(T.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let s=n(o.structuredContent);if(!s.valid)throw new P(T.InvalidParams,`Structured content does not match the tool's output schema: ${s.errorMessage}`)}catch(s){if(s instanceof P)throw s;throw new P(T.InvalidParams,`Failed to validate structured content: ${s instanceof Error?s.message:String(s)}`)}}return o}isToolTask(e){if(!this._serverCapabilities?.tasks?.requests?.tools?.call)return!1;return this._cachedKnownTaskTools.has(e)}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let t of e){if(t.outputSchema){let o=this._jsonSchemaValidator.getValidator(t.outputSchema);this._cachedToolOutputValidators.set(t.name,o)}let r=t.execution?.taskSupport;if(r==="required"||r==="optional")this._cachedKnownTaskTools.add(t.name);if(r==="required")this._cachedRequiredTaskTools.add(t.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let r=await this.request({method:"tools/list",params:e},Gr,t);return this.cacheToolMetadata(r.tools),r}_setupListChangedHandler(e,t,r,o){let n=Fp.safeParse(r);if(!n.success)throw Error(`Invalid ${e} listChanged options: ${n.error.message}`);if(typeof r.onChanged!=="function")throw Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:s,debounceMs:i}=n.data,{onChanged:a}=r,u=async()=>{if(!s){a(null,null);return}try{let l=await o();a(null,l)}catch(l){let p=l instanceof Error?l:Error(String(l));a(p,null)}},c=()=>{if(i){let l=this._listChangedDebounceTimers.get(e);if(l)clearTimeout(l);let p=setTimeout(u,i);this._listChangedDebounceTimers.set(e,p)}else u()};this.setNotificationHandler(t,c)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}}var O_=as(R_(),1);import es from"node:process";import{PassThrough as jP}from"node:stream";class vo{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
47
|
+
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),CP(t)}clear(){this._buffer=void 0}}function CP(e){return jp.parse(JSON.parse(e))}function Qn(e){return JSON.stringify(e)+`
|
|
48
|
+
`}var AP=es.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function ZP(){let e={};for(let t of AP){let r=es.env[t];if(r===void 0)continue;if(r.startsWith("()"))continue;e[t]=r}return e}class ka{constructor(e){if(this._readBuffer=new vo,this._stderrStream=null,this._serverParams=e,e.stderr==="pipe"||e.stderr==="overlapped")this._stderrStream=new jP}async start(){if(this._process)throw Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{if(this._process=O_.default(this._serverParams.command,this._serverParams.args??[],{env:{...ZP(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:es.platform==="win32"&&qP(),cwd:this._serverParams.cwd}),this._process.on("error",(r)=>{t(r),this.onerror?.(r)}),this._process.on("spawn",()=>{e()}),this._process.on("close",(r)=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",(r)=>{this.onerror?.(r)}),this._process.stdout?.on("data",(r)=>{this._readBuffer.append(r),this.processReadBuffer()}),this._process.stdout?.on("error",(r)=>{this.onerror?.(r)}),this._stderrStream&&this._process.stderr)this._process.stderr.pipe(this._stderrStream)})}get stderr(){if(this._stderrStream)return this._stderrStream;return this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let t=new Promise((r)=>{e.once("close",()=>{r()})});try{e.stdin?.end()}catch{}if(await Promise.race([t,new Promise((r)=>setTimeout(r,2000).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([t,new Promise((r)=>setTimeout(r,2000).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise((t)=>{if(!this._process?.stdin)throw Error("Not connected");let r=Qn(e);if(this._process.stdin.write(r))t();else this._process.stdin.once("drain",t)})}}function qP(){return"type"in es}class Pa{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],s=n.some((c)=>c.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],u=a.some((c)=>c.type==="tool_use");if(s){if(n.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!u)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let c=new Set(a.filter((p)=>p.type==="tool_use").map((p)=>p.id)),l=new Set(n.filter((p)=>p.type==="tool_result").map((p)=>p.toolUseId));if(c.size!==l.size||![...c].every((p)=>l.has(p)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Jt,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},vt,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class Ea extends oo{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Yr.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let n=this._loggingLevels.get(o);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new _o,this.setRequestHandler(Qs,(r)=>this._oninitialize(r)),this.setNotificationHandler(ti,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(vi,async(r,o)=>{let n=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:s}=r.params,i=Yr.safeParse(s);if(i.success)this._loggingLevels.set(n,i.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new Pa(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=tn(this._capabilities,e)}setRequestHandler(e,t){let o=Qt(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(_t(o)){let i=o;n=i._zod?.def?.value??i.value}else{let i=o;n=i._def?.value??i.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let i=async(a,u)=>{let c=be(Wr,a);if(!c.success){let f=c.error instanceof Error?c.error.message:String(c.error);throw new P(T.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:l}=c.data,p=await Promise.resolve(t(a,u));if(l.task){let f=be(it,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new P(T.InvalidParams,`Invalid task creation result: ${h}`)}return f.data}let d=be(Fe,p);if(!d.success){let f=d.error instanceof Error?d.error.message:String(d.error);throw new P(T.InvalidParams,`Invalid tools/call result: ${f}`)}return d.data};return super.setRequestHandler(e,i)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){Jn(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;Hn(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Fo.includes(t)?t:Mr,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"},st)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],n=o.some((u)=>u.type==="tool_result"),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],a=i.some((u)=>u.type==="tool_use");if(n){if(o.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!a)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){let u=new Set(i.filter((l)=>l.type==="tool_use").map((l)=>l.id)),c=new Set(o.filter((l)=>l.type==="tool_result").map((l)=>l.toolUseId));if(u.size!==c.size||![...u].every((l)=>c.has(l)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},eo,t);return this.request({method:"sampling/createMessage",params:e},Jt,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},vt,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:o},vt,t);if(n.action==="accept"&&n.content&&o.requestedSchema)try{let i=this._jsonSchemaValidator.getValidator(o.requestedSchema)(n.content);if(!i.valid)throw new P(T.InvalidParams,`Elicitation response content does not match requested schema: ${i.errorMessage}`)}catch(s){if(s instanceof P)throw s;throw new P(T.InternalError,`Error validating elicitation response: ${s instanceof Error?s.message:String(s)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},wi,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import I_ from"node:process";class Ta{constructor(e=I_.stdin,t=I_.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new vo,this._started=!1,this._ondata=(r)=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=(r)=>{this.onerror?.(r)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise((t)=>{let r=Qn(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}import{isAbsolute as N_,dirname as MP,relative as DP,sep as LP}from"node:path";import{fileURLToPath as C_}from"node:url";import{readFileSync as UP}from"node:fs";import{canonicalWorkspace as j_,ensurePmxServer as FP,probePmxServer as VP,runtimeCommand as HP,runtimeVersion as A_}from"./runtime.mjs";var os="canvas_connect_workspace",JP=j_(MP(C_(import.meta.url))),KP=Gr.parse(JSON.parse(UP(new URL("./tools.json",import.meta.url),"utf8"))),pe=new Ea({name:"pmx-canvas-plugin",version:A_},{capabilities:{tools:{listChanged:!0},resources:{listChanged:!0}},instructions:`Before using any PMX board tool, call ${os} with the absolute active project directory. Never use the plugin installation directory as the workspace. Then read skill://pmx-canvas/SKILL.md for workbench guidance. The connection returns a browser workbench URL; the native Copilot canvas is client-specific.`}),Dt,Ra,bo,Sr,ts;async function kr(){if(!Dt||!ts||!Sr)throw new P(T.InvalidRequest,`Call ${os} with your absolute project directory first.`);let e=await VP(ts,Sr);if(!e.ok)throw new P(T.InvalidRequest,`The bound PMX server is unavailable or belongs to another workspace: ${e.error}`);return Dt}async function Oa(e){if(!N_(e))throw new P(T.InvalidParams,"workspaceRoot must be an absolute project directory.");e=j_(e);let t=DP(JP,e);if(!t||t!==".."&&!t.startsWith(`..${LP}`)&&!N_(t))throw new P(T.InvalidParams,"The plugin installation directory is not a project workspace.");if(Sr&&Sr!==e)throw new P(T.InvalidParams,"This MCP session is already bound to another workspace. Start a new session.");if(bo){let r=await bo;return await kr(),r}Sr=e,bo=(async()=>{let r=await FP(e);if(!r.ok||!r.baseUrl||!r.health)throw Error(r.error??"PMX Canvas is unavailable.");if(rs)throw Error("MCP session closed while connecting the workspace.");let o=HP(),n=new ka({command:o.command,args:[...o.args,"--mcp"],cwd:e,env:{...Object.fromEntries(Object.entries(process.env).filter((a)=>a[1]!==void 0)),PMX_CANVAS_URL:r.baseUrl,PMX_CANVAS_WORKSPACE_ROOT:e,PMX_CANVAS_DISABLE_BROWSER_OPEN:"1"},stderr:"inherit"}),s=pe.getClientCapabilities()??{},i=new _a({name:"pmx-canvas-plugin",version:A_},{capabilities:s});if(s.roots)i.setRequestHandler($i,()=>pe.listRoots());if(s.sampling)i.setRequestHandler(Qr,(a)=>pe.createMessage(a.params));if(s.elicitation)i.setRequestHandler(to,(a)=>pe.elicitInput(a.params));i.setNotificationHandler(Xr,()=>pe.sendToolListChanged()),i.setNotificationHandler(Br,()=>pe.sendResourceListChanged()),i.setNotificationHandler(li,(a)=>pe.notification(a));try{if(await i.connect(n),rs)throw Error("MCP session closed while connecting the workspace.");Dt=i,Ra=n,ts=r.baseUrl,await pe.sendToolListChanged(),await pe.sendResourceListChanged()}catch(a){throw Dt=void 0,Ra=void 0,ts=void 0,await i.close(),await n.close(),a}return{workspaceRoot:e,serverUrl:r.baseUrl}})();try{return await bo}catch(r){throw bo=void 0,Sr=void 0,r}}pe.setRequestHandler(yi,async(e)=>({tools:[{name:os,description:"Connect PMX Canvas to the user-selected project BEFORE using board tools. Pass the absolute active project directory, never the plugin installation folder. Returns the browser workbench URL and enables the PMX tools for this MCP session.",inputSchema:{type:"object",properties:{workspaceRoot:{type:"string",description:"Absolute directory of the intended project."}},required:["workspaceRoot"],additionalProperties:!1}},...Dt?(await(await kr()).listTools(e.params)).tools:KP.tools]}));pe.setRequestHandler(Wr,async(e,t)=>{if(e.params.name!==os)return await(await kr()).request(e,Fe,{signal:t.signal});let r=e.params.arguments?.workspaceRoot;if(typeof r!=="string")throw new P(T.InvalidParams,"workspaceRoot is required.");try{let o=await Oa(r);return{content:[{type:"text",text:JSON.stringify({...o,workbenchUrl:`${o.serverUrl}/workbench`})}],structuredContent:{...o,workbenchUrl:`${o.serverUrl}/workbench`}}}catch(o){let n=o instanceof Error?o.message:String(o);return process.stderr.write(`[pmx-canvas] Workspace connection failed: ${n}
|
|
49
|
+
`),{isError:!0,content:[{type:"text",text:n}]}}});pe.setRequestHandler(oi,async(e)=>Dt?await(await kr()).listResources(e.params):{resources:[]});pe.setRequestHandler(si,async(e)=>Dt?await(await kr()).listResourceTemplates(e.params):{resourceTemplates:[]});pe.setRequestHandler(ci,async(e)=>await(await kr()).readResource(e.params));pe.oninitialized=async()=>{try{let e=process.env.PMX_CANVAS_WORKSPACE_ROOT;if(e)await Oa(e);else if(pe.getClientCapabilities()?.roots){let{roots:t}=await pe.listRoots();if(t.length===1&&t[0].uri.startsWith("file:"))await Oa(C_(t[0].uri))}}catch(e){process.stderr.write(`[pmx-canvas] Automatic workspace connection failed: ${e instanceof Error?e.message:String(e)}
|
|
50
|
+
`)}};var rs=!1;async function Ia(){if(rs)return;rs=!0;try{await Dt?.close(),await Ra?.close(),await pe.close()}catch(e){process.stderr.write(`[pmx-canvas] MCP shutdown failed: ${e instanceof Error?e.message:String(e)}
|
|
51
|
+
`),process.exitCode=1}}pe.onclose=()=>void Ia();process.once("SIGTERM",()=>void Ia());process.once("SIGINT",()=>void Ia());await pe.connect(new Ta);
|