@smithery/cli 4.5.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/automation.js +45 -0
- package/dist/index.js +322 -272
- package/package.json +4 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
var vw=Object.create;var bu=Object.defineProperty;var bw=Object.getOwnPropertyDescriptor;var $w=Object.getOwnPropertyNames;var xw=Object.getPrototypeOf,ww=Object.prototype.hasOwnProperty;var fr=(t,e)=>()=>(t&&(e=t(t=0)),e);var O=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cr=(t,e)=>{for(var r in e)bu(t,r,{get:e[r],enumerable:!0})},kw=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of $w(e))!ww.call(t,o)&&o!==r&&bu(t,o,{get:()=>e[o],enumerable:!(n=bw(e,o))||n.enumerable});return t};var Fa=(t,e,r)=>(r=t!=null?vw(xw(t)):{},kw(e||!t||!t.__esModule?bu(r,"default",{value:t,enumerable:!0}):r,t));var c=fr(()=>{});var Bi=O(ie=>{"use strict";c();Object.defineProperty(ie,"__esModule",{value:!0});ie.regexpCode=ie.getEsmExportName=ie.getProperty=ie.safeStringify=ie.stringify=ie.strConcat=ie.addCodeArg=ie.str=ie._=ie.nil=ie._Code=ie.Name=ie.IDENTIFIER=ie._CodeOrName=void 0;var Hi=class{};ie._CodeOrName=Hi;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Gr=class extends Hi{constructor(e){if(super(),!ie.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}}};ie.Name=Gr;var wt=class extends Hi{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,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Gr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=wt;ie.nil=new wt("");function kv(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Pp(r,e[n]),r.push(t[++n]);return new wt(r)}ie._=kv;var Ip=new wt("+");function Sv(t,...e){let r=[Ki(t[0])],n=0;for(;n<e.length;)r.push(Ip),Pp(r,e[n]),r.push(Ip,Ki(t[++n]));return aI(r),new wt(r)}ie.str=Sv;function Pp(t,e){e instanceof wt?t.push(...e._items):e instanceof Gr?t.push(e):t.push(uI(e))}ie.addCodeArg=Pp;function aI(t){let e=1;for(;e<t.length-1;){if(t[e]===Ip){let r=sI(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function sI(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Gr||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 Gr))return`"${t}${e.slice(1)}`}function cI(t,e){return e.emptyStr()?t:t.emptyStr()?e:Sv`${t}${e}`}ie.strConcat=cI;function uI(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Ki(Array.isArray(t)?t.join(","):t)}function lI(t){return new wt(Ki(t))}ie.stringify=lI;function Ki(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=Ki;function dI(t){return typeof t=="string"&&ie.IDENTIFIER.test(t)?new wt(`.${t}`):kv`[${t}]`}ie.getProperty=dI;function fI(t){if(typeof t=="string"&&ie.IDENTIFIER.test(t))return new wt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ie.getEsmExportName=fI;function pI(t){return new wt(t.toString())}ie.regexpCode=pI});var Tp=O(at=>{"use strict";c();Object.defineProperty(at,"__esModule",{value:!0});at.ValueScope=at.ValueScopeName=at.Scope=at.varKinds=at.UsedValueState=void 0;var it=Bi(),jp=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},cc;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(cc||(at.UsedValueState=cc={}));at.varKinds={const:new it.Name("const"),let:new it.Name("let"),var:new it.Name("var")};var uc=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof it.Name?e:this.name(e)}name(e){return new it.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};at.Scope=uc;var lc=class extends it.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,it._)`.${new it.Name(r)}[${n}]`}};at.ValueScopeName=lc;var mI=(0,it._)`\n`,Op=class extends uc{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?mI:it.nil}}get(){return this._scope}name(e){return new lc(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let d=s.get(a);if(d)return d}else s=this._values[i]=new Map;s.set(a,o);let u=this._scope[i]||(this._scope[i]=[]),l=u.length;return u[l]=r.ref,o.setValue(r,{property:i,itemIndex:l}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,it._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=it.nil;for(let a in e){let s=e[a];if(!s)continue;let u=n[a]=n[a]||new Map;s.forEach(l=>{if(u.has(l))return;u.set(l,cc.Started);let d=r(l);if(d){let f=this.opts.es5?at.varKinds.var:at.varKinds.const;i=(0,it._)`${i}${f} ${l} = ${d};${this.opts._n}`}else if(d=o?.(l))i=(0,it._)`${i}${d}${this.opts._n}`;else throw new jp(l);u.set(l,cc.Completed)})}return i}};at.ValueScope=Op});var W=O(X=>{"use strict";c();Object.defineProperty(X,"__esModule",{value:!0});X.or=X.and=X.not=X.CodeGen=X.operators=X.varKinds=X.ValueScopeName=X.ValueScope=X.Scope=X.Name=X.regexpCode=X.stringify=X.getProperty=X.nil=X.strConcat=X.str=X._=void 0;var re=Bi(),Tt=Tp(),kr=Bi();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return kr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return kr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return kr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return kr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return kr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return kr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return kr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return kr.Name}});var mc=Tp();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return mc.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return mc.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return mc.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return mc.varKinds}});X.operators={GT:new re._Code(">"),GTE:new re._Code(">="),LT:new re._Code("<"),LTE:new re._Code("<="),EQ:new re._Code("==="),NEQ:new re._Code("!=="),NOT:new re._Code("!"),OR:new re._Code("||"),AND:new re._Code("&&"),ADD:new re._Code("+")};var rr=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Ep=class extends rr{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Tt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Wn(this.rhs,e,r)),this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}},dc=class extends rr{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof re.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Wn(this.rhs,e,r),this}get names(){let e=this.lhs instanceof re.Name?{}:{...this.lhs.names};return pc(e,this.rhs)}},Np=class extends dc{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Rp=class extends rr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Ap=class extends rr{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Up=class extends rr{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Cp=class extends rr{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=Wn(this.code,e,r),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}},Wi=class extends rr{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(hI(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Qr(e,r.names),{})}},nr=class extends Wi{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Dp=class extends Wi{},Bn=class extends nr{};Bn.kind="else";var Xr=class t extends nr{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 n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Bn(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(zv(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Wn(this.condition,e,r),this}get names(){let e=super.names;return pc(e,this.condition),this.else&&Qr(e,this.else.names),e}};Xr.kind="if";var Yr=class extends nr{};Yr.kind="for";var Zp=class extends Yr{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=Wn(this.iteration,e,r),this}get names(){return Qr(super.names,this.iteration.names)}},Mp=class extends Yr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Tt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=pc(super.names,this.from);return pc(e,this.to)}},fc=class extends Yr{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}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=Wn(this.iterable,e,r),this}get names(){return Qr(super.names,this.iterable.names)}},Gi=class extends nr{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Gi.kind="func";var Xi=class extends Wi{render(e){return"return "+super.render(e)}};Xi.kind="return";var qp=class extends nr{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 n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Qr(e,this.catch.names),this.finally&&Qr(e,this.finally.names),e}},Yi=class extends nr{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};Yi.kind="catch";var Qi=class extends nr{render(e){return"finally"+super.render(e)}};Qi.kind="finally";var Lp=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new Tt.Scope({parent:e}),this._nodes=[new Dp]}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 n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}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,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Ep(e,i,n)),i}const(e,r,n){return this._def(Tt.varKinds.const,e,r,n)}let(e,r,n){return this._def(Tt.varKinds.let,e,r,n)}var(e,r,n){return this._def(Tt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new dc(e,r,n))}add(e,r){return this._leafNode(new Np(e,X.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==re.nil&&this._leafNode(new Cp(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,re.addCodeArg)(r,o));return r.push("}"),new re._Code(r)}if(e,r,n){if(this._blockNode(new Xr(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Xr(e))}else(){return this._elseNode(new Bn)}endIf(){return this._endBlockNode(Xr,Bn)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Zp(e),r)}forRange(e,r,n,o,i=this.opts.es5?Tt.varKinds.var:Tt.varKinds.let){let a=this._scope.toName(e);return this._for(new Mp(i,a,r,n),()=>o(a))}forOf(e,r,n,o=Tt.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let a=r instanceof re.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,re._)`${a}.length`,s=>{this.var(i,(0,re._)`${a}[${s}]`),n(i)})}return this._for(new fc("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?Tt.varKinds.var:Tt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,re._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new fc("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Yr)}label(e){return this._leafNode(new Rp(e))}break(e){return this._leafNode(new Ap(e))}return(e){let r=new Xi;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Xi)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new qp;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new Yi(i),r(i)}return n&&(this._currNode=o.finally=new Qi,this.code(n)),this._endBlockNode(Yi,Qi)}throw(e){return this._leafNode(new Up(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 n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=re.nil,n,o){return this._blockNode(new Gi(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Gi)}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 n=this._currNode;if(n instanceof e||r&&n 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 Xr))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}};X.CodeGen=Lp;function Qr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function pc(t,e){return e instanceof re._CodeOrName?Qr(t,e.names):t}function Wn(t,e,r){if(t instanceof re.Name)return n(t);if(!o(t))return t;return new re._Code(t._items.reduce((i,a)=>(a instanceof re.Name&&(a=n(a)),a instanceof re._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||e[i.str]!==1?i:(delete e[i.str],a)}function o(i){return i instanceof re._Code&&i._items.some(a=>a instanceof re.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function hI(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function zv(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,re._)`!${Fp(t)}`}X.not=zv;var gI=Iv(X.operators.AND);function yI(...t){return t.reduce(gI)}X.and=yI;var _I=Iv(X.operators.OR);function vI(...t){return t.reduce(_I)}X.or=vI;function Iv(t){return(e,r)=>e===re.nil?r:r===re.nil?e:(0,re._)`${Fp(e)} ${t} ${Fp(r)}`}function Fp(t){return t instanceof re.Name?t:(0,re._)`(${t})`}});var ae=O(Y=>{"use strict";c();Object.defineProperty(Y,"__esModule",{value:!0});Y.checkStrictMode=Y.getErrorPath=Y.Type=Y.useFunc=Y.setEvaluated=Y.evaluatedPropsToName=Y.mergeEvaluated=Y.eachItem=Y.unescapeJsonPointer=Y.escapeJsonPointer=Y.escapeFragment=Y.unescapeFragment=Y.schemaRefOrVal=Y.schemaHasRulesButRef=Y.schemaHasRules=Y.checkUnknownRules=Y.alwaysValidSchema=Y.toHash=void 0;var he=W(),bI=Bi();function $I(t){let e={};for(let r of t)e[r]=!0;return e}Y.toHash=$I;function xI(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Ov(t,e),!Tv(e,t.self.RULES.all))}Y.alwaysValidSchema=xI;function Ov(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||Rv(t,`unknown keyword: "${i}"`)}Y.checkUnknownRules=Ov;function Tv(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}Y.schemaHasRules=Tv;function wI(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}Y.schemaHasRulesButRef=wI;function kI({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,he._)`${r}`}return(0,he._)`${t}${e}${(0,he.getProperty)(n)}`}Y.schemaRefOrVal=kI;function SI(t){return Ev(decodeURIComponent(t))}Y.unescapeFragment=SI;function zI(t){return encodeURIComponent(Jp(t))}Y.escapeFragment=zI;function Jp(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}Y.escapeJsonPointer=Jp;function Ev(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}Y.unescapeJsonPointer=Ev;function II(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}Y.eachItem=II;function Pv({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let u=a===void 0?i:a instanceof he.Name?(i instanceof he.Name?t(o,i,a):e(o,i,a),a):i instanceof he.Name?(e(o,a,i),i):r(i,a);return s===he.Name&&!(u instanceof he.Name)?n(o,u):u}}Y.mergeEvaluated={props:Pv({mergeNames:(t,e,r)=>t.if((0,he._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,he._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,he._)`${r} || {}`).code((0,he._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,he._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,he._)`${r} || {}`),Hp(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Nv}),items:Pv({mergeNames:(t,e,r)=>t.if((0,he._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,he._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,he._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,he._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Nv(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,he._)`{}`);return e!==void 0&&Hp(t,r,e),r}Y.evaluatedPropsToName=Nv;function Hp(t,e,r){Object.keys(r).forEach(n=>t.assign((0,he._)`${e}${(0,he.getProperty)(n)}`,!0))}Y.setEvaluated=Hp;var jv={};function PI(t,e){return t.scopeValue("func",{ref:e,code:jv[e.code]||(jv[e.code]=new bI._Code(e.code))})}Y.useFunc=PI;var Vp;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Vp||(Y.Type=Vp={}));function jI(t,e,r){if(t instanceof he.Name){let n=e===Vp.Num;return r?n?(0,he._)`"[" + ${t} + "]"`:(0,he._)`"['" + ${t} + "']"`:n?(0,he._)`"/" + ${t}`:(0,he._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,he.getProperty)(t).toString():"/"+Jp(t)}Y.getErrorPath=jI;function Rv(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}Y.checkStrictMode=Rv});var or=O(Kp=>{"use strict";c();Object.defineProperty(Kp,"__esModule",{value:!0});var Ve=W(),OI={data:new Ve.Name("data"),valCxt:new Ve.Name("valCxt"),instancePath:new Ve.Name("instancePath"),parentData:new Ve.Name("parentData"),parentDataProperty:new Ve.Name("parentDataProperty"),rootData:new Ve.Name("rootData"),dynamicAnchors:new Ve.Name("dynamicAnchors"),vErrors:new Ve.Name("vErrors"),errors:new Ve.Name("errors"),this:new Ve.Name("this"),self:new Ve.Name("self"),scope:new Ve.Name("scope"),json:new Ve.Name("json"),jsonPos:new Ve.Name("jsonPos"),jsonLen:new Ve.Name("jsonLen"),jsonPart:new Ve.Name("jsonPart")};Kp.default=OI});var ea=O(Je=>{"use strict";c();Object.defineProperty(Je,"__esModule",{value:!0});Je.extendErrors=Je.resetErrorsCount=Je.reportExtraError=Je.reportError=Je.keyword$DataError=Je.keywordError=void 0;var oe=W(),hc=ae(),et=or();Je.keywordError={message:({keyword:t})=>(0,oe.str)`must pass "${t}" keyword validation`};Je.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,oe.str)`"${t}" keyword must be ${e} ($data)`:(0,oe.str)`"${t}" keyword is invalid ($data)`};function TI(t,e=Je.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:a,allErrors:s}=o,u=Cv(t,e,r);n??(a||s)?Av(i,u):Uv(o,(0,oe._)`[${u}]`)}Je.reportError=TI;function EI(t,e=Je.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:a}=n,s=Cv(t,e,r);Av(o,s),i||a||Uv(n,et.default.vErrors)}Je.reportExtraError=EI;function NI(t,e){t.assign(et.default.errors,e),t.if((0,oe._)`${et.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,oe._)`${et.default.vErrors}.length`,e),()=>t.assign(et.default.vErrors,null)))}Je.resetErrorsCount=NI;function RI({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",o,et.default.errors,s=>{t.const(a,(0,oe._)`${et.default.vErrors}[${s}]`),t.if((0,oe._)`${a}.instancePath === undefined`,()=>t.assign((0,oe._)`${a}.instancePath`,(0,oe.strConcat)(et.default.instancePath,i.errorPath))),t.assign((0,oe._)`${a}.schemaPath`,(0,oe.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,oe._)`${a}.schema`,r),t.assign((0,oe._)`${a}.data`,n))})}Je.extendErrors=RI;function Av(t,e){let r=t.const("err",e);t.if((0,oe._)`${et.default.vErrors} === null`,()=>t.assign(et.default.vErrors,(0,oe._)`[${r}]`),(0,oe._)`${et.default.vErrors}.push(${r})`),t.code((0,oe._)`${et.default.errors}++`)}function Uv(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,oe._)`new ${t.ValidationError}(${e})`):(r.assign((0,oe._)`${n}.errors`,e),r.return(!1))}var en={keyword:new oe.Name("keyword"),schemaPath:new oe.Name("schemaPath"),params:new oe.Name("params"),propertyName:new oe.Name("propertyName"),message:new oe.Name("message"),schema:new oe.Name("schema"),parentSchema:new oe.Name("parentSchema")};function Cv(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,oe._)`{}`:AI(t,e,r)}function AI(t,e,r={}){let{gen:n,it:o}=t,i=[UI(o,r),CI(t,r)];return DI(t,e,i),n.object(...i)}function UI({errorPath:t},{instancePath:e}){let r=e?(0,oe.str)`${t}${(0,hc.getErrorPath)(e,hc.Type.Str)}`:t;return[et.default.instancePath,(0,oe.strConcat)(et.default.instancePath,r)]}function CI({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,oe.str)`${e}/${t}`;return r&&(o=(0,oe.str)`${o}${(0,hc.getErrorPath)(r,hc.Type.Str)}`),[en.schemaPath,o]}function DI(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=t,{opts:u,propertyName:l,topSchemaRef:d,schemaPath:f}=s;n.push([en.keyword,o],[en.params,typeof e=="function"?e(t):e||(0,oe._)`{}`]),u.messages&&n.push([en.message,typeof r=="function"?r(t):r]),u.verbose&&n.push([en.schema,a],[en.parentSchema,(0,oe._)`${d}${f}`],[et.default.data,i]),l&&n.push([en.propertyName,l])}});var Zv=O(Gn=>{"use strict";c();Object.defineProperty(Gn,"__esModule",{value:!0});Gn.boolOrEmptySchema=Gn.topBoolOrEmptySchema=void 0;var ZI=ea(),MI=W(),qI=or(),LI={message:"boolean schema is false"};function FI(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Dv(t,!1):typeof r=="object"&&r.$async===!0?e.return(qI.default.data):(e.assign((0,MI._)`${n}.errors`,null),e.return(!0))}Gn.topBoolOrEmptySchema=FI;function VI(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Dv(t)):r.var(e,!0)}Gn.boolOrEmptySchema=VI;function Dv(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,ZI.reportError)(o,LI,void 0,e)}});var Bp=O(Xn=>{"use strict";c();Object.defineProperty(Xn,"__esModule",{value:!0});Xn.getRules=Xn.isJSONType=void 0;var JI=["string","number","integer","boolean","null","object","array"],HI=new Set(JI);function KI(t){return typeof t=="string"&&HI.has(t)}Xn.isJSONType=KI;function BI(){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:{}}}Xn.getRules=BI});var Wp=O(Sr=>{"use strict";c();Object.defineProperty(Sr,"__esModule",{value:!0});Sr.shouldUseRule=Sr.shouldUseGroup=Sr.schemaHasRulesForType=void 0;function WI({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Mv(t,n)}Sr.schemaHasRulesForType=WI;function Mv(t,e){return e.rules.some(r=>qv(t,r))}Sr.shouldUseGroup=Mv;function qv(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Sr.shouldUseRule=qv});var ta=O(He=>{"use strict";c();Object.defineProperty(He,"__esModule",{value:!0});He.reportTypeError=He.checkDataTypes=He.checkDataType=He.coerceAndCheckDataType=He.getJSONTypes=He.getSchemaTypes=He.DataType=void 0;var GI=Bp(),XI=Wp(),YI=ea(),K=W(),Lv=ae(),Yn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Yn||(He.DataType=Yn={}));function QI(t){let e=Fv(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=QI;function Fv(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(GI.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}He.getJSONTypes=Fv;function eP(t,e){let{gen:r,data:n,opts:o}=t,i=tP(e,o.coerceTypes),a=e.length>0&&!(i.length===0&&e.length===1&&(0,XI.schemaHasRulesForType)(t,e[0]));if(a){let s=Xp(e,n,o.strictNumbers,Yn.Wrong);r.if(s,()=>{i.length?rP(t,e,i):Yp(t)})}return a}He.coerceAndCheckDataType=eP;var Vv=new Set(["string","number","integer","boolean","null"]);function tP(t,e){return e?t.filter(r=>Vv.has(r)||e==="array"&&r==="array"):[]}function rP(t,e,r){let{gen:n,data:o,opts:i}=t,a=n.let("dataType",(0,K._)`typeof ${o}`),s=n.let("coerced",(0,K._)`undefined`);i.coerceTypes==="array"&&n.if((0,K._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,K._)`${o}[0]`).assign(a,(0,K._)`typeof ${o}`).if(Xp(e,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,K._)`${s} !== undefined`);for(let l of r)(Vv.has(l)||l==="array"&&i.coerceTypes==="array")&&u(l);n.else(),Yp(t),n.endIf(),n.if((0,K._)`${s} !== undefined`,()=>{n.assign(o,s),nP(t,s)});function u(l){switch(l){case"string":n.elseIf((0,K._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,K._)`"" + ${o}`).elseIf((0,K._)`${o} === null`).assign(s,(0,K._)`""`);return;case"number":n.elseIf((0,K._)`${a} == "boolean" || ${o} === null
|
|
4
|
+
|| (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,K._)`+${o}`);return;case"integer":n.elseIf((0,K._)`${a} === "boolean" || ${o} === null
|
|
5
|
+
|| (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,K._)`+${o}`);return;case"boolean":n.elseIf((0,K._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,K._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,K._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,K._)`${a} === "string" || ${a} === "number"
|
|
6
|
+
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,K._)`[${o}]`)}}}function nP({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,K._)`${e} !== undefined`,()=>t.assign((0,K._)`${e}[${r}]`,n))}function Gp(t,e,r,n=Yn.Correct){let o=n===Yn.Correct?K.operators.EQ:K.operators.NEQ,i;switch(t){case"null":return(0,K._)`${e} ${o} null`;case"array":i=(0,K._)`Array.isArray(${e})`;break;case"object":i=(0,K._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=a((0,K._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=a();break;default:return(0,K._)`typeof ${e} ${o} ${t}`}return n===Yn.Correct?i:(0,K.not)(i);function a(s=K.nil){return(0,K.and)((0,K._)`typeof ${e} == "number"`,s,r?(0,K._)`isFinite(${e})`:K.nil)}}He.checkDataType=Gp;function Xp(t,e,r,n){if(t.length===1)return Gp(t[0],e,r,n);let o,i=(0,Lv.toHash)(t);if(i.array&&i.object){let a=(0,K._)`typeof ${e} != "object"`;o=i.null?a:(0,K._)`!${e} || ${a}`,delete i.null,delete i.array,delete i.object}else o=K.nil;i.number&&delete i.integer;for(let a in i)o=(0,K.and)(o,Gp(a,e,r,n));return o}He.checkDataTypes=Xp;var oP={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,K._)`{type: ${t}}`:(0,K._)`{type: ${e}}`};function Yp(t){let e=iP(t);(0,YI.reportError)(e,oP)}He.reportTypeError=Yp;function iP(t){let{gen:e,data:r,schema:n}=t,o=(0,Lv.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var Hv=O(gc=>{"use strict";c();Object.defineProperty(gc,"__esModule",{value:!0});gc.assignDefaults=void 0;var Qn=W(),aP=ae();function sP(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)Jv(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Jv(t,i,o.default))}gc.assignDefaults=sP;function Jv(t,e,r){let{gen:n,compositeRule:o,data:i,opts:a}=t;if(r===void 0)return;let s=(0,Qn._)`${i}${(0,Qn.getProperty)(e)}`;if(o){(0,aP.checkStrictMode)(t,`default is ignored for: ${s}`);return}let u=(0,Qn._)`${s} === undefined`;a.useDefaults==="empty"&&(u=(0,Qn._)`${u} || ${s} === null || ${s} === ""`),n.if(u,(0,Qn._)`${s} = ${(0,Qn.stringify)(r)}`)}});var kt=O(de=>{"use strict";c();Object.defineProperty(de,"__esModule",{value:!0});de.validateUnion=de.validateArray=de.usePattern=de.callValidateCode=de.schemaProperties=de.allSchemaProperties=de.noPropertyInData=de.propertyInData=de.isOwnProperty=de.hasPropFunc=de.reportMissingProp=de.checkMissingProp=de.checkReportMissingProp=void 0;var be=W(),Qp=ae(),zr=or(),cP=ae();function uP(t,e){let{gen:r,data:n,it:o}=t;r.if(tm(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,be._)`${e}`},!0),t.error()})}de.checkReportMissingProp=uP;function lP({gen:t,data:e,it:{opts:r}},n,o){return(0,be.or)(...n.map(i=>(0,be.and)(tm(t,e,i,r.ownProperties),(0,be._)`${o} = ${i}`)))}de.checkMissingProp=lP;function dP(t,e){t.setParams({missingProperty:e},!0),t.error()}de.reportMissingProp=dP;function Kv(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,be._)`Object.prototype.hasOwnProperty`})}de.hasPropFunc=Kv;function em(t,e,r){return(0,be._)`${Kv(t)}.call(${e}, ${r})`}de.isOwnProperty=em;function fP(t,e,r,n){let o=(0,be._)`${e}${(0,be.getProperty)(r)} !== undefined`;return n?(0,be._)`${o} && ${em(t,e,r)}`:o}de.propertyInData=fP;function tm(t,e,r,n){let o=(0,be._)`${e}${(0,be.getProperty)(r)} === undefined`;return n?(0,be.or)(o,(0,be.not)(em(t,e,r))):o}de.noPropertyInData=tm;function Bv(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}de.allSchemaProperties=Bv;function pP(t,e){return Bv(e).filter(r=>!(0,Qp.alwaysValidSchema)(t,e[r]))}de.schemaProperties=pP;function mP({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,u,l){let d=l?(0,be._)`${t}, ${e}, ${n}${o}`:e,f=[[zr.default.instancePath,(0,be.strConcat)(zr.default.instancePath,i)],[zr.default.parentData,a.parentData],[zr.default.parentDataProperty,a.parentDataProperty],[zr.default.rootData,zr.default.rootData]];a.opts.dynamicRef&&f.push([zr.default.dynamicAnchors,zr.default.dynamicAnchors]);let g=(0,be._)`${d}, ${r.object(...f)}`;return u!==be.nil?(0,be._)`${s}.call(${u}, ${g})`:(0,be._)`${s}(${g})`}de.callValidateCode=mP;var hP=(0,be._)`new RegExp`;function gP({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,be._)`${o.code==="new RegExp"?hP:(0,cP.useFunc)(t,o)}(${r}, ${n})`})}de.usePattern=gP;function yP(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let s=e.let("valid",!0);return a(()=>e.assign(s,!1)),s}return e.var(i,!0),a(()=>e.break()),i;function a(s){let u=e.const("len",(0,be._)`${r}.length`);e.forRange("i",0,u,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:Qp.Type.Num},i),e.if((0,be.not)(i),s)})}}de.validateArray=yP;function _P(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(u=>(0,Qp.alwaysValidSchema)(o,u))&&!o.opts.unevaluated)return;let a=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((u,l)=>{let d=t.subschema({keyword:n,schemaProp:l,compositeRule:!0},s);e.assign(a,(0,be._)`${a} || ${s}`),t.mergeValidEvaluated(d,s)||e.if((0,be.not)(a))})),t.result(a,()=>t.reset(),()=>t.error(!0))}de.validateUnion=_P});var Xv=O(qt=>{"use strict";c();Object.defineProperty(qt,"__esModule",{value:!0});qt.validateKeywordUsage=qt.validSchemaType=qt.funcKeywordCode=qt.macroKeywordCode=void 0;var tt=W(),tn=or(),vP=kt(),bP=ea();function $P(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=t,s=e.macro.call(a.self,o,i,a),u=Gv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let l=r.name("valid");t.subschema({schema:s,schemaPath:tt.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:u,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}qt.macroKeywordCode=$P;function xP(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:u}=t;kP(u,e);let l=!s&&e.compile?e.compile.call(u.self,i,a,u):e.validate,d=Gv(n,o,l),f=n.let("valid");t.block$data(f,g),t.ok((r=e.valid)!==null&&r!==void 0?r:f);function g(){if(e.errors===!1)_(),e.modifying&&Wv(t),b(()=>t.error());else{let $=e.async?m():v();e.modifying&&Wv(t),b(()=>wP(t,$))}}function m(){let $=n.let("ruleErrs",null);return n.try(()=>_((0,tt._)`await `),x=>n.assign(f,!1).if((0,tt._)`${x} instanceof ${u.ValidationError}`,()=>n.assign($,(0,tt._)`${x}.errors`),()=>n.throw(x))),$}function v(){let $=(0,tt._)`${d}.errors`;return n.assign($,null),_(tt.nil),$}function _($=e.async?(0,tt._)`await `:tt.nil){let x=u.opts.passContext?tn.default.this:tn.default.self,P=!("compile"in e&&!s||e.schema===!1);n.assign(f,(0,tt._)`${$}${(0,vP.callValidateCode)(t,d,x,P)}`,e.modifying)}function b($){var x;n.if((0,tt.not)((x=e.valid)!==null&&x!==void 0?x:f),$)}}qt.funcKeywordCode=xP;function Wv(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,tt._)`${n.parentData}[${n.parentDataProperty}]`))}function wP(t,e){let{gen:r}=t;r.if((0,tt._)`Array.isArray(${e})`,()=>{r.assign(tn.default.vErrors,(0,tt._)`${tn.default.vErrors} === null ? ${e} : ${tn.default.vErrors}.concat(${e})`).assign(tn.default.errors,(0,tt._)`${tn.default.vErrors}.length`),(0,bP.extendErrors)(t)},()=>t.error())}function kP({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Gv(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,tt.stringify)(r)})}function SP(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}qt.validSchemaType=SP;function zP({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let u=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(u);else throw new Error(u)}}qt.validateKeywordUsage=zP});var Qv=O(Ir=>{"use strict";c();Object.defineProperty(Ir,"__esModule",{value:!0});Ir.extendSubschemaMode=Ir.extendSubschemaData=Ir.getSubschema=void 0;var Lt=W(),Yv=ae();function IP(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,Lt._)`${t.schemaPath}${(0,Lt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,Lt._)`${t.schemaPath}${(0,Lt.getProperty)(e)}${(0,Lt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Yv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}Ir.getSubschema=IP;function PP(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:l,dataPathArr:d,opts:f}=e,g=s.let("data",(0,Lt._)`${e.data}${(0,Lt.getProperty)(r)}`,!0);u(g),t.errorPath=(0,Lt.str)`${l}${(0,Yv.getErrorPath)(r,n,f.jsPropertySyntax)}`,t.parentDataProperty=(0,Lt._)`${r}`,t.dataPathArr=[...d,t.parentDataProperty]}if(o!==void 0){let l=o instanceof Lt.Name?o:s.let("data",o,!0);u(l),a!==void 0&&(t.propertyName=a)}i&&(t.dataTypes=i);function u(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}Ir.extendSubschemaData=PP;function jP(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}Ir.extendSubschemaMode=jP});var rm=O((HL,eb)=>{"use strict";c();eb.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 n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))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(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var rb=O((BL,tb)=>{"use strict";c();var Pr=tb.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};yc(e,n,o,t,"",t)};Pr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Pr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Pr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Pr.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 yc(t,e,r,n,o,i,a,s,u,l){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,a,s,u,l);for(var d in n){var f=n[d];if(Array.isArray(f)){if(d in Pr.arrayKeywords)for(var g=0;g<f.length;g++)yc(t,e,r,f[g],o+"/"+d+"/"+g,i,o,d,n,g)}else if(d in Pr.propsKeywords){if(f&&typeof f=="object")for(var m in f)yc(t,e,r,f[m],o+"/"+d+"/"+OP(m),i,o,d,n,m)}else(d in Pr.keywords||t.allKeys&&!(d in Pr.skipKeywords))&&yc(t,e,r,f,o+"/"+d,i,o,d,n)}r(n,o,i,a,s,u,l)}}function OP(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var ra=O(st=>{"use strict";c();Object.defineProperty(st,"__esModule",{value:!0});st.getSchemaRefs=st.resolveUrl=st.normalizeId=st._getFullPath=st.getFullPath=st.inlineRef=void 0;var TP=ae(),EP=rm(),NP=rb(),RP=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function AP(t,e=!0){return typeof t=="boolean"?!0:e===!0?!nm(t):e?nb(t)<=e:!1}st.inlineRef=AP;var UP=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function nm(t){for(let e in t){if(UP.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(nm)||typeof r=="object"&&nm(r))return!0}return!1}function nb(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!RP.has(r)&&(typeof t[r]=="object"&&(0,TP.eachItem)(t[r],n=>e+=nb(n)),e===1/0))return 1/0}return e}function ob(t,e="",r){r!==!1&&(e=eo(e));let n=t.parse(e);return ib(t,n)}st.getFullPath=ob;function ib(t,e){return t.serialize(e).split("#")[0]+"#"}st._getFullPath=ib;var CP=/#\/?$/;function eo(t){return t?t.replace(CP,""):""}st.normalizeId=eo;function DP(t,e,r){return r=eo(r),t.resolve(e,r)}st.resolveUrl=DP;var ZP=/^[a-z_][-a-z0-9._]*$/i;function MP(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=eo(t[r]||e),i={"":o},a=ob(n,o,!1),s={},u=new Set;return NP(t,{allKeys:!0},(f,g,m,v)=>{if(v===void 0)return;let _=a+g,b=i[v];typeof f[r]=="string"&&(b=$.call(this,f[r])),x.call(this,f.$anchor),x.call(this,f.$dynamicAnchor),i[g]=b;function $(P){let Z=this.opts.uriResolver.resolve;if(P=eo(b?Z(b,P):P),u.has(P))throw d(P);u.add(P);let U=this.refs[P];return typeof U=="string"&&(U=this.refs[U]),typeof U=="object"?l(f,U.schema,P):P!==eo(_)&&(P[0]==="#"?(l(f,s[P],P),s[P]=f):this.refs[P]=_),P}function x(P){if(typeof P=="string"){if(!ZP.test(P))throw new Error(`invalid anchor "${P}"`);$.call(this,`#${P}`)}}}),s;function l(f,g,m){if(g!==void 0&&!EP(f,g))throw d(m)}function d(f){return new Error(`reference "${f}" resolves to more than one schema`)}}st.getSchemaRefs=MP});var ia=O(jr=>{"use strict";c();Object.defineProperty(jr,"__esModule",{value:!0});jr.getData=jr.KeywordCxt=jr.validateFunctionCode=void 0;var lb=Zv(),ab=ta(),im=Wp(),_c=ta(),qP=Hv(),oa=Xv(),om=Qv(),A=W(),V=or(),LP=ra(),ir=ae(),na=ea();function FP(t){if(pb(t)&&(mb(t),fb(t))){HP(t);return}db(t,()=>(0,lb.topBoolOrEmptySchema)(t))}jr.validateFunctionCode=FP;function db({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,A._)`${V.default.data}, ${V.default.valCxt}`,n.$async,()=>{t.code((0,A._)`"use strict"; ${sb(r,o)}`),JP(t,o),t.code(i)}):t.func(e,(0,A._)`${V.default.data}, ${VP(o)}`,n.$async,()=>t.code(sb(r,o)).code(i))}function VP(t){return(0,A._)`{${V.default.instancePath}="", ${V.default.parentData}, ${V.default.parentDataProperty}, ${V.default.rootData}=${V.default.data}${t.dynamicRef?(0,A._)`, ${V.default.dynamicAnchors}={}`:A.nil}}={}`}function JP(t,e){t.if(V.default.valCxt,()=>{t.var(V.default.instancePath,(0,A._)`${V.default.valCxt}.${V.default.instancePath}`),t.var(V.default.parentData,(0,A._)`${V.default.valCxt}.${V.default.parentData}`),t.var(V.default.parentDataProperty,(0,A._)`${V.default.valCxt}.${V.default.parentDataProperty}`),t.var(V.default.rootData,(0,A._)`${V.default.valCxt}.${V.default.rootData}`),e.dynamicRef&&t.var(V.default.dynamicAnchors,(0,A._)`${V.default.valCxt}.${V.default.dynamicAnchors}`)},()=>{t.var(V.default.instancePath,(0,A._)`""`),t.var(V.default.parentData,(0,A._)`undefined`),t.var(V.default.parentDataProperty,(0,A._)`undefined`),t.var(V.default.rootData,V.default.data),e.dynamicRef&&t.var(V.default.dynamicAnchors,(0,A._)`{}`)})}function HP(t){let{schema:e,opts:r,gen:n}=t;db(t,()=>{r.$comment&&e.$comment&&gb(t),XP(t),n.let(V.default.vErrors,null),n.let(V.default.errors,0),r.unevaluated&&KP(t),hb(t),ej(t)})}function KP(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,A._)`${r}.evaluated`),e.if((0,A._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,A._)`${t.evaluated}.props`,(0,A._)`undefined`)),e.if((0,A._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,A._)`${t.evaluated}.items`,(0,A._)`undefined`))}function sb(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,A._)`/*# sourceURL=${r} */`:A.nil}function BP(t,e){if(pb(t)&&(mb(t),fb(t))){WP(t,e);return}(0,lb.boolOrEmptySchema)(t,e)}function fb({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 pb(t){return typeof t.schema!="boolean"}function WP(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&gb(t),YP(t),QP(t);let i=n.const("_errs",V.default.errors);hb(t,i),n.var(e,(0,A._)`${i} === ${V.default.errors}`)}function mb(t){(0,ir.checkUnknownRules)(t),GP(t)}function hb(t,e){if(t.opts.jtd)return cb(t,[],!1,e);let r=(0,ab.getSchemaTypes)(t.schema),n=(0,ab.coerceAndCheckDataType)(t,r);cb(t,r,!n,e)}function GP(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,ir.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function XP(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ir.checkStrictMode)(t,"default is ignored in the schema root")}function YP(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,LP.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function QP(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function gb({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,A._)`${V.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,A.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,A._)`${V.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function ej(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,A._)`${V.default.errors} === 0`,()=>e.return(V.default.data),()=>e.throw((0,A._)`new ${o}(${V.default.vErrors})`)):(e.assign((0,A._)`${n}.errors`,V.default.vErrors),i.unevaluated&&tj(t),e.return((0,A._)`${V.default.errors} === 0`))}function tj({gen:t,evaluated:e,props:r,items:n}){r instanceof A.Name&&t.assign((0,A._)`${e}.props`,r),n instanceof A.Name&&t.assign((0,A._)`${e}.items`,n)}function cb(t,e,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:u,self:l}=t,{RULES:d}=l;if(i.$ref&&(u.ignoreKeywordsWithRef||!(0,ir.schemaHasRulesButRef)(i,d))){o.block(()=>_b(t,"$ref",d.all.$ref.definition));return}u.jtd||rj(t,e),o.block(()=>{for(let g of d.rules)f(g);f(d.post)});function f(g){(0,im.shouldUseGroup)(i,g)&&(g.type?(o.if((0,_c.checkDataType)(g.type,a,u.strictNumbers)),ub(t,g),e.length===1&&e[0]===g.type&&r&&(o.else(),(0,_c.reportTypeError)(t)),o.endIf()):ub(t,g),s||o.if((0,A._)`${V.default.errors} === ${n||0}`))}}function ub(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,qP.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,im.shouldUseRule)(n,i)&&_b(t,i.keyword,i.definition,e.type)})}function rj(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(nj(t,e),t.opts.allowUnionTypes||oj(t,e),ij(t,t.dataTypes))}function nj(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{yb(t.dataTypes,r)||am(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),sj(t,e)}}function oj(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&am(t,"use allowUnionTypes to allow union type keyword")}function ij(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,im.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>aj(e,a))&&am(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function aj(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function yb(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function sj(t,e){let r=[];for(let n of t.dataTypes)yb(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function am(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,ir.checkStrictMode)(t,e,t.opts.strictTypes)}var vc=class{constructor(e,r,n){if((0,oa.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ir.schemaRefOrVal)(e,this.schema,n,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",vb(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,oa.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",V.default.errors))}result(e,r,n){this.failResult((0,A.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():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,A.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,A._)`${r} !== undefined && (${(0,A.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?na.reportExtraError:na.reportError)(this,this.def.error,r)}$dataError(){(0,na.reportError)(this,this.def.$dataError||na.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,na.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,n=A.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=A.nil,r=A.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,A.or)((0,A._)`${o} === undefined`,r)),e!==A.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==A.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,A.or)(a(),s());function a(){if(n.length){if(!(r instanceof A.Name))throw new Error("ajv implementation error");let u=Array.isArray(n)?n:[n];return(0,A._)`${(0,_c.checkDataTypes)(u,r,i.opts.strictNumbers,_c.DataType.Wrong)}`}return A.nil}function s(){if(o.validateSchema){let u=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,A._)`!${u}(${r})`}return A.nil}}subschema(e,r){let n=(0,om.getSubschema)(this.it,e);(0,om.extendSubschemaData)(n,this.it,e),(0,om.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return BP(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=ir.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=ir.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,A.Name)),!0}};jr.KeywordCxt=vc;function _b(t,e,r,n){let o=new vc(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,oa.funcKeywordCode)(o,r):"macro"in r?(0,oa.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,oa.funcKeywordCode)(o,r)}var cj=/^\/(?:[^~]|~0|~1)*$/,uj=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function vb(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return V.default.rootData;if(t[0]==="/"){if(!cj.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=V.default.rootData}else{let l=uj.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let d=+l[1];if(o=l[2],o==="#"){if(d>=e)throw new Error(u("property/index",d));return n[e-d]}if(d>e)throw new Error(u("data",d));if(i=r[e-d],!o)return i}let a=i,s=o.split("/");for(let l of s)l&&(i=(0,A._)`${i}${(0,A.getProperty)((0,ir.unescapeJsonPointer)(l))}`,a=(0,A._)`${a} && ${i}`);return a;function u(l,d){return`Cannot access ${l} ${d} levels up, current level is ${e}`}}jr.getData=vb});var bc=O(cm=>{"use strict";c();Object.defineProperty(cm,"__esModule",{value:!0});var sm=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};cm.default=sm});var aa=O(dm=>{"use strict";c();Object.defineProperty(dm,"__esModule",{value:!0});var um=ra(),lm=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,um.resolveUrl)(e,r,n),this.missingSchema=(0,um.normalizeId)((0,um.getFullPath)(e,this.missingRef))}};dm.default=lm});var xc=O(St=>{"use strict";c();Object.defineProperty(St,"__esModule",{value:!0});St.resolveSchema=St.getCompilingSchema=St.resolveRef=St.compileSchema=St.SchemaEnv=void 0;var Et=W(),lj=bc(),rn=or(),Nt=ra(),bb=ae(),dj=ia(),to=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=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,Nt.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};St.SchemaEnv=to;function pm(t){let e=$b.call(this,t);if(e)return e;let r=(0,Nt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new Et.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;t.$async&&(s=a.scopeValue("Error",{ref:lj.default,code:(0,Et._)`require("ajv/dist/runtime/validation_error").default`}));let u=a.scopeName("validate");t.validateName=u;let l={gen:a,allErrors:this.opts.allErrors,data:rn.default.data,parentData:rn.default.parentData,parentDataProperty:rn.default.parentDataProperty,dataNames:[rn.default.data],dataPathArr:[Et.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,Et.stringify)(t.schema)}:{ref:t.schema}),validateName:u,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:Et.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Et._)`""`,opts:this.opts,self:this},d;try{this._compilations.add(t),(0,dj.validateFunctionCode)(l),a.optimize(this.opts.code.optimize);let f=a.toString();d=`${a.scopeRefs(rn.default.scope)}return ${f}`,this.opts.code.process&&(d=this.opts.code.process(d,t));let m=new Function(`${rn.default.self}`,`${rn.default.scope}`,d)(this,this.scope.get());if(this.scope.value(u,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:u,validateCode:f,scopeValues:a._values}),this.opts.unevaluated){let{props:v,items:_}=l;m.evaluated={props:v instanceof Et.Name?void 0:v,items:_ instanceof Et.Name?void 0:_,dynamicProps:v instanceof Et.Name,dynamicItems:_ instanceof Et.Name},m.source&&(m.source.evaluated=(0,Et.stringify)(m.evaluated))}return t.validate=m,t}catch(f){throw delete t.validate,delete t.validateName,d&&this.logger.error("Error compiling schema, function code:",d),f}finally{this._compilations.delete(t)}}St.compileSchema=pm;function fj(t,e,r){var n;r=(0,Nt.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=hj.call(this,t,r);if(i===void 0){let a=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new to({schema:a,schemaId:s,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=pj.call(this,i)}St.resolveRef=fj;function pj(t){return(0,Nt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:pm.call(this,t)}function $b(t){for(let e of this._compilations)if(mj(e,t))return e}St.getCompilingSchema=$b;function mj(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function hj(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||$c.call(this,t,e)}function $c(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Nt._getFullPath)(this.opts.uriResolver,r),o=(0,Nt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return fm.call(this,r,t);let i=(0,Nt.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=$c.call(this,t,a);return typeof s?.schema!="object"?void 0:fm.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||pm.call(this,a),i===(0,Nt.normalizeId)(e)){let{schema:s}=a,{schemaId:u}=this.opts,l=s[u];return l&&(o=(0,Nt.resolveUrl)(this.opts.uriResolver,o,l)),new to({schema:s,schemaId:u,root:t,baseId:o})}return fm.call(this,r,a)}}St.resolveSchema=$c;var gj=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function fm(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let u=r[(0,bb.unescapeFragment)(s)];if(u===void 0)return;r=u;let l=typeof r=="object"&&r[this.opts.schemaId];!gj.has(s)&&l&&(e=(0,Nt.resolveUrl)(this.opts.uriResolver,e,l))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,bb.schemaHasRulesButRef)(r,this.RULES)){let s=(0,Nt.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=$c.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new to({schema:r,schemaId:a,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var xb=O((a9,yj)=>{yj.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 hm=O((s9,zb)=>{"use strict";c();var _j=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),kb=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function mm(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var vj=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function wb(t){return t.length=0,!0}function bj(t,e,r){if(t.length){let n=mm(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function $j(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=bj;for(let u=0;u<t.length;u++){let l=t[u];if(!(l==="["||l==="]"))if(l===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++e>7){r.error=!0;break}u>0&&t[u-1]===":"&&(i=!0),n.push(":");continue}else if(l==="%"){if(!s(o,n,r))break;s=wb}else{o.push(l);continue}}return o.length&&(s===wb?r.zone=o.join(""):a?n.push(o.join("")):n.push(mm(o))),r.address=n.join(""),r}function Sb(t){if(xj(t,":")<2)return{host:t,isIPV6:!1};let e=$j(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function xj(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function wj(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===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(o===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((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function kj(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function Sj(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!kb(r)){let n=Sb(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}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}zb.exports={nonSimpleDomain:vj,recomposeAuthority:Sj,normalizeComponentEncoding:kj,removeDotSegments:wj,isIPv4:kb,isUUID:_j,normalizeIPv6:Sb,stringArrayToHexStripped:mm}});var Tb=O((u9,Ob)=>{"use strict";c();var{isUUID:zj}=hm(),Ij=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,Pj=["http","https","ws","wss","urn","urn:uuid"];function jj(t){return Pj.indexOf(t)!==-1}function gm(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 Ib(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Pb(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 Oj(t){return t.secure=gm(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Tj(t){if((t.port===(gm(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 Ej(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(Ij);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=ym(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Nj(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=ym(o);i&&(t=i.serialize(t,e));let a=t,s=t.nss;return a.path=`${n||e.nid}:${s}`,e.skipEscape=!0,a}function Rj(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!zj(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Aj(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var jb={scheme:"http",domainHost:!0,parse:Ib,serialize:Pb},Uj={scheme:"https",domainHost:jb.domainHost,parse:Ib,serialize:Pb},wc={scheme:"ws",domainHost:!0,parse:Oj,serialize:Tj},Cj={scheme:"wss",domainHost:wc.domainHost,parse:wc.parse,serialize:wc.serialize},Dj={scheme:"urn",parse:Ej,serialize:Nj,skipNormalize:!0},Zj={scheme:"urn:uuid",parse:Rj,serialize:Aj,skipNormalize:!0},kc={http:jb,https:Uj,ws:wc,wss:Cj,urn:Dj,"urn:uuid":Zj};Object.setPrototypeOf(kc,null);function ym(t){return t&&(kc[t]||kc[t.toLowerCase()])||void 0}Ob.exports={wsIsSecure:gm,SCHEMES:kc,isValidSchemeName:jj,getSchemeHandler:ym}});var Rb=O((d9,zc)=>{"use strict";c();var{normalizeIPv6:Mj,removeDotSegments:sa,recomposeAuthority:qj,normalizeComponentEncoding:Sc,isIPv4:Lj,nonSimpleDomain:Fj}=hm(),{SCHEMES:Vj,getSchemeHandler:Eb}=Tb();function Jj(t,e){return typeof t=="string"?t=Ft(ar(t,e),e):typeof t=="object"&&(t=ar(Ft(t,e),e)),t}function Hj(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Nb(ar(t,n),ar(e,n),n,!0);return n.skipEscape=!0,Ft(o,n)}function Nb(t,e,r,n){let o={};return n||(t=ar(Ft(t,r),r),e=ar(Ft(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=sa(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=sa(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=sa(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=sa(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function Kj(t,e,r){return typeof t=="string"?(t=unescape(t),t=Ft(Sc(ar(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Ft(Sc(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Ft(Sc(ar(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Ft(Sc(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Ft(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:""},n=Object.assign({},e),o=[],i=Eb(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=qj(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=sa(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var Bj=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function ar(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(Bj);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(Lj(n.host)===!1){let u=Mj(n.host);n.host=u.host.toLowerCase(),o=u.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Eb(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&Fj(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var _m={SCHEMES:Vj,normalize:Jj,resolve:Hj,resolveComponent:Nb,equal:Kj,serialize:Ft,parse:ar};zc.exports=_m;zc.exports.default=_m;zc.exports.fastUri=_m});var Ub=O(vm=>{"use strict";c();Object.defineProperty(vm,"__esModule",{value:!0});var Ab=Rb();Ab.code='require("ajv/dist/runtime/uri").default';vm.default=Ab});var Vb=O(Ce=>{"use strict";c();Object.defineProperty(Ce,"__esModule",{value:!0});Ce.CodeGen=Ce.Name=Ce.nil=Ce.stringify=Ce.str=Ce._=Ce.KeywordCxt=void 0;var Wj=ia();Object.defineProperty(Ce,"KeywordCxt",{enumerable:!0,get:function(){return Wj.KeywordCxt}});var ro=W();Object.defineProperty(Ce,"_",{enumerable:!0,get:function(){return ro._}});Object.defineProperty(Ce,"str",{enumerable:!0,get:function(){return ro.str}});Object.defineProperty(Ce,"stringify",{enumerable:!0,get:function(){return ro.stringify}});Object.defineProperty(Ce,"nil",{enumerable:!0,get:function(){return ro.nil}});Object.defineProperty(Ce,"Name",{enumerable:!0,get:function(){return ro.Name}});Object.defineProperty(Ce,"CodeGen",{enumerable:!0,get:function(){return ro.CodeGen}});var Gj=bc(),qb=aa(),Xj=Bp(),ca=xc(),Yj=W(),ua=ra(),Ic=ta(),$m=ae(),Cb=xb(),Qj=Ub(),Lb=(t,e)=>new RegExp(t,e);Lb.code="new RegExp";var eO=["removeAdditional","useDefaults","coerceTypes"],tO=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),rO={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."},nO={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Db=200;function oO(t){var e,r,n,o,i,a,s,u,l,d,f,g,m,v,_,b,$,x,P,Z,U,ze,We,_n,dr;let xe=t.strict,Ct=(e=t.code)===null||e===void 0?void 0:e.optimize,Ro=Ct===!0||Ct===void 0?1:Ct||0,vn=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Lb,vu=(o=t.uriResolver)!==null&&o!==void 0?o:Qj.default;return{strictSchema:(a=(i=t.strictSchema)!==null&&i!==void 0?i:xe)!==null&&a!==void 0?a:!0,strictNumbers:(u=(s=t.strictNumbers)!==null&&s!==void 0?s:xe)!==null&&u!==void 0?u:!0,strictTypes:(d=(l=t.strictTypes)!==null&&l!==void 0?l:xe)!==null&&d!==void 0?d:"log",strictTuples:(g=(f=t.strictTuples)!==null&&f!==void 0?f:xe)!==null&&g!==void 0?g:"log",strictRequired:(v=(m=t.strictRequired)!==null&&m!==void 0?m:xe)!==null&&v!==void 0?v:!1,code:t.code?{...t.code,optimize:Ro,regExp:vn}:{optimize:Ro,regExp:vn},loopRequired:(_=t.loopRequired)!==null&&_!==void 0?_:Db,loopEnum:(b=t.loopEnum)!==null&&b!==void 0?b:Db,meta:($=t.meta)!==null&&$!==void 0?$:!0,messages:(x=t.messages)!==null&&x!==void 0?x:!0,inlineRefs:(P=t.inlineRefs)!==null&&P!==void 0?P:!0,schemaId:(Z=t.schemaId)!==null&&Z!==void 0?Z:"$id",addUsedSchema:(U=t.addUsedSchema)!==null&&U!==void 0?U:!0,validateSchema:(ze=t.validateSchema)!==null&&ze!==void 0?ze:!0,validateFormats:(We=t.validateFormats)!==null&&We!==void 0?We:!0,unicodeRegExp:(_n=t.unicodeRegExp)!==null&&_n!==void 0?_n:!0,int32range:(dr=t.int32range)!==null&&dr!==void 0?dr:!0,uriResolver:vu}}var la=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...oO(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new Yj.ValueScope({scope:{},prefixes:tO,es5:r,lines:n}),this.logger=lO(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Xj.getRules)(),Zb.call(this,rO,e,"NOT SUPPORTED"),Zb.call(this,nO,e,"DEPRECATED","warn"),this._metaOpts=cO.call(this),e.formats&&aO.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&sO.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),iO.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=Cb;n==="id"&&(o={...Cb},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!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 n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(d,f){await i.call(this,d.$schema);let g=this._addSchema(d,f);return g.validate||a.call(this,g)}async function i(d){d&&!this.getSchema(d)&&await o.call(this,{$ref:d},!0)}async function a(d){try{return this._compileSchemaEnv(d)}catch(f){if(!(f instanceof qb.default))throw f;return s.call(this,f),await u.call(this,f.missingSchema),a.call(this,d)}}function s({missingSchema:d,missingRef:f}){if(this.refs[d])throw new Error(`AnySchema ${d} is loaded but ${f} cannot be resolved`)}async function u(d){let f=await l.call(this,d);this.refs[d]||await i.call(this,f.$schema),this.refs[d]||this.addSchema(f,d,r)}async function l(d){let f=this._loading[d];if(f)return f;try{return await(this._loading[d]=n(d))}finally{delete this._loading[d]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let a of e)this.addSchema(a,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:a}=this.opts;if(i=e[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,ua.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=Mb.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new ca.SchemaEnv({schema:{},schemaId:n});if(r=ca.resolveSchema.call(this,o,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=Mb.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 n=e[this.opts.schemaId];return n&&(n=(0,ua.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),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 n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(fO.call(this,n,r),!r)return(0,$m.eachItem)(n,i=>bm.call(this,i)),this;mO.call(this,r);let o={...r,type:(0,Ic.getJSONTypes)(r.type),schemaType:(0,Ic.getJSONTypes)(r.schemaType)};return(0,$m.eachItem)(n,o.type.length===0?i=>bm.call(this,i,o):i=>o.type.forEach(a=>bm.call(this,i,o,a))),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 n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,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:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),a=e;for(let s of i)a=a[s];for(let s in n){let u=n[s];if(typeof u!="object")continue;let{$data:l}=u.definition,d=a[s];l&&d&&(a[s]=Fb(d))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e=="object")a=e[s];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 u=this._cache.get(e);if(u!==void 0)return u;n=(0,ua.normalizeId)(a||n);let l=ua.getSchemaRefs.call(this,e,n);return u=new ca.SchemaEnv({schema:e,schemaId:s,meta:r,baseId:n,localRefs:l}),this._cache.set(u.schema,u),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=u),o&&this.validateSchema(e,!0),u}_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):ca.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{ca.compileSchema.call(this,e)}finally{this.opts=r}}};la.ValidationError=Gj.default;la.MissingRefError=qb.default;Ce.default=la;function Zb(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function Mb(t){return t=(0,ua.normalizeId)(t),this.schemas[t]||this.refs[t]}function iO(){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 aO(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function sO(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 cO(){let t={...this.opts};for(let e of eO)delete t[e];return t}var uO={log(){},warn(){},error(){}};function lO(t){if(t===!1)return uO;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 dO=/^[a-z_$][a-z0-9_$:-]*$/i;function fO(t,e){let{RULES:r}=this;if((0,$m.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!dO.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function bm(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:u})=>u===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,Ic.getJSONTypes)(e.type),schemaType:(0,Ic.getJSONTypes)(e.schemaType)}};e.before?pO.call(this,a,s,e.before):a.rules.push(s),i.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(u=>this.addKeyword(u))}function pO(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function mO(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Fb(e)),t.validateSchema=this.compile(e,!0))}var hO={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Fb(t){return{anyOf:[t,hO]}}});var Jb=O(xm=>{"use strict";c();Object.defineProperty(xm,"__esModule",{value:!0});var gO={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};xm.default=gO});var Wb=O(nn=>{"use strict";c();Object.defineProperty(nn,"__esModule",{value:!0});nn.callRef=nn.getValidate=void 0;var yO=aa(),Hb=kt(),ct=W(),no=or(),Kb=xc(),Pc=ae(),_O={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:u}=n,{root:l}=i;if((r==="#"||r==="#/")&&o===l.baseId)return f();let d=Kb.resolveRef.call(u,l,o,r);if(d===void 0)throw new yO.default(n.opts.uriResolver,o,r);if(d instanceof Kb.SchemaEnv)return g(d);return m(d);function f(){if(i===l)return jc(t,a,i,i.$async);let v=e.scopeValue("root",{ref:l});return jc(t,(0,ct._)`${v}.validate`,l,l.$async)}function g(v){let _=Bb(t,v);jc(t,_,v,v.$async)}function m(v){let _=e.scopeValue("schema",s.code.source===!0?{ref:v,code:(0,ct.stringify)(v)}:{ref:v}),b=e.name("valid"),$=t.subschema({schema:v,dataTypes:[],schemaPath:ct.nil,topSchemaRef:_,errSchemaPath:r},b);t.mergeEvaluated($),t.ok(b)}}};function Bb(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,ct._)`${r.scopeValue("wrapper",{ref:e})}.validate`}nn.getValidate=Bb;function jc(t,e,r,n){let{gen:o,it:i}=t,{allErrors:a,schemaEnv:s,opts:u}=i,l=u.passContext?no.default.this:ct.nil;n?d():f();function d(){if(!s.$async)throw new Error("async schema referenced by sync schema");let v=o.let("valid");o.try(()=>{o.code((0,ct._)`await ${(0,Hb.callValidateCode)(t,e,l)}`),m(e),a||o.assign(v,!0)},_=>{o.if((0,ct._)`!(${_} instanceof ${i.ValidationError})`,()=>o.throw(_)),g(_),a||o.assign(v,!1)}),t.ok(v)}function f(){t.result((0,Hb.callValidateCode)(t,e,l),()=>m(e),()=>g(e))}function g(v){let _=(0,ct._)`${v}.errors`;o.assign(no.default.vErrors,(0,ct._)`${no.default.vErrors} === null ? ${_} : ${no.default.vErrors}.concat(${_})`),o.assign(no.default.errors,(0,ct._)`${no.default.vErrors}.length`)}function m(v){var _;if(!i.opts.unevaluated)return;let b=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(i.props!==!0)if(b&&!b.dynamicProps)b.props!==void 0&&(i.props=Pc.mergeEvaluated.props(o,b.props,i.props));else{let $=o.var("props",(0,ct._)`${v}.evaluated.props`);i.props=Pc.mergeEvaluated.props(o,$,i.props,ct.Name)}if(i.items!==!0)if(b&&!b.dynamicItems)b.items!==void 0&&(i.items=Pc.mergeEvaluated.items(o,b.items,i.items));else{let $=o.var("items",(0,ct._)`${v}.evaluated.items`);i.items=Pc.mergeEvaluated.items(o,$,i.items,ct.Name)}}}nn.callRef=jc;nn.default=_O});var Gb=O(wm=>{"use strict";c();Object.defineProperty(wm,"__esModule",{value:!0});var vO=Jb(),bO=Wb(),$O=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",vO.default,bO.default];wm.default=$O});var Xb=O(km=>{"use strict";c();Object.defineProperty(km,"__esModule",{value:!0});var Oc=W(),Or=Oc.operators,Tc={maximum:{okStr:"<=",ok:Or.LTE,fail:Or.GT},minimum:{okStr:">=",ok:Or.GTE,fail:Or.LT},exclusiveMaximum:{okStr:"<",ok:Or.LT,fail:Or.GTE},exclusiveMinimum:{okStr:">",ok:Or.GT,fail:Or.LTE}},xO={message:({keyword:t,schemaCode:e})=>(0,Oc.str)`must be ${Tc[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Oc._)`{comparison: ${Tc[t].okStr}, limit: ${e}}`},wO={keyword:Object.keys(Tc),type:"number",schemaType:"number",$data:!0,error:xO,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Oc._)`${r} ${Tc[e].fail} ${n} || isNaN(${r})`)}};km.default=wO});var Yb=O(Sm=>{"use strict";c();Object.defineProperty(Sm,"__esModule",{value:!0});var da=W(),kO={message:({schemaCode:t})=>(0,da.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,da._)`{multipleOf: ${t}}`},SO={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:kO,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,a=e.let("res"),s=i?(0,da._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,da._)`${a} !== parseInt(${a})`;t.fail$data((0,da._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Sm.default=SO});var e$=O(zm=>{"use strict";c();Object.defineProperty(zm,"__esModule",{value:!0});function Qb(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}zm.default=Qb;Qb.code='require("ajv/dist/runtime/ucs2length").default'});var t$=O(Im=>{"use strict";c();Object.defineProperty(Im,"__esModule",{value:!0});var on=W(),zO=ae(),IO=e$(),PO={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,on.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,on._)`{limit: ${t}}`},jO={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:PO,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?on.operators.GT:on.operators.LT,a=o.opts.unicode===!1?(0,on._)`${r}.length`:(0,on._)`${(0,zO.useFunc)(t.gen,IO.default)}(${r})`;t.fail$data((0,on._)`${a} ${i} ${n}`)}};Im.default=jO});var r$=O(Pm=>{"use strict";c();Object.defineProperty(Pm,"__esModule",{value:!0});var OO=kt(),Ec=W(),TO={message:({schemaCode:t})=>(0,Ec.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Ec._)`{pattern: ${t}}`},EO={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:TO,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:i}=t,a=i.opts.unicodeRegExp?"u":"",s=r?(0,Ec._)`(new RegExp(${o}, ${a}))`:(0,OO.usePattern)(t,n);t.fail$data((0,Ec._)`!${s}.test(${e})`)}};Pm.default=EO});var n$=O(jm=>{"use strict";c();Object.defineProperty(jm,"__esModule",{value:!0});var fa=W(),NO={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,fa.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,fa._)`{limit: ${t}}`},RO={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:NO,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?fa.operators.GT:fa.operators.LT;t.fail$data((0,fa._)`Object.keys(${r}).length ${o} ${n}`)}};jm.default=RO});var o$=O(Om=>{"use strict";c();Object.defineProperty(Om,"__esModule",{value:!0});var pa=kt(),ma=W(),AO=ae(),UO={message:({params:{missingProperty:t}})=>(0,ma.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,ma._)`{missingProperty: ${t}}`},CO={keyword:"required",type:"object",schemaType:"array",$data:!0,error:UO,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:a}=t,{opts:s}=a;if(!i&&r.length===0)return;let u=r.length>=s.loopRequired;if(a.allErrors?l():d(),s.strictRequired){let m=t.parentSchema.properties,{definedProperties:v}=t.it;for(let _ of r)if(m?.[_]===void 0&&!v.has(_)){let b=a.schemaEnv.baseId+a.errSchemaPath,$=`required property "${_}" is not defined at "${b}" (strictRequired)`;(0,AO.checkStrictMode)(a,$,a.opts.strictRequired)}}function l(){if(u||i)t.block$data(ma.nil,f);else for(let m of r)(0,pa.checkReportMissingProp)(t,m)}function d(){let m=e.let("missing");if(u||i){let v=e.let("valid",!0);t.block$data(v,()=>g(m,v)),t.ok(v)}else e.if((0,pa.checkMissingProp)(t,r,m)),(0,pa.reportMissingProp)(t,m),e.else()}function f(){e.forOf("prop",n,m=>{t.setParams({missingProperty:m}),e.if((0,pa.noPropertyInData)(e,o,m,s.ownProperties),()=>t.error())})}function g(m,v){t.setParams({missingProperty:m}),e.forOf(m,n,()=>{e.assign(v,(0,pa.propertyInData)(e,o,m,s.ownProperties)),e.if((0,ma.not)(v),()=>{t.error(),e.break()})},ma.nil)}}};Om.default=CO});var i$=O(Tm=>{"use strict";c();Object.defineProperty(Tm,"__esModule",{value:!0});var ha=W(),DO={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,ha.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,ha._)`{limit: ${t}}`},ZO={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:DO,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?ha.operators.GT:ha.operators.LT;t.fail$data((0,ha._)`${r}.length ${o} ${n}`)}};Tm.default=ZO});var Nc=O(Em=>{"use strict";c();Object.defineProperty(Em,"__esModule",{value:!0});var a$=rm();a$.code='require("ajv/dist/runtime/equal").default';Em.default=a$});var s$=O(Rm=>{"use strict";c();Object.defineProperty(Rm,"__esModule",{value:!0});var Nm=ta(),De=W(),MO=ae(),qO=Nc(),LO={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}}`},FO={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:LO,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=t;if(!n&&!o)return;let u=e.let("valid"),l=i.items?(0,Nm.getSchemaTypes)(i.items):[];t.block$data(u,d,(0,De._)`${a} === false`),t.ok(u);function d(){let v=e.let("i",(0,De._)`${r}.length`),_=e.let("j");t.setParams({i:v,j:_}),e.assign(u,!0),e.if((0,De._)`${v} > 1`,()=>(f()?g:m)(v,_))}function f(){return l.length>0&&!l.some(v=>v==="object"||v==="array")}function g(v,_){let b=e.name("item"),$=(0,Nm.checkDataTypes)(l,b,s.opts.strictNumbers,Nm.DataType.Wrong),x=e.const("indices",(0,De._)`{}`);e.for((0,De._)`;${v}--;`,()=>{e.let(b,(0,De._)`${r}[${v}]`),e.if($,(0,De._)`continue`),l.length>1&&e.if((0,De._)`typeof ${b} == "string"`,(0,De._)`${b} += "_"`),e.if((0,De._)`typeof ${x}[${b}] == "number"`,()=>{e.assign(_,(0,De._)`${x}[${b}]`),t.error(),e.assign(u,!1).break()}).code((0,De._)`${x}[${b}] = ${v}`)})}function m(v,_){let b=(0,MO.useFunc)(e,qO.default),$=e.name("outer");e.label($).for((0,De._)`;${v}--;`,()=>e.for((0,De._)`${_} = ${v}; ${_}--;`,()=>e.if((0,De._)`${b}(${r}[${v}], ${r}[${_}])`,()=>{t.error(),e.assign(u,!1).break($)})))}}};Rm.default=FO});var c$=O(Um=>{"use strict";c();Object.defineProperty(Um,"__esModule",{value:!0});var Am=W(),VO=ae(),JO=Nc(),HO={message:"must be equal to constant",params:({schemaCode:t})=>(0,Am._)`{allowedValue: ${t}}`},KO={keyword:"const",$data:!0,error:HO,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,Am._)`!${(0,VO.useFunc)(e,JO.default)}(${r}, ${o})`):t.fail((0,Am._)`${i} !== ${r}`)}};Um.default=KO});var u$=O(Cm=>{"use strict";c();Object.defineProperty(Cm,"__esModule",{value:!0});var ga=W(),BO=ae(),WO=Nc(),GO={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,ga._)`{allowedValues: ${t}}`},XO={keyword:"enum",schemaType:"array",$data:!0,error:GO,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,u,l=()=>u??(u=(0,BO.useFunc)(e,WO.default)),d;if(s||n)d=e.let("valid"),t.block$data(d,f);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let m=e.const("vSchema",i);d=(0,ga.or)(...o.map((v,_)=>g(m,_)))}t.pass(d);function f(){e.assign(d,!1),e.forOf("v",i,m=>e.if((0,ga._)`${l()}(${r}, ${m})`,()=>e.assign(d,!0).break()))}function g(m,v){let _=o[v];return typeof _=="object"&&_!==null?(0,ga._)`${l()}(${r}, ${m}[${v}])`:(0,ga._)`${r} === ${_}`}}};Cm.default=XO});var l$=O(Dm=>{"use strict";c();Object.defineProperty(Dm,"__esModule",{value:!0});var YO=Xb(),QO=Yb(),eT=t$(),tT=r$(),rT=n$(),nT=o$(),oT=i$(),iT=s$(),aT=c$(),sT=u$(),cT=[YO.default,QO.default,eT.default,tT.default,rT.default,nT.default,oT.default,iT.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},aT.default,sT.default];Dm.default=cT});var Mm=O(ya=>{"use strict";c();Object.defineProperty(ya,"__esModule",{value:!0});ya.validateAdditionalItems=void 0;var an=W(),Zm=ae(),uT={message:({params:{len:t}})=>(0,an.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,an._)`{limit: ${t}}`},lT={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:uT,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Zm.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}d$(t,n)}};function d$(t,e){let{gen:r,schema:n,data:o,keyword:i,it:a}=t;a.items=!0;let s=r.const("len",(0,an._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,an._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,Zm.alwaysValidSchema)(a,n)){let l=r.var("valid",(0,an._)`${s} <= ${e.length}`);r.if((0,an.not)(l),()=>u(l)),t.ok(l)}function u(l){r.forRange("i",e.length,s,d=>{t.subschema({keyword:i,dataProp:d,dataPropType:Zm.Type.Num},l),a.allErrors||r.if((0,an.not)(l),()=>r.break())})}}ya.validateAdditionalItems=d$;ya.default=lT});var qm=O(_a=>{"use strict";c();Object.defineProperty(_a,"__esModule",{value:!0});_a.validateTuple=void 0;var f$=W(),Rc=ae(),dT=kt(),fT={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return p$(t,"additionalItems",e);r.items=!0,!(0,Rc.alwaysValidSchema)(r,e)&&t.ok((0,dT.validateArray)(t))}};function p$(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=t;d(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Rc.mergeEvaluated.items(n,r.length,s.items));let u=n.name("valid"),l=n.const("len",(0,f$._)`${i}.length`);r.forEach((f,g)=>{(0,Rc.alwaysValidSchema)(s,f)||(n.if((0,f$._)`${l} > ${g}`,()=>t.subschema({keyword:a,schemaProp:g,dataProp:g},u)),t.ok(u))});function d(f){let{opts:g,errSchemaPath:m}=s,v=r.length,_=v===f.minItems&&(v===f.maxItems||f[e]===!1);if(g.strictTuples&&!_){let b=`"${a}" is ${v}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,Rc.checkStrictMode)(s,b,g.strictTuples)}}}_a.validateTuple=p$;_a.default=fT});var m$=O(Lm=>{"use strict";c();Object.defineProperty(Lm,"__esModule",{value:!0});var pT=qm(),mT={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,pT.validateTuple)(t,"items")};Lm.default=mT});var g$=O(Fm=>{"use strict";c();Object.defineProperty(Fm,"__esModule",{value:!0});var h$=W(),hT=ae(),gT=kt(),yT=Mm(),_T={message:({params:{len:t}})=>(0,h$.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,h$._)`{limit: ${t}}`},vT={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:_T,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,hT.alwaysValidSchema)(n,e)&&(o?(0,yT.validateAdditionalItems)(t,o):t.ok((0,gT.validateArray)(t)))}};Fm.default=vT});var y$=O(Vm=>{"use strict";c();Object.defineProperty(Vm,"__esModule",{value:!0});var zt=W(),Ac=ae(),bT={message:({params:{min:t,max:e}})=>e===void 0?(0,zt.str)`must contain at least ${t} valid item(s)`:(0,zt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,zt._)`{minContains: ${t}}`:(0,zt._)`{minContains: ${t}, maxContains: ${e}}`},$T={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:bT,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,a,s,{minContains:u,maxContains:l}=n;i.opts.next?(a=u===void 0?1:u,s=l):a=1;let d=e.const("len",(0,zt._)`${o}.length`);if(t.setParams({min:a,max:s}),s===void 0&&a===0){(0,Ac.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,Ac.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ac.alwaysValidSchema)(i,r)){let _=(0,zt._)`${d} >= ${a}`;s!==void 0&&(_=(0,zt._)`${_} && ${d} <= ${s}`),t.pass(_);return}i.items=!0;let f=e.name("valid");s===void 0&&a===1?m(f,()=>e.if(f,()=>e.break())):a===0?(e.let(f,!0),s!==void 0&&e.if((0,zt._)`${o}.length > 0`,g)):(e.let(f,!1),g()),t.result(f,()=>t.reset());function g(){let _=e.name("_valid"),b=e.let("count",0);m(_,()=>e.if(_,()=>v(b)))}function m(_,b){e.forRange("i",0,d,$=>{t.subschema({keyword:"contains",dataProp:$,dataPropType:Ac.Type.Num,compositeRule:!0},_),b()})}function v(_){e.code((0,zt._)`${_}++`),s===void 0?e.if((0,zt._)`${_} >= ${a}`,()=>e.assign(f,!0).break()):(e.if((0,zt._)`${_} > ${s}`,()=>e.assign(f,!1).break()),a===1?e.assign(f,!0):e.if((0,zt._)`${_} >= ${a}`,()=>e.assign(f,!0)))}}};Vm.default=$T});var b$=O(Vt=>{"use strict";c();Object.defineProperty(Vt,"__esModule",{value:!0});Vt.validateSchemaDeps=Vt.validatePropertyDeps=Vt.error=void 0;var Jm=W(),xT=ae(),va=kt();Vt.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Jm.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Jm._)`{property: ${t},
|
|
7
|
+
missingProperty: ${n},
|
|
8
|
+
depsCount: ${e},
|
|
9
|
+
deps: ${r}}`};var wT={keyword:"dependencies",type:"object",schemaType:"object",error:Vt.error,code(t){let[e,r]=kT(t);_$(t,e),v$(t,r)}};function kT({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function _$(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let a in e){let s=e[a];if(s.length===0)continue;let u=(0,va.propertyInData)(r,n,a,o.opts.ownProperties);t.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(u,()=>{for(let l of s)(0,va.checkReportMissingProp)(t,l)}):(r.if((0,Jm._)`${u} && (${(0,va.checkMissingProp)(t,s,i)})`),(0,va.reportMissingProp)(t,i),r.else())}}Vt.validatePropertyDeps=_$;function v$(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,a=r.name("valid");for(let s in e)(0,xT.alwaysValidSchema)(i,e[s])||(r.if((0,va.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let u=t.subschema({keyword:o,schemaProp:s},a);t.mergeValidEvaluated(u,a)},()=>r.var(a,!0)),t.ok(a))}Vt.validateSchemaDeps=v$;Vt.default=wT});var x$=O(Hm=>{"use strict";c();Object.defineProperty(Hm,"__esModule",{value:!0});var $$=W(),ST=ae(),zT={message:"property name must be valid",params:({params:t})=>(0,$$._)`{propertyName: ${t.propertyName}}`},IT={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:zT,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,ST.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),e.if((0,$$.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};Hm.default=IT});var Bm=O(Km=>{"use strict";c();Object.defineProperty(Km,"__esModule",{value:!0});var Uc=kt(),Rt=W(),PT=or(),Cc=ae(),jT={message:"must NOT have additional properties",params:({params:t})=>(0,Rt._)`{additionalProperty: ${t.additionalProperty}}`},OT={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:jT,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:u}=a;if(a.props=!0,u.removeAdditional!=="all"&&(0,Cc.alwaysValidSchema)(a,r))return;let l=(0,Uc.allSchemaProperties)(n.properties),d=(0,Uc.allSchemaProperties)(n.patternProperties);f(),t.ok((0,Rt._)`${i} === ${PT.default.errors}`);function f(){e.forIn("key",o,b=>{!l.length&&!d.length?v(b):e.if(g(b),()=>v(b))})}function g(b){let $;if(l.length>8){let x=(0,Cc.schemaRefOrVal)(a,n.properties,"properties");$=(0,Uc.isOwnProperty)(e,x,b)}else l.length?$=(0,Rt.or)(...l.map(x=>(0,Rt._)`${b} === ${x}`)):$=Rt.nil;return d.length&&($=(0,Rt.or)($,...d.map(x=>(0,Rt._)`${(0,Uc.usePattern)(t,x)}.test(${b})`))),(0,Rt.not)($)}function m(b){e.code((0,Rt._)`delete ${o}[${b}]`)}function v(b){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){m(b);return}if(r===!1){t.setParams({additionalProperty:b}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,Cc.alwaysValidSchema)(a,r)){let $=e.name("valid");u.removeAdditional==="failing"?(_(b,$,!1),e.if((0,Rt.not)($),()=>{t.reset(),m(b)})):(_(b,$),s||e.if((0,Rt.not)($),()=>e.break()))}}function _(b,$,x){let P={keyword:"additionalProperties",dataProp:b,dataPropType:Cc.Type.Str};x===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(P,$)}}};Km.default=OT});var S$=O(Gm=>{"use strict";c();Object.defineProperty(Gm,"__esModule",{value:!0});var TT=ia(),w$=kt(),Wm=ae(),k$=Bm(),ET={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&k$.default.code(new TT.KeywordCxt(i,k$.default,"additionalProperties"));let a=(0,w$.allSchemaProperties)(r);for(let f of a)i.definedProperties.add(f);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Wm.mergeEvaluated.props(e,(0,Wm.toHash)(a),i.props));let s=a.filter(f=>!(0,Wm.alwaysValidSchema)(i,r[f]));if(s.length===0)return;let u=e.name("valid");for(let f of s)l(f)?d(f):(e.if((0,w$.propertyInData)(e,o,f,i.opts.ownProperties)),d(f),i.allErrors||e.else().var(u,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(u);function l(f){return i.opts.useDefaults&&!i.compositeRule&&r[f].default!==void 0}function d(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},u)}}};Gm.default=ET});var j$=O(Xm=>{"use strict";c();Object.defineProperty(Xm,"__esModule",{value:!0});var z$=kt(),Dc=W(),I$=ae(),P$=ae(),NT={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:a}=i,s=(0,z$.allSchemaProperties)(r),u=s.filter(_=>(0,I$.alwaysValidSchema)(i,r[_]));if(s.length===0||u.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let l=a.strictSchema&&!a.allowMatchingProperties&&o.properties,d=e.name("valid");i.props!==!0&&!(i.props instanceof Dc.Name)&&(i.props=(0,P$.evaluatedPropsToName)(e,i.props));let{props:f}=i;g();function g(){for(let _ of s)l&&m(_),i.allErrors?v(_):(e.var(d,!0),v(_),e.if(d))}function m(_){for(let b in l)new RegExp(_).test(b)&&(0,I$.checkStrictMode)(i,`property ${b} matches pattern ${_} (use allowMatchingProperties)`)}function v(_){e.forIn("key",n,b=>{e.if((0,Dc._)`${(0,z$.usePattern)(t,_)}.test(${b})`,()=>{let $=u.includes(_);$||t.subschema({keyword:"patternProperties",schemaProp:_,dataProp:b,dataPropType:P$.Type.Str},d),i.opts.unevaluated&&f!==!0?e.assign((0,Dc._)`${f}[${b}]`,!0):!$&&!i.allErrors&&e.if((0,Dc.not)(d),()=>e.break())})})}}};Xm.default=NT});var O$=O(Ym=>{"use strict";c();Object.defineProperty(Ym,"__esModule",{value:!0});var RT=ae(),AT={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,RT.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Ym.default=AT});var T$=O(Qm=>{"use strict";c();Object.defineProperty(Qm,"__esModule",{value:!0});var UT=kt(),CT={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:UT.validateUnion,error:{message:"must match a schema in anyOf"}};Qm.default=CT});var E$=O(eh=>{"use strict";c();Object.defineProperty(eh,"__esModule",{value:!0});var Zc=W(),DT=ae(),ZT={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Zc._)`{passingSchemas: ${t.passing}}`},MT={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ZT,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=e.let("valid",!1),s=e.let("passing",null),u=e.name("_valid");t.setParams({passing:s}),e.block(l),t.result(a,()=>t.reset(),()=>t.error(!0));function l(){i.forEach((d,f)=>{let g;(0,DT.alwaysValidSchema)(o,d)?e.var(u,!0):g=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},u),f>0&&e.if((0,Zc._)`${u} && ${a}`).assign(a,!1).assign(s,(0,Zc._)`[${s}, ${f}]`).else(),e.if(u,()=>{e.assign(a,!0),e.assign(s,f),g&&t.mergeEvaluated(g,Zc.Name)})})}}};eh.default=MT});var N$=O(th=>{"use strict";c();Object.defineProperty(th,"__esModule",{value:!0});var qT=ae(),LT={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,a)=>{if((0,qT.alwaysValidSchema)(n,i))return;let s=t.subschema({keyword:"allOf",schemaProp:a},o);t.ok(o),t.mergeEvaluated(s)})}};th.default=LT});var U$=O(rh=>{"use strict";c();Object.defineProperty(rh,"__esModule",{value:!0});var Mc=W(),A$=ae(),FT={message:({params:t})=>(0,Mc.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Mc._)`{failingKeyword: ${t.ifClause}}`},VT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:FT,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,A$.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=R$(n,"then"),i=R$(n,"else");if(!o&&!i)return;let a=e.let("valid",!0),s=e.name("_valid");if(u(),t.reset(),o&&i){let d=e.let("ifClause");t.setParams({ifClause:d}),e.if(s,l("then",d),l("else",d))}else o?e.if(s,l("then")):e.if((0,Mc.not)(s),l("else"));t.pass(a,()=>t.error(!0));function u(){let d=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(d)}function l(d,f){return()=>{let g=t.subschema({keyword:d},s);e.assign(a,s),t.mergeValidEvaluated(g,a),f?e.assign(f,(0,Mc._)`${d}`):t.setParams({ifClause:d})}}}};function R$(t,e){let r=t.schema[e];return r!==void 0&&!(0,A$.alwaysValidSchema)(t,r)}rh.default=VT});var C$=O(nh=>{"use strict";c();Object.defineProperty(nh,"__esModule",{value:!0});var JT=ae(),HT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,JT.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};nh.default=HT});var D$=O(oh=>{"use strict";c();Object.defineProperty(oh,"__esModule",{value:!0});var KT=Mm(),BT=m$(),WT=qm(),GT=g$(),XT=y$(),YT=b$(),QT=x$(),eE=Bm(),tE=S$(),rE=j$(),nE=O$(),oE=T$(),iE=E$(),aE=N$(),sE=U$(),cE=C$();function uE(t=!1){let e=[nE.default,oE.default,iE.default,aE.default,sE.default,cE.default,QT.default,eE.default,YT.default,tE.default,rE.default];return t?e.push(BT.default,GT.default):e.push(KT.default,WT.default),e.push(XT.default),e}oh.default=uE});var Z$=O(ih=>{"use strict";c();Object.defineProperty(ih,"__esModule",{value:!0});var we=W(),lE={message:({schemaCode:t})=>(0,we.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,we._)`{format: ${t}}`},dE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:lE,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=t,{opts:u,errSchemaPath:l,schemaEnv:d,self:f}=s;if(!u.validateFormats)return;o?g():m();function g(){let v=r.scopeValue("formats",{ref:f.formats,code:u.code.formats}),_=r.const("fDef",(0,we._)`${v}[${a}]`),b=r.let("fType"),$=r.let("format");r.if((0,we._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(b,(0,we._)`${_}.type || "string"`).assign($,(0,we._)`${_}.validate`),()=>r.assign(b,(0,we._)`"string"`).assign($,_)),t.fail$data((0,we.or)(x(),P()));function x(){return u.strictSchema===!1?we.nil:(0,we._)`${a} && !${$}`}function P(){let Z=d.$async?(0,we._)`(${_}.async ? await ${$}(${n}) : ${$}(${n}))`:(0,we._)`${$}(${n})`,U=(0,we._)`(typeof ${$} == "function" ? ${Z} : ${$}.test(${n}))`;return(0,we._)`${$} && ${$} !== true && ${b} === ${e} && !${U}`}}function m(){let v=f.formats[i];if(!v){x();return}if(v===!0)return;let[_,b,$]=P(v);_===e&&t.pass(Z());function x(){if(u.strictSchema===!1){f.logger.warn(U());return}throw new Error(U());function U(){return`unknown format "${i}" ignored in schema at path "${l}"`}}function P(U){let ze=U instanceof RegExp?(0,we.regexpCode)(U):u.code.formats?(0,we._)`${u.code.formats}${(0,we.getProperty)(i)}`:void 0,We=r.scopeValue("formats",{key:i,ref:U,code:ze});return typeof U=="object"&&!(U instanceof RegExp)?[U.type||"string",U.validate,(0,we._)`${We}.validate`]:["string",U,We]}function Z(){if(typeof v=="object"&&!(v instanceof RegExp)&&v.async){if(!d.$async)throw new Error("async format in sync schema");return(0,we._)`await ${$}(${n})`}return typeof b=="function"?(0,we._)`${$}(${n})`:(0,we._)`${$}.test(${n})`}}}};ih.default=dE});var M$=O(ah=>{"use strict";c();Object.defineProperty(ah,"__esModule",{value:!0});var fE=Z$(),pE=[fE.default];ah.default=pE});var q$=O(oo=>{"use strict";c();Object.defineProperty(oo,"__esModule",{value:!0});oo.contentVocabulary=oo.metadataVocabulary=void 0;oo.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];oo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var F$=O(sh=>{"use strict";c();Object.defineProperty(sh,"__esModule",{value:!0});var mE=Gb(),hE=l$(),gE=D$(),yE=M$(),L$=q$(),_E=[mE.default,hE.default,(0,gE.default)(),yE.default,L$.metadataVocabulary,L$.contentVocabulary];sh.default=_E});var J$=O(qc=>{"use strict";c();Object.defineProperty(qc,"__esModule",{value:!0});qc.DiscrError=void 0;var V$;(function(t){t.Tag="tag",t.Mapping="mapping"})(V$||(qc.DiscrError=V$={}))});var K$=O(uh=>{"use strict";c();Object.defineProperty(uh,"__esModule",{value:!0});var io=W(),ch=J$(),H$=xc(),vE=aa(),bE=ae(),$E={message:({params:{discrError:t,tagName:e}})=>t===ch.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,io._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},xE={keyword:"discriminator",type:"object",schemaType:"object",error:$E,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let u=e.let("valid",!1),l=e.const("tag",(0,io._)`${r}${(0,io.getProperty)(s)}`);e.if((0,io._)`typeof ${l} == "string"`,()=>d(),()=>t.error(!1,{discrError:ch.DiscrError.Tag,tag:l,tagName:s})),t.ok(u);function d(){let m=g();e.if(!1);for(let v in m)e.elseIf((0,io._)`${l} === ${v}`),e.assign(u,f(m[v]));e.else(),t.error(!1,{discrError:ch.DiscrError.Mapping,tag:l,tagName:s}),e.endIf()}function f(m){let v=e.name("valid"),_=t.subschema({keyword:"oneOf",schemaProp:m},v);return t.mergeEvaluated(_,io.Name),v}function g(){var m;let v={},_=$(o),b=!0;for(let Z=0;Z<a.length;Z++){let U=a[Z];if(U?.$ref&&!(0,bE.schemaHasRulesButRef)(U,i.self.RULES)){let We=U.$ref;if(U=H$.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,We),U instanceof H$.SchemaEnv&&(U=U.schema),U===void 0)throw new vE.default(i.opts.uriResolver,i.baseId,We)}let ze=(m=U?.properties)===null||m===void 0?void 0:m[s];if(typeof ze!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);b=b&&(_||$(U)),x(ze,Z)}if(!b)throw new Error(`discriminator: "${s}" must be required`);return v;function $({required:Z}){return Array.isArray(Z)&&Z.includes(s)}function x(Z,U){if(Z.const)P(Z.const,U);else if(Z.enum)for(let ze of Z.enum)P(ze,U);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function P(Z,U){if(typeof Z!="string"||Z in v)throw new Error(`discriminator: "${s}" values must be unique strings`);v[Z]=U}}}};uh.default=xE});var B$=O((qF,wE)=>{wE.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 dh=O(($e,lh)=>{"use strict";c();Object.defineProperty($e,"__esModule",{value:!0});$e.MissingRefError=$e.ValidationError=$e.CodeGen=$e.Name=$e.nil=$e.stringify=$e.str=$e._=$e.KeywordCxt=$e.Ajv=void 0;var kE=Vb(),SE=F$(),zE=K$(),W$=B$(),IE=["/properties"],Lc="http://json-schema.org/draft-07/schema",ao=class extends kE.default{_addVocabularies(){super._addVocabularies(),SE.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(zE.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(W$,IE):W$;this.addMetaSchema(e,Lc,!1),this.refs["http://json-schema.org/schema"]=Lc}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Lc)?Lc:void 0)}};$e.Ajv=ao;lh.exports=$e=ao;lh.exports.Ajv=ao;Object.defineProperty($e,"__esModule",{value:!0});$e.default=ao;var PE=ia();Object.defineProperty($e,"KeywordCxt",{enumerable:!0,get:function(){return PE.KeywordCxt}});var so=W();Object.defineProperty($e,"_",{enumerable:!0,get:function(){return so._}});Object.defineProperty($e,"str",{enumerable:!0,get:function(){return so.str}});Object.defineProperty($e,"stringify",{enumerable:!0,get:function(){return so.stringify}});Object.defineProperty($e,"nil",{enumerable:!0,get:function(){return so.nil}});Object.defineProperty($e,"Name",{enumerable:!0,get:function(){return so.Name}});Object.defineProperty($e,"CodeGen",{enumerable:!0,get:function(){return so.CodeGen}});var jE=bc();Object.defineProperty($e,"ValidationError",{enumerable:!0,get:function(){return jE.default}});var OE=aa();Object.defineProperty($e,"MissingRefError",{enumerable:!0,get:function(){return OE.default}})});var nx=O(Ht=>{"use strict";c();Object.defineProperty(Ht,"__esModule",{value:!0});Ht.formatNames=Ht.fastFormats=Ht.fullFormats=void 0;function Jt(t,e){return{validate:t,compare:e}}Ht.fullFormats={date:Jt(Q$,hh),time:Jt(ph(!0),gh),"date-time":Jt(G$(!0),tx),"iso-time":Jt(ph(),ex),"iso-date-time":Jt(G$(),rx),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:UE,"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:FE,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:CE,int32:{type:"number",validate:ME},int64:{type:"number",validate:qE},float:{type:"number",validate:Y$},double:{type:"number",validate:Y$},password:!0,binary:!0};Ht.fastFormats={...Ht.fullFormats,date:Jt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,hh),time:Jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,gh),"date-time":Jt(/^\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,tx),"iso-time":Jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,ex),"iso-date-time":Jt(/^\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,rx),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};Ht.formatNames=Object.keys(Ht.fullFormats);function TE(t){return t%4===0&&(t%100!==0||t%400===0)}var EE=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,NE=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Q$(t){let e=EE.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&TE(r)?29:NE[n])}function hh(t,e){if(t&&e)return t>e?1:t<e?-1:0}var fh=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function ph(t){return function(r){let n=fh.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],u=n[5]==="-"?-1:1,l=+(n[6]||0),d=+(n[7]||0);if(l>23||d>59||t&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let f=i-d*u,g=o-l*u-(f<0?1:0);return(g===23||g===-1)&&(f===59||f===-1)&&a<61}}function gh(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function ex(t,e){if(!(t&&e))return;let r=fh.exec(t),n=fh.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var mh=/t|\s/i;function G$(t){let e=ph(t);return function(n){let o=n.split(mh);return o.length===2&&Q$(o[0])&&e(o[1])}}function tx(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function rx(t,e){if(!(t&&e))return;let[r,n]=t.split(mh),[o,i]=e.split(mh),a=hh(r,o);if(a!==void 0)return a||gh(n,i)}var RE=/\/|:/,AE=/^(?:[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 UE(t){return RE.test(t)&&AE.test(t)}var X$=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function CE(t){return X$.lastIndex=0,X$.test(t)}var DE=-(2**31),ZE=2**31-1;function ME(t){return Number.isInteger(t)&&t<=ZE&&t>=DE}function qE(t){return Number.isInteger(t)}function Y$(){return!0}var LE=/[^\\]\\Z/;function FE(t){if(LE.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var ox=O(co=>{"use strict";c();Object.defineProperty(co,"__esModule",{value:!0});co.formatLimitDefinition=void 0;var VE=dh(),At=W(),Tr=At.operators,Fc={formatMaximum:{okStr:"<=",ok:Tr.LTE,fail:Tr.GT},formatMinimum:{okStr:">=",ok:Tr.GTE,fail:Tr.LT},formatExclusiveMaximum:{okStr:"<",ok:Tr.LT,fail:Tr.GTE},formatExclusiveMinimum:{okStr:">",ok:Tr.GT,fail:Tr.LTE}},JE={message:({keyword:t,schemaCode:e})=>(0,At.str)`should be ${Fc[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,At._)`{comparison: ${Fc[t].okStr}, limit: ${e}}`};co.formatLimitDefinition={keyword:Object.keys(Fc),type:"string",schemaType:"string",$data:!0,error:JE,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:a,self:s}=i;if(!a.validateFormats)return;let u=new VE.KeywordCxt(i,s.RULES.all.format.definition,"format");u.$data?l():d();function l(){let g=e.scopeValue("formats",{ref:s.formats,code:a.code.formats}),m=e.const("fmt",(0,At._)`${g}[${u.schemaCode}]`);t.fail$data((0,At.or)((0,At._)`typeof ${m} != "object"`,(0,At._)`${m} instanceof RegExp`,(0,At._)`typeof ${m}.compare != "function"`,f(m)))}function d(){let g=u.schema,m=s.formats[g];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${o}": format "${g}" does not define "compare" function`);let v=e.scopeValue("formats",{key:g,ref:m,code:a.code.formats?(0,At._)`${a.code.formats}${(0,At.getProperty)(g)}`:void 0});t.fail$data(f(v))}function f(g){return(0,At._)`${g}.compare(${r}, ${n}) ${Fc[o].fail} 0`}},dependencies:["format"]};var HE=t=>(t.addKeyword(co.formatLimitDefinition),t);co.default=HE});var cx=O((ba,sx)=>{"use strict";c();Object.defineProperty(ba,"__esModule",{value:!0});var uo=nx(),KE=ox(),yh=W(),ix=new yh.Name("fullFormats"),BE=new yh.Name("fastFormats"),_h=(t,e={keywords:!0})=>{if(Array.isArray(e))return ax(t,e,uo.fullFormats,ix),t;let[r,n]=e.mode==="fast"?[uo.fastFormats,BE]:[uo.fullFormats,ix],o=e.formats||uo.formatNames;return ax(t,o,r,n),e.keywords&&(0,KE.default)(t),t};_h.get=(t,e="full")=>{let n=(e==="fast"?uo.fastFormats:uo.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function ax(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,yh._)`require("ajv-formats/dist/formats").${n}`);for(let a of e)t.addFormat(a,r[a])}sx.exports=ba=_h;Object.defineProperty(ba,"__esModule",{value:!0});ba.default=_h});var Gh=O((I5,Wh)=>{c();var hu=process||{},iw=hu.argv||[],mu=hu.env||{},u1=!(mu.NO_COLOR||iw.includes("--no-color"))&&(!!mu.FORCE_COLOR||iw.includes("--color")||hu.platform==="win32"||(hu.stdout||{}).isTTY&&mu.TERM!=="dumb"||!!mu.CI),l1=(t,e,r=t)=>n=>{let o=""+n,i=o.indexOf(e,t.length);return~i?t+d1(o,e,r,i)+e:t+o+e},d1=(t,e,r,n)=>{let o="",i=0;do o+=t.substring(i,n)+r,i=n+e.length,n=t.indexOf(e,i);while(~n);return o+t.substring(i)},aw=(t=u1)=>{let e=t?l1:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};Wh.exports=aw();Wh.exports.createColors=aw});function sw(t,e=0){return(qe[t[e+0]]+qe[t[e+1]]+qe[t[e+2]]+qe[t[e+3]]+"-"+qe[t[e+4]]+qe[t[e+5]]+"-"+qe[t[e+6]]+qe[t[e+7]]+"-"+qe[t[e+8]]+qe[t[e+9]]+"-"+qe[t[e+10]]+qe[t[e+11]]+qe[t[e+12]]+qe[t[e+13]]+qe[t[e+14]]+qe[t[e+15]]).toLowerCase()}var qe,cw=fr(()=>{c();qe=[];for(let t=0;t<256;++t)qe.push((t+256).toString(16).slice(1))});import{randomFillSync as f1}from"crypto";function Xh(){return gu>yu.length-16&&(f1(yu),gu=0),yu.slice(gu,gu+=16)}var yu,gu,uw=fr(()=>{c();yu=new Uint8Array(256),gu=yu.length});import{randomUUID as p1}from"crypto";var Yh,lw=fr(()=>{c();Yh={randomUUID:p1}});function m1(t,e,r){if(Yh.randomUUID&&!e&&!t)return Yh.randomUUID();t=t||{};let n=t.random??t.rng?.()??Xh();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let o=0;o<16;++o)e[r+o]=n[o];return e}return sw(n)}var Qh,dw=fr(()=>{c();lw();uw();cw();Qh=m1});var fw=fr(()=>{c();dw()});function Oe(t){h1&&console.log(pw.default.gray(`[verbose] ${t}`))}var pw,h1,mw=fr(()=>{"use strict";c();pw=Fa(Gh(),1),h1=!1});var gw={};Cr(gw,{clearApiKey:()=>w1,clearNamespace:()=>k1,getAnalyticsConsent:()=>b1,getApiKey:()=>og,getNamespace:()=>z1,getUserId:()=>v1,hasAskedConsent:()=>S1,initializeSettings:()=>Ut,setAnalyticsConsent:()=>$1,setApiKey:()=>x1,setNamespace:()=>I1});import{promises as rg}from"node:fs";import{homedir as eg,platform as g1}from"node:os";import{join as Eo}from"node:path";var hw,Te,tg,_u,No,y1,ng,yn,_1,Ut,v1,b1,og,$1,x1,w1,k1,S1,z1,I1,ig=fr(()=>{"use strict";c();hw=Fa(Gh(),1);fw();mw();Te=null,tg=!1,_u=()=>({userId:Qh(),analyticsConsent:!1,askedConsent:!1,cache:{servers:{}}}),No=()=>{if(process.env.SMITHERY_CONFIG_PATH)return process.env.SMITHERY_CONFIG_PATH;let t={win32:()=>Eo(process.env.APPDATA||Eo(eg(),"AppData","Roaming"),"smithery"),darwin:()=>Eo(eg(),"Library","Application Support","smithery"),default:()=>Eo(eg(),".config","smithery")};return(t[g1()]||t.default)()},y1=t=>{if(!t||typeof t!="object")return!1;let{userId:e,analyticsConsent:r,askedConsent:n}=t;return typeof e=="string"&&typeof r=="boolean"&&typeof n=="boolean"},ng=(t,e)=>`Permission denied: Cannot ${e} settings at ${t}
|
|
10
|
+
Fix with: chmod 700 "${t}"
|
|
11
|
+
Or use: export SMITHERY_CONFIG_PATH="/custom/path"
|
|
12
|
+
Running in memory-only mode (settings won't persist).`,yn=async(t,e)=>{Oe(`Saving settings to ${e}`),Oe(`Settings data: ${JSON.stringify(t,null,2)}`);try{try{Oe(`Ensuring directory exists: ${e}`),await rg.mkdir(e,{recursive:!0}),Oe("Directory check completed")}catch(n){if(Oe(`Directory creation error: ${JSON.stringify(n)}`),n instanceof Error&&"code"in n&&n.code==="EACCES")return{success:!1,error:ng(e,"write")};throw n}let r=Eo(e,"settings.json");return Oe(`Writing settings to file: ${r}`),await rg.writeFile(r,JSON.stringify(t,null,2)),Oe("Settings successfully written"),{success:!0,data:t}}catch(r){return Oe(`Settings save error: ${JSON.stringify(r)}`),{success:!1,error:r instanceof Error&&"code"in r&&r.code==="EACCES"?ng(e,"write"):`Failed to save settings: ${r instanceof Error?r.message:String(r)}`}}},_1=async t=>{Oe(`Loading settings from ${t}`);try{let e=Eo(t,"settings.json");Oe(`Reading settings file: ${e}`);try{let r=await rg.readFile(e,"utf-8");Oe("Settings file content loaded");let n=JSON.parse(r);if(Oe(`Settings parsed: ${JSON.stringify(n,null,2)}`),!y1(n)){Oe("Settings validation failed, fixing settings");let o={..._u(),...n};return o.analyticsConsent&&(o.askedConsent=!0),Oe(`Fixed settings: ${JSON.stringify(o,null,2)}`),await yn(o,t),{success:!0,data:o}}return{success:!0,data:n}}catch(r){if(Oe(`Settings read error: ${JSON.stringify(r)}`),r instanceof Error&&"code"in r){if(r.code==="ENOENT"){Oe("Settings file not found, creating default settings");let n=_u();return Oe(`Default settings: ${JSON.stringify(n,null,2)}`),await yn(n,t)}if(r.code==="EACCES")return{success:!1,error:ng(t,"read")}}throw r}}catch(e){return Oe(`Settings load error: ${JSON.stringify(e)}`),{success:!1,error:`Failed to load settings: ${e instanceof Error?e.message:String(e)}`}}},Ut=async()=>{if(tg&&Te)return{success:!0,data:Te};try{let t=No(),e=await _1(t);return e.success&&e.data&&(Te=e.data),tg=!0,e}catch(t){return Te=_u(),tg=!0,{success:!0,data:Te,error:`Warning: Running in memory-only mode - ${t instanceof Error?t.message:String(t)}`}}},v1=async()=>(await Ut(),Te?.userId||_u().userId),b1=async()=>{let t=await Ut();return!t.success||!t.data?(console.warn("[Config] Failed to load analytics settings:",t.error),!1):t.data.analyticsConsent},og=async()=>process.env.SMITHERY_API_KEY?process.env.SMITHERY_API_KEY:(await Ut(),Te?.apiKey),$1=async t=>{let e=await Ut();return!e.success||!e.data?e:(Te={...e.data,analyticsConsent:t,askedConsent:!0},await yn(Te,No()))},x1=async t=>{let e=await Ut();if(!e.success||!e.data)return e;Te={...e.data,apiKey:t};let r=await yn(Te,No());return r.success||console.warn(hw.default.yellow("Warning: Could not save API key to config. You may need to enter it again next time.")),r},w1=async()=>{let t=await Ut();if(!t.success||!t.data)return t;let{apiKey:e,...r}=t.data;return Te=r,await yn(Te,No())},k1=async()=>{let t=await Ut();if(!t.success||!t.data)return t;let{namespace:e,...r}=t.data;return Te=r,await yn(Te,No())},S1=async()=>(await Ut(),Te?.askedConsent||!1),z1=async()=>(await Ut(),Te?.namespace),I1=async t=>{let e=await Ut();return!e.success||!e.data?e:(Te={...e.data,namespace:t},await yn(Te,No()))}});c();c();c();c();c();c();c();c();c();c();var ee;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(ee||(ee={}));var sg;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(sg||(sg={}));var T=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Bt=t=>{switch(typeof t){case"undefined":return T.undefined;case"string":return T.string;case"number":return Number.isNaN(t)?T.nan:T.number;case"boolean":return T.boolean;case"function":return T.function;case"bigint":return T.bigint;case"symbol":return T.symbol;case"object":return Array.isArray(t)?T.array:t===null?T.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?T.promise:typeof Map<"u"&&t instanceof Map?T.map:typeof Set<"u"&&t instanceof Set?T.set:typeof Date<"u"&&t instanceof Date?T.date:T.object;default:return T.unknown}};var w=ee.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var ut=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,u=0;for(;u<a.path.length;){let l=a.path[u];u===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],u++}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};ut.create=t=>new ut(t);var Sw=(t,e)=>{let r;switch(t.code){case w.invalid_type:t.received===T.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case w.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ee.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(t.keys,", ")}`;break;case w.invalid_union:r="Invalid input";break;case w.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(t.options)}`;break;case w.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(t.options)}, received '${t.received}'`;break;case w.invalid_arguments:r="Invalid function arguments";break;case w.invalid_return_type:r="Invalid function return type";break;case w.invalid_date:r="Invalid date";break;case w.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ee.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case w.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case w.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case w.custom:r="Invalid input";break;case w.invalid_intersection_types:r="Intersection results could not be merged";break;case w.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case w.not_finite:r="Number must be finite";break;default:r=e.defaultError,ee.assertNever(t)}return{message:r}},pr=Sw;var zw=pr;function Ao(){return zw}c();var Va=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};function j(t,e){let r=Ao(),n=Va({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===pr?void 0:pr].filter(o=>!!o)});t.common.issues.push(n)}var Le=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return M;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return M;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},M=Object.freeze({status:"aborted"}),bn=t=>({status:"dirty",value:t}),Ge=t=>({status:"valid",value:t}),$u=t=>t.status==="aborted",xu=t=>t.status==="dirty",Dr=t=>t.status==="valid",Uo=t=>typeof Promise<"u"&&t instanceof Promise;c();c();c();var E;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(E||(E={}));var _t=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},cg=(t,e)=>{if(Dr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ut(t.common.issues);return this._error=r,this._error}}};function H(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:u}=t;return a.code==="invalid_enum_value"?{message:u??s.defaultError}:typeof s.data>"u"?{message:u??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:u??r??s.defaultError}},description:o}}var G=class{get description(){return this._def.description}_getType(e){return Bt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Bt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Le,ctx:{common:e.parent.common,data:e.data,parsedType:Bt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Uo(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Bt(e)},o=this._parseSync({data:e,path:n.path,parent:n});return cg(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Bt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Dr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Dr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Bt(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Uo(o)?o:Promise.resolve(o));return cg(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:w.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(u=>u?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new Pt({schema:this,typeName:D.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return It.create(this,this._def)}nullable(){return Xt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hr.create(this)}promise(){return Zr.create(this,this._def)}or(e){return Sn.create([this,e],this._def)}and(e){return zn.create(this,e,this._def)}transform(e){return new Pt({...H(this._def),schema:this,typeName:D.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Tn({...H(this._def),innerType:this,defaultValue:r,typeName:D.ZodDefault})}brand(){return new Ja({typeName:D.ZodBranded,type:this,...H(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new En({...H(this._def),innerType:this,catchValue:r,typeName:D.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ha.create(this,e)}readonly(){return Nn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Iw=/^c[^\s-]{8,}$/i,Pw=/^[0-9a-z]+$/,jw=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ow=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Tw=/^[a-z0-9_-]{21}$/i,Ew=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nw=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Rw=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Aw="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",wu,Uw=/^(?:(?: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])$/,Cw=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Dw=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Zw=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Mw=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,qw=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ug="((\\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])))",Lw=new RegExp(`^${ug}$`);function lg(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Fw(t){return new RegExp(`^${lg(t)}$`)}function Vw(t){let e=`${ug}T${lg(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Jw(t,e){return!!((e==="v4"||!e)&&Uw.test(t)||(e==="v6"||!e)&&Dw.test(t))}function Hw(t,e){if(!Ew.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function Kw(t,e){return!!((e==="v4"||!e)&&Cw.test(t)||(e==="v6"||!e)&&Zw.test(t))}var xn=class t extends G{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==T.string){let i=this._getOrReturnCtx(e);return j(i,{code:w.invalid_type,expected:T.string,received:i.parsedType}),M}let n=new Le,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),j(o,{code:w.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),j(o,{code:w.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?j(o,{code:w.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&j(o,{code:w.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Rw.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"email",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")wu||(wu=new RegExp(Aw,"u")),wu.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"emoji",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Ow.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"uuid",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Tw.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"nanoid",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Iw.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"cuid",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Pw.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"cuid2",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")jw.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"ulid",code:w.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),j(o,{validation:"url",code:w.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"regex",code:w.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),j(o,{code:w.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),j(o,{code:w.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),j(o,{code:w.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?Vw(i).test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{code:w.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Lw.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{code:w.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Fw(i).test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{code:w.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Nw.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"duration",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?Jw(e.data,i.version)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"ip",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Hw(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"jwt",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Kw(e.data,i.version)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"cidr",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Mw.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"base64",code:w.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?qw.test(e.data)||(o=this._getOrReturnCtx(e,o),j(o,{validation:"base64url",code:w.invalid_string,message:i.message}),n.dirty()):ee.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:w.invalid_string,...E.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...E.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...E.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...E.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...E.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...E.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...E.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...E.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...E.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...E.errToObj(r)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};xn.create=t=>new xn({checks:[],typeName:D.ZodString,coerce:t?.coerce??!1,...H(t)});function Bw(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var Co=class t extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==T.number){let i=this._getOrReturnCtx(e);return j(i,{code:w.invalid_type,expected:T.number,received:i.parsedType}),M}let n,o=new Le;for(let i of this._def.checks)i.kind==="int"?ee.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{code:w.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),j(n,{code:w.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),j(n,{code:w.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?Bw(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),j(n,{code:w.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),j(n,{code:w.not_finite,message:i.message}),o.dirty()):ee.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,E.toString(r))}gt(e,r){return this.setLimit("min",e,!1,E.toString(r))}lte(e,r){return this.setLimit("max",e,!0,E.toString(r))}lt(e,r){return this.setLimit("max",e,!1,E.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:E.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ee.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Co.create=t=>new Co({checks:[],typeName:D.ZodNumber,coerce:t?.coerce||!1,...H(t)});var Do=class t extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==T.bigint)return this._getInvalidInput(e);let n,o=new Le;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),j(n,{code:w.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),j(n,{code:w.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),j(n,{code:w.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):ee.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return j(r,{code:w.invalid_type,expected:T.bigint,received:r.parsedType}),M}gte(e,r){return this.setLimit("min",e,!0,E.toString(r))}gt(e,r){return this.setLimit("min",e,!1,E.toString(r))}lte(e,r){return this.setLimit("max",e,!0,E.toString(r))}lt(e,r){return this.setLimit("max",e,!1,E.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:E.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Do.create=t=>new Do({checks:[],typeName:D.ZodBigInt,coerce:t?.coerce??!1,...H(t)});var Zo=class extends G{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==T.boolean){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:T.boolean,received:n.parsedType}),M}return Ge(e.data)}};Zo.create=t=>new Zo({typeName:D.ZodBoolean,coerce:t?.coerce||!1,...H(t)});var Mo=class t extends G{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==T.date){let i=this._getOrReturnCtx(e);return j(i,{code:w.invalid_type,expected:T.date,received:i.parsedType}),M}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return j(i,{code:w.invalid_date}),M}let n=new Le,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),j(o,{code:w.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),j(o,{code:w.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):ee.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Mo.create=t=>new Mo({checks:[],coerce:t?.coerce||!1,typeName:D.ZodDate,...H(t)});var qo=class extends G{_parse(e){if(this._getType(e)!==T.symbol){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:T.symbol,received:n.parsedType}),M}return Ge(e.data)}};qo.create=t=>new qo({typeName:D.ZodSymbol,...H(t)});var wn=class extends G{_parse(e){if(this._getType(e)!==T.undefined){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:T.undefined,received:n.parsedType}),M}return Ge(e.data)}};wn.create=t=>new wn({typeName:D.ZodUndefined,...H(t)});var kn=class extends G{_parse(e){if(this._getType(e)!==T.null){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:T.null,received:n.parsedType}),M}return Ge(e.data)}};kn.create=t=>new kn({typeName:D.ZodNull,...H(t)});var Lo=class extends G{constructor(){super(...arguments),this._any=!0}_parse(e){return Ge(e.data)}};Lo.create=t=>new Lo({typeName:D.ZodAny,...H(t)});var mr=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ge(e.data)}};mr.create=t=>new mr({typeName:D.ZodUnknown,...H(t)});var Dt=class extends G{_parse(e){let r=this._getOrReturnCtx(e);return j(r,{code:w.invalid_type,expected:T.never,received:r.parsedType}),M}};Dt.create=t=>new Dt({typeName:D.ZodNever,...H(t)});var Fo=class extends G{_parse(e){if(this._getType(e)!==T.undefined){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:T.void,received:n.parsedType}),M}return Ge(e.data)}};Fo.create=t=>new Fo({typeName:D.ZodVoid,...H(t)});var hr=class t extends G{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==T.array)return j(r,{code:w.invalid_type,expected:T.array,received:r.parsedType}),M;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(j(r,{code:a?w.too_big:w.too_small,minimum:s?o.exactLength.value:void 0,maximum:a?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(j(r,{code:w.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(j(r,{code:w.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>o.type._parseAsync(new _t(r,a,r.path,s)))).then(a=>Le.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new _t(r,a,r.path,s)));return Le.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:E.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:E.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:E.toString(r)}})}nonempty(e){return this.min(1,e)}};hr.create=(t,e)=>new hr({type:t,minLength:null,maxLength:null,exactLength:null,typeName:D.ZodArray,...H(e)});function $n(t){if(t instanceof lt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=It.create($n(n))}return new lt({...t._def,shape:()=>e})}else return t instanceof hr?new hr({...t._def,type:$n(t.element)}):t instanceof It?It.create($n(t.unwrap())):t instanceof Xt?Xt.create($n(t.unwrap())):t instanceof Gt?Gt.create(t.items.map(e=>$n(e))):t}var lt=class t extends G{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ee.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==T.object){let l=this._getOrReturnCtx(e);return j(l,{code:w.invalid_type,expected:T.object,received:l.parsedType}),M}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof Dt&&this._def.unknownKeys==="strip"))for(let l in o.data)a.includes(l)||s.push(l);let u=[];for(let l of a){let d=i[l],f=o.data[l];u.push({key:{status:"valid",value:l},value:d._parse(new _t(o,f,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof Dt){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of s)u.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(l==="strict")s.length>0&&(j(o,{code:w.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of s){let f=o.data[d];u.push({key:{status:"valid",value:d},value:l._parse(new _t(o,f,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of u){let f=await d.key,g=await d.value;l.push({key:f,value:g,alwaysSet:d.alwaysSet})}return l}).then(l=>Le.mergeObjectSync(n,l)):Le.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:E.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:D.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ee.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ee.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return $n(this)}partial(e){let r={};for(let n of ee.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ee.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof It;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return dg(ee.objectKeys(this.shape))}};lt.create=(t,e)=>new lt({shape:()=>t,unknownKeys:"strip",catchall:Dt.create(),typeName:D.ZodObject,...H(e)});lt.strictCreate=(t,e)=>new lt({shape:()=>t,unknownKeys:"strict",catchall:Dt.create(),typeName:D.ZodObject,...H(e)});lt.lazycreate=(t,e)=>new lt({shape:t,unknownKeys:"strip",catchall:Dt.create(),typeName:D.ZodObject,...H(e)});var Sn=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new ut(s.ctx.common.issues));return j(r,{code:w.invalid_union,unionErrors:a}),M}if(r.common.async)return Promise.all(n.map(async i=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},d=u._parseSync({data:r.data,path:r.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(u=>new ut(u));return j(r,{code:w.invalid_union,unionErrors:s}),M}}get options(){return this._def.options}};Sn.create=(t,e)=>new Sn({options:t,typeName:D.ZodUnion,...H(e)});var Wt=t=>t instanceof In?Wt(t.schema):t instanceof Pt?Wt(t.innerType()):t instanceof Pn?[t.value]:t instanceof jn?t.options:t instanceof On?ee.objectValues(t.enum):t instanceof Tn?Wt(t._def.innerType):t instanceof wn?[void 0]:t instanceof kn?[null]:t instanceof It?[void 0,...Wt(t.unwrap())]:t instanceof Xt?[null,...Wt(t.unwrap())]:t instanceof Ja||t instanceof Nn?Wt(t.unwrap()):t instanceof En?Wt(t._def.innerType):[],ku=class t extends G{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==T.object)return j(r,{code:w.invalid_type,expected:T.object,received:r.parsedType}),M;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(j(r,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=Wt(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:D.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...H(n)})}};function Su(t,e){let r=Bt(t),n=Bt(e);if(t===e)return{valid:!0,data:t};if(r===T.object&&n===T.object){let o=ee.objectKeys(e),i=ee.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let u=Su(t[s],e[s]);if(!u.valid)return{valid:!1};a[s]=u.data}return{valid:!0,data:a}}else if(r===T.array&&n===T.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],u=Su(a,s);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===T.date&&n===T.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var zn=class extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if($u(i)||$u(a))return M;let s=Su(i.value,a.value);return s.valid?((xu(i)||xu(a))&&r.dirty(),{status:r.value,value:s.data}):(j(n,{code:w.invalid_intersection_types}),M)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};zn.create=(t,e,r)=>new zn({left:t,right:e,typeName:D.ZodIntersection,...H(r)});var Gt=class t extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.array)return j(n,{code:w.invalid_type,expected:T.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return j(n,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(j(n,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let u=this._def.items[s]||this._def.rest;return u?u._parse(new _t(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Le.mergeArray(r,a)):Le.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Gt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Gt({items:t,typeName:D.ZodTuple,rest:null,...H(e)})};var zu=class t extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.object)return j(n,{code:w.invalid_type,expected:T.object,received:n.parsedType}),M;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new _t(n,s,n.path,s)),value:a._parse(new _t(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Le.mergeObjectAsync(r,o):Le.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof G?new t({keyType:e,valueType:r,typeName:D.ZodRecord,...H(n)}):new t({keyType:xn.create(),valueType:e,typeName:D.ZodRecord,...H(r)})}},Vo=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.map)return j(n,{code:w.invalid_type,expected:T.map,received:n.parsedType}),M;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,u],l)=>({key:o._parse(new _t(n,s,n.path,[l,"key"])),value:i._parse(new _t(n,u,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let u of a){let l=await u.key,d=await u.value;if(l.status==="aborted"||d.status==="aborted")return M;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),s.set(l.value,d.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let u of a){let l=u.key,d=u.value;if(l.status==="aborted"||d.status==="aborted")return M;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),s.set(l.value,d.value)}return{status:r.value,value:s}}}};Vo.create=(t,e,r)=>new Vo({valueType:e,keyType:t,typeName:D.ZodMap,...H(r)});var Jo=class t extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==T.set)return j(n,{code:w.invalid_type,expected:T.set,received:n.parsedType}),M;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(j(n,{code:w.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(j(n,{code:w.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function a(u){let l=new Set;for(let d of u){if(d.status==="aborted")return M;d.status==="dirty"&&r.dirty(),l.add(d.value)}return{status:r.value,value:l}}let s=[...n.data.values()].map((u,l)=>i._parse(new _t(n,u,n.path,l)));return n.common.async?Promise.all(s).then(u=>a(u)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:E.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:E.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Jo.create=(t,e)=>new Jo({valueType:t,minSize:null,maxSize:null,typeName:D.ZodSet,...H(e)});var Iu=class t extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==T.function)return j(r,{code:w.invalid_type,expected:T.function,received:r.parsedType}),M;function n(s,u){return Va({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ao(),pr].filter(l=>!!l),issueData:{code:w.invalid_arguments,argumentsError:u}})}function o(s,u){return Va({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ao(),pr].filter(l=>!!l),issueData:{code:w.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Zr){let s=this;return Ge(async function(...u){let l=new ut([]),d=await s._def.args.parseAsync(u,i).catch(m=>{throw l.addIssue(n(u,m)),l}),f=await Reflect.apply(a,this,d);return await s._def.returns._def.type.parseAsync(f,i).catch(m=>{throw l.addIssue(o(f,m)),l})})}else{let s=this;return Ge(function(...u){let l=s._def.args.safeParse(u,i);if(!l.success)throw new ut([n(u,l.error)]);let d=Reflect.apply(a,this,l.data),f=s._def.returns.safeParse(d,i);if(!f.success)throw new ut([o(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Gt.create(e).rest(mr.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Gt.create([]).rest(mr.create()),returns:r||mr.create(),typeName:D.ZodFunction,...H(n)})}},In=class extends G{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};In.create=(t,e)=>new In({getter:t,typeName:D.ZodLazy,...H(e)});var Pn=class extends G{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return j(r,{received:r.data,code:w.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:e.data}}get value(){return this._def.value}};Pn.create=(t,e)=>new Pn({value:t,typeName:D.ZodLiteral,...H(e)});function dg(t,e){return new jn({values:t,typeName:D.ZodEnum,...H(e)})}var jn=class t extends G{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return j(r,{expected:ee.joinValues(n),received:r.parsedType,code:w.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return j(r,{received:r.data,code:w.invalid_enum_value,options:n}),M}return Ge(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};jn.create=dg;var On=class extends G{_parse(e){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==T.string&&n.parsedType!==T.number){let o=ee.objectValues(r);return j(n,{expected:ee.joinValues(o),received:n.parsedType,code:w.invalid_type}),M}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=ee.objectValues(r);return j(n,{received:n.data,code:w.invalid_enum_value,options:o}),M}return Ge(e.data)}get enum(){return this._def.values}};On.create=(t,e)=>new On({values:t,typeName:D.ZodNativeEnum,...H(e)});var Zr=class extends G{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==T.promise&&r.common.async===!1)return j(r,{code:w.invalid_type,expected:T.promise,received:r.parsedType}),M;let n=r.parsedType===T.promise?r.data:Promise.resolve(r.data);return Ge(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Zr.create=(t,e)=>new Zr({type:t,typeName:D.ZodPromise,...H(e)});var Pt=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===D.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{j(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return M;let u=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return u.status==="aborted"?M:u.status==="dirty"?bn(u.value):r.value==="dirty"?bn(u.value):u});{if(r.value==="aborted")return M;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?bn(s.value):r.value==="dirty"?bn(s.value):s}}if(o.type==="refinement"){let a=s=>{let u=o.refinement(s,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?M:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Dr(a))return M;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>Dr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):M);ee.assertNever(o)}};Pt.create=(t,e,r)=>new Pt({schema:t,typeName:D.ZodEffects,effect:e,...H(r)});Pt.createWithPreprocess=(t,e,r)=>new Pt({schema:e,effect:{type:"preprocess",transform:t},typeName:D.ZodEffects,...H(r)});var It=class extends G{_parse(e){return this._getType(e)===T.undefined?Ge(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};It.create=(t,e)=>new It({innerType:t,typeName:D.ZodOptional,...H(e)});var Xt=class extends G{_parse(e){return this._getType(e)===T.null?Ge(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Xt.create=(t,e)=>new Xt({innerType:t,typeName:D.ZodNullable,...H(e)});var Tn=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===T.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Tn.create=(t,e)=>new Tn({innerType:t,typeName:D.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...H(e)});var En=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Uo(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new ut(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};En.create=(t,e)=>new En({innerType:t,typeName:D.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...H(e)});var Ho=class extends G{_parse(e){if(this._getType(e)!==T.nan){let n=this._getOrReturnCtx(e);return j(n,{code:w.invalid_type,expected:T.nan,received:n.parsedType}),M}return{status:"valid",value:e.data}}};Ho.create=t=>new Ho({typeName:D.ZodNaN,...H(t)});var Ja=class extends G{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Ha=class t extends G{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?M:i.status==="dirty"?(r.dirty(),bn(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?M:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:D.ZodPipeline})}},Nn=class extends G{_parse(e){let r=this._def.innerType._parse(e),n=o=>(Dr(o)&&(o.value=Object.freeze(o.value)),o);return Uo(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Nn.create=(t,e)=>new Nn({innerType:t,typeName:D.ZodReadonly,...H(e)});var rR={object:lt.lazycreate},D;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(D||(D={}));var nR=xn.create,oR=Co.create,iR=Ho.create,aR=Do.create,sR=Zo.create,cR=Mo.create,uR=qo.create,lR=wn.create,dR=kn.create,fR=Lo.create,pR=mr.create,mR=Dt.create,hR=Fo.create,gR=hr.create,Ww=lt.create,yR=lt.strictCreate,_R=Sn.create,vR=ku.create,bR=zn.create,$R=Gt.create,xR=zu.create,wR=Vo.create,kR=Jo.create,SR=Iu.create,zR=In.create,IR=Pn.create,PR=jn.create,jR=On.create,OR=Zr.create,TR=Pt.create,ER=It.create,NR=Xt.create,RR=Pt.createWithPreprocess,AR=Ha.create;c();c();c();c();c();var Ba=Object.freeze({status:"aborted"});function y(t,e,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(t))return;s._zod.traits.add(t),e(s,u);let l=a.prototype,d=Object.keys(l);for(let f=0;f<d.length;f++){let g=d[f];g in s||(s[g]=l[g].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});function a(s){var u;let l=r?.Parent?new i:this;n(l,s),(u=l._zod).deferred??(u.deferred=[]);for(let d of l._zod.deferred)d();return l}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}var Zt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Mr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Ka={};function Ie(t){return t&&Object.assign(Ka,t),Ka}c();c();var k={};Cr(k,{BIGINT_FORMAT_RANGES:()=>Uu,Class:()=>ju,NUMBER_FORMAT_RANGES:()=>Au,aborted:()=>br,allowsEval:()=>Eu,assert:()=>rk,assertEqual:()=>Yw,assertIs:()=>ek,assertNever:()=>tk,assertNotEqual:()=>Qw,assignProp:()=>yr,base64ToUint8Array:()=>mg,base64urlToUint8Array:()=>vk,cached:()=>An,captureStackTrace:()=>Ga,cleanEnum:()=>_k,cleanRegex:()=>Wo,clone:()=>Xe,cloneDef:()=>ok,createTransparentProxy:()=>lk,defineLazy:()=>Q,esc:()=>Wa,escapeRegex:()=>vt,extend:()=>pk,finalizeIssue:()=>nt,floatSafeRemainder:()=>Ou,getElementAtPath:()=>ik,getEnumValues:()=>Bo,getLengthableOrigin:()=>Yo,getParsedType:()=>uk,getSizableOrigin:()=>Xo,hexToUint8Array:()=>$k,isObject:()=>qr,isPlainObject:()=>vr,issue:()=>Un,joinValues:()=>q,jsonStringifyReplacer:()=>Rn,merge:()=>hk,mergeDefs:()=>_r,normalizeParams:()=>z,nullish:()=>gr,numKeys:()=>ck,objectClone:()=>nk,omit:()=>fk,optionalKeys:()=>Ru,partial:()=>gk,pick:()=>dk,prefixIssues:()=>dt,primitiveTypes:()=>Nu,promiseAllObject:()=>ak,propertyKeyTypes:()=>Go,randomString:()=>sk,required:()=>yk,safeExtend:()=>mk,shallowClone:()=>pg,slugify:()=>Tu,stringifyPrimitive:()=>L,uint8ArrayToBase64:()=>hg,uint8ArrayToBase64url:()=>bk,uint8ArrayToHex:()=>xk,unwrapMessage:()=>Ko});c();function Yw(t){return t}function Qw(t){return t}function ek(t){}function tk(t){throw new Error("Unexpected value in exhaustive check")}function rk(t){}function Bo(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function q(t,e="|"){return t.map(r=>L(r)).join(e)}function Rn(t,e){return typeof e=="bigint"?e.toString():e}function An(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 Wo(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Ou(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let u=n.match(/\d?e-(\d?)/);u?.[1]&&(o=Number.parseInt(u[1]))}let i=r>o?r:o,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}var fg=Symbol("evaluating");function Q(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==fg)return n===void 0&&(n=fg,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function nk(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function yr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function _r(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function ok(t){return _r(t._zod.def)}function ik(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function ak(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<e.length;i++)o[e[i]]=n[i];return o})}function sk(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Wa(t){return JSON.stringify(t)}function Tu(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ga="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function qr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Eu=An(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function vr(t){if(qr(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(qr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function pg(t){return vr(t)?{...t}:Array.isArray(t)?[...t]:t}function ck(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var uk=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}`)}},Go=new Set(["string","number","symbol"]),Nu=new Set(["string","number","bigint","boolean","symbol","undefined"]);function vt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Xe(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function z(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 lk(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function L(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Ru(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Au={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]},Uu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function dk(t,e){let r=t._zod.def,n=_r(t._zod.def,{get shape(){let o={};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(o[i]=r.shape[i])}return yr(this,"shape",o),o},checks:[]});return Xe(t,n)}function fk(t,e){let r=t._zod.def,n=_r(t._zod.def,{get shape(){let o={...t._zod.def.shape};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&delete o[i]}return yr(this,"shape",o),o},checks:[]});return Xe(t,n)}function pk(t,e){if(!vr(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let o=_r(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return yr(this,"shape",i),i},checks:[]});return Xe(t,o)}function mk(t,e){if(!vr(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return yr(this,"shape",n),n},checks:t._zod.def.checks};return Xe(t,r)}function hk(t,e){let r=_r(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return yr(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Xe(t,r)}function gk(t,e,r){let n=_r(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=t?new t({type:"optional",innerType:o[a]}):o[a])}else for(let a in o)i[a]=t?new t({type:"optional",innerType:o[a]}):o[a];return yr(this,"shape",i),i},checks:[]});return Xe(e,n)}function yk(t,e,r){let n=_r(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new t({type:"nonoptional",innerType:o[a]});return yr(this,"shape",i),i},checks:[]});return Xe(e,n)}function br(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 dt(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Ko(t){return typeof t=="string"?t:t?.message}function nt(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Ko(t.inst?._zod.def?.error?.(t))??Ko(e?.error?.(t))??Ko(r.customError?.(t))??Ko(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function Xo(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Yo(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Un(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function _k(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function mg(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function hg(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function vk(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return mg(e+r)}function bk(t){return hg(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $k(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 n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function xk(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var ju=class{constructor(...e){}};var gg=(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,Rn,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Xa=y("$ZodError",gg),Qo=y("$ZodError",gg,{Parent:Error});function Ya(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function Qa(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let a=r,s=0;for(;s<i.path.length;){let u=i.path[s];s===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(e(i))):a[u]=a[u]||{_errors:[]},a=a[u],s++}}};return n(t),r}var ei=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new Zt;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>nt(u,i,Ie())));throw Ga(s,o?.callee),s}return a.value},ti=ei(Qo),ri=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(u=>nt(u,i,Ie())));throw Ga(s,o?.callee),s}return a.value},ni=ri(Qo),oi=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Zt;return i.issues.length?{success:!1,error:new(t??Xa)(i.issues.map(a=>nt(a,o,Ie())))}:{success:!0,data:i.value}},Cn=oi(Qo),ii=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>nt(a,o,Ie())))}:{success:!0,data:i.value}},ai=ii(Qo),yg=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ei(t)(e,r,o)};var _g=t=>(e,r,n)=>ei(t)(e,r,n);var vg=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ri(t)(e,r,o)};var bg=t=>async(e,r,n)=>ri(t)(e,r,n);var $g=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return oi(t)(e,r,o)};var xg=t=>(e,r,n)=>oi(t)(e,r,n);var wg=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ii(t)(e,r,o)};var kg=t=>async(e,r,n)=>ii(t)(e,r,n);c();c();var bt={};Cr(bt,{base64:()=>Yu,base64url:()=>es,bigint:()=>ol,boolean:()=>sl,browserEmail:()=>Tk,cidrv4:()=>Gu,cidrv6:()=>Xu,cuid:()=>Cu,cuid2:()=>Du,date:()=>el,datetime:()=>rl,domain:()=>Rk,duration:()=>Fu,e164:()=>Qu,email:()=>Ju,emoji:()=>Hu,extendedDuration:()=>kk,guid:()=>Vu,hex:()=>Ak,hostname:()=>Nk,html5Email:()=>Pk,idnEmail:()=>Ok,integer:()=>il,ipv4:()=>Ku,ipv6:()=>Bu,ksuid:()=>qu,lowercase:()=>ll,mac:()=>Wu,md5_base64:()=>Ck,md5_base64url:()=>Dk,md5_hex:()=>Uk,nanoid:()=>Lu,null:()=>cl,number:()=>al,rfc5322Email:()=>jk,sha1_base64:()=>Mk,sha1_base64url:()=>qk,sha1_hex:()=>Zk,sha256_base64:()=>Fk,sha256_base64url:()=>Vk,sha256_hex:()=>Lk,sha384_base64:()=>Hk,sha384_base64url:()=>Kk,sha384_hex:()=>Jk,sha512_base64:()=>Wk,sha512_base64url:()=>Gk,sha512_hex:()=>Bk,string:()=>nl,time:()=>tl,ulid:()=>Zu,undefined:()=>ul,unicodeEmail:()=>Sg,uppercase:()=>dl,uuid:()=>Lr,uuid4:()=>Sk,uuid6:()=>zk,uuid7:()=>Ik,xid:()=>Mu});c();var Cu=/^[cC][^\s-]{8,}$/,Du=/^[0-9a-z]+$/,Zu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Mu=/^[0-9a-vA-V]{20}$/,qu=/^[A-Za-z0-9]{27}$/,Lu=/^[a-zA-Z0-9_-]{21}$/,Fu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kk=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Vu=/^([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})$/,Lr=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)$/,Sk=Lr(4),zk=Lr(6),Ik=Lr(7),Ju=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pk=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,jk=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Sg=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Ok=Sg,Tk=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Ek="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hu(){return new RegExp(Ek,"u")}var Ku=/^(?:(?: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])$/,Bu=/^(([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}|:))$/,Wu=t=>{let e=vt(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},Gu=/^((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])$/,Xu=/^(([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])$/,Yu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,es=/^[A-Za-z0-9_-]*$/,Nk=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Rk=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Qu=/^\+(?:[0-9]){6,14}[0-9]$/,zg="(?:(?:\\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])))",el=new RegExp(`^${zg}$`);function Ig(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 tl(t){return new RegExp(`^${Ig(t)}$`)}function rl(t){let e=Ig({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${zg}T(?:${n})$`)}var nl=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},ol=/^-?\d+n?$/,il=/^-?\d+$/,al=/^-?\d+(?:\.\d+)?/,sl=/^(?:true|false)$/i,cl=/^null$/i;var ul=/^undefined$/i;var ll=/^[^A-Z]*$/,dl=/^[^a-z]*$/,Ak=/^[0-9a-fA-F]*$/;function si(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function ci(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var Uk=/^[0-9a-fA-F]{32}$/,Ck=si(22,"=="),Dk=ci(22),Zk=/^[0-9a-fA-F]{40}$/,Mk=si(27,"="),qk=ci(27),Lk=/^[0-9a-fA-F]{64}$/,Fk=si(43,"="),Vk=ci(43),Jk=/^[0-9a-fA-F]{96}$/,Hk=si(64,""),Kk=ci(64),Bk=/^[0-9a-fA-F]{128}$/,Wk=si(86,"=="),Gk=ci(86);var fe=y("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),jg={number:"number",bigint:"bigint",object:"date"},fl=y("$ZodCheckLessThan",(t,e)=>{fe.init(t,e);let r=jg[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),pl=y("$ZodCheckGreaterThan",(t,e)=>{fe.init(t,e);let r=jg[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Og=y("$ZodCheckMultipleOf",(t,e)=>{fe.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.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):Ou(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})}}),Tg=y("$ZodCheckNumberFormat",(t,e)=>{fe.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=Au[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=o,s.maximum=i,r&&(s.pattern=il)}),t._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inst:t})}}),Eg=y("$ZodCheckBigIntFormat",(t,e)=>{fe.init(t,e);let[r,n]=Uu[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),Ng=y("$ZodCheckMaxSize",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!gr(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:Xo(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Rg=y("$ZodCheckMinSize",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!gr(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:Xo(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Ag=y("$ZodCheckSizeEquals",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!gr(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let a=i>e.size;n.issues.push({origin:Xo(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Ug=y("$ZodCheckMaxLength",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!gr(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=Yo(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Cg=y("$ZodCheckMinLength",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!gr(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=Yo(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Dg=y("$ZodCheckLengthEquals",(t,e)=>{var r;fe.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!gr(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let a=Yo(o),s=i>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),ui=y("$ZodCheckStringFormat",(t,e)=>{var r,n;fe.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Zg=y("$ZodCheckRegex",(t,e)=>{ui.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})}}),Mg=y("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=ll),ui.init(t,e)}),qg=y("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=dl),ui.init(t,e)}),Lg=y("$ZodCheckIncludes",(t,e)=>{fe.init(t,e);let r=vt(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),Fg=y("$ZodCheckStartsWith",(t,e)=>{fe.init(t,e);let r=new RegExp(`^${vt(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Vg=y("$ZodCheckEndsWith",(t,e)=>{fe.init(t,e);let r=new RegExp(`.*${vt(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function Pg(t,e,r){t.issues.length&&e.issues.push(...dt(r,t.issues))}var Jg=y("$ZodCheckProperty",(t,e)=>{fe.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Pg(o,r,e.property));Pg(n,r,e.property)}}),Hg=y("$ZodCheckMimeType",(t,e)=>{fe.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),Kg=y("$ZodCheckOverwrite",(t,e)=>{fe.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});c();var ts=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 n=e.split(`
|
|
13
|
+
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(`
|
|
14
|
+
`))}};c();var Wg={major:4,minor:2,patch:1};var J=y("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Wg;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,s,u)=>{let l=br(a),d;for(let f of s){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(l)continue;let g=a.issues.length,m=f._zod.check(a);if(m instanceof Promise&&u?.async===!1)throw new Zt;if(d||m instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await m,a.issues.length!==g&&(l||(l=br(a,g)))});else{if(a.issues.length===g)continue;l||(l=br(a,g))}}return d?d.then(()=>a):a},i=(a,s,u)=>{if(br(a))return a.aborted=!0,a;let l=o(s,n,u);if(l instanceof Promise){if(u.async===!1)throw new Zt;return l.then(d=>t._zod.parse(d,u))}return t._zod.parse(l,u)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if(s.direction==="backward"){let l=t._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return l instanceof Promise?l.then(d=>i(d,a,s)):i(l,a,s)}let u=t._zod.parse(a,s);if(u instanceof Promise){if(s.async===!1)throw new Zt;return u.then(l=>o(l,n,s))}return o(u,n,s)}}t["~standard"]={validate:o=>{try{let i=Cn(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return ai(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),Fr=y("$ZodString",(t,e)=>{J.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??nl(t._zod.bag),t._zod.parse=(r,n)=>{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}}),ue=y("$ZodStringFormat",(t,e)=>{ui.init(t,e),Fr.init(t,e)}),hl=y("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Vu),ue.init(t,e)}),gl=y("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Lr(n))}else e.pattern??(e.pattern=Lr());ue.init(t,e)}),yl=y("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Ju),ue.init(t,e)}),_l=y("$ZodURL",(t,e)=>{ue.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.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(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.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=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),vl=y("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Hu()),ue.init(t,e)}),bl=y("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Lu),ue.init(t,e)}),$l=y("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Cu),ue.init(t,e)}),xl=y("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Du),ue.init(t,e)}),wl=y("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Zu),ue.init(t,e)}),kl=y("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Mu),ue.init(t,e)}),Sl=y("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=qu),ue.init(t,e)}),zl=y("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=rl(e)),ue.init(t,e)}),Il=y("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=el),ue.init(t,e)}),Pl=y("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=tl(e)),ue.init(t,e)}),jl=y("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Fu),ue.init(t,e)}),Ol=y("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Ku),ue.init(t,e),t._zod.bag.format="ipv4"}),Tl=y("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Bu),ue.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})}}}),El=y("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=Wu(e.delimiter)),ue.init(t,e),t._zod.bag.format="mac"}),Nl=y("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Gu),ue.init(t,e)}),Rl=y("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Xu),ue.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function sy(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Al=y("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Yu),ue.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{sy(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Xk(t){if(!es.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return sy(r)}var Ul=y("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=es),ue.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Xk(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Cl=y("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Qu),ue.init(t,e)});function Yk(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var Dl=y("$ZodJWT",(t,e)=>{ue.init(t,e),t._zod.check=r=>{Yk(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Zl=y("$ZodCustomStringFormat",(t,e)=>{ue.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),ss=y("$ZodNumber",(t,e)=>{J.init(t,e),t._zod.pattern=t._zod.bag.pattern??al,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),Ml=y("$ZodNumberFormat",(t,e)=>{Tg.init(t,e),ss.init(t,e)}),li=y("$ZodBoolean",(t,e)=>{J.init(t,e),t._zod.pattern=sl,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),cs=y("$ZodBigInt",(t,e)=>{J.init(t,e),t._zod.pattern=ol,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),ql=y("$ZodBigIntFormat",(t,e)=>{Eg.init(t,e),cs.init(t,e)}),Ll=y("$ZodSymbol",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),Fl=y("$ZodUndefined",(t,e)=>{J.init(t,e),t._zod.pattern=ul,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),Vl=y("$ZodNull",(t,e)=>{J.init(t,e),t._zod.pattern=cl,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),Jl=y("$ZodAny",(t,e)=>{J.init(t,e),t._zod.parse=r=>r}),Hl=y("$ZodUnknown",(t,e)=>{J.init(t,e),t._zod.parse=r=>r}),Kl=y("$ZodNever",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Bl=y("$ZodVoid",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),Wl=y("$ZodDate",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function Gg(t,e,r){t.issues.length&&e.issues.push(...dt(r,t.issues)),e.value[r]=t.value}var Gl=y("$ZodArray",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],u=e.element._zod.run({value:s,issues:[]},n);u instanceof Promise?i.push(u.then(l=>Gg(l,r,a))):Gg(u,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function as(t,e,r,n){t.issues.length&&e.issues.push(...dt(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function cy(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ru(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function uy(t,e,r,n,o,i){let a=[],s=o.keySet,u=o.catchall._zod,l=u.def.type;for(let d in e){if(s.has(d))continue;if(l==="never"){a.push(d);continue}let f=u.run({value:e[d],issues:[]},n);f instanceof Promise?t.push(f.then(g=>as(g,r,d,e))):as(f,r,d,e)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var ly=y("$ZodObject",(t,e)=>{if(J.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let u={...s};return Object.defineProperty(e,"shape",{value:u}),u}})}let n=An(()=>cy(e));Q(t._zod,"propValues",()=>{let s=e.shape,u={};for(let l in s){let d=s[l]._zod;if(d.values){u[l]??(u[l]=new Set);for(let f of d.values)u[l].add(f)}}return u});let o=qr,i=e.catchall,a;t._zod.parse=(s,u)=>{a??(a=n.value);let l=s.value;if(!o(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:t}),s;s.value={};let d=[],f=a.shape;for(let g of a.keys){let v=f[g]._zod.run({value:l[g],issues:[]},u);v instanceof Promise?d.push(v.then(_=>as(_,s,g,l))):as(v,s,g,l)}return i?uy(d,l,s,u,n.value,t):d.length?Promise.all(d).then(()=>s):s}}),dy=y("$ZodObjectJIT",(t,e)=>{ly.init(t,e);let r=t._zod.parse,n=An(()=>cy(e)),o=g=>{let m=new ts(["shape","payload","ctx"]),v=n.value,_=P=>{let Z=Wa(P);return`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`};m.write("const input = payload.value;");let b=Object.create(null),$=0;for(let P of v.keys)b[P]=`key_${$++}`;m.write("const newResult = {};");for(let P of v.keys){let Z=b[P],U=Wa(P);m.write(`const ${Z} = ${_(P)};`),m.write(`
|
|
15
|
+
if (${Z}.issues.length) {
|
|
16
|
+
payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
|
|
17
|
+
...iss,
|
|
18
|
+
path: iss.path ? [${U}, ...iss.path] : [${U}]
|
|
19
|
+
})));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if (${Z}.value === undefined) {
|
|
24
|
+
if (${U} in input) {
|
|
25
|
+
newResult[${U}] = undefined;
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
newResult[${U}] = ${Z}.value;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
`)}m.write("payload.value = newResult;"),m.write("return payload;");let x=m.compile();return(P,Z)=>x(g,P,Z)},i,a=qr,s=!Ka.jitless,l=s&&Eu.value,d=e.catchall,f;t._zod.parse=(g,m)=>{f??(f=n.value);let v=g.value;return a(v)?s&&l&&m?.async===!1&&m.jitless!==!0?(i||(i=o(e.shape)),g=i(g,m),d?uy([],v,g,m,f,t):g):r(g,m):(g.issues.push({expected:"object",code:"invalid_type",input:v,inst:t}),g)}});function Xg(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!br(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>nt(a,n,Ie())))}),e)}var di=y("$ZodUnion",(t,e)=>{J.init(t,e),Q(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Q(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Q(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),Q(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Wo(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let u of e.options){let l=u._zod.run({value:o.value,issues:[]},i);if(l instanceof Promise)s.push(l),a=!0;else{if(l.issues.length===0)return l;s.push(l)}}return a?Promise.all(s).then(u=>Xg(u,o,t,i)):Xg(s,o,t,i)}});function Yg(t,e,r,n){let o=t.filter(i=>i.issues.length===0);return o.length===1?(e.value=o[0].value,e):(o.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>nt(a,n,Ie())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}var Xl=y("$ZodXor",(t,e)=>{di.init(t,e),e.inclusive=!1;let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let u of e.options){let l=u._zod.run({value:o.value,issues:[]},i);l instanceof Promise?(s.push(l),a=!0):s.push(l)}return a?Promise.all(s).then(u=>Yg(u,o,t,i)):Yg(s,o,t,i)}}),Yl=y("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,di.init(t,e);let r=t._zod.parse;Q(t._zod,"propValues",()=>{let o={};for(let i of e.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[s,u]of Object.entries(a)){o[s]||(o[s]=new Set);for(let l of u)o[s].add(l)}}return o});let n=An(()=>{let o=e.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let u of s){if(i.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);i.set(u,a)}}return i});t._zod.parse=(o,i)=>{let a=o.value;if(!qr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:t}),o)}}),Ql=y("$ZodIntersection",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),a=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,l])=>Qg(r,u,l)):Qg(r,i,a)}});function ml(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(vr(t)&&vr(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let a=ml(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],a=ml(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Qg(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),br(t))return t;let n=ml(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var us=y("$ZodTuple",(t,e)=>{J.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(d=>d._zod.optin!=="optional"),u=s===-1?0:r.length-s;if(!e.rest){let d=i.length>r.length,f=i.length<u-1;if(d||f)return n.issues.push({...d?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},input:i,inst:t,origin:"array"}),n}let l=-1;for(let d of r){if(l++,l>=i.length&&l>=u)continue;let f=d._zod.run({value:i[l],issues:[]},o);f instanceof Promise?a.push(f.then(g=>rs(g,n,l))):rs(f,n,l)}if(e.rest){let d=i.slice(r.length);for(let f of d){l++;let g=e.rest._zod.run({value:f,issues:[]},o);g instanceof Promise?a.push(g.then(m=>rs(m,n,l))):rs(g,n,l)}}return a.length?Promise.all(a).then(()=>n):n}});function rs(t,e,r){t.issues.length&&e.issues.push(...dt(r,t.issues)),e.value[r]=t.value}var ed=y("$ZodRecord",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!vr(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],a=e.keyType._zod.values;if(a){r.value={};let s=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){s.add(typeof l=="number"?l.toString():l);let d=e.valueType._zod.run({value:o[l],issues:[]},n);d instanceof Promise?i.push(d.then(f=>{f.issues.length&&r.issues.push(...dt(l,f.issues)),r.value[l]=f.value})):(d.issues.length&&r.issues.push(...dt(l,d.issues)),r.value[l]=d.value)}let u;for(let l in o)s.has(l)||(u=u??[],u.push(l));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:u})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let u=e.keyType._zod.run({value:s,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){e.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>nt(d,n,Ie())),input:s,path:[s],inst:t});continue}let l=e.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...dt(s,d.issues)),r.value[u.value]=d.value})):(l.issues.length&&r.issues.push(...dt(s,l.issues)),r.value[u.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),td=y("$ZodMap",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[a,s]of o){let u=e.keyType._zod.run({value:a,issues:[]},n),l=e.valueType._zod.run({value:s,issues:[]},n);u instanceof Promise||l instanceof Promise?i.push(Promise.all([u,l]).then(([d,f])=>{ey(d,f,r,a,o,t,n)})):ey(u,l,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function ey(t,e,r,n,o,i,a){t.issues.length&&(Go.has(typeof n)?r.issues.push(...dt(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(s=>nt(s,a,Ie()))})),e.issues.length&&(Go.has(typeof n)?r.issues.push(...dt(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>nt(s,a,Ie()))})),r.value.set(t.value,e.value)}var rd=y("$ZodSet",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(u=>ty(u,r))):ty(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function ty(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var nd=y("$ZodEnum",(t,e)=>{J.init(t,e);let r=Bo(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>Go.has(typeof o)).map(o=>typeof o=="string"?vt(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:t}),o}}),od=y("$ZodLiteral",(t,e)=>{if(J.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(n=>typeof n=="string"?vt(n):n?vt(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),id=y("$ZodFile",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),ad=y("$ZodTransform",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mr(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new Zt;return r.value=o,r}});function ry(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var sd=y("$ZodOptional",(t,e)=>{J.init(t,e),t._zod.optin="optional",t._zod.optout="optional",Q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),Q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Wo(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>ry(i,r.value)):ry(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),cd=y("$ZodNullable",(t,e)=>{J.init(t,e),Q(t._zod,"optin",()=>e.innerType._zod.optin),Q(t._zod,"optout",()=>e.innerType._zod.optout),Q(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Wo(r.source)}|null)$`):void 0}),Q(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),ud=y("$ZodDefault",(t,e)=>{J.init(t,e),t._zod.optin="optional",Q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>ny(i,e)):ny(o,e)}});function ny(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var ld=y("$ZodPrefault",(t,e)=>{J.init(t,e),t._zod.optin="optional",Q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),dd=y("$ZodNonOptional",(t,e)=>{J.init(t,e),Q(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>oy(i,t)):oy(o,t)}});function oy(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 fd=y("$ZodSuccess",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mr("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),pd=y("$ZodCatch",(t,e)=>{J.init(t,e),Q(t._zod,"optin",()=>e.innerType._zod.optin),Q(t._zod,"optout",()=>e.innerType._zod.optout),Q(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>nt(a,n,Ie()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>nt(i,n,Ie()))},input:r.value}),r.issues=[]),r)}}),md=y("$ZodNaN",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),hd=y("$ZodPipe",(t,e)=>{J.init(t,e),Q(t._zod,"values",()=>e.in._zod.values),Q(t._zod,"optin",()=>e.in._zod.optin),Q(t._zod,"optout",()=>e.out._zod.optout),Q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>ns(a,e.in,n)):ns(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ns(i,e.out,n)):ns(o,e.out,n)}});function ns(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var fi=y("$ZodCodec",(t,e)=>{J.init(t,e),Q(t._zod,"values",()=>e.in._zod.values),Q(t._zod,"optin",()=>e.in._zod.optin),Q(t._zod,"optout",()=>e.out._zod.optout),Q(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>os(a,e,n)):os(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>os(a,e,n)):os(i,e,n)}}});function os(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>is(t,i,e.out,r)):is(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>is(t,i,e.in,r)):is(t,o,e.in,r)}}function is(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var gd=y("$ZodReadonly",(t,e)=>{J.init(t,e),Q(t._zod,"propValues",()=>e.innerType._zod.propValues),Q(t._zod,"values",()=>e.innerType._zod.values),Q(t._zod,"optin",()=>e.innerType?._zod?.optin),Q(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(iy):iy(o)}});function iy(t){return t.value=Object.freeze(t.value),t}var yd=y("$ZodTemplateLiteral",(t,e)=>{J.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Nu.has(typeof n))r.push(vt(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),_d=y("$ZodFunction",(t,e)=>(J.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?ti(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?ti(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await ni(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await ni(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new us({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),vd=y("$ZodPromise",(t,e)=>{J.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),bd=y("$ZodLazy",(t,e)=>{J.init(t,e),Q(t._zod,"innerType",()=>e.getter()),Q(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),Q(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),Q(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),Q(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),$d=y("$ZodCustom",(t,e)=>{fe.init(t,e),J.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>ay(i,r,n,t));ay(o,r,n,t)}});function ay(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Un(o))}}c();c();c();c();c();c();c();c();c();c();var eS=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},tS=()=>{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"}};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"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${eS(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${L(n.values[0])}`:`Invalid option: expected one of ${q(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.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":""}: ${q(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function xd(){return{localeError:tS()}}c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();var fy;var kd=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return 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 n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Sd(){return new kd}(fy=globalThis).__zod_globalRegistry??(fy.__zod_globalRegistry=Sd());var ot=globalThis.__zod_globalRegistry;c();function zd(t,e){return new t({type:"string",...z(e)})}function Id(t,e){return new t({type:"string",coerce:!0,...z(e)})}function ls(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...z(e)})}function pi(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...z(e)})}function ds(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...z(e)})}function fs(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(e)})}function ps(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(e)})}function ms(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(e)})}function mi(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...z(e)})}function hs(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...z(e)})}function gs(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(e)})}function ys(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...z(e)})}function _s(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(e)})}function vs(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...z(e)})}function bs(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...z(e)})}function $s(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(e)})}function xs(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(e)})}function ws(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(e)})}function Pd(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...z(e)})}function ks(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(e)})}function Ss(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(e)})}function zs(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...z(e)})}function Is(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...z(e)})}function Ps(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...z(e)})}function js(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...z(e)})}function jd(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(e)})}function Od(t,e){return new t({type:"string",format:"date",check:"string_format",...z(e)})}function Td(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...z(e)})}function Ed(t,e){return new t({type:"string",format:"duration",check:"string_format",...z(e)})}function Nd(t,e){return new t({type:"number",checks:[],...z(e)})}function Rd(t,e){return new t({type:"number",coerce:!0,checks:[],...z(e)})}function Ad(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...z(e)})}function Ud(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...z(e)})}function Cd(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...z(e)})}function Dd(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...z(e)})}function Zd(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...z(e)})}function Md(t,e){return new t({type:"boolean",...z(e)})}function qd(t,e){return new t({type:"boolean",coerce:!0,...z(e)})}function Ld(t,e){return new t({type:"bigint",...z(e)})}function Fd(t,e){return new t({type:"bigint",coerce:!0,...z(e)})}function Vd(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...z(e)})}function Jd(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...z(e)})}function Hd(t,e){return new t({type:"symbol",...z(e)})}function Kd(t,e){return new t({type:"undefined",...z(e)})}function Bd(t,e){return new t({type:"null",...z(e)})}function Wd(t){return new t({type:"any"})}function Gd(t){return new t({type:"unknown"})}function Xd(t,e){return new t({type:"never",...z(e)})}function Yd(t,e){return new t({type:"void",...z(e)})}function Qd(t,e){return new t({type:"date",...z(e)})}function ef(t,e){return new t({type:"date",coerce:!0,...z(e)})}function tf(t,e){return new t({type:"nan",...z(e)})}function Yt(t,e){return new fl({check:"less_than",...z(e),value:t,inclusive:!1})}function ft(t,e){return new fl({check:"less_than",...z(e),value:t,inclusive:!0})}function Qt(t,e){return new pl({check:"greater_than",...z(e),value:t,inclusive:!1})}function Ye(t,e){return new pl({check:"greater_than",...z(e),value:t,inclusive:!0})}function rf(t){return Qt(0,t)}function nf(t){return Yt(0,t)}function of(t){return ft(0,t)}function af(t){return Ye(0,t)}function Vr(t,e){return new Og({check:"multiple_of",...z(e),value:t})}function Dn(t,e){return new Ng({check:"max_size",...z(e),maximum:t})}function Jr(t,e){return new Rg({check:"min_size",...z(e),minimum:t})}function hi(t,e){return new Ag({check:"size_equals",...z(e),size:t})}function Zn(t,e){return new Ug({check:"max_length",...z(e),maximum:t})}function $r(t,e){return new Cg({check:"min_length",...z(e),minimum:t})}function Mn(t,e){return new Dg({check:"length_equals",...z(e),length:t})}function gi(t,e){return new Zg({check:"string_format",format:"regex",...z(e),pattern:t})}function yi(t){return new Mg({check:"string_format",format:"lowercase",...z(t)})}function _i(t){return new qg({check:"string_format",format:"uppercase",...z(t)})}function vi(t,e){return new Lg({check:"string_format",format:"includes",...z(e),includes:t})}function bi(t,e){return new Fg({check:"string_format",format:"starts_with",...z(e),prefix:t})}function $i(t,e){return new Vg({check:"string_format",format:"ends_with",...z(e),suffix:t})}function sf(t,e,r){return new Jg({check:"property",property:t,schema:e,...z(r)})}function xi(t,e){return new Hg({check:"mime_type",mime:t,...z(e)})}function Mt(t){return new Kg({check:"overwrite",tx:t})}function wi(t){return Mt(e=>e.normalize(t))}function ki(){return Mt(t=>t.trim())}function Si(){return Mt(t=>t.toLowerCase())}function zi(){return Mt(t=>t.toUpperCase())}function Os(){return Mt(t=>Tu(t))}function py(t,e,r){return new t({type:"array",element:e,...z(r)})}function cf(t,e){return new t({type:"file",...z(e)})}function uf(t,e,r){let n=z(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function lf(t,e,r){return new t({type:"custom",check:"custom",fn:e,...z(r)})}function df(t){let e=iS(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Un(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(Un(o))}},t(r.value,r)));return e}function iS(t,e){let r=new fe({check:"custom",...z(e)});return r._zod.check=t,r}function ff(t){let e=new fe({check:"describe"});return e._zod.onattach=[r=>{let n=ot.get(r)??{};ot.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function pf(t){let e=new fe({check:"meta"});return e._zod.onattach=[r=>{let n=ot.get(r)??{};ot.add(r,{...n,...t})}],e._zod.check=()=>{},e}function mf(t,e){let r=z(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),a=new Set(o),s=t.Codec??fi,u=t.Boolean??li,l=t.String??Fr,d=new l({type:"string",error:r.error}),f=new u({type:"boolean",error:r.error}),g=new s({type:"pipe",in:d,out:f,transform:((m,v)=>{let _=m;return r.case!=="sensitive"&&(_=_.toLowerCase()),i.has(_)?!0:a.has(_)?!1:(v.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:v.value,inst:g,continue:!1}),{})}),reverseTransform:((m,v)=>m===!0?n[0]||"true":o[0]||"false"),error:r.error});return g}function qn(t,e,r,n={}){let o=z(n),i={...z(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}c();function Ts(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??ot,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 _e(t,e,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,a);let s=t._zod.toJSONSchema?.();if(s)a.schema=s;else{let d={...r,schemaPath:[...r.schemaPath,t],path:r.path},f=t._zod.parent;if(f)a.ref=f,_e(f,e,d),e.seen.get(f).isParent=!0;else if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,d);else{let g=a.schema,m=e.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(t,e,g,d)}}let u=e.metadataRegistry.get(t);return u&&Object.assign(a.schema,u),e.io==="input"&&Qe(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function Es(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=i=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let d=t.external.registry.get(i[0])?.id,f=t.external.uri??(m=>m);if(d)return{ref:f(d)};let g=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=g,{defId:g,ref:`${f("__shared")}#/${a}/${g}`}}if(i[1]===r)return{ref:"#"};let u=`#/${a}/`,l=i[1].schema.id??`__schema${t.counter++}`;return{defId:l,ref:u+l}},o=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:s,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=s};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>
|
|
32
|
+
|
|
33
|
+
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]){o(i);continue}if(t.external){let u=t.external.registry.get(i[0])?.id;if(e!==i[0]&&u){o(i);continue}}if(t.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&t.reused==="ref"){o(i);continue}}}function Ns(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=t.seen.get(a),u=s.def??s.schema,l={...u};if(s.ref===null)return;let d=s.ref;if(s.ref=null,d){n(d);let f=t.seen.get(d).schema;f.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):(Object.assign(u,f),Object.assign(u,l))}s.isParent||t.override({zodSchema:a,jsonSchema:u,path:s.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$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");o.$id=t.external.uri(a)}Object.assign(o,r.def??r.schema);let i=t.external?.defs??{};for(let a of t.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:Ii(e,"input"),output:Ii(e,"output")}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Qe(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Qe(n.element,r);if(n.type==="set")return Qe(n.valueType,r);if(n.type==="lazy")return Qe(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Qe(n.innerType,r);if(n.type==="intersection")return Qe(n.left,r)||Qe(n.right,r);if(n.type==="record"||n.type==="map")return Qe(n.keyType,r)||Qe(n.valueType,r);if(n.type==="pipe")return Qe(n.in,r)||Qe(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Qe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Qe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Qe(o,r))return!0;return!!(n.rest&&Qe(n.rest,r))}return!1}var my=(t,e={})=>r=>{let n=Ts({...r,processors:e});return _e(t,n),Es(n,t),Ns(n,t)},Ii=(t,e)=>r=>{let{libraryOptions:n,target:o}=r??{},i=Ts({...n??{},target:o,io:e,processors:{}});return _e(t,i),Es(i,t),Ns(i,t)};c();var aS={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hy=(t,e,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:u,contentEncoding:l}=t._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=aS[s]??s,o.format===""&&delete o.format),l&&(o.contentEncoding=l),u&&u.size>0){let d=[...u];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(f=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},gy=(t,e,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:u,exclusiveMaximum:l,exclusiveMinimum:d}=t._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof d=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),typeof i=="number"&&(o.minimum=i,typeof d=="number"&&e.target!=="draft-04"&&(d>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.maximum=l,o.exclusiveMaximum=!0):o.exclusiveMaximum=l),typeof a=="number"&&(o.maximum=a,typeof l=="number"&&e.target!=="draft-04"&&(l<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},yy=(t,e,r,n)=>{r.type="boolean"},_y=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},vy=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},by=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},$y=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},xy=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},wy=(t,e,r,n)=>{r.not={}},ky=(t,e,r,n)=>{},Sy=(t,e,r,n)=>{},zy=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Iy=(t,e,r,n)=>{let o=t._zod.def,i=Bo(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Py=(t,e,r,n)=>{let o=t._zod.def,i=[];for(let a of o.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},jy=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Oy=(t,e,r,n)=>{let o=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Ty=(t,e,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:u}=t._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),u?u.length===1?(i.contentMediaType=u[0],Object.assign(o,i)):o.anyOf=u.map(l=>({...i,contentMediaType:l})):Object.assign(o,i)},Ey=(t,e,r,n)=>{r.type="boolean"},Ny=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ry=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Ay=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Uy=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Cy=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Dy=(t,e,r,n)=>{let o=r,i=t._zod.def,{minimum:a,maximum:s}=t._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=_e(i.element,e,{...n,path:[...n.path,"items"]})},Zy=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object",o.properties={};let a=i.shape;for(let l in a)o.properties[l]=_e(a[l],e,{...n,path:[...n.path,"properties",l]});let s=new Set(Object.keys(a)),u=new Set([...s].filter(l=>{let d=i.shape[l]._zod;return e.io==="input"?d.optin===void 0:d.optout===void 0}));u.size>0&&(o.required=Array.from(u)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=_e(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},hf=(t,e,r,n)=>{let o=t._zod.def,i=o.inclusive===!1,a=o.options.map((s,u)=>_e(s,e,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));i?r.oneOf=a:r.anyOf=a},My=(t,e,r,n)=>{let o=t._zod.def,i=_e(o.left,e,{...n,path:[...n.path,"allOf",0]}),a=_e(o.right,e,{...n,path:[...n.path,"allOf",1]}),s=l=>"allOf"in l&&Object.keys(l).length===1,u=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=u},qy=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((g,m)=>_e(g,e,{...n,path:[...n.path,a,m]})),l=i.rest?_e(i.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(o.prefixItems=u,l&&(o.items=l)):e.target==="openapi-3.0"?(o.items={anyOf:u},l&&o.items.anyOf.push(l),o.minItems=u.length,l||(o.maxItems=u.length)):(o.items=u,l&&(o.additionalItems=l));let{minimum:d,maximum:f}=t._zod.bag;typeof d=="number"&&(o.minItems=d),typeof f=="number"&&(o.maxItems=f)},Ly=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object",(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=_e(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=_e(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]})},Fy=(t,e,r,n)=>{let o=t._zod.def,i=_e(o.innerType,e,n),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Vy=(t,e,r,n)=>{let o=t._zod.def;_e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},Jy=(t,e,r,n)=>{let o=t._zod.def;_e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Hy=(t,e,r,n)=>{let o=t._zod.def;_e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ky=(t,e,r,n)=>{let o=t._zod.def;_e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},By=(t,e,r,n)=>{let o=t._zod.def,i=e.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;_e(i,e,n);let a=e.seen.get(t);a.ref=i},Wy=(t,e,r,n)=>{let o=t._zod.def;_e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.readOnly=!0},Gy=(t,e,r,n)=>{let o=t._zod.def;_e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},Xy=(t,e,r,n)=>{let o=t._zod.def;_e(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},Yy=(t,e,r,n)=>{let o=t._zod.innerType;_e(o,e,n);let i=e.seen.get(t);i.ref=o};c();c();c();c();c();c();c();function Ln(t){return!!t._zod}function Ot(t,e){return Ln(t)?Cn(t,e):t.safeParse(e)}function Rs(t){if(!t)return;let e;if(Ln(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function r_(t){if(Ln(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.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 n=t.value;if(n!==void 0)return n}c();c();c();c();var Pi={};Cr(Pi,{ZodAny:()=>b_,ZodArray:()=>k_,ZodBase64:()=>Mf,ZodBase64URL:()=>qf,ZodBigInt:()=>Ri,ZodBigIntFormat:()=>Vf,ZodBoolean:()=>Ni,ZodCIDRv4:()=>Df,ZodCIDRv6:()=>Zf,ZodCUID:()=>Tf,ZodCUID2:()=>Ef,ZodCatch:()=>L_,ZodCodec:()=>Xf,ZodCustom:()=>Js,ZodCustomStringFormat:()=>Ti,ZodDate:()=>Ms,ZodDefault:()=>U_,ZodDiscriminatedUnion:()=>z_,ZodE164:()=>Lf,ZodEmail:()=>If,ZodEmoji:()=>jf,ZodEnum:()=>ji,ZodFile:()=>N_,ZodFunction:()=>X_,ZodGUID:()=>Us,ZodIPv4:()=>Uf,ZodIPv6:()=>Cf,ZodIntersection:()=>I_,ZodJWT:()=>Ff,ZodKSUID:()=>Af,ZodLazy:()=>B_,ZodLiteral:()=>E_,ZodMAC:()=>g_,ZodMap:()=>O_,ZodNaN:()=>V_,ZodNanoID:()=>Of,ZodNever:()=>x_,ZodNonOptional:()=>Wf,ZodNull:()=>v_,ZodNullable:()=>A_,ZodNumber:()=>Ei,ZodNumberFormat:()=>Fn,ZodObject:()=>qs,ZodOptional:()=>Bf,ZodPipe:()=>Gf,ZodPrefault:()=>D_,ZodPromise:()=>G_,ZodReadonly:()=>J_,ZodRecord:()=>Vs,ZodSet:()=>T_,ZodString:()=>Oi,ZodStringFormat:()=>pe,ZodSuccess:()=>q_,ZodSymbol:()=>y_,ZodTemplateLiteral:()=>K_,ZodTransform:()=>R_,ZodTuple:()=>P_,ZodType:()=>B,ZodULID:()=>Nf,ZodURL:()=>Zs,ZodUUID:()=>er,ZodUndefined:()=>__,ZodUnion:()=>Ls,ZodUnknown:()=>$_,ZodVoid:()=>w_,ZodXID:()=>Rf,ZodXor:()=>S_,_ZodString:()=>zf,_default:()=>C_,_function:()=>y0,any:()=>Jf,array:()=>S,base64:()=>CS,base64url:()=>DS,bigint:()=>WS,boolean:()=>ce,catch:()=>F_,check:()=>_0,cidrv4:()=>AS,cidrv6:()=>US,codec:()=>m0,cuid:()=>IS,cuid2:()=>PS,custom:()=>Yf,date:()=>t0,describe:()=>v0,discriminatedUnion:()=>Fs,e164:()=>ZS,email:()=>_S,emoji:()=>SS,enum:()=>Fe,file:()=>l0,float32:()=>JS,float64:()=>HS,function:()=>y0,guid:()=>vS,hash:()=>VS,hex:()=>FS,hostname:()=>LS,httpUrl:()=>kS,instanceof:()=>$0,int:()=>Sf,int32:()=>KS,int64:()=>GS,intersection:()=>Ui,ipv4:()=>ES,ipv6:()=>RS,json:()=>w0,jwt:()=>MS,keyof:()=>r0,ksuid:()=>TS,lazy:()=>W_,literal:()=>N,looseObject:()=>Se,looseRecord:()=>a0,mac:()=>NS,map:()=>s0,meta:()=>b0,nan:()=>p0,nanoid:()=>zS,nativeEnum:()=>u0,never:()=>Hf,nonoptional:()=>M_,null:()=>Ai,nullable:()=>Cs,nullish:()=>d0,number:()=>ne,object:()=>I,optional:()=>ve,partialRecord:()=>i0,pipe:()=>Ds,prefault:()=>Z_,preprocess:()=>Hs,promise:()=>g0,readonly:()=>H_,record:()=>ge,refine:()=>Y_,set:()=>c0,strictObject:()=>n0,string:()=>h,stringFormat:()=>qS,stringbool:()=>x0,success:()=>f0,superRefine:()=>Q_,symbol:()=>YS,templateLiteral:()=>h0,transform:()=>Kf,tuple:()=>j_,uint32:()=>BS,uint64:()=>XS,ulid:()=>jS,undefined:()=>QS,union:()=>le,unknown:()=>me,url:()=>Pf,uuid:()=>bS,uuidv4:()=>$S,uuidv6:()=>xS,uuidv7:()=>wS,void:()=>e0,xid:()=>OS,xor:()=>o0});c();var As={};Cr(As,{endsWith:()=>$i,gt:()=>Qt,gte:()=>Ye,includes:()=>vi,length:()=>Mn,lowercase:()=>yi,lt:()=>Yt,lte:()=>ft,maxLength:()=>Zn,maxSize:()=>Dn,mime:()=>xi,minLength:()=>$r,minSize:()=>Jr,multipleOf:()=>Vr,negative:()=>nf,nonnegative:()=>af,nonpositive:()=>of,normalize:()=>wi,overwrite:()=>Mt,positive:()=>rf,property:()=>sf,regex:()=>gi,size:()=>hi,slugify:()=>Os,startsWith:()=>bi,toLowerCase:()=>Si,toUpperCase:()=>zi,trim:()=>ki,uppercase:()=>_i});c();var Hr={};Cr(Hr,{ZodISODate:()=>vf,ZodISODateTime:()=>yf,ZodISODuration:()=>wf,ZodISOTime:()=>$f,date:()=>bf,datetime:()=>_f,duration:()=>kf,time:()=>xf});c();var yf=y("ZodISODateTime",(t,e)=>{zl.init(t,e),pe.init(t,e)});function _f(t){return jd(yf,t)}var vf=y("ZodISODate",(t,e)=>{Il.init(t,e),pe.init(t,e)});function bf(t){return Od(vf,t)}var $f=y("ZodISOTime",(t,e)=>{Pl.init(t,e),pe.init(t,e)});function xf(t){return Td($f,t)}var wf=y("ZodISODuration",(t,e)=>{jl.init(t,e),pe.init(t,e)});function kf(t){return Ed(wf,t)}c();c();var n_=(t,e)=>{Xa.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Qa(t,r)},flatten:{value:r=>Ya(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Rn,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Rn,2)}},isEmpty:{get(){return t.issues.length===0}}})},oZ=y("ZodError",n_),pt=y("ZodError",n_,{Parent:Error});var o_=ei(pt),i_=ri(pt),a_=oi(pt),s_=ii(pt),c_=yg(pt),u_=_g(pt),l_=vg(pt),d_=bg(pt),f_=$g(pt),p_=xg(pt),m_=wg(pt),h_=kg(pt);var B=y("ZodType",(t,e)=>(J.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:Ii(t,"input"),output:Ii(t,"output")}}),t.toJSONSchema=my(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(k.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Xe(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>o_(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>a_(t,r,n),t.parseAsync=async(r,n)=>i_(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>s_(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>c_(t,r,n),t.decode=(r,n)=>u_(t,r,n),t.encodeAsync=async(r,n)=>l_(t,r,n),t.decodeAsync=async(r,n)=>d_(t,r,n),t.safeEncode=(r,n)=>f_(t,r,n),t.safeDecode=(r,n)=>p_(t,r,n),t.safeEncodeAsync=async(r,n)=>m_(t,r,n),t.safeDecodeAsync=async(r,n)=>h_(t,r,n),t.refine=(r,n)=>t.check(Y_(r,n)),t.superRefine=r=>t.check(Q_(r)),t.overwrite=r=>t.check(Mt(r)),t.optional=()=>ve(t),t.nullable=()=>Cs(t),t.nullish=()=>ve(Cs(t)),t.nonoptional=r=>M_(t,r),t.array=()=>S(t),t.or=r=>le([t,r]),t.and=r=>Ui(t,r),t.transform=r=>Ds(t,Kf(r)),t.default=r=>C_(t,r),t.prefault=r=>Z_(t,r),t.catch=r=>F_(t,r),t.pipe=r=>Ds(t,r),t.readonly=()=>H_(t),t.describe=r=>{let n=t.clone();return ot.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return ot.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return ot.get(t);let n=t.clone();return ot.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),zf=y("_ZodString",(t,e)=>{Fr.init(t,e),B.init(t,e),t._zod.processJSONSchema=(n,o,i)=>hy(t,n,o,i);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(gi(...n)),t.includes=(...n)=>t.check(vi(...n)),t.startsWith=(...n)=>t.check(bi(...n)),t.endsWith=(...n)=>t.check($i(...n)),t.min=(...n)=>t.check($r(...n)),t.max=(...n)=>t.check(Zn(...n)),t.length=(...n)=>t.check(Mn(...n)),t.nonempty=(...n)=>t.check($r(1,...n)),t.lowercase=n=>t.check(yi(n)),t.uppercase=n=>t.check(_i(n)),t.trim=()=>t.check(ki()),t.normalize=(...n)=>t.check(wi(...n)),t.toLowerCase=()=>t.check(Si()),t.toUpperCase=()=>t.check(zi()),t.slugify=()=>t.check(Os())}),Oi=y("ZodString",(t,e)=>{Fr.init(t,e),zf.init(t,e),t.email=r=>t.check(ls(If,r)),t.url=r=>t.check(mi(Zs,r)),t.jwt=r=>t.check(js(Ff,r)),t.emoji=r=>t.check(hs(jf,r)),t.guid=r=>t.check(pi(Us,r)),t.uuid=r=>t.check(ds(er,r)),t.uuidv4=r=>t.check(fs(er,r)),t.uuidv6=r=>t.check(ps(er,r)),t.uuidv7=r=>t.check(ms(er,r)),t.nanoid=r=>t.check(gs(Of,r)),t.guid=r=>t.check(pi(Us,r)),t.cuid=r=>t.check(ys(Tf,r)),t.cuid2=r=>t.check(_s(Ef,r)),t.ulid=r=>t.check(vs(Nf,r)),t.base64=r=>t.check(zs(Mf,r)),t.base64url=r=>t.check(Is(qf,r)),t.xid=r=>t.check(bs(Rf,r)),t.ksuid=r=>t.check($s(Af,r)),t.ipv4=r=>t.check(xs(Uf,r)),t.ipv6=r=>t.check(ws(Cf,r)),t.cidrv4=r=>t.check(ks(Df,r)),t.cidrv6=r=>t.check(Ss(Zf,r)),t.e164=r=>t.check(Ps(Lf,r)),t.datetime=r=>t.check(_f(r)),t.date=r=>t.check(bf(r)),t.time=r=>t.check(xf(r)),t.duration=r=>t.check(kf(r))});function h(t){return zd(Oi,t)}var pe=y("ZodStringFormat",(t,e)=>{ue.init(t,e),zf.init(t,e)}),If=y("ZodEmail",(t,e)=>{yl.init(t,e),pe.init(t,e)});function _S(t){return ls(If,t)}var Us=y("ZodGUID",(t,e)=>{hl.init(t,e),pe.init(t,e)});function vS(t){return pi(Us,t)}var er=y("ZodUUID",(t,e)=>{gl.init(t,e),pe.init(t,e)});function bS(t){return ds(er,t)}function $S(t){return fs(er,t)}function xS(t){return ps(er,t)}function wS(t){return ms(er,t)}var Zs=y("ZodURL",(t,e)=>{_l.init(t,e),pe.init(t,e)});function Pf(t){return mi(Zs,t)}function kS(t){return mi(Zs,{protocol:/^https?$/,hostname:bt.domain,...k.normalizeParams(t)})}var jf=y("ZodEmoji",(t,e)=>{vl.init(t,e),pe.init(t,e)});function SS(t){return hs(jf,t)}var Of=y("ZodNanoID",(t,e)=>{bl.init(t,e),pe.init(t,e)});function zS(t){return gs(Of,t)}var Tf=y("ZodCUID",(t,e)=>{$l.init(t,e),pe.init(t,e)});function IS(t){return ys(Tf,t)}var Ef=y("ZodCUID2",(t,e)=>{xl.init(t,e),pe.init(t,e)});function PS(t){return _s(Ef,t)}var Nf=y("ZodULID",(t,e)=>{wl.init(t,e),pe.init(t,e)});function jS(t){return vs(Nf,t)}var Rf=y("ZodXID",(t,e)=>{kl.init(t,e),pe.init(t,e)});function OS(t){return bs(Rf,t)}var Af=y("ZodKSUID",(t,e)=>{Sl.init(t,e),pe.init(t,e)});function TS(t){return $s(Af,t)}var Uf=y("ZodIPv4",(t,e)=>{Ol.init(t,e),pe.init(t,e)});function ES(t){return xs(Uf,t)}var g_=y("ZodMAC",(t,e)=>{El.init(t,e),pe.init(t,e)});function NS(t){return Pd(g_,t)}var Cf=y("ZodIPv6",(t,e)=>{Tl.init(t,e),pe.init(t,e)});function RS(t){return ws(Cf,t)}var Df=y("ZodCIDRv4",(t,e)=>{Nl.init(t,e),pe.init(t,e)});function AS(t){return ks(Df,t)}var Zf=y("ZodCIDRv6",(t,e)=>{Rl.init(t,e),pe.init(t,e)});function US(t){return Ss(Zf,t)}var Mf=y("ZodBase64",(t,e)=>{Al.init(t,e),pe.init(t,e)});function CS(t){return zs(Mf,t)}var qf=y("ZodBase64URL",(t,e)=>{Ul.init(t,e),pe.init(t,e)});function DS(t){return Is(qf,t)}var Lf=y("ZodE164",(t,e)=>{Cl.init(t,e),pe.init(t,e)});function ZS(t){return Ps(Lf,t)}var Ff=y("ZodJWT",(t,e)=>{Dl.init(t,e),pe.init(t,e)});function MS(t){return js(Ff,t)}var Ti=y("ZodCustomStringFormat",(t,e)=>{Zl.init(t,e),pe.init(t,e)});function qS(t,e,r={}){return qn(Ti,t,e,r)}function LS(t){return qn(Ti,"hostname",bt.hostname,t)}function FS(t){return qn(Ti,"hex",bt.hex,t)}function VS(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=bt[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return qn(Ti,n,o,e)}var Ei=y("ZodNumber",(t,e)=>{ss.init(t,e),B.init(t,e),t._zod.processJSONSchema=(n,o,i)=>gy(t,n,o,i),t.gt=(n,o)=>t.check(Qt(n,o)),t.gte=(n,o)=>t.check(Ye(n,o)),t.min=(n,o)=>t.check(Ye(n,o)),t.lt=(n,o)=>t.check(Yt(n,o)),t.lte=(n,o)=>t.check(ft(n,o)),t.max=(n,o)=>t.check(ft(n,o)),t.int=n=>t.check(Sf(n)),t.safe=n=>t.check(Sf(n)),t.positive=n=>t.check(Qt(0,n)),t.nonnegative=n=>t.check(Ye(0,n)),t.negative=n=>t.check(Yt(0,n)),t.nonpositive=n=>t.check(ft(0,n)),t.multipleOf=(n,o)=>t.check(Vr(n,o)),t.step=(n,o)=>t.check(Vr(n,o)),t.finite=()=>t;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 ne(t){return Nd(Ei,t)}var Fn=y("ZodNumberFormat",(t,e)=>{Ml.init(t,e),Ei.init(t,e)});function Sf(t){return Ad(Fn,t)}function JS(t){return Ud(Fn,t)}function HS(t){return Cd(Fn,t)}function KS(t){return Dd(Fn,t)}function BS(t){return Zd(Fn,t)}var Ni=y("ZodBoolean",(t,e)=>{li.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>yy(t,r,n,o)});function ce(t){return Md(Ni,t)}var Ri=y("ZodBigInt",(t,e)=>{cs.init(t,e),B.init(t,e),t._zod.processJSONSchema=(n,o,i)=>_y(t,n,o,i),t.gte=(n,o)=>t.check(Ye(n,o)),t.min=(n,o)=>t.check(Ye(n,o)),t.gt=(n,o)=>t.check(Qt(n,o)),t.gte=(n,o)=>t.check(Ye(n,o)),t.min=(n,o)=>t.check(Ye(n,o)),t.lt=(n,o)=>t.check(Yt(n,o)),t.lte=(n,o)=>t.check(ft(n,o)),t.max=(n,o)=>t.check(ft(n,o)),t.positive=n=>t.check(Qt(BigInt(0),n)),t.negative=n=>t.check(Yt(BigInt(0),n)),t.nonpositive=n=>t.check(ft(BigInt(0),n)),t.nonnegative=n=>t.check(Ye(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(Vr(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function WS(t){return Ld(Ri,t)}var Vf=y("ZodBigIntFormat",(t,e)=>{ql.init(t,e),Ri.init(t,e)});function GS(t){return Vd(Vf,t)}function XS(t){return Jd(Vf,t)}var y_=y("ZodSymbol",(t,e)=>{Ll.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>vy(t,r,n,o)});function YS(t){return Hd(y_,t)}var __=y("ZodUndefined",(t,e)=>{Fl.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>$y(t,r,n,o)});function QS(t){return Kd(__,t)}var v_=y("ZodNull",(t,e)=>{Vl.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>by(t,r,n,o)});function Ai(t){return Bd(v_,t)}var b_=y("ZodAny",(t,e)=>{Jl.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ky(t,r,n,o)});function Jf(){return Wd(b_)}var $_=y("ZodUnknown",(t,e)=>{Hl.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Sy(t,r,n,o)});function me(){return Gd($_)}var x_=y("ZodNever",(t,e)=>{Kl.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>wy(t,r,n,o)});function Hf(t){return Xd(x_,t)}var w_=y("ZodVoid",(t,e)=>{Bl.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>xy(t,r,n,o)});function e0(t){return Yd(w_,t)}var Ms=y("ZodDate",(t,e)=>{Wl.init(t,e),B.init(t,e),t._zod.processJSONSchema=(n,o,i)=>zy(t,n,o,i),t.min=(n,o)=>t.check(Ye(n,o)),t.max=(n,o)=>t.check(ft(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function t0(t){return Qd(Ms,t)}var k_=y("ZodArray",(t,e)=>{Gl.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Dy(t,r,n,o),t.element=e.element,t.min=(r,n)=>t.check($r(r,n)),t.nonempty=r=>t.check($r(1,r)),t.max=(r,n)=>t.check(Zn(r,n)),t.length=(r,n)=>t.check(Mn(r,n)),t.unwrap=()=>t.element});function S(t,e){return py(k_,t,e)}function r0(t){let e=t._zod.def.shape;return Fe(Object.keys(e))}var qs=y("ZodObject",(t,e)=>{dy.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Zy(t,r,n,o),k.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Fe(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:me()}),t.loose=()=>t.clone({...t._zod.def,catchall:me()}),t.strict=()=>t.clone({...t._zod.def,catchall:Hf()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>k.extend(t,r),t.safeExtend=r=>k.safeExtend(t,r),t.merge=r=>k.merge(t,r),t.pick=r=>k.pick(t,r),t.omit=r=>k.omit(t,r),t.partial=(...r)=>k.partial(Bf,t,r[0]),t.required=(...r)=>k.required(Wf,t,r[0])});function I(t,e){let r={type:"object",shape:t??{},...k.normalizeParams(e)};return new qs(r)}function n0(t,e){return new qs({type:"object",shape:t,catchall:Hf(),...k.normalizeParams(e)})}function Se(t,e){return new qs({type:"object",shape:t,catchall:me(),...k.normalizeParams(e)})}var Ls=y("ZodUnion",(t,e)=>{di.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>hf(t,r,n,o),t.options=e.options});function le(t,e){return new Ls({type:"union",options:t,...k.normalizeParams(e)})}var S_=y("ZodXor",(t,e)=>{Ls.init(t,e),Xl.init(t,e),t._zod.processJSONSchema=(r,n,o)=>hf(t,r,n,o),t.options=e.options});function o0(t,e){return new S_({type:"union",options:t,inclusive:!1,...k.normalizeParams(e)})}var z_=y("ZodDiscriminatedUnion",(t,e)=>{Ls.init(t,e),Yl.init(t,e)});function Fs(t,e,r){return new z_({type:"union",options:e,discriminator:t,...k.normalizeParams(r)})}var I_=y("ZodIntersection",(t,e)=>{Ql.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>My(t,r,n,o)});function Ui(t,e){return new I_({type:"intersection",left:t,right:e})}var P_=y("ZodTuple",(t,e)=>{us.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>qy(t,r,n,o),t.rest=r=>t.clone({...t._zod.def,rest:r})});function j_(t,e,r){let n=e instanceof J,o=n?r:e,i=n?e:null;return new P_({type:"tuple",items:t,rest:i,...k.normalizeParams(o)})}var Vs=y("ZodRecord",(t,e)=>{ed.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ly(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function ge(t,e,r){return new Vs({type:"record",keyType:t,valueType:e,...k.normalizeParams(r)})}function i0(t,e,r){let n=Xe(t);return n._zod.values=void 0,new Vs({type:"record",keyType:n,valueType:e,...k.normalizeParams(r)})}function a0(t,e,r){return new Vs({type:"record",keyType:t,valueType:e,mode:"loose",...k.normalizeParams(r)})}var O_=y("ZodMap",(t,e)=>{td.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Uy(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function s0(t,e,r){return new O_({type:"map",keyType:t,valueType:e,...k.normalizeParams(r)})}var T_=y("ZodSet",(t,e)=>{rd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Cy(t,r,n,o),t.min=(...r)=>t.check(Jr(...r)),t.nonempty=r=>t.check(Jr(1,r)),t.max=(...r)=>t.check(Dn(...r)),t.size=(...r)=>t.check(hi(...r))});function c0(t,e){return new T_({type:"set",valueType:t,...k.normalizeParams(e)})}var ji=y("ZodEnum",(t,e)=>{nd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Iy(t,n,o,i),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ji({...e,checks:[],...k.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ji({...e,checks:[],...k.normalizeParams(o),entries:i})}});function Fe(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new ji({type:"enum",entries:r,...k.normalizeParams(e)})}function u0(t,e){return new ji({type:"enum",entries:t,...k.normalizeParams(e)})}var E_=y("ZodLiteral",(t,e)=>{od.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Py(t,r,n,o),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 N(t,e){return new E_({type:"literal",values:Array.isArray(t)?t:[t],...k.normalizeParams(e)})}var N_=y("ZodFile",(t,e)=>{id.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ty(t,r,n,o),t.min=(r,n)=>t.check(Jr(r,n)),t.max=(r,n)=>t.check(Dn(r,n)),t.mime=(r,n)=>t.check(xi(Array.isArray(r)?r:[r],n))});function l0(t){return cf(N_,t)}var R_=y("ZodTransform",(t,e)=>{ad.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ay(t,r,n,o),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Mr(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(k.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push(k.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Kf(t){return new R_({type:"transform",transform:t})}var Bf=y("ZodOptional",(t,e)=>{sd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Xy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function ve(t){return new Bf({type:"optional",innerType:t})}var A_=y("ZodNullable",(t,e)=>{cd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Fy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Cs(t){return new A_({type:"nullable",innerType:t})}function d0(t){return ve(Cs(t))}var U_=y("ZodDefault",(t,e)=>{ud.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Jy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function C_(t,e){return new U_({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():k.shallowClone(e)}})}var D_=y("ZodPrefault",(t,e)=>{ld.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Hy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Z_(t,e){return new D_({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():k.shallowClone(e)}})}var Wf=y("ZodNonOptional",(t,e)=>{dd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Vy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function M_(t,e){return new Wf({type:"nonoptional",innerType:t,...k.normalizeParams(e)})}var q_=y("ZodSuccess",(t,e)=>{fd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ey(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function f0(t){return new q_({type:"success",innerType:t})}var L_=y("ZodCatch",(t,e)=>{pd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ky(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function F_(t,e){return new L_({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var V_=y("ZodNaN",(t,e)=>{md.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>jy(t,r,n,o)});function p0(t){return tf(V_,t)}var Gf=y("ZodPipe",(t,e)=>{hd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>By(t,r,n,o),t.in=e.in,t.out=e.out});function Ds(t,e){return new Gf({type:"pipe",in:t,out:e})}var Xf=y("ZodCodec",(t,e)=>{Gf.init(t,e),fi.init(t,e)});function m0(t,e,r){return new Xf({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var J_=y("ZodReadonly",(t,e)=>{gd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Wy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function H_(t){return new J_({type:"readonly",innerType:t})}var K_=y("ZodTemplateLiteral",(t,e)=>{yd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Oy(t,r,n,o)});function h0(t,e){return new K_({type:"template_literal",parts:t,...k.normalizeParams(e)})}var B_=y("ZodLazy",(t,e)=>{bd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Yy(t,r,n,o),t.unwrap=()=>t._zod.def.getter()});function W_(t){return new B_({type:"lazy",getter:t})}var G_=y("ZodPromise",(t,e)=>{vd.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Gy(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function g0(t){return new G_({type:"promise",innerType:t})}var X_=y("ZodFunction",(t,e)=>{_d.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ry(t,r,n,o)});function y0(t){return new X_({type:"function",input:Array.isArray(t?.input)?j_(t?.input):t?.input??S(me()),output:t?.output??me()})}var Js=y("ZodCustom",(t,e)=>{$d.init(t,e),B.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ny(t,r,n,o)});function _0(t){let e=new fe({check:"custom"});return e._zod.check=t,e}function Yf(t,e){return uf(Js,t??(()=>!0),e)}function Y_(t,e={}){return lf(Js,t,e)}function Q_(t){return df(t)}var v0=ff,b0=pf;function $0(t,e={error:`Input not instance of ${t.name}`}){let r=new Js({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...k.normalizeParams(e)});return r._zod.bag.Class=t,r}var x0=(...t)=>mf({Codec:Xf,Boolean:Ni,String:Oi},...t);function w0(t){let e=W_(()=>le([h(t),ne(),ce(),Ai(),S(e),ge(h(),e)]));return e}function Hs(t,e){return Ds(Kf(t),e)}c();var tv={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};var ev;ev||(ev={});c();var hZ={...Pi,...As,iso:Hr};var Ks={};Cr(Ks,{bigint:()=>I0,boolean:()=>z0,date:()=>P0,number:()=>S0,string:()=>k0});c();function k0(t){return Id(Oi,t)}function S0(t){return Rd(Ei,t)}function z0(t){return qd(Ni,t)}function I0(t){return Fd(Ri,t)}function P0(t){return ef(Ms,t)}Ie(xd());var Jn="2025-11-25";var nv=[Jn,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],xr="io.modelcontextprotocol/related-task",Ws="2.0",Ne=Yf(t=>t!==null&&(typeof t=="object"||typeof t=="function")),ov=le([h(),ne().int()]),iv=h(),ZZ=Se({ttl:le([ne(),Ai()]).optional(),pollInterval:ne().optional()}),O0=I({ttl:ne().optional()}),T0=I({taskId:h()}),ep=Se({progressToken:ov.optional(),[xr]:T0.optional()}),mt=I({_meta:ep.optional()}),Ci=mt.extend({task:O0.optional()}),av=t=>Ci.safeParse(t).success,Re=I({method:h(),params:mt.loose().optional()}),$t=I({_meta:ep.optional()}),xt=I({method:h(),params:$t.loose().optional()}),Ae=Se({_meta:ep.optional()}),Gs=le([h(),ne().int()]),sv=I({jsonrpc:N(Ws),id:Gs,...Re.shape}).strict(),Di=t=>sv.safeParse(t).success,cv=I({jsonrpc:N(Ws),...xt.shape}).strict(),uv=t=>cv.safeParse(t).success,tp=I({jsonrpc:N(Ws),id:Gs,result:Ae}).strict(),Kr=t=>tp.safeParse(t).success;var F;(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"})(F||(F={}));var rp=I({jsonrpc:N(Ws),id:Gs.optional(),error:I({code:ne().int(),message:h(),data:me().optional()})}).strict();var lv=t=>rp.safeParse(t).success;var Xs=le([sv,cv,tp,rp]),MZ=le([tp,rp]),Br=Ae.strict(),E0=$t.extend({requestId:Gs.optional(),reason:h().optional()}),Ys=xt.extend({method:N("notifications/cancelled"),params:E0}),N0=I({src:h(),mimeType:h().optional(),sizes:S(h()).optional(),theme:Fe(["light","dark"]).optional()}),Zi=I({icons:S(N0).optional()}),Vn=I({name:h(),title:h().optional()}),dv=Vn.extend({...Vn.shape,...Zi.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),R0=Ui(I({applyDefaults:ce().optional()}),ge(h(),me())),A0=Hs(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Ui(I({form:R0.optional(),url:Ne.optional()}),ge(h(),me()).optional())),U0=Se({list:Ne.optional(),cancel:Ne.optional(),requests:Se({sampling:Se({createMessage:Ne.optional()}).optional(),elicitation:Se({create:Ne.optional()}).optional()}).optional()}),C0=Se({list:Ne.optional(),cancel:Ne.optional(),requests:Se({tools:Se({call:Ne.optional()}).optional()}).optional()}),D0=I({experimental:ge(h(),Ne).optional(),sampling:I({context:Ne.optional(),tools:Ne.optional()}).optional(),elicitation:A0.optional(),roots:I({listChanged:ce().optional()}).optional(),tasks:U0.optional()}),Z0=mt.extend({protocolVersion:h(),capabilities:D0,clientInfo:dv}),M0=Re.extend({method:N("initialize"),params:Z0});var q0=I({experimental:ge(h(),Ne).optional(),logging:Ne.optional(),completions:Ne.optional(),prompts:I({listChanged:ce().optional()}).optional(),resources:I({subscribe:ce().optional(),listChanged:ce().optional()}).optional(),tools:I({listChanged:ce().optional()}).optional(),tasks:C0.optional()}),np=Ae.extend({protocolVersion:h(),capabilities:q0,serverInfo:dv,instructions:h().optional()}),fv=xt.extend({method:N("notifications/initialized"),params:$t.optional()}),pv=t=>fv.safeParse(t).success,Qs=Re.extend({method:N("ping"),params:mt.optional()}),L0=I({progress:ne(),total:ve(ne()),message:ve(h())}),F0=I({...$t.shape,...L0.shape,progressToken:ov}),ec=xt.extend({method:N("notifications/progress"),params:F0}),V0=mt.extend({cursor:iv.optional()}),Mi=Re.extend({params:V0.optional()}),qi=Ae.extend({nextCursor:iv.optional()}),J0=Fe(["working","input_required","completed","failed","cancelled"]),Li=I({taskId:h(),status:J0,ttl:le([ne(),Ai()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:ve(ne()),statusMessage:ve(h())}),Wr=Ae.extend({task:Li}),H0=$t.merge(Li),Fi=xt.extend({method:N("notifications/tasks/status"),params:H0}),tc=Re.extend({method:N("tasks/get"),params:mt.extend({taskId:h()})}),rc=Ae.merge(Li),nc=Re.extend({method:N("tasks/result"),params:mt.extend({taskId:h()})}),qZ=Ae.loose(),oc=Mi.extend({method:N("tasks/list")}),ic=qi.extend({tasks:S(Li)}),ac=Re.extend({method:N("tasks/cancel"),params:mt.extend({taskId:h()})}),mv=Ae.merge(Li),hv=I({uri:h(),mimeType:ve(h()),_meta:ge(h(),me()).optional()}),gv=hv.extend({text:h()}),op=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),yv=hv.extend({blob:op}),Vi=Fe(["user","assistant"]),Hn=I({audience:S(Vi).optional(),priority:ne().min(0).max(1).optional(),lastModified:Hr.datetime({offset:!0}).optional()}),_v=I({...Vn.shape,...Zi.shape,uri:h(),description:ve(h()),mimeType:ve(h()),annotations:Hn.optional(),_meta:ve(Se({}))}),K0=I({...Vn.shape,...Zi.shape,uriTemplate:h(),description:ve(h()),mimeType:ve(h()),annotations:Hn.optional(),_meta:ve(Se({}))}),B0=Mi.extend({method:N("resources/list")}),ip=qi.extend({resources:S(_v)}),W0=Mi.extend({method:N("resources/templates/list")}),ap=qi.extend({resourceTemplates:S(K0)}),sp=mt.extend({uri:h()}),G0=sp,X0=Re.extend({method:N("resources/read"),params:G0}),cp=Ae.extend({contents:S(le([gv,yv]))}),up=xt.extend({method:N("notifications/resources/list_changed"),params:$t.optional()}),Y0=sp,Q0=Re.extend({method:N("resources/subscribe"),params:Y0}),ez=sp,tz=Re.extend({method:N("resources/unsubscribe"),params:ez}),rz=$t.extend({uri:h()}),nz=xt.extend({method:N("notifications/resources/updated"),params:rz}),oz=I({name:h(),description:ve(h()),required:ve(ce())}),iz=I({...Vn.shape,...Zi.shape,description:ve(h()),arguments:ve(S(oz)),_meta:ve(Se({}))}),az=Mi.extend({method:N("prompts/list")}),lp=qi.extend({prompts:S(iz)}),sz=mt.extend({name:h(),arguments:ge(h(),h()).optional()}),cz=Re.extend({method:N("prompts/get"),params:sz}),dp=I({type:N("text"),text:h(),annotations:Hn.optional(),_meta:ge(h(),me()).optional()}),fp=I({type:N("image"),data:op,mimeType:h(),annotations:Hn.optional(),_meta:ge(h(),me()).optional()}),pp=I({type:N("audio"),data:op,mimeType:h(),annotations:Hn.optional(),_meta:ge(h(),me()).optional()}),uz=I({type:N("tool_use"),name:h(),id:h(),input:ge(h(),me()),_meta:ge(h(),me()).optional()}),lz=I({type:N("resource"),resource:le([gv,yv]),annotations:Hn.optional(),_meta:ge(h(),me()).optional()}),dz=_v.extend({type:N("resource_link")}),mp=le([dp,fp,pp,dz,lz]),fz=I({role:Vi,content:mp}),hp=Ae.extend({description:h().optional(),messages:S(fz)}),gp=xt.extend({method:N("notifications/prompts/list_changed"),params:$t.optional()}),pz=I({title:h().optional(),readOnlyHint:ce().optional(),destructiveHint:ce().optional(),idempotentHint:ce().optional(),openWorldHint:ce().optional()}),mz=I({taskSupport:Fe(["required","optional","forbidden"]).optional()}),vv=I({...Vn.shape,...Zi.shape,description:h().optional(),inputSchema:I({type:N("object"),properties:ge(h(),Ne).optional(),required:S(h()).optional()}).catchall(me()),outputSchema:I({type:N("object"),properties:ge(h(),Ne).optional(),required:S(h()).optional()}).catchall(me()).optional(),annotations:pz.optional(),execution:mz.optional(),_meta:ge(h(),me()).optional()}),hz=Mi.extend({method:N("tools/list")}),yp=qi.extend({tools:S(vv)}),Kn=Ae.extend({content:S(mp).default([]),structuredContent:ge(h(),me()).optional(),isError:ce().optional()}),LZ=Kn.or(Ae.extend({toolResult:me()})),gz=Ci.extend({name:h(),arguments:ge(h(),me()).optional()}),yz=Re.extend({method:N("tools/call"),params:gz}),_p=xt.extend({method:N("notifications/tools/list_changed"),params:$t.optional()}),bv=I({autoRefresh:ce().default(!0),debounceMs:ne().int().nonnegative().default(300)}),$v=Fe(["debug","info","notice","warning","error","critical","alert","emergency"]),_z=mt.extend({level:$v}),vz=Re.extend({method:N("logging/setLevel"),params:_z}),bz=$t.extend({level:$v,logger:h().optional(),data:me()}),$z=xt.extend({method:N("notifications/message"),params:bz}),xz=I({name:h().optional()}),wz=I({hints:S(xz).optional(),costPriority:ne().min(0).max(1).optional(),speedPriority:ne().min(0).max(1).optional(),intelligencePriority:ne().min(0).max(1).optional()}),kz=I({mode:Fe(["auto","required","none"]).optional()}),Sz=I({type:N("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:S(mp).default([]),structuredContent:I({}).loose().optional(),isError:ce().optional(),_meta:ge(h(),me()).optional()}),zz=Fs("type",[dp,fp,pp]),Bs=Fs("type",[dp,fp,pp,uz,Sz]),Iz=I({role:Vi,content:le([Bs,S(Bs)]),_meta:ge(h(),me()).optional()}),Pz=Ci.extend({messages:S(Iz),modelPreferences:wz.optional(),systemPrompt:h().optional(),includeContext:Fe(["none","thisServer","allServers"]).optional(),temperature:ne().optional(),maxTokens:ne().int(),stopSequences:S(h()).optional(),metadata:Ne.optional(),tools:S(vv).optional(),toolChoice:kz.optional()}),vp=Re.extend({method:N("sampling/createMessage"),params:Pz}),bp=Ae.extend({model:h(),stopReason:ve(Fe(["endTurn","stopSequence","maxTokens"]).or(h())),role:Vi,content:zz}),$p=Ae.extend({model:h(),stopReason:ve(Fe(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:Vi,content:le([Bs,S(Bs)])}),jz=I({type:N("boolean"),title:h().optional(),description:h().optional(),default:ce().optional()}),Oz=I({type:N("string"),title:h().optional(),description:h().optional(),minLength:ne().optional(),maxLength:ne().optional(),format:Fe(["email","uri","date","date-time"]).optional(),default:h().optional()}),Tz=I({type:Fe(["number","integer"]),title:h().optional(),description:h().optional(),minimum:ne().optional(),maximum:ne().optional(),default:ne().optional()}),Ez=I({type:N("string"),title:h().optional(),description:h().optional(),enum:S(h()),default:h().optional()}),Nz=I({type:N("string"),title:h().optional(),description:h().optional(),oneOf:S(I({const:h(),title:h()})),default:h().optional()}),Rz=I({type:N("string"),title:h().optional(),description:h().optional(),enum:S(h()),enumNames:S(h()).optional(),default:h().optional()}),Az=le([Ez,Nz]),Uz=I({type:N("array"),title:h().optional(),description:h().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:I({type:N("string"),enum:S(h())}),default:S(h()).optional()}),Cz=I({type:N("array"),title:h().optional(),description:h().optional(),minItems:ne().optional(),maxItems:ne().optional(),items:I({anyOf:S(I({const:h(),title:h()}))}),default:S(h()).optional()}),Dz=le([Uz,Cz]),Zz=le([Rz,Az,Dz]),Mz=le([Zz,jz,Oz,Tz]),qz=Ci.extend({mode:N("form").optional(),message:h(),requestedSchema:I({type:N("object"),properties:ge(h(),Mz),required:S(h()).optional()})}),Lz=Ci.extend({mode:N("url"),message:h(),elicitationId:h(),url:h().url()}),Fz=le([qz,Lz]),xp=Re.extend({method:N("elicitation/create"),params:Fz}),Vz=$t.extend({elicitationId:h()}),Jz=xt.extend({method:N("notifications/elicitation/complete"),params:Vz}),wp=Ae.extend({action:Fe(["accept","decline","cancel"]),content:Hs(t=>t===null?void 0:t,ge(h(),le([h(),ne(),ce(),S(h())])).optional())}),Hz=I({type:N("ref/resource"),uri:h()});var Kz=I({type:N("ref/prompt"),name:h()}),Bz=mt.extend({ref:le([Kz,Hz]),argument:I({name:h(),value:h()}),context:I({arguments:ge(h(),h()).optional()}).optional()}),Wz=Re.extend({method:N("completion/complete"),params:Bz});var kp=Ae.extend({completion:Se({values:S(h()).max(100),total:ve(ne().int()),hasMore:ve(ce())})}),Gz=I({uri:h().startsWith("file://"),name:h().optional(),_meta:ge(h(),me()).optional()}),Xz=Re.extend({method:N("roots/list"),params:mt.optional()}),Yz=Ae.extend({roots:S(Gz)}),Qz=xt.extend({method:N("notifications/roots/list_changed"),params:$t.optional()}),FZ=le([Qs,M0,Wz,vz,cz,az,B0,W0,X0,Q0,tz,yz,hz,tc,nc,oc,ac]),VZ=le([Ys,ec,fv,Qz,Fi]),JZ=le([Br,bp,$p,wp,Yz,rc,ic,Wr]),HZ=le([Qs,vp,xp,Xz,tc,nc,oc,ac]),KZ=le([Ys,ec,$z,nz,up,_p,gp,Fi,Jz]),BZ=le([Br,np,kp,hp,lp,ip,ap,cp,Kn,yp,rc,ic,Wr]),C=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===F.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Qf(o.elicitations,r)}return new t(e,r,n)}},Qf=class extends C{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(F.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};c();function wr(t){return t==="completed"||t==="failed"||t==="cancelled"}c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();var H6=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();c();function Sp(t){let r=Rs(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=r_(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function zp(t,e){let r=Ot(t,e);if(!r.success)throw r.error;return r.data}var iI=6e4,sc=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(Ys,r=>{this._oncancel(r)}),this.setNotificationHandler(ec,r=>{this._onprogress(r)}),this.setRequestHandler(Qs,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(tc,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new C(F.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(nc,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let u=s.message,l=u.id,d=this._requestResolvers.get(l);if(d)if(this._requestResolvers.delete(l),s.type==="response")d(u);else{let f=u,g=new C(f.error.code,f.error.message,f.error.data);d(g)}else{let f=s.type==="response"?"Response":"Error";this._onerror(new Error(`${f} handler missing for request ${l}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new C(F.InvalidParams,`Task not found: ${i}`);if(!wr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(wr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[xr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(oc,async(r,n)=>{try{let{tasks:o,nextCursor:i}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:i,_meta:{}}}catch(o){throw new C(F.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ac,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new C(F.InvalidParams,`Task not found: ${r.params.taskId}`);if(wr(o.status))throw new C(F.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new C(F.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof C?o:new C(F.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),C.fromError(F.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});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){this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),Kr(i)||lv(i)?this._onresponse(i):Di(i)?this._onrequest(i,a):uv(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=C.fromError(F.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(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(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,i=e.params?._meta?.[xr]?.taskId;if(n===void 0){let d={jsonrpc:"2.0",id:e.id,error:{code:F.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId).catch(f=>this._onerror(new Error(`Failed to enqueue error response: ${f}`))):o?.send(d).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let s=av(e.params)?e.params.task:void 0,u=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,l={signal:a.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async d=>{let f={relatedRequestId:e.id};i&&(f.relatedTask={taskId:i}),await this.notification(d,f)},sendRequest:async(d,f,g)=>{let m={...g,relatedRequestId:e.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let v=m.relatedTask?.taskId??i;return v&&u&&await u.updateTaskStatus(v,"input_required"),await this.request(d,f,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:i,taskStore:u,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,l)).then(async d=>{if(a.signal.aborted)return;let f={result:d,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:f,timestamp:Date.now()},o?.sessionId):await o?.send(f)},async d=>{if(a.signal.aborted)return;let f={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(d.code)?d.code:F.InternalError,message:d.message??"Internal error",...d.data!==void 0&&{data:d.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:f,timestamp:Date.now()},o?.sessionId):await o?.send(f)}).catch(d=>this._onerror(new Error(`Failed to send response: ${d}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(u){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(u);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Kr(e))n(e);else{let a=new C(e.error.code,e.error.message,e.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===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 i=!1;if(Kr(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),Kr(e))o(e);else{let a=C.fromError(e.error.code,e.error.message,e.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(a){yield{type:"error",error:a instanceof C?a:new C(F.InternalError,String(a))}}return}let i;try{let a=await this.request(e,Wr,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new C(F.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},wr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new C(F.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new C(F.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let u=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(l=>setTimeout(l,u)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof C?a:new C(F.InternalError,String(a))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:u}=n??{};return new Promise((l,d)=>{let f=x=>{d(x)};if(!this._transport){f(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(x){f(x);return}n?.signal?.throwIfAborted();let g=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:g};n?.onprogress&&(this._progressHandlers.set(g,n.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:g}}),s&&(m.params={...m.params,task:s}),u&&(m.params={...m.params,_meta:{...m.params?._meta||{},[xr]:u}});let v=x=>{this._responseHandlers.delete(g),this._progressHandlers.delete(g),this._cleanupTimeout(g),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:g,reason:String(x)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(Z=>this._onerror(new Error(`Failed to send cancellation: ${Z}`)));let P=x instanceof C?x:new C(F.RequestTimeout,String(x));d(P)};this._responseHandlers.set(g,x=>{if(!n?.signal?.aborted){if(x instanceof Error)return d(x);try{let P=Ot(r,x.result);P.success?l(P.data):d(P.error)}catch(P){d(P)}}}),n?.signal?.addEventListener("abort",()=>{v(n?.signal?.reason)});let _=n?.timeout??iI,b=()=>v(C.fromError(F.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(g,_,n?.maxTotalTimeout,b,n?.resetTimeoutOnProgress??!1);let $=u?.taskId;if($){let x=P=>{let Z=this._responseHandlers.get(g);Z?Z(P):this._onerror(new Error(`Response handler missing for side-channeled request ${g}`))};this._requestResolvers.set(g,x),this._enqueueTaskMessage($,{type:"request",message:m,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(g),d(P)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(x=>{this._cleanupTimeout(g),d(x)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},rc,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},ic,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},mv,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[xr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,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 s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[xr]:r.relatedTask}}}),this._transport?.send(s,r).catch(u=>this._onerror(u))});return}let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[xr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(e,r){let n=Sp(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=zp(e,o);return Promise.resolve(r(a,i))})}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 n=Sp(e);this._notificationHandlers.set(n,o=>{let i=zp(e,o);return Promise.resolve(r(i))})}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,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&Di(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new C(F.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new C(F.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new C(F.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new C(F.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let u=Fi.parse({method:"notifications/tasks/status",params:s});await this.notification(u),wr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new C(F.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(wr(s.status))throw new C(F.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let u=await n.getTask(o,r);if(u){let l=Fi.parse({method:"notifications/tasks/status",params:u});await this.notification(l),wr(u.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function xv(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function wv(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let a=r[o];xv(a)&&xv(i)?r[o]={...a,...i}:r[o]=i}return r}c();var ux=Fa(dh(),1),lx=Fa(cx(),1);function WE(){let t=new ux.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,lx.default)(t),t}var Vc=class{constructor(e){this._ajv=e??WE()}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 n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};c();var Jc=class{constructor(e){this._client=e}async*callToolStream(e,r=Kn,n){let o=this._client,i={...n,task:n?.task??(o.isToolTask(e.name)?{}:void 0)},a=o.requestStream({method:"tools/call",params:e},r,i),s=o.getToolOutputValidator(e.name);for await(let u of a){if(u.type==="result"&&s){let l=u.result;if(!l.structuredContent&&!l.isError){yield{type:"error",error:new C(F.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`)};return}if(l.structuredContent)try{let d=s(l.structuredContent);if(!d.valid){yield{type:"error",error:new C(F.InvalidParams,`Structured content does not match the tool's output schema: ${d.errorMessage}`)};return}}catch(d){if(d instanceof C){yield{type:"error",error:d};return}yield{type:"error",error:new C(F.InvalidParams,`Failed to validate structured content: ${d instanceof Error?d.message:String(d)}`)};return}}yield u}}async getTask(e,r){return this._client.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._client.getTaskResult({taskId:e},r,n)}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,n){return this._client.requestStream(e,r,n)}};c();function dx(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 fx(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 Hc(t,e){if(!(!t||e===null||typeof e!="object")){if(t.type==="object"&&t.properties&&typeof t.properties=="object"){let r=e,n=t.properties;for(let o of Object.keys(n)){let i=n[o];r[o]===void 0&&Object.prototype.hasOwnProperty.call(i,"default")&&(r[o]=i.default),r[o]!==void 0&&Hc(i,r[o])}}if(Array.isArray(t.anyOf))for(let r of t.anyOf)typeof r!="boolean"&&Hc(r,e);if(Array.isArray(t.oneOf))for(let r of t.oneOf)typeof r!="boolean"&&Hc(r,e)}}function GE(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 Kc=class extends sc{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 Vc,r?.listChanged&&(this._pendingListChangedConfig=r.listChanged)}_setupListChangedHandlers(e){e.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",_p,e.tools,async()=>(await this.listTools()).tools),e.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",gp,e.prompts,async()=>(await this.listPrompts()).prompts),e.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",up,e.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new Jc(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=wv(this._capabilities,e)}setRequestHandler(e,r){let o=Rs(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(Ln(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");let a=i;if(a==="elicitation/create"){let s=async(u,l)=>{let d=Ot(xp,u);if(!d.success){let x=d.error instanceof Error?d.error.message:String(d.error);throw new C(F.InvalidParams,`Invalid elicitation request: ${x}`)}let{params:f}=d.data;f.mode=f.mode??"form";let{supportsFormMode:g,supportsUrlMode:m}=GE(this._capabilities.elicitation);if(f.mode==="form"&&!g)throw new C(F.InvalidParams,"Client does not support form-mode elicitation requests");if(f.mode==="url"&&!m)throw new C(F.InvalidParams,"Client does not support URL-mode elicitation requests");let v=await Promise.resolve(r(u,l));if(f.task){let x=Ot(Wr,v);if(!x.success){let P=x.error instanceof Error?x.error.message:String(x.error);throw new C(F.InvalidParams,`Invalid task creation result: ${P}`)}return x.data}let _=Ot(wp,v);if(!_.success){let x=_.error instanceof Error?_.error.message:String(_.error);throw new C(F.InvalidParams,`Invalid elicitation result: ${x}`)}let b=_.data,$=f.mode==="form"?f.requestedSchema:void 0;if(f.mode==="form"&&b.action==="accept"&&b.content&&$&&this._capabilities.elicitation?.form?.applyDefaults)try{Hc($,b.content)}catch{}return b};return super.setRequestHandler(e,s)}if(a==="sampling/createMessage"){let s=async(u,l)=>{let d=Ot(vp,u);if(!d.success){let b=d.error instanceof Error?d.error.message:String(d.error);throw new C(F.InvalidParams,`Invalid sampling request: ${b}`)}let{params:f}=d.data,g=await Promise.resolve(r(u,l));if(f.task){let b=Ot(Wr,g);if(!b.success){let $=b.error instanceof Error?b.error.message:String(b.error);throw new C(F.InvalidParams,`Invalid task creation result: ${$}`)}return b.data}let v=f.tools||f.toolChoice?$p:bp,_=Ot(v,g);if(!_.success){let b=_.error instanceof Error?_.error.message:String(_.error);throw new C(F.InvalidParams,`Invalid sampling result: ${b}`)}return _.data};return super.setRequestHandler(e,s)}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 n=await this.request({method:"initialize",params:{protocolVersion:Jn,capabilities:this._capabilities,clientInfo:this._clientInfo}},np,r);if(n===void 0)throw new Error(`Server sent invalid initialize result: ${n}`);if(!nv.includes(n.protocolVersion))throw new Error(`Server's protocol version is not supported: ${n.protocolVersion}`);this._serverCapabilities=n.capabilities,this._serverVersion=n.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(n.protocolVersion),this._instructions=n.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(n){throw this.close(),n}}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){dx(this._serverCapabilities?.tasks?.requests,e,"Server")}assertTaskHandlerCapability(e){this._capabilities&&fx(this._capabilities.tasks?.requests,e,"Client")}async ping(e){return this.request({method:"ping"},Br,e)}async complete(e,r){return this.request({method:"completion/complete",params:e},kp,r)}async setLoggingLevel(e,r){return this.request({method:"logging/setLevel",params:{level:e}},Br,r)}async getPrompt(e,r){return this.request({method:"prompts/get",params:e},hp,r)}async listPrompts(e,r){return this.request({method:"prompts/list",params:e},lp,r)}async listResources(e,r){return this.request({method:"resources/list",params:e},ip,r)}async listResourceTemplates(e,r){return this.request({method:"resources/templates/list",params:e},ap,r)}async readResource(e,r){return this.request({method:"resources/read",params:e},cp,r)}async subscribeResource(e,r){return this.request({method:"resources/subscribe",params:e},Br,r)}async unsubscribeResource(e,r){return this.request({method:"resources/unsubscribe",params:e},Br,r)}async callTool(e,r=Kn,n){if(this.isToolTaskRequired(e.name))throw new C(F.InvalidRequest,`Tool "${e.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let o=await this.request({method:"tools/call",params:e},r,n),i=this.getToolOutputValidator(e.name);if(i){if(!o.structuredContent&&!o.isError)throw new C(F.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(o.structuredContent)try{let a=i(o.structuredContent);if(!a.valid)throw new C(F.InvalidParams,`Structured content does not match the tool's output schema: ${a.errorMessage}`)}catch(a){throw a instanceof C?a:new C(F.InvalidParams,`Failed to validate structured content: ${a instanceof Error?a.message:String(a)}`)}}return o}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 o=this._jsonSchemaValidator.getValidator(r.outputSchema);this._cachedToolOutputValidators.set(r.name,o)}let n=r.execution?.taskSupport;(n==="required"||n==="optional")&&this._cachedKnownTaskTools.add(r.name),n==="required"&&this._cachedRequiredTaskTools.add(r.name)}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,r){let n=await this.request({method:"tools/list",params:e},yp,r);return this.cacheToolMetadata(n.tools),n}_setupListChangedHandler(e,r,n,o){let i=bv.safeParse(n);if(!i.success)throw new Error(`Invalid ${e} listChanged options: ${i.error.message}`);if(typeof n.onChanged!="function")throw new Error(`Invalid ${e} listChanged options: onChanged must be a function`);let{autoRefresh:a,debounceMs:s}=i.data,{onChanged:u}=n,l=async()=>{if(!a){u(null,null);return}try{let f=await o();u(null,f)}catch(f){let g=f instanceof Error?f:new Error(String(f));u(g,null)}},d=()=>{if(s){let f=this._listChangedDebounceTimers.get(e);f&&clearTimeout(f);let g=setTimeout(l,s);this._listChangedDebounceTimers.set(e,g)}else l()};this.setNotificationHandler(r,d)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};c();c();c();function Bc(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function px(t=fetch,e){return e?async(r,n)=>{let o={...e,...n,headers:n?.headers?{...Bc(e.headers),...Bc(n.headers)}:e.headers};return t(r,o)}:t}c();c();var vh;vh=globalThis.crypto?.webcrypto??globalThis.crypto??import("node:crypto").then(t=>t.webcrypto);async function XE(t){return(await vh).getRandomValues(new Uint8Array(t))}async function YE(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length,n="";for(;n.length<t;){let o=await XE(t-n.length);for(let i of o)i<r&&(n+=e[i%e.length])}return n}async function QE(t){return await YE(t)}async function eN(t){let e=await(await vh).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function bh(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await QE(t),r=await eN(e);return{code_verifier:e,code_challenge:r}}c();var Ze=Pf().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:tv.custom,message:"URL must be parseable",fatal:!0}),Ba}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),hx=Se({resource:h().url(),authorization_servers:S(Ze).optional(),jwks_uri:h().url().optional(),scopes_supported:S(h()).optional(),bearer_methods_supported:S(h()).optional(),resource_signing_alg_values_supported:S(h()).optional(),resource_name:h().optional(),resource_documentation:h().optional(),resource_policy_uri:h().url().optional(),resource_tos_uri:h().url().optional(),tls_client_certificate_bound_access_tokens:ce().optional(),authorization_details_types_supported:S(h()).optional(),dpop_signing_alg_values_supported:S(h()).optional(),dpop_bound_access_tokens_required:ce().optional()}),$h=Se({issuer:h(),authorization_endpoint:Ze,token_endpoint:Ze,registration_endpoint:Ze.optional(),scopes_supported:S(h()).optional(),response_types_supported:S(h()),response_modes_supported:S(h()).optional(),grant_types_supported:S(h()).optional(),token_endpoint_auth_methods_supported:S(h()).optional(),token_endpoint_auth_signing_alg_values_supported:S(h()).optional(),service_documentation:Ze.optional(),revocation_endpoint:Ze.optional(),revocation_endpoint_auth_methods_supported:S(h()).optional(),revocation_endpoint_auth_signing_alg_values_supported:S(h()).optional(),introspection_endpoint:h().optional(),introspection_endpoint_auth_methods_supported:S(h()).optional(),introspection_endpoint_auth_signing_alg_values_supported:S(h()).optional(),code_challenge_methods_supported:S(h()).optional(),client_id_metadata_document_supported:ce().optional()}),tN=Se({issuer:h(),authorization_endpoint:Ze,token_endpoint:Ze,userinfo_endpoint:Ze.optional(),jwks_uri:Ze,registration_endpoint:Ze.optional(),scopes_supported:S(h()).optional(),response_types_supported:S(h()),response_modes_supported:S(h()).optional(),grant_types_supported:S(h()).optional(),acr_values_supported:S(h()).optional(),subject_types_supported:S(h()),id_token_signing_alg_values_supported:S(h()),id_token_encryption_alg_values_supported:S(h()).optional(),id_token_encryption_enc_values_supported:S(h()).optional(),userinfo_signing_alg_values_supported:S(h()).optional(),userinfo_encryption_alg_values_supported:S(h()).optional(),userinfo_encryption_enc_values_supported:S(h()).optional(),request_object_signing_alg_values_supported:S(h()).optional(),request_object_encryption_alg_values_supported:S(h()).optional(),request_object_encryption_enc_values_supported:S(h()).optional(),token_endpoint_auth_methods_supported:S(h()).optional(),token_endpoint_auth_signing_alg_values_supported:S(h()).optional(),display_values_supported:S(h()).optional(),claim_types_supported:S(h()).optional(),claims_supported:S(h()).optional(),service_documentation:h().optional(),claims_locales_supported:S(h()).optional(),ui_locales_supported:S(h()).optional(),claims_parameter_supported:ce().optional(),request_parameter_supported:ce().optional(),request_uri_parameter_supported:ce().optional(),require_request_uri_registration:ce().optional(),op_policy_uri:Ze.optional(),op_tos_uri:Ze.optional(),client_id_metadata_document_supported:ce().optional()}),gx=I({...tN.shape,...$h.pick({code_challenge_methods_supported:!0}).shape}),yx=I({access_token:h(),id_token:h().optional(),token_type:h(),expires_in:Ks.number().optional(),scope:h().optional(),refresh_token:h().optional()}).strip(),_x=I({error:h(),error_description:h().optional(),error_uri:h().optional()}),mx=Ze.optional().or(N("").transform(()=>{})),rN=I({redirect_uris:S(Ze),token_endpoint_auth_method:h().optional(),grant_types:S(h()).optional(),response_types:S(h()).optional(),client_name:h().optional(),client_uri:Ze.optional(),logo_uri:mx,scope:h().optional(),contacts:S(h()).optional(),tos_uri:mx,policy_uri:h().optional(),jwks_uri:Ze.optional(),jwks:Jf().optional(),software_id:h().optional(),software_version:h().optional(),software_statement:h().optional()}).strip(),nN=I({client_id:h(),client_secret:h().optional(),client_id_issued_at:ne().optional(),client_secret_expires_at:ne().optional()}).strip(),vx=rN.merge(nN),pV=I({error:h(),error_description:h().optional()}).strip(),mV=I({token:h(),token_type_hint:h().optional()}).strip();c();function bx(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function $x({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",i=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(i)}c();var ke=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},$a=class extends ke{};$a.errorCode="invalid_request";var sn=class extends ke{};sn.errorCode="invalid_client";var cn=class extends ke{};cn.errorCode="invalid_grant";var un=class extends ke{};un.errorCode="unauthorized_client";var xa=class extends ke{};xa.errorCode="unsupported_grant_type";var wa=class extends ke{};wa.errorCode="invalid_scope";var ka=class extends ke{};ka.errorCode="access_denied";var sr=class extends ke{};sr.errorCode="server_error";var Sa=class extends ke{};Sa.errorCode="temporarily_unavailable";var za=class extends ke{};za.errorCode="unsupported_response_type";var Ia=class extends ke{};Ia.errorCode="unsupported_token_type";var Pa=class extends ke{};Pa.errorCode="invalid_token";var ja=class extends ke{};ja.errorCode="method_not_allowed";var Oa=class extends ke{};Oa.errorCode="too_many_requests";var ln=class extends ke{};ln.errorCode="invalid_client_metadata";var Ta=class extends ke{};Ta.errorCode="insufficient_scope";var Ea=class extends ke{};Ea.errorCode="invalid_target";var xx={[$a.errorCode]:$a,[sn.errorCode]:sn,[cn.errorCode]:cn,[un.errorCode]:un,[xa.errorCode]:xa,[wa.errorCode]:wa,[ka.errorCode]:ka,[sr.errorCode]:sr,[Sa.errorCode]:Sa,[za.errorCode]:za,[Ia.errorCode]:Ia,[Pa.errorCode]:Pa,[ja.errorCode]:ja,[Oa.errorCode]:Oa,[ln.errorCode]:ln,[Ta.errorCode]:Ta,[Ea.errorCode]:Ea};var cr=class extends Error{constructor(e){super(e??"Unauthorized")}};function oN(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var xh="code",wh="S256";function iN(t,e){let r=t.client_secret!==void 0;return e.length===0?r?"client_secret_post":"none":"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&oN(t.token_endpoint_auth_method)&&e.includes(t.token_endpoint_auth_method)?t.token_endpoint_auth_method:r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function aN(t,e,r,n){let{client_id:o,client_secret:i}=e;switch(t){case"client_secret_basic":sN(o,i,r);return;case"client_secret_post":cN(o,i,n);return;case"none":uN(o,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function sN(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function cN(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function uN(t,e){e.set("client_id",t)}async function kx(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=_x.parse(JSON.parse(r)),{error:o,error_description:i,error_uri:a}=n,s=xx[o]||sr;return new s(i||"",a)}catch(n){let o=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new sr(o)}}async function Na(t,e){try{return await kh(t,e)}catch(r){if(r instanceof sn||r instanceof un)return await t.invalidateCredentials?.("all"),await kh(t,e);if(r instanceof cn)return await t.invalidateCredentials?.("tokens"),await kh(t,e);throw r}}async function kh(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:i}){let a,s;try{a=await fN(e,{resourceMetadataUrl:o},i),a.authorization_servers&&a.authorization_servers.length>0&&(s=a.authorization_servers[0])}catch{}s||(s=new URL("/",e));let u=await dN(e,t,a),l=await yN(s,{fetchFn:i}),d=await Promise.resolve(t.clientInformation());if(!d){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let b=l?.client_id_metadata_document_supported===!0,$=t.clientMetadataUrl;if($&&!lN($))throw new ln(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${$}`);if(b&&$)d={client_id:$},await t.saveClientInformation?.(d);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let P=await xN(s,{metadata:l,clientMetadata:t.clientMetadata,fetchFn:i});await t.saveClientInformation(P),d=P}}let f=!t.redirectUrl;if(r!==void 0||f){let b=await $N(t,s,{metadata:l,resource:u,authorizationCode:r,fetchFn:i});return await t.saveTokens(b),"AUTHORIZED"}let g=await t.tokens();if(g?.refresh_token)try{let b=await bN(s,{metadata:l,clientInformation:d,refreshToken:g.refresh_token,resource:u,addClientAuthentication:t.addClientAuthentication,fetchFn:i});return await t.saveTokens(b),"AUTHORIZED"}catch(b){if(!(!(b instanceof ke)||b instanceof sr))throw b}let m=t.state?await t.state():void 0,{authorizationUrl:v,codeVerifier:_}=await _N(s,{metadata:l,clientInformation:d,state:m,redirectUrl:t.redirectUrl,scope:n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,resource:u});return await t.saveCodeVerifier(_),await t.redirectToAuthorization(v),"REDIRECT"}function lN(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function dN(t,e,r){let n=bx(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!$x({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function zh(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=Sh(t,"resource_metadata")||void 0,i;if(o)try{i=new URL(o)}catch{}let a=Sh(t,"scope")||void 0,s=Sh(t,"error")||void 0;return{resourceMetadataUrl:i,scope:a,error:s}}function Sh(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function fN(t,e,r=fetch){let n=await hN(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return hx.parse(await n.json())}async function Ih(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?Ih(t,void 0,r):void 0;throw n}}function pN(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function wx(t,e,r=fetch){return await Ih(t,{"MCP-Protocol-Version":e},r)}function mN(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function hN(t,e,r,n){let o=new URL(t),i=n?.protocolVersion??Jn,a;if(n?.metadataUrl)a=new URL(n.metadataUrl);else{let u=pN(e,o.pathname);a=new URL(u,n?.metadataServerUrl??o),a.search=o.search}let s=await wx(a,i,r);if(!n?.metadataUrl&&mN(s,o.pathname)){let u=new URL(`/.well-known/${e}`,o);s=await wx(u,i,r)}return s}function gN(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let o=e.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,e.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function yN(t,{fetchFn:e=fetch,protocolVersion:r=Jn}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=gN(t);for(let{url:i,type:a}of o){let s=await Ih(i,n,e);if(s){if(!s.ok){if(await s.body?.cancel(),s.status>=400&&s.status<500)continue;throw new Error(`HTTP ${s.status} trying to load ${a==="oauth"?"OAuth":"OpenID provider"} metadata from ${i}`)}return a==="oauth"?$h.parse(await s.json()):gx.parse(await s.json())}}}async function _N(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:o,state:i,resource:a}){let s;if(e){if(s=new URL(e.authorization_endpoint),!e.response_types_supported.includes(xh))throw new Error(`Incompatible auth server: does not support response type ${xh}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(wh))throw new Error(`Incompatible auth server: does not support code challenge method ${wh}`)}else s=new URL("/authorize",t);let u=await bh(),l=u.code_verifier,d=u.code_challenge;return s.searchParams.set("response_type",xh),s.searchParams.set("client_id",r.client_id),s.searchParams.set("code_challenge",d),s.searchParams.set("code_challenge_method",wh),s.searchParams.set("redirect_uri",String(n)),i&&s.searchParams.set("state",i),o&&s.searchParams.set("scope",o),o?.includes("offline_access")&&s.searchParams.append("prompt","consent"),a&&s.searchParams.set("resource",a.href),{authorizationUrl:s,codeVerifier:l}}function vN(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function Sx(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:i,fetchFn:a}){let s=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),u=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(i&&r.set("resource",i.href),o)await o(u,r,s,e);else if(n){let d=e?.token_endpoint_auth_methods_supported??[],f=iN(n,d);aN(f,n,u,r)}let l=await(a??fetch)(s,{method:"POST",headers:u,body:r});if(!l.ok)throw await kx(l);return yx.parse(await l.json())}async function bN(t,{metadata:e,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:i,fetchFn:a}){let s=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),u=await Sx(t,{metadata:e,tokenRequestParams:s,clientInformation:r,addClientAuthentication:i,resource:o,fetchFn:a});return{refresh_token:n,...u}}async function $N(t,e,{metadata:r,resource:n,authorizationCode:o,fetchFn:i}={}){let a=t.clientMetadata.scope,s;if(t.prepareTokenRequest&&(s=await t.prepareTokenRequest(a)),!s){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let l=await t.codeVerifier();s=vN(o,l,t.redirectUrl)}let u=await t.clientInformation();return Sx(e,{metadata:r,tokenRequestParams:s,clientInformation:u??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:i})}async function xN(t,{metadata:e,clientMetadata:r,fetchFn:n}){let o;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");o=new URL(e.registration_endpoint)}else o=new URL("/register",t);let i=await(n??fetch)(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw await kx(i);return vx.parse(await i.json())}c();c();var Wc=class extends Error{constructor(e,r){super(e),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}};function Ph(t){}function zx(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Ph,onError:r=Ph,onRetry:n=Ph,onComment:o}=t,i="",a=!0,s,u="",l="";function d(_){let b=a?_.replace(/^\xEF\xBB\xBF/,""):_,[$,x]=wN(`${i}${b}`);for(let P of $)f(P);i=x,a=!1}function f(_){if(_===""){m();return}if(_.startsWith(":")){o&&o(_.slice(_.startsWith(": ")?2:1));return}let b=_.indexOf(":");if(b!==-1){let $=_.slice(0,b),x=_[b+1]===" "?2:1,P=_.slice(b+x);g($,P,_);return}g(_,"",_)}function g(_,b,$){switch(_){case"event":l=b;break;case"data":u=`${u}${b}
|
|
34
|
+
`;break;case"id":s=b.includes("\0")?void 0:b;break;case"retry":/^\d+$/.test(b)?n(parseInt(b,10)):r(new Wc(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:$}));break;default:r(new Wc(`Unknown field "${_.length>20?`${_.slice(0,20)}\u2026`:_}"`,{type:"unknown-field",field:_,value:b,line:$}));break}}function m(){u.length>0&&e({id:s,event:l||void 0,data:u.endsWith(`
|
|
35
|
+
`)?u.slice(0,-1):u}),s=void 0,u="",l=""}function v(_={}){i&&_.consume&&f(i),a=!0,s=void 0,u="",l="",i=""}return{feed:d,reset:v}}function wN(t){let e=[],r="",n=0;for(;n<t.length;){let o=t.indexOf("\r",n),i=t.indexOf(`
|
|
36
|
+
`,n),a=-1;if(o!==-1&&i!==-1?a=Math.min(o,i):o!==-1?o===t.length-1?a=-1:a=o:i!==-1&&(a=i),a===-1){r=t.slice(n);break}else{let s=t.slice(n,a);e.push(s),n=a+1,t[n-1]==="\r"&&t[n]===`
|
|
37
|
+
`&&n++}}return[e,r]}var Gc=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n}={}){let o;super({start(i){o=zx({onEvent:a=>{i.enqueue(a)},onError(a){e==="terminate"?i.error(a):typeof e=="function"&&e(a)},onRetry:r,onComment:n})},transform(i){o.feed(i)}})}};var kN={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Er=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},Xc=class{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=px(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??kN}async _authThenStart(){if(!this._authProvider)throw new cr("No auth provider");let e;try{e=await Na(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new cr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Bc(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new Er(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(i=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${i instanceof Error?i.message:String(i)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:o,replayMessageId:i}=r,a,s=!1,u=!1;(async()=>{try{let d=e.pipeThrough(new TextDecoderStream).pipeThrough(new Gc({onRetry:m=>{this._serverRetryMs=m}})).getReader();for(;;){let{value:m,done:v}=await d.read();if(v)break;if(m.id&&(a=m.id,s=!0,o?.(m.id)),!!m.data&&(!m.event||m.event==="message"))try{let _=Xs.parse(JSON.parse(m.data));Kr(_)&&(u=!0,i!==void 0&&(_.id=i)),this.onmessage?.(_)}catch(_){this.onerror?.(_)}}(n||s)&&!u&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:i},0)}catch(d){if(this.onerror?.(new Error(`SSE stream disconnected: ${d}`)),(n||s)&&!u&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:a,onresumptiontoken:o,replayMessageId:i},0)}catch(m){this.onerror?.(new Error(`Failed to reconnect: ${m instanceof Error?m.message:String(m)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new cr("No auth provider");if(await Na(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new cr("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Di(e)?e.id:void 0}).catch(g=>this.onerror?.(g));return}let i=await this._commonHeaders();i.set("content-type","application/json"),i.set("accept","application/json, text/event-stream");let a={...this._requestInit,method:"POST",headers:i,body:JSON.stringify(e),signal:this._abortController?.signal},s=await(this._fetch??fetch)(this._url,a),u=s.headers.get("mcp-session-id");if(u&&(this._sessionId=u),!s.ok){let g=await s.text().catch(()=>null);if(s.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Er(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:m,scope:v}=zh(s);if(this._resourceMetadataUrl=m,this._scope=v,await Na(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new cr;return this._hasCompletedAuthFlow=!0,this.send(e)}if(s.status===403&&this._authProvider){let{resourceMetadataUrl:m,scope:v,error:_}=zh(s);if(_==="insufficient_scope"){let b=s.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===b)throw new Er(403,"Server returned 403 after trying upscoping");if(v&&(this._scope=v),m&&(this._resourceMetadataUrl=m),this._lastUpscopingHeader=b??void 0,await Na(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new cr;return this.send(e)}}throw new Er(s.status,`Error POSTing to endpoint: ${g}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,s.status===202){await s.body?.cancel(),pv(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(g=>this.onerror?.(g));return}let d=(Array.isArray(e)?e:[e]).filter(g=>"method"in g&&"id"in g&&g.id!==void 0).length>0,f=s.headers.get("content-type");if(d)if(f?.includes("text/event-stream"))this._handleSseStream(s.body,{onresumptiontoken:o},!1);else if(f?.includes("application/json")){let g=await s.json(),m=Array.isArray(g)?g.map(v=>Xs.parse(v)):[Xs.parse(g)];for(let v of m)this.onmessage?.(v)}else throw await s.body?.cancel(),new Er(-1,`Unexpected content type: ${f}`);else await s.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Er(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};c();c();function Me(t,e,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function ye(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}c();var jh=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return jh=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};c();c();c();function Ra(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var Aa=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var Pe=class extends Error{},Ke=class t extends Pe{constructor(e,r,n,o){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=o,this.error=r}static makeMessage(e,r,n){let o=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&o?`${e} ${o}`:e?`${e} status code (no body)`:o||"(no status code or body)"}static generate(e,r,n,o){if(!e||!o)return new Nr({message:n,cause:Aa(r)});let i=r;return e===400?new fo(e,i,n,o):e===401?new po(e,i,n,o):e===403?new mo(e,i,n,o):e===404?new ho(e,i,n,o):e===409?new go(e,i,n,o):e===422?new yo(e,i,n,o):e===429?new _o(e,i,n,o):e>=500?new vo(e,i,n,o):new t(e,i,n,o)}},dn=class extends Ke{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Nr=class extends Ke{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},lo=class extends Nr{constructor({message:e}={}){super({message:e??"Request timed out."})}},fo=class extends Ke{},po=class extends Ke{},mo=class extends Ke{},ho=class extends Ke{},go=class extends Ke{},yo=class extends Ke{},_o=class extends Ke{},vo=class extends Ke{};var zN=/^[a-z][a-z0-9+.-]*:/i,Ix=t=>zN.test(t),Be=t=>(Be=Array.isArray,Be(t)),Oh=Be;function Ua(t){return typeof t!="object"?{}:t??{}}function Px(t){if(!t)return!0;for(let e in t)return!1;return!0}function jx(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Ox=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Pe(`${t} must be an integer`);if(e<0)throw new Pe(`${t} must be a positive integer`);return e};var Tx=t=>{try{return JSON.parse(t)}catch{return}};c();var Ex=t=>new Promise(e=>setTimeout(e,t));c();c();var Rr="0.53.0";function IN(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var PN=()=>{let t=IN();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Rr,"X-Stainless-OS":Rx(Deno.build.os),"X-Stainless-Arch":Nx(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Rr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Rr,"X-Stainless-OS":Rx(globalThis.process.platform??"unknown"),"X-Stainless-Arch":Nx(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=jN();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Rr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Rr,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function jN(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let o=n[1]||0,i=n[2]||0,a=n[3]||0;return{browser:e,version:`${o}.${i}.${a}`}}}return null}var Nx=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",Rx=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),Ax,Ux=()=>Ax??(Ax=PN());c();function Cx(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Smithery({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Th(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function Yc(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return Th({start(){},async pull(r){let{done:n,value:o}=await e.next();n?r.close():r.enqueue(o)},async cancel(){await e.return?.()}})}function Eh(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function Dx(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}c();var Zx=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});c();c();var Qc="RFC3986",Nh=t=>String(t),eu={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:Nh},Rh="RFC1738";c();c();var tu=(t,e)=>(tu=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),tu(t,e)),Kt=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var Ah=1024,Mx=(t,e,r,n,o)=>{if(t.length===0)return t;let i=t;if(typeof t=="symbol"?i=Symbol.prototype.toString.call(t):typeof t!="string"&&(i=String(t)),r==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(s){return"%26%23"+parseInt(s.slice(2),16)+"%3B"});let a="";for(let s=0;s<i.length;s+=Ah){let u=i.length>=Ah?i.slice(s,s+Ah):i,l=[];for(let d=0;d<u.length;++d){let f=u.charCodeAt(d);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||o===Rh&&(f===40||f===41)){l[l.length]=u.charAt(d);continue}if(f<128){l[l.length]=Kt[f];continue}if(f<2048){l[l.length]=Kt[192|f>>6]+Kt[128|f&63];continue}if(f<55296||f>=57344){l[l.length]=Kt[224|f>>12]+Kt[128|f>>6&63]+Kt[128|f&63];continue}d+=1,f=65536+((f&1023)<<10|u.charCodeAt(d)&1023),l[l.length]=Kt[240|f>>18]+Kt[128|f>>12&63]+Kt[128|f>>6&63]+Kt[128|f&63]}a+=l.join("")}return a};function qx(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function Uh(t,e){if(Be(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var Fx={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},Vx=function(t,e){Array.prototype.push.apply(t,Be(e)?e:[e])},Lx,je={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Mx,encodeValuesOnly:!1,format:Qc,formatter:Nh,indices:!1,serializeDate(t){return(Lx??(Lx=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function EN(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var Ch={};function Jx(t,e,r,n,o,i,a,s,u,l,d,f,g,m,v,_,b,$){let x=t,P=$,Z=0,U=!1;for(;(P=P.get(Ch))!==void 0&&!U;){let xe=P.get(t);if(Z+=1,typeof xe<"u"){if(xe===Z)throw new RangeError("Cyclic object value");U=!0}typeof P.get(Ch)>"u"&&(Z=0)}if(typeof l=="function"?x=l(e,x):x instanceof Date?x=g?.(x):r==="comma"&&Be(x)&&(x=Uh(x,function(xe){return xe instanceof Date?g?.(xe):xe})),x===null){if(i)return u&&!_?u(e,je.encoder,b,"key",m):e;x=""}if(EN(x)||qx(x)){if(u){let xe=_?e:u(e,je.encoder,b,"key",m);return[v?.(xe)+"="+v?.(u(x,je.encoder,b,"value",m))]}return[v?.(e)+"="+v?.(String(x))]}let ze=[];if(typeof x>"u")return ze;let We;if(r==="comma"&&Be(x))_&&u&&(x=Uh(x,u)),We=[{value:x.length>0?x.join(",")||null:void 0}];else if(Be(l))We=l;else{let xe=Object.keys(x);We=d?xe.sort(d):xe}let _n=s?String(e).replace(/\./g,"%2E"):String(e),dr=n&&Be(x)&&x.length===1?_n+"[]":_n;if(o&&Be(x)&&x.length===0)return dr+"[]";for(let xe=0;xe<We.length;++xe){let Ct=We[xe],Ro=typeof Ct=="object"&&typeof Ct.value<"u"?Ct.value:x[Ct];if(a&&Ro===null)continue;let vn=f&&s?Ct.replace(/\./g,"%2E"):Ct,vu=Be(x)?typeof r=="function"?r(dr,vn):dr:dr+(f?"."+vn:"["+vn+"]");$.set(t,Z);let ag=new WeakMap;ag.set(Ch,$),Vx(ze,Jx(Ro,vu,r,n,o,i,a,s,r==="comma"&&_&&Be(x)?null:u,l,d,f,g,m,v,_,b,ag))}return ze}function NN(t=je){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||je.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=Qc;if(typeof t.format<"u"){if(!tu(eu,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=eu[r],o=je.filter;(typeof t.filter=="function"||Be(t.filter))&&(o=t.filter);let i;if(t.arrayFormat&&t.arrayFormat in Fx?i=t.arrayFormat:"indices"in t?i=t.indices?"indices":"repeat":i=je.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:je.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:je.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:je.allowEmptyArrays,arrayFormat:i,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:je.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?je.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:je.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:je.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:je.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:je.encodeValuesOnly,filter:o,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:je.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:je.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:je.strictNullHandling}}function Dh(t,e={}){let r=t,n=NN(e),o,i;typeof n.filter=="function"?(i=n.filter,r=i("",r)):Be(n.filter)&&(i=n.filter,o=i);let a=[];if(typeof r!="object"||r===null)return"";let s=Fx[n.arrayFormat],u=s==="comma"&&n.commaRoundTrip;o||(o=Object.keys(r)),n.sort&&o.sort(n.sort);let l=new WeakMap;for(let g=0;g<o.length;++g){let m=o[g];n.skipNulls&&r[m]===null||Vx(a,Jx(r[m],m,s,u,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let d=a.join(n.delimiter),f=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),d.length>0?f+d:""}c();c();c();c();c();function Bx(t){let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),n=0;for(let o of t)r.set(o,n),n+=o.length;return r}var Hx;function Ca(t){let e;return(Hx??(e=new globalThis.TextEncoder,Hx=e.encode.bind(e)))(t)}var Kx;function Zh(t){let e;return(Kx??(e=new globalThis.TextDecoder,Kx=e.decode.bind(e)))(t)}var ht,gt,fn=class{constructor(){ht.set(this,void 0),gt.set(this,void 0),Me(this,ht,new Uint8Array,"f"),Me(this,gt,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Ca(e):e;Me(this,ht,Bx([ye(this,ht,"f"),r]),"f");let n=[],o;for(;(o=AN(ye(this,ht,"f"),ye(this,gt,"f")))!=null;){if(o.carriage&&ye(this,gt,"f")==null){Me(this,gt,o.index,"f");continue}if(ye(this,gt,"f")!=null&&(o.index!==ye(this,gt,"f")+1||o.carriage)){n.push(Zh(ye(this,ht,"f").subarray(0,ye(this,gt,"f")-1))),Me(this,ht,ye(this,ht,"f").subarray(ye(this,gt,"f")),"f"),Me(this,gt,null,"f");continue}let i=ye(this,gt,"f")!==null?o.preceding-1:o.preceding,a=Zh(ye(this,ht,"f").subarray(0,i));n.push(a),Me(this,ht,ye(this,ht,"f").subarray(o.index),"f"),Me(this,gt,null,"f")}return n}flush(){return ye(this,ht,"f").length?this.decode(`
|
|
38
|
+
`):[]}};ht=new WeakMap,gt=new WeakMap;fn.NEWLINE_CHARS=new Set([`
|
|
39
|
+
`,"\r"]);fn.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function AN(t,e){for(let o=e??0;o<t.length;o++){if(t[o]===10)return{preceding:o,index:o+1,carriage:!1};if(t[o]===13)return{preceding:o,index:o+1,carriage:!0}}return null}function Wx(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}c();var nu={off:0,error:200,warn:300,info:400,debug:500},Mh=(t,e,r)=>{if(t){if(jx(nu,t))return t;Ee(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(nu))}`)}};function Da(){}function ru(t,e,r){return!e||nu[t]>nu[r]?Da:e[t].bind(e)}var UN={error:Da,warn:Da,info:Da,debug:Da},Gx=new WeakMap;function Ee(t){let e=t.logger,r=t.logLevel??"off";if(!e)return UN;let n=Gx.get(e);if(n&&n[0]===r)return n[1];let o={error:ru("error",e,r),warn:ru("warn",e,r),info:ru("info",e,r),debug:ru("debug",e,r)};return Gx.set(e,[r,o]),o}var ur=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var Za,ou=class t{constructor(e,r,n){this.iterator=e,Za.set(this,void 0),this.controller=r,Me(this,Za,n,"f")}static fromSSEResponse(e,r,n){let o=!1,i=n?Ee(n):console;async function*a(){if(o)throw new Pe("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of CN(e,r))try{yield JSON.parse(u.data)}catch(l){throw i.error("Could not parse message into JSON:",u.data),i.error("From chunk:",u.raw),l}s=!0}catch(u){if(Ra(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let o=!1;async function*i(){let s=new fn,u=Eh(e);for await(let l of u)for(let d of s.decode(l))yield d;for(let l of s.flush())yield l}async function*a(){if(o)throw new Pe("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let s=!1;try{for await(let u of i())s||u&&(yield JSON.parse(u));s=!0}catch(u){if(Ra(u))return;throw u}finally{s||r.abort()}}return new t(a,r,n)}[(Za=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),o=i=>({next:()=>{if(i.length===0){let a=n.next();e.push(a),r.push(a)}return i.shift()}});return[new t(()=>o(e),this.controller,ye(this,Za,"f")),new t(()=>o(r),this.controller,ye(this,Za,"f"))]}toReadableStream(){let e=this,r;return Th({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:o,done:i}=await r.next();if(i)return n.close();let a=Ca(JSON.stringify(o)+`
|
|
40
|
+
`);n.enqueue(a)}catch(o){n.error(o)}},async cancel(){await r.return?.()}})}};async function*CN(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new Pe("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new Pe("Attempted to iterate over a response with no body");let r=new qh,n=new fn,o=Eh(t.body);for await(let i of DN(o))for(let a of n.decode(i)){let s=r.decode(a);s&&(yield s)}for(let i of n.flush()){let a=r.decode(i);a&&(yield a)}}async function*DN(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?Ca(r):r,o=new Uint8Array(e.length+n.length);o.set(e),o.set(n,e.length),e=o;let i;for(;(i=Wx(e))!==-1;)yield e.slice(0,i),e=e.slice(i)}e.length>0&&(yield e)}var qh=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let i={event:this.event,data:this.data.join(`
|
|
41
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],i}if(this.chunks.push(e),e.startsWith(":"))return null;let[r,n,o]=ZN(e,":");return o.startsWith(" ")&&(o=o.substring(1)),r==="event"?this.event=o:r==="data"&&this.data.push(o),null}};function ZN(t,e){let r=t.indexOf(e);return r!==-1?[t.substring(0,r),e,t.substring(r+e.length)]:[t,"",""]}async function iu(t,e){let{response:r,requestLogID:n,retryOfRequestLogID:o,startTime:i}=e,a=await(async()=>{if(e.options.stream)return Ee(t).debug("response",r.status,r.url,r.headers,r.body),e.options.__streamClass?e.options.__streamClass.fromSSEResponse(r,e.controller,t):ou.fromSSEResponse(r,e.controller,t);if(r.status===204)return null;if(e.options.__binaryResponse)return r;let u=r.headers.get("content-type")?.split(";")[0]?.trim();return u?.includes("application/json")||u?.endsWith("+json")?r.headers.get("content-length")==="0"?void 0:await r.json():await r.text()})();return Ee(t).debug(`[${n}] response parsed`,ur({retryOfRequestLogID:o,url:r.url,status:r.status,body:a,durationMs:Date.now()-i})),a}c();var Ma,pn=class t extends Promise{constructor(e,r,n=iu){super(o=>{o(null)}),this.responsePromise=r,this.parseResponse=n,Ma.set(this,void 0),Me(this,Ma,e,"f")}_thenUnwrap(e){return new t(ye(this,Ma,"f"),this.responsePromise,async(r,n)=>e(await this.parseResponse(r,n),n))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){let[e,r]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:r}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(ye(this,Ma,"f"),e))),this.parsedPromise}then(e,r){return this.parse().then(e,r)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};Ma=new WeakMap;var au,bo=class{constructor(e,r,n,o){au.set(this,void 0),Me(this,au,e,"f"),this.options=o,this.response=r,this.body=n}hasNextPage(){return this.getPaginatedItems().length?this.nextPageRequestOptions()!=null:!1}async getNextPage(){let e=this.nextPageRequestOptions();if(!e)throw new Pe("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await ye(this,au,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(au=new WeakMap,Symbol.asyncIterator)](){for await(let e of this.iterPages())for(let r of e.getPaginatedItems())yield r}},qa=class extends pn{constructor(e,r,n){super(e,r,async(o,i)=>new n(o,i.response,await iu(o,i),i.options))}async*[Symbol.asyncIterator](){let e=await this;for await(let r of e)yield r}},su=class extends bo{constructor(e,r,n,o){super(e,r,n,o),this.servers=n.servers||[],this.pagination=n.pagination||{}}getPaginatedItems(){return this.servers??[]}nextPageRequestOptions(){let r=this.options.query?.page??1;return{...this.options,query:{...Ua(this.options.query),page:r+1}}}},cu=class extends bo{constructor(e,r,n,o){super(e,r,n,o),this.skills=n.skills||[],this.pagination=n.pagination||{}}getPaginatedItems(){return this.skills??[]}nextPageRequestOptions(){let r=this.options.query?.page??1;return{...this.options,query:{...Ua(this.options.query),page:r+1}}}},uu=class extends bo{constructor(e,r,n,o){super(e,r,n,o),this.namespaces=n.namespaces||[],this.pagination=n.pagination||{}}getPaginatedItems(){return this.namespaces??[]}nextPageRequestOptions(){let r=this.options.query?.page??1;return{...this.options,query:{...Ua(this.options.query),page:r+1}}}},lu=class extends bo{constructor(e,r,n,o){super(e,r,n,o),this.reviews=n.reviews||[],this.pagination=n.pagination||{}}getPaginatedItems(){return this.reviews??[]}nextPageRequestOptions(){let r=this.options.query?.page??1;return{...this.options,query:{...Ua(this.options.query),page:r+1}}}};c();c();c();var Fh=()=>{if(typeof File>"u"){let{process:t}=globalThis,e=typeof t?.versions?.node=="string"&&parseInt(t.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(e?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function $o(t,e,r){return Fh(),new File(t,e??"unknown_file",r)}function La(t){return(typeof t=="object"&&t!==null&&("name"in t&&t.name&&String(t.name)||"url"in t&&t.url&&String(t.url)||"filename"in t&&t.filename&&String(t.filename)||"path"in t&&t.path&&String(t.path))||"").split(/[\\/]/).pop()||void 0}var Vh=t=>t!=null&&typeof t=="object"&&typeof t[Symbol.asyncIterator]=="function";var Yx=async(t,e)=>({...t,body:await LN(t.body,e)}),Xx=new WeakMap;function qN(t){let e=typeof t=="function"?t:t.fetch,r=Xx.get(e);if(r)return r;let n=(async()=>{try{let o="Response"in e?e.Response:(await e("data:,")).constructor,i=new FormData;return i.toString()!==await new o(i).text()}catch{return!0}})();return Xx.set(e,n),n}var LN=async(t,e)=>{if(!await qN(e))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let r=new FormData;return await Promise.all(Object.entries(t||{}).map(([n,o])=>Lh(r,n,o))),r},FN=t=>t instanceof Blob&&"name"in t;var Lh=async(t,e,r)=>{if(r!==void 0){if(r==null)throw new TypeError(`Received null for "${e}"; to pass null in FormData, you must use the string 'null'`);if(typeof r=="string"||typeof r=="number"||typeof r=="boolean")t.append(e,String(r));else if(r instanceof Response)t.append(e,$o([await r.blob()],La(r)));else if(Vh(r))t.append(e,$o([await new Response(Yc(r)).blob()],La(r)));else if(FN(r))t.append(e,r,La(r));else if(Array.isArray(r))await Promise.all(r.map(n=>Lh(t,e+"[]",n)));else if(typeof r=="object")await Promise.all(Object.entries(r).map(([n,o])=>Lh(t,`${e}[${n}]`,o)));else throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${r} instead`)}};var Qx=t=>t!=null&&typeof t=="object"&&typeof t.size=="number"&&typeof t.type=="string"&&typeof t.text=="function"&&typeof t.slice=="function"&&typeof t.arrayBuffer=="function",VN=t=>t!=null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.lastModified=="number"&&Qx(t),JN=t=>t!=null&&typeof t=="object"&&typeof t.url=="string"&&typeof t.blob=="function";async function du(t,e,r){if(Fh(),t=await t,VN(t))return t instanceof File?t:$o([await t.arrayBuffer()],t.name);if(JN(t)){let o=await t.blob();return e||(e=new URL(t.url).pathname.split(/[\\/]/).pop()),$o(await Jh(o),e,r)}let n=await Jh(t);if(e||(e=La(t)),!r?.type){let o=n.find(i=>typeof i=="object"&&"type"in i&&i.type);typeof o=="string"&&(r={...r,type:o})}return $o(n,e,r)}async function Jh(t){let e=[];if(typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer)e.push(t);else if(Qx(t))e.push(t instanceof Blob?t:await t.arrayBuffer());else if(Vh(t))for await(let r of t)e.push(...await Jh(r));else{let r=t?.constructor?.name;throw new Error(`Unexpected data type: ${typeof t}${r?`; constructor: ${r}`:""}${HN(t)}`)}return e}function HN(t){return typeof t!="object"||t===null?"":`; props: [${Object.getOwnPropertyNames(t).map(r=>`"${r}"`).join(", ")}]`}c();c();c();var te=class{constructor(e){this._client=e}};c();c();function tw(t){return t.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var ew=Object.freeze(Object.create(null)),BN=(t=tw)=>function(r,...n){if(r.length===1)return r[0];let o=!1,i=[],a=r.reduce((d,f,g)=>{/[?#]/.test(f)&&(o=!0);let m=n[g],v=(o?encodeURIComponent:t)(""+m);return g!==n.length&&(m==null||typeof m=="object"&&m.toString===Object.getPrototypeOf(Object.getPrototypeOf(m.hasOwnProperty??ew)??ew)?.toString)&&(v=m+"",i.push({start:d.length+f.length,length:v.length,error:`Value of type ${Object.prototype.toString.call(m).slice(8,-1)} is not a valid path parameter`})),d+f+(g===n.length?"":v)},""),s=a.split(/[?#]/,1)[0],u=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=u.exec(s))!==null;)i.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can't be safely passed as a path parameter`});if(i.sort((d,f)=>d.start-f.start),i.length>0){let d=0,f=i.reduce((g,m)=>{let v=" ".repeat(m.start-d),_="^".repeat(m.length);return d=m.start+m.length,g+v+_},"");throw new Pe(`Path parameters result in path with invalid segments:
|
|
42
|
+
${i.map(g=>g.error).join(`
|
|
43
|
+
`)}
|
|
44
|
+
${a}
|
|
45
|
+
${f}`)}return a},R=BN(tw);var xo=class extends te{call(e,r,n){let{namespace:o}=r;return this._client.post(R`/connect/${o}/${e}/mcp`,n)}};var Ar=class extends te{constructor(){super(...arguments),this.mcp=new xo(this._client)}create(e,r,n){return this._client.post(R`/connect/${e}`,{body:r,...n})}list(e,r={},n){return this._client.get(R`/connect/${e}`,{query:r,...n})}delete(e,r,n){let{namespace:o}=r;return this._client.delete(R`/connect/${o}/${e}`,n)}get(e,r,n){let{namespace:o}=r;return this._client.get(R`/connect/${o}/${e}`,n)}set(e,r,n){let{namespace:o,...i}=r;return this._client.put(R`/connect/${o}/${e}`,{body:i,...n})}};Ar.Mcp=xo;c();var mn=class extends te{check(e){return this._client.get("/health",e)}};c();c();var wo=class extends te{create(e,r,n){let{namespace:o,...i}=r;return this._client.put(R`/namespaces/${o}/servers/${e}`,{body:i,...n})}};var Ur=class extends te{constructor(){super(...arguments),this.servers=new wo(this._client)}create(e){return this._client.post("/namespaces",e)}list(e={},r){return this._client.getAPIList("/namespaces",uu,{query:e,...r})}delete(e,r){return this._client.delete(R`/namespaces/${e}`,r)}set(e,r){return this._client.put(R`/namespaces/${e}`,r)}};Ur.Servers=wo;c();c();var ko=class extends te{create(e,r,n){return this._client.post(R`/servers/${e}/domains`,{body:r,...n})}update(e,r,n){let{qualifiedName:o,...i}=r;return this._client.patch(R`/servers/${o}/domains/${e}`,{body:i,...n})}list(e,r){return this._client.get(R`/servers/${e}/domains`,r)}delete(e,r,n){let{qualifiedName:o}=r;return this._client.delete(R`/servers/${o}/domains/${e}`,n)}};c();c();var rw=Symbol("brand.privateNullableHeaders");function*YN(t){if(!t)return;if(rw in t){let{values:n,nulls:o}=t;yield*n.entries();for(let i of o)yield[i,null];return}let e=!1,r;t instanceof Headers?r=t.entries():Oh(t)?r=t:(e=!0,r=Object.entries(t??{}));for(let n of r){let o=n[0];if(typeof o!="string")throw new TypeError("expected header name to be a string");let i=Oh(n[1])?n[1]:[n[1]],a=!1;for(let s of i)s!==void 0&&(e&&!a&&(a=!0,yield[o,null]),yield[o,s])}}var rt=t=>{let e=new Headers,r=new Set;for(let n of t){let o=new Set;for(let[i,a]of YN(n)){let s=i.toLowerCase();o.has(s)||(e.delete(i),o.add(s)),a===null?(e.delete(i),r.add(s)):(e.append(i,a),r.delete(s))}}return{[rw]:!0,values:e,nulls:r}};var So=class extends te{delete(e,r){return this._client.delete(R`/servers/${e}/icon`,r)}get(e,r){return this._client.get(R`/servers/${e}/icon`,{...r,headers:rt([{Accept:"image/*"},r?.headers]),__binaryResponse:!0})}upload(e,r){return this._client.put(R`/servers/${e}/icon`,r)}};c();var zo=class extends te{list(e,r={},n){return this._client.get(R`/servers/${e}/logs`,{query:r,...n})}};c();var Io=class extends te{list(e,r){return this._client.get(R`/servers/${e}/releases`,r)}deploy(e,r,n){return this._client.put(R`/servers/${e}/releases`,Yx({body:r,...n},this._client))}get(e,r,n){let{qualifiedName:o}=r;return this._client.get(R`/servers/${o}/releases/${e}`,n)}resume(e,r,n){let{qualifiedName:o}=r;return this._client.post(R`/servers/${o}/releases/${e}/resume`,n)}stream(e,r,n){let{qualifiedName:o}=r;return this._client.get(R`/servers/${o}/releases/${e}/stream`,{...n,headers:rt([{Accept:"text/event-stream"},n?.headers]),stream:!0})}};c();var Po=class extends te{update(e,r={},n){return this._client.patch(R`/servers/${e}/repo`,{body:r,...n})}delete(e,r){return this._client.delete(R`/servers/${e}/repo`,r)}get(e,r){return this._client.get(R`/servers/${e}/repo`,r)}set(e,r,n){return this._client.put(R`/servers/${e}/repo`,{body:r,...n})}};c();var jo=class extends te{list(e,r){return this._client.get(R`/servers/${e}/secrets`,r)}delete(e,r,n){let{qualifiedName:o}=r;return this._client.delete(R`/servers/${o}/secrets/${e}`,n)}set(e,r,n){return this._client.put(R`/servers/${e}/secrets`,{body:r,...n})}};var yt=class extends te{constructor(){super(...arguments),this.releases=new Io(this._client),this.logs=new zo(this._client),this.secrets=new jo(this._client),this.repo=new Po(this._client),this.icon=new So(this._client),this.domains=new ko(this._client)}create(e,r={},n){return this._client.put(R`/servers/${e}`,{body:r,...n})}update(e,r={},n){return this._client.patch(R`/servers/${e}`,{body:r,...n})}list(e={},r){return this._client.getAPIList("/servers",su,{query:e,...r})}delete(e,r){return this._client.delete(R`/servers/${e}`,r)}download(e,r){return this._client.get(R`/servers/${e}/download`,{...r,headers:rt([{Accept:"application/zip"},r?.headers]),__binaryResponse:!0})}get(e,r){return this._client.get(R`/servers/${e}`,r)}};yt.Releases=Io;yt.Logs=zo;yt.Secrets=jo;yt.Repo=Po;yt.Icon=So;yt.Domains=ko;c();c();var Oo=class extends te{create(e,r,n){let{namespace:o,...i}=r;return this._client.post(R`/skills/${o}/${e}/reviews`,{body:i,...n})}list(e,r,n){let{namespace:o,...i}=r;return this._client.getAPIList(R`/skills/${o}/${e}/reviews`,lu,{query:i,...n})}delete(e,r,n){let{namespace:o}=r;return this._client.delete(R`/skills/${o}/${e}/reviews`,{...n,headers:rt([{Accept:"*/*"},n?.headers])})}unvote(e,r,n){let{namespace:o,slug:i}=r;return this._client.delete(R`/skills/${o}/${i}/reviews/${e}/vote`,{...n,headers:rt([{Accept:"*/*"},n?.headers])})}vote(e,r,n){let{namespace:o,slug:i,...a}=r;return this._client.post(R`/skills/${o}/${i}/reviews/${e}/vote`,{body:a,...n})}};c();var To=class extends te{create(e,r,n){let{namespace:o,...i}=r;return this._client.post(R`/skills/${o}/${e}/vote`,{body:i,...n})}delete(e,r,n){let{namespace:o}=r;return this._client.delete(R`/skills/${o}/${e}/vote`,{...n,headers:rt([{Accept:"*/*"},n?.headers])})}get(e,r,n){let{namespace:o}=r;return this._client.get(R`/skills/${o}/${e}/vote`,n)}};var lr=class extends te{constructor(){super(...arguments),this.votes=new To(this._client),this.reviews=new Oo(this._client)}create(e,r){return this._client.post("/skills",{body:e,...r})}list(e={},r){return this._client.getAPIList("/skills",cu,{query:e,...r})}delete(e,r,n){let{namespace:o}=r;return this._client.delete(R`/skills/${o}/${e}`,n)}get(e,r,n){let{namespace:o}=r;return this._client.get(R`/skills/${o}/${e}`,n)}set(e,r,n){let{namespace:o,...i}=r;return this._client.put(R`/skills/${o}/${e}`,{body:i,...n})}sync(e,r,n){let{namespace:o}=r;return this._client.post(R`/skills/${o}/${e}/sync`,n)}};lr.Votes=To;lr.Reviews=Oo;c();var hn=class extends te{create(e={},r){return this._client.post("/tokens",{body:e,...r})}};c();var gn=class extends te{createToken(e){return this._client.post("/uplink/token",e)}};c();var fu=t=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[t]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(t)?.trim()};var Hh,Kh,pu,nw,se=class{constructor({baseURL:e=fu("SMITHERY_BASE_URL"),apiKey:r=fu("SMITHERY_API_KEY"),...n}={}){if(Hh.add(this),pu.set(this,void 0),this.health=new mn(this),this.servers=new yt(this),this.uplink=new gn(this),this.skills=new lr(this),this.namespaces=new Ur(this),this.tokens=new hn(this),this.connections=new Ar(this),r===void 0)throw new Pe("The SMITHERY_API_KEY environment variable is missing or empty; either provide it, or instantiate the Smithery client with an apiKey option, like new Smithery({ apiKey: 'My API Key' }).");let o={apiKey:r,...n,baseURL:e||"https://api.smithery.ai"};this.baseURL=o.baseURL,this.timeout=o.timeout??Kh.DEFAULT_TIMEOUT,this.logger=o.logger??console;let i="warn";this.logLevel=i,this.logLevel=Mh(o.logLevel,"ClientOptions.logLevel",this)??Mh(fu("SMITHERY_LOG"),"process.env['SMITHERY_LOG']",this)??i,this.fetchOptions=o.fetchOptions,this.maxRetries=o.maxRetries??2,this.fetch=o.fetch??Cx(),Me(this,pu,Zx,"f"),this._options=o,this.apiKey=r}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return rt([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return Dh(e,{arrayFormat:"comma"})}getUserAgent(){return`${this.constructor.name}/JS ${Rr}`}defaultIdempotencyKey(){return`stainless-node-retry-${jh()}`}makeStatusError(e,r,n,o){return Ke.generate(e,r,n,o)}buildURL(e,r,n){let o=!ye(this,Hh,"m",nw).call(this)&&n||this.baseURL,i=Ix(e)?new URL(e):new URL(o+(o.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery();return Px(a)||(r={...a,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(i.search=this.stringifyQuery(r)),i.toString()}async prepareOptions(e){}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(o=>({method:e,path:r,...o})))}request(e,r=null){return new pn(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let o=await e,i=o.maxRetries??this.maxRetries;r==null&&(r=i),await this.prepareOptions(o);let{req:a,url:s,timeout:u}=await this.buildRequest(o,{retryCount:i-r});await this.prepareRequest(a,{url:s,options:o});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),d=n===void 0?"":`, retryOf: ${n}`,f=Date.now();if(Ee(this).debug(`[${l}] sending request`,ur({retryOfRequestLogID:n,method:o.method,url:s,options:o,headers:a.headers})),o.signal?.aborted)throw new dn;let g=new AbortController,m=await this.fetchWithTimeout(s,a,u,g).catch(Aa),v=Date.now();if(m instanceof globalThis.Error){let b=`retrying, ${r} attempts remaining`;if(o.signal?.aborted)throw new dn;let $=Ra(m)||/timed? ?out/i.test(String(m)+("cause"in m?String(m.cause):""));if(r)return Ee(this).info(`[${l}] connection ${$?"timed out":"failed"} - ${b}`),Ee(this).debug(`[${l}] connection ${$?"timed out":"failed"} (${b})`,ur({retryOfRequestLogID:n,url:s,durationMs:v-f,message:m.message})),this.retryRequest(o,r,n??l);throw Ee(this).info(`[${l}] connection ${$?"timed out":"failed"} - error; no more retries left`),Ee(this).debug(`[${l}] connection ${$?"timed out":"failed"} (error; no more retries left)`,ur({retryOfRequestLogID:n,url:s,durationMs:v-f,message:m.message})),$?new lo:new Nr({cause:m})}let _=`[${l}${d}] ${a.method} ${s} ${m.ok?"succeeded":"failed"} with status ${m.status} in ${v-f}ms`;if(!m.ok){let b=await this.shouldRetry(m);if(r&&b){let ze=`retrying, ${r} attempts remaining`;return await Dx(m.body),Ee(this).info(`${_} - ${ze}`),Ee(this).debug(`[${l}] response error (${ze})`,ur({retryOfRequestLogID:n,url:m.url,status:m.status,headers:m.headers,durationMs:v-f})),this.retryRequest(o,r,n??l,m.headers)}let $=b?"error; no more retries left":"error; not retryable";Ee(this).info(`${_} - ${$}`);let x=await m.text().catch(ze=>Aa(ze).message),P=Tx(x),Z=P?void 0:x;throw Ee(this).debug(`[${l}] response error (${$})`,ur({retryOfRequestLogID:n,url:m.url,status:m.status,headers:m.headers,message:Z,durationMs:Date.now()-f})),this.makeStatusError(m.status,P,Z,m.headers)}return Ee(this).info(_),Ee(this).debug(`[${l}] response start`,ur({retryOfRequestLogID:n,url:m.url,status:m.status,headers:m.headers,durationMs:v-f})),{response:m,options:o,controller:g,requestLogID:l,retryOfRequestLogID:n,startTime:f}}getAPIList(e,r,n){return this.requestAPIList(r,n&&"then"in n?n.then(o=>({method:"get",path:e,...o})):{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new qa(this,n,e)}async fetchWithTimeout(e,r,n,o){let{signal:i,method:a,...s}=r||{},u=this._makeAbort(o);i&&i.addEventListener("abort",u,{once:!0});let l=setTimeout(u,n),d=globalThis.ReadableStream&&s.body instanceof globalThis.ReadableStream||typeof s.body=="object"&&s.body!==null&&Symbol.asyncIterator in s.body,f={signal:o.signal,...d?{duplex:"half"}:{},method:"GET",...s};a&&(f.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,f)}finally{clearTimeout(l)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,o){let i,a=o?.get("retry-after-ms");if(a){let u=parseFloat(a);Number.isNaN(u)||(i=u)}let s=o?.get("retry-after");if(s&&!i){let u=parseFloat(s);Number.isNaN(u)?i=Date.parse(s)-Date.now():i=u*1e3}if(!(i&&0<=i&&i<60*1e3)){let u=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(r,u)}return await Ex(i),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let i=r-e,a=Math.min(.5*Math.pow(2,i),8),s=1-Math.random()*.25;return a*s*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:o,path:i,query:a,defaultBaseURL:s}=n,u=this.buildURL(i,a,s);"timeout"in n&&Ox("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:d}=this.buildBody({options:n}),f=await this.buildHeaders({options:e,method:o,bodyHeaders:l,retryCount:r});return{req:{method:o,headers:f,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&d instanceof globalThis.ReadableStream&&{duplex:"half"},...d&&{body:d},...this.fetchOptions??{},...n.fetchOptions??{}},url:u,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:o}){let i={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=rt([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(o),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...Ux()},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=rt([r]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:Yc(e)}:typeof e=="object"&&n.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)}:ye(this,pu,"f").call(this,{body:e,headers:n})}};Kh=se,pu=new WeakMap,Hh=new WeakSet,nw=function(){return this.baseURL!=="https://api.smithery.ai"};se.Smithery=Kh;se.DEFAULT_TIMEOUT=6e4;se.SmitheryError=Pe;se.APIError=Ke;se.APIConnectionError=Nr;se.APIConnectionTimeoutError=lo;se.APIUserAbortError=dn;se.NotFoundError=ho;se.ConflictError=go;se.RateLimitError=_o;se.BadRequestError=fo;se.AuthenticationError=po;se.InternalServerError=vo;se.PermissionDeniedError=mo;se.UnprocessableEntityError=yo;se.toFile=du;se.Health=mn;se.Servers=yt;se.Uplink=gn;se.Skills=lr;se.Namespaces=Ur;se.Tokens=hn;se.Connections=Ar;var Bh=class extends Error{constructor(e,r,n){super(e),this.authorizationUrl=r,this.connectionId=n,this.name="SmitheryAuthorizationError"}};async function ow(t){let e=t.client??new se;if(!t.connectionId&&!t.mcpUrl)throw new Error("mcpUrl is required when connectionId is not provided");let r=await s1(e,t.namespace),n=await c1(e,r,t.connectionId,t.mcpUrl),o=n.connectionId;if(n.status){if(n.status.state==="auth_required"){let{authorizationUrl:u}=n.status;throw u?new Bh(`MCP server requires authorization. Please visit: ${u}`,u,o):new Error("MCP server requires authorization.")}if(n.status.state==="error")throw new Error(`MCP connection failed: ${n.status.message}`)}else if(!n.serverInfo)throw new Error("Connection is not initialized. The upstream MCP server may require authorization. Try creating a new connection with mcpUrl to get authorization details.");let i=new URL(`/connect/${r}/${o}/mcp`,e.baseURL).href,a={requestInit:{headers:{Authorization:`Bearer ${e.apiKey}`}}};return{transport:new Xc(new URL(i),t.handshake?a:{...a,sessionId:"smithery-stateless"}),connectionId:o,url:i}}async function s1(t,e){if(e)return e;let{namespaces:r}=await t.namespaces.list();if(r.length>0)return r[0].name;let{name:n}=await t.namespaces.create();return n}async function c1(t,e,r,n){if(r)try{return await t.connections.get(r,{namespace:e})}catch(o){if(n)return await t.connections.set(r,{namespace:e,mcpUrl:n});throw o}return await t.connections.create(e,{mcpUrl:n})}c();c();ig();async function yw(t){let e=t??await og();if(!e)throw new Error("No API key found. Run 'smithery login' to authenticate.");return new se({apiKey:e})}c();var P1="https://server.smithery.ai/";function _w(t){return t.startsWith("https://")||t.startsWith("http://")?t:`${P1}${t}`}async function uK(t){let e=await yw(t.apiKey),r=t.namespace;if(!r){let{getNamespace:o}=await Promise.resolve().then(()=>(ig(),gw));if(r=await o(),!r){let{namespaces:i}=await e.namespaces.list();i.length===0?r=(await e.namespaces.create()).name:r=i[0].name}}let n=new Map;for(let o of t.servers){let i=_w(o),{connections:a}=await e.connections.list(r,{mcpUrl:i}),s;if(a.length>0){let d=a[0];if(d.status?.state==="auth_required"){let f=d.status?.authorizationUrl,g=new Error(`Connection for ${o} requires authorization`);throw g.authorizationUrl=f,g}s=d.connectionId}else{let d=await e.connections.create(r,{mcpUrl:i});if(d.status?.state==="auth_required"){let f=d.status?.authorizationUrl,g=new Error(`Connection for ${o} requires authorization`);throw g.authorizationUrl=f,g}s=d.connectionId}let{transport:u}=await ow({client:e,namespace:r,connectionId:s}),l=new Kc({name:"smithery-automation",version:"1.0.0"});await l.connect(u),n.set(o,{connectionId:s,client:l})}return{callTool:async(o,i,a)=>{let s=n.get(o);if(!s)throw new Error(`Server "${o}" was not included in the servers array.`);return s.client.callTool({name:i,arguments:a})}}}export{uK as createAutomationContext};
|