zam-core 0.10.2 → 0.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,109 @@
1
+ "use strict";var Tg=Object.create;var mo=Object.defineProperty;var Og=Object.getOwnPropertyDescriptor;var Rg=Object.getOwnPropertyNames;var Ig=Object.getPrototypeOf,Ng=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Un=(t,e)=>{for(var r in e)mo(t,r,{get:e[r],enumerable:!0})},yc=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Rg(e))!Ng.call(t,n)&&n!==r&&mo(t,n,{get:()=>e[n],enumerable:!(o=Og(e,n))||o.enumerable});return t};var fr=(t,e,r)=>(r=t!=null?Tg(Ig(t)):{},yc(e||!t||!t.__esModule?mo(r,"default",{value:t,enumerable:!0}):r,t)),Ag=t=>yc(mo({},"__esModule",{value:!0}),t);var Dr=v(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.regexpCode=L.getEsmExportName=L.getProperty=L.safeStringify=L.stringify=L.strConcat=L.addCodeArg=L.str=L._=L.nil=L._Code=L.Name=L.IDENTIFIER=L._CodeOrName=void 0;var qr=class{};L._CodeOrName=qr;L.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var xt=class extends qr{constructor(e){if(super(),!L.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};L.Name=xt;var Ne=class extends qr{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,o)=>`${r}${o}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,o)=>(o instanceof xt&&(r[o.str]=(r[o.str]||0)+1),r),{})}};L._Code=Ne;L.nil=new Ne("");function jp(t,...e){let r=[t[0]],o=0;for(;o<e.length;)di(r,e[o]),r.push(t[++o]);return new Ne(r)}L._=jp;var li=new Ne("+");function Zp(t,...e){let r=[Mr(t[0])],o=0;for(;o<e.length;)r.push(li),di(r,e[o]),r.push(li,Mr(t[++o]));return Bv(r),new Ne(r)}L.str=Zp;function di(t,e){e instanceof Ne?t.push(...e._items):e instanceof xt?t.push(e):t.push(Yv(e))}L.addCodeArg=di;function Bv(t){let e=1;for(;e<t.length-1;){if(t[e]===li){let r=Gv(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Gv(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof xt||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof xt))return`"${t}${e.slice(1)}`}function Wv(t,e){return e.emptyStr()?t:t.emptyStr()?e:Zp`${t}${e}`}L.strConcat=Wv;function Yv(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Mr(Array.isArray(t)?t.join(","):t)}function Qv(t){return new Ne(Mr(t))}L.stringify=Qv;function Mr(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}L.safeStringify=Mr;function Xv(t){return typeof t=="string"&&L.IDENTIFIER.test(t)?new Ne(`.${t}`):jp`[${t}]`}L.getProperty=Xv;function e$(t){if(typeof t=="string"&&L.IDENTIFIER.test(t))return new Ne(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}L.getEsmExportName=e$;function t$(t){return new Ne(t.toString())}L.regexpCode=t$});var mi=v(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.ValueScope=we.ValueScopeName=we.Scope=we.varKinds=we.UsedValueState=void 0;var be=Dr(),pi=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Go;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Go||(we.UsedValueState=Go={}));we.varKinds={const:new be.Name("const"),let:new be.Name("let"),var:new be.Name("var")};var Wo=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof be.Name?e:this.name(e)}name(e){return new be.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,o;if(!((o=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||o===void 0)&&o.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};we.Scope=Wo;var Yo=class extends be.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=(0,be._)`.${new be.Name(r)}[${o}]`}};we.ValueScopeName=Yo;var r$=(0,be._)`\n`,fi=class extends Wo{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?r$:be.nil}}get(){return this._scope}name(e){return new Yo(e,this._newName(e))}value(e,r){var o;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let n=this.toName(e),{prefix:s}=n,i=(o=r.key)!==null&&o!==void 0?o:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,n);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,n.setValue(r,{property:s,itemIndex:u}),n}getValue(e,r){let o=this._values[e];if(o)return o.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,o=>{if(o.scopePath===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return(0,be._)`${e}${o.scopePath}`})}scopeCode(e=this._values,r,o){return this._reduceValues(e,n=>{if(n.value===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return n.value.code},r,o)}_reduceValues(e,r,o={},n){let s=be.nil;for(let i in e){let a=e[i];if(!a)continue;let c=o[i]=o[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Go.Started);let l=r(u);if(l){let d=this.opts.es5?we.varKinds.var:we.varKinds.const;s=(0,be._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=n?.(u))s=(0,be._)`${s}${l}${this.opts._n}`;else throw new pi(u);c.set(u,Go.Completed)})}return s}};we.ValueScope=fi});var N=v(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.or=A.and=A.not=A.CodeGen=A.operators=A.varKinds=A.ValueScopeName=A.ValueScope=A.Scope=A.Name=A.regexpCode=A.stringify=A.getProperty=A.nil=A.strConcat=A.str=A._=void 0;var Z=Dr(),Me=mi(),pt=Dr();Object.defineProperty(A,"_",{enumerable:!0,get:function(){return pt._}});Object.defineProperty(A,"str",{enumerable:!0,get:function(){return pt.str}});Object.defineProperty(A,"strConcat",{enumerable:!0,get:function(){return pt.strConcat}});Object.defineProperty(A,"nil",{enumerable:!0,get:function(){return pt.nil}});Object.defineProperty(A,"getProperty",{enumerable:!0,get:function(){return pt.getProperty}});Object.defineProperty(A,"stringify",{enumerable:!0,get:function(){return pt.stringify}});Object.defineProperty(A,"regexpCode",{enumerable:!0,get:function(){return pt.regexpCode}});Object.defineProperty(A,"Name",{enumerable:!0,get:function(){return pt.Name}});var tn=mi();Object.defineProperty(A,"Scope",{enumerable:!0,get:function(){return tn.Scope}});Object.defineProperty(A,"ValueScope",{enumerable:!0,get:function(){return tn.ValueScope}});Object.defineProperty(A,"ValueScopeName",{enumerable:!0,get:function(){return tn.ValueScopeName}});Object.defineProperty(A,"varKinds",{enumerable:!0,get:function(){return tn.varKinds}});A.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("+")};var et=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},hi=class extends et{constructor(e,r,o){super(),this.varKind=e,this.name=r,this.rhs=o}render({es5:e,_n:r}){let o=e?Me.varKinds.var:this.varKind,n=this.rhs===void 0?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Jt(this.rhs,e,r)),this}get names(){return this.rhs instanceof Z._CodeOrName?this.rhs.names:{}}},Qo=class extends et{constructor(e,r,o){super(),this.lhs=e,this.rhs=r,this.sideEffects=o}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Z.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Jt(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Z.Name?{}:{...this.lhs.names};return en(e,this.rhs)}},gi=class extends Qo{constructor(e,r,o,n){super(e,o,n),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},_i=class extends et{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},yi=class extends et{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},vi=class extends et{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},$i=class extends et{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Jt(this.code,e,r),this}get names(){return this.code instanceof Z._CodeOrName?this.code.names:{}}},Lr=class extends et{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,o)=>r+o.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let o=e[r].optimizeNodes();Array.isArray(o)?e.splice(r,1,...o):o?e[r]=o:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:o}=this,n=o.length;for(;n--;){let s=o[n];s.optimizeNames(e,r)||(o$(e,s.names),o.splice(n,1))}return o.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Pt(e,r.names),{})}},tt=class extends Lr{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},bi=class extends Lr{},Ht=class extends tt{};Ht.kind="else";var St=class t extends tt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let o=r.optimizeNodes();r=this.else=Array.isArray(o)?new Ht(o):o}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(qp(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var o;if(this.else=(o=this.else)===null||o===void 0?void 0:o.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Jt(this.condition,e,r),this}get names(){let e=super.names;return en(e,this.condition),this.else&&Pt(e,this.else.names),e}};St.kind="if";var kt=class extends tt{};kt.kind="for";var wi=class extends kt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Jt(this.iteration,e,r),this}get names(){return Pt(super.names,this.iteration.names)}},zi=class extends kt{constructor(e,r,o,n){super(),this.varKind=e,this.name=r,this.from=o,this.to=n}render(e){let r=e.es5?Me.varKinds.var:this.varKind,{name:o,from:n,to:s}=this;return`for(${r} ${o}=${n}; ${o}<${s}; ${o}++)`+super.render(e)}get names(){let e=en(super.names,this.from);return en(e,this.to)}},Xo=class extends kt{constructor(e,r,o,n){super(),this.loop=e,this.varKind=r,this.name=o,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Jt(this.iterable,e,r),this}get names(){return Pt(super.names,this.iterable.names)}},Ur=class extends tt{constructor(e,r,o){super(),this.name=e,this.args=r,this.async=o}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Ur.kind="func";var Fr=class extends Lr{render(e){return"return "+super.render(e)}};Fr.kind="return";var xi=class extends tt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var o,n;return super.optimizeNames(e,r),(o=this.catch)===null||o===void 0||o.optimizeNames(e,r),(n=this.finally)===null||n===void 0||n.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Pt(e,this.catch.names),this.finally&&Pt(e,this.finally.names),e}},Vr=class extends tt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Vr.kind="catch";var Hr=class extends tt{render(e){return"finally"+super.render(e)}};Hr.kind="finally";var Si=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
2
+ `:""},this._extScope=e,this._scope=new Me.Scope({parent:e}),this._nodes=[new bi]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let o=this._extScope.value(e,r);return(this._values[o.prefix]||(this._values[o.prefix]=new Set)).add(o),o}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,o,n){let s=this._scope.toName(r);return o!==void 0&&n&&(this._constants[s.str]=o),this._leafNode(new hi(e,s,o)),s}const(e,r,o){return this._def(Me.varKinds.const,e,r,o)}let(e,r,o){return this._def(Me.varKinds.let,e,r,o)}var(e,r,o){return this._def(Me.varKinds.var,e,r,o)}assign(e,r,o){return this._leafNode(new Qo(e,r,o))}add(e,r){return this._leafNode(new gi(e,A.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Z.nil&&this._leafNode(new $i(e)),this}object(...e){let r=["{"];for(let[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,Z.addCodeArg)(r,n));return r.push("}"),new Z._Code(r)}if(e,r,o){if(this._blockNode(new St(e)),r&&o)this.code(r).else().code(o).endIf();else if(r)this.code(r).endIf();else if(o)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new St(e))}else(){return this._elseNode(new Ht)}endIf(){return this._endBlockNode(St,Ht)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new wi(e),r)}forRange(e,r,o,n,s=this.opts.es5?Me.varKinds.var:Me.varKinds.let){let i=this._scope.toName(e);return this._for(new zi(s,i,r,o),()=>n(i))}forOf(e,r,o,n=Me.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof Z.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Z._)`${i}.length`,a=>{this.var(s,(0,Z._)`${i}[${a}]`),o(s)})}return this._for(new Xo("of",n,s,r),()=>o(s))}forIn(e,r,o,n=this.opts.es5?Me.varKinds.var:Me.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Z._)`Object.keys(${r})`,o);let s=this._scope.toName(e);return this._for(new Xo("in",n,s,r),()=>o(s))}endFor(){return this._endBlockNode(kt)}label(e){return this._leafNode(new _i(e))}break(e){return this._leafNode(new yi(e))}return(e){let r=new Fr;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Fr)}try(e,r,o){if(!r&&!o)throw new Error('CodeGen: "try" without "catch" and "finally"');let n=new xi;if(this._blockNode(n),this.code(e),r){let s=this.name("e");this._currNode=n.catch=new Vr(s),r(s)}return o&&(this._currNode=n.finally=new Hr,this.code(o)),this._endBlockNode(Vr,Hr)}throw(e){return this._leafNode(new vi(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let o=this._nodes.length-r;if(o<0||e!==void 0&&o!==e)throw new Error(`CodeGen: wrong number of nodes: ${o} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Z.nil,o,n){return this._blockNode(new Ur(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(Ur)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let o=this._currNode;if(o instanceof e||r&&o instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof St))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};A.CodeGen=Si;function Pt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function en(t,e){return e instanceof Z._CodeOrName?Pt(t,e.names):t}function Jt(t,e,r){if(t instanceof Z.Name)return o(t);if(!n(t))return t;return new Z._Code(t._items.reduce((s,i)=>(i instanceof Z.Name&&(i=o(i)),i instanceof Z._Code?s.push(...i._items):s.push(i),s),[]));function o(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function n(s){return s instanceof Z._Code&&s._items.some(i=>i instanceof Z.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function o$(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function qp(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Z._)`!${ki(t)}`}A.not=qp;var n$=Mp(A.operators.AND);function s$(...t){return t.reduce(n$)}A.and=s$;var i$=Mp(A.operators.OR);function a$(...t){return t.reduce(i$)}A.or=a$;function Mp(t){return(e,r)=>e===Z.nil?r:r===Z.nil?e:(0,Z._)`${ki(e)} ${t} ${ki(r)}`}function ki(t){return t instanceof Z.Name?t:(0,Z._)`(${t})`}});var M=v(C=>{"use strict";Object.defineProperty(C,"__esModule",{value:!0});C.checkStrictMode=C.getErrorPath=C.Type=C.useFunc=C.setEvaluated=C.evaluatedPropsToName=C.mergeEvaluated=C.eachItem=C.unescapeJsonPointer=C.escapeJsonPointer=C.escapeFragment=C.unescapeFragment=C.schemaRefOrVal=C.schemaHasRulesButRef=C.schemaHasRules=C.checkUnknownRules=C.alwaysValidSchema=C.toHash=void 0;var H=N(),c$=Dr();function u$(t){let e={};for(let r of t)e[r]=!0;return e}C.toHash=u$;function l$(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Up(t,e),!Fp(e,t.self.RULES.all))}C.alwaysValidSchema=l$;function Up(t,e=t.schema){let{opts:r,self:o}=t;if(!r.strictSchema||typeof e=="boolean")return;let n=o.RULES.keywords;for(let s in e)n[s]||Jp(t,`unknown keyword: "${s}"`)}C.checkUnknownRules=Up;function Fp(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}C.schemaHasRules=Fp;function d$(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}C.schemaHasRulesButRef=d$;function p$({topSchemaRef:t,schemaPath:e},r,o,n){if(!n){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,H._)`${r}`}return(0,H._)`${t}${e}${(0,H.getProperty)(o)}`}C.schemaRefOrVal=p$;function f$(t){return Vp(decodeURIComponent(t))}C.unescapeFragment=f$;function m$(t){return encodeURIComponent(Ei(t))}C.escapeFragment=m$;function Ei(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}C.escapeJsonPointer=Ei;function Vp(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}C.unescapeJsonPointer=Vp;function h$(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}C.eachItem=h$;function Dp({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:o}){return(n,s,i,a)=>{let c=i===void 0?s:i instanceof H.Name?(s instanceof H.Name?t(n,s,i):e(n,s,i),i):s instanceof H.Name?(e(n,i,s),s):r(s,i);return a===H.Name&&!(c instanceof H.Name)?o(n,c):c}}C.mergeEvaluated={props:Dp({mergeNames:(t,e,r)=>t.if((0,H._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,H._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,H._)`${r} || {}`).code((0,H._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,H._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,H._)`${r} || {}`),Ti(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Hp}),items:Dp({mergeNames:(t,e,r)=>t.if((0,H._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,H._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,H._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,H._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Hp(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,H._)`{}`);return e!==void 0&&Ti(t,r,e),r}C.evaluatedPropsToName=Hp;function Ti(t,e,r){Object.keys(r).forEach(o=>t.assign((0,H._)`${e}${(0,H.getProperty)(o)}`,!0))}C.setEvaluated=Ti;var Lp={};function g$(t,e){return t.scopeValue("func",{ref:e,code:Lp[e.code]||(Lp[e.code]=new c$._Code(e.code))})}C.useFunc=g$;var Pi;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Pi||(C.Type=Pi={}));function _$(t,e,r){if(t instanceof H.Name){let o=e===Pi.Num;return r?o?(0,H._)`"[" + ${t} + "]"`:(0,H._)`"['" + ${t} + "']"`:o?(0,H._)`"/" + ${t}`:(0,H._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,H.getProperty)(t).toString():"/"+Ei(t)}C.getErrorPath=_$;function Jp(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}C.checkStrictMode=Jp});var rt=v(Oi=>{"use strict";Object.defineProperty(Oi,"__esModule",{value:!0});var fe=N(),y$={data:new fe.Name("data"),valCxt:new fe.Name("valCxt"),instancePath:new fe.Name("instancePath"),parentData:new fe.Name("parentData"),parentDataProperty:new fe.Name("parentDataProperty"),rootData:new fe.Name("rootData"),dynamicAnchors:new fe.Name("dynamicAnchors"),vErrors:new fe.Name("vErrors"),errors:new fe.Name("errors"),this:new fe.Name("this"),self:new fe.Name("self"),scope:new fe.Name("scope"),json:new fe.Name("json"),jsonPos:new fe.Name("jsonPos"),jsonLen:new fe.Name("jsonLen"),jsonPart:new fe.Name("jsonPart")};Oi.default=y$});var Jr=v(me=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.extendErrors=me.resetErrorsCount=me.reportExtraError=me.reportError=me.keyword$DataError=me.keywordError=void 0;var D=N(),rn=M(),ye=rt();me.keywordError={message:({keyword:t})=>(0,D.str)`must pass "${t}" keyword validation`};me.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,D.str)`"${t}" keyword must be ${e} ($data)`:(0,D.str)`"${t}" keyword is invalid ($data)`};function v$(t,e=me.keywordError,r,o){let{it:n}=t,{gen:s,compositeRule:i,allErrors:a}=n,c=Gp(t,e,r);o??(i||a)?Kp(s,c):Bp(n,(0,D._)`[${c}]`)}me.reportError=v$;function $$(t,e=me.keywordError,r){let{it:o}=t,{gen:n,compositeRule:s,allErrors:i}=o,a=Gp(t,e,r);Kp(n,a),s||i||Bp(o,ye.default.vErrors)}me.reportExtraError=$$;function b$(t,e){t.assign(ye.default.errors,e),t.if((0,D._)`${ye.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,D._)`${ye.default.vErrors}.length`,e),()=>t.assign(ye.default.vErrors,null)))}me.resetErrorsCount=b$;function w$({gen:t,keyword:e,schemaValue:r,data:o,errsCount:n,it:s}){if(n===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",n,ye.default.errors,a=>{t.const(i,(0,D._)`${ye.default.vErrors}[${a}]`),t.if((0,D._)`${i}.instancePath === undefined`,()=>t.assign((0,D._)`${i}.instancePath`,(0,D.strConcat)(ye.default.instancePath,s.errorPath))),t.assign((0,D._)`${i}.schemaPath`,(0,D.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,D._)`${i}.schema`,r),t.assign((0,D._)`${i}.data`,o))})}me.extendErrors=w$;function Kp(t,e){let r=t.const("err",e);t.if((0,D._)`${ye.default.vErrors} === null`,()=>t.assign(ye.default.vErrors,(0,D._)`[${r}]`),(0,D._)`${ye.default.vErrors}.push(${r})`),t.code((0,D._)`${ye.default.errors}++`)}function Bp(t,e){let{gen:r,validateName:o,schemaEnv:n}=t;n.$async?r.throw((0,D._)`new ${t.ValidationError}(${e})`):(r.assign((0,D._)`${o}.errors`,e),r.return(!1))}var Et={keyword:new D.Name("keyword"),schemaPath:new D.Name("schemaPath"),params:new D.Name("params"),propertyName:new D.Name("propertyName"),message:new D.Name("message"),schema:new D.Name("schema"),parentSchema:new D.Name("parentSchema")};function Gp(t,e,r){let{createErrors:o}=t.it;return o===!1?(0,D._)`{}`:z$(t,e,r)}function z$(t,e,r={}){let{gen:o,it:n}=t,s=[x$(n,r),S$(t,r)];return k$(t,e,s),o.object(...s)}function x$({errorPath:t},{instancePath:e}){let r=e?(0,D.str)`${t}${(0,rn.getErrorPath)(e,rn.Type.Str)}`:t;return[ye.default.instancePath,(0,D.strConcat)(ye.default.instancePath,r)]}function S$({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:o}){let n=o?e:(0,D.str)`${e}/${t}`;return r&&(n=(0,D.str)`${n}${(0,rn.getErrorPath)(r,rn.Type.Str)}`),[Et.schemaPath,n]}function k$(t,{params:e,message:r},o){let{keyword:n,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;o.push([Et.keyword,n],[Et.params,typeof e=="function"?e(t):e||(0,D._)`{}`]),c.messages&&o.push([Et.message,typeof r=="function"?r(t):r]),c.verbose&&o.push([Et.schema,i],[Et.parentSchema,(0,D._)`${l}${d}`],[ye.default.data,s]),u&&o.push([Et.propertyName,u])}});var Yp=v(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});Kt.boolOrEmptySchema=Kt.topBoolOrEmptySchema=void 0;var P$=Jr(),E$=N(),T$=rt(),O$={message:"boolean schema is false"};function R$(t){let{gen:e,schema:r,validateName:o}=t;r===!1?Wp(t,!1):typeof r=="object"&&r.$async===!0?e.return(T$.default.data):(e.assign((0,E$._)`${o}.errors`,null),e.return(!0))}Kt.topBoolOrEmptySchema=R$;function I$(t,e){let{gen:r,schema:o}=t;o===!1?(r.var(e,!1),Wp(t)):r.var(e,!0)}Kt.boolOrEmptySchema=I$;function Wp(t,e){let{gen:r,data:o}=t,n={gen:r,keyword:"false schema",data:o,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,P$.reportError)(n,O$,void 0,e)}});var Ri=v(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.getRules=Bt.isJSONType=void 0;var N$=["string","number","integer","boolean","null","object","array"],A$=new Set(N$);function C$(t){return typeof t=="string"&&A$.has(t)}Bt.isJSONType=C$;function j$(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Bt.getRules=j$});var Ii=v(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.shouldUseRule=ft.shouldUseGroup=ft.schemaHasRulesForType=void 0;function Z$({schema:t,self:e},r){let o=e.RULES.types[r];return o&&o!==!0&&Qp(t,o)}ft.schemaHasRulesForType=Z$;function Qp(t,e){return e.rules.some(r=>Xp(t,r))}ft.shouldUseGroup=Qp;function Xp(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(o=>t[o]!==void 0))}ft.shouldUseRule=Xp});var Kr=v(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.reportTypeError=he.checkDataTypes=he.checkDataType=he.coerceAndCheckDataType=he.getJSONTypes=he.getSchemaTypes=he.DataType=void 0;var q$=Ri(),M$=Ii(),D$=Jr(),I=N(),ef=M(),Gt;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Gt||(he.DataType=Gt={}));function L$(t){let e=tf(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}he.getSchemaTypes=L$;function tf(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(q$.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}he.getJSONTypes=tf;function U$(t,e){let{gen:r,data:o,opts:n}=t,s=F$(e,n.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,M$.schemaHasRulesForType)(t,e[0]));if(i){let a=Ai(e,o,n.strictNumbers,Gt.Wrong);r.if(a,()=>{s.length?V$(t,e,s):Ci(t)})}return i}he.coerceAndCheckDataType=U$;var rf=new Set(["string","number","integer","boolean","null"]);function F$(t,e){return e?t.filter(r=>rf.has(r)||e==="array"&&r==="array"):[]}function V$(t,e,r){let{gen:o,data:n,opts:s}=t,i=o.let("dataType",(0,I._)`typeof ${n}`),a=o.let("coerced",(0,I._)`undefined`);s.coerceTypes==="array"&&o.if((0,I._)`${i} == 'object' && Array.isArray(${n}) && ${n}.length == 1`,()=>o.assign(n,(0,I._)`${n}[0]`).assign(i,(0,I._)`typeof ${n}`).if(Ai(e,n,s.strictNumbers),()=>o.assign(a,n))),o.if((0,I._)`${a} !== undefined`);for(let u of r)(rf.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);o.else(),Ci(t),o.endIf(),o.if((0,I._)`${a} !== undefined`,()=>{o.assign(n,a),H$(t,a)});function c(u){switch(u){case"string":o.elseIf((0,I._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,I._)`"" + ${n}`).elseIf((0,I._)`${n} === null`).assign(a,(0,I._)`""`);return;case"number":o.elseIf((0,I._)`${i} == "boolean" || ${n} === null
3
+ || (${i} == "string" && ${n} && ${n} == +${n})`).assign(a,(0,I._)`+${n}`);return;case"integer":o.elseIf((0,I._)`${i} === "boolean" || ${n} === null
4
+ || (${i} === "string" && ${n} && ${n} == +${n} && !(${n} % 1))`).assign(a,(0,I._)`+${n}`);return;case"boolean":o.elseIf((0,I._)`${n} === "false" || ${n} === 0 || ${n} === null`).assign(a,!1).elseIf((0,I._)`${n} === "true" || ${n} === 1`).assign(a,!0);return;case"null":o.elseIf((0,I._)`${n} === "" || ${n} === 0 || ${n} === false`),o.assign(a,null);return;case"array":o.elseIf((0,I._)`${i} === "string" || ${i} === "number"
5
+ || ${i} === "boolean" || ${n} === null`).assign(a,(0,I._)`[${n}]`)}}}function H$({gen:t,parentData:e,parentDataProperty:r},o){t.if((0,I._)`${e} !== undefined`,()=>t.assign((0,I._)`${e}[${r}]`,o))}function Ni(t,e,r,o=Gt.Correct){let n=o===Gt.Correct?I.operators.EQ:I.operators.NEQ,s;switch(t){case"null":return(0,I._)`${e} ${n} null`;case"array":s=(0,I._)`Array.isArray(${e})`;break;case"object":s=(0,I._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,I._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,I._)`typeof ${e} ${n} ${t}`}return o===Gt.Correct?s:(0,I.not)(s);function i(a=I.nil){return(0,I.and)((0,I._)`typeof ${e} == "number"`,a,r?(0,I._)`isFinite(${e})`:I.nil)}}he.checkDataType=Ni;function Ai(t,e,r,o){if(t.length===1)return Ni(t[0],e,r,o);let n,s=(0,ef.toHash)(t);if(s.array&&s.object){let i=(0,I._)`typeof ${e} != "object"`;n=s.null?i:(0,I._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else n=I.nil;s.number&&delete s.integer;for(let i in s)n=(0,I.and)(n,Ni(i,e,r,o));return n}he.checkDataTypes=Ai;var J$={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,I._)`{type: ${t}}`:(0,I._)`{type: ${e}}`};function Ci(t){let e=K$(t);(0,D$.reportError)(e,J$)}he.reportTypeError=Ci;function K$(t){let{gen:e,data:r,schema:o}=t,n=(0,ef.schemaRefOrVal)(t,o,"type");return{gen:e,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:t}}});var nf=v(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.assignDefaults=void 0;var Wt=N(),B$=M();function G$(t,e){let{properties:r,items:o}=t.schema;if(e==="object"&&r)for(let n in r)of(t,n,r[n].default);else e==="array"&&Array.isArray(o)&&o.forEach((n,s)=>of(t,s,n.default))}on.assignDefaults=G$;function of(t,e,r){let{gen:o,compositeRule:n,data:s,opts:i}=t;if(r===void 0)return;let a=(0,Wt._)`${s}${(0,Wt.getProperty)(e)}`;if(n){(0,B$.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Wt._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,Wt._)`${c} || ${a} === null || ${a} === ""`),o.if(c,(0,Wt._)`${a} = ${(0,Wt.stringify)(r)}`)}});var Ae=v(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.validateUnion=V.validateArray=V.usePattern=V.callValidateCode=V.schemaProperties=V.allSchemaProperties=V.noPropertyInData=V.propertyInData=V.isOwnProperty=V.hasPropFunc=V.reportMissingProp=V.checkMissingProp=V.checkReportMissingProp=void 0;var W=N(),ji=M(),mt=rt(),W$=M();function Y$(t,e){let{gen:r,data:o,it:n}=t;r.if(qi(r,o,e,n.opts.ownProperties),()=>{t.setParams({missingProperty:(0,W._)`${e}`},!0),t.error()})}V.checkReportMissingProp=Y$;function Q$({gen:t,data:e,it:{opts:r}},o,n){return(0,W.or)(...o.map(s=>(0,W.and)(qi(t,e,s,r.ownProperties),(0,W._)`${n} = ${s}`)))}V.checkMissingProp=Q$;function X$(t,e){t.setParams({missingProperty:e},!0),t.error()}V.reportMissingProp=X$;function sf(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,W._)`Object.prototype.hasOwnProperty`})}V.hasPropFunc=sf;function Zi(t,e,r){return(0,W._)`${sf(t)}.call(${e}, ${r})`}V.isOwnProperty=Zi;function eb(t,e,r,o){let n=(0,W._)`${e}${(0,W.getProperty)(r)} !== undefined`;return o?(0,W._)`${n} && ${Zi(t,e,r)}`:n}V.propertyInData=eb;function qi(t,e,r,o){let n=(0,W._)`${e}${(0,W.getProperty)(r)} === undefined`;return o?(0,W.or)(n,(0,W.not)(Zi(t,e,r))):n}V.noPropertyInData=qi;function af(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}V.allSchemaProperties=af;function tb(t,e){return af(e).filter(r=>!(0,ji.alwaysValidSchema)(t,e[r]))}V.schemaProperties=tb;function rb({schemaCode:t,data:e,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:s},it:i},a,c,u){let l=u?(0,W._)`${t}, ${e}, ${o}${n}`:e,d=[[mt.default.instancePath,(0,W.strConcat)(mt.default.instancePath,s)],[mt.default.parentData,i.parentData],[mt.default.parentDataProperty,i.parentDataProperty],[mt.default.rootData,mt.default.rootData]];i.opts.dynamicRef&&d.push([mt.default.dynamicAnchors,mt.default.dynamicAnchors]);let p=(0,W._)`${l}, ${r.object(...d)}`;return c!==W.nil?(0,W._)`${a}.call(${c}, ${p})`:(0,W._)`${a}(${p})`}V.callValidateCode=rb;var ob=(0,W._)`new RegExp`;function nb({gen:t,it:{opts:e}},r){let o=e.unicodeRegExp?"u":"",{regExp:n}=e.code,s=n(r,o);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,W._)`${n.code==="new RegExp"?ob:(0,W$.useFunc)(t,n)}(${r}, ${o})`})}V.usePattern=nb;function sb(t){let{gen:e,data:r,keyword:o,it:n}=t,s=e.name("valid");if(n.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,W._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:o,dataProp:u,dataPropType:ji.Type.Num},s),e.if((0,W.not)(s),a)})}}V.validateArray=sb;function ib(t){let{gen:e,schema:r,keyword:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ji.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:o,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,W._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,W.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}V.validateUnion=ib});var lf=v(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.validateKeywordUsage=He.validSchemaType=He.funcKeywordCode=He.macroKeywordCode=void 0;var ve=N(),Tt=rt(),ab=Ae(),cb=Jr();function ub(t,e){let{gen:r,keyword:o,schema:n,parentSchema:s,it:i}=t,a=e.macro.call(i.self,n,s,i),c=uf(r,o,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:ve.nil,errSchemaPath:`${i.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}He.macroKeywordCode=ub;function lb(t,e){var r;let{gen:o,keyword:n,schema:s,parentSchema:i,$data:a,it:c}=t;pb(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=uf(o,n,u),d=o.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)_(),e.modifying&&cf(t),y(()=>t.error());else{let $=e.async?f():m();e.modifying&&cf(t),y(()=>db(t,$))}}function f(){let $=o.let("ruleErrs",null);return o.try(()=>_((0,ve._)`await `),w=>o.assign(d,!1).if((0,ve._)`${w} instanceof ${c.ValidationError}`,()=>o.assign($,(0,ve._)`${w}.errors`),()=>o.throw(w))),$}function m(){let $=(0,ve._)`${l}.errors`;return o.assign($,null),_(ve.nil),$}function _($=e.async?(0,ve._)`await `:ve.nil){let w=c.opts.passContext?Tt.default.this:Tt.default.self,z=!("compile"in e&&!a||e.schema===!1);o.assign(d,(0,ve._)`${$}${(0,ab.callValidateCode)(t,l,w,z)}`,e.modifying)}function y($){var w;o.if((0,ve.not)((w=e.valid)!==null&&w!==void 0?w:d),$)}}He.funcKeywordCode=lb;function cf(t){let{gen:e,data:r,it:o}=t;e.if(o.parentData,()=>e.assign(r,(0,ve._)`${o.parentData}[${o.parentDataProperty}]`))}function db(t,e){let{gen:r}=t;r.if((0,ve._)`Array.isArray(${e})`,()=>{r.assign(Tt.default.vErrors,(0,ve._)`${Tt.default.vErrors} === null ? ${e} : ${Tt.default.vErrors}.concat(${e})`).assign(Tt.default.errors,(0,ve._)`${Tt.default.vErrors}.length`),(0,cb.extendErrors)(t)},()=>t.error())}function pb({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function uf(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,ve.stringify)(r)})}function fb(t,e,r=!1){return!e.length||e.some(o=>o==="array"?Array.isArray(t):o==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==o||r&&typeof t>"u")}He.validSchemaType=fb;function mb({schema:t,opts:e,self:r,errSchemaPath:o},n,s){if(Array.isArray(n.keyword)?!n.keyword.includes(s):n.keyword!==s)throw new Error("ajv implementation error");let i=n.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(n.validateSchema&&!n.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}He.validateKeywordUsage=mb});var pf=v(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.extendSubschemaMode=ht.extendSubschemaData=ht.getSubschema=void 0;var Je=N(),df=M();function hb(t,{keyword:e,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&o!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Je._)`${t.schemaPath}${(0,Je.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Je._)`${t.schemaPath}${(0,Je.getProperty)(e)}${(0,Je.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,df.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}ht.getSubschema=hb;function gb(t,e,{dataProp:r,dataPropType:o,data:n,dataTypes:s,propertyName:i}){if(n!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0,Je._)`${e.data}${(0,Je.getProperty)(r)}`,!0);c(p),t.errorPath=(0,Je.str)`${u}${(0,df.getErrorPath)(r,o,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Je._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(n!==void 0){let u=n instanceof Je.Name?n:a.let("data",n,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}ht.extendSubschemaData=gb;function _b(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:s}){o!==void 0&&(t.compositeRule=o),n!==void 0&&(t.createErrors=n),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}ht.extendSubschemaMode=_b});var Mi=v((rI,ff)=>{"use strict";ff.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var o,n,s;if(Array.isArray(e)){if(o=e.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!t(e[n],r[n]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),o=s.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[n]))return!1;for(n=o;n--!==0;){var i=s[n];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var hf=v((oI,mf)=>{"use strict";var gt=mf.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};nn(e,o,n,t,"",t)};gt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};gt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};gt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};gt.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 nn(t,e,r,o,n,s,i,a,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){e(o,n,s,i,a,c,u);for(var l in o){var d=o[l];if(Array.isArray(d)){if(l in gt.arrayKeywords)for(var p=0;p<d.length;p++)nn(t,e,r,d[p],n+"/"+l+"/"+p,s,n,l,o,p)}else if(l in gt.propsKeywords){if(d&&typeof d=="object")for(var f in d)nn(t,e,r,d[f],n+"/"+l+"/"+yb(f),s,n,l,o,f)}else(l in gt.keywords||t.allKeys&&!(l in gt.skipKeywords))&&nn(t,e,r,d,n+"/"+l,s,n,l,o)}r(o,n,s,i,a,c,u)}}function yb(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Br=v(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.getSchemaRefs=ze.resolveUrl=ze.normalizeId=ze._getFullPath=ze.getFullPath=ze.inlineRef=void 0;var vb=M(),$b=Mi(),bb=hf(),wb=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function zb(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Di(t):e?gf(t)<=e:!1}ze.inlineRef=zb;var xb=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Di(t){for(let e in t){if(xb.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Di)||typeof r=="object"&&Di(r))return!0}return!1}function gf(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!wb.has(r)&&(typeof t[r]=="object"&&(0,vb.eachItem)(t[r],o=>e+=gf(o)),e===1/0))return 1/0}return e}function _f(t,e="",r){r!==!1&&(e=Yt(e));let o=t.parse(e);return yf(t,o)}ze.getFullPath=_f;function yf(t,e){return t.serialize(e).split("#")[0]+"#"}ze._getFullPath=yf;var Sb=/#\/?$/;function Yt(t){return t?t.replace(Sb,""):""}ze.normalizeId=Yt;function kb(t,e,r){return r=Yt(r),t.resolve(e,r)}ze.resolveUrl=kb;var Pb=/^[a-z_][-a-z0-9._]*$/i;function Eb(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Yt(t[r]||e),s={"":n},i=_f(o,n,!1),a={},c=new Set;return bb(t,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let _=i+p,y=s[m];typeof d[r]=="string"&&(y=$.call(this,d[r])),w.call(this,d.$anchor),w.call(this,d.$dynamicAnchor),s[p]=y;function $(z){let P=this.opts.uriResolver.resolve;if(z=Yt(y?P(y,z):z),c.has(z))throw l(z);c.add(z);let x=this.refs[z];return typeof x=="string"&&(x=this.refs[x]),typeof x=="object"?u(d,x.schema,z):z!==Yt(_)&&(z[0]==="#"?(u(d,a[z],z),a[z]=d):this.refs[z]=_),z}function w(z){if(typeof z=="string"){if(!Pb.test(z))throw new Error(`invalid anchor "${z}"`);$.call(this,`#${z}`)}}}),a;function u(d,p,f){if(p!==void 0&&!$b(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}ze.getSchemaRefs=Eb});var Yr=v(_t=>{"use strict";Object.defineProperty(_t,"__esModule",{value:!0});_t.getData=_t.KeywordCxt=_t.validateFunctionCode=void 0;var zf=Yp(),vf=Kr(),Ui=Ii(),sn=Kr(),Tb=nf(),Wr=lf(),Li=pf(),k=N(),R=rt(),Ob=Br(),ot=M(),Gr=Jr();function Rb(t){if(kf(t)&&(Pf(t),Sf(t))){Ab(t);return}xf(t,()=>(0,zf.topBoolOrEmptySchema)(t))}_t.validateFunctionCode=Rb;function xf({gen:t,validateName:e,schema:r,schemaEnv:o,opts:n},s){n.code.es5?t.func(e,(0,k._)`${R.default.data}, ${R.default.valCxt}`,o.$async,()=>{t.code((0,k._)`"use strict"; ${$f(r,n)}`),Nb(t,n),t.code(s)}):t.func(e,(0,k._)`${R.default.data}, ${Ib(n)}`,o.$async,()=>t.code($f(r,n)).code(s))}function Ib(t){return(0,k._)`{${R.default.instancePath}="", ${R.default.parentData}, ${R.default.parentDataProperty}, ${R.default.rootData}=${R.default.data}${t.dynamicRef?(0,k._)`, ${R.default.dynamicAnchors}={}`:k.nil}}={}`}function Nb(t,e){t.if(R.default.valCxt,()=>{t.var(R.default.instancePath,(0,k._)`${R.default.valCxt}.${R.default.instancePath}`),t.var(R.default.parentData,(0,k._)`${R.default.valCxt}.${R.default.parentData}`),t.var(R.default.parentDataProperty,(0,k._)`${R.default.valCxt}.${R.default.parentDataProperty}`),t.var(R.default.rootData,(0,k._)`${R.default.valCxt}.${R.default.rootData}`),e.dynamicRef&&t.var(R.default.dynamicAnchors,(0,k._)`${R.default.valCxt}.${R.default.dynamicAnchors}`)},()=>{t.var(R.default.instancePath,(0,k._)`""`),t.var(R.default.parentData,(0,k._)`undefined`),t.var(R.default.parentDataProperty,(0,k._)`undefined`),t.var(R.default.rootData,R.default.data),e.dynamicRef&&t.var(R.default.dynamicAnchors,(0,k._)`{}`)})}function Ab(t){let{schema:e,opts:r,gen:o}=t;xf(t,()=>{r.$comment&&e.$comment&&Tf(t),Mb(t),o.let(R.default.vErrors,null),o.let(R.default.errors,0),r.unevaluated&&Cb(t),Ef(t),Ub(t)})}function Cb(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,k._)`${r}.evaluated`),e.if((0,k._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,k._)`${t.evaluated}.props`,(0,k._)`undefined`)),e.if((0,k._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,k._)`${t.evaluated}.items`,(0,k._)`undefined`))}function $f(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,k._)`/*# sourceURL=${r} */`:k.nil}function jb(t,e){if(kf(t)&&(Pf(t),Sf(t))){Zb(t,e);return}(0,zf.boolOrEmptySchema)(t,e)}function Sf({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function kf(t){return typeof t.schema!="boolean"}function Zb(t,e){let{schema:r,gen:o,opts:n}=t;n.$comment&&r.$comment&&Tf(t),Db(t),Lb(t);let s=o.const("_errs",R.default.errors);Ef(t,s),o.var(e,(0,k._)`${s} === ${R.default.errors}`)}function Pf(t){(0,ot.checkUnknownRules)(t),qb(t)}function Ef(t,e){if(t.opts.jtd)return bf(t,[],!1,e);let r=(0,vf.getSchemaTypes)(t.schema),o=(0,vf.coerceAndCheckDataType)(t,r);bf(t,r,!o,e)}function qb(t){let{schema:e,errSchemaPath:r,opts:o,self:n}=t;e.$ref&&o.ignoreKeywordsWithRef&&(0,ot.schemaHasRulesButRef)(e,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Mb(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ot.checkStrictMode)(t,"default is ignored in the schema root")}function Db(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Ob.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Lb(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Tf({gen:t,schemaEnv:e,schema:r,errSchemaPath:o,opts:n}){let s=r.$comment;if(n.$comment===!0)t.code((0,k._)`${R.default.self}.logger.log(${s})`);else if(typeof n.$comment=="function"){let i=(0,k.str)`${o}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,k._)`${R.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Ub(t){let{gen:e,schemaEnv:r,validateName:o,ValidationError:n,opts:s}=t;r.$async?e.if((0,k._)`${R.default.errors} === 0`,()=>e.return(R.default.data),()=>e.throw((0,k._)`new ${n}(${R.default.vErrors})`)):(e.assign((0,k._)`${o}.errors`,R.default.vErrors),s.unevaluated&&Fb(t),e.return((0,k._)`${R.default.errors} === 0`))}function Fb({gen:t,evaluated:e,props:r,items:o}){r instanceof k.Name&&t.assign((0,k._)`${e}.props`,r),o instanceof k.Name&&t.assign((0,k._)`${e}.items`,o)}function bf(t,e,r,o){let{gen:n,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ot.schemaHasRulesButRef)(s,l))){n.block(()=>Rf(t,"$ref",l.all.$ref.definition));return}c.jtd||Vb(t,e),n.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Ui.shouldUseGroup)(s,p)&&(p.type?(n.if((0,sn.checkDataType)(p.type,i,c.strictNumbers)),wf(t,p),e.length===1&&e[0]===p.type&&r&&(n.else(),(0,sn.reportTypeError)(t)),n.endIf()):wf(t,p),a||n.if((0,k._)`${R.default.errors} === ${o||0}`))}}function wf(t,e){let{gen:r,schema:o,opts:{useDefaults:n}}=t;n&&(0,Tb.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Ui.shouldUseRule)(o,s)&&Rf(t,s.keyword,s.definition,e.type)})}function Vb(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Hb(t,e),t.opts.allowUnionTypes||Jb(t,e),Kb(t,t.dataTypes))}function Hb(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Of(t.dataTypes,r)||Fi(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Gb(t,e)}}function Jb(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Fi(t,"use allowUnionTypes to allow union type keyword")}function Kb(t,e){let r=t.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,Ui.shouldUseRule)(t.schema,n)){let{type:s}=n.definition;s.length&&!s.some(i=>Bb(e,i))&&Fi(t,`missing type "${s.join(",")}" for keyword "${o}"`)}}}function Bb(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Of(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Gb(t,e){let r=[];for(let o of t.dataTypes)Of(e,o)?r.push(o):e.includes("integer")&&o==="number"&&r.push("integer");t.dataTypes=r}function Fi(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,ot.checkStrictMode)(t,e,t.opts.strictTypes)}var an=class{constructor(e,r,o){if((0,Wr.validateKeywordUsage)(e,r,o),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=o,this.data=e.data,this.schema=e.schema[o],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ot.schemaRefOrVal)(e,this.schema,o,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",If(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Wr.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${o} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",R.default.errors))}result(e,r,o){this.failResult((0,k.not)(e),r,o)}failResult(e,r,o){this.gen.if(e),o?o():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,k.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,k._)`${r} !== undefined && (${(0,k.or)(this.invalid$data(),e)})`)}error(e,r,o){if(r){this.setParams(r),this._error(e,o),this.setParams({});return}this._error(e,o)}_error(e,r){(e?Gr.reportExtraError:Gr.reportError)(this,this.def.error,r)}$dataError(){(0,Gr.reportError)(this,this.def.$dataError||Gr.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Gr.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,o=k.nil){this.gen.block(()=>{this.check$data(e,o),r()})}check$data(e=k.nil,r=k.nil){if(!this.$data)return;let{gen:o,schemaCode:n,schemaType:s,def:i}=this;o.if((0,k.or)((0,k._)`${n} === undefined`,r)),e!==k.nil&&o.assign(e,!0),(s.length||i.validateSchema)&&(o.elseIf(this.invalid$data()),this.$dataError(),e!==k.nil&&o.assign(e,!1)),o.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:o,def:n,it:s}=this;return(0,k.or)(i(),a());function i(){if(o.length){if(!(r instanceof k.Name))throw new Error("ajv implementation error");let c=Array.isArray(o)?o:[o];return(0,k._)`${(0,sn.checkDataTypes)(c,r,s.opts.strictNumbers,sn.DataType.Wrong)}`}return k.nil}function a(){if(n.validateSchema){let c=e.scopeValue("validate$data",{ref:n.validateSchema});return(0,k._)`!${c}(${r})`}return k.nil}}subschema(e,r){let o=(0,Li.getSubschema)(this.it,e);(0,Li.extendSubschemaData)(o,this.it,e),(0,Li.extendSubschemaMode)(o,e);let n={...this.it,...o,items:void 0,props:void 0};return jb(n,r),n}mergeEvaluated(e,r){let{it:o,gen:n}=this;o.opts.unevaluated&&(o.props!==!0&&e.props!==void 0&&(o.props=ot.mergeEvaluated.props(n,e.props,o.props,r)),o.items!==!0&&e.items!==void 0&&(o.items=ot.mergeEvaluated.items(n,e.items,o.items,r)))}mergeValidEvaluated(e,r){let{it:o,gen:n}=this;if(o.opts.unevaluated&&(o.props!==!0||o.items!==!0))return n.if(r,()=>this.mergeEvaluated(e,k.Name)),!0}};_t.KeywordCxt=an;function Rf(t,e,r,o){let n=new an(t,r,e);"code"in r?r.code(n,o):n.$data&&r.validate?(0,Wr.funcKeywordCode)(n,r):"macro"in r?(0,Wr.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,Wr.funcKeywordCode)(n,r)}var Wb=/^\/(?:[^~]|~0|~1)*$/,Yb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function If(t,{dataLevel:e,dataNames:r,dataPathArr:o}){let n,s;if(t==="")return R.default.rootData;if(t[0]==="/"){if(!Wb.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);n=t,s=R.default.rootData}else{let u=Yb.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(n=u[2],n==="#"){if(l>=e)throw new Error(c("property/index",l));return o[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!n)return s}let i=s,a=n.split("/");for(let u of a)u&&(s=(0,k._)`${s}${(0,k.getProperty)((0,ot.unescapeJsonPointer)(u))}`,i=(0,k._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}_t.getData=If});var cn=v(Hi=>{"use strict";Object.defineProperty(Hi,"__esModule",{value:!0});var Vi=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Hi.default=Vi});var Qr=v(Bi=>{"use strict";Object.defineProperty(Bi,"__esModule",{value:!0});var Ji=Br(),Ki=class extends Error{constructor(e,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,Ji.resolveUrl)(e,r,o),this.missingSchema=(0,Ji.normalizeId)((0,Ji.getFullPath)(e,this.missingRef))}};Bi.default=Ki});var ln=v(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.resolveSchema=Ce.getCompilingSchema=Ce.resolveRef=Ce.compileSchema=Ce.SchemaEnv=void 0;var De=N(),Qb=cn(),Ot=rt(),Le=Br(),Nf=M(),Xb=Yr(),Qt=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let o;typeof e.schema=="object"&&(o=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Le.normalizeId)(o?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=o?.$async,this.refs={}}};Ce.SchemaEnv=Qt;function Wi(t){let e=Af.call(this,t);if(e)return e;let r=(0,Le.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:s}=this.opts,i=new De.CodeGen(this.scope,{es5:o,lines:n,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:Qb.default,code:(0,De._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Ot.default.data,parentData:Ot.default.parentData,parentDataProperty:Ot.default.parentDataProperty,dataNames:[Ot.default.data],dataPathArr:[De.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,De.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:De.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,De._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Xb.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Ot.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Ot.default.self}`,`${Ot.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:m,items:_}=u;f.evaluated={props:m instanceof De.Name?void 0:m,items:_ instanceof De.Name?void 0:_,dynamicProps:m instanceof De.Name,dynamicItems:_ instanceof De.Name},f.source&&(f.source.evaluated=(0,De.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}Ce.compileSchema=Wi;function ew(t,e,r){var o;r=(0,Le.resolveUrl)(this.opts.uriResolver,e,r);let n=t.refs[r];if(n)return n;let s=ow.call(this,t,r);if(s===void 0){let i=(o=t.localRefs)===null||o===void 0?void 0:o[r],{schemaId:a}=this.opts;i&&(s=new Qt({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=tw.call(this,s)}Ce.resolveRef=ew;function tw(t){return(0,Le.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Wi.call(this,t)}function Af(t){for(let e of this._compilations)if(rw(e,t))return e}Ce.getCompilingSchema=Af;function rw(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function ow(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||un.call(this,t,e)}function un(t,e){let r=this.opts.uriResolver.parse(e),o=(0,Le._getFullPath)(this.opts.uriResolver,r),n=(0,Le.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&o===n)return Gi.call(this,r,t);let s=(0,Le.normalizeId)(o),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=un.call(this,t,i);return typeof a?.schema!="object"?void 0:Gi.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Wi.call(this,i),s===(0,Le.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(n=(0,Le.resolveUrl)(this.opts.uriResolver,n,u)),new Qt({schema:a,schemaId:c,root:t,baseId:n})}return Gi.call(this,r,i)}}Ce.resolveSchema=un;var nw=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Gi(t,{baseId:e,schema:r,root:o}){var n;if(((n=t.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Nf.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!nw.has(a)&&u&&(e=(0,Le.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Nf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Le.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=un.call(this,o,a)}let{schemaId:i}=this.opts;if(s=s||new Qt({schema:r,schemaId:i,root:o,baseId:e}),s.schema!==s.root.schema)return s}});var Cf=v((uI,sw)=>{sw.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 Xi=v((lI,Lf)=>{"use strict";var iw=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Zf=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),Yi=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),qf=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),aw=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Qi(t){let e="",r=0,o=0;for(o=0;o<t.length;o++)if(r=t[o].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o];break}for(o+=1;o<t.length;o++){if(r=t[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[o]}return e}var cw=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function jf(t){return t.length=0,!0}function uw(t,e,r){if(t.length){let o=Qi(t);if(o!=="")e.push(o);else return r.error=!0,!1;t.length=0}return!0}function lw(t){let e=0,r={error:!1,address:"",zone:""},o=[],n=[],s=!1,i=!1,a=uw;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(n,o,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),o.push(":");continue}else if(u==="%"){if(!a(n,o,r))break;a=jf}else{n.push(u);continue}}return n.length&&(a===jf?r.zone=n.join(""):i?o.push(n.join("")):o.push(Qi(n))),r.address=o.join(""),r}function Mf(t){if(dw(t,":")<2)return{host:t,isIPV6:!1};let e=lw(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,o=e.address;return e.zone&&(r+="%"+e.zone,o+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:o}}}function dw(t,e){let r=0;for(let o=0;o<t.length;o++)t[o]===e&&r++;return r}function pw(t){let e=t,r=[],o=-1,n=0;for(;n=e.length;){if(n===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(n===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(n===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((o=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,o)),e=e.slice(o)}return r.join("")}var fw={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},mw=/[@/?#:]/g,hw=/[@/?#]/g;function Df(t,e){let r=e?hw:mw;return r.lastIndex=0,t.replace(r,o=>fw[o])}function gw(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let o=0;o<t.length;o++){if(t[o]==="%"&&o+2<t.length){let n=t.slice(o+1,o+3);if(Yi(n)){let s=n.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&qf(i)?r+=i:r+="%"+s,o+=2;continue}}r+=t[o]}return r}function _w(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(Yi(o)){let n=o.toUpperCase(),s=String.fromCharCode(parseInt(n,16));s!=="."&&qf(s)?e+=s:e+="%"+n,r+=2;continue}}aw(t[r])?e+=t[r]:e+=escape(t[r])}return e}function yw(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let o=t.slice(r+1,r+3);if(Yi(o)){e+="%"+o.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function vw(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Zf(r)){let o=Mf(r);o.isIPV6===!0?r=`[${o.escapedHost}]`:r=Df(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Lf.exports={nonSimpleDomain:cw,recomposeAuthority:vw,reescapeHostDelimiters:Df,normalizePercentEncoding:gw,normalizePathEncoding:_w,escapePreservingEscapes:yw,removeDotSegments:pw,isIPv4:Zf,isUUID:iw,normalizeIPv6:Mf,stringArrayToHexStripped:Qi}});var Jf=v((dI,Hf)=>{"use strict";var{isUUID:$w}=Xi(),bw=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,ww=["http","https","ws","wss","urn","urn:uuid"];function zw(t){return ww.indexOf(t)!==-1}function ea(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Uf(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Ff(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function xw(t){return t.secure=ea(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Sw(t){if((t.port===(ea(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function kw(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(bw);if(r){let o=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let n=`${o}:${e.nid||t.nid}`,s=ta(n);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Pw(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",o=t.nid.toLowerCase(),n=`${r}:${e.nid||o}`,s=ta(n);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${o||e.nid}:${a}`,e.skipEscape=!0,i}function Ew(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!$w(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Tw(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Vf={scheme:"http",domainHost:!0,parse:Uf,serialize:Ff},Ow={scheme:"https",domainHost:Vf.domainHost,parse:Uf,serialize:Ff},dn={scheme:"ws",domainHost:!0,parse:xw,serialize:Sw},Rw={scheme:"wss",domainHost:dn.domainHost,parse:dn.parse,serialize:dn.serialize},Iw={scheme:"urn",parse:kw,serialize:Pw,skipNormalize:!0},Nw={scheme:"urn:uuid",parse:Ew,serialize:Tw,skipNormalize:!0},pn={http:Vf,https:Ow,ws:dn,wss:Rw,urn:Iw,"urn:uuid":Nw};Object.setPrototypeOf(pn,null);function ta(t){return t&&(pn[t]||pn[t.toLowerCase()])||void 0}Hf.exports={wsIsSecure:ea,SCHEMES:pn,isValidSchemeName:zw,getSchemeHandler:ta}});var Qf=v((pI,fn)=>{"use strict";var{normalizeIPv6:Aw,removeDotSegments:Xr,recomposeAuthority:Cw,normalizePercentEncoding:jw,normalizePathEncoding:Zw,escapePreservingEscapes:qw,reescapeHostDelimiters:Mw,isIPv4:Dw,nonSimpleDomain:Lw}=Xi(),{SCHEMES:Uw,getSchemeHandler:Bf}=Jf();function Fw(t,e){return typeof t=="string"?t=Bw(t,e):typeof t=="object"&&(t=Xt(Rt(t,e),e)),t}function Vw(t,e,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=Gf(Xt(t,o),Xt(e,o),o,!0);return o.skipEscape=!0,Rt(n,o)}function Gf(t,e,r,o){let n={};return o||(t=Xt(Rt(t,r),r),e=Xt(Rt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(n.scheme=e.scheme,n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Xr(e.path||""),n.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(n.userinfo=e.userinfo,n.host=e.host,n.port=e.port,n.path=Xr(e.path||""),n.query=e.query):(e.path?(e.path[0]==="/"?n.path=Xr(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?n.path="/"+e.path:t.path?n.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:n.path=e.path,n.path=Xr(n.path)),n.query=e.query):(n.path=t.path,e.query!==void 0?n.query=e.query:n.query=t.query),n.userinfo=t.userinfo,n.host=t.host,n.port=t.port),n.scheme=t.scheme),n.fragment=e.fragment,n}function Hw(t,e,r){let o=Kf(t,r),n=Kf(e,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function Rt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},o=Object.assign({},e),n=[],s=Bf(o.scheme||r.scheme);s&&s.serialize&&s.serialize(r,o),r.path!==void 0&&(o.skipEscape?r.path=jw(r.path):(r.path=qw(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),o.reference!=="suffix"&&r.scheme&&n.push(r.scheme,":");let i=Cw(r);if(i!==void 0&&(o.reference!=="suffix"&&n.push("//"),n.push(i),r.path&&r.path[0]!=="/"&&n.push("/")),r.path!==void 0){let a=r.path;!o.absolutePath&&(!s||!s.absolutePath)&&(a=Xr(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),n.push(a)}return r.query!==void 0&&n.push("?",r.query),r.fragment!==void 0&&n.push("#",r.fragment),n.join("")}var Jw=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Kw(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function Wf(t,e){let r=Object.assign({},e),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(Jw);if(i){o.scheme=i[1],o.userinfo=i[3],o.host=i[4],o.port=parseInt(i[5],10),o.path=i[6]||"",o.query=i[7],o.fragment=i[8],isNaN(o.port)&&(o.port=i[5]);let a=Kw(o,i);if(a!==void 0&&(o.error=o.error||a,n=!0),o.host)if(Dw(o.host)===!1){let l=Aw(o.host);o.host=l.host.toLowerCase(),s=l.isIPV6}else s=!0;o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path?o.reference="same-document":o.scheme===void 0?o.reference="relative":o.fragment===void 0?o.reference="absolute":o.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==o.reference&&(o.error=o.error||"URI is not a "+r.reference+" reference.");let c=Bf(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)&&o.host&&(r.domainHost||c&&c.domainHost)&&s===!1&&Lw(o.host))try{o.host=new URL("http://"+o.host).hostname}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}if((!c||c&&!c.skipNormalize)&&(t.indexOf("%")!==-1&&(o.scheme!==void 0&&(o.scheme=unescape(o.scheme)),o.host!==void 0&&(o.host=Mw(unescape(o.host),s))),o.path&&(o.path=Zw(o.path)),o.fragment))try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}c&&c.parse&&c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function Xt(t,e){return Wf(t,e).parsed}function Bw(t,e){return Yf(t,e).normalized}function Yf(t,e){let{parsed:r,malformedAuthorityOrPort:o}=Wf(t,e);return{normalized:o?t:Rt(r,e),malformedAuthorityOrPort:o}}function Kf(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:o}=Yf(t,e);return o?void 0:r}if(typeof t=="object")return Rt(t,e)}var ra={SCHEMES:Uw,normalize:Fw,resolve:Vw,resolveComponent:Gf,equal:Hw,serialize:Rt,parse:Xt};fn.exports=ra;fn.exports.default=ra;fn.exports.fastUri=ra});var em=v(oa=>{"use strict";Object.defineProperty(oa,"__esModule",{value:!0});var Xf=Qf();Xf.code='require("ajv/dist/runtime/uri").default';oa.default=Xf});var cm=v(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.CodeGen=le.Name=le.nil=le.stringify=le.str=le._=le.KeywordCxt=void 0;var Gw=Yr();Object.defineProperty(le,"KeywordCxt",{enumerable:!0,get:function(){return Gw.KeywordCxt}});var er=N();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return er._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return er.str}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return er.stringify}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return er.nil}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return er.Name}});Object.defineProperty(le,"CodeGen",{enumerable:!0,get:function(){return er.CodeGen}});var Ww=cn(),sm=Qr(),Yw=Ri(),eo=ln(),Qw=N(),to=Br(),mn=Kr(),sa=M(),tm=Cf(),Xw=em(),im=(t,e)=>new RegExp(t,e);im.code="new RegExp";var e0=["removeAdditional","useDefaults","coerceTypes"],t0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),r0={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."},o0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},rm=200;function n0(t){var e,r,o,n,s,i,a,c,u,l,d,p,f,m,_,y,$,w,z,P,x,Se,Te,dr,Dn;let pr=t.strict,Ln=(e=t.code)===null||e===void 0?void 0:e.optimize,gc=Ln===!0||Ln===void 0?1:Ln||0,_c=(o=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:im,Eg=(n=t.uriResolver)!==null&&n!==void 0?n:Xw.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:pr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:pr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:pr)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:pr)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=t.strictRequired)!==null&&f!==void 0?f:pr)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:gc,regExp:_c}:{optimize:gc,regExp:_c},loopRequired:(_=t.loopRequired)!==null&&_!==void 0?_:rm,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:rm,meta:($=t.meta)!==null&&$!==void 0?$:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(z=t.inlineRefs)!==null&&z!==void 0?z:!0,schemaId:(P=t.schemaId)!==null&&P!==void 0?P:"$id",addUsedSchema:(x=t.addUsedSchema)!==null&&x!==void 0?x:!0,validateSchema:(Se=t.validateSchema)!==null&&Se!==void 0?Se:!0,validateFormats:(Te=t.validateFormats)!==null&&Te!==void 0?Te:!0,unicodeRegExp:(dr=t.unicodeRegExp)!==null&&dr!==void 0?dr:!0,int32range:(Dn=t.int32range)!==null&&Dn!==void 0?Dn:!0,uriResolver:Eg}}var ro=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...n0(e)};let{es5:r,lines:o}=this.opts.code;this.scope=new Qw.ValueScope({scope:{},prefixes:t0,es5:r,lines:o}),this.logger=l0(e.logger);let n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Yw.getRules)(),om.call(this,r0,e,"NOT SUPPORTED"),om.call(this,o0,e,"DEPRECATED","warn"),this._metaOpts=c0.call(this),e.formats&&i0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&a0.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),s0.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:o}=this.opts,n=tm;o==="id"&&(n={...tm},n.id=n.$id,delete n.$id),r&&e&&this.addMetaSchema(n,n[o],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let o;if(typeof e=="string"){if(o=this.getSchema(e),!o)throw new Error(`no schema with key or ref "${e}"`)}else o=this.compile(e);let n=o(r);return"$async"in o||(this.errors=o.errors),n}compile(e,r){let o=this._addSchema(e,r);return o.validate||this._compileSchemaEnv(o)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:o}=this.opts;return n.call(this,e,r);async function n(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await n.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof sm.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=o(l))}finally{delete this._loading[l]}}}addSchema(e,r,o,n=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,o,n);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,to.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,o,r,n,!0),this}addMetaSchema(e,r,o=this.opts.validateSchema){return this.addSchema(e,r,!0,o),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let o;if(o=e.$schema,o!==void 0&&typeof o!="string")throw new Error("$schema must be a string");if(o=o||this.opts.defaultMeta||this.defaultMeta(),!o)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let n=this.validate(o,e);if(!n&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return n}getSchema(e){let r;for(;typeof(r=nm.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:o}=this.opts,n=new eo.SchemaEnv({schema:{},schemaId:o});if(r=eo.resolveSchema.call(this,n,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=nm.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let o=e[this.opts.schemaId];return o&&(o=(0,to.normalizeId)(o),delete this.schemas[o],delete this.refs[o]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let o;if(typeof e=="string")o=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=o);else if(typeof e=="object"&&r===void 0){if(r=e,o=r.keyword,Array.isArray(o)&&!o.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(p0.call(this,o,r),!r)return(0,sa.eachItem)(o,s=>na.call(this,s)),this;m0.call(this,r);let n={...r,type:(0,mn.getJSONTypes)(r.type),schemaType:(0,mn.getJSONTypes)(r.schemaType)};return(0,sa.eachItem)(o,n.type.length===0?s=>na.call(this,s,n):s=>n.type.forEach(i=>na.call(this,s,n,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let o of r.rules){let n=o.rules.findIndex(s=>s.keyword===e);n>=0&&o.rules.splice(n,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:o="data"}={}){return!e||e.length===0?"No errors":e.map(n=>`${o}${n.instancePath} ${n.message}`).reduce((n,s)=>n+r+s)}$dataMetaSchema(e,r){let o=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let n of r){let s=n.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in o){let c=o[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=am(l))}}return e}_removeAllSchemas(e,r){for(let o in e){let n=e[o];(!r||r.test(o))&&(typeof n=="string"?delete e[o]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[o]))}}_addSchema(e,r,o,n=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;o=(0,to.normalizeId)(i||o);let u=to.getSchemaRefs.call(this,e,o);return c=new eo.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:o,localRefs:u}),this._cache.set(c.schema,c),s&&!o.startsWith("#")&&(o&&this._checkUnique(o),this.refs[o]=c),n&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):eo.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{eo.compileSchema.call(this,e)}finally{this.opts=r}}};ro.ValidationError=Ww.default;ro.MissingRefError=sm.default;le.default=ro;function om(t,e,r,o="error"){for(let n in t){let s=n;s in e&&this.logger[o](`${r}: option ${n}. ${t[s]}`)}}function nm(t){return t=(0,to.normalizeId)(t),this.schemas[t]||this.refs[t]}function s0(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function i0(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function a0(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function c0(){let t={...this.opts};for(let e of e0)delete t[e];return t}var u0={log(){},warn(){},error(){}};function l0(t){if(t===!1)return u0;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var d0=/^[a-z_$][a-z0-9_$:-]*$/i;function p0(t,e){let{RULES:r}=this;if((0,sa.eachItem)(t,o=>{if(r.keywords[o])throw new Error(`Keyword ${o} is already defined`);if(!d0.test(o))throw new Error(`Keyword ${o} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function na(t,e,r){var o;let n=e?.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=n?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,mn.getJSONTypes)(e.type),schemaType:(0,mn.getJSONTypes)(e.schemaType)}};e.before?f0.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(o=e.implements)===null||o===void 0||o.forEach(c=>this.addKeyword(c))}function f0(t,e,r){let o=t.rules.findIndex(n=>n.keyword===r);o>=0?t.rules.splice(o,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function m0(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=am(e)),t.validateSchema=this.compile(e,!0))}var h0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function am(t){return{anyOf:[t,h0]}}});var um=v(ia=>{"use strict";Object.defineProperty(ia,"__esModule",{value:!0});var g0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ia.default=g0});var fm=v(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.callRef=It.getValidate=void 0;var _0=Qr(),lm=Ae(),xe=N(),tr=rt(),dm=ln(),hn=M(),y0={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:o}=t,{baseId:n,schemaEnv:s,validateName:i,opts:a,self:c}=o,{root:u}=s;if((r==="#"||r==="#/")&&n===u.baseId)return d();let l=dm.resolveRef.call(c,u,n,r);if(l===void 0)throw new _0.default(o.opts.uriResolver,n,r);if(l instanceof dm.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return gn(t,i,s,s.$async);let m=e.scopeValue("root",{ref:u});return gn(t,(0,xe._)`${m}.validate`,u,u.$async)}function p(m){let _=pm(t,m);gn(t,_,m,m.$async)}function f(m){let _=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,xe.stringify)(m)}:{ref:m}),y=e.name("valid"),$=t.subschema({schema:m,dataTypes:[],schemaPath:xe.nil,topSchemaRef:_,errSchemaPath:r},y);t.mergeEvaluated($),t.ok(y)}}};function pm(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,xe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}It.getValidate=pm;function gn(t,e,r,o){let{gen:n,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?tr.default.this:xe.nil;o?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=n.let("valid");n.try(()=>{n.code((0,xe._)`await ${(0,lm.callValidateCode)(t,e,u)}`),f(e),i||n.assign(m,!0)},_=>{n.if((0,xe._)`!(${_} instanceof ${s.ValidationError})`,()=>n.throw(_)),p(_),i||n.assign(m,!1)}),t.ok(m)}function d(){t.result((0,lm.callValidateCode)(t,e,u),()=>f(e),()=>p(e))}function p(m){let _=(0,xe._)`${m}.errors`;n.assign(tr.default.vErrors,(0,xe._)`${tr.default.vErrors} === null ? ${_} : ${tr.default.vErrors}.concat(${_})`),n.assign(tr.default.errors,(0,xe._)`${tr.default.vErrors}.length`)}function f(m){var _;if(!s.opts.unevaluated)return;let y=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=hn.mergeEvaluated.props(n,y.props,s.props));else{let $=n.var("props",(0,xe._)`${m}.evaluated.props`);s.props=hn.mergeEvaluated.props(n,$,s.props,xe.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=hn.mergeEvaluated.items(n,y.items,s.items));else{let $=n.var("items",(0,xe._)`${m}.evaluated.items`);s.items=hn.mergeEvaluated.items(n,$,s.items,xe.Name)}}}It.callRef=gn;It.default=y0});var mm=v(aa=>{"use strict";Object.defineProperty(aa,"__esModule",{value:!0});var v0=um(),$0=fm(),b0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",v0.default,$0.default];aa.default=b0});var hm=v(ca=>{"use strict";Object.defineProperty(ca,"__esModule",{value:!0});var _n=N(),yt=_n.operators,yn={maximum:{okStr:"<=",ok:yt.LTE,fail:yt.GT},minimum:{okStr:">=",ok:yt.GTE,fail:yt.LT},exclusiveMaximum:{okStr:"<",ok:yt.LT,fail:yt.GTE},exclusiveMinimum:{okStr:">",ok:yt.GT,fail:yt.LTE}},w0={message:({keyword:t,schemaCode:e})=>(0,_n.str)`must be ${yn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,_n._)`{comparison: ${yn[t].okStr}, limit: ${e}}`},z0={keyword:Object.keys(yn),type:"number",schemaType:"number",$data:!0,error:w0,code(t){let{keyword:e,data:r,schemaCode:o}=t;t.fail$data((0,_n._)`${r} ${yn[e].fail} ${o} || isNaN(${r})`)}};ca.default=z0});var gm=v(ua=>{"use strict";Object.defineProperty(ua,"__esModule",{value:!0});var oo=N(),x0={message:({schemaCode:t})=>(0,oo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,oo._)`{multipleOf: ${t}}`},S0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:x0,code(t){let{gen:e,data:r,schemaCode:o,it:n}=t,s=n.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,oo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,oo._)`${i} !== parseInt(${i})`;t.fail$data((0,oo._)`(${o} === 0 || (${i} = ${r}/${o}, ${a}))`)}};ua.default=S0});var ym=v(la=>{"use strict";Object.defineProperty(la,"__esModule",{value:!0});function _m(t){let e=t.length,r=0,o=0,n;for(;o<e;)r++,n=t.charCodeAt(o++),n>=55296&&n<=56319&&o<e&&(n=t.charCodeAt(o),(n&64512)===56320&&o++);return r}la.default=_m;_m.code='require("ajv/dist/runtime/ucs2length").default'});var vm=v(da=>{"use strict";Object.defineProperty(da,"__esModule",{value:!0});var Nt=N(),k0=M(),P0=ym(),E0={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Nt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Nt._)`{limit: ${t}}`},T0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:E0,code(t){let{keyword:e,data:r,schemaCode:o,it:n}=t,s=e==="maxLength"?Nt.operators.GT:Nt.operators.LT,i=n.opts.unicode===!1?(0,Nt._)`${r}.length`:(0,Nt._)`${(0,k0.useFunc)(t.gen,P0.default)}(${r})`;t.fail$data((0,Nt._)`${i} ${s} ${o}`)}};da.default=T0});var $m=v(pa=>{"use strict";Object.defineProperty(pa,"__esModule",{value:!0});var O0=Ae(),R0=M(),rr=N(),I0={message:({schemaCode:t})=>(0,rr.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,rr._)`{pattern: ${t}}`},N0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:I0,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,rr._)`new RegExp`:(0,R0.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,rr._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,rr._)`!${l}`)}else{let c=(0,O0.usePattern)(t,n);t.fail$data((0,rr._)`!${c}.test(${r})`)}}};pa.default=N0});var bm=v(fa=>{"use strict";Object.defineProperty(fa,"__esModule",{value:!0});var no=N(),A0={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,no.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,no._)`{limit: ${t}}`},C0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:A0,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxProperties"?no.operators.GT:no.operators.LT;t.fail$data((0,no._)`Object.keys(${r}).length ${n} ${o}`)}};fa.default=C0});var wm=v(ma=>{"use strict";Object.defineProperty(ma,"__esModule",{value:!0});var so=Ae(),io=N(),j0=M(),Z0={message:({params:{missingProperty:t}})=>(0,io.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,io._)`{missingProperty: ${t}}`},q0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Z0,code(t){let{gen:e,schema:r,schemaCode:o,data:n,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:m}=t.it;for(let _ of r)if(f?.[_]===void 0&&!m.has(_)){let y=i.schemaEnv.baseId+i.errSchemaPath,$=`required property "${_}" is not defined at "${y}" (strictRequired)`;(0,j0.checkStrictMode)(i,$,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(io.nil,d);else for(let f of r)(0,so.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>p(f,m)),t.ok(m)}else e.if((0,so.checkMissingProp)(t,r,f)),(0,so.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",o,f=>{t.setParams({missingProperty:f}),e.if((0,so.noPropertyInData)(e,n,f,a.ownProperties),()=>t.error())})}function p(f,m){t.setParams({missingProperty:f}),e.forOf(f,o,()=>{e.assign(m,(0,so.propertyInData)(e,n,f,a.ownProperties)),e.if((0,io.not)(m),()=>{t.error(),e.break()})},io.nil)}}};ma.default=q0});var zm=v(ha=>{"use strict";Object.defineProperty(ha,"__esModule",{value:!0});var ao=N(),M0={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,ao.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,ao._)`{limit: ${t}}`},D0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:M0,code(t){let{keyword:e,data:r,schemaCode:o}=t,n=e==="maxItems"?ao.operators.GT:ao.operators.LT;t.fail$data((0,ao._)`${r}.length ${n} ${o}`)}};ha.default=D0});var vn=v(ga=>{"use strict";Object.defineProperty(ga,"__esModule",{value:!0});var xm=Mi();xm.code='require("ajv/dist/runtime/equal").default';ga.default=xm});var Sm=v(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var _a=Kr(),de=N(),L0=M(),U0=vn(),F0={message:({params:{i:t,j:e}})=>(0,de.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,de._)`{i: ${t}, j: ${e}}`},V0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:F0,code(t){let{gen:e,data:r,$data:o,schema:n,parentSchema:s,schemaCode:i,it:a}=t;if(!o&&!n)return;let c=e.let("valid"),u=s.items?(0,_a.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,de._)`${i} === false`),t.ok(c);function l(){let m=e.let("i",(0,de._)`${r}.length`),_=e.let("j");t.setParams({i:m,j:_}),e.assign(c,!0),e.if((0,de._)`${m} > 1`,()=>(d()?p:f)(m,_))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,_){let y=e.name("item"),$=(0,_a.checkDataTypes)(u,y,a.opts.strictNumbers,_a.DataType.Wrong),w=e.const("indices",(0,de._)`{}`);e.for((0,de._)`;${m}--;`,()=>{e.let(y,(0,de._)`${r}[${m}]`),e.if($,(0,de._)`continue`),u.length>1&&e.if((0,de._)`typeof ${y} == "string"`,(0,de._)`${y} += "_"`),e.if((0,de._)`typeof ${w}[${y}] == "number"`,()=>{e.assign(_,(0,de._)`${w}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,de._)`${w}[${y}] = ${m}`)})}function f(m,_){let y=(0,L0.useFunc)(e,U0.default),$=e.name("outer");e.label($).for((0,de._)`;${m}--;`,()=>e.for((0,de._)`${_} = ${m}; ${_}--;`,()=>e.if((0,de._)`${y}(${r}[${m}], ${r}[${_}])`,()=>{t.error(),e.assign(c,!1).break($)})))}}};ya.default=V0});var km=v($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var va=N(),H0=M(),J0=vn(),K0={message:"must be equal to constant",params:({schemaCode:t})=>(0,va._)`{allowedValue: ${t}}`},B0={keyword:"const",$data:!0,error:K0,code(t){let{gen:e,data:r,$data:o,schemaCode:n,schema:s}=t;o||s&&typeof s=="object"?t.fail$data((0,va._)`!${(0,H0.useFunc)(e,J0.default)}(${r}, ${n})`):t.fail((0,va._)`${s} !== ${r}`)}};$a.default=B0});var Pm=v(ba=>{"use strict";Object.defineProperty(ba,"__esModule",{value:!0});var co=N(),G0=M(),W0=vn(),Y0={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,co._)`{allowedValues: ${t}}`},Q0={keyword:"enum",schemaType:"array",$data:!0,error:Y0,code(t){let{gen:e,data:r,$data:o,schema:n,schemaCode:s,it:i}=t;if(!o&&n.length===0)throw new Error("enum must have non-empty array");let a=n.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,G0.useFunc)(e,W0.default)),l;if(a||o)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(n))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,co.or)(...n.map((m,_)=>p(f,_)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,co._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function p(f,m){let _=n[m];return typeof _=="object"&&_!==null?(0,co._)`${u()}(${r}, ${f}[${m}])`:(0,co._)`${r} === ${_}`}}};ba.default=Q0});var Em=v(wa=>{"use strict";Object.defineProperty(wa,"__esModule",{value:!0});var X0=hm(),ez=gm(),tz=vm(),rz=$m(),oz=bm(),nz=wm(),sz=zm(),iz=Sm(),az=km(),cz=Pm(),uz=[X0.default,ez.default,tz.default,rz.default,oz.default,nz.default,sz.default,iz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},az.default,cz.default];wa.default=uz});var xa=v(uo=>{"use strict";Object.defineProperty(uo,"__esModule",{value:!0});uo.validateAdditionalItems=void 0;var At=N(),za=M(),lz={message:({params:{len:t}})=>(0,At.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,At._)`{limit: ${t}}`},dz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:lz,code(t){let{parentSchema:e,it:r}=t,{items:o}=e;if(!Array.isArray(o)){(0,za.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Tm(t,o)}};function Tm(t,e){let{gen:r,schema:o,data:n,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,At._)`${n}.length`);if(o===!1)t.setParams({len:e.length}),t.pass((0,At._)`${a} <= ${e.length}`);else if(typeof o=="object"&&!(0,za.alwaysValidSchema)(i,o)){let u=r.var("valid",(0,At._)`${a} <= ${e.length}`);r.if((0,At.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:za.Type.Num},u),i.allErrors||r.if((0,At.not)(u),()=>r.break())})}}uo.validateAdditionalItems=Tm;uo.default=dz});var Sa=v(lo=>{"use strict";Object.defineProperty(lo,"__esModule",{value:!0});lo.validateTuple=void 0;var Om=N(),$n=M(),pz=Ae(),fz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Rm(t,"additionalItems",e);r.items=!0,!(0,$n.alwaysValidSchema)(r,e)&&t.ok((0,pz.validateArray)(t))}};function Rm(t,e,r=t.schema){let{gen:o,parentSchema:n,data:s,keyword:i,it:a}=t;l(n),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=$n.mergeEvaluated.items(o,r.length,a.items));let c=o.name("valid"),u=o.const("len",(0,Om._)`${s}.length`);r.forEach((d,p)=>{(0,$n.alwaysValidSchema)(a,d)||(o.if((0,Om._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=a,m=r.length,_=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(p.strictTuples&&!_){let y=`"${i}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,$n.checkStrictMode)(a,y,p.strictTuples)}}}lo.validateTuple=Rm;lo.default=fz});var Im=v(ka=>{"use strict";Object.defineProperty(ka,"__esModule",{value:!0});var mz=Sa(),hz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,mz.validateTuple)(t,"items")};ka.default=hz});var Am=v(Pa=>{"use strict";Object.defineProperty(Pa,"__esModule",{value:!0});var Nm=N(),gz=M(),_z=Ae(),yz=xa(),vz={message:({params:{len:t}})=>(0,Nm.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Nm._)`{limit: ${t}}`},$z={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:vz,code(t){let{schema:e,parentSchema:r,it:o}=t,{prefixItems:n}=r;o.items=!0,!(0,gz.alwaysValidSchema)(o,e)&&(n?(0,yz.validateAdditionalItems)(t,n):t.ok((0,_z.validateArray)(t)))}};Pa.default=$z});var Cm=v(Ea=>{"use strict";Object.defineProperty(Ea,"__esModule",{value:!0});var je=N(),bn=M(),bz={message:({params:{min:t,max:e}})=>e===void 0?(0,je.str)`must contain at least ${t} valid item(s)`:(0,je.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,je._)`{minContains: ${t}}`:(0,je._)`{minContains: ${t}, maxContains: ${e}}`},wz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:bz,code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t,i,a,{minContains:c,maxContains:u}=o;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,je._)`${n}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,bn.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,bn.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,bn.alwaysValidSchema)(s,r)){let _=(0,je._)`${l} >= ${i}`;a!==void 0&&(_=(0,je._)`${_} && ${l} <= ${a}`),t.pass(_);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,je._)`${n}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let _=e.name("_valid"),y=e.let("count",0);f(_,()=>e.if(_,()=>m(y)))}function f(_,y){e.forRange("i",0,l,$=>{t.subschema({keyword:"contains",dataProp:$,dataPropType:bn.Type.Num,compositeRule:!0},_),y()})}function m(_){e.code((0,je._)`${_}++`),a===void 0?e.if((0,je._)`${_} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,je._)`${_} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,je._)`${_} >= ${i}`,()=>e.assign(d,!0)))}}};Ea.default=wz});var qm=v(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.validateSchemaDeps=Ke.validatePropertyDeps=Ke.error=void 0;var Ta=N(),zz=M(),po=Ae();Ke.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let o=e===1?"property":"properties";return(0,Ta.str)`must have ${o} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:o}})=>(0,Ta._)`{property: ${t},
6
+ missingProperty: ${o},
7
+ depsCount: ${e},
8
+ deps: ${r}}`};var xz={keyword:"dependencies",type:"object",schemaType:"object",error:Ke.error,code(t){let[e,r]=Sz(t);jm(t,e),Zm(t,r)}};function Sz({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function jm(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,po.propertyInData)(r,o,i,n.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(c,()=>{for(let u of a)(0,po.checkReportMissingProp)(t,u)}):(r.if((0,Ta._)`${c} && (${(0,po.checkMissingProp)(t,a,s)})`),(0,po.reportMissingProp)(t,s),r.else())}}Ke.validatePropertyDeps=jm;function Zm(t,e=t.schema){let{gen:r,data:o,keyword:n,it:s}=t,i=r.name("valid");for(let a in e)(0,zz.alwaysValidSchema)(s,e[a])||(r.if((0,po.propertyInData)(r,o,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:n,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Ke.validateSchemaDeps=Zm;Ke.default=xz});var Dm=v(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Mm=N(),kz=M(),Pz={message:"property name must be valid",params:({params:t})=>(0,Mm._)`{propertyName: ${t.propertyName}}`},Ez={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Pz,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,kz.alwaysValidSchema)(n,r))return;let s=e.name("valid");e.forIn("key",o,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,Mm.not)(s),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(s)}};Oa.default=Ez});var Ia=v(Ra=>{"use strict";Object.defineProperty(Ra,"__esModule",{value:!0});var wn=Ae(),Ue=N(),Tz=rt(),zn=M(),Oz={message:"must NOT have additional properties",params:({params:t})=>(0,Ue._)`{additionalProperty: ${t.additionalProperty}}`},Rz={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Oz,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,zn.alwaysValidSchema)(i,r))return;let u=(0,wn.allSchemaProperties)(o.properties),l=(0,wn.allSchemaProperties)(o.patternProperties);d(),t.ok((0,Ue._)`${s} === ${Tz.default.errors}`);function d(){e.forIn("key",n,y=>{!u.length&&!l.length?m(y):e.if(p(y),()=>m(y))})}function p(y){let $;if(u.length>8){let w=(0,zn.schemaRefOrVal)(i,o.properties,"properties");$=(0,wn.isOwnProperty)(e,w,y)}else u.length?$=(0,Ue.or)(...u.map(w=>(0,Ue._)`${y} === ${w}`)):$=Ue.nil;return l.length&&($=(0,Ue.or)($,...l.map(w=>(0,Ue._)`${(0,wn.usePattern)(t,w)}.test(${y})`))),(0,Ue.not)($)}function f(y){e.code((0,Ue._)`delete ${n}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,zn.alwaysValidSchema)(i,r)){let $=e.name("valid");c.removeAdditional==="failing"?(_(y,$,!1),e.if((0,Ue.not)($),()=>{t.reset(),f(y)})):(_(y,$),a||e.if((0,Ue.not)($),()=>e.break()))}}function _(y,$,w){let z={keyword:"additionalProperties",dataProp:y,dataPropType:zn.Type.Str};w===!1&&Object.assign(z,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(z,$)}}};Ra.default=Rz});var Fm=v(Aa=>{"use strict";Object.defineProperty(Aa,"__esModule",{value:!0});var Iz=Yr(),Lm=Ae(),Na=M(),Um=Ia(),Nz={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:s}=t;s.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&Um.default.code(new Iz.KeywordCxt(s,Um.default,"additionalProperties"));let i=(0,Lm.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=Na.mergeEvaluated.props(e,(0,Na.toHash)(i),s.props));let a=i.filter(d=>!(0,Na.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Lm.propertyInData)(e,n,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Aa.default=Nz});var Km=v(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});var Vm=Ae(),xn=N(),Hm=M(),Jm=M(),Az={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:s}=t,{opts:i}=s,a=(0,Vm.allSchemaProperties)(r),c=a.filter(_=>(0,Hm.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&n.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof xn.Name)&&(s.props=(0,Jm.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let _ of a)u&&f(_),s.allErrors?m(_):(e.var(l,!0),m(_),e.if(l))}function f(_){for(let y in u)new RegExp(_).test(y)&&(0,Hm.checkStrictMode)(s,`property ${y} matches pattern ${_} (use allowMatchingProperties)`)}function m(_){e.forIn("key",o,y=>{e.if((0,xn._)`${(0,Vm.usePattern)(t,_)}.test(${y})`,()=>{let $=c.includes(_);$||t.subschema({keyword:"patternProperties",schemaProp:_,dataProp:y,dataPropType:Jm.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,xn._)`${d}[${y}]`,!0):!$&&!s.allErrors&&e.if((0,xn.not)(l),()=>e.break())})})}}};Ca.default=Az});var Bm=v(ja=>{"use strict";Object.defineProperty(ja,"__esModule",{value:!0});var Cz=M(),jz={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,Cz.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};ja.default=jz});var Gm=v(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var Zz=Ae(),qz={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Zz.validateUnion,error:{message:"must match a schema in anyOf"}};Za.default=qz});var Wm=v(qa=>{"use strict";Object.defineProperty(qa,"__esModule",{value:!0});var Sn=N(),Mz=M(),Dz={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Sn._)`{passingSchemas: ${t.passing}}`},Lz={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Dz,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let p;(0,Mz.alwaysValidSchema)(n,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Sn._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Sn._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),p&&t.mergeEvaluated(p,Sn.Name)})})}}};qa.default=Lz});var Ym=v(Ma=>{"use strict";Object.defineProperty(Ma,"__esModule",{value:!0});var Uz=M(),Fz={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((s,i)=>{if((0,Uz.alwaysValidSchema)(o,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},n);t.ok(n),t.mergeEvaluated(a)})}};Ma.default=Fz});var eh=v(Da=>{"use strict";Object.defineProperty(Da,"__esModule",{value:!0});var kn=N(),Xm=M(),Vz={message:({params:t})=>(0,kn.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,kn._)`{failingKeyword: ${t.ifClause}}`},Hz={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Vz,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,Xm.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=Qm(o,"then"),s=Qm(o,"else");if(!n&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),n&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else n?e.if(a,u("then")):e.if((0,kn.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0,kn._)`${l}`):t.setParams({ifClause:l})}}}};function Qm(t,e){let r=t.schema[e];return r!==void 0&&!(0,Xm.alwaysValidSchema)(t,r)}Da.default=Hz});var th=v(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var Jz=M(),Kz={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Jz.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};La.default=Kz});var rh=v(Ua=>{"use strict";Object.defineProperty(Ua,"__esModule",{value:!0});var Bz=xa(),Gz=Im(),Wz=Sa(),Yz=Am(),Qz=Cm(),Xz=qm(),ex=Dm(),tx=Ia(),rx=Fm(),ox=Km(),nx=Bm(),sx=Gm(),ix=Wm(),ax=Ym(),cx=eh(),ux=th();function lx(t=!1){let e=[nx.default,sx.default,ix.default,ax.default,cx.default,ux.default,ex.default,tx.default,Xz.default,rx.default,ox.default];return t?e.push(Gz.default,Yz.default):e.push(Bz.default,Wz.default),e.push(Qz.default),e}Ua.default=lx});var oh=v(Fa=>{"use strict";Object.defineProperty(Fa,"__esModule",{value:!0});var oe=N(),dx={message:({schemaCode:t})=>(0,oe.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,oe._)`{format: ${t}}`},px={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:dx,code(t,e){let{gen:r,data:o,$data:n,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;n?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),_=r.const("fDef",(0,oe._)`${m}[${i}]`),y=r.let("fType"),$=r.let("format");r.if((0,oe._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(y,(0,oe._)`${_}.type || "string"`).assign($,(0,oe._)`${_}.validate`),()=>r.assign(y,(0,oe._)`"string"`).assign($,_)),t.fail$data((0,oe.or)(w(),z()));function w(){return c.strictSchema===!1?oe.nil:(0,oe._)`${i} && !${$}`}function z(){let P=l.$async?(0,oe._)`(${_}.async ? await ${$}(${o}) : ${$}(${o}))`:(0,oe._)`${$}(${o})`,x=(0,oe._)`(typeof ${$} == "function" ? ${P} : ${$}.test(${o}))`;return(0,oe._)`${$} && ${$} !== true && ${y} === ${e} && !${x}`}}function f(){let m=d.formats[s];if(!m){w();return}if(m===!0)return;let[_,y,$]=z(m);_===e&&t.pass(P());function w(){if(c.strictSchema===!1){d.logger.warn(x());return}throw new Error(x());function x(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function z(x){let Se=x instanceof RegExp?(0,oe.regexpCode)(x):c.code.formats?(0,oe._)`${c.code.formats}${(0,oe.getProperty)(s)}`:void 0,Te=r.scopeValue("formats",{key:s,ref:x,code:Se});return typeof x=="object"&&!(x instanceof RegExp)?[x.type||"string",x.validate,(0,oe._)`${Te}.validate`]:["string",x,Te]}function P(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,oe._)`await ${$}(${o})`}return typeof y=="function"?(0,oe._)`${$}(${o})`:(0,oe._)`${$}.test(${o})`}}}};Fa.default=px});var nh=v(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});var fx=oh(),mx=[fx.default];Va.default=mx});var sh=v(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.contentVocabulary=or.metadataVocabulary=void 0;or.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];or.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var ah=v(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});var hx=mm(),gx=Em(),_x=rh(),yx=nh(),ih=sh(),vx=[hx.default,gx.default,(0,_x.default)(),yx.default,ih.metadataVocabulary,ih.contentVocabulary];Ha.default=vx});var uh=v(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.DiscrError=void 0;var ch;(function(t){t.Tag="tag",t.Mapping="mapping"})(ch||(Pn.DiscrError=ch={}))});var dh=v(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var nr=N(),Ja=uh(),lh=ln(),$x=Qr(),bx=M(),wx={message:({params:{discrError:t,tagName:e}})=>t===Ja.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,nr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},zx={keyword:"discriminator",type:"object",schemaType:"object",error:wx,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:s}=t,{oneOf:i}=n;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,nr._)`${r}${(0,nr.getProperty)(a)}`);e.if((0,nr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Ja.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=p();e.if(!1);for(let m in f)e.elseIf((0,nr._)`${u} === ${m}`),e.assign(c,d(f[m]));e.else(),t.error(!1,{discrError:Ja.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let m=e.name("valid"),_=t.subschema({keyword:"oneOf",schemaProp:f},m);return t.mergeEvaluated(_,nr.Name),m}function p(){var f;let m={},_=$(n),y=!0;for(let P=0;P<i.length;P++){let x=i[P];if(x?.$ref&&!(0,bx.schemaHasRulesButRef)(x,s.self.RULES)){let Te=x.$ref;if(x=lh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Te),x instanceof lh.SchemaEnv&&(x=x.schema),x===void 0)throw new $x.default(s.opts.uriResolver,s.baseId,Te)}let Se=(f=x?.properties)===null||f===void 0?void 0:f[a];if(typeof Se!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(_||$(x)),w(Se,P)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return m;function $({required:P}){return Array.isArray(P)&&P.includes(a)}function w(P,x){if(P.const)z(P.const,x);else if(P.enum)for(let Se of P.enum)z(Se,x);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function z(P,x){if(typeof P!="string"||P in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[P]=x}}}};Ka.default=zx});var ph=v((e1,xx)=>{xx.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 Ga=v((Y,Ba)=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.MissingRefError=Y.ValidationError=Y.CodeGen=Y.Name=Y.nil=Y.stringify=Y.str=Y._=Y.KeywordCxt=Y.Ajv=void 0;var Sx=cm(),kx=ah(),Px=dh(),fh=ph(),Ex=["/properties"],En="http://json-schema.org/draft-07/schema",sr=class extends Sx.default{_addVocabularies(){super._addVocabularies(),kx.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(Px.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(fh,Ex):fh;this.addMetaSchema(e,En,!1),this.refs["http://json-schema.org/schema"]=En}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(En)?En:void 0)}};Y.Ajv=sr;Ba.exports=Y=sr;Ba.exports.Ajv=sr;Object.defineProperty(Y,"__esModule",{value:!0});Y.default=sr;var Tx=Yr();Object.defineProperty(Y,"KeywordCxt",{enumerable:!0,get:function(){return Tx.KeywordCxt}});var ir=N();Object.defineProperty(Y,"_",{enumerable:!0,get:function(){return ir._}});Object.defineProperty(Y,"str",{enumerable:!0,get:function(){return ir.str}});Object.defineProperty(Y,"stringify",{enumerable:!0,get:function(){return ir.stringify}});Object.defineProperty(Y,"nil",{enumerable:!0,get:function(){return ir.nil}});Object.defineProperty(Y,"Name",{enumerable:!0,get:function(){return ir.Name}});Object.defineProperty(Y,"CodeGen",{enumerable:!0,get:function(){return ir.CodeGen}});var Ox=cn();Object.defineProperty(Y,"ValidationError",{enumerable:!0,get:function(){return Ox.default}});var Rx=Qr();Object.defineProperty(Y,"MissingRefError",{enumerable:!0,get:function(){return Rx.default}})});var bh=v(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.formatNames=Ge.fastFormats=Ge.fullFormats=void 0;function Be(t,e){return{validate:t,compare:e}}Ge.fullFormats={date:Be(_h,Xa),time:Be(Ya(!0),ec),"date-time":Be(mh(!0),vh),"iso-time":Be(Ya(),yh),"iso-date-time":Be(mh(),$h),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Zx,"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:Vx,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:qx,int32:{type:"number",validate:Lx},int64:{type:"number",validate:Ux},float:{type:"number",validate:gh},double:{type:"number",validate:gh},password:!0,binary:!0};Ge.fastFormats={...Ge.fullFormats,date:Be(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Xa),time:Be(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,ec),"date-time":Be(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,vh),"iso-time":Be(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,yh),"iso-date-time":Be(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,$h),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};Ge.formatNames=Object.keys(Ge.fullFormats);function Ix(t){return t%4===0&&(t%100!==0||t%400===0)}var Nx=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Ax=[0,31,28,31,30,31,30,31,31,30,31,30,31];function _h(t){let e=Nx.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&Ix(r)?29:Ax[o])}function Xa(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Wa=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Ya(t){return function(r){let o=Wa.exec(r);if(!o)return!1;let n=+o[1],s=+o[2],i=+o[3],a=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),l=+(o[7]||0);if(u>23||l>59||t&&!a)return!1;if(n<=23&&s<=59&&i<60)return!0;let d=s-l*c,p=n-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&i<61}}function ec(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function yh(t,e){if(!(t&&e))return;let r=Wa.exec(t),o=Wa.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var Qa=/t|\s/i;function mh(t){let e=Ya(t);return function(o){let n=o.split(Qa);return n.length===2&&_h(n[0])&&e(n[1])}}function vh(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function $h(t,e){if(!(t&&e))return;let[r,o]=t.split(Qa),[n,s]=e.split(Qa),i=Xa(r,n);if(i!==void 0)return i||ec(o,s)}var Cx=/\/|:/,jx=/^(?:[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 Zx(t){return Cx.test(t)&&jx.test(t)}var hh=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function qx(t){return hh.lastIndex=0,hh.test(t)}var Mx=-(2**31),Dx=2**31-1;function Lx(t){return Number.isInteger(t)&&t<=Dx&&t>=Mx}function Ux(t){return Number.isInteger(t)}function gh(){return!0}var Fx=/[^\\]\\Z/;function Vx(t){if(Fx.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var wh=v(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.formatLimitDefinition=void 0;var Hx=Ga(),Fe=N(),vt=Fe.operators,Tn={formatMaximum:{okStr:"<=",ok:vt.LTE,fail:vt.GT},formatMinimum:{okStr:">=",ok:vt.GTE,fail:vt.LT},formatExclusiveMaximum:{okStr:"<",ok:vt.LT,fail:vt.GTE},formatExclusiveMinimum:{okStr:">",ok:vt.GT,fail:vt.LTE}},Jx={message:({keyword:t,schemaCode:e})=>(0,Fe.str)`should be ${Tn[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Fe._)`{comparison: ${Tn[t].okStr}, limit: ${e}}`};ar.formatLimitDefinition={keyword:Object.keys(Tn),type:"string",schemaType:"string",$data:!0,error:Jx,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new Hx.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Fe._)`${p}[${c.schemaCode}]`);t.fail$data((0,Fe.or)((0,Fe._)`typeof ${f} != "object"`,(0,Fe._)`${f} instanceof RegExp`,(0,Fe._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${n}": format "${p}" does not define "compare" function`);let m=e.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0,Fe._)`${i.code.formats}${(0,Fe.getProperty)(p)}`:void 0});t.fail$data(d(m))}function d(p){return(0,Fe._)`${p}.compare(${r}, ${o}) ${Tn[n].fail} 0`}},dependencies:["format"]};var Kx=t=>(t.addKeyword(ar.formatLimitDefinition),t);ar.default=Kx});var kh=v((fo,Sh)=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});var cr=bh(),Bx=wh(),tc=N(),zh=new tc.Name("fullFormats"),Gx=new tc.Name("fastFormats"),rc=(t,e={keywords:!0})=>{if(Array.isArray(e))return xh(t,e,cr.fullFormats,zh),t;let[r,o]=e.mode==="fast"?[cr.fastFormats,Gx]:[cr.fullFormats,zh],n=e.formats||cr.formatNames;return xh(t,n,r,o),e.keywords&&(0,Bx.default)(t),t};rc.get=(t,e="full")=>{let o=(e==="fast"?cr.fastFormats:cr.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function xh(t,e,r,o){var n,s;(n=(s=t.opts.code).formats)!==null&&n!==void 0||(s.formats=(0,tc._)`require("ajv-formats/dist/formats").${o}`);for(let i of e)t.addFormat(i,r[i])}Sh.exports=fo=rc;Object.defineProperty(fo,"__esModule",{value:!0});fo.default=rc});var Ch=v((m1,Ah)=>{"use strict";Ah.exports=Nh;Nh.sync=Xx;var Rh=require("fs");function Qx(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var o=0;o<r.length;o++){var n=r[o].toLowerCase();if(n&&t.substr(-n.length).toLowerCase()===n)return!0}return!1}function Ih(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Qx(e,r)}function Nh(t,e,r){Rh.stat(t,function(o,n){r(o,o?!1:Ih(n,t,e))})}function Xx(t,e){return Ih(Rh.statSync(t),t,e)}});var Dh=v((h1,Mh)=>{"use strict";Mh.exports=Zh;Zh.sync=eS;var jh=require("fs");function Zh(t,e,r){jh.stat(t,function(o,n){r(o,o?!1:qh(n,e))})}function eS(t,e){return qh(jh.statSync(t),e)}function qh(t,e){return t.isFile()&&tS(t,e)}function tS(t,e){var r=t.mode,o=t.uid,n=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),i=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,d=r&u||r&c&&n===i||r&a&&o===s||r&l&&s===0;return d}});var Uh=v((_1,Lh)=>{"use strict";var g1=require("fs"),An;process.platform==="win32"||global.TESTING_WINDOWS?An=Ch():An=Dh();Lh.exports=oc;oc.sync=rS;function oc(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(o,n){oc(t,e||{},function(s,i){s?n(s):o(i)})})}An(t,e||{},function(o,n){o&&(o.code==="EACCES"||e&&e.ignoreErrors)&&(o=null,n=!1),r(o,n)})}function rS(t,e){try{return An.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var Gh=v((y1,Bh)=>{"use strict";var ur=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Fh=require("path"),oS=ur?";":":",Vh=Uh(),Hh=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),Jh=(t,e)=>{let r=e.colon||oS,o=t.match(/\//)||ur&&t.match(/\\/)?[""]:[...ur?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],n=ur?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=ur?n.split(r):[""];return ur&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:o,pathExt:s,pathExtExe:n}},Kh=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:o,pathExt:n,pathExtExe:s}=Jh(t,e),i=[],a=u=>new Promise((l,d)=>{if(u===o.length)return e.all&&i.length?l(i):d(Hh(t));let p=o[u],f=/^".*"$/.test(p)?p.slice(1,-1):p,m=Fh.join(f,t),_=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+m:m;l(c(_,u,0))}),c=(u,l,d)=>new Promise((p,f)=>{if(d===n.length)return p(a(l+1));let m=n[d];Vh(u+m,{pathExt:s},(_,y)=>{if(!_&&y)if(e.all)i.push(u+m);else return p(u+m);return p(c(u,l,d+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},nS=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:o,pathExtExe:n}=Jh(t,e),s=[];for(let i=0;i<r.length;i++){let a=r[i],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=Fh.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<o.length;d++){let p=l+o[d];try{if(Vh.sync(p,{pathExt:n}))if(e.all)s.push(p);else return p}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw Hh(t)};Bh.exports=Kh;Kh.sync=nS});var Yh=v((v1,nc)=>{"use strict";var Wh=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(o=>o.toUpperCase()==="PATH")||"Path"};nc.exports=Wh;nc.exports.default=Wh});var tg=v(($1,eg)=>{"use strict";var Qh=require("path"),sS=Gh(),iS=Yh();function Xh(t,e){let r=t.options.env||process.env,o=process.cwd(),n=t.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let i;try{i=sS.sync(t.command,{path:r[iS({env:r})],pathExt:e?Qh.delimiter:void 0})}catch{}finally{s&&process.chdir(o)}return i&&(i=Qh.resolve(n?t.options.cwd:"",i)),i}function aS(t){return Xh(t)||Xh(t,!0)}eg.exports=aS});var rg=v((b1,ic)=>{"use strict";var sc=/([()\][%!^"`<>&|;, *?])/g;function cS(t){return t=t.replace(sc,"^$1"),t}function uS(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(sc,"^$1"),e&&(t=t.replace(sc,"^$1")),t}ic.exports.command=cS;ic.exports.argument=uS});var ng=v((w1,og)=>{"use strict";og.exports=/^#!(.*)/});var ig=v((z1,sg)=>{"use strict";var lS=ng();sg.exports=(t="")=>{let e=t.match(lS);if(!e)return null;let[r,o]=e[0].replace(/#! ?/,"").split(" "),n=r.split("/").pop();return n==="env"?o:o?`${n} ${o}`:n}});var cg=v((x1,ag)=>{"use strict";var ac=require("fs"),dS=ig();function pS(t){let r=Buffer.alloc(150),o;try{o=ac.openSync(t,"r"),ac.readSync(o,r,0,150,0),ac.closeSync(o)}catch{}return dS(r.toString())}ag.exports=pS});var pg=v((S1,dg)=>{"use strict";var fS=require("path"),ug=tg(),lg=rg(),mS=cg(),hS=process.platform==="win32",gS=/\.(?:com|exe)$/i,_S=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function yS(t){t.file=ug(t);let e=t.file&&mS(t.file);return e?(t.args.unshift(t.file),t.command=e,ug(t)):t.file}function vS(t){if(!hS)return t;let e=yS(t),r=!gS.test(e);if(t.options.forceShell||r){let o=_S.test(e);t.command=fS.normalize(t.command),t.command=lg.command(t.command),t.args=t.args.map(s=>lg.argument(s,o));let n=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${n}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function $S(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let o={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?o:vS(o)}dg.exports=$S});var hg=v((k1,mg)=>{"use strict";var cc=process.platform==="win32";function uc(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function bS(t,e){if(!cc)return;let r=t.emit;t.emit=function(o,n){if(o==="exit"){let s=fg(n,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function fg(t,e){return cc&&t===1&&!e.file?uc(e.original,"spawn"):null}function wS(t,e){return cc&&t===1&&!e.file?uc(e.original,"spawnSync"):null}mg.exports={hookChildProcess:bS,verifyENOENT:fg,verifyENOENTSync:wS,notFoundError:uc}});var yg=v((P1,lr)=>{"use strict";var gg=require("child_process"),lc=pg(),dc=hg();function _g(t,e,r){let o=lc(t,e,r),n=gg.spawn(o.command,o.args,o.options);return dc.hookChildProcess(n,o),n}function zS(t,e,r){let o=lc(t,e,r),n=gg.spawnSync(o.command,o.args,o.options);return n.error=n.error||dc.verifyENOENTSync(n.status,o),n}lr.exports=_g;lr.exports.spawn=_g;lr.exports.sync=zS;lr.exports._parse=lc;lr.exports._enoent=dc});var AS={};Un(AS,{activate:()=>IS,deactivate:()=>NS});module.exports=Ag(AS);var Mn=require("fs"),st=require("fs/promises"),Pg=require("os"),nt=require("path");var vc;function g(t,e,r){function o(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=i.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in a||(a[p]=u[p].bind(a))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;o(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var Ve=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ct=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(vc=globalThis).__zod_globalConfig??(vc.__zod_globalConfig={});var jt=globalThis.__zod_globalConfig;function ke(t){return t&&Object.assign(jt,t),jt}var q={};Un(q,{BIGINT_FORMAT_RANGES:()=>zc,Class:()=>Vn,NUMBER_FORMAT_RANGES:()=>Wn,aborted:()=>ct,allowsEval:()=>Kn,assert:()=>Mg,assertEqual:()=>Cg,assertIs:()=>Zg,assertNever:()=>qg,assertNotEqual:()=>jg,assignProp:()=>it,base64ToUint8Array:()=>Sc,base64urlToUint8Array:()=>r_,cached:()=>qt,captureStackTrace:()=>_o,cleanEnum:()=>t_,cleanRegex:()=>_r,clone:()=>Ze,cloneDef:()=>Lg,createTransparentProxy:()=>Kg,defineLazy:()=>U,esc:()=>go,escapeRegex:()=>Ye,explicitlyAborted:()=>Yn,extend:()=>Wg,finalizeIssue:()=>Oe,floatSafeRemainder:()=>Hn,getElementAtPath:()=>Ug,getEnumValues:()=>hr,getLengthableOrigin:()=>yr,getParsedType:()=>Jg,getSizableOrigin:()=>xc,hexToUint8Array:()=>n_,isObject:()=>$t,isPlainObject:()=>at,issue:()=>Mt,joinValues:()=>ho,jsonStringifyReplacer:()=>Zt,merge:()=>Qg,mergeDefs:()=>We,normalizeParams:()=>T,nullish:()=>gr,numKeys:()=>Hg,objectClone:()=>Dg,omit:()=>Gg,optionalKeys:()=>Gn,parsedType:()=>Qn,partial:()=>Xg,pick:()=>Bg,prefixIssues:()=>Qe,primitiveTypes:()=>wc,promiseAllObject:()=>Fg,propertyKeyTypes:()=>Bn,randomString:()=>Vg,required:()=>e_,safeExtend:()=>Yg,shallowClone:()=>bc,slugify:()=>Jn,stringifyPrimitive:()=>yo,uint8ArrayToBase64:()=>kc,uint8ArrayToBase64url:()=>o_,uint8ArrayToHex:()=>s_,unwrapMessage:()=>mr});function Cg(t){return t}function jg(t){return t}function Zg(t){}function qg(t){throw new Error("Unexpected value in exhaustive check")}function Mg(t){}function hr(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function ho(t,e="|"){return t.map(r=>yo(r)).join(e)}function Zt(t,e){return typeof e=="bigint"?e.toString():e}function qt(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function gr(t){return t==null}function _r(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Hn(t,e){let r=t/e,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-o)<n?0:r-o}var $c=Symbol("evaluating");function U(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==$c)return o===void 0&&(o=$c,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function Dg(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function it(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function We(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function Lg(t){return We(t._zod.def)}function Ug(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function Fg(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let s=0;s<e.length;s++)n[e[s]]=o[s];return n})}function Vg(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function go(t){return JSON.stringify(t)}function Jn(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var _o="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function $t(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Kn=qt(()=>{if(jt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function at(t){if($t(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!($t(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function bc(t){return at(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function Hg(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var Jg=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Bn=new Set(["string","number","symbol"]),wc=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ye(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function T(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Kg(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,s){return e??(e=t()),Reflect.set(e,o,n,s)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function yo(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Gn(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Wn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},zc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Bg(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=We(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=r.shape[a])}return it(this,"shape",i),i},checks:[]});return Ze(t,s)}function Gg(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=We(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return it(this,"shape",i),i},checks:[]});return Ze(t,s)}function Wg(t,e){if(!at(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let s=t._zod.def.shape;for(let i in e)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=We(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return it(this,"shape",s),s}});return Ze(t,n)}function Yg(t,e){if(!at(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=We(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return it(this,"shape",o),o}});return Ze(t,r)}function Qg(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=We(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return it(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return Ze(t,r)}function Xg(t,e,r){let n=e._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=We(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(r)for(let u in r){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=t?new t({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=t?new t({type:"optional",innerType:a[u]}):a[u];return it(this,"shape",c),c},checks:[]});return Ze(e,i)}function e_(t,e,r){let o=We(e._zod.def,{get shape(){let n=e._zod.def.shape,s={...n};if(r)for(let i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new t({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new t({type:"nonoptional",innerType:n[i]});return it(this,"shape",s),s}});return Ze(e,o)}function ct(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Yn(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue===!1)return!0;return!1}function Qe(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function mr(t){return typeof t=="string"?t:t?.message}function Oe(t,e,r){let o=t.message?t.message:mr(t.inst?._zod.def?.error?.(t))??mr(e?.error?.(t))??mr(r.customError?.(t))??mr(r.localeError?.(t))??"Invalid input",{inst:n,continue:s,input:i,...a}=t;return a.path??(a.path=[]),a.message=o,e?.reportInput&&(a.input=i),a}function xc(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function yr(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Qn(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Mt(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function t_(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Sc(t){let e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}function kc(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function r_(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return Sc(e+r)}function o_(t){return kc(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function n_(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)r[o/2]=Number.parseInt(e.slice(o,o+2),16);return r}function s_(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Vn=class{constructor(...e){}};var Pc=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Zt,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},vo=g("$ZodError",Pc),Xn=g("$ZodError",Pc,{Parent:Error});function Ec(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function Tc(t,e=r=>r.message){let r={_errors:[]},o=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")o({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")o({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)r._errors.push(e(i));else{let c=r,u=0;for(;u<a.length;){let l=a[u];u===a.length-1?(c[l]=c[l]||{_errors:[]},c[l]._errors.push(e(i))):c[l]=c[l]||{_errors:[]},c=c[l],u++}}}};return o(t),r}var $o=t=>(e,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Ve;if(i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Oe(c,s,ke())));throw _o(a,n?.callee),a}return i.value};var bo=t=>async(e,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(n?.Err??t)(i.issues.map(c=>Oe(c,s,ke())));throw _o(a,n?.callee),a}return i.value};var vr=t=>(e,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new Ve;return s.issues.length?{success:!1,error:new(t??vo)(s.issues.map(i=>Oe(i,n,ke())))}:{success:!0,data:s.value}},$r=vr(Xn),br=t=>async(e,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=e._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>Oe(i,n,ke())))}:{success:!0,data:s.value}},wo=br(Xn),Oc=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return $o(t)(e,r,n)};var Rc=t=>(e,r,o)=>$o(t)(e,r,o);var Ic=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return bo(t)(e,r,n)};var Nc=t=>async(e,r,o)=>bo(t)(e,r,o);var Ac=t=>(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return vr(t)(e,r,n)};var Cc=t=>(e,r,o)=>vr(t)(e,r,o);var jc=t=>async(e,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return br(t)(e,r,n)};var Zc=t=>async(e,r,o)=>br(t)(e,r,o);var qc=/^[cC][0-9a-z]{6,}$/,Mc=/^[0-9a-z]+$/,Dc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lc=/^[0-9a-vA-V]{20}$/,Uc=/^[A-Za-z0-9]{27}$/,Fc=/^[a-zA-Z0-9_-]{21}$/,Vc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Hc=/^([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})$/,es=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;var Jc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var a_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Kc(){return new RegExp(a_,"u")}var Bc=/^(?:(?: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])$/,Gc=/^(([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 Wc=/^((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])$/,Yc=/^(([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])$/,Qc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ts=/^[A-Za-z0-9_-]*$/;var Xc=/^https?$/,eu=/^\+[1-9]\d{6,14}$/,tu="(?:(?:\\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])))",ru=new RegExp(`^${tu}$`);function ou(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function nu(t){return new RegExp(`^${ou(t)}$`)}function su(t){let e=ou({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${e}(?:${r.join("|")})`;return new RegExp(`^${tu}T(?:${o})$`)}var iu=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var au=/^-?\d+$/,rs=/^-?\d+(?:\.\d+)?$/,cu=/^(?:true|false)$/i,uu=/^null$/i;var lu=/^[^A-Z]*$/,du=/^[^a-z]*$/;var ie=g("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),pu={number:"number",bigint:"bigint",object:"date"},os=g("$ZodCheckLessThan",(t,e)=>{ie.init(t,e);let r=pu[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?n.maximum=e.value:n.exclusiveMaximum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value<=e.value:o.value<e.value)||o.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ns=g("$ZodCheckGreaterThan",(t,e)=>{ie.init(t,e);let r=pu[typeof e.value];t._zod.onattach.push(o=>{let n=o._zod.bag,s=(e.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?n.minimum=e.value:n.exclusiveMinimum=e.value)}),t._zod.check=o=>{(e.inclusive?o.value>=e.value:o.value>e.value)||o.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:o.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),fu=g("$ZodCheckMultipleOf",(t,e)=>{ie.init(t,e),t._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Hn(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),mu=g("$ZodCheckNumberFormat",(t,e)=>{ie.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),o=r?"int":"number",[n,s]=Wn[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=n,a.maximum=s,r&&(a.pattern=au)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:o,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:o,inclusive:!0,continue:!e.abort});return}}a<n&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:n,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}});var hu=g("$ZodCheckMaxLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!gr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<n&&(o._zod.bag.maximum=e.maximum)}),t._zod.check=o=>{let n=o.value;if(n.length<=e.maximum)return;let i=yr(n);o.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),gu=g("$ZodCheckMinLength",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!gr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>n&&(o._zod.bag.minimum=e.minimum)}),t._zod.check=o=>{let n=o.value;if(n.length>=e.minimum)return;let i=yr(n);o.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:n,inst:t,continue:!e.abort})}}),_u=g("$ZodCheckLengthEquals",(t,e)=>{var r;ie.init(t,e),(r=t._zod.def).when??(r.when=o=>{let n=o.value;return!gr(n)&&n.length!==void 0}),t._zod.onattach.push(o=>{let n=o._zod.bag;n.minimum=e.length,n.maximum=e.length,n.length=e.length}),t._zod.check=o=>{let n=o.value,s=n.length;if(s===e.length)return;let i=yr(n),a=s>e.length;o.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:o.value,inst:t,continue:!e.abort})}}),wr=g("$ZodCheckStringFormat",(t,e)=>{var r,o;ie.init(t,e),t._zod.onattach.push(n=>{let s=n._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:e.format,input:n.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(o=t._zod).check??(o.check=()=>{})}),yu=g("$ZodCheckRegex",(t,e)=>{wr.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),vu=g("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=lu),wr.init(t,e)}),$u=g("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=du),wr.init(t,e)}),bu=g("$ZodCheckIncludes",(t,e)=>{ie.init(t,e);let r=Ye(e.includes),o=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=o,t._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(o)}),t._zod.check=n=>{n.value.includes(e.includes,e.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:n.value,inst:t,continue:!e.abort})}}),wu=g("$ZodCheckStartsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`^${Ye(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.startsWith(e.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:o.value,inst:t,continue:!e.abort})}}),zu=g("$ZodCheckEndsWith",(t,e)=>{ie.init(t,e);let r=new RegExp(`.*${Ye(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(o=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),t._zod.check=o=>{o.value.endsWith(e.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:o.value,inst:t,continue:!e.abort})}});var xu=g("$ZodCheckOverwrite",(t,e)=>{ie.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var xo=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
9
+ `).filter(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),s=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let e=Function,r=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,n.join(`
10
+ `))}};var ku={major:4,minor:4,patch:3};var K=g("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=ku;let o=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&o.unshift(t);for(let n of o)for(let s of n._zod.onattach)s(t);if(o.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let n=(i,a,c)=>{let u=ct(i),l;for(let d of a){if(d._zod.def.when){if(Yn(i)||!d._zod.def.when(i))continue}else if(u)continue;let p=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Ve;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,i.issues.length!==p&&(u||(u=ct(i,p)))});else{if(i.issues.length===p)continue;u||(u=ct(i,p))}}return l?l.then(()=>i):i},s=(i,a,c)=>{if(ct(i))return i.aborted=!0,i;let u=n(a,o,c);if(u instanceof Promise){if(c.async===!1)throw new Ve;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(i,a)=>{if(a.skipChecks)return t._zod.parse(i,a);if(a.direction==="backward"){let u=t._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(l=>s(l,i,a)):s(u,i,a)}let c=t._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Ve;return c.then(u=>n(u,o,a))}return n(c,o,a)}}U(t,"~standard",()=>({validate:n=>{try{let s=$r(t,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return wo(t,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Po=g("$ZodString",(t,e)=>{K.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??iu(t._zod.bag),t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),B=g("$ZodStringFormat",(t,e)=>{wr.init(t,e),Po.init(t,e)}),Cu=g("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Hc),B.init(t,e)}),ju=g("$ZodUUID",(t,e)=>{if(e.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(o===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=es(o))}else e.pattern??(e.pattern=es());B.init(t,e)}),Zu=g("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Jc),B.init(t,e)}),qu=g("$ZodURL",(t,e)=>{B.init(t,e),t._zod.check=r=>{try{let o=r.value.trim();if(!e.normalize&&e.protocol?.source===Xc.source&&!/^https?:\/\//i.test(o)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}let n=new URL(o);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Mu=g("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Kc()),B.init(t,e)}),Du=g("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Fc),B.init(t,e)}),Lu=g("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=qc),B.init(t,e)}),Uu=g("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Mc),B.init(t,e)}),Fu=g("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Dc),B.init(t,e)}),Vu=g("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Lc),B.init(t,e)}),Hu=g("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Uc),B.init(t,e)}),Ju=g("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=su(e)),B.init(t,e)}),Ku=g("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=ru),B.init(t,e)}),Bu=g("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=nu(e)),B.init(t,e)}),Gu=g("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Vc),B.init(t,e)}),Wu=g("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Bc),B.init(t,e),t._zod.bag.format="ipv4"}),Yu=g("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Gc),B.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}});var Qu=g("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Wc),B.init(t,e)}),Xu=g("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Yc),B.init(t,e),t._zod.check=r=>{let o=r.value.split("/");try{if(o.length!==2)throw new Error;let[n,s]=o;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function el(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var tl=g("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Qc),B.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{el(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function l_(t){if(!ts.test(t))return!1;let e=t.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return el(r)}var rl=g("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=ts),B.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{l_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),ol=g("$ZodE164",(t,e)=>{e.pattern??(e.pattern=eu),B.init(t,e)});function d_(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[o]=r;if(!o)return!1;let n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||e&&(!("alg"in n)||n.alg!==e))}catch{return!1}}var nl=g("$ZodJWT",(t,e)=>{B.init(t,e),t._zod.check=r=>{d_(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var is=g("$ZodNumber",(t,e)=>{K.init(t,e),t._zod.pattern=t._zod.bag.pattern??rs,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:t,...s?{received:s}:{}}),r}}),sl=g("$ZodNumberFormat",(t,e)=>{mu.init(t,e),is.init(t,e)}),il=g("$ZodBoolean",(t,e)=>{K.init(t,e),t._zod.pattern=cu,t._zod.parse=(r,o)=>{if(e.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:t}),r}});var al=g("$ZodNull",(t,e)=>{K.init(t,e),t._zod.pattern=uu,t._zod.values=new Set([null]),t._zod.parse=(r,o)=>{let n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:t}),r}});var cl=g("$ZodUnknown",(t,e)=>{K.init(t,e),t._zod.parse=r=>r}),ul=g("$ZodNever",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function Pu(t,e,r){t.issues.length&&e.issues.push(...Qe(r,t.issues)),e.value[r]=t.value}var ll=g("$ZodArray",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:t}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let a=n[i],c=e.element._zod.run({value:a,issues:[]},o);c instanceof Promise?s.push(c.then(u=>Pu(u,r,i))):Pu(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function ko(t,e,r,o,n,s){let i=r in o;if(t.issues.length){if(n&&s&&!i)return;e.issues.push(...Qe(r,t.issues))}if(!i&&!n){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?i&&(e.value[r]=void 0):e.value[r]=t.value}function dl(t){let e=Object.keys(t.shape);for(let o of e)if(!t.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=Gn(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function pl(t,e,r,o,n,s){let i=[],a=n.keySet,c=n.catchall._zod,u=c.def.type,l=c.optin==="optional",d=c.optout==="optional";for(let p in e){if(p==="__proto__"||a.has(p))continue;if(u==="never"){i.push(p);continue}let f=c.run({value:e[p],issues:[]},o);f instanceof Promise?t.push(f.then(m=>ko(m,r,p,e,l,d))):ko(f,r,p,e,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:e,inst:s}),t.length?Promise.all(t).then(()=>r):r}var p_=g("$ZodObject",(t,e)=>{if(K.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let o=qt(()=>dl(e));U(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let l=a[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let n=$t,s=e.catchall,i;t._zod.parse=(a,c)=>{i??(i=o.value);let u=a.value;if(!n(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let l=[],d=i.shape;for(let p of i.keys){let f=d[p],m=f._zod.optin==="optional",_=f._zod.optout==="optional",y=f._zod.run({value:u[p],issues:[]},c);y instanceof Promise?l.push(y.then($=>ko($,a,p,u,m,_))):ko(y,a,p,u,m,_)}return s?pl(l,u,a,c,o.value,t):l.length?Promise.all(l).then(()=>a):a}}),fl=g("$ZodObjectJIT",(t,e)=>{p_.init(t,e);let r=t._zod.parse,o=qt(()=>dl(e)),n=p=>{let f=new xo(["shape","payload","ctx"]),m=o.value,_=z=>{let P=go(z);return`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),$=0;for(let z of m.keys)y[z]=`key_${$++}`;f.write("const newResult = {};");for(let z of m.keys){let P=y[z],x=go(z),Se=p[z],Te=Se?._zod?.optin==="optional",dr=Se?._zod?.optout==="optional";f.write(`const ${P} = ${_(z)};`),Te&&dr?f.write(`
11
+ if (${P}.issues.length) {
12
+ if (${x} in input) {
13
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
14
+ ...iss,
15
+ path: iss.path ? [${x}, ...iss.path] : [${x}]
16
+ })));
17
+ }
18
+ }
19
+
20
+ if (${P}.value === undefined) {
21
+ if (${x} in input) {
22
+ newResult[${x}] = undefined;
23
+ }
24
+ } else {
25
+ newResult[${x}] = ${P}.value;
26
+ }
27
+
28
+ `):Te?f.write(`
29
+ if (${P}.issues.length) {
30
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
31
+ ...iss,
32
+ path: iss.path ? [${x}, ...iss.path] : [${x}]
33
+ })));
34
+ }
35
+
36
+ if (${P}.value === undefined) {
37
+ if (${x} in input) {
38
+ newResult[${x}] = undefined;
39
+ }
40
+ } else {
41
+ newResult[${x}] = ${P}.value;
42
+ }
43
+
44
+ `):f.write(`
45
+ const ${P}_present = ${x} in input;
46
+ if (${P}.issues.length) {
47
+ payload.issues = payload.issues.concat(${P}.issues.map(iss => ({
48
+ ...iss,
49
+ path: iss.path ? [${x}, ...iss.path] : [${x}]
50
+ })));
51
+ }
52
+ if (!${P}_present && !${P}.issues.length) {
53
+ payload.issues.push({
54
+ code: "invalid_type",
55
+ expected: "nonoptional",
56
+ input: undefined,
57
+ path: [${x}]
58
+ });
59
+ }
60
+
61
+ if (${P}_present) {
62
+ if (${P}.value === undefined) {
63
+ newResult[${x}] = undefined;
64
+ } else {
65
+ newResult[${x}] = ${P}.value;
66
+ }
67
+ }
68
+
69
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");let w=f.compile();return(z,P)=>w(p,z,P)},s,i=$t,a=!jt.jitless,u=a&&Kn.value,l=e.catchall,d;t._zod.parse=(p,f)=>{d??(d=o.value);let m=p.value;return i(m)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=n(e.shape)),p=s(p,f),l?pl([],m,p,f,d,t):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),p)}});function Eu(t,e,r,o){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;let n=t.filter(s=>!ct(s));return n.length===1?(e.value=n[0].value,n[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(s=>s.issues.map(i=>Oe(i,o,ke())))}),e)}var as=g("$ZodUnion",(t,e)=>{K.init(t,e),U(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),U(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),U(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),U(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${o.map(n=>_r(n.source)).join("|")})$`)}});let r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(o,n)=>{if(r)return r(o,n);let s=!1,i=[];for(let a of e.options){let c=a._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Eu(a,o,t,n)):Eu(i,o,t,n)}});var ml=g("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,as.init(t,e);let r=t._zod.parse;U(t._zod,"propValues",()=>{let n={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){n[a]||(n[a]=new Set);for(let u of c)n[a].add(u)}}return n});let o=qt(()=>{let n=e.options,s=new Map;for(let i of n){let a=i._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(n,s)=>{let i=n.value;if(!$t(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),n;let a=o.value.get(i?.[e.discriminator]);return a?a._zod.run(n,s):e.unionFallback||s.direction==="backward"?r(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(o.value.keys()),input:i,path:[e.discriminator],inst:t}),n)}}),hl=g("$ZodIntersection",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value,s=e.left._zod.run({value:n,issues:[]},o),i=e.right._zod.run({value:n,issues:[]},o);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Tu(r,c,u)):Tu(r,s,i)}});function ss(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(at(t)&&at(e)){let r=Object.keys(e),o=Object.keys(t).filter(s=>r.indexOf(s)!==-1),n={...t,...e};for(let s of o){let i=ss(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<t.length;o++){let n=t[o],s=e[o],i=ss(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 Tu(t,e,r){let o=new Map,n;for(let a of e.issues)if(a.code==="unrecognized_keys"){n??(n=a);for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).l=!0}else t.issues.push(a);for(let a of r.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)o.has(c)||o.set(c,{}),o.get(c).r=!0;else t.issues.push(a);let s=[...o].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&n&&t.issues.push({...n,keys:s}),ct(t))return t;let i=ss(e.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}var gl=g("$ZodRecord",(t,e)=>{K.init(t,e),t._zod.parse=(r,o)=>{let n=r.value;if(!at(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:t}),r;let s=[],i=e.keyType._zod.values;if(i){r.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let l=e.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(l.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>Oe(f,o,ke())),input:u,path:[u],inst:t});continue}let d=l.value,p=e.valueType._zod.run({value:n[u],issues:[]},o);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&r.issues.push(...Qe(u,f.issues)),r.value[d]=f.value})):(p.issues.length&&r.issues.push(...Qe(u,p.issues)),r.value[d]=p.value)}let c;for(let u in n)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:t,keys:c})}else{r.value={};for(let a of Reflect.ownKeys(n)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&rs.test(a)&&c.issues.length){let d=e.keyType._zod.run({value:Number(a),issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){e.mode==="loose"?r.value[a]=n[a]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Oe(d,o,ke())),input:a,path:[a],inst:t});continue}let l=e.valueType._zod.run({value:n[a],issues:[]},o);l instanceof Promise?s.push(l.then(d=>{d.issues.length&&r.issues.push(...Qe(a,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Qe(a,l.issues)),r.value[c.value]=l.value)}}return s.length?Promise.all(s).then(()=>r):r}});var _l=g("$ZodEnum",(t,e)=>{K.init(t,e);let r=hr(e.entries),o=new Set(r);t._zod.values=o,t._zod.pattern=new RegExp(`^(${r.filter(n=>Bn.has(typeof n)).map(n=>typeof n=="string"?Ye(n):n.toString()).join("|")})$`),t._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:t}),n}}),yl=g("$ZodLiteral",(t,e)=>{if(K.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(o=>typeof o=="string"?Ye(o):o?Ye(o.toString()):String(o)).join("|")})$`),t._zod.parse=(o,n)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),o}});var vl=g("$ZodTransform",(t,e)=>{K.init(t,e),t._zod.optin="optional",t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ct(t.constructor.name);let n=e.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r.fallback=!0,r));if(n instanceof Promise)throw new Ve;return r.value=n,r.fallback=!0,r}});function Ou(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var cs=g("$ZodOptional",(t,e)=>{K.init(t,e),t._zod.optin="optional",t._zod.optout="optional",U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${_r(r.source)})?$`):void 0}),t._zod.parse=(r,o)=>{if(e.innerType._zod.optin==="optional"){let n=r.value,s=e.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>Ou(i,n)):Ou(s,n)}return r.value===void 0?r:e.innerType._zod.run(r,o)}}),$l=g("$ZodExactOptional",(t,e)=>{cs.init(t,e),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,o)=>e.innerType._zod.run(r,o)}),bl=g("$ZodNullable",(t,e)=>{K.init(t,e),U(t._zod,"optin",()=>e.innerType._zod.optin),U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${_r(r.source)}|null)$`):void 0}),U(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,o)=>r.value===null?r:e.innerType._zod.run(r,o)}),wl=g("$ZodDefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);if(r.value===void 0)return r.value=e.defaultValue,r;let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Ru(s,e)):Ru(n,e)}});function Ru(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var zl=g("$ZodPrefault",(t,e)=>{K.init(t,e),t._zod.optin="optional",U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,o))}),xl=g("$ZodNonOptional",(t,e)=>{K.init(t,e),U(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),t._zod.parse=(r,o)=>{let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Iu(s,t)):Iu(n,t)}});function Iu(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var Sl=g("$ZodCatch",(t,e)=>{K.init(t,e),t._zod.optin="optional",U(t._zod,"optout",()=>e.innerType._zod.optout),U(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>Oe(i,o,ke()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=n.value,n.issues.length&&(r.value=e.catchValue({...r,error:{issues:n.issues.map(s=>Oe(s,o,ke()))},input:r.value}),r.issues=[],r.fallback=!0),r)}});var us=g("$ZodPipe",(t,e)=>{K.init(t,e),U(t._zod,"values",()=>e.in._zod.values),U(t._zod,"optin",()=>e.in._zod.optin),U(t._zod,"optout",()=>e.out._zod.optout),U(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,o)=>{if(o.direction==="backward"){let s=e.out._zod.run(r,o);return s instanceof Promise?s.then(i=>So(i,e.in,o)):So(s,e.in,o)}let n=e.in._zod.run(r,o);return n instanceof Promise?n.then(s=>So(s,e.out,o)):So(n,e.out,o)}});function So(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}var kl=g("$ZodPreprocess",(t,e)=>{us.init(t,e)}),Pl=g("$ZodReadonly",(t,e)=>{K.init(t,e),U(t._zod,"propValues",()=>e.innerType._zod.propValues),U(t._zod,"values",()=>e.innerType._zod.values),U(t._zod,"optin",()=>e.innerType?._zod?.optin),U(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,o)=>{if(o.direction==="backward")return e.innerType._zod.run(r,o);let n=e.innerType._zod.run(r,o);return n instanceof Promise?n.then(Nu):Nu(n)}});function Nu(t){return t.value=Object.freeze(t.value),t}var El=g("$ZodCustom",(t,e)=>{ie.init(t,e),K.init(t,e),t._zod.parse=(r,o)=>r,t._zod.check=r=>{let o=r.value,n=e.fn(o);if(n instanceof Promise)return n.then(s=>Au(s,r,o,t));Au(n,r,o,t)}});function Au(t,e,r,o){if(!t){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),e.issues.push(Mt(n))}}var f_=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=o[n.expected]??n.expected,i=Qn(n.input),a=o[i]??i;return`Invalid input: expected ${s}, received ${a}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${yo(n.values[0])}`:`Invalid option: expected one of ${ho(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${r[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${ho(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Tl(){return{localeError:f_()}}var Ol;var ls=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let o=r[0];return this._map.set(e,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let o={...this.get(r)??{}};delete o.id;let n={...o,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function m_(){return new ls}(Ol=globalThis).__zod_globalRegistry??(Ol.__zod_globalRegistry=m_());var bt=globalThis.__zod_globalRegistry;function Rl(t,e){return new t({type:"string",...T(e)})}function Il(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...T(e)})}function ds(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...T(e)})}function Nl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...T(e)})}function Al(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(e)})}function Cl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(e)})}function jl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(e)})}function Zl(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...T(e)})}function ql(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...T(e)})}function Ml(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(e)})}function Dl(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...T(e)})}function Ll(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(e)})}function Ul(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...T(e)})}function Fl(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...T(e)})}function Vl(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(e)})}function Hl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(e)})}function Jl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(e)})}function Kl(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(e)})}function Bl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(e)})}function Gl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...T(e)})}function Wl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...T(e)})}function Yl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...T(e)})}function Ql(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...T(e)})}function Xl(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(e)})}function ed(t,e){return new t({type:"string",format:"date",check:"string_format",...T(e)})}function td(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...T(e)})}function rd(t,e){return new t({type:"string",format:"duration",check:"string_format",...T(e)})}function od(t,e){return new t({type:"number",checks:[],...T(e)})}function nd(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...T(e)})}function sd(t,e){return new t({type:"boolean",...T(e)})}function id(t,e){return new t({type:"null",...T(e)})}function ad(t){return new t({type:"unknown"})}function cd(t,e){return new t({type:"never",...T(e)})}function Eo(t,e){return new os({check:"less_than",...T(e),value:t,inclusive:!1})}function zr(t,e){return new os({check:"less_than",...T(e),value:t,inclusive:!0})}function To(t,e){return new ns({check:"greater_than",...T(e),value:t,inclusive:!1})}function xr(t,e){return new ns({check:"greater_than",...T(e),value:t,inclusive:!0})}function Oo(t,e){return new fu({check:"multiple_of",...T(e),value:t})}function Ro(t,e){return new hu({check:"max_length",...T(e),maximum:t})}function Dt(t,e){return new gu({check:"min_length",...T(e),minimum:t})}function Io(t,e){return new _u({check:"length_equals",...T(e),length:t})}function ps(t,e){return new yu({check:"string_format",format:"regex",...T(e),pattern:t})}function fs(t){return new vu({check:"string_format",format:"lowercase",...T(t)})}function ms(t){return new $u({check:"string_format",format:"uppercase",...T(t)})}function hs(t,e){return new bu({check:"string_format",format:"includes",...T(e),includes:t})}function gs(t,e){return new wu({check:"string_format",format:"starts_with",...T(e),prefix:t})}function _s(t,e){return new zu({check:"string_format",format:"ends_with",...T(e),suffix:t})}function ut(t){return new xu({check:"overwrite",tx:t})}function ys(t){return ut(e=>e.normalize(t))}function vs(){return ut(t=>t.trim())}function $s(){return ut(t=>t.toLowerCase())}function bs(){return ut(t=>t.toUpperCase())}function ws(){return ut(t=>Jn(t))}function ud(t,e,r){return new t({type:"array",element:e,...T(r)})}function ld(t,e,r){let o=T(r);return o.abort??(o.abort=!0),new t({type:"custom",check:"custom",fn:e,...o})}function dd(t,e,r){return new t({type:"custom",check:"custom",fn:e,...T(r)})}function pd(t,e){let r=h_(o=>(o.addIssue=n=>{if(typeof n=="string")o.issues.push(Mt(n,o.value,r._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=o.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),o.issues.push(Mt(s))}},t(o.value,o)),e);return r}function h_(t,e){let r=new ie({check:"custom",...T(e)});return r._zod.check=t,r}function zs(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??bt,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function re(t,e,r={path:[],schemaPath:[]}){var o;let n=t._zod.def,s=e.seen.get(t);if(s)return s.count++,r.schemaPath.includes(t)&&(s.cycle=r.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,i);let a=t._zod.toJSONSchema?.();if(a)i.schema=a;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,i.schema,l);else{let p=i.schema,f=e.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(t,e,p,l)}let d=t._zod.parent;d&&(i.ref||(i.ref=d),re(d,e,l),e.seen.get(d).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(i.schema,c),e.io==="input"&&ge(t)&&(delete i.schema.examples,delete i.schema.default),e.io==="input"&&"_prefault"in i.schema&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,e.seen.get(t).schema}function xs(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let i of t.seen.entries()){let a=t.metadataRegistry.get(i[0])?.id;if(a){let c=o.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(a,i[0])}}let n=i=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(i[0])?.id,p=t.external.uri??(m=>m);if(d)return{ref:p(d)};let f=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=n(i);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let d in l)delete l[d];l.$ref=c};if(t.cycles==="throw")for(let i of t.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
70
+
71
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of t.seen.entries()){let a=i[1];if(e===i[0]){s(i);continue}if(t.external){let u=t.external.registry.get(i[0])?.id;if(e!==i[0]&&u){s(i);continue}}if(t.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&t.reused==="ref"){s(i);continue}}}function Ss(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=a=>{let c=t.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},d=c.ref;if(c.ref=null,d){o(d);let f=t.seen.get(d),m=f.schema;if(m.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(m)):Object.assign(u,m),Object.assign(u,l),a._zod.parent===d)for(let y in u)y==="$ref"||y==="allOf"||y in l||delete u[y];if(m.$ref&&f.def)for(let y in u)y==="$ref"||y==="allOf"||y in f.def&&JSON.stringify(u[y])===JSON.stringify(f.def[y])&&delete u[y]}let p=a._zod.parent;if(p&&p!==d){o(p);let f=t.seen.get(p);if(f?.schema.$ref&&(u.$ref=f.schema.$ref,f.def))for(let m in u)m==="$ref"||m==="allOf"||m in f.def&&JSON.stringify(u[m])===JSON.stringify(f.def[m])&&delete u[m]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())o(a[0]);let n={};if(t.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=t.external.uri(a)}Object.assign(n,r.def??r.schema);let s=t.metadataRegistry.get(e)?.id;s!==void 0&&n.id===s&&delete n.id;let i=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Sr(e,"input",t.processors),output:Sr(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ge(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ge(o.element,r);if(o.type==="set")return ge(o.valueType,r);if(o.type==="lazy")return ge(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 ge(o.innerType,r);if(o.type==="intersection")return ge(o.left,r)||ge(o.right,r);if(o.type==="record"||o.type==="map")return ge(o.keyType,r)||ge(o.valueType,r);if(o.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:ge(o.in,r)||ge(o.out,r);if(o.type==="object"){for(let n in o.shape)if(ge(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ge(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ge(n,r))return!0;return!!(o.rest&&ge(o.rest,r))}return!1}var fd=(t,e={})=>r=>{let o=zs({...r,processors:e});return re(t,o),xs(o,t),Ss(o,t)},Sr=(t,e,r={})=>o=>{let{libraryOptions:n,target:s}=o??{},i=zs({...n??{},target:s,io:e,processors:r});return re(t,i),xs(i,t),Ss(i,t)};var g_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},md=(t,e,r,o)=>{let n=r;n.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),a&&(n.format=g_[a]??a,n.format===""&&delete n.format,a==="time"&&delete n.format),u&&(n.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?n.pattern=l[0].source:l.length>1&&(n.allOf=[...l.map(d=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},hd=(t,e,r,o)=>{let n=r,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof a=="string"&&a.includes("int")?n.type="integer":n.type="number";let d=typeof l=="number"&&l>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),f=e.target==="draft-04"||e.target==="openapi-3.0";d?f?(n.minimum=l,n.exclusiveMinimum=!0):n.exclusiveMinimum=l:typeof s=="number"&&(n.minimum=s),p?f?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof c=="number"&&(n.multipleOf=c)},gd=(t,e,r,o)=>{r.type="boolean"};var _d=(t,e,r,o)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"};var yd=(t,e,r,o)=>{r.not={}};var vd=(t,e,r,o)=>{};var $d=(t,e,r,o)=>{let n=t._zod.def,s=hr(n.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},bd=(t,e,r,o)=>{let n=t._zod.def,s=[];for(let i of n.values)if(i===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];r.type=i===null?"null":typeof i,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s};var wd=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var zd=(t,e,r,o)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var xd=(t,e,r,o)=>{let n=r,s=t._zod.def,{minimum:i,maximum:a}=t._zod.bag;typeof i=="number"&&(n.minItems=i),typeof a=="number"&&(n.maxItems=a),n.type="array",n.items=re(s.element,e,{...o,path:[...o.path,"items"]})},Sd=(t,e,r,o)=>{let n=r,s=t._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=re(i[u],e,{...o,path:[...o.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let l=s.shape[u]._zod;return e.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(n.required=Array.from(c)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=re(s.catchall,e,{...o,path:[...o.path,"additionalProperties"]})):e.io==="output"&&(n.additionalProperties=!1)},kd=(t,e,r,o)=>{let n=t._zod.def,s=n.inclusive===!1,i=n.options.map((a,c)=>re(a,e,{...o,path:[...o.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Pd=(t,e,r,o)=>{let n=t._zod.def,s=re(n.left,e,{...o,path:[...o.path,"allOf",0]}),i=re(n.right,e,{...o,path:[...o.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];r.allOf=c};var Ed=(t,e,r,o)=>{let n=r,s=t._zod.def;n.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let l=re(s.valueType,e,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let d of c)n.patternProperties[d.source]=l}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(n.propertyNames=re(s.keyType,e,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=re(s.valueType,e,{...o,path:[...o.path,"additionalProperties"]});let u=i._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(n.required=l)}},Td=(t,e,r,o)=>{let n=t._zod.def,s=re(n.innerType,e,o),i=e.seen.get(t);e.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Od=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType},Rd=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Id=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Nd=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Ad=(t,e,r,o)=>{let n=t._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=e.io==="input"?s?n.out:n.in:n.out;re(i,e,o);let a=e.seen.get(t);a.ref=i},Cd=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType,r.readOnly=!0};var ks=(t,e,r,o)=>{let n=t._zod.def;re(n.innerType,e,o);let s=e.seen.get(t);s.ref=n.innerType};function Lt(t){return!!t._zod}function qe(t,e){return Lt(t)?$r(t,e):t.safeParse(e)}function No(t){if(!t)return;let e;if(Lt(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function jd(t){if(Lt(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=t.value;if(o!==void 0)return o}var Pr={};Un(Pr,{ZodISODate:()=>qd,ZodISODateTime:()=>Zd,ZodISODuration:()=>Dd,ZodISOTime:()=>Md,date:()=>Es,datetime:()=>Ps,duration:()=>Os,time:()=>Ts});var Zd=g("ZodISODateTime",(t,e)=>{Ju.init(t,e),Q.init(t,e)});function Ps(t){return Xl(Zd,t)}var qd=g("ZodISODate",(t,e)=>{Ku.init(t,e),Q.init(t,e)});function Es(t){return ed(qd,t)}var Md=g("ZodISOTime",(t,e)=>{Bu.init(t,e),Q.init(t,e)});function Ts(t){return td(Md,t)}var Dd=g("ZodISODuration",(t,e)=>{Gu.init(t,e),Q.init(t,e)});function Os(t){return rd(Dd,t)}var S_=(t,e)=>{vo.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Tc(t,r)},flatten:{value:r=>Ec(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Zt,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Zt,2)}},isEmpty:{get(){return t.issues.length===0}}})};var Pe=g("ZodError",S_,{Parent:Error});var Ld=$o(Pe),Ud=bo(Pe),Fd=vr(Pe),Vd=br(Pe),Hd=Oc(Pe),Jd=Rc(Pe),Kd=Ic(Pe),Bd=Nc(Pe),Gd=Ac(Pe),Wd=Cc(Pe),Yd=jc(Pe),Qd=Zc(Pe);var Xd=new WeakMap;function Er(t,e,r){let o=Object.getPrototypeOf(t),n=Xd.get(o);if(n||(n=new Set,Xd.set(o,n)),!n.has(e)){n.add(e);for(let s in r){let i=r[s];Object.defineProperty(o,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var te=g("ZodType",(t,e)=>(K.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Sr(t,"input"),output:Sr(t,"output")}}),t.toJSONSchema=fd(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,o)=>Ld(t,r,o,{callee:t.parse}),t.safeParse=(r,o)=>Fd(t,r,o),t.parseAsync=async(r,o)=>Ud(t,r,o,{callee:t.parseAsync}),t.safeParseAsync=async(r,o)=>Vd(t,r,o),t.spa=t.safeParseAsync,t.encode=(r,o)=>Hd(t,r,o),t.decode=(r,o)=>Jd(t,r,o),t.encodeAsync=async(r,o)=>Kd(t,r,o),t.decodeAsync=async(r,o)=>Bd(t,r,o),t.safeEncode=(r,o)=>Gd(t,r,o),t.safeDecode=(r,o)=>Wd(t,r,o),t.safeEncodeAsync=async(r,o)=>Yd(t,r,o),t.safeDecodeAsync=async(r,o)=>Qd(t,r,o),Er(t,"ZodType",{check(...r){let o=this.def;return this.clone(q.mergeDefs(o,{checks:[...o.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return Ze(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(hy(r,o))},superRefine(r,o){return this.check(gy(r,o))},overwrite(r){return this.check(ut(r))},optional(){return ee(this)},exactOptional(){return oy(this)},nullable(){return op(this)},nullish(){return ee(op(this))},nonoptional(r){return uy(this,r)},array(){return j(this)},or(r){return G([this,r])},and(r){return Co(this,r)},transform(r){return np(this,lp(r))},default(r){return iy(this,r)},prefault(r){return cy(this,r)},catch(r){return dy(this,r)},pipe(r){return np(this,r)},readonly(){return my(this)},describe(r){let o=this.clone();return bt.add(o,{description:r}),o},meta(...r){if(r.length===0)return bt.get(this);let o=this.clone();return bt.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){return bt.get(t)?.description},configurable:!0}),t)),sp=g("_ZodString",(t,e)=>{Po.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>md(t,o,n,s);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,Er(t,"_ZodString",{regex(...o){return this.check(ps(...o))},includes(...o){return this.check(hs(...o))},startsWith(...o){return this.check(gs(...o))},endsWith(...o){return this.check(_s(...o))},min(...o){return this.check(Dt(...o))},max(...o){return this.check(Ro(...o))},length(...o){return this.check(Io(...o))},nonempty(...o){return this.check(Dt(1,...o))},lowercase(o){return this.check(fs(o))},uppercase(o){return this.check(ms(o))},trim(){return this.check(vs())},normalize(...o){return this.check(ys(...o))},toLowerCase(){return this.check($s())},toUpperCase(){return this.check(bs())},slugify(){return this.check(ws())}})}),P_=g("ZodString",(t,e)=>{Po.init(t,e),sp.init(t,e),t.email=r=>t.check(Il(E_,r)),t.url=r=>t.check(Zl(T_,r)),t.jwt=r=>t.check(Ql(V_,r)),t.emoji=r=>t.check(ql(O_,r)),t.guid=r=>t.check(ds(ep,r)),t.uuid=r=>t.check(Nl(Ao,r)),t.uuidv4=r=>t.check(Al(Ao,r)),t.uuidv6=r=>t.check(Cl(Ao,r)),t.uuidv7=r=>t.check(jl(Ao,r)),t.nanoid=r=>t.check(Ml(R_,r)),t.guid=r=>t.check(ds(ep,r)),t.cuid=r=>t.check(Dl(I_,r)),t.cuid2=r=>t.check(Ll(N_,r)),t.ulid=r=>t.check(Ul(A_,r)),t.base64=r=>t.check(Gl(L_,r)),t.base64url=r=>t.check(Wl(U_,r)),t.xid=r=>t.check(Fl(C_,r)),t.ksuid=r=>t.check(Vl(j_,r)),t.ipv4=r=>t.check(Hl(Z_,r)),t.ipv6=r=>t.check(Jl(q_,r)),t.cidrv4=r=>t.check(Kl(M_,r)),t.cidrv6=r=>t.check(Bl(D_,r)),t.e164=r=>t.check(Yl(F_,r)),t.datetime=r=>t.check(Ps(r)),t.date=r=>t.check(Es(r)),t.time=r=>t.check(Ts(r)),t.duration=r=>t.check(Os(r))});function h(t){return Rl(P_,t)}var Q=g("ZodStringFormat",(t,e)=>{B.init(t,e),sp.init(t,e)}),E_=g("ZodEmail",(t,e)=>{Zu.init(t,e),Q.init(t,e)});var ep=g("ZodGUID",(t,e)=>{Cu.init(t,e),Q.init(t,e)});var Ao=g("ZodUUID",(t,e)=>{ju.init(t,e),Q.init(t,e)});var T_=g("ZodURL",(t,e)=>{qu.init(t,e),Q.init(t,e)});var O_=g("ZodEmoji",(t,e)=>{Mu.init(t,e),Q.init(t,e)});var R_=g("ZodNanoID",(t,e)=>{Du.init(t,e),Q.init(t,e)});var I_=g("ZodCUID",(t,e)=>{Lu.init(t,e),Q.init(t,e)});var N_=g("ZodCUID2",(t,e)=>{Uu.init(t,e),Q.init(t,e)});var A_=g("ZodULID",(t,e)=>{Fu.init(t,e),Q.init(t,e)});var C_=g("ZodXID",(t,e)=>{Vu.init(t,e),Q.init(t,e)});var j_=g("ZodKSUID",(t,e)=>{Hu.init(t,e),Q.init(t,e)});var Z_=g("ZodIPv4",(t,e)=>{Wu.init(t,e),Q.init(t,e)});var q_=g("ZodIPv6",(t,e)=>{Yu.init(t,e),Q.init(t,e)});var M_=g("ZodCIDRv4",(t,e)=>{Qu.init(t,e),Q.init(t,e)});var D_=g("ZodCIDRv6",(t,e)=>{Xu.init(t,e),Q.init(t,e)});var L_=g("ZodBase64",(t,e)=>{tl.init(t,e),Q.init(t,e)});var U_=g("ZodBase64URL",(t,e)=>{rl.init(t,e),Q.init(t,e)});var F_=g("ZodE164",(t,e)=>{ol.init(t,e),Q.init(t,e)});var V_=g("ZodJWT",(t,e)=>{nl.init(t,e),Q.init(t,e)});var ip=g("ZodNumber",(t,e)=>{is.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>hd(t,o,n,s),Er(t,"ZodNumber",{gt(o,n){return this.check(To(o,n))},gte(o,n){return this.check(xr(o,n))},min(o,n){return this.check(xr(o,n))},lt(o,n){return this.check(Eo(o,n))},lte(o,n){return this.check(zr(o,n))},max(o,n){return this.check(zr(o,n))},int(o){return this.check(tp(o))},safe(o){return this.check(tp(o))},positive(o){return this.check(To(0,o))},nonnegative(o){return this.check(xr(0,o))},negative(o){return this.check(Eo(0,o))},nonpositive(o){return this.check(zr(0,o))},multipleOf(o,n){return this.check(Oo(o,n))},step(o,n){return this.check(Oo(o,n))},finite(){return this}});let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function F(t){return od(ip,t)}var H_=g("ZodNumberFormat",(t,e)=>{sl.init(t,e),ip.init(t,e)});function tp(t){return nd(H_,t)}var J_=g("ZodBoolean",(t,e)=>{il.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>gd(t,r,o,n)});function se(t){return sd(J_,t)}var K_=g("ZodNull",(t,e)=>{al.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>_d(t,r,o,n)});function ap(t){return id(K_,t)}var B_=g("ZodUnknown",(t,e)=>{cl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>vd(t,r,o,n)});function X(){return ad(B_)}var G_=g("ZodNever",(t,e)=>{ul.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>yd(t,r,o,n)});function W_(t){return cd(G_,t)}var Y_=g("ZodArray",(t,e)=>{ll.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>xd(t,r,o,n),t.element=e.element,Er(t,"ZodArray",{min(r,o){return this.check(Dt(r,o))},nonempty(r){return this.check(Dt(1,r))},max(r,o){return this.check(Ro(r,o))},length(r,o){return this.check(Io(r,o))},unwrap(){return this.element}})});function j(t,e){return ud(Y_,t,e)}var cp=g("ZodObject",(t,e)=>{fl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Sd(t,r,o,n),q.defineLazy(t,"shape",()=>e.shape),Er(t,"ZodObject",{keyof(){return $e(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:W_()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return q.extend(this,r)},safeExtend(r){return q.safeExtend(this,r)},merge(r){return q.merge(this,r)},pick(r){return q.pick(this,r)},omit(r){return q.omit(this,r)},partial(...r){return q.partial(dp,this,r[0])},required(...r){return q.required(pp,this,r[0])}})});function b(t,e){let r={type:"object",shape:t??{},...q.normalizeParams(e)};return new cp(r)}function _e(t,e){return new cp({type:"object",shape:t,catchall:X(),...q.normalizeParams(e)})}var up=g("ZodUnion",(t,e)=>{as.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>kd(t,r,o,n),t.options=e.options});function G(t,e){return new up({type:"union",options:t,...q.normalizeParams(e)})}var Q_=g("ZodDiscriminatedUnion",(t,e)=>{up.init(t,e),ml.init(t,e)});function Is(t,e,r){return new Q_({type:"union",options:e,discriminator:t,...q.normalizeParams(r)})}var X_=g("ZodIntersection",(t,e)=>{hl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Pd(t,r,o,n)});function Co(t,e){return new X_({type:"intersection",left:t,right:e})}var rp=g("ZodRecord",(t,e)=>{gl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Ed(t,r,o,n),t.keyType=e.keyType,t.valueType=e.valueType});function J(t,e,r){return!e||!e._zod?new rp({type:"record",keyType:h(),valueType:t,...q.normalizeParams(e)}):new rp({type:"record",keyType:t,valueType:e,...q.normalizeParams(r)})}var Rs=g("ZodEnum",(t,e)=>{_l.init(t,e),te.init(t,e),t._zod.processJSONSchema=(o,n,s)=>$d(t,o,n,s),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(o,n)=>{let s={};for(let i of o)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Rs({...e,checks:[],...q.normalizeParams(n),entries:s})},t.exclude=(o,n)=>{let s={...e.entries};for(let i of o)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Rs({...e,checks:[],...q.normalizeParams(n),entries:s})}});function $e(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new Rs({type:"enum",entries:r,...q.normalizeParams(e)})}var ey=g("ZodLiteral",(t,e)=>{yl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>bd(t,r,o,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function S(t,e){return new ey({type:"literal",values:Array.isArray(t)?t:[t],...q.normalizeParams(e)})}var ty=g("ZodTransform",(t,e)=>{vl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>zd(t,r,o,n),t._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ct(t.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(q.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),r.issues.push(q.issue(i))}};let n=e.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=n,r.fallback=!0,r)}});function lp(t){return new ty({type:"transform",transform:t})}var dp=g("ZodOptional",(t,e)=>{cs.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ks(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function ee(t){return new dp({type:"optional",innerType:t})}var ry=g("ZodExactOptional",(t,e)=>{$l.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>ks(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function oy(t){return new ry({type:"optional",innerType:t})}var ny=g("ZodNullable",(t,e)=>{bl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Td(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function op(t){return new ny({type:"nullable",innerType:t})}var sy=g("ZodDefault",(t,e)=>{wl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Rd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function iy(t,e){return new sy({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():q.shallowClone(e)}})}var ay=g("ZodPrefault",(t,e)=>{zl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Id(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function cy(t,e){return new ay({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():q.shallowClone(e)}})}var pp=g("ZodNonOptional",(t,e)=>{xl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Od(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function uy(t,e){return new pp({type:"nonoptional",innerType:t,...q.normalizeParams(e)})}var ly=g("ZodCatch",(t,e)=>{Sl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Nd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function dy(t,e){return new ly({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var fp=g("ZodPipe",(t,e)=>{us.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Ad(t,r,o,n),t.in=e.in,t.out=e.out});function np(t,e){return new fp({type:"pipe",in:t,out:e})}var py=g("ZodPreprocess",(t,e)=>{fp.init(t,e),kl.init(t,e)}),fy=g("ZodReadonly",(t,e)=>{Pl.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>Cd(t,r,o,n),t.unwrap=()=>t._zod.def.innerType});function my(t){return new fy({type:"readonly",innerType:t})}var mp=g("ZodCustom",(t,e)=>{El.init(t,e),te.init(t,e),t._zod.processJSONSchema=(r,o,n)=>wd(t,r,o,n)});function hp(t,e){return ld(mp,t??(()=>!0),e)}function hy(t,e={}){return dd(mp,t,e)}function gy(t,e){return pd(t,e)}function Ns(t,e){return new py({type:"pipe",in:lp(t),out:e})}ke(Tl());var Cs="2025-11-25";var gp=[Cs,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],lt="io.modelcontextprotocol/related-task",Zo="2.0",ne=hp(t=>t!==null&&(typeof t=="object"||typeof t=="function")),_p=G([h(),F().int()]),yp=h(),tE=_e({ttl:F().optional(),pollInterval:F().optional()}),_y=b({ttl:F().optional()}),yy=b({taskId:h()}),js=_e({progressToken:_p.optional(),[lt]:yy.optional()}),Ee=b({_meta:js.optional()}),Tr=Ee.extend({task:_y.optional()}),vp=t=>Tr.safeParse(t).success,ae=b({method:h(),params:Ee.loose().optional()}),Re=b({_meta:js.optional()}),Ie=b({method:h(),params:Re.loose().optional()}),ce=_e({_meta:js.optional()}),qo=G([h(),F().int()]),$p=b({jsonrpc:S(Zo),id:qo,...ae.shape}).strict(),Zs=t=>$p.safeParse(t).success,bp=b({jsonrpc:S(Zo),...Ie.shape}).strict(),wp=t=>bp.safeParse(t).success,qs=b({jsonrpc:S(Zo),id:qo,result:ce}).strict(),Or=t=>qs.safeParse(t).success;var O;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(O||(O={}));var Ms=b({jsonrpc:S(Zo),id:qo.optional(),error:b({code:F().int(),message:h(),data:X().optional()})}).strict();var zp=t=>Ms.safeParse(t).success;var xp=G([$p,bp,qs,Ms]),rE=G([qs,Ms]),wt=ce.strict(),vy=Re.extend({requestId:qo.optional(),reason:h().optional()}),Mo=Ie.extend({method:S("notifications/cancelled"),params:vy}),$y=b({src:h(),mimeType:h().optional(),sizes:j(h()).optional(),theme:$e(["light","dark"]).optional()}),Rr=b({icons:j($y).optional()}),Ut=b({name:h(),title:h().optional()}),Sp=Ut.extend({...Ut.shape,...Rr.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),by=Co(b({applyDefaults:se().optional()}),J(h(),X())),wy=Ns(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Co(b({form:by.optional(),url:ne.optional()}),J(h(),X()).optional())),zy=_e({list:ne.optional(),cancel:ne.optional(),requests:_e({sampling:_e({createMessage:ne.optional()}).optional(),elicitation:_e({create:ne.optional()}).optional()}).optional()}),xy=_e({list:ne.optional(),cancel:ne.optional(),requests:_e({tools:_e({call:ne.optional()}).optional()}).optional()}),Sy=b({experimental:J(h(),ne).optional(),sampling:b({context:ne.optional(),tools:ne.optional()}).optional(),elicitation:wy.optional(),roots:b({listChanged:se().optional()}).optional(),tasks:zy.optional(),extensions:J(h(),ne).optional()}),ky=Ee.extend({protocolVersion:h(),capabilities:Sy,clientInfo:Sp}),Py=ae.extend({method:S("initialize"),params:ky});var Ey=b({experimental:J(h(),ne).optional(),logging:ne.optional(),completions:ne.optional(),prompts:b({listChanged:se().optional()}).optional(),resources:b({subscribe:se().optional(),listChanged:se().optional()}).optional(),tools:b({listChanged:se().optional()}).optional(),tasks:xy.optional(),extensions:J(h(),ne).optional()}),Ds=ce.extend({protocolVersion:h(),capabilities:Ey,serverInfo:Sp,instructions:h().optional()}),Ty=Ie.extend({method:S("notifications/initialized"),params:Re.optional()});var Do=ae.extend({method:S("ping"),params:Ee.optional()}),Oy=b({progress:F(),total:ee(F()),message:ee(h())}),Ry=b({...Re.shape,...Oy.shape,progressToken:_p}),Lo=Ie.extend({method:S("notifications/progress"),params:Ry}),Iy=Ee.extend({cursor:yp.optional()}),Ir=ae.extend({params:Iy.optional()}),Nr=ce.extend({nextCursor:yp.optional()}),Ny=$e(["working","input_required","completed","failed","cancelled"]),Ar=b({taskId:h(),status:Ny,ttl:G([F(),ap()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ee(F()),statusMessage:ee(h())}),zt=ce.extend({task:Ar}),Ay=Re.merge(Ar),Cr=Ie.extend({method:S("notifications/tasks/status"),params:Ay}),Uo=ae.extend({method:S("tasks/get"),params:Ee.extend({taskId:h()})}),Fo=ce.merge(Ar),Vo=ae.extend({method:S("tasks/result"),params:Ee.extend({taskId:h()})}),oE=ce.loose(),Ho=Ir.extend({method:S("tasks/list")}),Jo=Nr.extend({tasks:j(Ar)}),Ko=ae.extend({method:S("tasks/cancel"),params:Ee.extend({taskId:h()})}),kp=ce.merge(Ar),Pp=b({uri:h(),mimeType:ee(h()),_meta:J(h(),X()).optional()}),Ep=Pp.extend({text:h()}),Ls=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),Tp=Pp.extend({blob:Ls}),jr=$e(["user","assistant"]),Ft=b({audience:j(jr).optional(),priority:F().min(0).max(1).optional(),lastModified:Pr.datetime({offset:!0}).optional()}),Op=b({...Ut.shape,...Rr.shape,uri:h(),description:ee(h()),mimeType:ee(h()),size:ee(F()),annotations:Ft.optional(),_meta:ee(_e({}))}),Cy=b({...Ut.shape,...Rr.shape,uriTemplate:h(),description:ee(h()),mimeType:ee(h()),annotations:Ft.optional(),_meta:ee(_e({}))}),jy=Ir.extend({method:S("resources/list")}),Us=Nr.extend({resources:j(Op)}),Zy=Ir.extend({method:S("resources/templates/list")}),Fs=Nr.extend({resourceTemplates:j(Cy)}),Vs=Ee.extend({uri:h()}),qy=Vs,My=ae.extend({method:S("resources/read"),params:qy}),Hs=ce.extend({contents:j(G([Ep,Tp]))}),Js=Ie.extend({method:S("notifications/resources/list_changed"),params:Re.optional()}),Dy=Vs,Ly=ae.extend({method:S("resources/subscribe"),params:Dy}),Uy=Vs,Fy=ae.extend({method:S("resources/unsubscribe"),params:Uy}),Vy=Re.extend({uri:h()}),Hy=Ie.extend({method:S("notifications/resources/updated"),params:Vy}),Jy=b({name:h(),description:ee(h()),required:ee(se())}),Ky=b({...Ut.shape,...Rr.shape,description:ee(h()),arguments:ee(j(Jy)),_meta:ee(_e({}))}),By=Ir.extend({method:S("prompts/list")}),Ks=Nr.extend({prompts:j(Ky)}),Gy=Ee.extend({name:h(),arguments:J(h(),h()).optional()}),Wy=ae.extend({method:S("prompts/get"),params:Gy}),Bs=b({type:S("text"),text:h(),annotations:Ft.optional(),_meta:J(h(),X()).optional()}),Gs=b({type:S("image"),data:Ls,mimeType:h(),annotations:Ft.optional(),_meta:J(h(),X()).optional()}),Ws=b({type:S("audio"),data:Ls,mimeType:h(),annotations:Ft.optional(),_meta:J(h(),X()).optional()}),Yy=b({type:S("tool_use"),name:h(),id:h(),input:J(h(),X()),_meta:J(h(),X()).optional()}),Qy=b({type:S("resource"),resource:G([Ep,Tp]),annotations:Ft.optional(),_meta:J(h(),X()).optional()}),Xy=Op.extend({type:S("resource_link")}),Ys=G([Bs,Gs,Ws,Xy,Qy]),ev=b({role:jr,content:Ys}),Qs=ce.extend({description:h().optional(),messages:j(ev)}),Xs=Ie.extend({method:S("notifications/prompts/list_changed"),params:Re.optional()}),tv=b({title:h().optional(),readOnlyHint:se().optional(),destructiveHint:se().optional(),idempotentHint:se().optional(),openWorldHint:se().optional()}),rv=b({taskSupport:$e(["required","optional","forbidden"]).optional()}),Rp=b({...Ut.shape,...Rr.shape,description:h().optional(),inputSchema:b({type:S("object"),properties:J(h(),ne).optional(),required:j(h()).optional()}).catchall(X()),outputSchema:b({type:S("object"),properties:J(h(),ne).optional(),required:j(h()).optional()}).catchall(X()).optional(),annotations:tv.optional(),execution:rv.optional(),_meta:J(h(),X()).optional()}),ov=Ir.extend({method:S("tools/list")}),ei=Nr.extend({tools:j(Rp)}),Vt=ce.extend({content:j(Ys).default([]),structuredContent:J(h(),X()).optional(),isError:se().optional()}),nE=Vt.or(ce.extend({toolResult:X()})),nv=Tr.extend({name:h(),arguments:J(h(),X()).optional()}),sv=ae.extend({method:S("tools/call"),params:nv}),ti=Ie.extend({method:S("notifications/tools/list_changed"),params:Re.optional()}),Ip=b({autoRefresh:se().default(!0),debounceMs:F().int().nonnegative().default(300)}),Np=$e(["debug","info","notice","warning","error","critical","alert","emergency"]),iv=Ee.extend({level:Np}),av=ae.extend({method:S("logging/setLevel"),params:iv}),cv=Re.extend({level:Np,logger:h().optional(),data:X()}),uv=Ie.extend({method:S("notifications/message"),params:cv}),lv=b({name:h().optional()}),dv=b({hints:j(lv).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),pv=b({mode:$e(["auto","required","none"]).optional()}),fv=b({type:S("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:j(Ys).default([]),structuredContent:b({}).loose().optional(),isError:se().optional(),_meta:J(h(),X()).optional()}),mv=Is("type",[Bs,Gs,Ws]),jo=Is("type",[Bs,Gs,Ws,Yy,fv]),hv=b({role:jr,content:G([jo,j(jo)]),_meta:J(h(),X()).optional()}),gv=Tr.extend({messages:j(hv),modelPreferences:dv.optional(),systemPrompt:h().optional(),includeContext:$e(["none","thisServer","allServers"]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:j(h()).optional(),metadata:ne.optional(),tools:j(Rp).optional(),toolChoice:pv.optional()}),ri=ae.extend({method:S("sampling/createMessage"),params:gv}),oi=ce.extend({model:h(),stopReason:ee($e(["endTurn","stopSequence","maxTokens"]).or(h())),role:jr,content:mv}),ni=ce.extend({model:h(),stopReason:ee($e(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:jr,content:G([jo,j(jo)])}),_v=b({type:S("boolean"),title:h().optional(),description:h().optional(),default:se().optional()}),yv=b({type:S("string"),title:h().optional(),description:h().optional(),minLength:F().optional(),maxLength:F().optional(),format:$e(["email","uri","date","date-time"]).optional(),default:h().optional()}),vv=b({type:$e(["number","integer"]),title:h().optional(),description:h().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),$v=b({type:S("string"),title:h().optional(),description:h().optional(),enum:j(h()),default:h().optional()}),bv=b({type:S("string"),title:h().optional(),description:h().optional(),oneOf:j(b({const:h(),title:h()})),default:h().optional()}),wv=b({type:S("string"),title:h().optional(),description:h().optional(),enum:j(h()),enumNames:j(h()).optional(),default:h().optional()}),zv=G([$v,bv]),xv=b({type:S("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:b({type:S("string"),enum:j(h())}),default:j(h()).optional()}),Sv=b({type:S("array"),title:h().optional(),description:h().optional(),minItems:F().optional(),maxItems:F().optional(),items:b({anyOf:j(b({const:h(),title:h()}))}),default:j(h()).optional()}),kv=G([xv,Sv]),Pv=G([wv,zv,kv]),Ev=G([Pv,_v,yv,vv]),Tv=Tr.extend({mode:S("form").optional(),message:h(),requestedSchema:b({type:S("object"),properties:J(h(),Ev),required:j(h()).optional()})}),Ov=Tr.extend({mode:S("url"),message:h(),elicitationId:h(),url:h().url()}),Rv=G([Tv,Ov]),si=ae.extend({method:S("elicitation/create"),params:Rv}),Iv=Re.extend({elicitationId:h()}),Nv=Ie.extend({method:S("notifications/elicitation/complete"),params:Iv}),ii=ce.extend({action:$e(["accept","decline","cancel"]),content:Ns(t=>t===null?void 0:t,J(h(),G([h(),F(),se(),j(h())])).optional())}),Av=b({type:S("ref/resource"),uri:h()});var Cv=b({type:S("ref/prompt"),name:h()}),jv=Ee.extend({ref:G([Cv,Av]),argument:b({name:h(),value:h()}),context:b({arguments:J(h(),h()).optional()}).optional()}),Zv=ae.extend({method:S("completion/complete"),params:jv});var ai=ce.extend({completion:_e({values:j(h()).max(100),total:ee(F().int()),hasMore:ee(se())})}),qv=b({uri:h().startsWith("file://"),name:h().optional(),_meta:J(h(),X()).optional()}),Mv=ae.extend({method:S("roots/list"),params:Ee.optional()}),Dv=ce.extend({roots:j(qv)}),Lv=Ie.extend({method:S("notifications/roots/list_changed"),params:Re.optional()}),sE=G([Do,Py,Zv,av,Wy,By,jy,Zy,My,Ly,Fy,sv,ov,Uo,Vo,Ho,Ko]),iE=G([Mo,Lo,Ty,Lv,Cr]),aE=G([wt,oi,ni,ii,Dv,Fo,Jo,zt]),cE=G([Do,ri,si,Mv,Uo,Vo,Ho,Ko]),uE=G([Mo,Lo,uv,Hy,Js,ti,Xs,Cr,Nv]),lE=G([wt,Ds,ai,Qs,Ks,Us,Fs,Hs,Vt,ei,Fo,Jo,zt]),E=class t extends Error{constructor(e,r,o){super(`MCP error ${e}: ${r}`),this.code=e,this.data=o,this.name="McpError"}static fromError(e,r,o){if(e===O.UrlElicitationRequired&&o){let n=o;if(n.elicitations)return new As(n.elicitations,r)}return new t(e,r,o)}},As=class extends E{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(O.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function dt(t){return t==="completed"||t==="failed"||t==="cancelled"}var FE=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ci(t){let r=No(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=jd(r);if(typeof o!="string")throw new Error("Schema method literal must be a string");return o}function ui(t,e){let r=qe(t,e);if(!r.success)throw r.error;return r.data}var Kv=6e4,Bo=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Mo,r=>{this._oncancel(r)}),this.setNotificationHandler(Lo,r=>{this._onprogress(r)}),this.setRequestHandler(Do,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Uo,async(r,o)=>{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new E(O.InvalidParams,"Failed to retrieve task: Task not found");return{...n}}),this.setRequestHandler(Vo,async(r,o)=>{let n=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,o.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,p=new E(d.error.code,d.error.message,d.error.data);l(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:o.requestId})}}let i=await this._taskStore.getTask(s,o.sessionId);if(!i)throw new E(O.InvalidParams,`Task not found: ${s}`);if(!dt(i.status))return await this._waitForTaskUpdate(s,o.signal),await n();if(dt(i.status)){let a=await this._taskStore.getTaskResult(s,o.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[lt]:{taskId:s}}}}return await n()};return await n()}),this.setRequestHandler(Ho,async(r,o)=>{try{let{tasks:n,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,o.sessionId);return{tasks:n,nextCursor:s,_meta:{}}}catch(n){throw new E(O.InvalidParams,`Failed to list tasks: ${n instanceof Error?n.message:String(n)}`)}}),this.setRequestHandler(Ko,async(r,o)=>{try{let n=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!n)throw new E(O.InvalidParams,`Task not found: ${r.params.taskId}`);if(dt(n.status))throw new E(O.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",o.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,o.sessionId);if(!s)throw new E(O.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(n){throw n instanceof E?n:new E(O.InvalidRequest,`Failed to cancel task: ${n instanceof Error?n.message:String(n)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,o,n,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,r),startTime:Date.now(),timeout:r,maxTotalTimeout:o,resetTimeoutOnProgress:s,onTimeout:n})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let o=Date.now()-r.startTime;if(r.maxTotalTimeout&&o>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),E.fromError(O.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:o});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let o=this.transport?.onerror;this._transport.onerror=s=>{o?.(s),this._onerror(s)};let n=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{n?.(s,i),Or(s)||zp(s)?this._onresponse(s):Zs(s)?this._onrequest(s,i):wp(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let o of this._timeoutInfo.values())clearTimeout(o.timeoutId);this._timeoutInfo.clear();for(let o of this._requestHandlerAbortControllers.values())o.abort();this._requestHandlerAbortControllers.clear();let r=E.fromError(O.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let o of e.values())o(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(o=>this._onerror(new Error(`Uncaught error in notification handler: ${o}`)))}_onrequest(e,r){let o=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,s=e.params?._meta?.[lt]?.taskId;if(o===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:O.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},n?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):n?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=vp(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:i.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new E(O.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let m=f.relatedTask?.taskId??s;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>o(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:O.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},n?.sessionId):await n?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...o}=e.params,n=Number(r),s=this._progressHandlers.get(n);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}s(o)}_onresponse(e){let r=Number(e.id),o=this._requestResolvers.get(r);if(o){if(this._requestResolvers.delete(r),Or(e))o(e);else{let i=new E(e.error.code,e.error.message,e.error.data);o(i)}return}let n=this._responseHandlers.get(r);if(n===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=!1;if(Or(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),Or(e))n(e);else{let i=E.fromError(e.error.code,e.error.message,e.error.data);n(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,o){let{task:n}=o??{};if(!n){try{yield{type:"result",result:await this.request(e,r,o)}}catch(i){yield{type:"error",error:i instanceof E?i:new E(O.InternalError,String(i))}}return}let s;try{let i=await this.request(e,zt,o);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new E(O.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},o);if(yield{type:"taskStatus",task:a},dt(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)}:a.status==="failed"?yield{type:"error",error:new E(O.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new E(O.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,o)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),o?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof E?i:new E(O.InternalError,String(i))}}}request(e,r,o){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=o??{};return new Promise((u,l)=>{let d=w=>{l(w)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(w){d(w);return}o?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};o?.onprogress&&(this._progressHandlers.set(p,o.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[lt]:c}});let m=w=>{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(w)}},{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(P=>this._onerror(new Error(`Failed to send cancellation: ${P}`)));let z=w instanceof E?w:new E(O.RequestTimeout,String(w));l(z)};this._responseHandlers.set(p,w=>{if(!o?.signal?.aborted){if(w instanceof Error)return l(w);try{let z=qe(r,w.result);z.success?u(z.data):l(z.error)}catch(z){l(z)}}}),o?.signal?.addEventListener("abort",()=>{m(o?.signal?.reason)});let _=o?.timeout??Kv,y=()=>m(E.fromError(O.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(p,_,o?.maxTotalTimeout,y,o?.resetTimeoutOnProgress??!1);let $=c?.taskId;if($){let w=z=>{let P=this._responseHandlers.get(p);P?P(z):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,w),this._enqueueTaskMessage($,{type:"request",message:f,timestamp:Date.now()}).catch(z=>{this._cleanupTimeout(p),l(z)})}else this._transport.send(f,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(w=>{this._cleanupTimeout(p),l(w)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Fo,r)}async getTaskResult(e,r,o){return this.request({method:"tasks/result",params:e},r,o)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},Jo,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},kp,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let o=r?.relatedTask?.taskId;if(o){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[lt]:r.relatedTask}}};await this._enqueueTaskMessage(o,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[lt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[lt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let o=ci(e);this.assertRequestHandlerCapability(o),this._requestHandlers.set(o,(n,s)=>{let i=ui(e,n);return Promise.resolve(r(i,s))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let o=ci(e);this._notificationHandlers.set(o,n=>{let s=ui(e,n);return Promise.resolve(r(s))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,o){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,o,n)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let o=await this._taskMessageQueue.dequeueAll(e,r);for(let n of o)if(n.type==="request"&&Zs(n.message)){let s=n.message.id,i=this._requestResolvers.get(s);i?(i(new E(O.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let o=this._options?.defaultTaskPollInterval??1e3;try{let n=await this._taskStore?.getTask(e);n?.pollInterval&&(o=n.pollInterval)}catch{}return new Promise((n,s)=>{if(r.aborted){s(new E(O.InvalidRequest,"Request cancelled"));return}let i=setTimeout(n,o);r.addEventListener("abort",()=>{clearTimeout(i),s(new E(O.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let o=this._taskStore;if(!o)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await o.createTask(n,e.id,{method:e.method,params:e.params},r)},getTask:async n=>{let s=await o.getTask(n,r);if(!s)throw new E(O.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(n,s,i)=>{await o.storeTaskResult(n,s,i,r);let a=await o.getTask(n,r);if(a){let c=Cr.parse({method:"notifications/tasks/status",params:a});await this.notification(c),dt(a.status)&&this._cleanupTaskProgressHandler(n)}},getTaskResult:n=>o.getTaskResult(n,r),updateTaskStatus:async(n,s,i)=>{let a=await o.getTask(n,r);if(!a)throw new E(O.InvalidParams,`Task "${n}" not found - it may have been cleaned up`);if(dt(a.status))throw new E(O.InvalidParams,`Cannot update task "${n}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await o.updateTaskStatus(n,s,i,r);let c=await o.getTask(n,r);if(c){let u=Cr.parse({method:"notifications/tasks/status",params:c});await this.notification(u),dt(c.status)&&this._cleanupTaskProgressHandler(n)}},listTasks:n=>o.listTasks(n,r)}}};function Ap(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Cp(t,e){let r={...t};for(let o in e){let n=o,s=e[n];if(s===void 0)continue;let i=r[n];Ap(i)&&Ap(s)?r[n]={...i,...s}:r[n]=s}return r}var Ph=fr(Ga(),1),Eh=fr(kh(),1);function Wx(){let t=new Ph.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,Eh.default)(t),t}var On=class{constructor(e){this._ajv=e??Wx()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return o=>r(o)?{valid:!0,data:o,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Rn=class{constructor(e){this._client=e}async*callToolStream(e,r=Vt,o){let n=this._client,s={...o,task:o?.task??(n.isToolTask(e.name)?{}:void 0)},i=n.requestStream({method:"tools/call",params:e},r,s),a=n.getToolOutputValidator(e.name);for await(let c of i){if(c.type==="result"&&a){let u=c.result;if(!u.structuredContent&&!u.isError){yield{type:"error",error:new E(O.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(u.structuredContent)try{let l=a(u.structuredContent);if(!l.valid){yield{type:"error",error:new E(O.InvalidParams,`Structured content does not match the tool's output schema: ${l.errorMessage}`)};return}}catch(l){if(l instanceof E){yield{type:"error",error:l};return}yield{type:"error",error:new E(O.InvalidParams,`Failed to validate structured content: ${l instanceof Error?l.message:String(l)}`)};return}}yield c}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,o){return this._client.getTaskResult({taskId:e},r,o)}async listTasks(e,r){return this._client.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._client.cancelTask({taskId:e},r)}requestStream(e,r,o){return this._client.requestStream(e,r,o)}};function Th(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function Oh(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}function In(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,o=t.properties;for(let n of Object.keys(o)){let s=o[n];r[n]===void 0&&Object.prototype.hasOwnProperty.call(s,"default")&&(r[n]=s.default),r[n]!==void 0&&In(s,r[n])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&In(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&In(r,e)}}function Yx(t){if(!t)return{supportsFormMode:!1,supportsUrlMode:!1};let e=t.form!==void 0,r=t.url!==void 0;return{supportsFormMode:e||!e&&!r,supportsUrlMode:r}}var Nn=class extends Bo{constructor(e,r){super(r),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=r?.capabilities??{},this._jsonSchemaValidator=r?.jsonSchemaValidator??new On,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",ti,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",Xs,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",Js,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Rn(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Cp(this._capabilities,e)}setRequestHandler(e,r){let n=No(e)?.method;if(!n)throw new Error("Schema is missing a method literal");let s;if(Lt(n)){let a=n;s=a._zod?.def?.value??a.value}else{let a=n;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");let i=s;if(i==="elicitation/create"){let a=async(c,u)=>{let l=qe(si,c);if(!l.success){let w=l.error instanceof Error?l.error.message:String(l.error);throw new E(O.InvalidParams,`Invalid elicitation request: ${w}`)}let{params:d}=l.data;d.mode=d.mode??"form";let{supportsFormMode:p,supportsUrlMode:f}=Yx(this._capabilities.elicitation);if(d.mode==="form"&&!p)throw new E(O.InvalidParams,"Client does not support form-mode elicitation requests");if(d.mode==="url"&&!f)throw new E(O.InvalidParams,"Client does not support URL-mode elicitation requests");let m=await Promise.resolve(r(c,u));if(d.task){let w=qe(zt,m);if(!w.success){let z=w.error instanceof Error?w.error.message:String(w.error);throw new E(O.InvalidParams,`Invalid task creation result: ${z}`)}return w.data}let _=qe(ii,m);if(!_.success){let w=_.error instanceof Error?_.error.message:String(_.error);throw new E(O.InvalidParams,`Invalid elicitation result: ${w}`)}let y=_.data,$=d.mode==="form"?d.requestedSchema:void 0;if(d.mode==="form"&&y.action==="accept"&&y.content&&$&&this._capabilities.elicitation?.form?.applyDefaults)try{In($,y.content)}catch{}return y};return super.setRequestHandler(e,a)}if(i==="sampling/createMessage"){let a=async(c,u)=>{let l=qe(ri,c);if(!l.success){let y=l.error instanceof Error?l.error.message:String(l.error);throw new E(O.InvalidParams,`Invalid sampling request: ${y}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let y=qe(zt,p);if(!y.success){let $=y.error instanceof Error?y.error.message:String(y.error);throw new E(O.InvalidParams,`Invalid task creation result: ${$}`)}return y.data}let m=d.tools||d.toolChoice?ni:oi,_=qe(m,p);if(!_.success){let y=_.error instanceof Error?_.error.message:String(_.error);throw new E(O.InvalidParams,`Invalid sampling result: ${y}`)}return _.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}assertCapability(e,r){if(!this._serverCapabilities?.[e])throw new Error(`Server does not support ${e} (required for ${r})`)}async connect(e,r){if(await super.connect(e),e.sessionId===void 0)try{let o=await this.request({method:"initialize",params:{protocolVersion:Cs,capabilities:this._capabilities,clientInfo:this._clientInfo}},Ds,r);if(o===void 0)throw new Error(`Server sent invalid initialize result: ${o}`);if(!gp.includes(o.protocolVersion))throw new Error(`Server's protocol version is not supported: ${o.protocolVersion}`);this._serverCapabilities=o.capabilities,this._serverVersion=o.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(o.protocolVersion),this._instructions=o.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(o){throw this.close(),o}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){switch(e){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new 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 new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new 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 new 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)switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new 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 new Error(`Client does not support tasks capability (required for ${e})`);break;case"ping":break}}assertTaskCapability(e){Th(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&Oh(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},wt,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},ai,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},wt,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},Qs,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},Ks,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},Us,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},Fs,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},Hs,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},wt,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},wt,r)}async callTool(e,r=Vt,o){if(this.isToolTaskRequired(e.name))throw new E(O.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let n=await this.request({method:"tools/call",params:e},r,o),s=this.getToolOutputValidator(e.name);if(s){if(!n.structuredContent&&!n.isError)throw new E(O.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(n.structuredContent)try{let i=s(n.structuredContent);if(!i.valid)throw new E(O.InvalidParams,`Structured content does not match the tool's output schema: ${i.errorMessage}`)}catch(i){throw i instanceof E?i:new E(O.InvalidParams,`Failed to validate structured content: ${i instanceof Error?i.message:String(i)}`)}}return n}isToolTask(e){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(e):!1}isToolTaskRequired(e){return this._cachedRequiredTaskTools.has(e)}cacheToolMetadata(e){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let r of e){if(r.outputSchema){let n=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,n)}let o=r.execution?.taskSupport;(o==="required"||o==="optional")&&this._cachedKnownTaskTools.add(r.name),o==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let o=await this.request({method:"tools/list",params:e},ei,r);return this.cacheToolMetadata(o.tools),o}_setupListChangedHandler(e,r,o,n){let s=Ip.safeParse(o);if(!s.success)throw new Error(`Invalid ${e} listChanged options: ${s.error.message}`);if(typeof o.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:i,debounceMs:a}=s.data,{onChanged:c}=o,u=async()=>{if(!i){c(null,null);return}try{let d=await n();c(null,d)}catch(d){let p=d instanceof Error?d:new Error(String(d));c(p,null)}},l=()=>{if(a){let d=this._listChangedDebounceTimers.get(e);d&&clearTimeout(d);let p=setTimeout(u,a);this._listChangedDebounceTimers.set(e,p)}else u()};this.setNotificationHandler(r,l)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var $g=fr(yg(),1),Zn=fr(require("process"),1),bg=require("stream");var Cn=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
72
+ `);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),xS(r)}clear(){this._buffer=void 0}};function xS(t){return xp.parse(JSON.parse(t))}function vg(t){return JSON.stringify(t)+`
73
+ `}var SS=Zn.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function kS(){let t={};for(let e of SS){let r=Zn.default.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}var jn=class{constructor(e){this._readBuffer=new Cn,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new bg.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._process=(0,$g.default)(this._serverParams.command,this._serverParams.args??[],{env:{...kS(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:Zn.default.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",o=>{r(o),this.onerror?.(o)}),this._process.on("spawn",()=>{e()}),this._process.on("close",o=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",o=>{this.onerror?.(o)}),this._process.stdout?.on("data",o=>{this._readBuffer.append(o),this.processReadBuffer()}),this._process.stdout?.on("error",o=>{this.onerror?.(o)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)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 r=new Promise(o=>{e.once("close",()=>{o()})});try{e.stdin?.end()}catch{}if(await Promise.race([r,new Promise(o=>setTimeout(o,2e3).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(o=>setTimeout(o,2e3).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(r=>{if(!this._process?.stdin)throw new Error("Not connected");let o=vg(e);this._process.stdin.write(o)?r():this._process.stdin.once("drain",r)})}};var pe=fr(require("vscode"),1);var qn={recall:{title:"ZAM Recall",toolName:"zam_open_recall",allowedTools:new Set(["zam_get_reviews","zam_submit_review"])},graph:{title:"ZAM Graph",toolName:"zam_show_graph",allowedTools:new Set(["zam_studio_bridge"])},settings:{title:"ZAM Settings",toolName:"zam_open_settings",allowedTools:new Set(["zam_studio_bridge"])}};function wg(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function zg(t,e=Date.now(),r=3e4){if(!wg(t)||t.version!==1||typeof t.id!="string"||typeof t.app!="string"||!(t.app in qn)||typeof t.createdAt!="string"||!wg(t.input))return;let o=Date.parse(t.createdAt);if(!Number.isFinite(o)||o>e+5e3||e-o>r)return;let n=Object.fromEntries(Object.entries(t.input).filter(s=>typeof s[1]=="string"));return{version:1,id:t.id,app:t.app,input:n,createdAt:t.createdAt}}function xg(t,e){return Object.fromEntries((t==="recall"?["user","domain"]:t==="graph"?["user","focus"]:["user"]).flatMap(o=>typeof e[o]=="string"?[[o,e[o]]]:[]))}function Sg(t){let e=t._meta,r=e?.ui?.resourceUri,o=e?.["ui/resourceUri"];return typeof r=="string"?r:typeof o=="string"?o:void 0}var PS="zamCompanion",ES="zam.companion",kg="ZAM wartet auf eine Auswahl im Agent-Chat. Starte mit $zam oder \xF6ffne Recall, Graph oder Settings \xFCber die Befehlspalette.";function pc(t){return t instanceof Error?t.message:String(t)}function TS(){return{...Object.fromEntries(Object.entries(process.env).filter(t=>typeof t[1]=="string")),ZAM_DISABLE_UI_INTENT:"1"}}async function OS(t){try{let e=JSON.parse(await(0,st.readFile)(t,"utf8"));if(typeof e.command=="string"&&Array.isArray(e.args)&&e.args.every(r=>typeof r=="string"))return{command:e.command,args:e.args}}catch{}return{command:process.env.ZAM_BIN??"zam",args:["mcp"]}}var fc=class{constructor(e,r){this.launchConfigPath=e;this.output=r}launchConfigPath;output;connectionPromise;async connect(){return this.connectionPromise||(this.connectionPromise=(async()=>{let e=await OS(this.launchConfigPath),r=new jn({command:e.command,args:e.args,env:TS(),stderr:"pipe"});r.stderr?.on("data",n=>{this.output.appendLine(`[zam mcp] ${(Buffer.isBuffer(n)?n.toString("utf8"):n).trimEnd()}`)});let o=new Nn({name:"vscode-zam-companion",version:"__ZAM_VERSION__"});return await o.connect(r),{client:o,transport:r}})().catch(e=>{throw this.connectionPromise=void 0,e})),this.connectionPromise}async client(){return(await this.connect()).client}async prepare(e,r){let o=qn[e],n=await this.client(),{tools:s}=await n.listTools(),i=s.find(m=>m.name===o.toolName);if(!i)throw new Error(`ZAM MCP tool not found: ${o.toolName}`);let a=Sg(i);if(!a)throw new Error(`${o.toolName} does not advertise an MCP App`);let c=xg(e,r),[u,l]=await Promise.all([n.callTool({name:o.toolName,arguments:c}),n.readResource({uri:a})]),d=u;if(d.isError){let m=d.content?.find(_=>_.type==="text");throw new Error(m&&"text"in m?m.text:`${o.toolName} failed`)}let p=l.contents.find(m=>m.uri===a)??l.contents[0],f=p&&"text"in p&&typeof p.text=="string"?p.text:p&&"blob"in p&&typeof p.blob=="string"?Buffer.from(p.blob,"base64").toString("utf8"):"";if(!f)throw new Error(`MCP App resource is empty: ${a}`);return{appHtml:f,config:o,kind:e,resourceUri:a,tool:i,toolArguments:c,toolResult:d}}async close(){let e=await this.connectionPromise?.catch(()=>{});this.connectionPromise=void 0,await e?.client.close().catch(()=>{})}},mc=class{constructor(e,r,o){this.extensionUri=e;this.mcp=r;this.output=o}extensionUri;mcp;output;view;hostReady=!1;prepared;resolveWebviewView(e){this.view=e,this.hostReady=!1,e.webview.options={enableScripts:!0},e.webview.html=this.renderHostHtml(e.webview),e.webview.onDidReceiveMessage(r=>{this.handleMessage(r)}),e.onDidDispose(()=>{this.view=void 0,this.hostReady=!1})}async open(e,r={}){await pe.commands.executeCommand(`workbench.view.extension.${PS}`),this.view?.show(!0),this.setEmpty(`${qn[e].title} wird geladen \u2026`);try{this.prepared=await this.mcp.prepare(e,r),this.sendBootstrap(),this.output.appendLine(`[${new Date().toISOString()}] opened ${e} via ${this.prepared.resourceUri}`)}catch(o){let n=pc(o);this.setEmpty(`ZAM konnte nicht ge\xF6ffnet werden: ${n}`),this.output.appendLine(`[${new Date().toISOString()}] failed to open ${e}: ${n}`),pe.window.showErrorMessage(`ZAM Companion: ${n}`)}}async handleMessage(e){if(e.type==="ready"){this.hostReady=!0,this.output.appendLine(`[${new Date().toISOString()}] webview host ready`),this.prepared?this.sendBootstrap():this.setEmpty(kg);return}let r=typeof e.id=="number"?e.id:void 0;if(r!==void 0)try{let o={};if(e.type==="callTool")o=await this.callTool(e.payload);else if(e.type==="openLink")o=await this.openLink(e.payload);else if(e.type==="modelContext")o={};else if(e.type==="status")this.output.appendLine(`[${new Date().toISOString()}] webview ${JSON.stringify(e.payload)}`);else throw new Error(`Unknown ZAM Companion message: ${String(e.type)}`);await this.view?.webview.postMessage({type:"response",id:r,result:o})}catch(o){await this.view?.webview.postMessage({type:"response",id:r,error:pc(o)})}}async callTool(e){if(!this.prepared||!e||typeof e!="object")throw new Error("No active ZAM MCP App");let r=e;if(typeof r.name!="string"||!this.prepared.config.allowedTools.has(r.name))throw new Error(`Tool is not allowed for ${this.prepared.kind}: ${String(r.name)}`);let o=r.arguments&&typeof r.arguments=="object"&&!Array.isArray(r.arguments)?r.arguments:{};return await(await this.mcp.client()).callTool({name:r.name,arguments:o})}async openLink(e){if(!e||typeof e!="object")throw new Error("Invalid link request");let r=e.url;if(typeof r!="string")throw new Error("Invalid link URL");let o=pe.Uri.parse(r,!0);if(o.scheme!=="https"&&o.scheme!=="http")throw new Error(`Blocked link scheme: ${o.scheme}`);return await pe.env.openExternal(o)?{}:{isError:!0}}sendBootstrap(){!this.hostReady||!this.prepared||!this.view||(this.output.appendLine(`[${new Date().toISOString()}] sending ${this.prepared.kind} bootstrap`),this.view.webview.postMessage({type:"bootstrap",payload:{appHtml:this.prepared.appHtml,title:this.prepared.config.title,tool:this.prepared.tool,toolArguments:this.prepared.toolArguments,toolResult:this.prepared.toolResult}}))}setEmpty(e){!this.hostReady||!this.view||this.view.webview.postMessage({type:"empty",message:e})}renderHostHtml(e){let r=e.asWebviewUri(pe.Uri.joinPath(this.extensionUri,"media","host.bundle.js"));return`<!doctype html>
74
+ <html lang="de">
75
+ <head>
76
+ <meta charset="utf-8" />
77
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
78
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src ${e.cspSource} 'unsafe-inline' blob:; style-src 'unsafe-inline'; frame-src blob:; img-src data: blob:;" />
79
+ <title>ZAM Companion</title>
80
+ <style>
81
+ * { box-sizing: border-box; }
82
+ html, body { width: 100%; height: 100%; margin: 0; }
83
+ body {
84
+ overflow: hidden;
85
+ color: var(--vscode-foreground);
86
+ background: var(--vscode-panel-background, var(--vscode-sideBar-background));
87
+ font-family: var(--vscode-font-family, system-ui, sans-serif);
88
+ }
89
+ #status {
90
+ position: absolute;
91
+ inset: 0;
92
+ display: grid;
93
+ place-items: center;
94
+ padding: 24px;
95
+ color: var(--vscode-descriptionForeground);
96
+ text-align: center;
97
+ line-height: 1.45;
98
+ }
99
+ #app { width: 100%; height: 100%; border: 0; background: transparent; }
100
+ body.ready #status { display: none; }
101
+ </style>
102
+ </head>
103
+ <body>
104
+ <div id="status" role="status">${kg}</div>
105
+ <iframe id="app" title="ZAM Companion" sandbox="allow-scripts allow-forms"></iframe>
106
+ <script type="module" src="${r}"></script>
107
+ </body>
108
+ </html>`}};async function RS(t,e){let r=(0,nt.join)((0,nt.dirname)(t),`.vscode-host-${process.pid}.tmp`);await(0,st.mkdir)((0,nt.dirname)(t),{recursive:!0}),await(0,st.writeFile)(r,`${JSON.stringify({version:1,intentPath:e,updatedAt:new Date().toISOString()},null,2)}
109
+ `,"utf8"),await(0,st.rename)(r,t)}var hc;async function IS(t){let e=(0,nt.join)((0,Pg.homedir)(),".zam"),r=process.env.ZAM_UI_INTENT_PATH??(0,nt.join)(e,"ui-intent.json"),o=(0,nt.join)(e,"vscode-host.json"),n=(0,nt.join)(e,"vscode-launch.json"),s=pe.window.createOutputChannel("ZAM Companion",{log:!0}),i=new fc(n,s);hc=i;let a=new mc(t.extensionUri,i,s);t.subscriptions.push(s,pe.window.registerWebviewViewProvider(ES,a),pe.commands.registerCommand("zam.openRecall",()=>a.open("recall")),pe.commands.registerCommand("zam.showGraph",()=>a.open("graph")),pe.commands.registerCommand("zam.openSettings",()=>a.open("settings")));let c,u=async()=>{if(pe.window.state.focused)try{let f=zg(JSON.parse(await(0,st.readFile)(r,"utf8")));if(!f||f.id===c)return;c=f.id,await a.open(f.app,f.input)}catch{}},l=()=>{u()};(0,Mn.watchFile)(r,{interval:300},l),t.subscriptions.push({dispose:()=>(0,Mn.unwatchFile)(r,l)});let d=()=>{pe.window.state.focused&&RS(o,r).catch(f=>{s.warn(`Could not publish VS Code host registration: ${pc(f)}`)})};d();let p=setInterval(d,5e3);t.subscriptions.push({dispose:()=>clearInterval(p)},pe.window.onDidChangeWindowState(f=>{f.focused&&(d(),u())}))}async function NS(){await hc?.close(),hc=void 0}0&&(module.exports={activate,deactivate});