superpowers-mcp 6.3.8 → 6.3.9
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.ja.md +21 -2
- package/README.ko.md +21 -2
- package/README.md +21 -2
- package/README.zh-TW.md +21 -2
- package/docs/desktop-setup.md +86 -0
- package/out/server.js +55 -54
- package/out/setup-runner.js +21 -20
- package/out/setup.js +22 -21
- package/package.json +1 -1
- package/scripts/install.sh +1 -1
package/out/server.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var w$=Object.create;var Ns=Object.defineProperty;var S$=Object.getOwnPropertyDescriptor;var z$=Object.getOwnPropertyNames;var I$=Object.getPrototypeOf,P$=Object.prototype.hasOwnProperty;var I=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},En=(e,t)=>{for(var r in t)Ns(e,r,{get:t[r],enumerable:!0})},j$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of z$(t))!P$.call(e,i)&&i!==r&&Ns(e,i,{get:()=>t[i],enumerable:!(n=S$(t,i))||n.enumerable});return e};var ft=(e,t,r)=>(r=e!=null?w$(I$(e)):{},j$(t||!e||!e.__esModule?Ns(r,"default",{value:e,enumerable:!0}):r,e));var qi=I(ie=>{"use strict";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 Mi=class{};ie._CodeOrName=Mi;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var br=class extends Mi{constructor(t){if(super(),!ie.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ie.Name=br;var ut=class extends Mi{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof br&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=ut;ie.nil=new ut("");function ov(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Dd(r,t[n]),r.push(e[++n]);return new ut(r)}ie._=ov;var Od=new ut("+");function av(e,...t){let r=[Fi(e[0])],n=0;for(;n<t.length;)r.push(Od),Dd(r,t[n]),r.push(Od,Fi(e[++n]));return pS(r),new ut(r)}ie.str=av;function Dd(e,t){t instanceof ut?e.push(...t._items):t instanceof br?e.push(t):e.push(hS(t))}ie.addCodeArg=Dd;function pS(e){let t=1;for(;t<e.length-1;){if(e[t]===Od){let r=fS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function fS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof br||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof br))return`"${e}${t.slice(1)}`}function mS(e,t){return t.emptyStr()?e:e.emptyStr()?t:av`${e}${t}`}ie.strConcat=mS;function hS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Fi(Array.isArray(e)?e.join(","):e)}function gS(e){return new ut(Fi(e))}ie.stringify=gS;function Fi(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=Fi;function vS(e){return typeof e=="string"&&ie.IDENTIFIER.test(e)?new ut(`.${e}`):ov`[${e}]`}ie.getProperty=vS;function yS(e){if(typeof e=="string"&&ie.IDENTIFIER.test(e))return new ut(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ie.getEsmExportName=yS;function _S(e){return new ut(e.toString())}ie.regexpCode=_S});var Zd=I(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.ValueScope=Be.ValueScopeName=Be.Scope=Be.varKinds=Be.UsedValueState=void 0;var He=qi(),Nd=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},La;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(La||(Be.UsedValueState=La={}));Be.varKinds={const:new He.Name("const"),let:new He.Name("let"),var:new He.Name("var")};var Va=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof He.Name?t:this.name(t)}name(t){return new He.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Be.Scope=Va;var Ja=class extends He.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,He._)`.${new He.Name(r)}[${n}]`}};Be.ValueScopeName=Ja;var $S=(0,He._)`\n`,Rd=class extends Va{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?$S:He.nil}}get(){return this._scope}name(t){return new Ja(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(t),{prefix:o}=i,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[o];if(s){let l=s.get(a);if(l)return l}else s=this._values[o]=new Map;s.set(a,i);let c=this._scope[o]||(this._scope[o]=[]),u=c.length;return c[u]=r.ref,i.setValue(r,{property:o,itemIndex:u}),i}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,He._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let o=He.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,La.Started);let l=r(u);if(l){let d=this.opts.es5?Be.varKinds.var:Be.varKinds.const;o=(0,He._)`${o}${d} ${u} = ${l};${this.opts._n}`}else if(l=i?.(u))o=(0,He._)`${o}${l}${this.opts._n}`;else throw new Nd(u);c.set(u,La.Completed)})}return o}};Be.ValueScope=Rd});var W=I(X=>{"use strict";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 te=qi(),vt=Zd(),rr=qi();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return rr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return rr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return rr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return rr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return rr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return rr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return rr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return rr.Name}});var Wa=Zd();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Wa.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Wa.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Wa.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Wa.varKinds}});X.operators={GT:new te._Code(">"),GTE:new te._Code(">="),LT:new te._Code("<"),LTE:new te._Code("<="),EQ:new te._Code("==="),NEQ:new te._Code("!=="),NOT:new te._Code("!"),OR:new te._Code("||"),AND:new te._Code("&&"),ADD:new te._Code("+")};var Ft=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Cd=class extends Ft{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?vt.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=dn(this.rhs,t,r)),this}get names(){return this.rhs instanceof te._CodeOrName?this.rhs.names:{}}},Ka=class extends Ft{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof te.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=dn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof te.Name?{}:{...this.lhs.names};return Ba(t,this.rhs)}},Ad=class extends Ka{constructor(t,r,n,i){super(t,n,i),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Ud=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Md=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Fd=class extends Ft{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},qd=class extends Ft{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=dn(this.code,t,r),this}get names(){return this.code instanceof te._CodeOrName?this.code.names:{}}},Li=class extends Ft{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,i=n.length;for(;i--;){let o=n[i];o.optimizeNames(t,r)||(bS(t,o.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>wr(t,r.names),{})}},qt=class extends Li{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Ld=class extends Li{},ln=class extends qt{};ln.kind="else";var xr=class e extends qt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new ln(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(sv(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=dn(this.condition,t,r),this}get names(){let t=super.names;return Ba(t,this.condition),this.else&&wr(t,this.else.names),t}};xr.kind="if";var kr=class extends qt{};kr.kind="for";var Vd=class extends kr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=dn(this.iteration,t,r),this}get names(){return wr(super.names,this.iteration.names)}},Jd=class extends kr{constructor(t,r,n,i){super(),this.varKind=t,this.name=r,this.from=n,this.to=i}render(t){let r=t.es5?vt.varKinds.var:this.varKind,{name:n,from:i,to:o}=this;return`for(${r} ${n}=${i}; ${n}<${o}; ${n}++)`+super.render(t)}get names(){let t=Ba(super.names,this.from);return Ba(t,this.to)}},Ha=class extends kr{constructor(t,r,n,i){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=dn(this.iterable,t,r),this}get names(){return wr(super.names,this.iterable.names)}},Vi=class extends qt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Vi.kind="func";var Ji=class extends Li{render(t){return"return "+super.render(t)}};Ji.kind="return";var Kd=class extends qt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,i;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(i=this.finally)===null||i===void 0||i.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&wr(t,this.catch.names),this.finally&&wr(t,this.finally.names),t}},Ki=class extends qt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Ki.kind="catch";var Hi=class extends qt{render(t){return"finally"+super.render(t)}};Hi.kind="finally";var Hd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
-
`:""},this._extScope=t,this._scope=new vt.Scope({parent:t}),this._nodes=[new Ld]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,i){let o=this._scope.toName(r);return n!==void 0&&i&&(this._constants[o.str]=n),this._leafNode(new Cd(t,o,n)),o}const(t,r,n){return this._def(vt.varKinds.const,t,r,n)}let(t,r,n){return this._def(vt.varKinds.let,t,r,n)}var(t,r,n){return this._def(vt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Ka(t,r,n))}add(t,r){return this._leafNode(new Ad(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==te.nil&&this._leafNode(new qd(t)),this}object(...t){let r=["{"];for(let[n,i]of t)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,te.addCodeArg)(r,i));return r.push("}"),new te._Code(r)}if(t,r,n){if(this._blockNode(new xr(t)),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(t){return this._elseNode(new xr(t))}else(){return this._elseNode(new ln)}endIf(){return this._endBlockNode(xr,ln)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Vd(t),r)}forRange(t,r,n,i,o=this.opts.es5?vt.varKinds.var:vt.varKinds.let){let a=this._scope.toName(t);return this._for(new Jd(o,a,r,n),()=>i(a))}forOf(t,r,n,i=vt.varKinds.const){let o=this._scope.toName(t);if(this.opts.es5){let a=r instanceof te.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,te._)`${a}.length`,s=>{this.var(o,(0,te._)`${a}[${s}]`),n(o)})}return this._for(new Ha("of",i,o,r),()=>n(o))}forIn(t,r,n,i=this.opts.es5?vt.varKinds.var:vt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,te._)`Object.keys(${r})`,n);let o=this._scope.toName(t);return this._for(new Ha("in",i,o,r),()=>n(o))}endFor(){return this._endBlockNode(kr)}label(t){return this._leafNode(new Ud(t))}break(t){return this._leafNode(new Md(t))}return(t){let r=new Ji;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ji)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new Kd;if(this._blockNode(i),this.code(t),r){let o=this.name("e");this._currNode=i.catch=new Ki(o),r(o)}return n&&(this._currNode=i.finally=new Hi,this.code(n)),this._endBlockNode(Ki,Hi)}throw(t){return this._leafNode(new Fd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){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||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=te.nil,n,i){return this._blockNode(new Vi(t,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(Vi)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof xr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};X.CodeGen=Hd;function wr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Ba(e,t){return t instanceof te._CodeOrName?wr(e,t.names):e}function dn(e,t,r){if(e instanceof te.Name)return n(e);if(!i(e))return e;return new te._Code(e._items.reduce((o,a)=>(a instanceof te.Name&&(a=n(a)),a instanceof te._Code?o.push(...a._items):o.push(a),o),[]));function n(o){let a=r[o.str];return a===void 0||t[o.str]!==1?o:(delete t[o.str],a)}function i(o){return o instanceof te._Code&&o._items.some(a=>a instanceof te.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function bS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function sv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,te._)`!${Bd(e)}`}X.not=sv;var xS=cv(X.operators.AND);function kS(...e){return e.reduce(xS)}X.and=kS;var wS=cv(X.operators.OR);function SS(...e){return e.reduce(wS)}X.or=SS;function cv(e){return(t,r)=>t===te.nil?r:r===te.nil?t:(0,te._)`${Bd(t)} ${e} ${Bd(r)}`}function Bd(e){return e instanceof te.Name?e:(0,te._)`(${e})`}});var re=I(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;var pe=W(),zS=qi();function IS(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=IS;function PS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(dv(e,t),!pv(t,e.self.RULES.all))}Q.alwaysValidSchema=PS;function dv(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let i=n.RULES.keywords;for(let o in t)i[o]||hv(e,`unknown keyword: "${o}"`)}Q.checkUnknownRules=dv;function pv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=pv;function jS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Q.schemaHasRulesButRef=jS;function TS({topSchemaRef:e,schemaPath:t},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${e}${t}${(0,pe.getProperty)(n)}`}Q.schemaRefOrVal=TS;function ES(e){return fv(decodeURIComponent(e))}Q.unescapeFragment=ES;function OS(e){return encodeURIComponent(Gd(e))}Q.escapeFragment=OS;function Gd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Gd;function fv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=fv;function DS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=DS;function uv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,o,a,s)=>{let c=a===void 0?o:a instanceof pe.Name?(o instanceof pe.Name?e(i,o,a):t(i,o,a),a):o instanceof pe.Name?(t(i,a,o),o):r(o,a);return s===pe.Name&&!(c instanceof pe.Name)?n(i,c):c}}Q.mergeEvaluated={props:uv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,pe._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,pe._)`${r} || {}`),Xd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:mv}),items:uv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,pe._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,pe._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function mv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,pe._)`{}`);return t!==void 0&&Xd(e,r,t),r}Q.evaluatedPropsToName=mv;function Xd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,pe._)`${t}${(0,pe.getProperty)(n)}`,!0))}Q.setEvaluated=Xd;var lv={};function NS(e,t){return e.scopeValue("func",{ref:t,code:lv[t.code]||(lv[t.code]=new zS._Code(t.code))})}Q.useFunc=NS;var Wd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Wd||(Q.Type=Wd={}));function RS(e,t,r){if(e instanceof pe.Name){let n=t===Wd.Num;return r?n?(0,pe._)`"[" + ${e} + "]"`:(0,pe._)`"['" + ${e} + "']"`:n?(0,pe._)`"/" + ${e}`:(0,pe._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(e).toString():"/"+Gd(e)}Q.getErrorPath=RS;function hv(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Q.checkStrictMode=hv});var Lt=I(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});var De=W(),ZS={data:new De.Name("data"),valCxt:new De.Name("valCxt"),instancePath:new De.Name("instancePath"),parentData:new De.Name("parentData"),parentDataProperty:new De.Name("parentDataProperty"),rootData:new De.Name("rootData"),dynamicAnchors:new De.Name("dynamicAnchors"),vErrors:new De.Name("vErrors"),errors:new De.Name("errors"),this:new De.Name("this"),self:new De.Name("self"),scope:new De.Name("scope"),json:new De.Name("json"),jsonPos:new De.Name("jsonPos"),jsonLen:new De.Name("jsonLen"),jsonPart:new De.Name("jsonPart")};Yd.default=ZS});var Bi=I(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.extendErrors=Ne.resetErrorsCount=Ne.reportExtraError=Ne.reportError=Ne.keyword$DataError=Ne.keywordError=void 0;var ne=W(),Ga=re(),Ve=Lt();Ne.keywordError={message:({keyword:e})=>(0,ne.str)`must pass "${e}" keyword validation`};Ne.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ne.str)`"${e}" keyword must be ${t} ($data)`:(0,ne.str)`"${e}" keyword is invalid ($data)`};function CS(e,t=Ne.keywordError,r,n){let{it:i}=e,{gen:o,compositeRule:a,allErrors:s}=i,c=yv(e,t,r);n??(a||s)?gv(o,c):vv(i,(0,ne._)`[${c}]`)}Ne.reportError=CS;function AS(e,t=Ne.keywordError,r){let{it:n}=e,{gen:i,compositeRule:o,allErrors:a}=n,s=yv(e,t,r);gv(i,s),o||a||vv(n,Ve.default.vErrors)}Ne.reportExtraError=AS;function US(e,t){e.assign(Ve.default.errors,t),e.if((0,ne._)`${Ve.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ne._)`${Ve.default.vErrors}.length`,t),()=>e.assign(Ve.default.vErrors,null)))}Ne.resetErrorsCount=US;function MS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:o}){if(i===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",i,Ve.default.errors,s=>{e.const(a,(0,ne._)`${Ve.default.vErrors}[${s}]`),e.if((0,ne._)`${a}.instancePath === undefined`,()=>e.assign((0,ne._)`${a}.instancePath`,(0,ne.strConcat)(Ve.default.instancePath,o.errorPath))),e.assign((0,ne._)`${a}.schemaPath`,(0,ne.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,ne._)`${a}.schema`,r),e.assign((0,ne._)`${a}.data`,n))})}Ne.extendErrors=MS;function gv(e,t){let r=e.const("err",t);e.if((0,ne._)`${Ve.default.vErrors} === null`,()=>e.assign(Ve.default.vErrors,(0,ne._)`[${r}]`),(0,ne._)`${Ve.default.vErrors}.push(${r})`),e.code((0,ne._)`${Ve.default.errors}++`)}function vv(e,t){let{gen:r,validateName:n,schemaEnv:i}=e;i.$async?r.throw((0,ne._)`new ${e.ValidationError}(${t})`):(r.assign((0,ne._)`${n}.errors`,t),r.return(!1))}var Sr={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function yv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ne._)`{}`:FS(e,t,r)}function FS(e,t,r={}){let{gen:n,it:i}=e,o=[qS(i,r),LS(e,r)];return VS(e,t,o),n.object(...o)}function qS({errorPath:e},{instancePath:t}){let r=t?(0,ne.str)`${e}${(0,Ga.getErrorPath)(t,Ga.Type.Str)}`:e;return[Ve.default.instancePath,(0,ne.strConcat)(Ve.default.instancePath,r)]}function LS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,ne.str)`${t}/${e}`;return r&&(i=(0,ne.str)`${i}${(0,Ga.getErrorPath)(r,Ga.Type.Str)}`),[Sr.schemaPath,i]}function VS(e,{params:t,message:r},n){let{keyword:i,data:o,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Sr.keyword,i],[Sr.params,typeof t=="function"?t(e):t||(0,ne._)`{}`]),c.messages&&n.push([Sr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Sr.schema,a],[Sr.parentSchema,(0,ne._)`${l}${d}`],[Ve.default.data,o]),u&&n.push([Sr.propertyName,u])}});var $v=I(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.boolOrEmptySchema=pn.topBoolOrEmptySchema=void 0;var JS=Bi(),KS=W(),HS=Lt(),BS={message:"boolean schema is false"};function WS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?_v(e,!1):typeof r=="object"&&r.$async===!0?t.return(HS.default.data):(t.assign((0,KS._)`${n}.errors`,null),t.return(!0))}pn.topBoolOrEmptySchema=WS;function GS(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),_v(e)):r.var(t,!0)}pn.boolOrEmptySchema=GS;function _v(e,t){let{gen:r,data:n}=e,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,JS.reportError)(i,BS,void 0,t)}});var Qd=I(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.getRules=fn.isJSONType=void 0;var XS=["string","number","integer","boolean","null","object","array"],YS=new Set(XS);function QS(e){return typeof e=="string"&&YS.has(e)}fn.isJSONType=QS;function e0(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}fn.getRules=e0});var ep=I(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function t0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&bv(e,n)}nr.schemaHasRulesForType=t0;function bv(e,t){return t.rules.some(r=>xv(e,r))}nr.shouldUseGroup=bv;function xv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}nr.shouldUseRule=xv});var Wi=I(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var r0=Qd(),n0=ep(),i0=Bi(),B=W(),kv=re(),mn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(mn||(Re.DataType=mn={}));function o0(e){let t=wv(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Re.getSchemaTypes=o0;function wv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(r0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Re.getJSONTypes=wv;function a0(e,t){let{gen:r,data:n,opts:i}=e,o=s0(t,i.coerceTypes),a=t.length>0&&!(o.length===0&&t.length===1&&(0,n0.schemaHasRulesForType)(e,t[0]));if(a){let s=rp(t,n,i.strictNumbers,mn.Wrong);r.if(s,()=>{o.length?c0(e,t,o):np(e)})}return a}Re.coerceAndCheckDataType=a0;var Sv=new Set(["string","number","integer","boolean","null"]);function s0(e,t){return t?e.filter(r=>Sv.has(r)||t==="array"&&r==="array"):[]}function c0(e,t,r){let{gen:n,data:i,opts:o}=e,a=n.let("dataType",(0,B._)`typeof ${i}`),s=n.let("coerced",(0,B._)`undefined`);o.coerceTypes==="array"&&n.if((0,B._)`${a} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,B._)`${i}[0]`).assign(a,(0,B._)`typeof ${i}`).if(rp(t,i,o.strictNumbers),()=>n.assign(s,i))),n.if((0,B._)`${s} !== undefined`);for(let u of r)(Sv.has(u)||u==="array"&&o.coerceTypes==="array")&&c(u);n.else(),np(e),n.endIf(),n.if((0,B._)`${s} !== undefined`,()=>{n.assign(i,s),u0(e,s)});function c(u){switch(u){case"string":n.elseIf((0,B._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,B._)`"" + ${i}`).elseIf((0,B._)`${i} === null`).assign(s,(0,B._)`""`);return;case"number":n.elseIf((0,B._)`${a} == "boolean" || ${i} === null
|
|
4
|
-
|| (${a} == "string" && ${
|
|
5
|
-
|| (${a} === "string" && ${
|
|
6
|
-
|| ${a} === "boolean" || ${i} === null`).assign(s,(0,B._)`[${i}]`)}}}function u0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,B._)`${t} !== undefined`,()=>e.assign((0,B._)`${t}[${r}]`,n))}function tp(e,t,r,n=mn.Correct){let i=n===mn.Correct?B.operators.EQ:B.operators.NEQ,o;switch(e){case"null":return(0,B._)`${t} ${i} null`;case"array":o=(0,B._)`Array.isArray(${t})`;break;case"object":o=(0,B._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":o=a((0,B._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":o=a();break;default:return(0,B._)`typeof ${t} ${i} ${e}`}return n===mn.Correct?o:(0,B.not)(o);function a(s=B.nil){return(0,B.and)((0,B._)`typeof ${t} == "number"`,s,r?(0,B._)`isFinite(${t})`:B.nil)}}Re.checkDataType=tp;function rp(e,t,r,n){if(e.length===1)return tp(e[0],t,r,n);let i,o=(0,kv.toHash)(e);if(o.array&&o.object){let a=(0,B._)`typeof ${t} != "object"`;i=o.null?a:(0,B._)`!${t} || ${a}`,delete o.null,delete o.array,delete o.object}else i=B.nil;o.number&&delete o.integer;for(let a in o)i=(0,B.and)(i,tp(a,t,r,n));return i}Re.checkDataTypes=rp;var l0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,B._)`{type: ${e}}`:(0,B._)`{type: ${t}}`};function np(e){let t=d0(e);(0,i0.reportError)(t,l0)}Re.reportTypeError=np;function d0(e){let{gen:t,data:r,schema:n}=e,i=(0,kv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}});var Iv=I(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.assignDefaults=void 0;var hn=W(),p0=re();function f0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let i in r)zv(e,i,r[i].default);else t==="array"&&Array.isArray(n)&&n.forEach((i,o)=>zv(e,o,i.default))}Xa.assignDefaults=f0;function zv(e,t,r){let{gen:n,compositeRule:i,data:o,opts:a}=e;if(r===void 0)return;let s=(0,hn._)`${o}${(0,hn.getProperty)(t)}`;if(i){(0,p0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,hn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,hn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,hn._)`${s} = ${(0,hn.stringify)(r)}`)}});var lt=I(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.validateUnion=ce.validateArray=ce.usePattern=ce.callValidateCode=ce.schemaProperties=ce.allSchemaProperties=ce.noPropertyInData=ce.propertyInData=ce.isOwnProperty=ce.hasPropFunc=ce.reportMissingProp=ce.checkMissingProp=ce.checkReportMissingProp=void 0;var ge=W(),ip=re(),ir=Lt(),m0=re();function h0(e,t){let{gen:r,data:n,it:i}=e;r.if(ap(r,n,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ge._)`${t}`},!0),e.error()})}ce.checkReportMissingProp=h0;function g0({gen:e,data:t,it:{opts:r}},n,i){return(0,ge.or)(...n.map(o=>(0,ge.and)(ap(e,t,o,r.ownProperties),(0,ge._)`${i} = ${o}`)))}ce.checkMissingProp=g0;function v0(e,t){e.setParams({missingProperty:t},!0),e.error()}ce.reportMissingProp=v0;function Pv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ge._)`Object.prototype.hasOwnProperty`})}ce.hasPropFunc=Pv;function op(e,t,r){return(0,ge._)`${Pv(e)}.call(${t}, ${r})`}ce.isOwnProperty=op;function y0(e,t,r,n){let i=(0,ge._)`${t}${(0,ge.getProperty)(r)} !== undefined`;return n?(0,ge._)`${i} && ${op(e,t,r)}`:i}ce.propertyInData=y0;function ap(e,t,r,n){let i=(0,ge._)`${t}${(0,ge.getProperty)(r)} === undefined`;return n?(0,ge.or)(i,(0,ge.not)(op(e,t,r))):i}ce.noPropertyInData=ap;function jv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ce.allSchemaProperties=jv;function _0(e,t){return jv(t).filter(r=>!(0,ip.alwaysValidSchema)(e,t[r]))}ce.schemaProperties=_0;function $0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:o},it:a},s,c,u){let l=u?(0,ge._)`${e}, ${t}, ${n}${i}`:t,d=[[ir.default.instancePath,(0,ge.strConcat)(ir.default.instancePath,o)],[ir.default.parentData,a.parentData],[ir.default.parentDataProperty,a.parentDataProperty],[ir.default.rootData,ir.default.rootData]];a.opts.dynamicRef&&d.push([ir.default.dynamicAnchors,ir.default.dynamicAnchors]);let p=(0,ge._)`${l}, ${r.object(...d)}`;return c!==ge.nil?(0,ge._)`${s}.call(${c}, ${p})`:(0,ge._)`${s}(${p})`}ce.callValidateCode=$0;var b0=(0,ge._)`new RegExp`;function x0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:i}=t.code,o=i(r,n);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,ge._)`${i.code==="new RegExp"?b0:(0,m0.useFunc)(e,i)}(${r}, ${n})`})}ce.usePattern=x0;function k0(e){let{gen:t,data:r,keyword:n,it:i}=e,o=t.name("valid");if(i.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(o,!0),a(()=>t.break()),o;function a(s){let c=t.const("len",(0,ge._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:ip.Type.Num},o),t.if((0,ge.not)(o),s)})}}ce.validateArray=k0;function w0(e){let{gen:t,schema:r,keyword:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ip.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ge._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ge.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ce.validateUnion=w0});var Ov=I(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateKeywordUsage=St.validSchemaType=St.funcKeywordCode=St.macroKeywordCode=void 0;var Je=W(),zr=Lt(),S0=lt(),z0=Bi();function I0(e,t){let{gen:r,keyword:n,schema:i,parentSchema:o,it:a}=e,s=t.macro.call(a.self,i,o,a),c=Ev(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Je.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}St.macroKeywordCode=I0;function P0(e,t){var r;let{gen:n,keyword:i,schema:o,parentSchema:a,$data:s,it:c}=e;T0(c,t);let u=!s&&t.compile?t.compile.call(c.self,o,a,c):t.validate,l=Ev(n,i,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)h(),t.modifying&&Tv(e),y(()=>e.error());else{let $=t.async?f():m();t.modifying&&Tv(e),y(()=>j0(e,$))}}function f(){let $=n.let("ruleErrs",null);return n.try(()=>h((0,Je._)`await `),_=>n.assign(d,!1).if((0,Je._)`${_} instanceof ${c.ValidationError}`,()=>n.assign($,(0,Je._)`${_}.errors`),()=>n.throw(_))),$}function m(){let $=(0,Je._)`${l}.errors`;return n.assign($,null),h(Je.nil),$}function h($=t.async?(0,Je._)`await `:Je.nil){let _=c.opts.passContext?zr.default.this:zr.default.self,b=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Je._)`${$}${(0,S0.callValidateCode)(e,l,_,b)}`,t.modifying)}function y($){var _;n.if((0,Je.not)((_=t.valid)!==null&&_!==void 0?_:d),$)}}St.funcKeywordCode=P0;function Tv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Je._)`${n.parentData}[${n.parentDataProperty}]`))}function j0(e,t){let{gen:r}=e;r.if((0,Je._)`Array.isArray(${t})`,()=>{r.assign(zr.default.vErrors,(0,Je._)`${zr.default.vErrors} === null ? ${t} : ${zr.default.vErrors}.concat(${t})`).assign(zr.default.errors,(0,Je._)`${zr.default.vErrors}.length`),(0,z0.extendErrors)(e)},()=>e.error())}function T0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Ev(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Je.stringify)(r)})}function E0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}St.validSchemaType=E0;function O0({schema:e,opts:t,self:r,errSchemaPath:n},i,o){if(Array.isArray(i.keyword)?!i.keyword.includes(o):i.keyword!==o)throw new Error("ajv implementation error");let a=i.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${o}: ${a.join(",")}`);if(i.validateSchema&&!i.validateSchema(e[o])){let c=`keyword "${o}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}St.validateKeywordUsage=O0});var Nv=I(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.extendSubschemaMode=or.extendSubschemaData=or.getSubschema=void 0;var zt=W(),Dv=re();function D0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:o,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}${(0,zt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Dv.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||o===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:a,errSchemaPath:o}}throw new Error('either "keyword" or "schema" must be passed')}or.getSubschema=D0;function N0(e,t,{dataProp:r,dataPropType:n,data:i,dataTypes:o,propertyName:a}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,p=s.let("data",(0,zt._)`${t.data}${(0,zt.getProperty)(r)}`,!0);c(p),e.errorPath=(0,zt.str)`${u}${(0,Dv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,zt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(i!==void 0){let u=i instanceof zt.Name?i:s.let("data",i,!0);c(u),a!==void 0&&(e.propertyName=a)}o&&(e.dataTypes=o);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}or.extendSubschemaData=N0;function R0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:o}){n!==void 0&&(e.compositeRule=n),i!==void 0&&(e.createErrors=i),o!==void 0&&(e.allErrors=o),e.jtdDiscriminator=t,e.jtdMetadata=r}or.extendSubschemaMode=R0});var sp=I((zA,Rv)=>{"use strict";Rv.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,i,o;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(o=Object.keys(t),n=o.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[i]))return!1;for(i=n;i--!==0;){var a=o[i];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var Cv=I((IA,Zv)=>{"use strict";var ar=Zv.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Ya(t,n,i,e,"",e)};ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ar.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ar.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 Ya(e,t,r,n,i,o,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,i,o,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ar.arrayKeywords)for(var p=0;p<d.length;p++)Ya(e,t,r,d[p],i+"/"+l+"/"+p,o,i,l,n,p)}else if(l in ar.propsKeywords){if(d&&typeof d=="object")for(var f in d)Ya(e,t,r,d[f],i+"/"+l+"/"+Z0(f),o,i,l,n,f)}else(l in ar.keywords||e.allKeys&&!(l in ar.skipKeywords))&&Ya(e,t,r,d,i+"/"+l,o,i,l,n)}r(n,i,o,a,s,c,u)}}function Z0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Gi=I(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.getSchemaRefs=We.resolveUrl=We.normalizeId=We._getFullPath=We.getFullPath=We.inlineRef=void 0;var C0=re(),A0=sp(),U0=Cv(),M0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function F0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!cp(e):t?Av(e)<=t:!1}We.inlineRef=F0;var q0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function cp(e){for(let t in e){if(q0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(cp)||typeof r=="object"&&cp(r))return!0}return!1}function Av(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!M0.has(r)&&(typeof e[r]=="object"&&(0,C0.eachItem)(e[r],n=>t+=Av(n)),t===1/0))return 1/0}return t}function Uv(e,t="",r){r!==!1&&(t=gn(t));let n=e.parse(t);return Mv(e,n)}We.getFullPath=Uv;function Mv(e,t){return e.serialize(t).split("#")[0]+"#"}We._getFullPath=Mv;var L0=/#\/?$/;function gn(e){return e?e.replace(L0,""):""}We.normalizeId=gn;function V0(e,t,r){return r=gn(r),e.resolve(t,r)}We.resolveUrl=V0;var J0=/^[a-z_][-a-z0-9._]*$/i;function K0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=gn(e[r]||t),o={"":i},a=Uv(n,i,!1),s={},c=new Set;return U0(e,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=a+p,y=o[m];typeof d[r]=="string"&&(y=$.call(this,d[r])),_.call(this,d.$anchor),_.call(this,d.$dynamicAnchor),o[p]=y;function $(b){let T=this.opts.uriResolver.resolve;if(b=gn(y?T(y,b):b),c.has(b))throw l(b);c.add(b);let E=this.refs[b];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?u(d,E.schema,b):b!==gn(h)&&(b[0]==="#"?(u(d,s[b],b),s[b]=d):this.refs[b]=h),b}function _(b){if(typeof b=="string"){if(!J0.test(b))throw new Error(`invalid anchor "${b}"`);$.call(this,`#${b}`)}}}),s;function u(d,p,f){if(p!==void 0&&!A0(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}We.getSchemaRefs=K0});var Qi=I(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.getData=sr.KeywordCxt=sr.validateFunctionCode=void 0;var Jv=$v(),Fv=Wi(),lp=ep(),Qa=Wi(),H0=Iv(),Yi=Ov(),up=Nv(),N=W(),L=Lt(),B0=Gi(),Vt=re(),Xi=Bi();function W0(e){if(Bv(e)&&(Wv(e),Hv(e))){Y0(e);return}Kv(e,()=>(0,Jv.topBoolOrEmptySchema)(e))}sr.validateFunctionCode=W0;function Kv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:i},o){i.code.es5?e.func(t,(0,N._)`${L.default.data}, ${L.default.valCxt}`,n.$async,()=>{e.code((0,N._)`"use strict"; ${qv(r,i)}`),X0(e,i),e.code(o)}):e.func(t,(0,N._)`${L.default.data}, ${G0(i)}`,n.$async,()=>e.code(qv(r,i)).code(o))}function G0(e){return(0,N._)`{${L.default.instancePath}="", ${L.default.parentData}, ${L.default.parentDataProperty}, ${L.default.rootData}=${L.default.data}${e.dynamicRef?(0,N._)`, ${L.default.dynamicAnchors}={}`:N.nil}}={}`}function X0(e,t){e.if(L.default.valCxt,()=>{e.var(L.default.instancePath,(0,N._)`${L.default.valCxt}.${L.default.instancePath}`),e.var(L.default.parentData,(0,N._)`${L.default.valCxt}.${L.default.parentData}`),e.var(L.default.parentDataProperty,(0,N._)`${L.default.valCxt}.${L.default.parentDataProperty}`),e.var(L.default.rootData,(0,N._)`${L.default.valCxt}.${L.default.rootData}`),t.dynamicRef&&e.var(L.default.dynamicAnchors,(0,N._)`${L.default.valCxt}.${L.default.dynamicAnchors}`)},()=>{e.var(L.default.instancePath,(0,N._)`""`),e.var(L.default.parentData,(0,N._)`undefined`),e.var(L.default.parentDataProperty,(0,N._)`undefined`),e.var(L.default.rootData,L.default.data),t.dynamicRef&&e.var(L.default.dynamicAnchors,(0,N._)`{}`)})}function Y0(e){let{schema:t,opts:r,gen:n}=e;Kv(e,()=>{r.$comment&&t.$comment&&Xv(e),nz(e),n.let(L.default.vErrors,null),n.let(L.default.errors,0),r.unevaluated&&Q0(e),Gv(e),az(e)})}function Q0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,N._)`${r}.evaluated`),t.if((0,N._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,N._)`${e.evaluated}.props`,(0,N._)`undefined`)),t.if((0,N._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,N._)`${e.evaluated}.items`,(0,N._)`undefined`))}function qv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,N._)`/*# sourceURL=${r} */`:N.nil}function ez(e,t){if(Bv(e)&&(Wv(e),Hv(e))){tz(e,t);return}(0,Jv.boolOrEmptySchema)(e,t)}function Hv({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Bv(e){return typeof e.schema!="boolean"}function tz(e,t){let{schema:r,gen:n,opts:i}=e;i.$comment&&r.$comment&&Xv(e),iz(e),oz(e);let o=n.const("_errs",L.default.errors);Gv(e,o),n.var(t,(0,N._)`${o} === ${L.default.errors}`)}function Wv(e){(0,Vt.checkUnknownRules)(e),rz(e)}function Gv(e,t){if(e.opts.jtd)return Lv(e,[],!1,t);let r=(0,Fv.getSchemaTypes)(e.schema),n=(0,Fv.coerceAndCheckDataType)(e,r);Lv(e,r,!n,t)}function rz(e){let{schema:t,errSchemaPath:r,opts:n,self:i}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Vt.schemaHasRulesButRef)(t,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function nz(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Vt.checkStrictMode)(e,"default is ignored in the schema root")}function iz(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,B0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function oz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Xv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:i}){let o=r.$comment;if(i.$comment===!0)e.code((0,N._)`${L.default.self}.logger.log(${o})`);else if(typeof i.$comment=="function"){let a=(0,N.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,N._)`${L.default.self}.opts.$comment(${o}, ${a}, ${s}.schema)`)}}function az(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:i,opts:o}=e;r.$async?t.if((0,N._)`${L.default.errors} === 0`,()=>t.return(L.default.data),()=>t.throw((0,N._)`new ${i}(${L.default.vErrors})`)):(t.assign((0,N._)`${n}.errors`,L.default.vErrors),o.unevaluated&&sz(e),t.return((0,N._)`${L.default.errors} === 0`))}function sz({gen:e,evaluated:t,props:r,items:n}){r instanceof N.Name&&e.assign((0,N._)`${t}.props`,r),n instanceof N.Name&&e.assign((0,N._)`${t}.items`,n)}function Lv(e,t,r,n){let{gen:i,schema:o,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(o.$ref&&(c.ignoreKeywordsWithRef||!(0,Vt.schemaHasRulesButRef)(o,l))){i.block(()=>Qv(e,"$ref",l.all.$ref.definition));return}c.jtd||cz(e,t),i.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,lp.shouldUseGroup)(o,p)&&(p.type?(i.if((0,Qa.checkDataType)(p.type,a,c.strictNumbers)),Vv(e,p),t.length===1&&t[0]===p.type&&r&&(i.else(),(0,Qa.reportTypeError)(e)),i.endIf()):Vv(e,p),s||i.if((0,N._)`${L.default.errors} === ${n||0}`))}}function Vv(e,t){let{gen:r,schema:n,opts:{useDefaults:i}}=e;i&&(0,H0.assignDefaults)(e,t.type),r.block(()=>{for(let o of t.rules)(0,lp.shouldUseRule)(n,o)&&Qv(e,o.keyword,o.definition,t.type)})}function cz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(uz(e,t),e.opts.allowUnionTypes||lz(e,t),dz(e,e.dataTypes))}function uz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Yv(e.dataTypes,r)||dp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),fz(e,t)}}function lz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&dp(e,"use allowUnionTypes to allow union type keyword")}function dz(e,t){let r=e.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,lp.shouldUseRule)(e.schema,i)){let{type:o}=i.definition;o.length&&!o.some(a=>pz(t,a))&&dp(e,`missing type "${o.join(",")}" for keyword "${n}"`)}}}function pz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Yv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function fz(e,t){let r=[];for(let n of e.dataTypes)Yv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function dp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Vt.checkStrictMode)(e,t,e.opts.strictTypes)}var es=class{constructor(t,r,n){if((0,Yi.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Vt.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",ey(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Yi.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=t.gen.const("_errs",L.default.errors))}result(t,r,n){this.failResult((0,N.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,N.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,N._)`${r} !== undefined && (${(0,N.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Xi.reportExtraError:Xi.reportError)(this,this.def.error,r)}$dataError(){(0,Xi.reportError)(this,this.def.$dataError||Xi.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Xi.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=N.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=N.nil,r=N.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:o,def:a}=this;n.if((0,N.or)((0,N._)`${i} === undefined`,r)),t!==N.nil&&n.assign(t,!0),(o.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==N.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:i,it:o}=this;return(0,N.or)(a(),s());function a(){if(n.length){if(!(r instanceof N.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,N._)`${(0,Qa.checkDataTypes)(c,r,o.opts.strictNumbers,Qa.DataType.Wrong)}`}return N.nil}function s(){if(i.validateSchema){let c=t.scopeValue("validate$data",{ref:i.validateSchema});return(0,N._)`!${c}(${r})`}return N.nil}}subschema(t,r){let n=(0,up.getSubschema)(this.it,t);(0,up.extendSubschemaData)(n,this.it,t),(0,up.extendSubschemaMode)(n,t);let i={...this.it,...n,items:void 0,props:void 0};return ez(i,r),i}mergeEvaluated(t,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Vt.mergeEvaluated.props(i,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Vt.mergeEvaluated.items(i,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(t,N.Name)),!0}};sr.KeywordCxt=es;function Qv(e,t,r,n){let i=new es(e,r,t);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Yi.funcKeywordCode)(i,r):"macro"in r?(0,Yi.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Yi.funcKeywordCode)(i,r)}var mz=/^\/(?:[^~]|~0|~1)*$/,hz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ey(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let i,o;if(e==="")return L.default.rootData;if(e[0]==="/"){if(!mz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);i=e,o=L.default.rootData}else{let u=hz.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(i=u[2],i==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(o=r[t-l],!i)return o}let a=o,s=i.split("/");for(let u of s)u&&(o=(0,N._)`${o}${(0,N.getProperty)((0,Vt.unescapeJsonPointer)(u))}`,a=(0,N._)`${a} && ${o}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}sr.getData=ey});var ts=I(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var pp=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};fp.default=pp});var eo=I(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var mp=Gi(),hp=class extends Error{constructor(t,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,mp.resolveUrl)(t,r,n),this.missingSchema=(0,mp.normalizeId)((0,mp.getFullPath)(t,this.missingRef))}};gp.default=hp});var ns=I(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.resolveSchema=dt.getCompilingSchema=dt.resolveRef=dt.compileSchema=dt.SchemaEnv=void 0;var yt=W(),gz=ts(),Ir=Lt(),_t=Gi(),ty=re(),vz=Qi(),vn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,_t.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};dt.SchemaEnv=vn;function yp(e){let t=ry.call(this,e);if(t)return t;let r=(0,_t.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:o}=this.opts,a=new yt.CodeGen(this.scope,{es5:n,lines:i,ownProperties:o}),s;e.$async&&(s=a.scopeValue("Error",{ref:gz.default,code:(0,yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,yt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:yt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,vz.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Ir.default.self}`,`${Ir.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:m,items:h}=u;f.evaluated={props:m instanceof yt.Name?void 0:m,items:h instanceof yt.Name?void 0:h,dynamicProps:m instanceof yt.Name,dynamicItems:h instanceof yt.Name},f.source&&(f.source.evaluated=(0,yt.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}dt.compileSchema=yp;function yz(e,t,r){var n;r=(0,_t.resolveUrl)(this.opts.uriResolver,t,r);let i=e.refs[r];if(i)return i;let o=bz.call(this,e,r);if(o===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(o=new vn({schema:a,schemaId:s,root:e,baseId:t}))}if(o!==void 0)return e.refs[r]=_z.call(this,o)}dt.resolveRef=yz;function _z(e){return(0,_t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:yp.call(this,e)}function ry(e){for(let t of this._compilations)if($z(t,e))return t}dt.getCompilingSchema=ry;function $z(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function bz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||rs.call(this,e,t)}function rs(e,t){let r=this.opts.uriResolver.parse(t),n=(0,_t._getFullPath)(this.opts.uriResolver,r),i=(0,_t.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===i)return vp.call(this,r,e);let o=(0,_t.normalizeId)(n),a=this.refs[o]||this.schemas[o];if(typeof a=="string"){let s=rs.call(this,e,a);return typeof s?.schema!="object"?void 0:vp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||yp.call(this,a),o===(0,_t.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(i=(0,_t.resolveUrl)(this.opts.uriResolver,i,u)),new vn({schema:s,schemaId:c,root:e,baseId:i})}return vp.call(this,r,a)}}dt.resolveSchema=rs;var xz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function vp(e,{baseId:t,schema:r,root:n}){var i;if(((i=e.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,ty.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!xz.has(s)&&u&&(t=(0,_t.resolveUrl)(this.opts.uriResolver,t,u))}let o;if(typeof r!="boolean"&&r.$ref&&!(0,ty.schemaHasRulesButRef)(r,this.RULES)){let s=(0,_t.resolveUrl)(this.opts.uriResolver,t,r.$ref);o=rs.call(this,n,s)}let{schemaId:a}=this.opts;if(o=o||new vn({schema:r,schemaId:a,root:n,baseId:t}),o.schema!==o.root.schema)return o}});var ny=I((DA,kz)=>{kz.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 Sp=I((NA,uy)=>{"use strict";var wz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),$p=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),Sz=RegExp.prototype.test.bind(/^\d*$/u),Pr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),bp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),oy=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),xp=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),zz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function Iz(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var Pz=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),jz=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Tz=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Ez=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),Oz=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),Dz=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function Nz(e){return Oz(e)||Dz(e)}function Rz(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Tz(e[t])){if(e[t]==="%"&&t+2<e.length&&Pr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function iy(e){let t=-1,r=0,n=-1,i=0;for(let s=0;s<e.length;s++)e[s]==="0"?(n===-1&&(n=s),i++,i>r&&(r=i,t=n)):(n=-1,i=0);if(r<2)return e.join(":");let o=e.slice(0,t).join(":"),a=e.slice(t+r).join(":");return o+"::"+a}function Zz(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let i=r.concat(n),o=0;for(let s=0;s<i.length;s++){let c=i[s];if(c==="")return;if(c.indexOf(".")!==-1){if(s!==i.length-1||t!==-1&&n.length===0||!$p(c))return;o+=2;continue}if(!Pz(c))return;i[s]=parseInt(c,16).toString(16),o++}if(t===-1)return o!==8?void 0:iy(i);if(o>=8)return;let a=i.slice(0,r.length);for(let s=o;s<8;s++)a.push("0");for(let s=r.length;s<i.length;s++)a.push(i[s]);return iy(a)}function _p(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&jz(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Cz(n,":")<2)return{host:e,isIPV6:!1,error:t};let i="",o=n.indexOf("%");if(o!==-1){let s=n.slice(o,o+3).toLowerCase()==="%25"?3:1;if(i=n.slice(o+s),!Rz(i))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,o)}let a=Zz(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(i?"%"+i:""),escapedHost:a+(i?"%25"+i:""),isIPV6:!0}}function Cz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Az(e){let t=e,r=[],n=-1,i=0;for(;i=t.length;){if(i===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(i===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){r.push("/");break}}else if(i===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var Uz={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Mz=/[@/?#:]/g,Fz=/[@/?#]/g;function ay(e,t){let r=t?Fz:Mz;return r.lastIndex=0,e.replace(r,n=>Uz[n])}function sy(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Pr(i)){let o=i.toUpperCase(),a=String.fromCharCode(parseInt(o,16));t&&bp(a)?r+=a:r+="%"+o,n+=2;continue}}r+=e[n]}return r}var Ze=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ze[t]="%"+e[t>>4]+e[t&15]}function kp(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function _e(e){return e<2048?Ze[192|e>>6]+Ze[128|e&63]:e<65536?Ze[224|e>>12]+Ze[128|e>>6&63]+Ze[128|e&63]:Ze[240|e>>18]+Ze[128|e>>12&63]+Ze[128|e>>6&63]+Ze[128|e&63]}function qz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Pr(i)){let o=i.toUpperCase(),a=String.fromCharCode(parseInt(o,16));a!=="."&&bp(a)?t+=a:t+="%"+o,r+=2;continue}}if(oy(n))t+=n;else{let i=e.charCodeAt(r);if(i<128)t+=kp(i)?n:Ze[i];else if(i<55296||i>57343)t+=_e(i);else if(i<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=_e(65536+(i-55296<<10)+(o-56320)),r++):t+=_e(65533)}else t+=_e(65533)}}return t}function Lz(e,t=!1){let r="",n=t&&e[0]!=="/";for(let i=0;i<e.length;i++){let o=e[i];if(o==="%"&&i+2<e.length){let a=e.slice(i+1,i+3);if(Pr(a)){r+="%"+a.toUpperCase(),i+=2;continue}}if(o==="/"&&(n=!1),oy(o)&&(o!==":"||!n))r+=o;else{let a=e.charCodeAt(i);if(a<128)r+=Ze[a];else if(a<55296||a>57343)r+=_e(a);else if(a<=56319&&i+1<e.length){let s=e.charCodeAt(i+1);s>=56320&&s<=57343?(r+=_e(65536+(a-55296<<10)+(s-56320)),i++):r+=_e(65533)}else r+=_e(65533)}}return r}function Vz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Pr(i)){let o=i.toUpperCase(),a=String.fromCharCode(parseInt(o,16));bp(a)?t+=a:t+="%"+o,r+=2;continue}}if(xp(n))t+=n;else{let i=e.charCodeAt(r);if(i<128)t+=kp(i)?n:Ze[i];else if(i<55296||i>57343)t+=_e(i);else if(i<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=_e(65536+(i-55296<<10)+(o-56320)),r++):t+=_e(65533)}else t+=_e(65533)}}return t}function wp(e,t){let r="";for(let n=0;n<e.length;n++){let i=e[n];if(i==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Pr(o)){r+="%"+o.toUpperCase(),n+=2;continue}}if(t(i))r+=i;else{let o=e.charCodeAt(n);if(o<128)r+=Ze[o];else if(o<55296||o>57343)r+=_e(o);else if(o<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=_e(65536+(o-55296<<10)+(a-56320)),n++):r+=_e(65533)}else r+=_e(65533)}}return r}function cy(e){return wp(e,zz)}function Jz(e){return wp(e,xp)}function Kz(e){return wp(e,xp)}function Hz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){t+="%"+o.toUpperCase(),r+=2;continue}}let i=e.charCodeAt(r);if(i<128)t+=kp(i)?n:Ze[i];else if(i<55296||i>57343)t+=_e(i);else if(i<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);o>=56320&&o<=57343?(t+=_e(65536+(i-55296<<10)+(o-56320)),r++):t+=_e(65533)}else t+=_e(65533)}return t}function Bz(e){let t=[];if(e.userinfo!==void 0&&(t.push(cy(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!$p(r)){let n=_p(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=sy(r,!0),n=_p(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=ay(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!Sz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}uy.exports={BYTE_HEX:Ze,percentEncodeNonAscii:_e,nonSimpleDomain:Ez,nonSimpleMailtoDomain:Nz,recomposeAuthority:Bz,reescapeHostDelimiters:ay,normalizePercentEncoding:sy,normalizePathEncoding:qz,serializePathEncoding:Lz,normalizeQueryFragmentEncoding:Vz,encodeUserinfo:cy,encodeQuery:Jz,encodeFragment:Kz,escapePreservingEscapes:Hz,removeDotSegments:Az,isIPv4:$p,isUUID:wz,normalizeIPv6:_p,stringArrayToHexStripped:Iz}});var _y=I((RA,yy)=>{"use strict";var{isUUID:Wz,BYTE_HEX:Gz,percentEncodeNonAscii:zp,nonSimpleMailtoDomain:Xz}=Sp(),Yz=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,Qz=["http","https","ws","wss","urn","urn:uuid","mailto"];function eI(e){return Qz.indexOf(e)!==-1}function Pp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function fy(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function my(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function tI(e){return e.secure=Pp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function rI(e){if((e.port===(Pp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function nI(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Yz);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let i=`${n}:${t.nid||e.nid}`,o=jp(i);e.path=void 0,o&&(e=o.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function iI(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),i=`${r}:${t.nid||n}`,o=jp(i);o&&(e=o.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function oI(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Wz(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function aI(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var hy={scheme:"http",domainHost:!0,parse:fy,serialize:my},sI={scheme:"https",domainHost:hy.domainHost,parse:fy,serialize:my},is={scheme:"ws",domainHost:!0,parse:tI,serialize:rI},cI={scheme:"wss",domainHost:is.domainHost,parse:is.parse,serialize:is.serialize},uI={scheme:"urn",parse:nI,serialize:iI,skipNormalize:!0},lI={scheme:"urn:uuid",parse:oI,serialize:aI,skipNormalize:!0},dI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=",pI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@",gy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function as(e,t=!1){let r=new Uint8Array(128);for(let o=0;o<e.length;o++)r[e.charCodeAt(o)]=1;let n=e.replace(/[\\\]^-]/gu,"\\$&"),i=t?`[${n}]|[^\\0-\\x7F\\uD800-\\uDFFF]`:`[${n}]`;return{all:new RegExp(`^(?:${i})*$`,"u"),table:r,allowNonAscii:t}}var fI=as(dI),ly=as(pI),mI=as(gy),hI=as(gy,!0),gI=/^[\da-f]{2}$/iu,vI=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,Ip="URI mailto has an invalid recipient domain.",dy=/[\uD800-\uDFFF]/u;function cr(e){if(typeof e!="string"||e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function py(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);if(i>=56320&&i<=57343){t+=e[r]+e[r+1],r++;continue}}t+=n>=55296&&n<=57343?"\uFFFD":e[r]}return t}function to(e,t){if(t.all.test(e))return e;let r=t.table,n="";for(let i=0;i<e.length;i++){let o=e.charCodeAt(i);if(o<128){r[o]===1?n+=e[i]:o===37&&i+2<e.length&&gI.test(e.slice(i+1,i+3))?(n+="%"+e.slice(i+1,i+3).toUpperCase(),i+=2):n+=Gz[o];continue}if(o<55296||o>57343){n+=t.allowNonAscii?e[i]:zp(o);continue}if(o<=56319&&i+1<e.length){let a=e.charCodeAt(i+1);if(a>=56320&&a<=57343){n+=t.allowNonAscii?e[i]+e[i+1]:zp(65536+(o-55296<<10)+(a-56320)),i++;continue}}n+=t.allowNonAscii?"\uFFFD":zp(65533)}return n}function vy(e,t,r){let n=String(e).toLowerCase();if(vI.test(n)||n!==""&&!Xz(n))return n;try{let i=new URL("http://"+n);if(i.username||i.password||i.port||i.pathname!=="/"||i.search||i.hash||!i.hostname)throw new Error(Ip);return t&&t.unicodeSupport?n:i.hostname}catch{return r&&(r.error=r.error||Ip),n}}function yI(e,t){let r=t&&t.unicodeSupport?hI:mI;return e.length>1&&e[0]==="["&&e[e.length-1]==="]"?"["+to(e.slice(1,-1),r)+"]":to(e,r)}function _I(e,t){let r=e,n=r.path,i=r.query;n&&dy.test(n)&&(n=py(n)),i&&dy.test(i)&&(i=py(i));let o=n?n.indexOf(",")===-1?[n]:n.split(","):[];if(r.path=void 0,i){let a=null,s=0;for(;s<=i.length;){let c=i.indexOf("&",s);c===-1&&(c=i.length);let u=i.slice(s,c);s=c+1;let l=u.indexOf("=");if(l!==u.lastIndexOf("=")){r.error=r.error||"URI mailto has malformed header fields.";continue}let d=l===-1?u:u.slice(0,l),p=l===-1?"":u.slice(l+1);if(d==="to"){let f=p.split(",");for(let m=0;m<f.length;m++)o.push(f[m]);continue}if(d==="subject"){r.subject=cr(p);continue}if(d==="body"){r.body=cr(p);continue}a===null&&(a=Object.create(null)),a[cr(d)]=cr(p)}a!==null&&(r.headers=a)}r.query=void 0;for(let a=0;a<o.length;a++){let s=o[a],c=s.lastIndexOf("@");if(c<0){r.error=r.error||Ip,o[a]=cr(s);continue}let u=cr(s.slice(0,c)),l=vy(cr(s.slice(c+1)),t,r);o[a]=u+"@"+l}return o.length&&(r.to=o),r}function $I(e,t){let r=e,n=Array.isArray(r.to)?r.to.slice():[];if(n.length){for(let s=0;s<n.length;s++){let c=String(n[s]),u=c.lastIndexOf("@"),l=u>=0?c.slice(0,u):c,d=u>=0?c.slice(u+1):"",p=to(l,fI),f=cr(d),m=vy(f,t);n[s]=p+"@"+yI(m,t)}r.path=n.join(","),t.skipEscape=!0}else r.path=void 0;let i=r.headers&&typeof r.headers=="object"?Object.assign(Object.create(null),r.headers):Object.create(null);r.subject&&(i.subject=r.subject),r.body&&(i.body=r.body),r.headers=i;let o="",a=0;for(let s in i)a++!==0&&(o+="&"),o+=to(s,ly)+"="+to(String(i[s]),ly);return a!==0?r.query=o:r.headers=void 0,r}var bI={scheme:"mailto",parse:_I,serialize:$I,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0},os={http:hy,https:sI,ws:is,wss:cI,urn:uI,"urn:uuid":lI,mailto:bI};Object.setPrototypeOf(os,null);function jp(e){return e&&(os[e]||os[e.toLowerCase()])||void 0}yy.exports={wsIsSecure:Pp,SCHEMES:os,isValidSchemeName:eI,getSchemeHandler:jp}});var Dy=I((ZA,us)=>{"use strict";var{normalizeIPv6:wy,removeDotSegments:no,recomposeAuthority:xI,normalizePercentEncoding:Sy,normalizePathEncoding:kI,serializePathEncoding:$y,normalizeQueryFragmentEncoding:by,encodeQuery:wI,encodeFragment:SI,reescapeHostDelimiters:zI,isIPv4:zy,nonSimpleDomain:II}=Sp(),{SCHEMES:Iy,getSchemeHandler:Tp}=_y(),Py=/^[A-Za-z][A-Za-z0-9+.-]*$/u,jy="URI scheme is malformed.";function xy(e){let t=unescape(String(e));if(!Py.test(t))throw new TypeError(jy);return t}function PI(e,t){return typeof e=="string"?e=ZI(e,t):typeof e=="object"&&(e=cs(jr(e,t),t)),e}function jI(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:i,malformedAuthorityOrPort:o,malformedPercentEncoding:a,malformedSchemeSpecific:s,malformedHost:c,malformedScheme:u}=ss(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:f,malformedHost:m,malformedScheme:h}=ss(t,n);if(o||d||a||p||s||f||c||m||u||h)throw new Error(i.error||l.error||"URI is malformed.");let y=Ty(i,l,n,!0),$=Tp(r&&r.scheme||y.scheme),_=y.host,b=_!==void 0&&_!==""&&(zy(_)||wy(_).isIPV6);Ey(y,r||{},$,b);let T=_&&_.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(_);if(y.error&&!T)throw new Error(y.error);return n.skipEscape=!0,jr(y,n)}function Ty(e,t,r,n){let i={};return n||(e=cs(jr(e,r),r),t=cs(jr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=no(t.path||""),i.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=no(t.path||""),i.query=t.query):(t.path?(t.path[0]==="/"?i.path=no(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?i.path="/"+t.path:e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path,i.path=no(i.path)),i.query=t.query):(i.path=e.path,t.query!==void 0?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function TI(e,t,r){let n=ky(e,r),i=ky(t,r);return n!==void 0&&i!==void 0&&n===i}function jr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,to:e.to,subject:e.subject,body:e.body,headers:e.headers,error:""},n=Object.assign({},t),i=[];r.scheme&&(r.scheme=xy(r.scheme));let o=Tp(n.scheme||r.scheme);o&&o.serialize&&o.serialize(r,n);let a=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,s=!n.skipEscape&&r.scheme===void 0&&!a;r.path!==void 0&&(n.skipEscape?r.path=Sy(r.path):r.path=$y(r.path,s)),n.reference!=="suffix"&&r.scheme&&(r.scheme=xy(r.scheme),i.push(r.scheme,":"));let c=xI(r);if(c!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(c),r.path&&r.path[0]!=="/"&&i.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!o||!o.absolutePath)&&(u=no(u)),s&&(u=$y(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),i.push(u)}return r.query!==void 0&&i.push("?",wI(r.query)),r.fragment!==void 0&&i.push("#",SI(r.fragment)),i.join("")}var EI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,OI=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,DI=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function NI(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function ro(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Ep(e){return e[0]==="["&&e[e.length-1]==="]"}function RI(e){let t=e[4];return ro(e[3])||t!==void 0&&!Ep(t)&&ro(t)||ro(e[6])||ro(e[7])||ro(e[8])}function Ey(e,t,r,n){let i=e.host&&e.host[0]==="["&&e.host[e.host.length-1]==="]";if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Ep(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&!i&&II(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(o){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+o,!0}return!1}function ss(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1,o=!1,a=!1,s=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(OI);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",i=!0);let p=e.match(DI);if(p!==null){let m=p[1],h=m.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",i=!0):m.length!==h.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",i=!0))}let f=e.match(EI);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0){let y=unescape(n.scheme);Py.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||jy,u=!0)}o=RI(f),o&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let m=NI(n,f);if(m!==void 0&&(n.error=n.error||m,i=!0),n.host)if(zy(n.host)===!1){let $=Ep(n.host),_=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,b=wy(n.host);l=b.isIPV6||b.isIPVFuture===!0,c=_&&(!$||b.error===!0),n.host=l?b.host:b.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",i=!0)}else l=!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 h=Tp(r.scheme||n.scheme);if(c||(s=Ey(n,r,h,l)),!h||h&&!h.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:Sy(n.host,!0);n.host=zI(y,l)}n.path&&(n.path=kI(n.path)),n.query&&(n.query=by(n.query)),n.fragment&&(n.fragment=by(n.fragment))}h&&h.parse&&(h.parse(n,r),h===Iy.urn&&n.nid===void 0&&(a=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:u}}function cs(e,t){return ss(e,t).parsed}function ZI(e,t){return Oy(e,t).normalized}function Oy(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:s}=ss(e,t);return{normalized:n||i||o||a||s?e:jr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:i,malformedSchemeSpecific:o,malformedHost:a,malformedScheme:s}}function ky(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:jr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:i,malformedPercentEncoding:o,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=Oy(r,t);return i||o||a||s||c?void 0:n}var Op={SCHEMES:Iy,normalize:PI,resolve:jI,resolveComponent:Ty,equal:TI,serialize:jr,parse:cs};us.exports=Op;us.exports.default=Op;us.exports.fastUri=Op});var Ry=I(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var Ny=Dy();Ny.code='require("ajv/dist/runtime/uri").default';Dp.default=Ny});var Ly=I(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.CodeGen=Ie.Name=Ie.nil=Ie.stringify=Ie.str=Ie._=Ie.KeywordCxt=void 0;var CI=Qi();Object.defineProperty(Ie,"KeywordCxt",{enumerable:!0,get:function(){return CI.KeywordCxt}});var yn=W();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return yn._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return yn.str}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return yn.stringify}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return yn.nil}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return yn.Name}});Object.defineProperty(Ie,"CodeGen",{enumerable:!0,get:function(){return yn.CodeGen}});var AI=ts(),My=eo(),UI=Qd(),io=ns(),MI=W(),oo=Gi(),ls=Wi(),Rp=re(),Zy=ny(),FI=Ry(),Fy=(e,t)=>new RegExp(e,t);Fy.code="new RegExp";var qI=["removeAdditional","useDefaults","coerceTypes"],LI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),VI={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."},JI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Cy=200;function KI(e){var t,r,n,i,o,a,s,c,u,l,d,p,f,m,h,y,$,_,b,T,E,nt,Ae,jn,Os;let Tn=e.strict,Ds=(t=e.code)===null||t===void 0?void 0:t.optimize,Af=Ds===!0||Ds===void 0?1:Ds||0,Uf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Fy,k$=(i=e.uriResolver)!==null&&i!==void 0?i:FI.default;return{strictSchema:(a=(o=e.strictSchema)!==null&&o!==void 0?o:Tn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Tn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Tn)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:Tn)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=e.strictRequired)!==null&&f!==void 0?f:Tn)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:Af,regExp:Uf}:{optimize:Af,regExp:Uf},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:Cy,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:Cy,meta:($=e.meta)!==null&&$!==void 0?$:!0,messages:(_=e.messages)!==null&&_!==void 0?_:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(T=e.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(nt=e.validateSchema)!==null&&nt!==void 0?nt:!0,validateFormats:(Ae=e.validateFormats)!==null&&Ae!==void 0?Ae:!0,unicodeRegExp:(jn=e.unicodeRegExp)!==null&&jn!==void 0?jn:!0,int32range:(Os=e.int32range)!==null&&Os!==void 0?Os:!0,uriResolver:k$}}var ao=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...KI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new MI.ValueScope({scope:{},prefixes:LI,es5:r,lines:n}),this.logger=YI(t.logger);let i=t.validateFormats;t.validateFormats=!1,this.RULES=(0,UI.getRules)(),Ay.call(this,VI,t,"NOT SUPPORTED"),Ay.call(this,JI,t,"DEPRECATED","warn"),this._metaOpts=GI.call(this),t.formats&&BI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&WI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),HI.call(this),t.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,i=Zy;n==="id"&&(i={...Zy},i.id=i.$id,delete i.$id),r&&t&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,t,r);async function i(l,d){await o.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function o(l){l&&!this.getSchema(l)&&await i.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof My.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await o.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,i=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,i);return this}let o;if(typeof t=="object"){let{schemaId:a}=this.opts;if(o=t[a],o!==void 0&&typeof o!="string")throw new Error(`schema ${a} must be string`)}return r=(0,oo.normalizeId)(r||o),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,i,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$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 i=this.validate(n,t);if(!i&&r){let o="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(o);else throw new Error(o)}return i}getSchema(t){let r;for(;typeof(r=Uy.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,i=new io.SchemaEnv({schema:{},schemaId:n});if(r=io.resolveSchema.call(this,i,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Uy.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,oo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,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(eP.call(this,n,r),!r)return(0,Rp.eachItem)(n,o=>Np.call(this,o)),this;rP.call(this,r);let i={...r,type:(0,ls.getJSONTypes)(r.type),schemaType:(0,ls.getJSONTypes)(r.schemaType)};return(0,Rp.eachItem)(n,i.type.length===0?o=>Np.call(this,o,i):o=>i.type.forEach(a=>Np.call(this,o,i,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let i=n.rules.findIndex(o=>o.keyword===t);i>=0&&n.rules.splice(i,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,o)=>i+r+o)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let i of r){let o=i.split("/").slice(1),a=t;for(let s of o)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=qy(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let i=t[n];(!r||r.test(n))&&(typeof i=="string"?delete t[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete t[n]))}}_addSchema(t,r,n,i=this.opts.validateSchema,o=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,oo.normalizeId)(a||n);let u=oo.getSchemaRefs.call(this,t,n);return c=new io.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),o&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):io.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{io.compileSchema.call(this,t)}finally{this.opts=r}}};ao.ValidationError=AI.default;ao.MissingRefError=My.default;Ie.default=ao;function Ay(e,t,r,n="error"){for(let i in e){let o=i;o in t&&this.logger[n](`${r}: option ${i}. ${e[o]}`)}}function Uy(e){return e=(0,oo.normalizeId)(e),this.schemas[e]||this.refs[e]}function HI(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function BI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function WI(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function GI(){let e={...this.opts};for(let t of qI)delete e[t];return e}var XI={log(){},warn(){},error(){}};function YI(e){if(e===!1)return XI;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var QI=/^[a-z_$][a-z0-9_$:-]*$/i;function eP(e,t){let{RULES:r}=this;if((0,Rp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!QI.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Np(e,t,r){var n;let i=t?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:o}=this,a=i?o.post:o.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},o.rules.push(a)),o.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,ls.getJSONTypes)(t.type),schemaType:(0,ls.getJSONTypes)(t.schemaType)}};t.before?tP.call(this,a,s,t.before):a.rules.push(s),o.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function tP(e,t,r){let n=e.rules.findIndex(i=>i.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function rP(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=qy(t)),e.validateSchema=this.compile(t,!0))}var nP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function qy(e){return{anyOf:[e,nP]}}});var Vy=I(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var iP={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Zp.default=iP});var By=I(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.callRef=Tr.getValidate=void 0;var oP=eo(),Jy=lt(),Ge=W(),_n=Lt(),Ky=ns(),ds=re(),aP={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:i,schemaEnv:o,validateName:a,opts:s,self:c}=n,{root:u}=o;if((r==="#"||r==="#/")&&i===u.baseId)return d();let l=Ky.resolveRef.call(c,u,i,r);if(l===void 0)throw new oP.default(n.opts.uriResolver,i,r);if(l instanceof Ky.SchemaEnv)return p(l);return f(l);function d(){if(o===u)return ps(e,a,o,o.$async);let m=t.scopeValue("root",{ref:u});return ps(e,(0,Ge._)`${m}.validate`,u,u.$async)}function p(m){let h=Hy(e,m);ps(e,h,m,m.$async)}function f(m){let h=t.scopeValue("schema",s.code.source===!0?{ref:m,code:(0,Ge.stringify)(m)}:{ref:m}),y=t.name("valid"),$=e.subschema({schema:m,dataTypes:[],schemaPath:Ge.nil,topSchemaRef:h,errSchemaPath:r},y);e.mergeEvaluated($),e.ok(y)}}};function Hy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ge._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Tr.getValidate=Hy;function ps(e,t,r,n){let{gen:i,it:o}=e,{allErrors:a,schemaEnv:s,opts:c}=o,u=c.passContext?_n.default.this:Ge.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,Ge._)`await ${(0,Jy.callValidateCode)(e,t,u)}`),f(t),a||i.assign(m,!0)},h=>{i.if((0,Ge._)`!(${h} instanceof ${o.ValidationError})`,()=>i.throw(h)),p(h),a||i.assign(m,!1)}),e.ok(m)}function d(){e.result((0,Jy.callValidateCode)(e,t,u),()=>f(t),()=>p(t))}function p(m){let h=(0,Ge._)`${m}.errors`;i.assign(_n.default.vErrors,(0,Ge._)`${_n.default.vErrors} === null ? ${h} : ${_n.default.vErrors}.concat(${h})`),i.assign(_n.default.errors,(0,Ge._)`${_n.default.vErrors}.length`)}function f(m){var h;if(!o.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(o.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(o.props=ds.mergeEvaluated.props(i,y.props,o.props));else{let $=i.var("props",(0,Ge._)`${m}.evaluated.props`);o.props=ds.mergeEvaluated.props(i,$,o.props,Ge.Name)}if(o.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(o.items=ds.mergeEvaluated.items(i,y.items,o.items));else{let $=i.var("items",(0,Ge._)`${m}.evaluated.items`);o.items=ds.mergeEvaluated.items(i,$,o.items,Ge.Name)}}}Tr.callRef=ps;Tr.default=aP});var Wy=I(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var sP=Vy(),cP=By(),uP=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",sP.default,cP.default];Cp.default=uP});var Gy=I(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var fs=W(),ur=fs.operators,ms={maximum:{okStr:"<=",ok:ur.LTE,fail:ur.GT},minimum:{okStr:">=",ok:ur.GTE,fail:ur.LT},exclusiveMaximum:{okStr:"<",ok:ur.LT,fail:ur.GTE},exclusiveMinimum:{okStr:">",ok:ur.GT,fail:ur.LTE}},lP={message:({keyword:e,schemaCode:t})=>(0,fs.str)`must be ${ms[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,fs._)`{comparison: ${ms[e].okStr}, limit: ${t}}`},dP={keyword:Object.keys(ms),type:"number",schemaType:"number",$data:!0,error:lP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,fs._)`${r} ${ms[t].fail} ${n} || isNaN(${r})`)}};Ap.default=dP});var Xy=I(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var so=W(),pP={message:({schemaCode:e})=>(0,so.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,so._)`{multipleOf: ${e}}`},fP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:pP,code(e){let{gen:t,data:r,schemaCode:n,it:i}=e,o=i.opts.multipleOfPrecision,a=t.let("res"),s=o?(0,so._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${o}`:(0,so._)`${a} !== parseInt(${a})`;e.fail$data((0,so._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Up.default=fP});var Qy=I(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});function Yy(e){let t=e.length,r=0,n=0,i;for(;n<t;)r++,i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<t&&(i=e.charCodeAt(n),(i&64512)===56320&&n++);return r}Mp.default=Yy;Yy.code='require("ajv/dist/runtime/ucs2length").default'});var e_=I(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var Er=W(),mP=re(),hP=Qy(),gP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Er.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Er._)`{limit: ${e}}`},vP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:gP,code(e){let{keyword:t,data:r,schemaCode:n,it:i}=e,o=t==="maxLength"?Er.operators.GT:Er.operators.LT,a=i.opts.unicode===!1?(0,Er._)`${r}.length`:(0,Er._)`${(0,mP.useFunc)(e.gen,hP.default)}(${r})`;e.fail$data((0,Er._)`${a} ${o} ${n}`)}};Fp.default=vP});var t_=I(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var yP=lt(),_P=re(),$n=W(),$P={message:({schemaCode:e})=>(0,$n.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,$n._)`{pattern: ${e}}`},bP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:$P,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:o,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,$n._)`new RegExp`:(0,_P.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,$n._)`${u}(${o}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,$n._)`!${l}`)}else{let c=(0,yP.usePattern)(e,i);e.fail$data((0,$n._)`!${c}.test(${r})`)}}};qp.default=bP});var r_=I(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var co=W(),xP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,co.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,co._)`{limit: ${e}}`},kP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:xP,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxProperties"?co.operators.GT:co.operators.LT;e.fail$data((0,co._)`Object.keys(${r}).length ${i} ${n}`)}};Lp.default=kP});var n_=I(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var uo=lt(),lo=W(),wP=re(),SP={message:({params:{missingProperty:e}})=>(0,lo.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,lo._)`{missingProperty: ${e}}`},zP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:SP,code(e){let{gen:t,schema:r,schemaCode:n,data:i,$data:o,it:a}=e,{opts:s}=a;if(!o&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let y=a.schemaEnv.baseId+a.errSchemaPath,$=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,wP.checkStrictMode)(a,$,a.opts.strictRequired)}}function u(){if(c||o)e.block$data(lo.nil,d);else for(let f of r)(0,uo.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||o){let m=t.let("valid",!0);e.block$data(m,()=>p(f,m)),e.ok(m)}else t.if((0,uo.checkMissingProp)(e,r,f)),(0,uo.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,uo.noPropertyInData)(t,i,f,s.ownProperties),()=>e.error())})}function p(f,m){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(m,(0,uo.propertyInData)(t,i,f,s.ownProperties)),t.if((0,lo.not)(m),()=>{e.error(),t.break()})},lo.nil)}}};Vp.default=zP});var i_=I(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var po=W(),IP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,po.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,po._)`{limit: ${e}}`},PP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:IP,code(e){let{keyword:t,data:r,schemaCode:n}=e,i=t==="maxItems"?po.operators.GT:po.operators.LT;e.fail$data((0,po._)`${r}.length ${i} ${n}`)}};Jp.default=PP});var hs=I(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var o_=sp();o_.code='require("ajv/dist/runtime/equal").default';Kp.default=o_});var a_=I(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var Hp=Wi(),Pe=W(),jP=re(),TP=hs(),EP={message:({params:{i:e,j:t}})=>(0,Pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Pe._)`{i: ${e}, j: ${t}}`},OP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:EP,code(e){let{gen:t,data:r,$data:n,schema:i,parentSchema:o,schemaCode:a,it:s}=e;if(!n&&!i)return;let c=t.let("valid"),u=o.items?(0,Hp.getSchemaTypes)(o.items):[];e.block$data(c,l,(0,Pe._)`${a} === false`),e.ok(c);function l(){let m=t.let("i",(0,Pe._)`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,Pe._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,h){let y=t.name("item"),$=(0,Hp.checkDataTypes)(u,y,s.opts.strictNumbers,Hp.DataType.Wrong),_=t.const("indices",(0,Pe._)`{}`);t.for((0,Pe._)`;${m}--;`,()=>{t.let(y,(0,Pe._)`${r}[${m}]`),t.if($,(0,Pe._)`continue`),u.length>1&&t.if((0,Pe._)`typeof ${y} == "string"`,(0,Pe._)`${y} += "_"`),t.if((0,Pe._)`typeof ${_}[${y}] == "number"`,()=>{t.assign(h,(0,Pe._)`${_}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,Pe._)`${_}[${y}] = ${m}`)})}function f(m,h){let y=(0,jP.useFunc)(t,TP.default),$=t.name("outer");t.label($).for((0,Pe._)`;${m}--;`,()=>t.for((0,Pe._)`${h} = ${m}; ${h}--;`,()=>t.if((0,Pe._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break($)})))}}};Bp.default=OP});var s_=I(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var Wp=W(),DP=re(),NP=hs(),RP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Wp._)`{allowedValue: ${e}}`},ZP={keyword:"const",$data:!0,error:RP,code(e){let{gen:t,data:r,$data:n,schemaCode:i,schema:o}=e;n||o&&typeof o=="object"?e.fail$data((0,Wp._)`!${(0,DP.useFunc)(t,NP.default)}(${r}, ${i})`):e.fail((0,Wp._)`${o} !== ${r}`)}};Gp.default=ZP});var c_=I(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var fo=W(),CP=re(),AP=hs(),UP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,fo._)`{allowedValues: ${e}}`},MP={keyword:"enum",schemaType:"array",$data:!0,error:UP,code(e){let{gen:t,data:r,$data:n,schema:i,schemaCode:o,it:a}=e;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let s=i.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,CP.useFunc)(t,AP.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let f=t.const("vSchema",o);l=(0,fo.or)(...i.map((m,h)=>p(f,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",o,f=>t.if((0,fo._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,m){let h=i[m];return typeof h=="object"&&h!==null?(0,fo._)`${u()}(${r}, ${f}[${m}])`:(0,fo._)`${r} === ${h}`}}};Xp.default=MP});var u_=I(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var FP=Gy(),qP=Xy(),LP=e_(),VP=t_(),JP=r_(),KP=n_(),HP=i_(),BP=a_(),WP=s_(),GP=c_(),XP=[FP.default,qP.default,LP.default,VP.default,JP.default,KP.default,HP.default,BP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},WP.default,GP.default];Yp.default=XP});var ef=I(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.validateAdditionalItems=void 0;var Or=W(),Qp=re(),YP={message:({params:{len:e}})=>(0,Or.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Or._)`{limit: ${e}}`},QP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:YP,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Qp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}l_(e,n)}};function l_(e,t){let{gen:r,schema:n,data:i,keyword:o,it:a}=e;a.items=!0;let s=r.const("len",(0,Or._)`${i}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Or._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Qp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Or._)`${s} <= ${t.length}`);r.if((0,Or.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:o,dataProp:l,dataPropType:Qp.Type.Num},u),a.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}mo.validateAdditionalItems=l_;mo.default=QP});var tf=I(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.validateTuple=void 0;var d_=W(),gs=re(),ej=lt(),tj={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return p_(e,"additionalItems",t);r.items=!0,!(0,gs.alwaysValidSchema)(r,t)&&e.ok((0,ej.validateArray)(e))}};function p_(e,t,r=e.schema){let{gen:n,parentSchema:i,data:o,keyword:a,it:s}=e;l(i),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=gs.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,d_._)`${o}.length`);r.forEach((d,p)=>{(0,gs.alwaysValidSchema)(s,d)||(n.if((0,d_._)`${u} > ${p}`,()=>e.subschema({keyword:a,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=s,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(p.strictTuples&&!h){let y=`"${a}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,gs.checkStrictMode)(s,y,p.strictTuples)}}}ho.validateTuple=p_;ho.default=tj});var f_=I(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var rj=tf(),nj={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,rj.validateTuple)(e,"items")};rf.default=nj});var h_=I(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var m_=W(),ij=re(),oj=lt(),aj=ef(),sj={message:({params:{len:e}})=>(0,m_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,m_._)`{limit: ${e}}`},cj={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:sj,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:i}=r;n.items=!0,!(0,ij.alwaysValidSchema)(n,t)&&(i?(0,aj.validateAdditionalItems)(e,i):e.ok((0,oj.validateArray)(e)))}};nf.default=cj});var g_=I(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var pt=W(),vs=re(),uj={message:({params:{min:e,max:t}})=>t===void 0?(0,pt.str)`must contain at least ${e} valid item(s)`:(0,pt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,pt._)`{minContains: ${e}}`:(0,pt._)`{minContains: ${e}, maxContains: ${t}}`},lj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:uj,code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:o}=e,a,s,{minContains:c,maxContains:u}=n;o.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,pt._)`${i}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,vs.checkStrictMode)(o,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,vs.checkStrictMode)(o,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,vs.alwaysValidSchema)(o,r)){let h=(0,pt._)`${l} >= ${a}`;s!==void 0&&(h=(0,pt._)`${h} && ${l} <= ${s}`),e.pass(h);return}o.items=!0;let d=t.name("valid");s===void 0&&a===1?f(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,pt._)`${i}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let h=t.name("_valid"),y=t.let("count",0);f(h,()=>t.if(h,()=>m(y)))}function f(h,y){t.forRange("i",0,l,$=>{e.subschema({keyword:"contains",dataProp:$,dataPropType:vs.Type.Num,compositeRule:!0},h),y()})}function m(h){t.code((0,pt._)`${h}++`),s===void 0?t.if((0,pt._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,pt._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,pt._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};of.default=lj});var __=I(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateSchemaDeps=It.validatePropertyDeps=It.error=void 0;var af=W(),dj=re(),go=lt();It.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,af.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,af._)`{property: ${e},
|
|
2
|
+
"use strict";var S$=Object.create;var Ns=Object.defineProperty;var z$=Object.getOwnPropertyDescriptor;var I$=Object.getOwnPropertyNames;var P$=Object.getPrototypeOf,j$=Object.prototype.hasOwnProperty;var I=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},En=(e,t)=>{for(var r in t)Ns(e,r,{get:t[r],enumerable:!0})},T$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of I$(t))!j$.call(e,o)&&o!==r&&Ns(e,o,{get:()=>t[o],enumerable:!(n=z$(t,o))||n.enumerable});return e};var ft=(e,t,r)=>(r=e!=null?S$(P$(e)):{},T$(t||!e||!e.__esModule?Ns(r,"default",{value:e,enumerable:!0}):r,e));var Lo=I(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.regexpCode=oe.getEsmExportName=oe.getProperty=oe.safeStringify=oe.stringify=oe.strConcat=oe.addCodeArg=oe.str=oe._=oe.nil=oe._Code=oe.Name=oe.IDENTIFIER=oe._CodeOrName=void 0;var Fo=class{};oe._CodeOrName=Fo;oe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var br=class extends Fo{constructor(t){if(super(),!oe.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};oe.Name=br;var ut=class extends Fo{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof br&&(r[n.str]=(r[n.str]||0)+1),r),{})}};oe._Code=ut;oe.nil=new ut("");function iv(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Dd(r,t[n]),r.push(e[++n]);return new ut(r)}oe._=iv;var Od=new ut("+");function av(e,...t){let r=[qo(e[0])],n=0;for(;n<t.length;)r.push(Od),Dd(r,t[n]),r.push(Od,qo(e[++n]));return fS(r),new ut(r)}oe.str=av;function Dd(e,t){t instanceof ut?e.push(...t._items):t instanceof br?e.push(t):e.push(gS(t))}oe.addCodeArg=Dd;function fS(e){let t=1;for(;t<e.length-1;){if(e[t]===Od){let r=mS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function mS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof br||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof br))return`"${e}${t.slice(1)}`}function hS(e,t){return t.emptyStr()?e:e.emptyStr()?t:av`${e}${t}`}oe.strConcat=hS;function gS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:qo(Array.isArray(e)?e.join(","):e)}function vS(e){return new ut(qo(e))}oe.stringify=vS;function qo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}oe.safeStringify=qo;function yS(e){return typeof e=="string"&&oe.IDENTIFIER.test(e)?new ut(`.${e}`):iv`[${e}]`}oe.getProperty=yS;function _S(e){if(typeof e=="string"&&oe.IDENTIFIER.test(e))return new ut(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}oe.getEsmExportName=_S;function $S(e){return new ut(e.toString())}oe.regexpCode=$S});var Cd=I(Be=>{"use strict";Object.defineProperty(Be,"__esModule",{value:!0});Be.ValueScope=Be.ValueScopeName=Be.Scope=Be.varKinds=Be.UsedValueState=void 0;var Ke=Lo(),Nd=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},La;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(La||(Be.UsedValueState=La={}));Be.varKinds={const:new Ke.Name("const"),let:new Ke.Name("let"),var:new Ke.Name("var")};var Va=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Ke.Name?t:this.name(t)}name(t){return new Ke.Name(this._newName(t))}_newName(t){let r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(t)||this._prefixes&&!this._prefixes.has(t))throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`);return this._names[t]={prefix:t,index:0}}};Be.Scope=Va;var Ja=class extends Ke.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Ke._)`.${new Ke.Name(r)}[${n}]`}};Be.ValueScopeName=Ja;var bS=(0,Ke._)`\n`,Rd=class extends Va{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?bS:Ke.nil}}get(){return this._scope}name(t){return new Ja(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(t),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let l=s.get(a);if(l)return l}else s=this._values[i]=new Map;s.set(a,o);let c=this._scope[i]||(this._scope[i]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:i,itemIndex:u}),o}getValue(t,r){let n=this._values[t];if(n)return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ke._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(t,r,n={},o){let i=Ke.nil;for(let a in t){let s=t[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,La.Started);let l=r(u);if(l){let d=this.opts.es5?Be.varKinds.var:Be.varKinds.const;i=(0,Ke._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Ke._)`${i}${l}${this.opts._n}`;else throw new Nd(u);c.set(u,La.Completed)})}return i}};Be.ValueScope=Rd});var W=I(X=>{"use strict";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 te=Lo(),vt=Cd(),rr=Lo();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return rr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return rr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return rr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return rr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return rr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return rr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return rr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return rr.Name}});var Wa=Cd();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Wa.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Wa.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Wa.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Wa.varKinds}});X.operators={GT:new te._Code(">"),GTE:new te._Code(">="),LT:new te._Code("<"),LTE:new te._Code("<="),EQ:new te._Code("==="),NEQ:new te._Code("!=="),NOT:new te._Code("!"),OR:new te._Code("||"),AND:new te._Code("&&"),ADD:new te._Code("+")};var Ft=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Zd=class extends Ft{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?vt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=dn(this.rhs,t,r)),this}get names(){return this.rhs instanceof te._CodeOrName?this.rhs.names:{}}},Ha=class extends Ft{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof te.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=dn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof te.Name?{}:{...this.lhs.names};return Ba(t,this.rhs)}},Ad=class extends Ha{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Ud=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Md=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Fd=class extends Ft{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},qd=class extends Ft{constructor(t){super(),this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){return this.code=dn(this.code,t,r),this}get names(){return this.code instanceof te._CodeOrName?this.code.names:{}}},Vo=class extends Ft{constructor(t=[]){super(),this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){let{nodes:t}=this,r=t.length;for(;r--;){let n=t[r].optimizeNodes();Array.isArray(n)?t.splice(r,1,...n):n?t[r]=n:t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(t,r)||(xS(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>wr(t,r.names),{})}},qt=class extends Vo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Ld=class extends Vo{},ln=class extends qt{};ln.kind="else";var xr=class e extends qt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new ln(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(sv(t),r instanceof e?[r]:r.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(t,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r),!!(super.optimizeNames(t,r)||this.else))return this.condition=dn(this.condition,t,r),this}get names(){let t=super.names;return Ba(t,this.condition),this.else&&wr(t,this.else.names),t}};xr.kind="if";var kr=class extends qt{};kr.kind="for";var Vd=class extends kr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=dn(this.iteration,t,r),this}get names(){return wr(super.names,this.iteration.names)}},Jd=class extends kr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?vt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=Ba(super.names,this.from);return Ba(t,this.to)}},Ka=class extends kr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=dn(this.iterable,t,r),this}get names(){return wr(super.names,this.iterable.names)}},Jo=class extends qt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Jo.kind="func";var Ho=class extends Vo{render(t){return"return "+super.render(t)}};Ho.kind="return";var Hd=class extends qt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&wr(t,this.catch.names),this.finally&&wr(t,this.finally.names),t}},Ko=class extends qt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Ko.kind="catch";var Bo=class extends qt{render(t){return"finally"+super.render(t)}};Bo.kind="finally";var Kd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=t,this._scope=new vt.Scope({parent:t}),this._nodes=[new Ld]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){let n=this._extScope.value(t,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new Zd(t,i,n)),i}const(t,r,n){return this._def(vt.varKinds.const,t,r,n)}let(t,r,n){return this._def(vt.varKinds.let,t,r,n)}var(t,r,n){return this._def(vt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Ha(t,r,n))}add(t,r){return this._leafNode(new Ad(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==te.nil&&this._leafNode(new qd(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,te.addCodeArg)(r,o));return r.push("}"),new te._Code(r)}if(t,r,n){if(this._blockNode(new xr(t)),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(t){return this._elseNode(new xr(t))}else(){return this._elseNode(new ln)}endIf(){return this._endBlockNode(xr,ln)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Vd(t),r)}forRange(t,r,n,o,i=this.opts.es5?vt.varKinds.var:vt.varKinds.let){let a=this._scope.toName(t);return this._for(new Jd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=vt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof te.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,te._)`${a}.length`,s=>{this.var(i,(0,te._)`${a}[${s}]`),n(i)})}return this._for(new Ka("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?vt.varKinds.var:vt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,te._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new Ka("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(kr)}label(t){return this._leafNode(new Ud(t))}break(t){return this._leafNode(new Md(t))}return(t){let r=new Ho;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Ho)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Hd;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new Ko(i),r(i)}return n&&(this._currNode=o.finally=new Bo,this.code(n)),this._endBlockNode(Ko,Bo)}throw(t){return this._leafNode(new Fd(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){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||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=te.nil,n,o){return this._blockNode(new Jo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Jo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof xr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};X.CodeGen=Kd;function wr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Ba(e,t){return t instanceof te._CodeOrName?wr(e,t.names):e}function dn(e,t,r){if(e instanceof te.Name)return n(e);if(!o(e))return e;return new te._Code(e._items.reduce((i,a)=>(a instanceof te.Name&&(a=n(a)),a instanceof te._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof te._Code&&i._items.some(a=>a instanceof te.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function xS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function sv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,te._)`!${Bd(e)}`}X.not=sv;var kS=cv(X.operators.AND);function wS(...e){return e.reduce(kS)}X.and=wS;var SS=cv(X.operators.OR);function zS(...e){return e.reduce(SS)}X.or=zS;function cv(e){return(t,r)=>t===te.nil?r:r===te.nil?t:(0,te._)`${Bd(t)} ${e} ${Bd(r)}`}function Bd(e){return e instanceof te.Name?e:(0,te._)`(${e})`}});var re=I(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;var pe=W(),IS=Lo();function PS(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=PS;function jS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(dv(e,t),!pv(t,e.self.RULES.all))}Q.alwaysValidSchema=jS;function dv(e,t=e.schema){let{opts:r,self:n}=e;if(!r.strictSchema||typeof t=="boolean")return;let o=n.RULES.keywords;for(let i in t)o[i]||hv(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=dv;function pv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=pv;function TS(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(r!=="$ref"&&t.all[r])return!0;return!1}Q.schemaHasRulesButRef=TS;function ES({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${e}${t}${(0,pe.getProperty)(n)}`}Q.schemaRefOrVal=ES;function OS(e){return fv(decodeURIComponent(e))}Q.unescapeFragment=OS;function DS(e){return encodeURIComponent(Gd(e))}Q.escapeFragment=DS;function Gd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Gd;function fv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=fv;function NS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=NS;function uv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof pe.Name?(i instanceof pe.Name?e(o,i,a):t(o,i,a),a):i instanceof pe.Name?(t(o,a,i),i):r(i,a);return s===pe.Name&&!(c instanceof pe.Name)?n(o,c):c}}Q.mergeEvaluated={props:uv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,pe._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,pe._)`${r} || {}`),Xd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:mv}),items:uv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,pe._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,pe._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function mv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,pe._)`{}`);return t!==void 0&&Xd(e,r,t),r}Q.evaluatedPropsToName=mv;function Xd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,pe._)`${t}${(0,pe.getProperty)(n)}`,!0))}Q.setEvaluated=Xd;var lv={};function RS(e,t){return e.scopeValue("func",{ref:t,code:lv[t.code]||(lv[t.code]=new IS._Code(t.code))})}Q.useFunc=RS;var Wd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Wd||(Q.Type=Wd={}));function CS(e,t,r){if(e instanceof pe.Name){let n=t===Wd.Num;return r?n?(0,pe._)`"[" + ${e} + "]"`:(0,pe._)`"['" + ${e} + "']"`:n?(0,pe._)`"/" + ${e}`:(0,pe._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(e).toString():"/"+Gd(e)}Q.getErrorPath=CS;function hv(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,r===!0)throw new Error(t);e.self.logger.warn(t)}}Q.checkStrictMode=hv});var Lt=I(Yd=>{"use strict";Object.defineProperty(Yd,"__esModule",{value:!0});var De=W(),ZS={data:new De.Name("data"),valCxt:new De.Name("valCxt"),instancePath:new De.Name("instancePath"),parentData:new De.Name("parentData"),parentDataProperty:new De.Name("parentDataProperty"),rootData:new De.Name("rootData"),dynamicAnchors:new De.Name("dynamicAnchors"),vErrors:new De.Name("vErrors"),errors:new De.Name("errors"),this:new De.Name("this"),self:new De.Name("self"),scope:new De.Name("scope"),json:new De.Name("json"),jsonPos:new De.Name("jsonPos"),jsonLen:new De.Name("jsonLen"),jsonPart:new De.Name("jsonPart")};Yd.default=ZS});var Wo=I(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.extendErrors=Ne.resetErrorsCount=Ne.reportExtraError=Ne.reportError=Ne.keyword$DataError=Ne.keywordError=void 0;var ne=W(),Ga=re(),Ve=Lt();Ne.keywordError={message:({keyword:e})=>(0,ne.str)`must pass "${e}" keyword validation`};Ne.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ne.str)`"${e}" keyword must be ${t} ($data)`:(0,ne.str)`"${e}" keyword is invalid ($data)`};function AS(e,t=Ne.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=yv(e,t,r);n??(a||s)?gv(i,c):vv(o,(0,ne._)`[${c}]`)}Ne.reportError=AS;function US(e,t=Ne.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=yv(e,t,r);gv(o,s),i||a||vv(n,Ve.default.vErrors)}Ne.reportExtraError=US;function MS(e,t){e.assign(Ve.default.errors,t),e.if((0,ne._)`${Ve.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ne._)`${Ve.default.vErrors}.length`,t),()=>e.assign(Ve.default.vErrors,null)))}Ne.resetErrorsCount=MS;function FS({gen:e,keyword:t,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=e.name("err");e.forRange("i",o,Ve.default.errors,s=>{e.const(a,(0,ne._)`${Ve.default.vErrors}[${s}]`),e.if((0,ne._)`${a}.instancePath === undefined`,()=>e.assign((0,ne._)`${a}.instancePath`,(0,ne.strConcat)(Ve.default.instancePath,i.errorPath))),e.assign((0,ne._)`${a}.schemaPath`,(0,ne.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,ne._)`${a}.schema`,r),e.assign((0,ne._)`${a}.data`,n))})}Ne.extendErrors=FS;function gv(e,t){let r=e.const("err",t);e.if((0,ne._)`${Ve.default.vErrors} === null`,()=>e.assign(Ve.default.vErrors,(0,ne._)`[${r}]`),(0,ne._)`${Ve.default.vErrors}.push(${r})`),e.code((0,ne._)`${Ve.default.errors}++`)}function vv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,ne._)`new ${e.ValidationError}(${t})`):(r.assign((0,ne._)`${n}.errors`,t),r.return(!1))}var Sr={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function yv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ne._)`{}`:qS(e,t,r)}function qS(e,t,r={}){let{gen:n,it:o}=e,i=[LS(o,r),VS(e,r)];return JS(e,t,i),n.object(...i)}function LS({errorPath:e},{instancePath:t}){let r=t?(0,ne.str)`${e}${(0,Ga.getErrorPath)(t,Ga.Type.Str)}`:e;return[Ve.default.instancePath,(0,ne.strConcat)(Ve.default.instancePath,r)]}function VS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,ne.str)`${t}/${e}`;return r&&(o=(0,ne.str)`${o}${(0,Ga.getErrorPath)(r,Ga.Type.Str)}`),[Sr.schemaPath,o]}function JS(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Sr.keyword,o],[Sr.params,typeof t=="function"?t(e):t||(0,ne._)`{}`]),c.messages&&n.push([Sr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Sr.schema,a],[Sr.parentSchema,(0,ne._)`${l}${d}`],[Ve.default.data,i]),u&&n.push([Sr.propertyName,u])}});var $v=I(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.boolOrEmptySchema=pn.topBoolOrEmptySchema=void 0;var HS=Wo(),KS=W(),BS=Lt(),WS={message:"boolean schema is false"};function GS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?_v(e,!1):typeof r=="object"&&r.$async===!0?t.return(BS.default.data):(t.assign((0,KS._)`${n}.errors`,null),t.return(!0))}pn.topBoolOrEmptySchema=GS;function XS(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),_v(e)):r.var(t,!0)}pn.boolOrEmptySchema=XS;function _v(e,t){let{gen:r,data:n}=e,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,HS.reportError)(o,WS,void 0,t)}});var Qd=I(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.getRules=fn.isJSONType=void 0;var YS=["string","number","integer","boolean","null","object","array"],QS=new Set(YS);function e0(e){return typeof e=="string"&&QS.has(e)}fn.isJSONType=e0;function t0(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}fn.getRules=t0});var ep=I(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function r0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&bv(e,n)}nr.schemaHasRulesForType=r0;function bv(e,t){return t.rules.some(r=>xv(e,r))}nr.shouldUseGroup=bv;function xv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}nr.shouldUseRule=xv});var Go=I(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var n0=Qd(),o0=ep(),i0=Wo(),B=W(),kv=re(),mn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(mn||(Re.DataType=mn={}));function a0(e){let t=wv(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Re.getSchemaTypes=a0;function wv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(n0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Re.getJSONTypes=wv;function s0(e,t){let{gen:r,data:n,opts:o}=e,i=c0(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,o0.schemaHasRulesForType)(e,t[0]));if(a){let s=rp(t,n,o.strictNumbers,mn.Wrong);r.if(s,()=>{i.length?u0(e,t,i):np(e)})}return a}Re.coerceAndCheckDataType=s0;var Sv=new Set(["string","number","integer","boolean","null"]);function c0(e,t){return t?e.filter(r=>Sv.has(r)||t==="array"&&r==="array"):[]}function u0(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,B._)`typeof ${o}`),s=n.let("coerced",(0,B._)`undefined`);i.coerceTypes==="array"&&n.if((0,B._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,B._)`${o}[0]`).assign(a,(0,B._)`typeof ${o}`).if(rp(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,B._)`${s} !== undefined`);for(let u of r)(Sv.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),np(e),n.endIf(),n.if((0,B._)`${s} !== undefined`,()=>{n.assign(o,s),l0(e,s)});function c(u){switch(u){case"string":n.elseIf((0,B._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,B._)`"" + ${o}`).elseIf((0,B._)`${o} === null`).assign(s,(0,B._)`""`);return;case"number":n.elseIf((0,B._)`${a} == "boolean" || ${o} === null
|
|
4
|
+
|| (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,B._)`+${o}`);return;case"integer":n.elseIf((0,B._)`${a} === "boolean" || ${o} === null
|
|
5
|
+
|| (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,B._)`+${o}`);return;case"boolean":n.elseIf((0,B._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,B._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,B._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,B._)`${a} === "string" || ${a} === "number"
|
|
6
|
+
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,B._)`[${o}]`)}}}function l0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,B._)`${t} !== undefined`,()=>e.assign((0,B._)`${t}[${r}]`,n))}function tp(e,t,r,n=mn.Correct){let o=n===mn.Correct?B.operators.EQ:B.operators.NEQ,i;switch(e){case"null":return(0,B._)`${t} ${o} null`;case"array":i=(0,B._)`Array.isArray(${t})`;break;case"object":i=(0,B._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,B._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,B._)`typeof ${t} ${o} ${e}`}return n===mn.Correct?i:(0,B.not)(i);function a(s=B.nil){return(0,B.and)((0,B._)`typeof ${t} == "number"`,s,r?(0,B._)`isFinite(${t})`:B.nil)}}Re.checkDataType=tp;function rp(e,t,r,n){if(e.length===1)return tp(e[0],t,r,n);let o,i=(0,kv.toHash)(e);if(i.array&&i.object){let a=(0,B._)`typeof ${t} != "object"`;o=i.null?a:(0,B._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=B.nil;i.number&&delete i.integer;for(let a in i)o=(0,B.and)(o,tp(a,t,r,n));return o}Re.checkDataTypes=rp;var d0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,B._)`{type: ${e}}`:(0,B._)`{type: ${t}}`};function np(e){let t=p0(e);(0,i0.reportError)(t,d0)}Re.reportTypeError=np;function p0(e){let{gen:t,data:r,schema:n}=e,o=(0,kv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Iv=I(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});Xa.assignDefaults=void 0;var hn=W(),f0=re();function m0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)zv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>zv(e,i,o.default))}Xa.assignDefaults=m0;function zv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,hn._)`${i}${(0,hn.getProperty)(t)}`;if(o){(0,f0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,hn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,hn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,hn._)`${s} = ${(0,hn.stringify)(r)}`)}});var lt=I(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.validateUnion=ce.validateArray=ce.usePattern=ce.callValidateCode=ce.schemaProperties=ce.allSchemaProperties=ce.noPropertyInData=ce.propertyInData=ce.isOwnProperty=ce.hasPropFunc=ce.reportMissingProp=ce.checkMissingProp=ce.checkReportMissingProp=void 0;var ge=W(),op=re(),or=Lt(),h0=re();function g0(e,t){let{gen:r,data:n,it:o}=e;r.if(ap(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ge._)`${t}`},!0),e.error()})}ce.checkReportMissingProp=g0;function v0({gen:e,data:t,it:{opts:r}},n,o){return(0,ge.or)(...n.map(i=>(0,ge.and)(ap(e,t,i,r.ownProperties),(0,ge._)`${o} = ${i}`)))}ce.checkMissingProp=v0;function y0(e,t){e.setParams({missingProperty:t},!0),e.error()}ce.reportMissingProp=y0;function Pv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ge._)`Object.prototype.hasOwnProperty`})}ce.hasPropFunc=Pv;function ip(e,t,r){return(0,ge._)`${Pv(e)}.call(${t}, ${r})`}ce.isOwnProperty=ip;function _0(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} !== undefined`;return n?(0,ge._)`${o} && ${ip(e,t,r)}`:o}ce.propertyInData=_0;function ap(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} === undefined`;return n?(0,ge.or)(o,(0,ge.not)(ip(e,t,r))):o}ce.noPropertyInData=ap;function jv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ce.allSchemaProperties=jv;function $0(e,t){return jv(t).filter(r=>!(0,op.alwaysValidSchema)(e,t[r]))}ce.schemaProperties=$0;function b0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ge._)`${e}, ${t}, ${n}${o}`:t,d=[[or.default.instancePath,(0,ge.strConcat)(or.default.instancePath,i)],[or.default.parentData,a.parentData],[or.default.parentDataProperty,a.parentDataProperty],[or.default.rootData,or.default.rootData]];a.opts.dynamicRef&&d.push([or.default.dynamicAnchors,or.default.dynamicAnchors]);let p=(0,ge._)`${l}, ${r.object(...d)}`;return c!==ge.nil?(0,ge._)`${s}.call(${c}, ${p})`:(0,ge._)`${s}(${p})`}ce.callValidateCode=b0;var x0=(0,ge._)`new RegExp`;function k0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ge._)`${o.code==="new RegExp"?x0:(0,h0.useFunc)(e,o)}(${r}, ${n})`})}ce.usePattern=k0;function w0(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,ge._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:op.Type.Num},i),t.if((0,ge.not)(i),s)})}}ce.validateArray=w0;function S0(e){let{gen:t,schema:r,keyword:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,op.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ge._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ge.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ce.validateUnion=S0});var Ov=I(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateKeywordUsage=St.validSchemaType=St.funcKeywordCode=St.macroKeywordCode=void 0;var Je=W(),zr=Lt(),z0=lt(),I0=Wo();function P0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=Ev(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Je.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}St.macroKeywordCode=P0;function j0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;E0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=Ev(n,o,u),d=n.let("valid");e.block$data(d,p),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function p(){if(t.errors===!1)h(),t.modifying&&Tv(e),y(()=>e.error());else{let $=t.async?f():m();t.modifying&&Tv(e),y(()=>T0(e,$))}}function f(){let $=n.let("ruleErrs",null);return n.try(()=>h((0,Je._)`await `),_=>n.assign(d,!1).if((0,Je._)`${_} instanceof ${c.ValidationError}`,()=>n.assign($,(0,Je._)`${_}.errors`),()=>n.throw(_))),$}function m(){let $=(0,Je._)`${l}.errors`;return n.assign($,null),h(Je.nil),$}function h($=t.async?(0,Je._)`await `:Je.nil){let _=c.opts.passContext?zr.default.this:zr.default.self,b=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Je._)`${$}${(0,z0.callValidateCode)(e,l,_,b)}`,t.modifying)}function y($){var _;n.if((0,Je.not)((_=t.valid)!==null&&_!==void 0?_:d),$)}}St.funcKeywordCode=j0;function Tv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Je._)`${n.parentData}[${n.parentDataProperty}]`))}function T0(e,t){let{gen:r}=e;r.if((0,Je._)`Array.isArray(${t})`,()=>{r.assign(zr.default.vErrors,(0,Je._)`${zr.default.vErrors} === null ? ${t} : ${zr.default.vErrors}.concat(${t})`).assign(zr.default.errors,(0,Je._)`${zr.default.vErrors}.length`),(0,I0.extendErrors)(e)},()=>e.error())}function E0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Ev(e,t,r){if(r===void 0)throw new Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Je.stringify)(r)})}function O0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}St.validSchemaType=O0;function D0({schema:e,opts:t,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(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}St.validateKeywordUsage=D0});var Nv=I(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.extendSubschemaMode=ir.extendSubschemaData=ir.getSubschema=void 0;var zt=W(),Dv=re();function N0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}${(0,zt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Dv.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=N0;function R0(e,t,{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}=t;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=t,p=s.let("data",(0,zt._)`${t.data}${(0,zt.getProperty)(r)}`,!0);c(p),e.errorPath=(0,zt.str)`${u}${(0,Dv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,zt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof zt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}ir.extendSubschemaData=R0;function C0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}ir.extendSubschemaMode=C0});var sp=I((PA,Rv)=>{"use strict";Rv.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(t)){if(n=t.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),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(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var Zv=I((jA,Cv)=>{"use strict";var ar=Cv.exports=function(e,t,r){typeof t=="function"&&(r=t,t={}),r=t.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Ya(t,n,o,e,"",e)};ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ar.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ar.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 Ya(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ar.arrayKeywords)for(var p=0;p<d.length;p++)Ya(e,t,r,d[p],o+"/"+l+"/"+p,i,o,l,n,p)}else if(l in ar.propsKeywords){if(d&&typeof d=="object")for(var f in d)Ya(e,t,r,d[f],o+"/"+l+"/"+Z0(f),i,o,l,n,f)}else(l in ar.keywords||e.allKeys&&!(l in ar.skipKeywords))&&Ya(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function Z0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Xo=I(We=>{"use strict";Object.defineProperty(We,"__esModule",{value:!0});We.getSchemaRefs=We.resolveUrl=We.normalizeId=We._getFullPath=We.getFullPath=We.inlineRef=void 0;var A0=re(),U0=sp(),M0=Zv(),F0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function q0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!cp(e):t?Av(e)<=t:!1}We.inlineRef=q0;var L0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function cp(e){for(let t in e){if(L0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(cp)||typeof r=="object"&&cp(r))return!0}return!1}function Av(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!F0.has(r)&&(typeof e[r]=="object"&&(0,A0.eachItem)(e[r],n=>t+=Av(n)),t===1/0))return 1/0}return t}function Uv(e,t="",r){r!==!1&&(t=gn(t));let n=e.parse(t);return Mv(e,n)}We.getFullPath=Uv;function Mv(e,t){return e.serialize(t).split("#")[0]+"#"}We._getFullPath=Mv;var V0=/#\/?$/;function gn(e){return e?e.replace(V0,""):""}We.normalizeId=gn;function J0(e,t,r){return r=gn(r),e.resolve(t,r)}We.resolveUrl=J0;var H0=/^[a-z_][-a-z0-9._]*$/i;function K0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=gn(e[r]||t),i={"":o},a=Uv(n,o,!1),s={},c=new Set;return M0(e,{allKeys:!0},(d,p,f,m)=>{if(m===void 0)return;let h=a+p,y=i[m];typeof d[r]=="string"&&(y=$.call(this,d[r])),_.call(this,d.$anchor),_.call(this,d.$dynamicAnchor),i[p]=y;function $(b){let T=this.opts.uriResolver.resolve;if(b=gn(y?T(y,b):b),c.has(b))throw l(b);c.add(b);let E=this.refs[b];return typeof E=="string"&&(E=this.refs[E]),typeof E=="object"?u(d,E.schema,b):b!==gn(h)&&(b[0]==="#"?(u(d,s[b],b),s[b]=d):this.refs[b]=h),b}function _(b){if(typeof b=="string"){if(!H0.test(b))throw new Error(`invalid anchor "${b}"`);$.call(this,`#${b}`)}}}),s;function u(d,p,f){if(p!==void 0&&!U0(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}We.getSchemaRefs=K0});var ei=I(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.getData=sr.KeywordCxt=sr.validateFunctionCode=void 0;var Jv=$v(),Fv=Go(),lp=ep(),Qa=Go(),B0=Iv(),Qo=Ov(),up=Nv(),N=W(),L=Lt(),W0=Xo(),Vt=re(),Yo=Wo();function G0(e){if(Bv(e)&&(Wv(e),Kv(e))){Q0(e);return}Hv(e,()=>(0,Jv.topBoolOrEmptySchema)(e))}sr.validateFunctionCode=G0;function Hv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,N._)`${L.default.data}, ${L.default.valCxt}`,n.$async,()=>{e.code((0,N._)`"use strict"; ${qv(r,o)}`),Y0(e,o),e.code(i)}):e.func(t,(0,N._)`${L.default.data}, ${X0(o)}`,n.$async,()=>e.code(qv(r,o)).code(i))}function X0(e){return(0,N._)`{${L.default.instancePath}="", ${L.default.parentData}, ${L.default.parentDataProperty}, ${L.default.rootData}=${L.default.data}${e.dynamicRef?(0,N._)`, ${L.default.dynamicAnchors}={}`:N.nil}}={}`}function Y0(e,t){e.if(L.default.valCxt,()=>{e.var(L.default.instancePath,(0,N._)`${L.default.valCxt}.${L.default.instancePath}`),e.var(L.default.parentData,(0,N._)`${L.default.valCxt}.${L.default.parentData}`),e.var(L.default.parentDataProperty,(0,N._)`${L.default.valCxt}.${L.default.parentDataProperty}`),e.var(L.default.rootData,(0,N._)`${L.default.valCxt}.${L.default.rootData}`),t.dynamicRef&&e.var(L.default.dynamicAnchors,(0,N._)`${L.default.valCxt}.${L.default.dynamicAnchors}`)},()=>{e.var(L.default.instancePath,(0,N._)`""`),e.var(L.default.parentData,(0,N._)`undefined`),e.var(L.default.parentDataProperty,(0,N._)`undefined`),e.var(L.default.rootData,L.default.data),t.dynamicRef&&e.var(L.default.dynamicAnchors,(0,N._)`{}`)})}function Q0(e){let{schema:t,opts:r,gen:n}=e;Hv(e,()=>{r.$comment&&t.$comment&&Xv(e),oz(e),n.let(L.default.vErrors,null),n.let(L.default.errors,0),r.unevaluated&&ez(e),Gv(e),sz(e)})}function ez(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,N._)`${r}.evaluated`),t.if((0,N._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,N._)`${e.evaluated}.props`,(0,N._)`undefined`)),t.if((0,N._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,N._)`${e.evaluated}.items`,(0,N._)`undefined`))}function qv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,N._)`/*# sourceURL=${r} */`:N.nil}function tz(e,t){if(Bv(e)&&(Wv(e),Kv(e))){rz(e,t);return}(0,Jv.boolOrEmptySchema)(e,t)}function Kv({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function Bv(e){return typeof e.schema!="boolean"}function rz(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Xv(e),iz(e),az(e);let i=n.const("_errs",L.default.errors);Gv(e,i),n.var(t,(0,N._)`${i} === ${L.default.errors}`)}function Wv(e){(0,Vt.checkUnknownRules)(e),nz(e)}function Gv(e,t){if(e.opts.jtd)return Lv(e,[],!1,t);let r=(0,Fv.getSchemaTypes)(e.schema),n=(0,Fv.coerceAndCheckDataType)(e,r);Lv(e,r,!n,t)}function nz(e){let{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,Vt.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function oz(e){let{schema:t,opts:r}=e;t.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Vt.checkStrictMode)(e,"default is ignored in the schema root")}function iz(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,W0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function az(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Xv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,N._)`${L.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,N.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,N._)`${L.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function sz(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,N._)`${L.default.errors} === 0`,()=>t.return(L.default.data),()=>t.throw((0,N._)`new ${o}(${L.default.vErrors})`)):(t.assign((0,N._)`${n}.errors`,L.default.vErrors),i.unevaluated&&cz(e),t.return((0,N._)`${L.default.errors} === 0`))}function cz({gen:e,evaluated:t,props:r,items:n}){r instanceof N.Name&&e.assign((0,N._)`${t}.props`,r),n instanceof N.Name&&e.assign((0,N._)`${t}.items`,n)}function Lv(e,t,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Vt.schemaHasRulesButRef)(i,l))){o.block(()=>Qv(e,"$ref",l.all.$ref.definition));return}c.jtd||uz(e,t),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,lp.shouldUseGroup)(i,p)&&(p.type?(o.if((0,Qa.checkDataType)(p.type,a,c.strictNumbers)),Vv(e,p),t.length===1&&t[0]===p.type&&r&&(o.else(),(0,Qa.reportTypeError)(e)),o.endIf()):Vv(e,p),s||o.if((0,N._)`${L.default.errors} === ${n||0}`))}}function Vv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,B0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,lp.shouldUseRule)(n,i)&&Qv(e,i.keyword,i.definition,t.type)})}function uz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(lz(e,t),e.opts.allowUnionTypes||dz(e,t),pz(e,e.dataTypes))}function lz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Yv(e.dataTypes,r)||dp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),mz(e,t)}}function dz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&dp(e,"use allowUnionTypes to allow union type keyword")}function pz(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,lp.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>fz(t,a))&&dp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function fz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Yv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function mz(e,t){let r=[];for(let n of e.dataTypes)Yv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function dp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Vt.checkStrictMode)(e,t,e.opts.strictTypes)}var es=class{constructor(t,r,n){if((0,Qo.validateKeywordUsage)(t,r,n),this.gen=t.gen,this.allErrors=t.allErrors,this.keyword=n,this.data=t.data,this.schema=t.schema[n],this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Vt.schemaRefOrVal)(t,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=t.schema,this.params={},this.it=t,this.def=r,this.$data)this.schemaCode=t.gen.const("vSchema",ey(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Qo.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=t.gen.const("_errs",L.default.errors))}result(t,r,n){this.failResult((0,N.not)(t),r,n)}failResult(t,r,n){this.gen.if(t),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(t,r){this.failResult((0,N.not)(t),void 0,r)}fail(t){if(t===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(t),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);let{schemaCode:r}=this;this.fail((0,N._)`${r} !== undefined && (${(0,N.or)(this.invalid$data(),t)})`)}error(t,r,n){if(r){this.setParams(r),this._error(t,n),this.setParams({});return}this._error(t,n)}_error(t,r){(t?Yo.reportExtraError:Yo.reportError)(this,this.def.error,r)}$dataError(){(0,Yo.reportError)(this,this.def.$dataError||Yo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Yo.resetErrorsCount)(this.gen,this.errsCount)}ok(t){this.allErrors||this.gen.if(t)}setParams(t,r){r?Object.assign(this.params,t):this.params=t}block$data(t,r,n=N.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=N.nil,r=N.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,N.or)((0,N._)`${o} === undefined`,r)),t!==N.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==N.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,N.or)(a(),s());function a(){if(n.length){if(!(r instanceof N.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,N._)`${(0,Qa.checkDataTypes)(c,r,i.opts.strictNumbers,Qa.DataType.Wrong)}`}return N.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,N._)`!${c}(${r})`}return N.nil}}subschema(t,r){let n=(0,up.getSubschema)(this.it,t);(0,up.extendSubschemaData)(n,this.it,t),(0,up.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return tz(o,r),o}mergeEvaluated(t,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&t.props!==void 0&&(n.props=Vt.mergeEvaluated.props(o,t.props,n.props,r)),n.items!==!0&&t.items!==void 0&&(n.items=Vt.mergeEvaluated.items(o,t.items,n.items,r)))}mergeValidEvaluated(t,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(t,N.Name)),!0}};sr.KeywordCxt=es;function Qv(e,t,r,n){let o=new es(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Qo.funcKeywordCode)(o,r):"macro"in r?(0,Qo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Qo.funcKeywordCode)(o,r)}var hz=/^\/(?:[^~]|~0|~1)*$/,gz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ey(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return L.default.rootData;if(e[0]==="/"){if(!hz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=L.default.rootData}else{let u=gz.exec(e);if(!u)throw new Error(`Invalid JSON-pointer: ${e}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=t)throw new Error(c("property/index",l));return n[t-l]}if(l>t)throw new Error(c("data",l));if(i=r[t-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,N._)`${i}${(0,N.getProperty)((0,Vt.unescapeJsonPointer)(u))}`,a=(0,N._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}sr.getData=ey});var ts=I(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var pp=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};fp.default=pp});var ti=I(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var mp=Xo(),hp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,mp.resolveUrl)(t,r,n),this.missingSchema=(0,mp.normalizeId)((0,mp.getFullPath)(t,this.missingRef))}};gp.default=hp});var ns=I(dt=>{"use strict";Object.defineProperty(dt,"__esModule",{value:!0});dt.resolveSchema=dt.getCompilingSchema=dt.resolveRef=dt.compileSchema=dt.SchemaEnv=void 0;var yt=W(),vz=ts(),Ir=Lt(),_t=Xo(),ty=re(),yz=ei(),vn=class{constructor(t){var r;this.refs={},this.dynamicAnchors={};let n;typeof t.schema=="object"&&(n=t.schema),this.schema=t.schema,this.schemaId=t.schemaId,this.root=t.root||this,this.baseId=(r=t.baseId)!==null&&r!==void 0?r:(0,_t.normalizeId)(n?.[t.schemaId||"$id"]),this.schemaPath=t.schemaPath,this.localRefs=t.localRefs,this.meta=t.meta,this.$async=n?.$async,this.refs={}}};dt.SchemaEnv=vn;function yp(e){let t=ry.call(this,e);if(t)return t;let r=(0,_t.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new yt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:vz.default,code:(0,yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,yt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:yt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,yz.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let f=new Function(`${Ir.default.self}`,`${Ir.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=e.schema,f.schemaEnv=e,e.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:m,items:h}=u;f.evaluated={props:m instanceof yt.Name?void 0:m,items:h instanceof yt.Name?void 0:h,dynamicProps:m instanceof yt.Name,dynamicItems:h instanceof yt.Name},f.source&&(f.source.evaluated=(0,yt.stringify)(f.evaluated))}return e.validate=f,e}catch(d){throw delete e.validate,delete e.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(e)}}dt.compileSchema=yp;function _z(e,t,r){var n;r=(0,_t.resolveUrl)(this.opts.uriResolver,t,r);let o=e.refs[r];if(o)return o;let i=xz.call(this,e,r);if(i===void 0){let a=(n=e.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new vn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=$z.call(this,i)}dt.resolveRef=_z;function $z(e){return(0,_t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:yp.call(this,e)}function ry(e){for(let t of this._compilations)if(bz(t,e))return t}dt.getCompilingSchema=ry;function bz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function xz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||rs.call(this,e,t)}function rs(e,t){let r=this.opts.uriResolver.parse(t),n=(0,_t._getFullPath)(this.opts.uriResolver,r),o=(0,_t.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===o)return vp.call(this,r,e);let i=(0,_t.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=rs.call(this,e,a);return typeof s?.schema!="object"?void 0:vp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||yp.call(this,a),i===(0,_t.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,_t.resolveUrl)(this.opts.uriResolver,o,u)),new vn({schema:s,schemaId:c,root:e,baseId:o})}return vp.call(this,r,a)}}dt.resolveSchema=rs;var kz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function vp(e,{baseId:t,schema:r,root:n}){var o;if(((o=e.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,ty.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!kz.has(s)&&u&&(t=(0,_t.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,ty.schemaHasRulesButRef)(r,this.RULES)){let s=(0,_t.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=rs.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new vn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var ny=I((RA,wz)=>{wz.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 Sp=I((CA,uy)=>{"use strict";var Sz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),$p=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),zz=RegExp.prototype.test.bind(/^\d*$/u),Pr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),bp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),iy=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),xp=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Iz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function Pz(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}var jz=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Tz=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Ez=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Oz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),Dz=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),Nz=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function Rz(e){return Dz(e)||Nz(e)}function Cz(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Ez(e[t])){if(e[t]==="%"&&t+2<e.length&&Pr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function oy(e){let t=-1,r=0,n=-1,o=0;for(let s=0;s<e.length;s++)e[s]==="0"?(n===-1&&(n=s),o++,o>r&&(r=o,t=n)):(n=-1,o=0);if(r<2)return e.join(":");let i=e.slice(0,t).join(":"),a=e.slice(t+r).join(":");return i+"::"+a}function Zz(e){let t=e.indexOf("::");if(t!==-1&&e.indexOf("::",t+1)!==-1)return;let r=t===-1?e.split(":"):e.slice(0,t).split(":"),n=t===-1?[]:e.slice(t+2).split(":");t!==-1&&(r.length===1&&r[0]===""&&(r.length=0),n.length===1&&n[0]===""&&(n.length=0));let o=r.concat(n),i=0;for(let s=0;s<o.length;s++){let c=o[s];if(c==="")return;if(c.indexOf(".")!==-1){if(s!==o.length-1||t!==-1&&n.length===0||!$p(c))return;i+=2;continue}if(!jz(c))return;o[s]=parseInt(c,16).toString(16),i++}if(t===-1)return i!==8?void 0:oy(o);if(i>=8)return;let a=o.slice(0,r.length);for(let s=i;s<8;s++)a.push("0");for(let s=r.length;s<o.length;s++)a.push(o[s]);return oy(a)}function _p(e){let t=e[0]==="["&&e[e.length-1]==="]";if((e[0]==="["||e[e.length-1]==="]")&&!t)return{host:e,isIPV6:!1,error:!0};let n=t?e.slice(1,-1):e;if(t&&Tz(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Az(n,":")<2)return{host:e,isIPV6:!1,error:t};let o="",i=n.indexOf("%");if(i!==-1){let s=n.slice(i,i+3).toLowerCase()==="%25"?3:1;if(o=n.slice(i+s),!Cz(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=Zz(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(o?"%"+o:""),escapedHost:a+(o?"%25"+o:""),isIPV6:!0}}function Az(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Uz(e){let t=e,r=[],n=-1,o=0;for(;o=t.length;){if(o===1){if(t===".")break;if(t==="/"){r.push("/");break}else{r.push(t);break}}else if(o===2){if(t[0]==="."){if(t[1]===".")break;if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){r.push("/");break}}else if(o===3&&t==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"&&t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."&&t[3]==="/"){t=t.slice(3),r.length!==0&&r.pop();continue}}if((n=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")}var Mz={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Fz=/[@/?#:]/g,qz=/[@/?#]/g;function ay(e,t){let r=t?qz:Fz;return r.lastIndex=0,e.replace(r,n=>Mz[n])}function sy(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));t&&bp(a)?r+=a:r+="%"+i,n+=2;continue}}r+=e[n]}return r}var Ce=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ce[t]="%"+e[t>>4]+e[t&15]}function kp(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function _e(e){return e<2048?Ce[192|e>>6]+Ce[128|e&63]:e<65536?Ce[224|e>>12]+Ce[128|e>>6&63]+Ce[128|e&63]:Ce[240|e>>18]+Ce[128|e>>12&63]+Ce[128|e>>6&63]+Ce[128|e&63]}function Lz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&bp(a)?t+=a:t+="%"+i,r+=2;continue}}if(iy(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=kp(o)?n:Ce[o];else if(o<55296||o>57343)t+=_e(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=_e(65536+(o-55296<<10)+(i-56320)),r++):t+=_e(65533)}else t+=_e(65533)}}return t}function Vz(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let i=e[o];if(i==="%"&&o+2<e.length){let a=e.slice(o+1,o+3);if(Pr(a)){r+="%"+a.toUpperCase(),o+=2;continue}}if(i==="/"&&(n=!1),iy(i)&&(i!==":"||!n))r+=i;else{let a=e.charCodeAt(o);if(a<128)r+=Ce[a];else if(a<55296||a>57343)r+=_e(a);else if(a<=56319&&o+1<e.length){let s=e.charCodeAt(o+1);s>=56320&&s<=57343?(r+=_e(65536+(a-55296<<10)+(s-56320)),o++):r+=_e(65533)}else r+=_e(65533)}}return r}function Jz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));bp(a)?t+=a:t+="%"+i,r+=2;continue}}if(xp(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=kp(o)?n:Ce[o];else if(o<55296||o>57343)t+=_e(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=_e(65536+(o-55296<<10)+(i-56320)),r++):t+=_e(65533)}else t+=_e(65533)}}return t}function wp(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Pr(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let i=e.charCodeAt(n);if(i<128)r+=Ce[i];else if(i<55296||i>57343)r+=_e(i);else if(i<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=_e(65536+(i-55296<<10)+(a-56320)),n++):r+=_e(65533)}else r+=_e(65533)}}return r}function cy(e){return wp(e,Iz)}function Hz(e){return wp(e,xp)}function Kz(e){return wp(e,xp)}function Bz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Pr(i)){t+="%"+i.toUpperCase(),r+=2;continue}}let o=e.charCodeAt(r);if(o<128)t+=kp(o)?n:Ce[o];else if(o<55296||o>57343)t+=_e(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=_e(65536+(o-55296<<10)+(i-56320)),r++):t+=_e(65533)}else t+=_e(65533)}return t}function Wz(e){let t=[];if(e.userinfo!==void 0&&(t.push(cy(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!$p(r)){let n=_p(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=sy(r,!0),n=_p(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=ay(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!zz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}uy.exports={BYTE_HEX:Ce,percentEncodeNonAscii:_e,nonSimpleDomain:Oz,nonSimpleMailtoDomain:Rz,recomposeAuthority:Wz,reescapeHostDelimiters:ay,normalizePercentEncoding:sy,normalizePathEncoding:Lz,serializePathEncoding:Vz,normalizeQueryFragmentEncoding:Jz,encodeUserinfo:cy,encodeQuery:Hz,encodeFragment:Kz,escapePreservingEscapes:Bz,removeDotSegments:Uz,isIPv4:$p,isUUID:Sz,normalizeIPv6:_p,stringArrayToHexStripped:Pz}});var _y=I((ZA,yy)=>{"use strict";var{isUUID:Gz,BYTE_HEX:Xz,percentEncodeNonAscii:zp,nonSimpleMailtoDomain:Yz}=Sp(),Qz=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,eI=["http","https","ws","wss","urn","urn:uuid","mailto"];function tI(e){return eI.indexOf(e)!==-1}function Pp(e){return e.secure===!0?!0:e.secure===!1?!1:e.scheme?e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S"):!1}function fy(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function my(e){let t=String(e.scheme).toLowerCase()==="https";return(e.port===(t?443:80)||e.port==="")&&(e.port=void 0),e.path||(e.path="/"),e}function rI(e){return e.secure=Pp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function nI(e){if((e.port===(Pp(e)?443:80)||e.port==="")&&(e.port=void 0),typeof e.secure=="boolean"&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let t=e.resourceName.indexOf("?"),r=t===-1?e.resourceName:e.resourceName.slice(0,t);e.path=r&&r!=="/"?r:void 0,e.query=t===-1?void 0:e.resourceName.slice(t+1),e.resourceName=void 0}return e.fragment=void 0,e}function oI(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Qz);if(r&&r[0]===e.path){let n=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let o=`${n}:${t.nid||e.nid}`,i=jp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function iI(e,t){if(e.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=jp(o);i&&(e=i.serialize(e,t));let a=e,s=e.nss;return a.path=`${n||t.nid}:${s}`,t.skipEscape=!0,a}function aI(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Gz(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function sI(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var hy={scheme:"http",domainHost:!0,parse:fy,serialize:my},cI={scheme:"https",domainHost:hy.domainHost,parse:fy,serialize:my},os={scheme:"ws",domainHost:!0,parse:rI,serialize:nI},uI={scheme:"wss",domainHost:os.domainHost,parse:os.parse,serialize:os.serialize},lI={scheme:"urn",parse:oI,serialize:iI,skipNormalize:!0},dI={scheme:"urn:uuid",parse:aI,serialize:sI,skipNormalize:!0},pI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=",fI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@",gy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function as(e,t=!1){let r=new Uint8Array(128);for(let i=0;i<e.length;i++)r[e.charCodeAt(i)]=1;let n=e.replace(/[\\\]^-]/gu,"\\$&"),o=t?`[${n}]|[^\\0-\\x7F\\uD800-\\uDFFF]`:`[${n}]`;return{all:new RegExp(`^(?:${o})*$`,"u"),table:r,allowNonAscii:t}}var mI=as(pI),ly=as(fI),hI=as(gy),gI=as(gy,!0),vI=/^[\da-f]{2}$/iu,yI=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,Ip="URI mailto has an invalid recipient domain.",dy=/[\uD800-\uDFFF]/u;function cr(e){if(typeof e!="string"||e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function py(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);if(n>=55296&&n<=56319&&r+1<e.length){let o=e.charCodeAt(r+1);if(o>=56320&&o<=57343){t+=e[r]+e[r+1],r++;continue}}t+=n>=55296&&n<=57343?"\uFFFD":e[r]}return t}function ri(e,t){if(t.all.test(e))return e;let r=t.table,n="";for(let o=0;o<e.length;o++){let i=e.charCodeAt(o);if(i<128){r[i]===1?n+=e[o]:i===37&&o+2<e.length&&vI.test(e.slice(o+1,o+3))?(n+="%"+e.slice(o+1,o+3).toUpperCase(),o+=2):n+=Xz[i];continue}if(i<55296||i>57343){n+=t.allowNonAscii?e[o]:zp(i);continue}if(i<=56319&&o+1<e.length){let a=e.charCodeAt(o+1);if(a>=56320&&a<=57343){n+=t.allowNonAscii?e[o]+e[o+1]:zp(65536+(i-55296<<10)+(a-56320)),o++;continue}}n+=t.allowNonAscii?"\uFFFD":zp(65533)}return n}function vy(e,t,r){let n=String(e).toLowerCase();if(yI.test(n)||n!==""&&!Yz(n))return n;try{let o=new URL("http://"+n);if(o.username||o.password||o.port||o.pathname!=="/"||o.search||o.hash||!o.hostname)throw new Error(Ip);return t&&t.unicodeSupport?n:o.hostname}catch{return r&&(r.error=r.error||Ip),n}}function _I(e,t){let r=t&&t.unicodeSupport?gI:hI;return e.length>1&&e[0]==="["&&e[e.length-1]==="]"?"["+ri(e.slice(1,-1),r)+"]":ri(e,r)}function $I(e,t){let r=e,n=r.path,o=r.query;n&&dy.test(n)&&(n=py(n)),o&&dy.test(o)&&(o=py(o));let i=n?n.indexOf(",")===-1?[n]:n.split(","):[];if(r.path=void 0,o){let a=null,s=0;for(;s<=o.length;){let c=o.indexOf("&",s);c===-1&&(c=o.length);let u=o.slice(s,c);s=c+1;let l=u.indexOf("=");if(l!==u.lastIndexOf("=")){r.error=r.error||"URI mailto has malformed header fields.";continue}let d=l===-1?u:u.slice(0,l),p=l===-1?"":u.slice(l+1);if(d==="to"){let f=p.split(",");for(let m=0;m<f.length;m++)i.push(f[m]);continue}if(d==="subject"){r.subject=cr(p);continue}if(d==="body"){r.body=cr(p);continue}a===null&&(a=Object.create(null)),a[cr(d)]=cr(p)}a!==null&&(r.headers=a)}r.query=void 0;for(let a=0;a<i.length;a++){let s=i[a],c=s.lastIndexOf("@");if(c<0){r.error=r.error||Ip,i[a]=cr(s);continue}let u=cr(s.slice(0,c)),l=vy(cr(s.slice(c+1)),t,r);i[a]=u+"@"+l}return i.length&&(r.to=i),r}function bI(e,t){let r=e,n=Array.isArray(r.to)?r.to.slice():[];if(n.length){for(let s=0;s<n.length;s++){let c=String(n[s]),u=c.lastIndexOf("@"),l=u>=0?c.slice(0,u):c,d=u>=0?c.slice(u+1):"",p=ri(l,mI),f=cr(d),m=vy(f,t);n[s]=p+"@"+_I(m,t)}r.path=n.join(","),t.skipEscape=!0}else r.path=void 0;let o=r.headers&&typeof r.headers=="object"?Object.assign(Object.create(null),r.headers):Object.create(null);r.subject&&(o.subject=r.subject),r.body&&(o.body=r.body),r.headers=o;let i="",a=0;for(let s in o)a++!==0&&(i+="&"),i+=ri(s,ly)+"="+ri(String(o[s]),ly);return a!==0?r.query=i:r.headers=void 0,r}var xI={scheme:"mailto",parse:$I,serialize:bI,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0},is={http:hy,https:cI,ws:os,wss:uI,urn:lI,"urn:uuid":dI,mailto:xI};Object.setPrototypeOf(is,null);function jp(e){return e&&(is[e]||is[e.toLowerCase()])||void 0}yy.exports={wsIsSecure:Pp,SCHEMES:is,isValidSchemeName:tI,getSchemeHandler:jp}});var Dy=I((AA,us)=>{"use strict";var{normalizeIPv6:wy,removeDotSegments:oi,recomposeAuthority:kI,normalizePercentEncoding:Sy,normalizePathEncoding:wI,serializePathEncoding:$y,normalizeQueryFragmentEncoding:by,encodeQuery:SI,encodeFragment:zI,reescapeHostDelimiters:II,isIPv4:zy,nonSimpleDomain:PI}=Sp(),{SCHEMES:Iy,getSchemeHandler:Tp}=_y(),Py=/^[A-Za-z][A-Za-z0-9+.-]*$/u,jy="URI scheme is malformed.";function xy(e){let t=unescape(String(e));if(!Py.test(t))throw new TypeError(jy);return t}function jI(e,t){return typeof e=="string"?e=ZI(e,t):typeof e=="object"&&(e=cs(jr(e,t),t)),e}function TI(e,t,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},{parsed:o,malformedAuthorityOrPort:i,malformedPercentEncoding:a,malformedSchemeSpecific:s,malformedHost:c,malformedScheme:u}=ss(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:p,malformedSchemeSpecific:f,malformedHost:m,malformedScheme:h}=ss(t,n);if(i||d||a||p||s||f||c||m||u||h)throw new Error(o.error||l.error||"URI is malformed.");let y=Ty(o,l,n,!0),$=Tp(r&&r.scheme||y.scheme),_=y.host,b=_!==void 0&&_!==""&&(zy(_)||wy(_).isIPV6);Ey(y,r||{},$,b);let T=_&&_.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(_);if(y.error&&!T)throw new Error(y.error);return n.skipEscape=!0,jr(y,n)}function Ty(e,t,r,n){let o={};return n||(e=cs(jr(e,r),r),t=cs(jr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=oi(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=oi(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=oi(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?o.path="/"+t.path:e.path?o.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:o.path=t.path,o.path=oi(o.path)),o.query=t.query):(o.path=e.path,t.query!==void 0?o.query=t.query:o.query=e.query),o.userinfo=e.userinfo,o.host=e.host,o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function EI(e,t,r){let n=ky(e,r),o=ky(t,r);return n!==void 0&&o!==void 0&&n===o}function jr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,to:e.to,subject:e.subject,body:e.body,headers:e.headers,error:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=xy(r.scheme));let i=Tp(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n);let a=r.userinfo!==void 0||r.host!==void 0||r.port!==void 0,s=!n.skipEscape&&r.scheme===void 0&&!a;r.path!==void 0&&(n.skipEscape?r.path=Sy(r.path):r.path=$y(r.path,s)),n.reference!=="suffix"&&r.scheme&&(r.scheme=xy(r.scheme),o.push(r.scheme,":"));let c=kI(r);if(c!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(c),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let u=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(u=oi(u)),s&&(u=$y(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",SI(r.query)),r.fragment!==void 0&&o.push("#",zI(r.fragment)),o.join("")}var OI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,DI=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,NI=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function RI(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port=="number"&&(e.port<0||e.port>65535))return"URI port is malformed."}function ni(e){if(e===void 0)return!1;let t=e.indexOf("%");for(;t!==-1;){if(t+2>=e.length||!/^[\da-f]{2}$/iu.test(e.slice(t+1,t+3)))return!0;t=e.indexOf("%",t+3)}return!1}function Ep(e){return e[0]==="["&&e[e.length-1]==="]"}function CI(e){let t=e[4];return ni(e[3])||t!==void 0&&!Ep(t)&&ni(t)||ni(e[6])||ni(e[7])||ni(e[8])}function Ey(e,t,r,n){let o=e.host&&e.host[0]==="["&&e.host[e.host.length-1]==="]";if(!t.unicodeSupport&&(!r||!r.unicodeSupport)&&e.host&&!Ep(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&!o&&PI(e.host))try{e.host=new URL("http://"+e.host).hostname}catch(i){return e.error=e.error||"Host's domain name can not be converted to ASCII: "+i,!0}return!1}function ss(e,t){let r=Object.assign({},t),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,i=!1,a=!1,s=!1,c=!1,u=!1,l=!1;r.reference==="suffix"&&(r.scheme?e=r.scheme+":"+e:e="//"+e);let d=e.match(DI);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let p=e.match(NI);if(p!==null){let m=p[1],h=m.replace(/[\t\n\r]/g,"");h.length>=2&&(h.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):m.length!==h.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let f=e.match(OI);if(f){if(n.scheme=f[1],n.userinfo=f[3],n.host=f[4],n.port=parseInt(f[5],10),n.path=f[6]||"",n.query=f[7],n.fragment=f[8],n.scheme!==void 0){let y=unescape(n.scheme);Py.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||jy,u=!0)}i=CI(f),i&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=f[5]);let m=RI(n,f);if(m!==void 0&&(n.error=n.error||m,o=!0),n.host)if(zy(n.host)===!1){let $=Ep(n.host),_=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,b=wy(n.host);l=b.isIPV6||b.isIPVFuture===!0,c=_&&(!$||b.error===!0),n.host=l?b.host:b.host.toLowerCase(),c&&(n.error=n.error||"URI host is malformed.",o=!0)}else l=!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 h=Tp(r.scheme||n.scheme);if(c||(s=Ey(n,r,h,l)),!h||h&&!h.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:Sy(n.host,!0);n.host=II(y,l)}n.path&&(n.path=wI(n.path)),n.query&&(n.query=by(n.query)),n.fragment&&(n.fragment=by(n.fragment))}h&&h.parse&&(h.parse(n,r),h===Iy.urn&&n.nid===void 0&&(a=!0))}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:u}}function cs(e,t){return ss(e,t).parsed}function ZI(e,t){return Oy(e,t).normalized}function Oy(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}=ss(e,t);return{normalized:n||o||i||a||s?e:jr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}}function ky(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:jr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=Oy(r,t);return o||i||a||s||c?void 0:n}var Op={SCHEMES:Iy,normalize:jI,resolve:TI,resolveComponent:Ty,equal:EI,serialize:jr,parse:cs};us.exports=Op;us.exports.default=Op;us.exports.fastUri=Op});var Ry=I(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var Ny=Dy();Ny.code='require("ajv/dist/runtime/uri").default';Dp.default=Ny});var Ly=I(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.CodeGen=Ie.Name=Ie.nil=Ie.stringify=Ie.str=Ie._=Ie.KeywordCxt=void 0;var AI=ei();Object.defineProperty(Ie,"KeywordCxt",{enumerable:!0,get:function(){return AI.KeywordCxt}});var yn=W();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return yn._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return yn.str}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return yn.stringify}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return yn.nil}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return yn.Name}});Object.defineProperty(Ie,"CodeGen",{enumerable:!0,get:function(){return yn.CodeGen}});var UI=ts(),My=ti(),MI=Qd(),ii=ns(),FI=W(),ai=Xo(),ls=Go(),Rp=re(),Cy=ny(),qI=Ry(),Fy=(e,t)=>new RegExp(e,t);Fy.code="new RegExp";var LI=["removeAdditional","useDefaults","coerceTypes"],VI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),JI={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."},HI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Zy=200;function KI(e){var t,r,n,o,i,a,s,c,u,l,d,p,f,m,h,y,$,_,b,T,E,nt,Ae,jn,Os;let Tn=e.strict,Ds=(t=e.code)===null||t===void 0?void 0:t.optimize,Af=Ds===!0||Ds===void 0?1:Ds||0,Uf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Fy,w$=(o=e.uriResolver)!==null&&o!==void 0?o:qI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Tn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Tn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Tn)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=e.strictTuples)!==null&&d!==void 0?d:Tn)!==null&&p!==void 0?p:"log",strictRequired:(m=(f=e.strictRequired)!==null&&f!==void 0?f:Tn)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:Af,regExp:Uf}:{optimize:Af,regExp:Uf},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:Zy,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:Zy,meta:($=e.meta)!==null&&$!==void 0?$:!0,messages:(_=e.messages)!==null&&_!==void 0?_:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(T=e.schemaId)!==null&&T!==void 0?T:"$id",addUsedSchema:(E=e.addUsedSchema)!==null&&E!==void 0?E:!0,validateSchema:(nt=e.validateSchema)!==null&&nt!==void 0?nt:!0,validateFormats:(Ae=e.validateFormats)!==null&&Ae!==void 0?Ae:!0,unicodeRegExp:(jn=e.unicodeRegExp)!==null&&jn!==void 0?jn:!0,int32range:(Os=e.int32range)!==null&&Os!==void 0?Os:!0,uriResolver:w$}}var si=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...KI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new FI.ValueScope({scope:{},prefixes:VI,es5:r,lines:n}),this.logger=QI(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,MI.getRules)(),Ay.call(this,JI,t,"NOT SUPPORTED"),Ay.call(this,HI,t,"DEPRECATED","warn"),this._metaOpts=XI.call(this),t.formats&&WI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&GI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),BI.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Cy;n==="id"&&(o={...Cy},o.id=o.$id,delete o.$id),r&&t&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:void 0}validate(t,r){let n;if(typeof t=="string"){if(n=this.getSchema(t),!n)throw new Error(`no schema with key or ref "${t}"`)}else n=this.compile(t);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(t,r){let n=this._addSchema(t,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(t,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,t,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof My.default))throw d;return s.call(this,d),await c.call(this,d.missingSchema),a.call(this,l)}}function s({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await i.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(t,r,n,o=this.opts.validateSchema){if(Array.isArray(t)){for(let a of t)this.addSchema(a,void 0,n,o);return this}let i;if(typeof t=="object"){let{schemaId:a}=this.opts;if(i=t[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,ai.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(t,n,r,o,!0),this}addMetaSchema(t,r,n=this.opts.validateSchema){return this.addSchema(t,r,!0,n),this}validateSchema(t,r){if(typeof t=="boolean")return!0;let n;if(n=t.$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,t);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(t){let r;for(;typeof(r=Uy.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new ii.SchemaEnv({schema:{},schemaId:n});if(r=ii.resolveSchema.call(this,o,t),!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp)return this._removeAllSchemas(this.schemas,t),this._removeAllSchemas(this.refs,t),this;switch(typeof t){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Uy.call(this,t);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[t],delete this.refs[t],this}case"object":{let r=t;this._cache.delete(r);let n=t[this.opts.schemaId];return n&&(n=(0,ai.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(let r of t)this.addKeyword(r);return this}addKeyword(t,r){let n;if(typeof t=="string")n=t,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof t=="object"&&r===void 0){if(r=t,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(tP.call(this,n,r),!r)return(0,Rp.eachItem)(n,i=>Np.call(this,i)),this;nP.call(this,r);let o={...r,type:(0,ls.getJSONTypes)(r.type),schemaType:(0,ls.getJSONTypes)(r.schemaType)};return(0,Rp.eachItem)(n,o.type.length===0?i=>Np.call(this,i,o):i=>o.type.forEach(a=>Np.call(this,i,o,a))),this}getKeyword(t){let r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){let{RULES:r}=this;delete r.keywords[t],delete r.all[t];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===t);o>=0&&n.rules.splice(o,1)}return this}addFormat(t,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[t]=r,this}errorsText(t=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!t||t.length===0?"No errors":t.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(t,r){let n=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(let o of r){let i=o.split("/").slice(1),a=t;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=qy(l))}}return t}_removeAllSchemas(t,r){for(let n in t){let o=t[n];(!r||r.test(n))&&(typeof o=="string"?delete t[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete t[n]))}}_addSchema(t,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof t=="object")a=t[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(t);if(c!==void 0)return c;n=(0,ai.normalizeId)(a||n);let u=ai.getSchemaRefs.call(this,t,n);return c=new ii.SchemaEnv({schema:t,schemaId:s,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),i&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(t,!0),c}_checkUnique(t){if(this.schemas[t]||this.refs[t])throw new Error(`schema with key or id "${t}" already exists`)}_compileSchemaEnv(t){if(t.meta?this._compileMetaSchema(t):ii.compileSchema.call(this,t),!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){let r=this.opts;this.opts=this._metaOpts;try{ii.compileSchema.call(this,t)}finally{this.opts=r}}};si.ValidationError=UI.default;si.MissingRefError=My.default;Ie.default=si;function Ay(e,t,r,n="error"){for(let o in e){let i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function Uy(e){return e=(0,ai.normalizeId)(e),this.schemas[e]||this.refs[e]}function BI(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function WI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function GI(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function XI(){let e={...this.opts};for(let t of LI)delete e[t];return e}var YI={log(){},warn(){},error(){}};function QI(e){if(e===!1)return YI;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var eP=/^[a-z_$][a-z0-9_$:-]*$/i;function tP(e,t){let{RULES:r}=this;if((0,Rp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!eP.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Np(e,t,r){var n;let o=t?.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:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,ls.getJSONTypes)(t.type),schemaType:(0,ls.getJSONTypes)(t.schemaType)}};t.before?rP.call(this,a,s,t.before):a.rules.push(s),i.all[e]=s,(n=t.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function rP(e,t,r){let n=e.rules.findIndex(o=>o.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function nP(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=qy(t)),e.validateSchema=this.compile(t,!0))}var oP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function qy(e){return{anyOf:[e,oP]}}});var Vy=I(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var iP={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Cp.default=iP});var By=I(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.callRef=Tr.getValidate=void 0;var aP=ti(),Jy=lt(),Ge=W(),_n=Lt(),Hy=ns(),ds=re(),sP={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:n}=e,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Hy.resolveRef.call(c,u,o,r);if(l===void 0)throw new aP.default(n.opts.uriResolver,o,r);if(l instanceof Hy.SchemaEnv)return p(l);return f(l);function d(){if(i===u)return ps(e,a,i,i.$async);let m=t.scopeValue("root",{ref:u});return ps(e,(0,Ge._)`${m}.validate`,u,u.$async)}function p(m){let h=Ky(e,m);ps(e,h,m,m.$async)}function f(m){let h=t.scopeValue("schema",s.code.source===!0?{ref:m,code:(0,Ge.stringify)(m)}:{ref:m}),y=t.name("valid"),$=e.subschema({schema:m,dataTypes:[],schemaPath:Ge.nil,topSchemaRef:h,errSchemaPath:r},y);e.mergeEvaluated($),e.ok(y)}}};function Ky(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ge._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Tr.getValidate=Ky;function ps(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?_n.default.this:Ge.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let m=o.let("valid");o.try(()=>{o.code((0,Ge._)`await ${(0,Jy.callValidateCode)(e,t,u)}`),f(t),a||o.assign(m,!0)},h=>{o.if((0,Ge._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),p(h),a||o.assign(m,!1)}),e.ok(m)}function d(){e.result((0,Jy.callValidateCode)(e,t,u),()=>f(t),()=>p(t))}function p(m){let h=(0,Ge._)`${m}.errors`;o.assign(_n.default.vErrors,(0,Ge._)`${_n.default.vErrors} === null ? ${h} : ${_n.default.vErrors}.concat(${h})`),o.assign(_n.default.errors,(0,Ge._)`${_n.default.vErrors}.length`)}function f(m){var h;if(!i.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(i.props=ds.mergeEvaluated.props(o,y.props,i.props));else{let $=o.var("props",(0,Ge._)`${m}.evaluated.props`);i.props=ds.mergeEvaluated.props(o,$,i.props,Ge.Name)}if(i.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(i.items=ds.mergeEvaluated.items(o,y.items,i.items));else{let $=o.var("items",(0,Ge._)`${m}.evaluated.items`);i.items=ds.mergeEvaluated.items(o,$,i.items,Ge.Name)}}}Tr.callRef=ps;Tr.default=sP});var Wy=I(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var cP=Vy(),uP=By(),lP=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",cP.default,uP.default];Zp.default=lP});var Gy=I(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var fs=W(),ur=fs.operators,ms={maximum:{okStr:"<=",ok:ur.LTE,fail:ur.GT},minimum:{okStr:">=",ok:ur.GTE,fail:ur.LT},exclusiveMaximum:{okStr:"<",ok:ur.LT,fail:ur.GTE},exclusiveMinimum:{okStr:">",ok:ur.GT,fail:ur.LTE}},dP={message:({keyword:e,schemaCode:t})=>(0,fs.str)`must be ${ms[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,fs._)`{comparison: ${ms[e].okStr}, limit: ${t}}`},pP={keyword:Object.keys(ms),type:"number",schemaType:"number",$data:!0,error:dP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,fs._)`${r} ${ms[t].fail} ${n} || isNaN(${r})`)}};Ap.default=pP});var Xy=I(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var ci=W(),fP={message:({schemaCode:e})=>(0,ci.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ci._)`{multipleOf: ${e}}`},mP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:fP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,ci._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,ci._)`${a} !== parseInt(${a})`;e.fail$data((0,ci._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Up.default=mP});var Qy=I(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});function Yy(e){let t=e.length,r=0,n=0,o;for(;n<t;)r++,o=e.charCodeAt(n++),o>=55296&&o<=56319&&n<t&&(o=e.charCodeAt(n),(o&64512)===56320&&n++);return r}Mp.default=Yy;Yy.code='require("ajv/dist/runtime/ucs2length").default'});var e_=I(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var Er=W(),hP=re(),gP=Qy(),vP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Er.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Er._)`{limit: ${e}}`},yP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:vP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Er.operators.GT:Er.operators.LT,a=o.opts.unicode===!1?(0,Er._)`${r}.length`:(0,Er._)`${(0,hP.useFunc)(e.gen,gP.default)}(${r})`;e.fail$data((0,Er._)`${a} ${i} ${n}`)}};Fp.default=yP});var t_=I(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var _P=lt(),$P=re(),$n=W(),bP={message:({schemaCode:e})=>(0,$n.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,$n._)`{pattern: ${e}}`},xP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:bP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?(0,$n._)`new RegExp`:(0,$P.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,$n._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,$n._)`!${l}`)}else{let c=(0,_P.usePattern)(e,o);e.fail$data((0,$n._)`!${c}.test(${r})`)}}};qp.default=xP});var r_=I(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var ui=W(),kP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,ui.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,ui._)`{limit: ${e}}`},wP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:kP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?ui.operators.GT:ui.operators.LT;e.fail$data((0,ui._)`Object.keys(${r}).length ${o} ${n}`)}};Lp.default=wP});var n_=I(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var li=lt(),di=W(),SP=re(),zP={message:({params:{missingProperty:e}})=>(0,di.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,di._)`{missingProperty: ${e}}`},IP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:zP,code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let f=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if(f?.[h]===void 0&&!m.has(h)){let y=a.schemaEnv.baseId+a.errSchemaPath,$=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,SP.checkStrictMode)(a,$,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(di.nil,d);else for(let f of r)(0,li.checkReportMissingProp)(e,f)}function l(){let f=t.let("missing");if(c||i){let m=t.let("valid",!0);e.block$data(m,()=>p(f,m)),e.ok(m)}else t.if((0,li.checkMissingProp)(e,r,f)),(0,li.reportMissingProp)(e,f),t.else()}function d(){t.forOf("prop",n,f=>{e.setParams({missingProperty:f}),t.if((0,li.noPropertyInData)(t,o,f,s.ownProperties),()=>e.error())})}function p(f,m){e.setParams({missingProperty:f}),t.forOf(f,n,()=>{t.assign(m,(0,li.propertyInData)(t,o,f,s.ownProperties)),t.if((0,di.not)(m),()=>{e.error(),t.break()})},di.nil)}}};Vp.default=IP});var o_=I(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var pi=W(),PP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,pi.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,pi._)`{limit: ${e}}`},jP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:PP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?pi.operators.GT:pi.operators.LT;e.fail$data((0,pi._)`${r}.length ${o} ${n}`)}};Jp.default=jP});var hs=I(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var i_=sp();i_.code='require("ajv/dist/runtime/equal").default';Hp.default=i_});var a_=I(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var Kp=Go(),Pe=W(),TP=re(),EP=hs(),OP={message:({params:{i:e,j:t}})=>(0,Pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Pe._)`{i: ${e}, j: ${t}}`},DP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:OP,code(e){let{gen:t,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=e;if(!n&&!o)return;let c=t.let("valid"),u=i.items?(0,Kp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Pe._)`${a} === false`),e.ok(c);function l(){let m=t.let("i",(0,Pe._)`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,Pe._)`${m} > 1`,()=>(d()?p:f)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function p(m,h){let y=t.name("item"),$=(0,Kp.checkDataTypes)(u,y,s.opts.strictNumbers,Kp.DataType.Wrong),_=t.const("indices",(0,Pe._)`{}`);t.for((0,Pe._)`;${m}--;`,()=>{t.let(y,(0,Pe._)`${r}[${m}]`),t.if($,(0,Pe._)`continue`),u.length>1&&t.if((0,Pe._)`typeof ${y} == "string"`,(0,Pe._)`${y} += "_"`),t.if((0,Pe._)`typeof ${_}[${y}] == "number"`,()=>{t.assign(h,(0,Pe._)`${_}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,Pe._)`${_}[${y}] = ${m}`)})}function f(m,h){let y=(0,TP.useFunc)(t,EP.default),$=t.name("outer");t.label($).for((0,Pe._)`;${m}--;`,()=>t.for((0,Pe._)`${h} = ${m}; ${h}--;`,()=>t.if((0,Pe._)`${y}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break($)})))}}};Bp.default=DP});var s_=I(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var Wp=W(),NP=re(),RP=hs(),CP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Wp._)`{allowedValue: ${e}}`},ZP={keyword:"const",$data:!0,error:CP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Wp._)`!${(0,NP.useFunc)(t,RP.default)}(${r}, ${o})`):e.fail((0,Wp._)`${i} !== ${r}`)}};Gp.default=ZP});var c_=I(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var fi=W(),AP=re(),UP=hs(),MP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,fi._)`{allowedValues: ${e}}`},FP={keyword:"enum",schemaType:"array",$data:!0,error:MP,code(e){let{gen:t,data:r,$data:n,schema:o,schemaCode:i,it:a}=e;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,AP.useFunc)(t,UP.default)),l;if(s||n)l=t.let("valid"),e.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=t.const("vSchema",i);l=(0,fi.or)(...o.map((m,h)=>p(f,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,f=>t.if((0,fi._)`${u()}(${r}, ${f})`,()=>t.assign(l,!0).break()))}function p(f,m){let h=o[m];return typeof h=="object"&&h!==null?(0,fi._)`${u()}(${r}, ${f}[${m}])`:(0,fi._)`${r} === ${h}`}}};Xp.default=FP});var u_=I(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var qP=Gy(),LP=Xy(),VP=e_(),JP=t_(),HP=r_(),KP=n_(),BP=o_(),WP=a_(),GP=s_(),XP=c_(),YP=[qP.default,LP.default,VP.default,JP.default,HP.default,KP.default,BP.default,WP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},GP.default,XP.default];Yp.default=YP});var ef=I(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.validateAdditionalItems=void 0;var Or=W(),Qp=re(),QP={message:({params:{len:e}})=>(0,Or.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Or._)`{limit: ${e}}`},ej={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:QP,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Qp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}l_(e,n)}};function l_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Or._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Or._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Qp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Or._)`${s} <= ${t.length}`);r.if((0,Or.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Qp.Type.Num},u),a.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}mi.validateAdditionalItems=l_;mi.default=ej});var tf=I(hi=>{"use strict";Object.defineProperty(hi,"__esModule",{value:!0});hi.validateTuple=void 0;var d_=W(),gs=re(),tj=lt(),rj={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return p_(e,"additionalItems",t);r.items=!0,!(0,gs.alwaysValidSchema)(r,t)&&e.ok((0,tj.validateArray)(e))}};function p_(e,t,r=e.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=e;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=gs.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,d_._)`${i}.length`);r.forEach((d,p)=>{(0,gs.alwaysValidSchema)(s,d)||(n.if((0,d_._)`${u} > ${p}`,()=>e.subschema({keyword:a,schemaProp:p,dataProp:p},c)),e.ok(c))});function l(d){let{opts:p,errSchemaPath:f}=s,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(p.strictTuples&&!h){let y=`"${a}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${f}"`;(0,gs.checkStrictMode)(s,y,p.strictTuples)}}}hi.validateTuple=p_;hi.default=rj});var f_=I(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var nj=tf(),oj={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,nj.validateTuple)(e,"items")};rf.default=oj});var h_=I(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var m_=W(),ij=re(),aj=lt(),sj=ef(),cj={message:({params:{len:e}})=>(0,m_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,m_._)`{limit: ${e}}`},uj={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:cj,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,ij.alwaysValidSchema)(n,t)&&(o?(0,sj.validateAdditionalItems)(e,o):e.ok((0,aj.validateArray)(e)))}};nf.default=uj});var g_=I(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var pt=W(),vs=re(),lj={message:({params:{min:e,max:t}})=>t===void 0?(0,pt.str)`must contain at least ${e} valid item(s)`:(0,pt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,pt._)`{minContains: ${e}}`:(0,pt._)`{minContains: ${e}, maxContains: ${t}}`},dj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:lj,code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=t.const("len",(0,pt._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,vs.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,vs.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,vs.alwaysValidSchema)(i,r)){let h=(0,pt._)`${l} >= ${a}`;s!==void 0&&(h=(0,pt._)`${h} && ${l} <= ${s}`),e.pass(h);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?f(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,pt._)`${o}.length > 0`,p)):(t.let(d,!1),p()),e.result(d,()=>e.reset());function p(){let h=t.name("_valid"),y=t.let("count",0);f(h,()=>t.if(h,()=>m(y)))}function f(h,y){t.forRange("i",0,l,$=>{e.subschema({keyword:"contains",dataProp:$,dataPropType:vs.Type.Num,compositeRule:!0},h),y()})}function m(h){t.code((0,pt._)`${h}++`),s===void 0?t.if((0,pt._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,pt._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,pt._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};of.default=dj});var __=I(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateSchemaDeps=It.validatePropertyDeps=It.error=void 0;var af=W(),pj=re(),gi=lt();It.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,af.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,af._)`{property: ${e},
|
|
7
7
|
missingProperty: ${n},
|
|
8
8
|
depsCount: ${t},
|
|
9
|
-
deps: ${r}}`};var pj={keyword:"dependencies",type:"object",schemaType:"object",error:It.error,code(e){let[t,r]=fj(e);v_(e,t),y_(e,r)}};function fj({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let i=Array.isArray(e[n])?t:r;i[n]=e[n]}return[t,r]}function v_(e,t=e.schema){let{gen:r,data:n,it:i}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,go.propertyInData)(r,n,a,i.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),i.allErrors?r.if(c,()=>{for(let u of s)(0,go.checkReportMissingProp)(e,u)}):(r.if((0,af._)`${c} && (${(0,go.checkMissingProp)(e,s,o)})`),(0,go.reportMissingProp)(e,o),r.else())}}It.validatePropertyDeps=v_;function y_(e,t=e.schema){let{gen:r,data:n,keyword:i,it:o}=e,a=r.name("valid");for(let s in t)(0,dj.alwaysValidSchema)(o,t[s])||(r.if((0,go.propertyInData)(r,n,s,o.opts.ownProperties),()=>{let c=e.subschema({keyword:i,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}It.validateSchemaDeps=y_;It.default=pj});var b_=I(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var $_=W(),mj=re(),hj={message:"property name must be valid",params:({params:e})=>(0,$_._)`{propertyName: ${e.propertyName}}`},gj={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:hj,code(e){let{gen:t,schema:r,data:n,it:i}=e;if((0,mj.alwaysValidSchema)(i,r))return;let o=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},o),t.if((0,$_.not)(o),()=>{e.error(!0),i.allErrors||t.break()})}),e.ok(o)}};sf.default=gj});var uf=I(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var ys=lt(),$t=W(),vj=Lt(),_s=re(),yj={message:"must NOT have additional properties",params:({params:e})=>(0,$t._)`{additionalProperty: ${e.additionalProperty}}`},_j={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:yj,code(e){let{gen:t,schema:r,parentSchema:n,data:i,errsCount:o,it:a}=e;if(!o)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,_s.alwaysValidSchema)(a,r))return;let u=(0,ys.allSchemaProperties)(n.properties),l=(0,ys.allSchemaProperties)(n.patternProperties);d(),e.ok((0,$t._)`${o} === ${vj.default.errors}`);function d(){t.forIn("key",i,y=>{!u.length&&!l.length?m(y):t.if(p(y),()=>m(y))})}function p(y){let $;if(u.length>8){let _=(0,_s.schemaRefOrVal)(a,n.properties,"properties");$=(0,ys.isOwnProperty)(t,_,y)}else u.length?$=(0,$t.or)(...u.map(_=>(0,$t._)`${y} === ${_}`)):$=$t.nil;return l.length&&($=(0,$t.or)($,...l.map(_=>(0,$t._)`${(0,ys.usePattern)(e,_)}.test(${y})`))),(0,$t.not)($)}function f(y){t.code((0,$t._)`delete ${i}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,_s.alwaysValidSchema)(a,r)){let $=t.name("valid");c.removeAdditional==="failing"?(h(y,$,!1),t.if((0,$t.not)($),()=>{e.reset(),f(y)})):(h(y,$),s||t.if((0,$t.not)($),()=>t.break()))}}function h(y,$,_){let b={keyword:"additionalProperties",dataProp:y,dataPropType:_s.Type.Str};_===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,$)}}};cf.default=_j});var w_=I(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var $j=Qi(),x_=lt(),lf=re(),k_=uf(),bj={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:i,it:o}=e;o.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&k_.default.code(new $j.KeywordCxt(o,k_.default,"additionalProperties"));let a=(0,x_.allSchemaProperties)(r);for(let d of a)o.definedProperties.add(d);o.opts.unevaluated&&a.length&&o.props!==!0&&(o.props=lf.mergeEvaluated.props(t,(0,lf.toHash)(a),o.props));let s=a.filter(d=>!(0,lf.alwaysValidSchema)(o,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,x_.propertyInData)(t,i,d,o.opts.ownProperties)),l(d),o.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return o.opts.useDefaults&&!o.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};df.default=bj});var P_=I(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var S_=lt(),$s=W(),z_=re(),I_=re(),xj={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:i,it:o}=e,{opts:a}=o,s=(0,S_.allSchemaProperties)(r),c=s.filter(h=>(0,z_.alwaysValidSchema)(o,r[h]));if(s.length===0||c.length===s.length&&(!o.opts.unevaluated||o.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&i.properties,l=t.name("valid");o.props!==!0&&!(o.props instanceof $s.Name)&&(o.props=(0,I_.evaluatedPropsToName)(t,o.props));let{props:d}=o;p();function p(){for(let h of s)u&&f(h),o.allErrors?m(h):(t.var(l,!0),m(h),t.if(l))}function f(h){for(let y in u)new RegExp(h).test(y)&&(0,z_.checkStrictMode)(o,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",n,y=>{t.if((0,$s._)`${(0,S_.usePattern)(e,h)}.test(${y})`,()=>{let $=c.includes(h);$||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:I_.Type.Str},l),o.opts.unevaluated&&d!==!0?t.assign((0,$s._)`${d}[${y}]`,!0):!$&&!o.allErrors&&t.if((0,$s.not)(l),()=>t.break())})})}}};pf.default=xj});var j_=I(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});var kj=re(),wj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,kj.alwaysValidSchema)(n,r)){e.fail();return}let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};ff.default=wj});var T_=I(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var Sj=lt(),zj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Sj.validateUnion,error:{message:"must match a schema in anyOf"}};mf.default=zj});var E_=I(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var bs=W(),Ij=re(),Pj={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,bs._)`{passingSchemas: ${e.passing}}`},jj={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Pj,code(e){let{gen:t,schema:r,parentSchema:n,it:i}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let o=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((l,d)=>{let p;(0,Ij.alwaysValidSchema)(i,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,bs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,bs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),p&&e.mergeEvaluated(p,bs.Name)})})}}};hf.default=jj});var O_=I(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var Tj=re(),Ej={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=t.name("valid");r.forEach((o,a)=>{if((0,Tj.alwaysValidSchema)(n,o))return;let s=e.subschema({keyword:"allOf",schemaProp:a},i);e.ok(i),e.mergeEvaluated(s)})}};gf.default=Ej});var R_=I(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var xs=W(),N_=re(),Oj={message:({params:e})=>(0,xs.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,xs._)`{failingKeyword: ${e.ifClause}}`},Dj={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Oj,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,N_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=D_(n,"then"),o=D_(n,"else");if(!i&&!o)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),i&&o){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else i?t.if(s,u("then")):t.if((0,xs.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let p=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(p,a),d?t.assign(d,(0,xs._)`${l}`):e.setParams({ifClause:l})}}}};function D_(e,t){let r=e.schema[t];return r!==void 0&&!(0,N_.alwaysValidSchema)(e,r)}vf.default=Dj});var Z_=I(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var Nj=re(),Rj={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Nj.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};yf.default=Rj});var C_=I(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Zj=ef(),Cj=f_(),Aj=tf(),Uj=h_(),Mj=g_(),Fj=__(),qj=b_(),Lj=uf(),Vj=w_(),Jj=P_(),Kj=j_(),Hj=T_(),Bj=E_(),Wj=O_(),Gj=R_(),Xj=Z_();function Yj(e=!1){let t=[Kj.default,Hj.default,Bj.default,Wj.default,Gj.default,Xj.default,qj.default,Lj.default,Fj.default,Vj.default,Jj.default];return e?t.push(Cj.default,Uj.default):t.push(Zj.default,Aj.default),t.push(Mj.default),t}_f.default=Yj});var A_=I($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var $e=W(),Qj={message:({schemaCode:e})=>(0,$e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,$e._)`{format: ${e}}`},eT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Qj,code(e,t){let{gen:r,data:n,$data:i,schema:o,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;i?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,$e._)`${m}[${a}]`),y=r.let("fType"),$=r.let("format");r.if((0,$e._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,$e._)`${h}.type || "string"`).assign($,(0,$e._)`${h}.validate`),()=>r.assign(y,(0,$e._)`"string"`).assign($,h)),e.fail$data((0,$e.or)(_(),b()));function _(){return c.strictSchema===!1?$e.nil:(0,$e._)`${a} && !${$}`}function b(){let T=l.$async?(0,$e._)`(${h}.async ? await ${$}(${n}) : ${$}(${n}))`:(0,$e._)`${$}(${n})`,E=(0,$e._)`(typeof ${$} == "function" ? ${T} : ${$}.test(${n}))`;return(0,$e._)`${$} && ${$} !== true && ${y} === ${t} && !${E}`}}function f(){let m=d.formats[o];if(!m){_();return}if(m===!0)return;let[h,y,$]=b(m);h===t&&e.pass(T());function _(){if(c.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function b(E){let nt=E instanceof RegExp?(0,$e.regexpCode)(E):c.code.formats?(0,$e._)`${c.code.formats}${(0,$e.getProperty)(o)}`:void 0,Ae=r.scopeValue("formats",{key:o,ref:E,code:nt});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,$e._)`${Ae}.validate`]:["string",E,Ae]}function T(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,$e._)`await ${$}(${n})`}return typeof y=="function"?(0,$e._)`${$}(${n})`:(0,$e._)`${$}.test(${n})`}}}};$f.default=eT});var U_=I(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var tT=A_(),rT=[tT.default];bf.default=rT});var M_=I(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.contentVocabulary=bn.metadataVocabulary=void 0;bn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];bn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var q_=I(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});var nT=Wy(),iT=u_(),oT=C_(),aT=U_(),F_=M_(),sT=[nT.default,iT.default,(0,oT.default)(),aT.default,F_.metadataVocabulary,F_.contentVocabulary];xf.default=sT});var V_=I(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.DiscrError=void 0;var L_;(function(e){e.Tag="tag",e.Mapping="mapping"})(L_||(ks.DiscrError=L_={}))});var K_=I(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});var xn=W(),kf=V_(),J_=ns(),cT=eo(),uT=re(),lT={message:({params:{discrError:e,tagName:t}})=>e===kf.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,xn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},dT={keyword:"discriminator",type:"object",schemaType:"object",error:lT,code(e){let{gen:t,data:r,schema:n,parentSchema:i,it:o}=e,{oneOf:a}=i;if(!o.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 c=t.let("valid",!1),u=t.const("tag",(0,xn._)`${r}${(0,xn.getProperty)(s)}`);t.if((0,xn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:kf.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let f=p();t.if(!1);for(let m in f)t.elseIf((0,xn._)`${u} === ${m}`),t.assign(c,d(f[m]));t.else(),e.error(!1,{discrError:kf.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(f){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},m);return e.mergeEvaluated(h,xn.Name),m}function p(){var f;let m={},h=$(i),y=!0;for(let T=0;T<a.length;T++){let E=a[T];if(E?.$ref&&!(0,uT.schemaHasRulesButRef)(E,o.self.RULES)){let Ae=E.$ref;if(E=J_.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,Ae),E instanceof J_.SchemaEnv&&(E=E.schema),E===void 0)throw new cT.default(o.opts.uriResolver,o.baseId,Ae)}let nt=(f=E?.properties)===null||f===void 0?void 0:f[s];if(typeof nt!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(h||$(E)),_(nt,T)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return m;function $({required:T}){return Array.isArray(T)&&T.includes(s)}function _(T,E){if(T.const)b(T.const,E);else if(T.enum)for(let nt of T.enum)b(nt,E);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function b(T,E){if(typeof T!="string"||T in m)throw new Error(`discriminator: "${s}" values must be unique strings`);m[T]=E}}}};wf.default=dT});var H_=I((wU,pT)=>{pT.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 zf=I((ve,Sf)=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.MissingRefError=ve.ValidationError=ve.CodeGen=ve.Name=ve.nil=ve.stringify=ve.str=ve._=ve.KeywordCxt=ve.Ajv=void 0;var fT=Ly(),mT=q_(),hT=K_(),B_=H_(),gT=["/properties"],ws="http://json-schema.org/draft-07/schema",kn=class extends fT.default{_addVocabularies(){super._addVocabularies(),mT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(hT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(B_,gT):B_;this.addMetaSchema(t,ws,!1),this.refs["http://json-schema.org/schema"]=ws}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ws)?ws:void 0)}};ve.Ajv=kn;Sf.exports=ve=kn;Sf.exports.Ajv=kn;Object.defineProperty(ve,"__esModule",{value:!0});ve.default=kn;var vT=Qi();Object.defineProperty(ve,"KeywordCxt",{enumerable:!0,get:function(){return vT.KeywordCxt}});var wn=W();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return wn._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return wn.str}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return wn.stringify}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return wn.nil}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return wn.Name}});Object.defineProperty(ve,"CodeGen",{enumerable:!0,get:function(){return wn.CodeGen}});var yT=ts();Object.defineProperty(ve,"ValidationError",{enumerable:!0,get:function(){return yT.default}});var _T=eo();Object.defineProperty(ve,"MissingRefError",{enumerable:!0,get:function(){return _T.default}})});var r$=I(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.formatNames=jt.fastFormats=jt.fullFormats=void 0;function Pt(e,t){return{validate:e,compare:t}}jt.fullFormats={date:Pt(Y_,Tf),time:Pt(Pf(!0),Ef),"date-time":Pt(W_(!0),e$),"iso-time":Pt(Pf(),Q_),"iso-date-time":Pt(W_(),t$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:ST,"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:OT,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:zT,int32:{type:"number",validate:jT},int64:{type:"number",validate:TT},float:{type:"number",validate:X_},double:{type:"number",validate:X_},password:!0,binary:!0};jt.fastFormats={...jt.fullFormats,date:Pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Tf),time:Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ef),"date-time":Pt(/^\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,e$),"iso-time":Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Q_),"iso-date-time":Pt(/^\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,t$),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};jt.formatNames=Object.keys(jt.fullFormats);function $T(e){return e%4===0&&(e%100!==0||e%400===0)}var bT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,xT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Y_(e){let t=bT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],i=+t[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&$T(r)?29:xT[n])}function Tf(e,t){if(e&&t)return e>t?1:e<t?-1:0}var If=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Pf(e){return function(r){let n=If.exec(r);if(!n)return!1;let i=+n[1],o=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(i<=23&&o<=59&&a<60)return!0;let d=o-l*c,p=i-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function Ef(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function Q_(e,t){if(!(e&&t))return;let r=If.exec(e),n=If.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var jf=/t|\s/i;function W_(e){let t=Pf(e);return function(n){let i=n.split(jf);return i.length===2&&Y_(i[0])&&t(i[1])}}function e$(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function t$(e,t){if(!(e&&t))return;let[r,n]=e.split(jf),[i,o]=t.split(jf),a=Tf(r,i);if(a!==void 0)return a||Ef(n,o)}var kT=/\/|:/,wT=/^(?:[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 ST(e){return kT.test(e)&&wT.test(e)}var G_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function zT(e){return G_.lastIndex=0,G_.test(e)}var IT=-(2**31),PT=2**31-1;function jT(e){return Number.isInteger(e)&&e<=PT&&e>=IT}function TT(e){return Number.isInteger(e)}function X_(){return!0}var ET=/[^\\]\\Z/;function OT(e){if(ET.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var n$=I(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.formatLimitDefinition=void 0;var DT=zf(),bt=W(),lr=bt.operators,Ss={formatMaximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},formatMinimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},formatExclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},formatExclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},NT={message:({keyword:e,schemaCode:t})=>(0,bt.str)`should be ${Ss[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,bt._)`{comparison: ${Ss[e].okStr}, limit: ${t}}`};Sn.formatLimitDefinition={keyword:Object.keys(Ss),type:"string",schemaType:"string",$data:!0,error:NT,code(e){let{gen:t,data:r,schemaCode:n,keyword:i,it:o}=e,{opts:a,self:s}=o;if(!a.validateFormats)return;let c=new DT.KeywordCxt(o,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=t.const("fmt",(0,bt._)`${p}[${c.schemaCode}]`);e.fail$data((0,bt.or)((0,bt._)`typeof ${f} != "object"`,(0,bt._)`${f} instanceof RegExp`,(0,bt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=s.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${i}": format "${p}" does not define "compare" function`);let m=t.scopeValue("formats",{key:p,ref:f,code:a.code.formats?(0,bt._)`${a.code.formats}${(0,bt.getProperty)(p)}`:void 0});e.fail$data(d(m))}function d(p){return(0,bt._)`${p}.compare(${r}, ${n}) ${Ss[i].fail} 0`}},dependencies:["format"]};var RT=e=>(e.addKeyword(Sn.formatLimitDefinition),e);Sn.default=RT});var s$=I((vo,a$)=>{"use strict";Object.defineProperty(vo,"__esModule",{value:!0});var zn=r$(),ZT=n$(),Of=W(),i$=new Of.Name("fullFormats"),CT=new Of.Name("fastFormats"),Df=(e,t={keywords:!0})=>{if(Array.isArray(t))return o$(e,t,zn.fullFormats,i$),e;let[r,n]=t.mode==="fast"?[zn.fastFormats,CT]:[zn.fullFormats,i$],i=t.formats||zn.formatNames;return o$(e,i,r,n),t.keywords&&(0,ZT.default)(e),e};Df.get=(e,t="full")=>{let n=(t==="fast"?zn.fastFormats:zn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function o$(e,t,r,n){var i,o;(i=(o=e.opts.code).formats)!==null&&i!==void 0||(o.formats=(0,Of._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}a$.exports=vo=Df;Object.defineProperty(vo,"__esModule",{value:!0});vo.default=Df});var Ce=ft(require("path")),Pn=ft(require("fs"));var ee;(function(e){e.assertEqual=i=>{};function t(i){}e.assertIs=t;function r(i){throw new Error}e.assertNever=r,e.arrayToEnum=i=>{let o={};for(let a of i)o[a]=a;return o},e.getValidEnumValues=i=>{let o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(let s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let o=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(let a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(ee||(ee={}));var Mf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Mf||(Mf={}));var P=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Et=e=>{switch(typeof e){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(e)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(e)?P.array:e===null?P.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?P.promise:typeof Map<"u"&&e instanceof Map?P.map:typeof Set<"u"&&e instanceof Set?P.set:typeof Date<"u"&&e instanceof Date?P.date:P.object;default:return P.unknown}};var x=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 Xe=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||function(o){return o.message},n={_errors:[]},i=o=>{for(let a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return i(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r=Object.create(null),n=[];for(let i of this.issues)if(i.path.length>0){let o=i.path[0];r[o]=r[o]||[],r[o].push(t(i))}else n.push(t(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Xe.create=e=>new Xe(e);var T$=(e,t)=>{let r;switch(e.code){case x.invalid_type:e.received===P.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ee.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case x.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case x.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},Jt=T$;var E$=Jt;function On(){return E$}var $o=e=>{let{data:t,path:r,errorMaps:n,issueData:i}=e,o=[...r,...i.path||[]],a={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:s}};function S(e,t){let r=On(),n=$o({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Jt?void 0:Jt].filter(i=>!!i)});e.common.issues.push(n)}var Te=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let i of r){if(i.status==="aborted")return M;i.status==="dirty"&&t.dirty(),n.push(i.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let i of r){let o=await i.key,a=await i.value;n.push({key:o,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let i of r){let{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return M;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[o.value]=a.value)}return{status:t.value,value:n}}},M=Object.freeze({status:"aborted"}),Zr=e=>({status:"dirty",value:e}),Ue=e=>({status:"valid",value:e}),Rs=e=>e.status==="aborted",Zs=e=>e.status==="dirty",pr=e=>e.status==="valid",Dn=e=>typeof Promise<"u"&&e instanceof Promise;var O;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(O||(O={}));var it=class{constructor(t,r,n,i){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=i}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}},Ff=(e,t)=>{if(pr(t))return{success:!0,data:t.value};if(!e.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 Xe(e.common.issues);return this._error=r,this._error}}};function J(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:i}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:i}}var G=class{get description(){return this._def.description}_getType(t){return Et(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Te,ctx:{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Dn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},i=this._parseSync({data:t,path:n.path,parent:n});return Ff(n,i)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return pr(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:t,path:[],parent:r}).then(n=>pr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},i=this._parse({data:t,path:n.path,parent:n}),o=await(Dn(i)?i:Promise.resolve(i));return Ff(n,o)}refine(t,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,o)=>{let a=t(i),s=()=>o.addIssue({code:x.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,i)=>t(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(t){return new ht({schema:this,typeName:Z.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 mt.create(this,this._def)}nullable(){return Nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ht.create(this)}promise(){return fr.create(this,this._def)}or(t){return Fr.create([this,t],this._def)}and(t){return qr.create(this,t,this._def)}transform(t){return new ht({...J(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Hr({...J(this._def),innerType:this,defaultValue:r,typeName:Z.ZodDefault})}brand(){return new bo({typeName:Z.ZodBranded,type:this,...J(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Br({...J(this._def),innerType:this,catchValue:r,typeName:Z.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return xo.create(this,t)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},O$=/^c[^\s-]{8,}$/i,D$=/^[0-9a-z]+$/,N$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,R$=/^[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,Z$=/^[a-z0-9_-]{21}$/i,C$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A$=/^[-+]?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)?)??$/,U$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,M$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Cs,F$=/^(?:(?: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])$/,q$=/^(?:(?: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])$/,L$=/^(([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]))$/,V$=/^(([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])$/,J$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,K$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qf="((\\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])))",H$=new RegExp(`^${qf}$`);function Lf(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function B$(e){return new RegExp(`^${Lf(e)}$`)}function W$(e){let t=`${qf}T${Lf(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function G$(e,t){return!!((t==="v4"||!t)&&F$.test(e)||(t==="v6"||!t)&&L$.test(e))}function X$(e,t){if(!C$.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function Y$(e,t){return!!((t==="v4"||!t)&&q$.test(e)||(t==="v6"||!t)&&V$.test(e))}var Ar=class e extends G{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==P.string){let o=this._getOrReturnCtx(t);return S(o,{code:x.invalid_type,expected:P.string,received:o.parsedType}),M}let n=new Te,i;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(i=this._getOrReturnCtx(t,i),S(i,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(i=this._getOrReturnCtx(t,i),S(i,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let a=t.data.length>o.value,s=t.data.length<o.value;(a||s)&&(i=this._getOrReturnCtx(t,i),a?S(i,{code:x.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):s&&S(i,{code:x.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")U$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"email",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")Cs||(Cs=new RegExp(M$,"u")),Cs.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"emoji",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")R$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"uuid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Z$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"nanoid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")O$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"cuid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")D$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"cuid2",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")N$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"ulid",code:x.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),S(i,{validation:"url",code:x.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"regex",code:x.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(i=this._getOrReturnCtx(t,i),S(i,{code:x.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(i=this._getOrReturnCtx(t,i),S(i,{code:x.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(i=this._getOrReturnCtx(t,i),S(i,{code:x.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?W$(o).test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{code:x.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?H$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{code:x.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?B$(o).test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{code:x.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?A$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"duration",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?G$(t.data,o.version)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"ip",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?X$(t.data,o.alg)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"jwt",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?Y$(t.data,o.version)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"cidr",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?J$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"base64",code:x.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?K$.test(t.data)||(i=this._getOrReturnCtx(t,i),S(i,{validation:"base64url",code:x.invalid_string,message:o.message}),n.dirty()):ee.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(i=>t.test(i),{validation:r,code:x.invalid_string,...O.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...O.errToObj(t)})}url(t){return this._addCheck({kind:"url",...O.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...O.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...O.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...O.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...O.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...O.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...O.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...O.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...O.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...O.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...O.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...O.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...O.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...O.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...O.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...O.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...O.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...O.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...O.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...O.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...O.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...O.errToObj(r)})}nonempty(t){return this.min(1,O.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ar.create=e=>new Ar({checks:[],typeName:Z.ZodString,coerce:e?.coerce??!1,...J(e)});function Q$(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,i=r>n?r:n,o=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return o%a/10**i}var Nn=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==P.number){let o=this._getOrReturnCtx(t);return S(o,{code:x.invalid_type,expected:P.number,received:o.parsedType}),M}let n,i=new Te;for(let o of this._def.checks)o.kind==="int"?ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),S(n,{code:x.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Q$(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),S(n,{code:x.not_finite,message:o.message}),i.dirty()):ee.assertNever(o);return{status:i.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:O.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:O.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ee.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Nn.create=e=>new Nn({checks:[],typeName:Z.ZodNumber,coerce:e?.coerce||!1,...J(e)});var Rn=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==P.bigint)return this._getInvalidInput(t);let n,i=new Te;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):ee.assertNever(o);return{status:i.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return S(r,{code:x.invalid_type,expected:P.bigint,received:r.parsedType}),M}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Rn.create=e=>new Rn({checks:[],typeName:Z.ZodBigInt,coerce:e?.coerce??!1,...J(e)});var Zn=class extends G{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==P.boolean){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.boolean,received:n.parsedType}),M}return Ue(t.data)}};Zn.create=e=>new Zn({typeName:Z.ZodBoolean,coerce:e?.coerce||!1,...J(e)});var Cn=class e extends G{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==P.date){let o=this._getOrReturnCtx(t);return S(o,{code:x.invalid_type,expected:P.date,received:o.parsedType}),M}if(Number.isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return S(o,{code:x.invalid_date}),M}let n=new Te,i;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(i=this._getOrReturnCtx(t,i),S(i,{code:x.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(i=this._getOrReturnCtx(t,i),S(i,{code:x.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):ee.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:O.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:O.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Cn.create=e=>new Cn({checks:[],coerce:e?.coerce||!1,typeName:Z.ZodDate,...J(e)});var An=class extends G{_parse(t){if(this._getType(t)!==P.symbol){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.symbol,received:n.parsedType}),M}return Ue(t.data)}};An.create=e=>new An({typeName:Z.ZodSymbol,...J(e)});var Ur=class extends G{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.undefined,received:n.parsedType}),M}return Ue(t.data)}};Ur.create=e=>new Ur({typeName:Z.ZodUndefined,...J(e)});var Mr=class extends G{_parse(t){if(this._getType(t)!==P.null){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.null,received:n.parsedType}),M}return Ue(t.data)}};Mr.create=e=>new Mr({typeName:Z.ZodNull,...J(e)});var Un=class extends G{constructor(){super(...arguments),this._any=!0}_parse(t){return Ue(t.data)}};Un.create=e=>new Un({typeName:Z.ZodAny,...J(e)});var Kt=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ue(t.data)}};Kt.create=e=>new Kt({typeName:Z.ZodUnknown,...J(e)});var xt=class extends G{_parse(t){let r=this._getOrReturnCtx(t);return S(r,{code:x.invalid_type,expected:P.never,received:r.parsedType}),M}};xt.create=e=>new xt({typeName:Z.ZodNever,...J(e)});var Mn=class extends G{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.void,received:n.parsedType}),M}return Ue(t.data)}};Mn.create=e=>new Mn({typeName:Z.ZodVoid,...J(e)});var Ht=class e extends G{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),i=this._def;if(r.parsedType!==P.array)return S(r,{code:x.invalid_type,expected:P.array,received:r.parsedType}),M;if(i.exactLength!==null){let a=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(a||s)&&(S(r,{code:a?x.too_big:x.too_small,minimum:s?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(S(r,{code:x.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(S(r,{code:x.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,s)=>i.type._parseAsync(new it(r,a,r.path,s)))).then(a=>Te.mergeArray(n,a));let o=[...r.data].map((a,s)=>i.type._parseSync(new it(r,a,r.path,s)));return Te.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:O.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:O.toString(r)}})}nonempty(t){return this.min(1,t)}};Ht.create=(e,t)=>new Ht({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...J(t)});function Cr(e){if(e instanceof Ye){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=mt.create(Cr(n))}return new Ye({...e._def,shape:()=>t})}else return e instanceof Ht?new Ht({...e._def,type:Cr(e.element)}):e instanceof mt?mt.create(Cr(e.unwrap())):e instanceof Nt?Nt.create(Cr(e.unwrap())):e instanceof Dt?Dt.create(e.items.map(t=>Cr(t))):e}var Ye=class e 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 t=this._def.shape(),r=ee.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==P.object){let u=this._getOrReturnCtx(t);return S(u,{code:x.invalid_type,expected:P.object,received:u.parsedType}),M}let{status:n,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xt&&this._def.unknownKeys==="strip"))for(let u in i.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=o[u],d=i.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new it(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof xt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:i.data[l]}});else if(u==="strict")s.length>0&&(S(i,{code:x.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=i.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new it(i,d,i.path,l)),alwaysSet:l in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Te.mergeObjectSync(n,u)):Te.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return O.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Z.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of ee.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of ee.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Cr(this)}partial(t){let r={};for(let n of ee.objectKeys(this.shape)){let i=this.shape[n];t&&!t[n]?r[n]=i:r[n]=i.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ee.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof mt;)o=o._def.innerType;r[n]=o}return new e({...this._def,shape:()=>r})}keyof(){return Vf(ee.objectKeys(this.shape))}};Ye.create=(e,t)=>new Ye({shape:()=>e,unknownKeys:"strip",catchall:xt.create(),typeName:Z.ZodObject,...J(t)});Ye.strictCreate=(e,t)=>new Ye({shape:()=>e,unknownKeys:"strict",catchall:xt.create(),typeName:Z.ZodObject,...J(t)});Ye.lazycreate=(e,t)=>new Ye({shape:e,unknownKeys:"strip",catchall:xt.create(),typeName:Z.ZodObject,...J(t)});var Fr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function i(o){for(let s of o)if(s.result.status==="valid")return s.result;for(let s of o)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=o.map(s=>new Xe(s.ctx.common.issues));return S(r,{code:x.invalid_union,unionErrors:a}),M}if(r.common.async)return Promise.all(n.map(async o=>{let a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(i);{let o,a=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!o&&(o={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let s=a.map(c=>new Xe(c));return S(r,{code:x.invalid_union,unionErrors:s}),M}}get options(){return this._def.options}};Fr.create=(e,t)=>new Fr({options:e,typeName:Z.ZodUnion,...J(t)});var Ot=e=>e instanceof Lr?Ot(e.schema):e instanceof ht?Ot(e.innerType()):e instanceof Vr?[e.value]:e instanceof Jr?e.options:e instanceof Kr?ee.objectValues(e.enum):e instanceof Hr?Ot(e._def.innerType):e instanceof Ur?[void 0]:e instanceof Mr?[null]:e instanceof mt?[void 0,...Ot(e.unwrap())]:e instanceof Nt?[null,...Ot(e.unwrap())]:e instanceof bo||e instanceof Wr?Ot(e.unwrap()):e instanceof Br?Ot(e._def.innerType):[],As=class e extends G{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.object)return S(r,{code:x.invalid_type,expected:P.object,received:r.parsedType}),M;let n=this.discriminator,i=r.data[n],o=this.optionsMap.get(i);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(S(r,{code:x.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(t,r,n){let i=new Map;for(let o of r){let a=Ot(o.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new e({typeName:Z.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:i,...J(n)})}};function Us(e,t){let r=Et(e),n=Et(t);if(e===t)return{valid:!0,data:e};if(r===P.object&&n===P.object){let i=ee.objectKeys(t),o=ee.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(let s of o){let c=Us(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===P.array&&n===P.array){if(e.length!==t.length)return{valid:!1};let i=[];for(let o=0;o<e.length;o++){let a=e[o],s=t[o],c=Us(a,s);if(!c.valid)return{valid:!1};i.push(c.data)}return{valid:!0,data:i}}else return r===P.date&&n===P.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var qr=class extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=(o,a)=>{if(Rs(o)||Rs(a))return M;let s=Us(o.value,a.value);return s.valid?((Zs(o)||Zs(a))&&r.dirty(),{status:r.value,value:s.data}):(S(n,{code:x.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(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};qr.create=(e,t,r)=>new qr({left:e,right:t,typeName:Z.ZodIntersection,...J(r)});var Dt=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.array)return S(n,{code:x.invalid_type,expected:P.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return S(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new it(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(o).then(a=>Te.mergeArray(r,a)):Te.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Dt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:e,typeName:Z.ZodTuple,rest:null,...J(t)})};var Ms=class e extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.object)return S(n,{code:x.invalid_type,expected:P.object,received:n.parsedType}),M;let i=[],o=this._def.keyType,a=this._def.valueType;for(let s in n.data)i.push({key:o._parse(new it(n,s,n.path,s)),value:a._parse(new it(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Te.mergeObjectAsync(r,i):Te.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof G?new e({keyType:t,valueType:r,typeName:Z.ZodRecord,...J(n)}):new e({keyType:Ar.create(),valueType:t,typeName:Z.ZodRecord,...J(r)})}},Fn=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.map)return S(n,{code:x.invalid_type,expected:P.map,received:n.parsedType}),M;let i=this._def.keyType,o=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:i._parse(new it(n,s,n.path,[u,"key"])),value:o._parse(new it(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Fn.create=(e,t,r)=>new Fn({valueType:t,keyType:e,typeName:Z.ZodMap,...J(r)});var qn=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.set)return S(n,{code:x.invalid_type,expected:P.set,received:n.parsedType}),M;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(S(n,{code:x.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(S(n,{code:x.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let o=this._def.valueType;function a(c){let u=new Set;for(let l of c){if(l.status==="aborted")return M;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>o._parse(new it(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:O.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};qn.create=(e,t)=>new qn({valueType:e,minSize:null,maxSize:null,typeName:Z.ZodSet,...J(t)});var Fs=class e extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.function)return S(r,{code:x.invalid_type,expected:P.function,received:r.parsedType}),M;function n(s,c){return $o({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Jt].filter(u=>!!u),issueData:{code:x.invalid_arguments,argumentsError:c}})}function i(s,c){return $o({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Jt].filter(u=>!!u),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let o={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof fr){let s=this;return Ue(async function(...c){let u=new Xe([]),l=await s._def.args.parseAsync(c,o).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,o).catch(f=>{throw u.addIssue(i(d,f)),u})})}else{let s=this;return Ue(function(...c){let u=s._def.args.safeParse(c,o);if(!u.success)throw new Xe([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,o);if(!d.success)throw new Xe([i(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Dt.create(t).rest(Kt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Dt.create([]).rest(Kt.create()),returns:r||Kt.create(),typeName:Z.ZodFunction,...J(n)})}},Lr=class extends G{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Lr.create=(e,t)=>new Lr({getter:e,typeName:Z.ZodLazy,...J(t)});var Vr=class extends G{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return S(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:t.data}}get value(){return this._def.value}};Vr.create=(e,t)=>new Vr({value:e,typeName:Z.ZodLiteral,...J(t)});function Vf(e,t){return new Jr({values:e,typeName:Z.ZodEnum,...J(t)})}var Jr=class e extends G{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return S(r,{expected:ee.joinValues(n),received:r.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return S(r,{received:r.data,code:x.invalid_enum_value,options:n}),M}return Ue(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Jr.create=Vf;var Kr=class extends G{_parse(t){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==P.string&&n.parsedType!==P.number){let i=ee.objectValues(r);return S(n,{expected:ee.joinValues(i),received:n.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let i=ee.objectValues(r);return S(n,{received:n.data,code:x.invalid_enum_value,options:i}),M}return Ue(t.data)}get enum(){return this._def.values}};Kr.create=(e,t)=>new Kr({values:e,typeName:Z.ZodNativeEnum,...J(t)});var fr=class extends G{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.promise&&r.common.async===!1)return S(r,{code:x.invalid_type,expected:P.promise,received:r.parsedType}),M;let n=r.parsedType===P.promise?r.data:Promise.resolve(r.data);return Ue(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fr.create=(e,t)=>new fr({type:e,typeName:Z.ZodPromise,...J(t)});var ht=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{S(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){let a=i.transform(n.data,o);if(n.common.async)return Promise.resolve(a).then(async s=>{if(r.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?Zr(c.value):r.value==="dirty"?Zr(c.value):c});{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"?Zr(s.value):r.value==="dirty"?Zr(s.value):s}}if(i.type==="refinement"){let a=s=>{let c=i.refinement(s,o);if(n.common.async)return Promise.resolve(c);if(c 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(i.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!pr(a))return M;let s=i.transform(a.value,o);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=>pr(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:r.value,value:s})):M);ee.assertNever(i)}};ht.create=(e,t,r)=>new ht({schema:e,typeName:Z.ZodEffects,effect:t,...J(r)});ht.createWithPreprocess=(e,t,r)=>new ht({schema:t,effect:{type:"preprocess",transform:e},typeName:Z.ZodEffects,...J(r)});var mt=class extends G{_parse(t){return this._getType(t)===P.undefined?Ue(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:Z.ZodOptional,...J(t)});var Nt=class extends G{_parse(t){return this._getType(t)===P.null?Ue(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:Z.ZodNullable,...J(t)});var Hr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===P.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Hr.create=(e,t)=>new Hr({innerType:e,typeName:Z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});var Br=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Dn(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Xe(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Xe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Br.create=(e,t)=>new Br({innerType:e,typeName:Z.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});var Ln=class extends G{_parse(t){if(this._getType(t)!==P.nan){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.nan,received:n.parsedType}),M}return{status:"valid",value:t.data}}};Ln.create=e=>new Ln({typeName:Z.ZodNaN,...J(e)});var bo=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},xo=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?M:o.status==="dirty"?(r.dirty(),Zr(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?M:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:Z.ZodPipeline})}},Wr=class extends G{_parse(t){let r=this._def.innerType._parse(t),n=i=>(pr(i)&&(i.value=Object.freeze(i.value)),i);return Dn(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:Z.ZodReadonly,...J(t)});var fE={object:Ye.lazycreate},Z;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Z||(Z={}));var mE=Ar.create,hE=Nn.create,gE=Ln.create,vE=Rn.create,yE=Zn.create,_E=Cn.create,$E=An.create,bE=Ur.create,xE=Mr.create,kE=Un.create,wE=Kt.create,SE=xt.create,zE=Mn.create,IE=Ht.create,eb=Ye.create,PE=Ye.strictCreate,jE=Fr.create,TE=As.create,EE=qr.create,OE=Dt.create,DE=Ms.create,NE=Fn.create,RE=qn.create,ZE=Fs.create,CE=Lr.create,AE=Vr.create,UE=Jr.create,ME=Kr.create,FE=fr.create,qE=ht.create,LE=mt.create,VE=Nt.create,JE=ht.createWithPreprocess,KE=xo.create;var Jf=Object.freeze({status:"aborted"});function g(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(s){var c;let u=r?.Parent?new o:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}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(e)}),Object.defineProperty(a,"name",{value:e}),a}var kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},mr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ko={};function xe(e){return e&&Object.assign(ko,e),ko}var k={};En(k,{BIGINT_FORMAT_RANGES:()=>Xs,Class:()=>Ls,NUMBER_FORMAT_RANGES:()=>Gs,aborted:()=>Xt,allowsEval:()=>Ks,assert:()=>sb,assertEqual:()=>nb,assertIs:()=>ob,assertNever:()=>ab,assertNotEqual:()=>ib,assignProp:()=>Wt,base64ToUint8Array:()=>Qf,base64urlToUint8Array:()=>yb,cached:()=>Xr,captureStackTrace:()=>So,cleanEnum:()=>vb,cleanRegex:()=>Kn,clone:()=>Me,cloneDef:()=>ub,createTransparentProxy:()=>hb,defineLazy:()=>K,esc:()=>wo,escapeRegex:()=>ot,extend:()=>Wf,finalizeIssue:()=>Ke,floatSafeRemainder:()=>Vs,getElementAtPath:()=>lb,getEnumValues:()=>Jn,getLengthableOrigin:()=>Wn,getParsedType:()=>mb,getSizableOrigin:()=>Bn,hexToUint8Array:()=>$b,isObject:()=>hr,isPlainObject:()=>Gt,issue:()=>Yr,joinValues:()=>C,jsonStringifyReplacer:()=>Gr,merge:()=>gb,mergeDefs:()=>Rt,normalizeParams:()=>z,nullish:()=>Bt,numKeys:()=>fb,objectClone:()=>cb,omit:()=>Bf,optionalKeys:()=>Ws,parsedType:()=>F,partial:()=>Xf,pick:()=>Hf,prefixIssues:()=>Qe,primitiveTypes:()=>Bs,promiseAllObject:()=>db,propertyKeyTypes:()=>Hn,randomString:()=>pb,required:()=>Yf,safeExtend:()=>Gf,shallowClone:()=>Hs,slugify:()=>Js,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>em,uint8ArrayToBase64url:()=>_b,uint8ArrayToHex:()=>bb,unwrapMessage:()=>Vn});function nb(e){return e}function ib(e){return e}function ob(e){}function ab(e){throw new Error("Unexpected value in exhaustive check")}function sb(e){}function Jn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function C(e,t="|"){return e.map(r=>A(r)).join(t)}function Gr(e,t){return typeof t=="bigint"?t.toString():t}function Xr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Bt(e){return e==null}function Kn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Vs(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(i=Number.parseInt(c[1]))}let o=r>i?r:i,a=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return a%s/10**o}var Kf=Symbol("evaluating");function K(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Kf)return n===void 0&&(n=Kf,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function cb(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Wt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Rt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ub(e){return Rt(e._zod.def)}function lb(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function db(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function pb(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function wo(e){return JSON.stringify(e)}function Js(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var So="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ks=Xr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gt(e){if(hr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(hr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Hs(e){return Gt(e)?{...e}:Array.isArray(e)?[...e]:e}function fb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var mb=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Hn=new Set(["string","number","symbol"]),Bs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ot(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Me(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function z(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function hb(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function A(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ws(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Gs={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]},Xs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Hf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=Rt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Wt(this,"shape",a),a},checks:[]});return Me(e,o)}function Bf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=Rt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Wt(this,"shape",a),a},checks:[]});return Me(e,o)}function Wf(e,t){if(!Gt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=Rt(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return Wt(this,"shape",o),o}});return Me(e,i)}function Gf(e,t){if(!Gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Wt(this,"shape",n),n}});return Me(e,r)}function gb(e,t){let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Wt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Me(e,r)}function Xf(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Rt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Wt(this,"shape",c),c},checks:[]});return Me(t,a)}function Yf(e,t,r){let n=Rt(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(let a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return Wt(this,"shape",o),o}});return Me(t,n)}function Xt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Qe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Vn(e){return typeof e=="string"?e:e?.message}function Ke(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=Vn(e.inst?._zod.def?.error?.(e))??Vn(t?.error?.(e))??Vn(r.customError?.(e))??Vn(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Bn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Wn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function F(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Yr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function vb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Qf(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function em(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function yb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Qf(t+r)}function _b(e){return em(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function $b(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function bb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ls=class{constructor(...t){}};var tm=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Gr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},zo=g("$ZodError",tm),Gn=g("$ZodError",tm,{Parent:Error});function Io(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function Po(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let a=r,s=0;for(;s<o.path.length;){let c=o.path[s];s===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(o))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Xn=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new kt;if(a.issues.length){let s=new(i?.Err??e)(a.issues.map(c=>Ke(c,o,xe())));throw So(s,i?.callee),s}return a.value},Yn=Xn(Gn),Qn=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(i?.Err??e)(a.issues.map(c=>Ke(c,o,xe())));throw So(s,i?.callee),s}return a.value},ei=Qn(Gn),ti=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new kt;return o.issues.length?{success:!1,error:new(e??zo)(o.issues.map(a=>Ke(a,i,xe())))}:{success:!0,data:o.value}},Qr=ti(Gn),ri=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>Ke(a,i,xe())))}:{success:!0,data:o.value}},ni=ri(Gn),rm=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,i)};var nm=e=>(t,r,n)=>Xn(e)(t,r,n);var im=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qn(e)(t,r,i)};var om=e=>async(t,r,n)=>Qn(e)(t,r,n);var am=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ti(e)(t,r,i)};var sm=e=>(t,r,n)=>ti(e)(t,r,n);var cm=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ri(e)(t,r,i)};var um=e=>async(t,r,n)=>ri(e)(t,r,n);var at={};En(at,{base64:()=>fc,base64url:()=>jo,bigint:()=>_c,boolean:()=>bc,browserEmail:()=>Tb,cidrv4:()=>dc,cidrv6:()=>pc,cuid:()=>Ys,cuid2:()=>Qs,date:()=>hc,datetime:()=>vc,domain:()=>Db,duration:()=>ic,e164:()=>mc,email:()=>ac,emoji:()=>sc,extendedDuration:()=>kb,guid:()=>oc,hex:()=>Nb,hostname:()=>Ob,html5Email:()=>Ib,idnEmail:()=>jb,integer:()=>$c,ipv4:()=>cc,ipv6:()=>uc,ksuid:()=>rc,lowercase:()=>wc,mac:()=>lc,md5_base64:()=>Zb,md5_base64url:()=>Cb,md5_hex:()=>Rb,nanoid:()=>nc,null:()=>xc,number:()=>To,rfc5322Email:()=>Pb,sha1_base64:()=>Ub,sha1_base64url:()=>Mb,sha1_hex:()=>Ab,sha256_base64:()=>qb,sha256_base64url:()=>Lb,sha256_hex:()=>Fb,sha384_base64:()=>Jb,sha384_base64url:()=>Kb,sha384_hex:()=>Vb,sha512_base64:()=>Bb,sha512_base64url:()=>Wb,sha512_hex:()=>Hb,string:()=>yc,time:()=>gc,ulid:()=>ec,undefined:()=>kc,unicodeEmail:()=>lm,uppercase:()=>Sc,uuid:()=>gr,uuid4:()=>wb,uuid6:()=>Sb,uuid7:()=>zb,xid:()=>tc});var Ys=/^[cC][^\s-]{8,}$/,Qs=/^[0-9a-z]+$/,ec=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tc=/^[0-9a-vA-V]{20}$/,rc=/^[A-Za-z0-9]{27}$/,nc=/^[a-zA-Z0-9_-]{21}$/,ic=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,kb=/^[-+]?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)?)??$/,oc=/^([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})$/,gr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/,wb=gr(4),Sb=gr(6),zb=gr(7),ac=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ib=/^[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])?)*$/,Pb=/^(([^<>()\[\]\\.,;:\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,}))$/,lm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,jb=lm,Tb=/^[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])?)*$/,Eb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function sc(){return new RegExp(Eb,"u")}var cc=/^(?:(?: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])$/,uc=/^(([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}|:))$/,lc=e=>{let t=ot(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},dc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,pc=/^(([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])$/,fc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jo=/^[A-Za-z0-9_-]*$/,Ob=/^(?=.{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])?)*\.?$/,Db=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,mc=/^\+[1-9]\d{6,14}$/,dm="(?:(?:\\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])))",hc=new RegExp(`^${dm}$`);function pm(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gc(e){return new RegExp(`^${pm(e)}$`)}function vc(e){let t=pm({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${dm}T(?:${n})$`)}var yc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},_c=/^-?\d+n?$/,$c=/^-?\d+$/,To=/^-?\d+(?:\.\d+)?$/,bc=/^(?:true|false)$/i,xc=/^null$/i;var kc=/^undefined$/i;var wc=/^[^A-Z]*$/,Sc=/^[^a-z]*$/,Nb=/^[0-9a-fA-F]*$/;function ii(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function oi(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Rb=/^[0-9a-fA-F]{32}$/,Zb=ii(22,"=="),Cb=oi(22),Ab=/^[0-9a-fA-F]{40}$/,Ub=ii(27,"="),Mb=oi(27),Fb=/^[0-9a-fA-F]{64}$/,qb=ii(43,"="),Lb=oi(43),Vb=/^[0-9a-fA-F]{96}$/,Jb=ii(64,""),Kb=oi(64),Hb=/^[0-9a-fA-F]{128}$/,Bb=ii(86,"=="),Wb=oi(86);var ue=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),mm={number:"number",bigint:"bigint",object:"date"},zc=g("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let r=mm[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ic=g("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=mm[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hm=g("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Vs(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),gm=g("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Gs[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=i,s.maximum=o,r&&(s.pattern=$c)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});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:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<i&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),vm=g("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[r,n]=Xs[t.format];e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,o.minimum=r,o.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),ym=g("$ZodCheckMaxSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Bt(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:Bn(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),_m=g("$ZodCheckMinSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Bt(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:Bn(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),$m=g("$ZodCheckSizeEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Bt(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,o=i.size;if(o===t.size)return;let a=o>t.size;n.issues.push({origin:Bn(i),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),bm=g("$ZodCheckMaxLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Bt(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let a=Wn(i);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xm=g("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Bt(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let a=Wn(i);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),km=g("$ZodCheckLengthEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!Bt(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let a=Wn(i),s=o>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ai=g("$ZodCheckStringFormat",(e,t)=>{var r,n;ue.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),wm=g("$ZodCheckRegex",(e,t)=>{ai.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Sm=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=wc),ai.init(e,t)}),zm=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Sc),ai.init(e,t)}),Im=g("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let r=ot(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),Pm=g("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`^${ot(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jm=g("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`.*${ot(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function fm(e,t,r){e.issues.length&&t.issues.push(...Qe(r,e.issues))}var Tm=g("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>fm(i,r,t.property));fm(n,r,t.property)}}),Em=g("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Om=g("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Eo=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
10
|
-
`).filter(a=>a),
|
|
11
|
-
`))}};var Nm={major:4,minor:3,patch:6};var V=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Nm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,s,c)=>{let u=Xt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new kt;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(u||(u=Xt(a,p)))});else{if(a.issues.length===p)continue;u||(u=Xt(a,p))}}return l?l.then(()=>a):a},o=(a,s,c)=>{if(Xt(a))return a.aborted=!0,a;let u=i(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new kt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>o(l,a,s)):o(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new kt;return c.then(u=>i(u,n,s))}return i(c,n,s)}}K(e,"~standard",()=>({validate:i=>{try{let o=Qr(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return ni(e,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),vr=g("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??yc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.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:e}),r}}),ae=g("$ZodStringFormat",(e,t)=>{ai.init(e,t),vr.init(e,t)}),jc=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=oc),ae.init(e,t)}),Tc=g("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gr(n))}else t.pattern??(t.pattern=gr());ae.init(e,t)}),Ec=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ac),ae.init(e,t)}),Oc=g("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Dc=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=sc()),ae.init(e,t)}),Nc=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=nc),ae.init(e,t)}),Rc=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ys),ae.init(e,t)}),Zc=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Qs),ae.init(e,t)}),Cc=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ec),ae.init(e,t)}),Ac=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=tc),ae.init(e,t)}),Uc=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=rc),ae.init(e,t)}),Mc=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=vc(t)),ae.init(e,t)}),Fc=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=hc),ae.init(e,t)}),qc=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gc(t)),ae.init(e,t)}),Lc=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ic),ae.init(e,t)}),Vc=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=cc),ae.init(e,t),e._zod.bag.format="ipv4"}),Jc=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=uc),ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Kc=g("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=lc(t.delimiter)),ae.init(e,t),e._zod.bag.format="mac"}),Hc=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=dc),ae.init(e,t)}),Bc=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=pc),ae.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Km(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Wc=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=fc),ae.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Km(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Gb(e){if(!jo.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Km(r)}var Gc=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=jo),ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Gb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Xc=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=mc),ae.init(e,t)});function Xb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var Yc=g("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=r=>{Xb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Qc=g("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Co=g("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??To,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),eu=g("$ZodNumberFormat",(e,t)=>{gm.init(e,t),Co.init(e,t)}),si=g("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=bc,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Ao=g("$ZodBigInt",(e,t)=>{V.init(e,t),e._zod.pattern=_c,e._zod.parse=(r,n)=>{if(t.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:e}),r}}),tu=g("$ZodBigIntFormat",(e,t)=>{vm.init(e,t),Ao.init(e,t)}),ru=g("$ZodSymbol",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:e}),r}}),nu=g("$ZodUndefined",(e,t)=>{V.init(e,t),e._zod.pattern=kc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),iu=g("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=xc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),ou=g("$ZodAny",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),au=g("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),su=g("$ZodNever",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),cu=g("$ZodVoid",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),uu=g("$ZodDate",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function Rm(e,t,r){e.issues.length&&t.issues.push(...Qe(r,e.issues)),t.value[r]=e.value}var lu=g("$ZodArray",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let s=i[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?o.push(c.then(u=>Rm(u,r,a))):Rm(c,r,a)}return o.length?Promise.all(o).then(()=>r):r}});function Zo(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...Qe(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Hm(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ws(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Bm(e,t,r,n,i,o){let a=[],s=i.keySet,c=i.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:t[d],issues:[]},n);p instanceof Promise?e.push(p.then(f=>Zo(f,r,d,t,l))):Zo(p,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var Wm=g("$ZodObject",(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Xr(()=>Hm(t));K(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let i=hr,o=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!i(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let f=d[p],m=f._zod.optout==="optional",h=f._zod.run({value:u[p],issues:[]},c);h instanceof Promise?l.push(h.then(y=>Zo(y,s,p,u,m))):Zo(h,s,p,u,m)}return o?Bm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Gm=g("$ZodObjectJIT",(e,t)=>{Wm.init(e,t);let r=e._zod.parse,n=Xr(()=>Hm(t)),i=p=>{let f=new Eo(["shape","payload","ctx"]),m=n.value,h=b=>{let T=wo(b);return`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),$=0;for(let b of m.keys)y[b]=`key_${$++}`;f.write("const newResult = {};");for(let b of m.keys){let T=y[b],E=wo(b),Ae=p[b]?._zod?.optout==="optional";f.write(`const ${T} = ${h(b)};`),Ae?f.write(`
|
|
9
|
+
deps: ${r}}`};var fj={keyword:"dependencies",type:"object",schemaType:"object",error:It.error,code(e){let[t,r]=mj(e);v_(e,t),y_(e,r)}};function mj({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let o=Array.isArray(e[n])?t:r;o[n]=e[n]}return[t,r]}function v_(e,t=e.schema){let{gen:r,data:n,it:o}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,gi.propertyInData)(r,n,a,o.opts.ownProperties);e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,gi.checkReportMissingProp)(e,u)}):(r.if((0,af._)`${c} && (${(0,gi.checkMissingProp)(e,s,i)})`),(0,gi.reportMissingProp)(e,i),r.else())}}It.validatePropertyDeps=v_;function y_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,pj.alwaysValidSchema)(i,t[s])||(r.if((0,gi.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}It.validateSchemaDeps=y_;It.default=fj});var b_=I(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var $_=W(),hj=re(),gj={message:"property name must be valid",params:({params:e})=>(0,$_._)`{propertyName: ${e.propertyName}}`},vj={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:gj,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,hj.alwaysValidSchema)(o,r))return;let i=t.name("valid");t.forIn("key",n,a=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,$_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};sf.default=vj});var uf=I(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var ys=lt(),$t=W(),yj=Lt(),_s=re(),_j={message:"must NOT have additional properties",params:({params:e})=>(0,$t._)`{additionalProperty: ${e.additionalProperty}}`},$j={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:_j,code(e){let{gen:t,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=e;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,_s.alwaysValidSchema)(a,r))return;let u=(0,ys.allSchemaProperties)(n.properties),l=(0,ys.allSchemaProperties)(n.patternProperties);d(),e.ok((0,$t._)`${i} === ${yj.default.errors}`);function d(){t.forIn("key",o,y=>{!u.length&&!l.length?m(y):t.if(p(y),()=>m(y))})}function p(y){let $;if(u.length>8){let _=(0,_s.schemaRefOrVal)(a,n.properties,"properties");$=(0,ys.isOwnProperty)(t,_,y)}else u.length?$=(0,$t.or)(...u.map(_=>(0,$t._)`${y} === ${_}`)):$=$t.nil;return l.length&&($=(0,$t.or)($,...l.map(_=>(0,$t._)`${(0,ys.usePattern)(e,_)}.test(${y})`))),(0,$t.not)($)}function f(y){t.code((0,$t._)`delete ${o}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,_s.alwaysValidSchema)(a,r)){let $=t.name("valid");c.removeAdditional==="failing"?(h(y,$,!1),t.if((0,$t.not)($),()=>{e.reset(),f(y)})):(h(y,$),s||t.if((0,$t.not)($),()=>t.break()))}}function h(y,$,_){let b={keyword:"additionalProperties",dataProp:y,dataPropType:_s.Type.Str};_===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,$)}}};cf.default=$j});var w_=I(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var bj=ei(),x_=lt(),lf=re(),k_=uf(),xj={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:o,it:i}=e;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&k_.default.code(new bj.KeywordCxt(i,k_.default,"additionalProperties"));let a=(0,x_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=lf.mergeEvaluated.props(t,(0,lf.toHash)(a),i.props));let s=a.filter(d=>!(0,lf.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=t.name("valid");for(let d of s)u(d)?l(d):(t.if((0,x_.propertyInData)(t,o,d,i.opts.ownProperties)),l(d),i.allErrors||t.else().var(c,!0),t.endIf()),e.it.definedProperties.add(d),e.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){e.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};df.default=xj});var P_=I(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var S_=lt(),$s=W(),z_=re(),I_=re(),kj={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:o,it:i}=e,{opts:a}=i,s=(0,S_.allSchemaProperties)(r),c=s.filter(h=>(0,z_.alwaysValidSchema)(i,r[h]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=t.name("valid");i.props!==!0&&!(i.props instanceof $s.Name)&&(i.props=(0,I_.evaluatedPropsToName)(t,i.props));let{props:d}=i;p();function p(){for(let h of s)u&&f(h),i.allErrors?m(h):(t.var(l,!0),m(h),t.if(l))}function f(h){for(let y in u)new RegExp(h).test(y)&&(0,z_.checkStrictMode)(i,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",n,y=>{t.if((0,$s._)`${(0,S_.usePattern)(e,h)}.test(${y})`,()=>{let $=c.includes(h);$||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:I_.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,$s._)`${d}[${y}]`,!0):!$&&!i.allErrors&&t.if((0,$s.not)(l),()=>t.break())})})}}};pf.default=kj});var j_=I(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});var wj=re(),Sj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,wj.alwaysValidSchema)(n,r)){e.fail();return}let o=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),e.failResult(o,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};ff.default=Sj});var T_=I(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var zj=lt(),Ij={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:zj.validateUnion,error:{message:"must match a schema in anyOf"}};mf.default=Ij});var E_=I(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var bs=W(),Pj=re(),jj={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,bs._)`{passingSchemas: ${e.passing}}`},Tj={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:jj,code(e){let{gen:t,schema:r,parentSchema:n,it:o}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((l,d)=>{let p;(0,Pj.alwaysValidSchema)(o,l)?t.var(c,!0):p=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,bs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,bs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),p&&e.mergeEvaluated(p,bs.Name)})})}}};hf.default=Tj});var O_=I(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var Ej=re(),Oj={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=t.name("valid");r.forEach((i,a)=>{if((0,Ej.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};gf.default=Oj});var R_=I(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var xs=W(),N_=re(),Dj={message:({params:e})=>(0,xs.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,xs._)`{failingKeyword: ${e.ifClause}}`},Nj={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Dj,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,N_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=D_(n,"then"),i=D_(n,"else");if(!o&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),o&&i){let l=t.let("ifClause");e.setParams({ifClause:l}),t.if(s,u("then",l),u("else",l))}else o?t.if(s,u("then")):t.if((0,xs.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let l=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(l)}function u(l,d){return()=>{let p=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(p,a),d?t.assign(d,(0,xs._)`${l}`):e.setParams({ifClause:l})}}}};function D_(e,t){let r=e.schema[t];return r!==void 0&&!(0,N_.alwaysValidSchema)(e,r)}vf.default=Nj});var C_=I(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var Rj=re(),Cj={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Rj.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};yf.default=Cj});var Z_=I(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Zj=ef(),Aj=f_(),Uj=tf(),Mj=h_(),Fj=g_(),qj=__(),Lj=b_(),Vj=uf(),Jj=w_(),Hj=P_(),Kj=j_(),Bj=T_(),Wj=E_(),Gj=O_(),Xj=R_(),Yj=C_();function Qj(e=!1){let t=[Kj.default,Bj.default,Wj.default,Gj.default,Xj.default,Yj.default,Lj.default,Vj.default,qj.default,Jj.default,Hj.default];return e?t.push(Aj.default,Mj.default):t.push(Zj.default,Uj.default),t.push(Fj.default),t}_f.default=Qj});var A_=I($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var $e=W(),eT={message:({schemaCode:e})=>(0,$e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,$e._)`{format: ${e}}`},tT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:eT,code(e,t){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():f();function p(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,$e._)`${m}[${a}]`),y=r.let("fType"),$=r.let("format");r.if((0,$e._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,$e._)`${h}.type || "string"`).assign($,(0,$e._)`${h}.validate`),()=>r.assign(y,(0,$e._)`"string"`).assign($,h)),e.fail$data((0,$e.or)(_(),b()));function _(){return c.strictSchema===!1?$e.nil:(0,$e._)`${a} && !${$}`}function b(){let T=l.$async?(0,$e._)`(${h}.async ? await ${$}(${n}) : ${$}(${n}))`:(0,$e._)`${$}(${n})`,E=(0,$e._)`(typeof ${$} == "function" ? ${T} : ${$}.test(${n}))`;return(0,$e._)`${$} && ${$} !== true && ${y} === ${t} && !${E}`}}function f(){let m=d.formats[i];if(!m){_();return}if(m===!0)return;let[h,y,$]=b(m);h===t&&e.pass(T());function _(){if(c.strictSchema===!1){d.logger.warn(E());return}throw new Error(E());function E(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function b(E){let nt=E instanceof RegExp?(0,$e.regexpCode)(E):c.code.formats?(0,$e._)`${c.code.formats}${(0,$e.getProperty)(i)}`:void 0,Ae=r.scopeValue("formats",{key:i,ref:E,code:nt});return typeof E=="object"&&!(E instanceof RegExp)?[E.type||"string",E.validate,(0,$e._)`${Ae}.validate`]:["string",E,Ae]}function T(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,$e._)`await ${$}(${n})`}return typeof y=="function"?(0,$e._)`${$}(${n})`:(0,$e._)`${$}.test(${n})`}}}};$f.default=tT});var U_=I(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var rT=A_(),nT=[rT.default];bf.default=nT});var M_=I(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.contentVocabulary=bn.metadataVocabulary=void 0;bn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];bn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var q_=I(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});var oT=Wy(),iT=u_(),aT=Z_(),sT=U_(),F_=M_(),cT=[oT.default,iT.default,(0,aT.default)(),sT.default,F_.metadataVocabulary,F_.contentVocabulary];xf.default=cT});var V_=I(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.DiscrError=void 0;var L_;(function(e){e.Tag="tag",e.Mapping="mapping"})(L_||(ks.DiscrError=L_={}))});var H_=I(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});var xn=W(),kf=V_(),J_=ns(),uT=ti(),lT=re(),dT={message:({params:{discrError:e,tagName:t}})=>e===kf.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,xn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},pT={keyword:"discriminator",type:"object",schemaType:"object",error:dT,code(e){let{gen:t,data:r,schema:n,parentSchema:o,it:i}=e,{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 c=t.let("valid",!1),u=t.const("tag",(0,xn._)`${r}${(0,xn.getProperty)(s)}`);t.if((0,xn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:kf.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let f=p();t.if(!1);for(let m in f)t.elseIf((0,xn._)`${u} === ${m}`),t.assign(c,d(f[m]));t.else(),e.error(!1,{discrError:kf.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(f){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:f},m);return e.mergeEvaluated(h,xn.Name),m}function p(){var f;let m={},h=$(o),y=!0;for(let T=0;T<a.length;T++){let E=a[T];if(E?.$ref&&!(0,lT.schemaHasRulesButRef)(E,i.self.RULES)){let Ae=E.$ref;if(E=J_.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,Ae),E instanceof J_.SchemaEnv&&(E=E.schema),E===void 0)throw new uT.default(i.opts.uriResolver,i.baseId,Ae)}let nt=(f=E?.properties)===null||f===void 0?void 0:f[s];if(typeof nt!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(h||$(E)),_(nt,T)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return m;function $({required:T}){return Array.isArray(T)&&T.includes(s)}function _(T,E){if(T.const)b(T.const,E);else if(T.enum)for(let nt of T.enum)b(nt,E);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function b(T,E){if(typeof T!="string"||T in m)throw new Error(`discriminator: "${s}" values must be unique strings`);m[T]=E}}}};wf.default=pT});var K_=I((zU,fT)=>{fT.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 zf=I((ve,Sf)=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.MissingRefError=ve.ValidationError=ve.CodeGen=ve.Name=ve.nil=ve.stringify=ve.str=ve._=ve.KeywordCxt=ve.Ajv=void 0;var mT=Ly(),hT=q_(),gT=H_(),B_=K_(),vT=["/properties"],ws="http://json-schema.org/draft-07/schema",kn=class extends mT.default{_addVocabularies(){super._addVocabularies(),hT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(gT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(B_,vT):B_;this.addMetaSchema(t,ws,!1),this.refs["http://json-schema.org/schema"]=ws}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ws)?ws:void 0)}};ve.Ajv=kn;Sf.exports=ve=kn;Sf.exports.Ajv=kn;Object.defineProperty(ve,"__esModule",{value:!0});ve.default=kn;var yT=ei();Object.defineProperty(ve,"KeywordCxt",{enumerable:!0,get:function(){return yT.KeywordCxt}});var wn=W();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return wn._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return wn.str}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return wn.stringify}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return wn.nil}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return wn.Name}});Object.defineProperty(ve,"CodeGen",{enumerable:!0,get:function(){return wn.CodeGen}});var _T=ts();Object.defineProperty(ve,"ValidationError",{enumerable:!0,get:function(){return _T.default}});var $T=ti();Object.defineProperty(ve,"MissingRefError",{enumerable:!0,get:function(){return $T.default}})});var r$=I(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.formatNames=jt.fastFormats=jt.fullFormats=void 0;function Pt(e,t){return{validate:e,compare:t}}jt.fullFormats={date:Pt(Y_,Tf),time:Pt(Pf(!0),Ef),"date-time":Pt(W_(!0),e$),"iso-time":Pt(Pf(),Q_),"iso-date-time":Pt(W_(),t$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:zT,"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:DT,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:IT,int32:{type:"number",validate:TT},int64:{type:"number",validate:ET},float:{type:"number",validate:X_},double:{type:"number",validate:X_},password:!0,binary:!0};jt.fastFormats={...jt.fullFormats,date:Pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Tf),time:Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Ef),"date-time":Pt(/^\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,e$),"iso-time":Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Q_),"iso-date-time":Pt(/^\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,t$),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};jt.formatNames=Object.keys(jt.fullFormats);function bT(e){return e%4===0&&(e%100!==0||e%400===0)}var xT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,kT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Y_(e){let t=xT.exec(e);if(!t)return!1;let r=+t[1],n=+t[2],o=+t[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&bT(r)?29:kT[n])}function Tf(e,t){if(e&&t)return e>t?1:e<t?-1:0}var If=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Pf(e){return function(r){let n=If.exec(r);if(!n)return!1;let o=+n[1],i=+n[2],a=+n[3],s=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||e&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function Ef(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();if(r&&n)return r-n}function Q_(e,t){if(!(e&&t))return;let r=If.exec(e),n=If.exec(t);if(r&&n)return e=r[1]+r[2]+r[3],t=n[1]+n[2]+n[3],e>t?1:e<t?-1:0}var jf=/t|\s/i;function W_(e){let t=Pf(e);return function(n){let o=n.split(jf);return o.length===2&&Y_(o[0])&&t(o[1])}}function e$(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function t$(e,t){if(!(e&&t))return;let[r,n]=e.split(jf),[o,i]=t.split(jf),a=Tf(r,o);if(a!==void 0)return a||Ef(n,i)}var wT=/\/|:/,ST=/^(?:[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 zT(e){return wT.test(e)&&ST.test(e)}var G_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function IT(e){return G_.lastIndex=0,G_.test(e)}var PT=-(2**31),jT=2**31-1;function TT(e){return Number.isInteger(e)&&e<=jT&&e>=PT}function ET(e){return Number.isInteger(e)}function X_(){return!0}var OT=/[^\\]\\Z/;function DT(e){if(OT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var n$=I(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.formatLimitDefinition=void 0;var NT=zf(),bt=W(),lr=bt.operators,Ss={formatMaximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},formatMinimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},formatExclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},formatExclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},RT={message:({keyword:e,schemaCode:t})=>(0,bt.str)`should be ${Ss[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,bt._)`{comparison: ${Ss[e].okStr}, limit: ${t}}`};Sn.formatLimitDefinition={keyword:Object.keys(Ss),type:"string",schemaType:"string",$data:!0,error:RT,code(e){let{gen:t,data:r,schemaCode:n,keyword:o,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new NT.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),f=t.const("fmt",(0,bt._)`${p}[${c.schemaCode}]`);e.fail$data((0,bt.or)((0,bt._)`typeof ${f} != "object"`,(0,bt._)`${f} instanceof RegExp`,(0,bt._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let p=c.schema,f=s.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let m=t.scopeValue("formats",{key:p,ref:f,code:a.code.formats?(0,bt._)`${a.code.formats}${(0,bt.getProperty)(p)}`:void 0});e.fail$data(d(m))}function d(p){return(0,bt._)`${p}.compare(${r}, ${n}) ${Ss[o].fail} 0`}},dependencies:["format"]};var CT=e=>(e.addKeyword(Sn.formatLimitDefinition),e);Sn.default=CT});var s$=I((vi,a$)=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});var zn=r$(),ZT=n$(),Of=W(),o$=new Of.Name("fullFormats"),AT=new Of.Name("fastFormats"),Df=(e,t={keywords:!0})=>{if(Array.isArray(t))return i$(e,t,zn.fullFormats,o$),e;let[r,n]=t.mode==="fast"?[zn.fastFormats,AT]:[zn.fullFormats,o$],o=t.formats||zn.formatNames;return i$(e,o,r,n),t.keywords&&(0,ZT.default)(e),e};Df.get=(e,t="full")=>{let n=(t==="fast"?zn.fastFormats:zn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function i$(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,Of._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}a$.exports=vi=Df;Object.defineProperty(vi,"__esModule",{value:!0});vi.default=Df});var Ze=ft(require("path")),Pn=ft(require("fs"));var ee;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.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},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.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)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(ee||(ee={}));var Mf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Mf||(Mf={}));var P=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Et=e=>{switch(typeof e){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(e)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(e)?P.array:e===null?P.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?P.promise:typeof Map<"u"&&e instanceof Map?P.map:typeof Set<"u"&&e instanceof Set?P.set:typeof Date<"u"&&e instanceof Date?P.date:P.object;default:return P.unknown}};var x=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 Xe=class e extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){let r=t||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,c=0;for(;c<a.path.length;){let u=a.path[c];c===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(a))):s[u]=s[u]||{_errors:[]},s=s[u],c++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ee.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=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(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Xe.create=e=>new Xe(e);var E$=(e,t)=>{let r;switch(e.code){case x.invalid_type:e.received===P.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:ee.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case x.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case x.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},Jt=E$;var O$=Jt;function On(){return O$}var $i=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...o,path:i,message:s}};function S(e,t){let r=On(),n=$i({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Jt?void 0:Jt].filter(o=>!!o)});e.common.issues.push(n)}var Te=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return M;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,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"&&t.dirty(),a.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:t.value,value:n}}},M=Object.freeze({status:"aborted"}),Cr=e=>({status:"dirty",value:e}),Ue=e=>({status:"valid",value:e}),Rs=e=>e.status==="aborted",Cs=e=>e.status==="dirty",pr=e=>e.status==="valid",Dn=e=>typeof Promise<"u"&&e instanceof Promise;var O;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(O||(O={}));var ot=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,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}},Ff=(e,t)=>{if(pr(t))return{success:!0,data:t.value};if(!e.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 Xe(e.common.issues);return this._error=r,this._error}}};function J(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var G=class{get description(){return this._def.description}_getType(t){return Et(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Te,ctx:{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Dn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Ff(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return pr(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:t,path:[],parent:r}).then(n=>pr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Dn(o)?o:Promise.resolve(o));return Ff(n,i)}refine(t,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=t(o),s=()=>i.addIssue({code:x.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new ht({schema:this,typeName:C.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 mt.create(this,this._def)}nullable(){return Nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Kt.create(this)}promise(){return fr.create(this,this._def)}or(t){return Fr.create([this,t],this._def)}and(t){return qr.create(this,t,this._def)}transform(t){return new ht({...J(this._def),schema:this,typeName:C.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Kr({...J(this._def),innerType:this,defaultValue:r,typeName:C.ZodDefault})}brand(){return new bi({typeName:C.ZodBranded,type:this,...J(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Br({...J(this._def),innerType:this,catchValue:r,typeName:C.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return xi.create(this,t)}readonly(){return Wr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},D$=/^c[^\s-]{8,}$/i,N$=/^[0-9a-z]+$/,R$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,C$=/^[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,Z$=/^[a-z0-9_-]{21}$/i,A$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,U$=/^[-+]?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)?)??$/,M$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,F$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zs,q$=/^(?:(?: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])$/,L$=/^(?:(?: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])$/,V$=/^(([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]))$/,J$=/^(([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])$/,H$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,K$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qf="((\\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])))",B$=new RegExp(`^${qf}$`);function Lf(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function W$(e){return new RegExp(`^${Lf(e)}$`)}function G$(e){let t=`${qf}T${Lf(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function X$(e,t){return!!((t==="v4"||!t)&&q$.test(e)||(t==="v6"||!t)&&V$.test(e))}function Y$(e,t){if(!A$.test(e))return!1;try{let[r]=e.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||t&&o.alg!==t)}catch{return!1}}function Q$(e,t){return!!((t==="v4"||!t)&&L$.test(e)||(t==="v6"||!t)&&J$.test(e))}var Ar=class e extends G{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==P.string){let i=this._getOrReturnCtx(t);return S(i,{code:x.invalid_type,expected:P.string,received:i.parsedType}),M}let n=new Te,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),S(o,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),S(o,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=t.data.length>i.value,s=t.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(t,o),a?S(o,{code:x.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&S(o,{code:x.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")M$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"email",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Zs||(Zs=new RegExp(F$,"u")),Zs.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"emoji",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")C$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"uuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Z$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"nanoid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")D$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"cuid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")N$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"cuid2",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")R$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"ulid",code:x.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),S(o,{validation:"url",code:x.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"regex",code:x.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),S(o,{code:x.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),S(o,{code:x.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),S(o,{code:x.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?G$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{code:x.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?B$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{code:x.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?W$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{code:x.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?U$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"duration",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?X$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"ip",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?Y$(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"jwt",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?Q$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"cidr",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?H$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"base64",code:x.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?K$.test(t.data)||(o=this._getOrReturnCtx(t,o),S(o,{validation:"base64url",code:x.invalid_string,message:i.message}),n.dirty()):ee.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:x.invalid_string,...O.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...O.errToObj(t)})}url(t){return this._addCheck({kind:"url",...O.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...O.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...O.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...O.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...O.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...O.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...O.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...O.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...O.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...O.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...O.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...O.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...O.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...O.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...O.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...O.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...O.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...O.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...O.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...O.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...O.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...O.errToObj(r)})}nonempty(t){return this.min(1,O.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Ar.create=e=>new Ar({checks:[],typeName:C.ZodString,coerce:e?.coerce??!1,...J(e)});function eb(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),a=Number.parseInt(t.toFixed(o).replace(".",""));return i%a/10**o}var Nn=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==P.number){let i=this._getOrReturnCtx(t);return S(i,{code:x.invalid_type,expected:P.number,received:i.parsedType}),M}let n,o=new Te;for(let i of this._def.checks)i.kind==="int"?ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),S(n,{code:x.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?eb(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),S(n,{code:x.not_finite,message:i.message}),o.dirty()):ee.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:O.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:O.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&ee.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Nn.create=e=>new Nn({checks:[],typeName:C.ZodNumber,coerce:e?.coerce||!1,...J(e)});var Rn=class e extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==P.bigint)return this._getInvalidInput(t);let n,o=new Te;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),S(n,{code:x.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):ee.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return S(r,{code:x.invalid_type,expected:P.bigint,received:r.parsedType}),M}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Rn.create=e=>new Rn({checks:[],typeName:C.ZodBigInt,coerce:e?.coerce??!1,...J(e)});var Cn=class extends G{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==P.boolean){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.boolean,received:n.parsedType}),M}return Ue(t.data)}};Cn.create=e=>new Cn({typeName:C.ZodBoolean,coerce:e?.coerce||!1,...J(e)});var Zn=class e extends G{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==P.date){let i=this._getOrReturnCtx(t);return S(i,{code:x.invalid_type,expected:P.date,received:i.parsedType}),M}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return S(i,{code:x.invalid_date}),M}let n=new Te,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),S(o,{code:x.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),S(o,{code:x.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(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:O.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:O.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Zn.create=e=>new Zn({checks:[],coerce:e?.coerce||!1,typeName:C.ZodDate,...J(e)});var An=class extends G{_parse(t){if(this._getType(t)!==P.symbol){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.symbol,received:n.parsedType}),M}return Ue(t.data)}};An.create=e=>new An({typeName:C.ZodSymbol,...J(e)});var Ur=class extends G{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.undefined,received:n.parsedType}),M}return Ue(t.data)}};Ur.create=e=>new Ur({typeName:C.ZodUndefined,...J(e)});var Mr=class extends G{_parse(t){if(this._getType(t)!==P.null){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.null,received:n.parsedType}),M}return Ue(t.data)}};Mr.create=e=>new Mr({typeName:C.ZodNull,...J(e)});var Un=class extends G{constructor(){super(...arguments),this._any=!0}_parse(t){return Ue(t.data)}};Un.create=e=>new Un({typeName:C.ZodAny,...J(e)});var Ht=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ue(t.data)}};Ht.create=e=>new Ht({typeName:C.ZodUnknown,...J(e)});var xt=class extends G{_parse(t){let r=this._getOrReturnCtx(t);return S(r,{code:x.invalid_type,expected:P.never,received:r.parsedType}),M}};xt.create=e=>new xt({typeName:C.ZodNever,...J(e)});var Mn=class extends G{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.void,received:n.parsedType}),M}return Ue(t.data)}};Mn.create=e=>new Mn({typeName:C.ZodVoid,...J(e)});var Kt=class e extends G{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==P.array)return S(r,{code:x.invalid_type,expected:P.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)&&(S(r,{code:a?x.too_big:x.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&&(S(r,{code:x.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&&(S(r,{code:x.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 ot(r,a,r.path,s)))).then(a=>Te.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new ot(r,a,r.path,s)));return Te.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:O.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:O.toString(r)}})}nonempty(t){return this.min(1,t)}};Kt.create=(e,t)=>new Kt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:C.ZodArray,...J(t)});function Zr(e){if(e instanceof Ye){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=mt.create(Zr(n))}return new Ye({...e._def,shape:()=>t})}else return e instanceof Kt?new Kt({...e._def,type:Zr(e.element)}):e instanceof mt?mt.create(Zr(e.unwrap())):e instanceof Nt?Nt.create(Zr(e.unwrap())):e instanceof Dt?Dt.create(e.items.map(t=>Zr(t))):e}var Ye=class e 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 t=this._def.shape(),r=ee.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==P.object){let u=this._getOrReturnCtx(t);return S(u,{code:x.invalid_type,expected:P.object,received:u.parsedType}),M}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new ot(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof xt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(S(o,{code:x.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let l of s){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new ot(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>Te.mergeObjectSync(n,u)):Te.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return O.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:C.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of ee.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of ee.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Zr(this)}partial(t){let r={};for(let n of ee.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ee.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof mt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Vf(ee.objectKeys(this.shape))}};Ye.create=(e,t)=>new Ye({shape:()=>e,unknownKeys:"strip",catchall:xt.create(),typeName:C.ZodObject,...J(t)});Ye.strictCreate=(e,t)=>new Ye({shape:()=>e,unknownKeys:"strict",catchall:xt.create(),typeName:C.ZodObject,...J(t)});Ye.lazycreate=(e,t)=>new Ye({shape:e,unknownKeys:"strip",catchall:xt.create(),typeName:C.ZodObject,...J(t)});var Fr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),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 Xe(s.ctx.common.issues));return S(r,{code:x.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 c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!i&&(i={result:l,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new Xe(c));return S(r,{code:x.invalid_union,unionErrors:s}),M}}get options(){return this._def.options}};Fr.create=(e,t)=>new Fr({options:e,typeName:C.ZodUnion,...J(t)});var Ot=e=>e instanceof Lr?Ot(e.schema):e instanceof ht?Ot(e.innerType()):e instanceof Vr?[e.value]:e instanceof Jr?e.options:e instanceof Hr?ee.objectValues(e.enum):e instanceof Kr?Ot(e._def.innerType):e instanceof Ur?[void 0]:e instanceof Mr?[null]:e instanceof mt?[void 0,...Ot(e.unwrap())]:e instanceof Nt?[null,...Ot(e.unwrap())]:e instanceof bi||e instanceof Wr?Ot(e.unwrap()):e instanceof Br?Ot(e._def.innerType):[],As=class e extends G{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.object)return S(r,{code:x.invalid_type,expected:P.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}):(S(r,{code:x.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(t,r,n){let o=new Map;for(let i of r){let a=Ot(i.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);o.set(s,i)}}return new e({typeName:C.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...J(n)})}};function Us(e,t){let r=Et(e),n=Et(t);if(e===t)return{valid:!0,data:e};if(r===P.object&&n===P.object){let o=ee.objectKeys(t),i=ee.objectKeys(e).filter(s=>o.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=Us(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===P.array&&n===P.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=Us(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===P.date&&n===P.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var qr=class extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Rs(i)||Rs(a))return M;let s=Us(i.value,a.value);return s.valid?((Cs(i)||Cs(a))&&r.dirty(),{status:r.value,value:s.data}):(S(n,{code:x.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}))}};qr.create=(e,t,r)=>new qr({left:e,right:t,typeName:C.ZodIntersection,...J(r)});var Dt=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.array)return S(n,{code:x.invalid_type,expected:P.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return S(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new ot(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Te.mergeArray(r,a)):Te.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Dt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:e,typeName:C.ZodTuple,rest:null,...J(t)})};var Ms=class e extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.object)return S(n,{code:x.invalid_type,expected:P.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 ot(n,s,n.path,s)),value:a._parse(new ot(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Te.mergeObjectAsync(r,o):Te.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof G?new e({keyType:t,valueType:r,typeName:C.ZodRecord,...J(n)}):new e({keyType:Ar.create(),valueType:t,typeName:C.ZodRecord,...J(r)})}},Fn=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.map)return S(n,{code:x.invalid_type,expected:P.map,received:n.parsedType}),M;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new ot(n,s,n.path,[u,"key"])),value:i._parse(new ot(n,c,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let c of a){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Fn.create=(e,t,r)=>new Fn({valueType:t,keyType:e,typeName:C.ZodMap,...J(r)});var qn=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.set)return S(n,{code:x.invalid_type,expected:P.set,received:n.parsedType}),M;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(S(n,{code:x.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&&(S(n,{code:x.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(c){let u=new Set;for(let l of c){if(l.status==="aborted")return M;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((c,u)=>i._parse(new ot(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(t,r){return new e({...this._def,minSize:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:O.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};qn.create=(e,t)=>new qn({valueType:e,minSize:null,maxSize:null,typeName:C.ZodSet,...J(t)});var Fs=class e extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.function)return S(r,{code:x.invalid_type,expected:P.function,received:r.parsedType}),M;function n(s,c){return $i({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Jt].filter(u=>!!u),issueData:{code:x.invalid_arguments,argumentsError:c}})}function o(s,c){return $i({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Jt].filter(u=>!!u),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof fr){let s=this;return Ue(async function(...c){let u=new Xe([]),l=await s._def.args.parseAsync(c,i).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(f=>{throw u.addIssue(o(d,f)),u})})}else{let s=this;return Ue(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Xe([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Xe([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Dt.create(t).rest(Ht.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Dt.create([]).rest(Ht.create()),returns:r||Ht.create(),typeName:C.ZodFunction,...J(n)})}},Lr=class extends G{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Lr.create=(e,t)=>new Lr({getter:e,typeName:C.ZodLazy,...J(t)});var Vr=class extends G{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return S(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:t.data}}get value(){return this._def.value}};Vr.create=(e,t)=>new Vr({value:e,typeName:C.ZodLiteral,...J(t)});function Vf(e,t){return new Jr({values:e,typeName:C.ZodEnum,...J(t)})}var Jr=class e extends G{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return S(r,{expected:ee.joinValues(n),received:r.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return S(r,{received:r.data,code:x.invalid_enum_value,options:n}),M}return Ue(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};Jr.create=Vf;var Hr=class extends G{_parse(t){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==P.string&&n.parsedType!==P.number){let o=ee.objectValues(r);return S(n,{expected:ee.joinValues(o),received:n.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=ee.objectValues(r);return S(n,{received:n.data,code:x.invalid_enum_value,options:o}),M}return Ue(t.data)}get enum(){return this._def.values}};Hr.create=(e,t)=>new Hr({values:e,typeName:C.ZodNativeEnum,...J(t)});var fr=class extends G{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.promise&&r.common.async===!1)return S(r,{code:x.invalid_type,expected:P.promise,received:r.parsedType}),M;let n=r.parsedType===P.promise?r.data:Promise.resolve(r.data);return Ue(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fr.create=(e,t)=>new fr({type:e,typeName:C.ZodPromise,...J(t)});var ht=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===C.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:a=>{S(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 c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?Cr(c.value):r.value==="dirty"?Cr(c.value):c});{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"?Cr(s.value):r.value==="dirty"?Cr(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c 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(!pr(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=>pr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):M);ee.assertNever(o)}};ht.create=(e,t,r)=>new ht({schema:e,typeName:C.ZodEffects,effect:t,...J(r)});ht.createWithPreprocess=(e,t,r)=>new ht({schema:t,effect:{type:"preprocess",transform:e},typeName:C.ZodEffects,...J(r)});var mt=class extends G{_parse(t){return this._getType(t)===P.undefined?Ue(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:C.ZodOptional,...J(t)});var Nt=class extends G{_parse(t){return this._getType(t)===P.null?Ue(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:C.ZodNullable,...J(t)});var Kr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===P.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Kr.create=(e,t)=>new Kr({innerType:e,typeName:C.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});var Br=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Dn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Xe(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Xe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Br.create=(e,t)=>new Br({innerType:e,typeName:C.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});var Ln=class extends G{_parse(t){if(this._getType(t)!==P.nan){let n=this._getOrReturnCtx(t);return S(n,{code:x.invalid_type,expected:P.nan,received:n.parsedType}),M}return{status:"valid",value:t.data}}};Ln.create=e=>new Ln({typeName:C.ZodNaN,...J(e)});var bi=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},xi=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);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(),Cr(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(t,r){return new e({in:t,out:r,typeName:C.ZodPipeline})}},Wr=class extends G{_parse(t){let r=this._def.innerType._parse(t),n=o=>(pr(o)&&(o.value=Object.freeze(o.value)),o);return Dn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:C.ZodReadonly,...J(t)});var hE={object:Ye.lazycreate},C;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(C||(C={}));var gE=Ar.create,vE=Nn.create,yE=Ln.create,_E=Rn.create,$E=Cn.create,bE=Zn.create,xE=An.create,kE=Ur.create,wE=Mr.create,SE=Un.create,zE=Ht.create,IE=xt.create,PE=Mn.create,jE=Kt.create,tb=Ye.create,TE=Ye.strictCreate,EE=Fr.create,OE=As.create,DE=qr.create,NE=Dt.create,RE=Ms.create,CE=Fn.create,ZE=qn.create,AE=Fs.create,UE=Lr.create,ME=Vr.create,FE=Jr.create,qE=Hr.create,LE=fr.create,VE=ht.create,JE=mt.create,HE=Nt.create,KE=ht.createWithPreprocess,BE=xi.create;var Jf=Object.freeze({status:"aborted"});function g(e,t,r){function n(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(s){var c;let u=r?.Parent?new i:this;n(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}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(e)}),Object.defineProperty(a,"name",{value:e}),a}var kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},mr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},ki={};function xe(e){return e&&Object.assign(ki,e),ki}var k={};En(k,{BIGINT_FORMAT_RANGES:()=>Xs,Class:()=>Ls,NUMBER_FORMAT_RANGES:()=>Gs,aborted:()=>Xt,allowsEval:()=>Hs,assert:()=>cb,assertEqual:()=>ob,assertIs:()=>ab,assertNever:()=>sb,assertNotEqual:()=>ib,assignProp:()=>Wt,base64ToUint8Array:()=>Qf,base64urlToUint8Array:()=>_b,cached:()=>Xr,captureStackTrace:()=>Si,cleanEnum:()=>yb,cleanRegex:()=>Hn,clone:()=>Me,cloneDef:()=>lb,createTransparentProxy:()=>gb,defineLazy:()=>H,esc:()=>wi,escapeRegex:()=>it,extend:()=>Wf,finalizeIssue:()=>He,floatSafeRemainder:()=>Vs,getElementAtPath:()=>db,getEnumValues:()=>Jn,getLengthableOrigin:()=>Wn,getParsedType:()=>hb,getSizableOrigin:()=>Bn,hexToUint8Array:()=>bb,isObject:()=>hr,isPlainObject:()=>Gt,issue:()=>Yr,joinValues:()=>Z,jsonStringifyReplacer:()=>Gr,merge:()=>vb,mergeDefs:()=>Rt,normalizeParams:()=>z,nullish:()=>Bt,numKeys:()=>mb,objectClone:()=>ub,omit:()=>Bf,optionalKeys:()=>Ws,parsedType:()=>F,partial:()=>Xf,pick:()=>Kf,prefixIssues:()=>Qe,primitiveTypes:()=>Bs,promiseAllObject:()=>pb,propertyKeyTypes:()=>Kn,randomString:()=>fb,required:()=>Yf,safeExtend:()=>Gf,shallowClone:()=>Ks,slugify:()=>Js,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>em,uint8ArrayToBase64url:()=>$b,uint8ArrayToHex:()=>xb,unwrapMessage:()=>Vn});function ob(e){return e}function ib(e){return e}function ab(e){}function sb(e){throw new Error("Unexpected value in exhaustive check")}function cb(e){}function Jn(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function Z(e,t="|"){return e.map(r=>A(r)).join(t)}function Gr(e,t){return typeof t=="bigint"?t.toString():t}function Xr(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Bt(e){return e==null}function Hn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Vs(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}var Hf=Symbol("evaluating");function H(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Hf)return n===void 0&&(n=Hf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function ub(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Wt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Rt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function lb(e){return Rt(e._zod.def)}function db(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function pb(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function fb(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function wi(e){return JSON.stringify(e)}function Js(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Si="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Hs=Xr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gt(e){if(hr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(hr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ks(e){return Gt(e)?{...e}:Array.isArray(e)?[...e]:e}function mb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var hb=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Kn=new Set(["string","number","symbol"]),Bs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function it(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Me(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function z(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function gb(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function A(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ws(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Gs={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]},Xs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Kf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Rt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Wt(this,"shape",a),a},checks:[]});return Me(e,i)}function Bf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Rt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Wt(this,"shape",a),a},checks:[]});return Me(e,i)}function Wf(e,t){if(!Gt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Rt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Wt(this,"shape",i),i}});return Me(e,o)}function Gf(e,t){if(!Gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Wt(this,"shape",n),n}});return Me(e,r)}function vb(e,t){let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Wt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Me(e,r)}function Xf(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Rt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Wt(this,"shape",c),c},checks:[]});return Me(t,a)}function Yf(e,t,r){let n=Rt(t._zod.def,{get shape(){let o=t._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 e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Wt(this,"shape",i),i}});return Me(t,n)}function Xt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Qe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Vn(e){return typeof e=="string"?e:e?.message}function He(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Vn(e.inst?._zod.def?.error?.(e))??Vn(t?.error?.(e))??Vn(r.customError?.(e))??Vn(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Bn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Wn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function F(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Yr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function yb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Qf(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function em(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function _b(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Qf(t+r)}function $b(e){return em(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function bb(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function xb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ls=class{constructor(...t){}};var tm=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Gr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},zi=g("$ZodError",tm),Gn=g("$ZodError",tm,{Parent:Error});function Ii(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function Pi(e,t=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(t(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(e),r}var Xn=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new kt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>He(c,i,xe())));throw Si(s,o?.callee),s}return a.value},Yn=Xn(Gn),Qn=e=>async(t,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>He(c,i,xe())));throw Si(s,o?.callee),s}return a.value},eo=Qn(Gn),to=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new kt;return i.issues.length?{success:!1,error:new(e??zi)(i.issues.map(a=>He(a,o,xe())))}:{success:!0,data:i.value}},Qr=to(Gn),ro=e=>async(t,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>He(a,o,xe())))}:{success:!0,data:i.value}},no=ro(Gn),rm=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,o)};var nm=e=>(t,r,n)=>Xn(e)(t,r,n);var om=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qn(e)(t,r,o)};var im=e=>async(t,r,n)=>Qn(e)(t,r,n);var am=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return to(e)(t,r,o)};var sm=e=>(t,r,n)=>to(e)(t,r,n);var cm=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ro(e)(t,r,o)};var um=e=>async(t,r,n)=>ro(e)(t,r,n);var at={};En(at,{base64:()=>fc,base64url:()=>ji,bigint:()=>_c,boolean:()=>bc,browserEmail:()=>Eb,cidrv4:()=>dc,cidrv6:()=>pc,cuid:()=>Ys,cuid2:()=>Qs,date:()=>hc,datetime:()=>vc,domain:()=>Nb,duration:()=>oc,e164:()=>mc,email:()=>ac,emoji:()=>sc,extendedDuration:()=>wb,guid:()=>ic,hex:()=>Rb,hostname:()=>Db,html5Email:()=>Pb,idnEmail:()=>Tb,integer:()=>$c,ipv4:()=>cc,ipv6:()=>uc,ksuid:()=>rc,lowercase:()=>wc,mac:()=>lc,md5_base64:()=>Zb,md5_base64url:()=>Ab,md5_hex:()=>Cb,nanoid:()=>nc,null:()=>xc,number:()=>Ti,rfc5322Email:()=>jb,sha1_base64:()=>Mb,sha1_base64url:()=>Fb,sha1_hex:()=>Ub,sha256_base64:()=>Lb,sha256_base64url:()=>Vb,sha256_hex:()=>qb,sha384_base64:()=>Hb,sha384_base64url:()=>Kb,sha384_hex:()=>Jb,sha512_base64:()=>Wb,sha512_base64url:()=>Gb,sha512_hex:()=>Bb,string:()=>yc,time:()=>gc,ulid:()=>ec,undefined:()=>kc,unicodeEmail:()=>lm,uppercase:()=>Sc,uuid:()=>gr,uuid4:()=>Sb,uuid6:()=>zb,uuid7:()=>Ib,xid:()=>tc});var Ys=/^[cC][^\s-]{8,}$/,Qs=/^[0-9a-z]+$/,ec=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,tc=/^[0-9a-vA-V]{20}$/,rc=/^[A-Za-z0-9]{27}$/,nc=/^[a-zA-Z0-9_-]{21}$/,oc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,wb=/^[-+]?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)?)??$/,ic=/^([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})$/,gr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([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)$/,Sb=gr(4),zb=gr(6),Ib=gr(7),ac=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pb=/^[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])?)*$/,jb=/^(([^<>()\[\]\\.,;:\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,}))$/,lm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Tb=lm,Eb=/^[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])?)*$/,Ob="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function sc(){return new RegExp(Ob,"u")}var cc=/^(?:(?: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])$/,uc=/^(([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}|:))$/,lc=e=>{let t=it(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},dc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,pc=/^(([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])$/,fc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ji=/^[A-Za-z0-9_-]*$/,Db=/^(?=.{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])?)*\.?$/,Nb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,mc=/^\+[1-9]\d{6,14}$/,dm="(?:(?:\\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])))",hc=new RegExp(`^${dm}$`);function pm(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gc(e){return new RegExp(`^${pm(e)}$`)}function vc(e){let t=pm({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${dm}T(?:${n})$`)}var yc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},_c=/^-?\d+n?$/,$c=/^-?\d+$/,Ti=/^-?\d+(?:\.\d+)?$/,bc=/^(?:true|false)$/i,xc=/^null$/i;var kc=/^undefined$/i;var wc=/^[^A-Z]*$/,Sc=/^[^a-z]*$/,Rb=/^[0-9a-fA-F]*$/;function oo(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function io(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Cb=/^[0-9a-fA-F]{32}$/,Zb=oo(22,"=="),Ab=io(22),Ub=/^[0-9a-fA-F]{40}$/,Mb=oo(27,"="),Fb=io(27),qb=/^[0-9a-fA-F]{64}$/,Lb=oo(43,"="),Vb=io(43),Jb=/^[0-9a-fA-F]{96}$/,Hb=oo(64,""),Kb=io(64),Bb=/^[0-9a-fA-F]{128}$/,Wb=oo(86,"=="),Gb=io(86);var ue=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),mm={number:"number",bigint:"bigint",object:"date"},zc=g("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let r=mm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ic=g("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=mm[typeof t.value];e._zod.onattach.push(n=>{let o=n._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hm=g("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Vs(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),gm=g("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Gs[t.format];e._zod.onattach.push(a=>{let s=a._zod.bag;s.format=t.format,s.minimum=o,s.maximum=i,r&&(s.pattern=$c)}),e._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});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:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),vm=g("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[r,n]=Xs[t.format];e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,i.minimum=r,i.maximum=n}),e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),ym=g("$ZodCheckMaxSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Bn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_m=g("$ZodCheckMinSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Bn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$m=g("$ZodCheckSizeEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Bn(o),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),bm=g("$ZodCheckMaxLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xm=g("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Wn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),km=g("$ZodCheckLengthEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Wn(o),s=i>t.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ao=g("$ZodCheckStringFormat",(e,t)=>{var r,n;ue.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),wm=g("$ZodCheckRegex",(e,t)=>{ao.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Sm=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=wc),ao.init(e,t)}),zm=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Sc),ao.init(e,t)}),Im=g("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let r=it(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Pm=g("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`^${it(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),jm=g("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`.*${it(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function fm(e,t,r){e.issues.length&&t.issues.push(...Qe(r,e.issues))}var Tm=g("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>fm(o,r,t.property));fm(n,r,t.property)}}),Em=g("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Om=g("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ei=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
|
|
10
|
+
`).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 t=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,o.join(`
|
|
11
|
+
`))}};var Nm={major:4,minor:3,patch:6};var V=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Nm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=Xt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,f=d._zod.check(a);if(f instanceof Promise&&c?.async===!1)throw new kt;if(l||f instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await f,a.issues.length!==p&&(u||(u=Xt(a,p)))});else{if(a.issues.length===p)continue;u||(u=Xt(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Xt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new kt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new kt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}H(e,"~standard",()=>({validate:o=>{try{let i=Qr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return no(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),vr=g("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??yc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.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:e}),r}}),ae=g("$ZodStringFormat",(e,t)=>{ao.init(e,t),vr.init(e,t)}),jc=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ic),ae.init(e,t)}),Tc=g("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gr(n))}else t.pattern??(t.pattern=gr());ae.init(e,t)}),Ec=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ac),ae.init(e,t)}),Oc=g("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Dc=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=sc()),ae.init(e,t)}),Nc=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=nc),ae.init(e,t)}),Rc=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ys),ae.init(e,t)}),Cc=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Qs),ae.init(e,t)}),Zc=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ec),ae.init(e,t)}),Ac=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=tc),ae.init(e,t)}),Uc=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=rc),ae.init(e,t)}),Mc=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=vc(t)),ae.init(e,t)}),Fc=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=hc),ae.init(e,t)}),qc=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gc(t)),ae.init(e,t)}),Lc=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=oc),ae.init(e,t)}),Vc=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=cc),ae.init(e,t),e._zod.bag.format="ipv4"}),Jc=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=uc),ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Hc=g("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=lc(t.delimiter)),ae.init(e,t),e._zod.bag.format="mac"}),Kc=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=dc),ae.init(e,t)}),Bc=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=pc),ae.init(e,t),e._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:e,continue:!t.abort})}}});function Hm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Wc=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=fc),ae.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Hm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Xb(e){if(!ji.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Hm(r)}var Gc=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ji),ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Xb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Xc=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=mc),ae.init(e,t)});function Yb(e,t=null){try{let r=e.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||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Yc=g("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=r=>{Yb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Qc=g("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Zi=g("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ti,e._zod.parse=(r,n)=>{if(t.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:e,...i?{received:i}:{}}),r}}),eu=g("$ZodNumberFormat",(e,t)=>{gm.init(e,t),Zi.init(e,t)}),so=g("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=bc,e._zod.parse=(r,n)=>{if(t.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:e}),r}}),Ai=g("$ZodBigInt",(e,t)=>{V.init(e,t),e._zod.pattern=_c,e._zod.parse=(r,n)=>{if(t.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:e}),r}}),tu=g("$ZodBigIntFormat",(e,t)=>{vm.init(e,t),Ai.init(e,t)}),ru=g("$ZodSymbol",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),nu=g("$ZodUndefined",(e,t)=>{V.init(e,t),e._zod.pattern=kc,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),ou=g("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=xc,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),iu=g("$ZodAny",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),au=g("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),su=g("$ZodNever",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),cu=g("$ZodVoid",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),uu=g("$ZodDate",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(t.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:e}),r}});function Rm(e,t,r){e.issues.length&&t.issues.push(...Qe(r,e.issues)),t.value[r]=e.value}var lu=g("$ZodArray",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=t.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>Rm(u,r,a))):Rm(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ci(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Qe(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Km(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ws(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Bm(e,t,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type,l=c.optout==="optional";for(let d in t){if(s.has(d))continue;if(u==="never"){a.push(d);continue}let p=c.run({value:t[d],issues:[]},n);p instanceof Promise?e.push(p.then(f=>Ci(f,r,d,t,l))):Ci(p,r,d,t,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var Wm=g("$ZodObject",(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}let n=Xr(()=>Km(t));H(e._zod,"propValues",()=>{let s=t.shape,c={};for(let u in s){let l=s[u]._zod;if(l.values){c[u]??(c[u]=new Set);for(let d of l.values)c[u].add(d)}}return c});let o=hr,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let f=d[p],m=f._zod.optout==="optional",h=f._zod.run({value:u[p],issues:[]},c);h instanceof Promise?l.push(h.then(y=>Ci(y,s,p,u,m))):Ci(h,s,p,u,m)}return i?Bm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Gm=g("$ZodObjectJIT",(e,t)=>{Wm.init(e,t);let r=e._zod.parse,n=Xr(()=>Km(t)),o=p=>{let f=new Ei(["shape","payload","ctx"]),m=n.value,h=b=>{let T=wi(b);return`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`};f.write("const input = payload.value;");let y=Object.create(null),$=0;for(let b of m.keys)y[b]=`key_${$++}`;f.write("const newResult = {};");for(let b of m.keys){let T=y[b],E=wi(b),Ae=p[b]?._zod?.optout==="optional";f.write(`const ${T} = ${h(b)};`),Ae?f.write(`
|
|
12
12
|
if (${T}.issues.length) {
|
|
13
13
|
if (${E} in input) {
|
|
14
14
|
payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
|
|
@@ -42,39 +42,39 @@
|
|
|
42
42
|
newResult[${E}] = ${T}.value;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
`)}f.write("payload.value = newResult;"),f.write("return payload;");let _=f.compile();return(b,T)=>_(p,b,T)},o,a=hr,s=!ko.jitless,u=s&&Ks.value,l=t.catchall,d;e._zod.parse=(p,f)=>{d??(d=n.value);let m=p.value;return a(m)?s&&u&&f?.async===!1&&f.jitless!==!0?(o||(o=i(t.shape)),p=o(p,f),l?Bm([],m,p,f,d,e):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p)}});function Zm(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!Xt(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>Ke(a,n,xe())))}),t)}var ci=g("$ZodUnion",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),K(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),K(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),K(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>Kn(o.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:i.value,issues:[]},o);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Zm(c,i,e,o)):Zm(s,i,e,o)}});function Cm(e,t,r,n){let i=e.filter(o=>o.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>Ke(a,n,xe())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var du=g("$ZodXor",(e,t)=>{ci.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:i.value,issues:[]},o);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>Cm(c,i,e,o)):Cm(s,i,e,o)}}),pu=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ci.init(e,t);let r=e._zod.parse;K(e._zod,"propValues",()=>{let i={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[s,c]of Object.entries(a)){i[s]||(i[s]=new Set);for(let u of c)i[s].add(u)}}return i});let n=Xr(()=>{let i=t.options,o=new Map;for(let a of i){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(o.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);o.set(c,a)}}return o});e._zod.parse=(i,o)=>{let a=i.value;if(!hr(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(i,o):t.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),i)}}),fu=g("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value,o=t.left._zod.run({value:i,issues:[]},n),a=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([c,u])=>Am(r,c,u)):Am(r,o,a)}});function Pc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Gt(e)&&Gt(t)){let r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),i={...e,...t};for(let o of n){let a=Pc(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=t[n],a=Pc(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Am(e,t,r){let n=new Map,i;for(let s of t.issues)if(s.code==="unrecognized_keys"){i??(i=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let o=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(o.length&&i&&e.issues.push({...i,keys:o}),Xt(e))return e;let a=Pc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Uo=g("$ZodTuple",(e,t)=>{V.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=o.length>r.length,d=o.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:o,inst:e,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=o.length&&u>=c)continue;let d=l._zod.run({value:o[u],issues:[]},i);d instanceof Promise?a.push(d.then(p=>Oo(p,n,u))):Oo(d,n,u)}if(t.rest){let l=o.slice(r.length);for(let d of l){u++;let p=t.rest._zod.run({value:d,issues:[]},i);p instanceof Promise?a.push(p.then(f=>Oo(f,n,u))):Oo(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Oo(e,t,r){e.issues.length&&t.issues.push(...Qe(r,e.issues)),t.value[r]=e.value}var mu=g("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Gt(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let o=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:i[u],issues:[]},n);l instanceof Promise?o.push(l.then(d=>{d.issues.length&&r.issues.push(...Qe(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Qe(u,l.issues)),r.value[u]=l.value)}let c;for(let u in i)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(i)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&To.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=i[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>Ke(d,n,xe())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:i[s],issues:[]},n);l instanceof Promise?o.push(l.then(d=>{d.issues.length&&r.issues.push(...Qe(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Qe(s,l.issues)),r.value[c.value]=l.value)}}return o.length?Promise.all(o).then(()=>r):r}}),hu=g("$ZodMap",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let o=[];r.value=new Map;for(let[a,s]of i){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?o.push(Promise.all([c,u]).then(([l,d])=>{Um(l,d,r,a,i,e,n)})):Um(c,u,r,a,i,e,n)}return o.length?Promise.all(o).then(()=>r):r}});function Um(e,t,r,n,i,o,a){e.issues.length&&(Hn.has(typeof n)?r.issues.push(...Qe(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map(s=>Ke(s,a,xe()))})),t.issues.length&&(Hn.has(typeof n)?r.issues.push(...Qe(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:t.issues.map(s=>Ke(s,a,xe()))})),r.value.set(e.value,t.value)}var gu=g("$ZodSet",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let a of i){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?o.push(s.then(c=>Mm(c,r))):Mm(s,r)}return o.length?Promise.all(o).then(()=>r):r}});function Mm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var vu=g("$ZodEnum",(e,t)=>{V.init(e,t);let r=Jn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>Hn.has(typeof i)).map(i=>typeof i=="string"?ot(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{let a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:r,input:a,inst:e}),i}}),yu=g("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?ot(n):n?ot(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),_u=g("$ZodFile",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return i instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:i,inst:e}),r}}),$u=g("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(r.value=a,r));if(i instanceof Promise)throw new kt;return r.value=i,r}});function Fm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Mo=g("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),K(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kn(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>Fm(o,r.value)):Fm(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),bu=g("$ZodExactOptional",(e,t)=>{Mo.init(e,t),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),xu=g("$ZodNullable",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Kn(r.source)}|null)$`):void 0}),K(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ku=g("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>qm(o,t)):qm(i,t)}});function qm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var wu=g("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Su=g("$ZodNonOptional",(e,t)=>{V.init(e,t),K(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>Lm(o,e)):Lm(i,e)}});function Lm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var zu=g("$ZodSuccess",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr("ZodSuccess");let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.issues.length===0,r)):(r.value=i.issues.length===0,r)}}),Iu=g("$ZodCatch",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.innerType._zod.optin),K(e._zod,"optout",()=>t.innerType._zod.optout),K(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(a=>Ke(a,n,xe()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>Ke(o,n,xe()))},input:r.value}),r.issues=[]),r)}}),Pu=g("$ZodNaN",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),ju=g("$ZodPipe",(e,t)=>{V.init(e,t),K(e._zod,"values",()=>t.in._zod.values),K(e._zod,"optin",()=>t.in._zod.optin),K(e._zod,"optout",()=>t.out._zod.optout),K(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>Do(a,t.in,n)):Do(o,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(o=>Do(o,t.out,n)):Do(i,t.out,n)}});function Do(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var ui=g("$ZodCodec",(e,t)=>{V.init(e,t),K(e._zod,"values",()=>t.in._zod.values),K(e._zod,"optin",()=>t.in._zod.optin),K(e._zod,"optout",()=>t.out._zod.optout),K(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(a=>No(a,t,n)):No(o,t,n)}else{let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>No(a,t,n)):No(o,t,n)}}});function No(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let i=t.transform(e.value,e);return i instanceof Promise?i.then(o=>Ro(e,o,t.out,r)):Ro(e,i,t.out,r)}else{let i=t.reverseTransform(e.value,e);return i instanceof Promise?i.then(o=>Ro(e,o,t.in,r)):Ro(e,i,t.in,r)}}function Ro(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Tu=g("$ZodReadonly",(e,t)=>{V.init(e,t),K(e._zod,"propValues",()=>t.innerType._zod.propValues),K(e._zod,"values",()=>t.innerType._zod.values),K(e._zod,"optin",()=>t.innerType?._zod?.optin),K(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(Vm):Vm(i)}});function Vm(e){return e.value=Object.freeze(e.value),e}var Eu=g("$ZodTemplateLiteral",(e,t)=>{V.init(e,t);let r=[];for(let n of t.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 i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let o=i.startsWith("^")?1:0,a=i.endsWith("$")?i.length-1:i.length;r.push(i.slice(o,a))}else if(n===null||Bs.has(typeof n))r.push(ot(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Ou=g("$ZodFunction",(e,t)=>(V.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let i=e._def.input?Yn(e._def.input,n):n,o=Reflect.apply(r,this,i);return e._def.output?Yn(e._def.output,o):o}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let i=e._def.input?await ei(e._def.input,n):n,o=await Reflect.apply(r,this,i);return e._def.output?await ei(e._def.output,o):o}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Uo({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Du=g("$ZodPromise",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(i=>t.innerType._zod.run({value:i,issues:[]},n))}),Nu=g("$ZodLazy",(e,t)=>{V.init(e,t),K(e._zod,"innerType",()=>t.getter()),K(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),K(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),K(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),K(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ru=g("$ZodCustom",(e,t)=>{ue.init(e,t),V.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(o=>Jm(o,r,n,e));Jm(i,r,n,e)}});function Jm(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(Yr(i))}}var Qb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??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"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=F(i.input),s=n[a]??a;return`Invalid input: expected ${o}, received ${s}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${A(i.values[0])}`:`Invalid option: expected one of ${C(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${o}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${o}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;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]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${C(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Zu(){return{localeError:Qb()}}var Xm;var Au=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Uu(){return new Au}(Xm=globalThis).__zod_globalRegistry??(Xm.__zod_globalRegistry=Uu());var Fe=globalThis.__zod_globalRegistry;function Mu(e,t){return new e({type:"string",...z(t)})}function Fo(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}function li(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function qo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}function Lo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}function Vo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}function Jo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}function di(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function Ko(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}function Ho(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}function Bo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}function Wo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}function Go(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}function Xo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}function Yo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}function Qo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function ea(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function Fu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...z(t)})}function ta(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}function ra(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}function na(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}function ia(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}function oa(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}function aa(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}function qu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}function Lu(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}function Vu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}function Ju(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}function Ku(e,t){return new e({type:"number",checks:[],...z(t)})}function Hu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}function Bu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...z(t)})}function Wu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...z(t)})}function Gu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...z(t)})}function Xu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...z(t)})}function Yu(e,t){return new e({type:"boolean",...z(t)})}function Qu(e,t){return new e({type:"bigint",...z(t)})}function el(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...z(t)})}function tl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...z(t)})}function rl(e,t){return new e({type:"symbol",...z(t)})}function nl(e,t){return new e({type:"undefined",...z(t)})}function il(e,t){return new e({type:"null",...z(t)})}function ol(e){return new e({type:"any"})}function al(e){return new e({type:"unknown"})}function sl(e,t){return new e({type:"never",...z(t)})}function cl(e,t){return new e({type:"void",...z(t)})}function ul(e,t){return new e({type:"date",...z(t)})}function ll(e,t){return new e({type:"nan",...z(t)})}function Zt(e,t){return new zc({check:"less_than",...z(t),value:e,inclusive:!1})}function et(e,t){return new zc({check:"less_than",...z(t),value:e,inclusive:!0})}function Ct(e,t){return new Ic({check:"greater_than",...z(t),value:e,inclusive:!1})}function qe(e,t){return new Ic({check:"greater_than",...z(t),value:e,inclusive:!0})}function dl(e){return Ct(0,e)}function pl(e){return Zt(0,e)}function fl(e){return et(0,e)}function ml(e){return qe(0,e)}function yr(e,t){return new hm({check:"multiple_of",...z(t),value:e})}function _r(e,t){return new ym({check:"max_size",...z(t),maximum:e})}function At(e,t){return new _m({check:"min_size",...z(t),minimum:e})}function en(e,t){return new $m({check:"size_equals",...z(t),size:e})}function tn(e,t){return new bm({check:"max_length",...z(t),maximum:e})}function Yt(e,t){return new xm({check:"min_length",...z(t),minimum:e})}function rn(e,t){return new km({check:"length_equals",...z(t),length:e})}function pi(e,t){return new wm({check:"string_format",format:"regex",...z(t),pattern:e})}function fi(e){return new Sm({check:"string_format",format:"lowercase",...z(e)})}function mi(e){return new zm({check:"string_format",format:"uppercase",...z(e)})}function hi(e,t){return new Im({check:"string_format",format:"includes",...z(t),includes:e})}function gi(e,t){return new Pm({check:"string_format",format:"starts_with",...z(t),prefix:e})}function vi(e,t){return new jm({check:"string_format",format:"ends_with",...z(t),suffix:e})}function hl(e,t,r){return new Tm({check:"property",property:e,schema:t,...z(r)})}function yi(e,t){return new Em({check:"mime_type",mime:e,...z(t)})}function wt(e){return new Om({check:"overwrite",tx:e})}function _i(e){return wt(t=>t.normalize(e))}function $i(){return wt(e=>e.trim())}function bi(){return wt(e=>e.toLowerCase())}function xi(){return wt(e=>e.toUpperCase())}function sa(){return wt(e=>Js(e))}function Ym(e,t,r){return new e({type:"array",element:t,...z(r)})}function gl(e,t){return new e({type:"file",...z(t)})}function vl(e,t,r){let n=z(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function yl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...z(r)})}function _l(e){let t=nx(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Yr(n,r.value,t._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(Yr(i))}},e(r.value,r)));return t}function nx(e,t){let r=new ue({check:"custom",...z(t)});return r._zod.check=e,r}function $l(e){let t=new ue({check:"describe"});return t._zod.onattach=[r=>{let n=Fe.get(r)??{};Fe.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function bl(e){let t=new ue({check:"meta"});return t._zod.onattach=[r=>{let n=Fe.get(r)??{};Fe.add(r,{...n,...e})}],t._zod.check=()=>{},t}function xl(e,t){let r=z(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),i=i.map(f=>typeof f=="string"?f.toLowerCase():f));let o=new Set(n),a=new Set(i),s=e.Codec??ui,c=e.Boolean??si,u=e.String??vr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((f,m)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),o.has(h)?!0:a.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:m.value,inst:p,continue:!1}),{})}),reverseTransform:((f,m)=>f===!0?n[0]||"true":i[0]||"false"),error:r.error});return p}function nn(e,t,r,n={}){let i=z(n),o={...z(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...i};return r instanceof RegExp&&(o.pattern=r),new e(o)}function ca(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Fe,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function fe(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let p=a.schema,f=t.processors[i.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);f(e,t,p,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Le(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function ua(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let i=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,p=e.external.uri??(m=>m);if(d)return{ref:p(d)};let f=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},o=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=i(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
46
|
-
|
|
47
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){o(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1&&e.reused==="ref"){o(a);continue}}}function la(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let p=e.seen.get(l),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(f.$ref&&p.def)for(let h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let p=e.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,r.def??r.schema);let o=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(o[s.defId]=s.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ki(t,"input",e.processors),output:ki(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Le(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Le(n.element,r);if(n.type==="set")return Le(n.valueType,r);if(n.type==="lazy")return Le(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 Le(n.innerType,r);if(n.type==="intersection")return Le(n.left,r)||Le(n.right,r);if(n.type==="record"||n.type==="map")return Le(n.keyType,r)||Le(n.valueType,r);if(n.type==="pipe")return Le(n.in,r)||Le(n.out,r);if(n.type==="object"){for(let i in n.shape)if(Le(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(Le(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(Le(i,r))return!0;return!!(n.rest&&Le(n.rest,r))}return!1}var Qm=(e,t={})=>r=>{let n=ca({...r,processors:t});return fe(e,n),ua(n,e),la(n,e)},ki=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},a=ca({...i??{},target:o,io:t,processors:r});return fe(e,a),ua(a,e),la(a,e)};var ix={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},eh=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),s&&(i.format=ix[s]??s,i.format===""&&delete i.format,s==="time"&&delete i.format),u&&(i.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?i.pattern=l[0].source:l.length>1&&(i.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},th=(e,t,r,n)=>{let i=r,{minimum:o,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?i.type="integer":i.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l),typeof o=="number"&&(i.minimum=o,typeof l=="number"&&t.target!=="draft-04"&&(l>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=u,i.exclusiveMaximum=!0):i.exclusiveMaximum=u),typeof a=="number"&&(i.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof c=="number"&&(i.multipleOf=c)},rh=(e,t,r,n)=>{r.type="boolean"},nh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},ih=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},oh=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ah=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},ch=(e,t,r,n)=>{r.not={}},uh=(e,t,r,n)=>{},lh=(e,t,r,n)=>{},dh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ph=(e,t,r,n)=>{let i=e._zod.def,o=Jn(i.entries);o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),r.enum=o},fh=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let a of i.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),o.every(a=>typeof a=="boolean")&&(r.type="boolean"),o.every(a=>a===null)&&(r.type="null"),r.enum=o},mh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},hh=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},gh=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(o.minLength=a),s!==void 0&&(o.maxLength=s),c?c.length===1?(o.contentMediaType=c[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(i,o)},vh=(e,t,r,n)=>{r.type="boolean"},yh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},_h=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},$h=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},xh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},kh=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(i.minItems=a),typeof s=="number"&&(i.maxItems=s),i.type="array",i.items=fe(o.element,t,{...n,path:[...n.path,"items"]})},wh=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let a=o.shape;for(let u in a)i.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=o.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(i.required=Array.from(c)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=fe(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},kl=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,a=i.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,o?"oneOf":"anyOf",c]}));o?r.oneOf=a:r.anyOf=a},Sh=(e,t,r,n)=>{let i=e._zod.def,o=fe(i.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(i.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(o)?o.allOf:[o],...s(a)?a.allOf:[a]];r.allOf=c},zh=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=o.items.map((p,f)=>fe(p,t,{...n,path:[...n.path,a,f]})),u=o.rest?fe(o.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=c,u&&(i.items=u)):t.target==="openapi-3.0"?(i.items={anyOf:c},u&&i.items.anyOf.push(u),i.minItems=c.length,u||(i.maxItems=c.length)):(i.items=c,u&&(i.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(i.minItems=l),typeof d=="number"&&(i.maxItems=d)},Ih=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let a=o.keyType,c=a._zod.bag?.patterns;if(o.mode==="loose"&&c&&c.size>0){let l=fe(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let d of c)i.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=fe(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=fe(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(i.required=l)}},Ph=(e,t,r,n)=>{let i=e._zod.def,o=fe(i.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},jh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Th=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},Eh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Oh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Dh=(e,t,r,n)=>{let i=e._zod.def,o=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;fe(o,t,n);let a=t.seen.get(e);a.ref=o},Nh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},Rh=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},wl=(e,t,r,n)=>{let i=e._zod.def;fe(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Zh=(e,t,r,n)=>{let i=e._zod.innerType;fe(i,t,n);let o=t.seen.get(e);o.ref=i};function on(e){return!!e._zod}function Qt(e,t){return on(e)?Qr(e,t):e.safeParse(t)}function da(e){if(!e)return;let t;if(on(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Mh(e){if(on(e)){let o=e._zod?.def;if(o){if(o.value!==void 0)return o.value;if(Array.isArray(o.values)&&o.values.length>0)return o.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var wi={};En(wi,{ZodAny:()=>ig,ZodArray:()=>cg,ZodBase64:()=>Bl,ZodBase64URL:()=>Wl,ZodBigInt:()=>$a,ZodBigIntFormat:()=>Yl,ZodBoolean:()=>_a,ZodCIDRv4:()=>Kl,ZodCIDRv6:()=>Hl,ZodCUID:()=>Ul,ZodCUID2:()=>Ml,ZodCatch:()=>Pg,ZodCodec:()=>od,ZodCustom:()=>Sa,ZodCustomStringFormat:()=>zi,ZodDate:()=>ed,ZodDefault:()=>xg,ZodDiscriminatedUnion:()=>lg,ZodE164:()=>Gl,ZodEmail:()=>Zl,ZodEmoji:()=>Cl,ZodEnum:()=>Si,ZodExactOptional:()=>_g,ZodFile:()=>vg,ZodFunction:()=>Cg,ZodGUID:()=>fa,ZodIPv4:()=>Vl,ZodIPv6:()=>Jl,ZodIntersection:()=>dg,ZodJWT:()=>Xl,ZodKSUID:()=>Ll,ZodLazy:()=>Ng,ZodLiteral:()=>gg,ZodMAC:()=>eg,ZodMap:()=>mg,ZodNaN:()=>Tg,ZodNanoID:()=>Al,ZodNever:()=>ag,ZodNonOptional:()=>nd,ZodNull:()=>ng,ZodNullable:()=>bg,ZodNumber:()=>ya,ZodNumberFormat:()=>an,ZodObject:()=>ba,ZodOptional:()=>rd,ZodPipe:()=>id,ZodPrefault:()=>wg,ZodPromise:()=>Zg,ZodReadonly:()=>Eg,ZodRecord:()=>wa,ZodSet:()=>hg,ZodString:()=>ga,ZodStringFormat:()=>le,ZodSuccess:()=>Ig,ZodSymbol:()=>tg,ZodTemplateLiteral:()=>Dg,ZodTransform:()=>yg,ZodTuple:()=>pg,ZodType:()=>H,ZodULID:()=>Fl,ZodURL:()=>va,ZodUUID:()=>Ut,ZodUndefined:()=>rg,ZodUnion:()=>xa,ZodUnknown:()=>og,ZodVoid:()=>sg,ZodXID:()=>ql,ZodXor:()=>ug,_ZodString:()=>Rl,_default:()=>kg,_function:()=>xk,any:()=>ik,array:()=>Y,base64:()=>Fx,base64url:()=>qx,bigint:()=>Qx,boolean:()=>be,catch:()=>jg,check:()=>kk,cidrv4:()=>Ux,cidrv6:()=>Mx,codec:()=>_k,cuid:()=>Ex,cuid2:()=>Ox,custom:()=>ad,date:()=>ak,describe:()=>wk,discriminatedUnion:()=>ka,e164:()=>Lx,email:()=>bx,emoji:()=>jx,enum:()=>Oe,exactOptional:()=>$g,file:()=>hk,float32:()=>Wx,float64:()=>Gx,function:()=>xk,guid:()=>xx,hash:()=>Bx,hex:()=>Hx,hostname:()=>Kx,httpUrl:()=>Px,instanceof:()=>zk,int:()=>Nl,int32:()=>Xx,int64:()=>ek,intersection:()=>Pi,ipv4:()=>Zx,ipv6:()=>Ax,json:()=>Pk,jwt:()=>Vx,keyof:()=>sk,ksuid:()=>Rx,lazy:()=>Rg,literal:()=>D,looseObject:()=>Ee,looseRecord:()=>dk,mac:()=>Cx,map:()=>pk,meta:()=>Sk,nan:()=>yk,nanoid:()=>Tx,nativeEnum:()=>mk,never:()=>Ql,nonoptional:()=>zg,null:()=>Ii,nullable:()=>ma,nullish:()=>gk,number:()=>oe,object:()=>j,optional:()=>he,partialRecord:()=>lk,pipe:()=>ha,prefault:()=>Sg,preprocess:()=>za,promise:()=>bk,readonly:()=>Og,record:()=>me,refine:()=>Ag,set:()=>fk,strictObject:()=>ck,string:()=>v,stringFormat:()=>Jx,stringbool:()=>Ik,success:()=>vk,superRefine:()=>Ug,symbol:()=>rk,templateLiteral:()=>$k,transform:()=>td,tuple:()=>fg,uint32:()=>Yx,uint64:()=>tk,ulid:()=>Dx,undefined:()=>nk,union:()=>se,unknown:()=>de,url:()=>Ix,uuid:()=>kx,uuidv4:()=>wx,uuidv6:()=>Sx,uuidv7:()=>zx,void:()=>ok,xid:()=>Nx,xor:()=>uk});var pa={};En(pa,{endsWith:()=>vi,gt:()=>Ct,gte:()=>qe,includes:()=>hi,length:()=>rn,lowercase:()=>fi,lt:()=>Zt,lte:()=>et,maxLength:()=>tn,maxSize:()=>_r,mime:()=>yi,minLength:()=>Yt,minSize:()=>At,multipleOf:()=>yr,negative:()=>pl,nonnegative:()=>ml,nonpositive:()=>fl,normalize:()=>_i,overwrite:()=>wt,positive:()=>dl,property:()=>hl,regex:()=>pi,size:()=>en,slugify:()=>sa,startsWith:()=>gi,toLowerCase:()=>bi,toUpperCase:()=>xi,trim:()=>$i,uppercase:()=>mi});var $r={};En($r,{ZodISODate:()=>Pl,ZodISODateTime:()=>zl,ZodISODuration:()=>Ol,ZodISOTime:()=>Tl,date:()=>jl,datetime:()=>Il,duration:()=>Dl,time:()=>El});var zl=g("ZodISODateTime",(e,t)=>{Mc.init(e,t),le.init(e,t)});function Il(e){return qu(zl,e)}var Pl=g("ZodISODate",(e,t)=>{Fc.init(e,t),le.init(e,t)});function jl(e){return Lu(Pl,e)}var Tl=g("ZodISOTime",(e,t)=>{qc.init(e,t),le.init(e,t)});function El(e){return Vu(Tl,e)}var Ol=g("ZodISODuration",(e,t)=>{Lc.init(e,t),le.init(e,t)});function Dl(e){return Ju(Ol,e)}var Fh=(e,t)=>{zo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Po(e,r)},flatten:{value:r=>Io(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Gr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Gr,2)}},isEmpty:{get(){return e.issues.length===0}}})},BN=g("ZodError",Fh),tt=g("ZodError",Fh,{Parent:Error});var qh=Xn(tt),Lh=Qn(tt),Vh=ti(tt),Jh=ri(tt),Kh=rm(tt),Hh=nm(tt),Bh=im(tt),Wh=om(tt),Gh=am(tt),Xh=sm(tt),Yh=cm(tt),Qh=um(tt);var H=g("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ki(e,"input"),output:ki(e,"output")}}),e.toJSONSchema=Qm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(k.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Me(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>qh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Vh(e,r,n),e.parseAsync=async(r,n)=>Lh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Jh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Kh(e,r,n),e.decode=(r,n)=>Hh(e,r,n),e.encodeAsync=async(r,n)=>Bh(e,r,n),e.decodeAsync=async(r,n)=>Wh(e,r,n),e.safeEncode=(r,n)=>Gh(e,r,n),e.safeDecode=(r,n)=>Xh(e,r,n),e.safeEncodeAsync=async(r,n)=>Yh(e,r,n),e.safeDecodeAsync=async(r,n)=>Qh(e,r,n),e.refine=(r,n)=>e.check(Ag(r,n)),e.superRefine=r=>e.check(Ug(r)),e.overwrite=r=>e.check(wt(r)),e.optional=()=>he(e),e.exactOptional=()=>$g(e),e.nullable=()=>ma(e),e.nullish=()=>he(ma(e)),e.nonoptional=r=>zg(e,r),e.array=()=>Y(e),e.or=r=>se([e,r]),e.and=r=>Pi(e,r),e.transform=r=>ha(e,td(r)),e.default=r=>kg(e,r),e.prefault=r=>Sg(e,r),e.catch=r=>jg(e,r),e.pipe=r=>ha(e,r),e.readonly=()=>Og(e),e.describe=r=>{let n=e.clone();return Fe.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Fe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Fe.get(e);let n=e.clone();return Fe.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Rl=g("_ZodString",(e,t)=>{vr.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,i,o)=>eh(e,n,i,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(pi(...n)),e.includes=(...n)=>e.check(hi(...n)),e.startsWith=(...n)=>e.check(gi(...n)),e.endsWith=(...n)=>e.check(vi(...n)),e.min=(...n)=>e.check(Yt(...n)),e.max=(...n)=>e.check(tn(...n)),e.length=(...n)=>e.check(rn(...n)),e.nonempty=(...n)=>e.check(Yt(1,...n)),e.lowercase=n=>e.check(fi(n)),e.uppercase=n=>e.check(mi(n)),e.trim=()=>e.check($i()),e.normalize=(...n)=>e.check(_i(...n)),e.toLowerCase=()=>e.check(bi()),e.toUpperCase=()=>e.check(xi()),e.slugify=()=>e.check(sa())}),ga=g("ZodString",(e,t)=>{vr.init(e,t),Rl.init(e,t),e.email=r=>e.check(Fo(Zl,r)),e.url=r=>e.check(di(va,r)),e.jwt=r=>e.check(aa(Xl,r)),e.emoji=r=>e.check(Ko(Cl,r)),e.guid=r=>e.check(li(fa,r)),e.uuid=r=>e.check(qo(Ut,r)),e.uuidv4=r=>e.check(Lo(Ut,r)),e.uuidv6=r=>e.check(Vo(Ut,r)),e.uuidv7=r=>e.check(Jo(Ut,r)),e.nanoid=r=>e.check(Ho(Al,r)),e.guid=r=>e.check(li(fa,r)),e.cuid=r=>e.check(Bo(Ul,r)),e.cuid2=r=>e.check(Wo(Ml,r)),e.ulid=r=>e.check(Go(Fl,r)),e.base64=r=>e.check(na(Bl,r)),e.base64url=r=>e.check(ia(Wl,r)),e.xid=r=>e.check(Xo(ql,r)),e.ksuid=r=>e.check(Yo(Ll,r)),e.ipv4=r=>e.check(Qo(Vl,r)),e.ipv6=r=>e.check(ea(Jl,r)),e.cidrv4=r=>e.check(ta(Kl,r)),e.cidrv6=r=>e.check(ra(Hl,r)),e.e164=r=>e.check(oa(Gl,r)),e.datetime=r=>e.check(Il(r)),e.date=r=>e.check(jl(r)),e.time=r=>e.check(El(r)),e.duration=r=>e.check(Dl(r))});function v(e){return Mu(ga,e)}var le=g("ZodStringFormat",(e,t)=>{ae.init(e,t),Rl.init(e,t)}),Zl=g("ZodEmail",(e,t)=>{Ec.init(e,t),le.init(e,t)});function bx(e){return Fo(Zl,e)}var fa=g("ZodGUID",(e,t)=>{jc.init(e,t),le.init(e,t)});function xx(e){return li(fa,e)}var Ut=g("ZodUUID",(e,t)=>{Tc.init(e,t),le.init(e,t)});function kx(e){return qo(Ut,e)}function wx(e){return Lo(Ut,e)}function Sx(e){return Vo(Ut,e)}function zx(e){return Jo(Ut,e)}var va=g("ZodURL",(e,t)=>{Oc.init(e,t),le.init(e,t)});function Ix(e){return di(va,e)}function Px(e){return di(va,{protocol:/^https?$/,hostname:at.domain,...k.normalizeParams(e)})}var Cl=g("ZodEmoji",(e,t)=>{Dc.init(e,t),le.init(e,t)});function jx(e){return Ko(Cl,e)}var Al=g("ZodNanoID",(e,t)=>{Nc.init(e,t),le.init(e,t)});function Tx(e){return Ho(Al,e)}var Ul=g("ZodCUID",(e,t)=>{Rc.init(e,t),le.init(e,t)});function Ex(e){return Bo(Ul,e)}var Ml=g("ZodCUID2",(e,t)=>{Zc.init(e,t),le.init(e,t)});function Ox(e){return Wo(Ml,e)}var Fl=g("ZodULID",(e,t)=>{Cc.init(e,t),le.init(e,t)});function Dx(e){return Go(Fl,e)}var ql=g("ZodXID",(e,t)=>{Ac.init(e,t),le.init(e,t)});function Nx(e){return Xo(ql,e)}var Ll=g("ZodKSUID",(e,t)=>{Uc.init(e,t),le.init(e,t)});function Rx(e){return Yo(Ll,e)}var Vl=g("ZodIPv4",(e,t)=>{Vc.init(e,t),le.init(e,t)});function Zx(e){return Qo(Vl,e)}var eg=g("ZodMAC",(e,t)=>{Kc.init(e,t),le.init(e,t)});function Cx(e){return Fu(eg,e)}var Jl=g("ZodIPv6",(e,t)=>{Jc.init(e,t),le.init(e,t)});function Ax(e){return ea(Jl,e)}var Kl=g("ZodCIDRv4",(e,t)=>{Hc.init(e,t),le.init(e,t)});function Ux(e){return ta(Kl,e)}var Hl=g("ZodCIDRv6",(e,t)=>{Bc.init(e,t),le.init(e,t)});function Mx(e){return ra(Hl,e)}var Bl=g("ZodBase64",(e,t)=>{Wc.init(e,t),le.init(e,t)});function Fx(e){return na(Bl,e)}var Wl=g("ZodBase64URL",(e,t)=>{Gc.init(e,t),le.init(e,t)});function qx(e){return ia(Wl,e)}var Gl=g("ZodE164",(e,t)=>{Xc.init(e,t),le.init(e,t)});function Lx(e){return oa(Gl,e)}var Xl=g("ZodJWT",(e,t)=>{Yc.init(e,t),le.init(e,t)});function Vx(e){return aa(Xl,e)}var zi=g("ZodCustomStringFormat",(e,t)=>{Qc.init(e,t),le.init(e,t)});function Jx(e,t,r={}){return nn(zi,e,t,r)}function Kx(e){return nn(zi,"hostname",at.hostname,e)}function Hx(e){return nn(zi,"hex",at.hex,e)}function Bx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=at[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return nn(zi,n,i,t)}var ya=g("ZodNumber",(e,t)=>{Co.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,i,o)=>th(e,n,i,o),e.gt=(n,i)=>e.check(Ct(n,i)),e.gte=(n,i)=>e.check(qe(n,i)),e.min=(n,i)=>e.check(qe(n,i)),e.lt=(n,i)=>e.check(Zt(n,i)),e.lte=(n,i)=>e.check(et(n,i)),e.max=(n,i)=>e.check(et(n,i)),e.int=n=>e.check(Nl(n)),e.safe=n=>e.check(Nl(n)),e.positive=n=>e.check(Ct(0,n)),e.nonnegative=n=>e.check(qe(0,n)),e.negative=n=>e.check(Zt(0,n)),e.nonpositive=n=>e.check(et(0,n)),e.multipleOf=(n,i)=>e.check(yr(n,i)),e.step=(n,i)=>e.check(yr(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function oe(e){return Ku(ya,e)}var an=g("ZodNumberFormat",(e,t)=>{eu.init(e,t),ya.init(e,t)});function Nl(e){return Hu(an,e)}function Wx(e){return Bu(an,e)}function Gx(e){return Wu(an,e)}function Xx(e){return Gu(an,e)}function Yx(e){return Xu(an,e)}var _a=g("ZodBoolean",(e,t)=>{si.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>rh(e,r,n,i)});function be(e){return Yu(_a,e)}var $a=g("ZodBigInt",(e,t)=>{Ao.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,i,o)=>nh(e,n,i,o),e.gte=(n,i)=>e.check(qe(n,i)),e.min=(n,i)=>e.check(qe(n,i)),e.gt=(n,i)=>e.check(Ct(n,i)),e.gte=(n,i)=>e.check(qe(n,i)),e.min=(n,i)=>e.check(qe(n,i)),e.lt=(n,i)=>e.check(Zt(n,i)),e.lte=(n,i)=>e.check(et(n,i)),e.max=(n,i)=>e.check(et(n,i)),e.positive=n=>e.check(Ct(BigInt(0),n)),e.negative=n=>e.check(Zt(BigInt(0),n)),e.nonpositive=n=>e.check(et(BigInt(0),n)),e.nonnegative=n=>e.check(qe(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(yr(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Qx(e){return Qu($a,e)}var Yl=g("ZodBigIntFormat",(e,t)=>{tu.init(e,t),$a.init(e,t)});function ek(e){return el(Yl,e)}function tk(e){return tl(Yl,e)}var tg=g("ZodSymbol",(e,t)=>{ru.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ih(e,r,n,i)});function rk(e){return rl(tg,e)}var rg=g("ZodUndefined",(e,t)=>{nu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ah(e,r,n,i)});function nk(e){return nl(rg,e)}var ng=g("ZodNull",(e,t)=>{iu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>oh(e,r,n,i)});function Ii(e){return il(ng,e)}var ig=g("ZodAny",(e,t)=>{ou.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>uh(e,r,n,i)});function ik(){return ol(ig)}var og=g("ZodUnknown",(e,t)=>{au.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>lh(e,r,n,i)});function de(){return al(og)}var ag=g("ZodNever",(e,t)=>{su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ch(e,r,n,i)});function Ql(e){return sl(ag,e)}var sg=g("ZodVoid",(e,t)=>{cu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>sh(e,r,n,i)});function ok(e){return cl(sg,e)}var ed=g("ZodDate",(e,t)=>{uu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,i,o)=>dh(e,n,i,o),e.min=(n,i)=>e.check(qe(n,i)),e.max=(n,i)=>e.check(et(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function ak(e){return ul(ed,e)}var cg=g("ZodArray",(e,t)=>{lu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>kh(e,r,n,i),e.element=t.element,e.min=(r,n)=>e.check(Yt(r,n)),e.nonempty=r=>e.check(Yt(1,r)),e.max=(r,n)=>e.check(tn(r,n)),e.length=(r,n)=>e.check(rn(r,n)),e.unwrap=()=>e.element});function Y(e,t){return Ym(cg,e,t)}function sk(e){let t=e._zod.def.shape;return Oe(Object.keys(t))}var ba=g("ZodObject",(e,t)=>{Gm.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>wh(e,r,n,i),k.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Oe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:de()}),e.loose=()=>e.clone({...e._zod.def,catchall:de()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ql()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>k.extend(e,r),e.safeExtend=r=>k.safeExtend(e,r),e.merge=r=>k.merge(e,r),e.pick=r=>k.pick(e,r),e.omit=r=>k.omit(e,r),e.partial=(...r)=>k.partial(rd,e,r[0]),e.required=(...r)=>k.required(nd,e,r[0])});function j(e,t){let r={type:"object",shape:e??{},...k.normalizeParams(t)};return new ba(r)}function ck(e,t){return new ba({type:"object",shape:e,catchall:Ql(),...k.normalizeParams(t)})}function Ee(e,t){return new ba({type:"object",shape:e,catchall:de(),...k.normalizeParams(t)})}var xa=g("ZodUnion",(e,t)=>{ci.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>kl(e,r,n,i),e.options=t.options});function se(e,t){return new xa({type:"union",options:e,...k.normalizeParams(t)})}var ug=g("ZodXor",(e,t)=>{xa.init(e,t),du.init(e,t),e._zod.processJSONSchema=(r,n,i)=>kl(e,r,n,i),e.options=t.options});function uk(e,t){return new ug({type:"union",options:e,inclusive:!1,...k.normalizeParams(t)})}var lg=g("ZodDiscriminatedUnion",(e,t)=>{xa.init(e,t),pu.init(e,t)});function ka(e,t,r){return new lg({type:"union",options:t,discriminator:e,...k.normalizeParams(r)})}var dg=g("ZodIntersection",(e,t)=>{fu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Sh(e,r,n,i)});function Pi(e,t){return new dg({type:"intersection",left:e,right:t})}var pg=g("ZodTuple",(e,t)=>{Uo.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>zh(e,r,n,i),e.rest=r=>e.clone({...e._zod.def,rest:r})});function fg(e,t,r){let n=t instanceof V,i=n?r:t,o=n?t:null;return new pg({type:"tuple",items:e,rest:o,...k.normalizeParams(i)})}var wa=g("ZodRecord",(e,t)=>{mu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ih(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function me(e,t,r){return new wa({type:"record",keyType:e,valueType:t,...k.normalizeParams(r)})}function lk(e,t,r){let n=Me(e);return n._zod.values=void 0,new wa({type:"record",keyType:n,valueType:t,...k.normalizeParams(r)})}function dk(e,t,r){return new wa({type:"record",keyType:e,valueType:t,mode:"loose",...k.normalizeParams(r)})}var mg=g("ZodMap",(e,t)=>{hu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>bh(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(en(...r))});function pk(e,t,r){return new mg({type:"map",keyType:e,valueType:t,...k.normalizeParams(r)})}var hg=g("ZodSet",(e,t)=>{gu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xh(e,r,n,i),e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(en(...r))});function fk(e,t){return new hg({type:"set",valueType:e,...k.normalizeParams(t)})}var Si=g("ZodEnum",(e,t)=>{vu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,i,o)=>ph(e,n,i,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let a of n)if(r.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Si({...t,checks:[],...k.normalizeParams(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let a of n)if(r.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new Si({...t,checks:[],...k.normalizeParams(i),entries:o})}});function Oe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Si({type:"enum",entries:r,...k.normalizeParams(t)})}function mk(e,t){return new Si({type:"enum",entries:e,...k.normalizeParams(t)})}var gg=g("ZodLiteral",(e,t)=>{yu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>fh(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function D(e,t){return new gg({type:"literal",values:Array.isArray(e)?e:[e],...k.normalizeParams(t)})}var vg=g("ZodFile",(e,t)=>{_u.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>gh(e,r,n,i),e.min=(r,n)=>e.check(At(r,n)),e.max=(r,n)=>e.check(_r(r,n)),e.mime=(r,n)=>e.check(yi(Array.isArray(r)?r:[r],n))});function hk(e){return gl(vg,e)}var yg=g("ZodTransform",(e,t)=>{$u.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>$h(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(k.issue(o,r.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(k.issue(a))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function td(e){return new yg({type:"transform",transform:e})}var rd=g("ZodOptional",(e,t)=>{Mo.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>wl(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function he(e){return new rd({type:"optional",innerType:e})}var _g=g("ZodExactOptional",(e,t)=>{bu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>wl(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function $g(e){return new _g({type:"optional",innerType:e})}var bg=g("ZodNullable",(e,t)=>{xu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ph(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function ma(e){return new bg({type:"nullable",innerType:e})}function gk(e){return he(ma(e))}var xg=g("ZodDefault",(e,t)=>{ku.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Th(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function kg(e,t){return new xg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var wg=g("ZodPrefault",(e,t)=>{wu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Eh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Sg(e,t){return new wg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var nd=g("ZodNonOptional",(e,t)=>{Su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>jh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function zg(e,t){return new nd({type:"nonoptional",innerType:e,...k.normalizeParams(t)})}var Ig=g("ZodSuccess",(e,t)=>{zu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>vh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function vk(e){return new Ig({type:"success",innerType:e})}var Pg=g("ZodCatch",(e,t)=>{Iu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Oh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jg(e,t){return new Pg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Tg=g("ZodNaN",(e,t)=>{Pu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>mh(e,r,n,i)});function yk(e){return ll(Tg,e)}var id=g("ZodPipe",(e,t)=>{ju.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Dh(e,r,n,i),e.in=t.in,e.out=t.out});function ha(e,t){return new id({type:"pipe",in:e,out:t})}var od=g("ZodCodec",(e,t)=>{id.init(e,t),ui.init(e,t)});function _k(e,t,r){return new od({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Eg=g("ZodReadonly",(e,t)=>{Tu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Nh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Og(e){return new Eg({type:"readonly",innerType:e})}var Dg=g("ZodTemplateLiteral",(e,t)=>{Eu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>hh(e,r,n,i)});function $k(e,t){return new Dg({type:"template_literal",parts:e,...k.normalizeParams(t)})}var Ng=g("ZodLazy",(e,t)=>{Nu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Zh(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function Rg(e){return new Ng({type:"lazy",getter:e})}var Zg=g("ZodPromise",(e,t)=>{Du.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Rh(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function bk(e){return new Zg({type:"promise",innerType:e})}var Cg=g("ZodFunction",(e,t)=>{Ou.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>_h(e,r,n,i)});function xk(e){return new Cg({type:"function",input:Array.isArray(e?.input)?fg(e?.input):e?.input??Y(de()),output:e?.output??de()})}var Sa=g("ZodCustom",(e,t)=>{Ru.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yh(e,r,n,i)});function kk(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function ad(e,t){return vl(Sa,e??(()=>!0),t)}function Ag(e,t={}){return yl(Sa,e,t)}function Ug(e){return _l(e)}var wk=$l,Sk=bl;function zk(e,t={}){let r=new Sa({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...k.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Ik=(...e)=>xl({Codec:od,Boolean:_a,String:ga},...e);function Pk(e){let t=Rg(()=>se([v(e),oe(),be(),Ii(),Y(t),me(v(),t)]));return t}function za(e,t){return ha(td(e),t)}var Mg;Mg||(Mg={});var r4={...wi,...pa,iso:$r};xe(Zu());var cd="2025-11-25";var Fg=[cd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],er="io.modelcontextprotocol/related-task",Pa="2.0",ke=ad(e=>e!==null&&(typeof e=="object"||typeof e=="function")),qg=se([v(),oe().int()]),Lg=v(),b4=Ee({ttl:se([oe(),Ii()]).optional(),pollInterval:oe().optional()}),Ok=j({ttl:oe().optional()}),Dk=j({taskId:v()}),ud=Ee({progressToken:qg.optional(),[er]:Dk.optional()}),rt=j({_meta:ud.optional()}),ji=rt.extend({task:Ok.optional()}),Vg=e=>ji.safeParse(e).success,we=j({method:v(),params:rt.loose().optional()}),st=j({_meta:ud.optional()}),ct=j({method:v(),params:st.loose().optional()}),Se=Ee({_meta:ud.optional()}),ja=se([v(),oe().int()]),Jg=j({jsonrpc:D(Pa),id:ja,...we.shape}).strict(),ld=e=>Jg.safeParse(e).success,Kg=j({jsonrpc:D(Pa),...ct.shape}).strict(),Hg=e=>Kg.safeParse(e).success,dd=j({jsonrpc:D(Pa),id:ja,result:Se}).strict(),Ti=e=>dd.safeParse(e).success;var q;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(q||(q={}));var pd=j({jsonrpc:D(Pa),id:ja.optional(),error:j({code:oe().int(),message:v(),data:de().optional()})}).strict();var Bg=e=>pd.safeParse(e).success;var Wg=se([Jg,Kg,dd,pd]),x4=se([dd,pd]),Ta=Se.strict(),Nk=st.extend({requestId:ja.optional(),reason:v().optional()}),Ea=ct.extend({method:D("notifications/cancelled"),params:Nk}),Rk=j({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Oe(["light","dark"]).optional()}),Ei=j({icons:Y(Rk).optional()}),sn=j({name:v(),title:v().optional()}),Gg=sn.extend({...sn.shape,...Ei.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Zk=Pi(j({applyDefaults:be().optional()}),me(v(),de())),Ck=za(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Pi(j({form:Zk.optional(),url:ke.optional()}),me(v(),de()).optional())),Ak=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({sampling:Ee({createMessage:ke.optional()}).optional(),elicitation:Ee({create:ke.optional()}).optional()}).optional()}),Uk=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({tools:Ee({call:ke.optional()}).optional()}).optional()}),Mk=j({experimental:me(v(),ke).optional(),sampling:j({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:Ck.optional(),roots:j({listChanged:be().optional()}).optional(),tasks:Ak.optional()}),Fk=rt.extend({protocolVersion:v(),capabilities:Mk,clientInfo:Gg}),fd=we.extend({method:D("initialize"),params:Fk});var qk=j({experimental:me(v(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:j({listChanged:be().optional()}).optional(),resources:j({subscribe:be().optional(),listChanged:be().optional()}).optional(),tools:j({listChanged:be().optional()}).optional(),tasks:Uk.optional()}),Lk=Se.extend({protocolVersion:v(),capabilities:qk,serverInfo:Gg,instructions:v().optional()}),md=ct.extend({method:D("notifications/initialized"),params:st.optional()});var Oa=we.extend({method:D("ping"),params:rt.optional()}),Vk=j({progress:oe(),total:he(oe()),message:he(v())}),Jk=j({...st.shape,...Vk.shape,progressToken:qg}),Da=ct.extend({method:D("notifications/progress"),params:Jk}),Kk=rt.extend({cursor:Lg.optional()}),Oi=we.extend({params:Kk.optional()}),Di=Se.extend({nextCursor:Lg.optional()}),Hk=Oe(["working","input_required","completed","failed","cancelled"]),Ni=j({taskId:v(),status:Hk,ttl:se([oe(),Ii()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:he(oe()),statusMessage:he(v())}),cn=Se.extend({task:Ni}),Bk=st.merge(Ni),Ri=ct.extend({method:D("notifications/tasks/status"),params:Bk}),Na=we.extend({method:D("tasks/get"),params:rt.extend({taskId:v()})}),Ra=Se.merge(Ni),Za=we.extend({method:D("tasks/result"),params:rt.extend({taskId:v()})}),k4=Se.loose(),Ca=Oi.extend({method:D("tasks/list")}),Aa=Di.extend({tasks:Y(Ni)}),Ua=we.extend({method:D("tasks/cancel"),params:rt.extend({taskId:v()})}),Xg=Se.merge(Ni),Yg=j({uri:v(),mimeType:he(v()),_meta:me(v(),de()).optional()}),Qg=Yg.extend({text:v()}),hd=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ev=Yg.extend({blob:hd}),Zi=Oe(["user","assistant"]),un=j({audience:Y(Zi).optional(),priority:oe().min(0).max(1).optional(),lastModified:$r.datetime({offset:!0}).optional()}),tv=j({...sn.shape,...Ei.shape,uri:v(),description:he(v()),mimeType:he(v()),annotations:un.optional(),_meta:he(Ee({}))}),Wk=j({...sn.shape,...Ei.shape,uriTemplate:v(),description:he(v()),mimeType:he(v()),annotations:un.optional(),_meta:he(Ee({}))}),gd=Oi.extend({method:D("resources/list")}),Gk=Di.extend({resources:Y(tv)}),Xk=Oi.extend({method:D("resources/templates/list")}),Yk=Di.extend({resourceTemplates:Y(Wk)}),vd=rt.extend({uri:v()}),Qk=vd,yd=we.extend({method:D("resources/read"),params:Qk}),ew=Se.extend({contents:Y(se([Qg,ev]))}),tw=ct.extend({method:D("notifications/resources/list_changed"),params:st.optional()}),rw=vd,nw=we.extend({method:D("resources/subscribe"),params:rw}),iw=vd,ow=we.extend({method:D("resources/unsubscribe"),params:iw}),aw=st.extend({uri:v()}),sw=ct.extend({method:D("notifications/resources/updated"),params:aw}),cw=j({name:v(),description:he(v()),required:he(be())}),uw=j({...sn.shape,...Ei.shape,description:he(v()),arguments:he(Y(cw)),_meta:he(Ee({}))}),_d=Oi.extend({method:D("prompts/list")}),lw=Di.extend({prompts:Y(uw)}),dw=rt.extend({name:v(),arguments:me(v(),v()).optional()}),$d=we.extend({method:D("prompts/get"),params:dw}),bd=j({type:D("text"),text:v(),annotations:un.optional(),_meta:me(v(),de()).optional()}),xd=j({type:D("image"),data:hd,mimeType:v(),annotations:un.optional(),_meta:me(v(),de()).optional()}),kd=j({type:D("audio"),data:hd,mimeType:v(),annotations:un.optional(),_meta:me(v(),de()).optional()}),pw=j({type:D("tool_use"),name:v(),id:v(),input:me(v(),de()),_meta:me(v(),de()).optional()}),fw=j({type:D("resource"),resource:se([Qg,ev]),annotations:un.optional(),_meta:me(v(),de()).optional()}),mw=tv.extend({type:D("resource_link")}),wd=se([bd,xd,kd,mw,fw]),hw=j({role:Zi,content:wd}),gw=Se.extend({description:v().optional(),messages:Y(hw)}),vw=ct.extend({method:D("notifications/prompts/list_changed"),params:st.optional()}),yw=j({title:v().optional(),readOnlyHint:be().optional(),destructiveHint:be().optional(),idempotentHint:be().optional(),openWorldHint:be().optional()}),_w=j({taskSupport:Oe(["required","optional","forbidden"]).optional()}),rv=j({...sn.shape,...Ei.shape,description:v().optional(),inputSchema:j({type:D("object"),properties:me(v(),ke).optional(),required:Y(v()).optional()}).catchall(de()),outputSchema:j({type:D("object"),properties:me(v(),ke).optional(),required:Y(v()).optional()}).catchall(de()).optional(),annotations:yw.optional(),execution:_w.optional(),_meta:me(v(),de()).optional()}),Sd=Oi.extend({method:D("tools/list")}),$w=Di.extend({tools:Y(rv)}),Ma=Se.extend({content:Y(wd).default([]),structuredContent:me(v(),de()).optional(),isError:be().optional()}),w4=Ma.or(Se.extend({toolResult:de()})),bw=ji.extend({name:v(),arguments:me(v(),de()).optional()}),Ci=we.extend({method:D("tools/call"),params:bw}),xw=ct.extend({method:D("notifications/tools/list_changed"),params:st.optional()}),S4=j({autoRefresh:be().default(!0),debounceMs:oe().int().nonnegative().default(300)}),Ai=Oe(["debug","info","notice","warning","error","critical","alert","emergency"]),kw=rt.extend({level:Ai}),zd=we.extend({method:D("logging/setLevel"),params:kw}),ww=st.extend({level:Ai,logger:v().optional(),data:de()}),Sw=ct.extend({method:D("notifications/message"),params:ww}),zw=j({name:v().optional()}),Iw=j({hints:Y(zw).optional(),costPriority:oe().min(0).max(1).optional(),speedPriority:oe().min(0).max(1).optional(),intelligencePriority:oe().min(0).max(1).optional()}),Pw=j({mode:Oe(["auto","required","none"]).optional()}),jw=j({type:D("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:Y(wd).default([]),structuredContent:j({}).loose().optional(),isError:be().optional(),_meta:me(v(),de()).optional()}),Tw=ka("type",[bd,xd,kd]),Ia=ka("type",[bd,xd,kd,pw,jw]),Ew=j({role:Zi,content:se([Ia,Y(Ia)]),_meta:me(v(),de()).optional()}),Ow=ji.extend({messages:Y(Ew),modelPreferences:Iw.optional(),systemPrompt:v().optional(),includeContext:Oe(["none","thisServer","allServers"]).optional(),temperature:oe().optional(),maxTokens:oe().int(),stopSequences:Y(v()).optional(),metadata:ke.optional(),tools:Y(rv).optional(),toolChoice:Pw.optional()}),Dw=we.extend({method:D("sampling/createMessage"),params:Ow}),Id=Se.extend({model:v(),stopReason:he(Oe(["endTurn","stopSequence","maxTokens"]).or(v())),role:Zi,content:Tw}),Pd=Se.extend({model:v(),stopReason:he(Oe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:Zi,content:se([Ia,Y(Ia)])}),Nw=j({type:D("boolean"),title:v().optional(),description:v().optional(),default:be().optional()}),Rw=j({type:D("string"),title:v().optional(),description:v().optional(),minLength:oe().optional(),maxLength:oe().optional(),format:Oe(["email","uri","date","date-time"]).optional(),default:v().optional()}),Zw=j({type:Oe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:oe().optional(),maximum:oe().optional(),default:oe().optional()}),Cw=j({type:D("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),Aw=j({type:D("string"),title:v().optional(),description:v().optional(),oneOf:Y(j({const:v(),title:v()})),default:v().optional()}),Uw=j({type:D("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),Mw=se([Cw,Aw]),Fw=j({type:D("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:j({type:D("string"),enum:Y(v())}),default:Y(v()).optional()}),qw=j({type:D("array"),title:v().optional(),description:v().optional(),minItems:oe().optional(),maxItems:oe().optional(),items:j({anyOf:Y(j({const:v(),title:v()}))}),default:Y(v()).optional()}),Lw=se([Fw,qw]),Vw=se([Uw,Mw,Lw]),Jw=se([Vw,Nw,Rw,Zw]),Kw=ji.extend({mode:D("form").optional(),message:v(),requestedSchema:j({type:D("object"),properties:me(v(),Jw),required:Y(v()).optional()})}),Hw=ji.extend({mode:D("url"),message:v(),elicitationId:v(),url:v().url()}),Bw=se([Kw,Hw]),Ww=we.extend({method:D("elicitation/create"),params:Bw}),Gw=st.extend({elicitationId:v()}),Xw=ct.extend({method:D("notifications/elicitation/complete"),params:Gw}),Fa=Se.extend({action:Oe(["accept","decline","cancel"]),content:za(e=>e===null?void 0:e,me(v(),se([v(),oe(),be(),Y(v())])).optional())}),Yw=j({type:D("ref/resource"),uri:v()});var Qw=j({type:D("ref/prompt"),name:v()}),eS=rt.extend({ref:se([Qw,Yw]),argument:j({name:v(),value:v()}),context:j({arguments:me(v(),v()).optional()}).optional()}),tS=we.extend({method:D("completion/complete"),params:eS});var rS=Se.extend({completion:Ee({values:Y(v()).max(100),total:he(oe().int()),hasMore:he(be())})}),nS=j({uri:v().startsWith("file://"),name:v().optional(),_meta:me(v(),de()).optional()}),iS=we.extend({method:D("roots/list"),params:rt.optional()}),jd=Se.extend({roots:Y(nS)}),oS=ct.extend({method:D("notifications/roots/list_changed"),params:st.optional()}),z4=se([Oa,fd,tS,zd,$d,_d,gd,Xk,yd,nw,ow,Ci,Sd,Na,Za,Ca,Ua]),I4=se([Ea,Da,md,oS,Ri]),P4=se([Ta,Id,Pd,Fa,jd,Ra,Aa,cn]),j4=se([Oa,Dw,Ww,iS,Na,Za,Ca,Ua]),T4=se([Ea,Da,Sw,sw,tw,xw,vw,Ri,Xw]),E4=se([Ta,Lk,rS,gw,lw,Gk,Yk,ew,Ma,$w,Ra,Aa,cn]),R=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===q.UrlElicitationRequired&&n){let i=n;if(i.elicitations)return new sd(i.elicitations,r)}return new e(t,r,n)}},sd=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(q.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function tr(e){return e==="completed"||e==="failed"||e==="cancelled"}var dR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Td(e){let r=da(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Mh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Ed(e,t){let r=Qt(e,t);if(!r.success)throw r.error;return r.data}var dS=6e4,qa=class{constructor(t){this._options=t,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(Ea,r=>{this._oncancel(r)}),this.setNotificationHandler(Da,r=>{this._onprogress(r)}),this.setRequestHandler(Oa,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Na,async(r,n)=>{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new R(q.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Za,async(r,n)=>{let i=async()=>{let o=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(o,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new R(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(o,n.sessionId);if(!a)throw new R(q.InvalidParams,`Task not found: ${o}`);if(!tr(a.status))return await this._waitForTaskUpdate(o,n.signal),await i();if(tr(a.status)){let s=await this._taskStore.getTaskResult(o,n.sessionId);return this._clearTaskQueue(o),{...s,_meta:{...s._meta,[er]:{taskId:o}}}}return await i()};return await i()}),this.setRequestHandler(Ca,async(r,n)=>{try{let{tasks:i,nextCursor:o}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:i,nextCursor:o,_meta:{}}}catch(i){throw new R(q.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Ua,async(r,n)=>{try{let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new R(q.InvalidParams,`Task not found: ${r.params.taskId}`);if(tr(i.status))throw new R(q.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(q.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...o}}catch(i){throw i instanceof R?i:new R(q.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,i,o=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(i,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:o,onTimeout:i})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),R.fromError(q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=o=>{n?.(o),this._onerror(o)};let i=this._transport?.onmessage;this._transport.onmessage=(o,a)=>{i?.(o,a),Ti(o)||Bg(o)?this._onresponse(o):ld(o)?this._onrequest(o,a):Hg(o)?this._onnotification(o):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(q.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,i=this._transport,o=t.params?._meta?.[er]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:q.MethodNotFound,message:"Method not found"}};o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:l,timestamp:Date.now()},i?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):i?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=Vg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,i?.sessionId):void 0,u={signal:a.signal,sessionId:i?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};o&&(d.relatedTask={taskId:o}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new R(q.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};o&&!f.relatedTask&&(f.relatedTask={taskId:o});let m=f.relatedTask?.taskId??o;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:q.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:d,timestamp:Date.now()},i?.sessionId):await i?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.params,i=Number(r),o=this._progressHandlers.get(i);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(t)}`));return}let a=this._responseHandlers.get(i),s=this._timeoutInfo.get(i);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(c){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),a(c);return}o(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Ti(t))n(t);else{let a=new R(t.error.code,t.error.message,t.error.data);n(a)}return}let i=this._responseHandlers.get(r);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let o=!1;if(Ti(t)&&t.result&&typeof t.result=="object"){let a=t.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(o=!0,this._taskProgressTokens.set(s.taskId,r))}}if(o||this._progressHandlers.delete(r),Ti(t))i(t);else{let a=R.fromError(t.error.code,t.error.message,t.error.data);i(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:i}=n??{};if(!i){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof R?a:new R(q.InternalError,String(a))}}return}let o;try{let a=await this.request(t,cn,n);if(a.task)o=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new R(q.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:o},n);if(yield{type:"taskStatus",task:s},tr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)}:s.status==="failed"?yield{type:"error",error:new R(q.InternalError,`Task ${o} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new R(q.InternalError,`Task ${o} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:o},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof R?a:new R(q.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=_=>{l(_)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(_){d(_);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[er]:c}});let m=_=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(_)}},{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));let b=_ instanceof R?_:new R(q.RequestTimeout,String(_));l(b)};this._responseHandlers.set(p,_=>{if(!n?.signal?.aborted){if(_ instanceof Error)return l(_);try{let b=Qt(r,_.result);b.success?u(b.data):l(b.error)}catch(b){l(b)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??dS,y=()=>m(R.fromError(q.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let $=c?.taskId;if($){let _=b=>{let T=this._responseHandlers.get(p);T?T(b):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,_),this._enqueueTaskMessage($,{type:"request",message:f,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(p),l(b)})}else this._transport.send(f,{relatedRequestId:i,resumptionToken:o,onresumptiontoken:a}).catch(_=>{this._cleanupTimeout(p),l(_)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ra,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Aa,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Xg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[er]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[er]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[er]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Td(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(i,o)=>{let a=Ed(t,i);return Promise.resolve(r(a,o))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Td(t);this._notificationHandlers.set(n,i=>{let o=Ed(t,i);return Promise.resolve(r(o))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(t,r,n,i)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let i of n)if(i.type==="request"&&ld(i.message)){let o=i.message.id,a=this._requestResolvers.get(o);a?(a(new R(q.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(o)):this._onerror(new Error(`Resolver missing for request ${o} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let i=await this._taskStore?.getTask(t);i?.pollInterval&&(n=i.pollInterval)}catch{}return new Promise((i,o)=>{if(r.aborted){o(new R(q.InvalidRequest,"Request cancelled"));return}let a=setTimeout(i,n);r.addEventListener("abort",()=>{clearTimeout(a),o(new R(q.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async i=>{if(!t)throw new Error("No request provided");return await n.createTask(i,t.id,{method:t.method,params:t.params},r)},getTask:async i=>{let o=await n.getTask(i,r);if(!o)throw new R(q.InvalidParams,"Failed to retrieve task: Task not found");return o},storeTaskResult:async(i,o,a)=>{await n.storeTaskResult(i,o,a,r);let s=await n.getTask(i,r);if(s){let c=Ri.parse({method:"notifications/tasks/status",params:s});await this.notification(c),tr(s.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>n.getTaskResult(i,r),updateTaskStatus:async(i,o,a)=>{let s=await n.getTask(i,r);if(!s)throw new R(q.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(tr(s.status))throw new R(q.InvalidParams,`Cannot update task "${i}" from terminal status "${s.status}" to "${o}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(i,o,a,r);let c=await n.getTask(i,r);if(c){let u=Ri.parse({method:"notifications/tasks/status",params:c});await this.notification(u),tr(c.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>n.listTasks(i,r)}}};function nv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function iv(e,t){let r={...e};for(let n in t){let i=n,o=t[i];if(o===void 0)continue;let a=r[i];nv(a)&&nv(o)?r[i]={...a,...o}:r[i]=o}return r}var c$=ft(zf(),1),u$=ft(s$(),1);function AT(){let e=new c$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,u$.default)(e),e}var zs=class{constructor(t){this._ajv=t??AT()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Is=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function l$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function d$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Ps=class extends qa{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ai.options.map((n,i)=>[n,i])),this.isMessageIgnored=(n,i)=>{let o=this._loggingLevels.get(i);return o?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new zs,this.setRequestHandler(fd,n=>this._oninitialize(n)),this.setNotificationHandler(md,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(zd,async(n,i)=>{let o=i.sessionId||i.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Ai.safeParse(a);return s.success&&this._loggingLevels.set(o,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Is(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=iv(this._capabilities,t)}setRequestHandler(t,r){let i=da(t)?.method;if(!i)throw new Error("Schema is missing a method literal");let o;if(on(i)){let s=i;o=s._zod?.def?.value??s.value}else{let s=i;o=s._def?.value??s.value}if(typeof o!="string")throw new Error("Schema method literal must be a string");if(o==="tools/call"){let s=async(c,u)=>{let l=Qt(Ci,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(q.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let m=Qt(cn,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new R(q.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=Qt(Ma,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(q.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){d$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&l$(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Fg.includes(r)?r:cd,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Ta)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],i=Array.isArray(n.content)?n.content:[n.content],o=i.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(o){if(i.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(i.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},Pd,r):this.request({method:"sampling/createMessage",params:t},Id,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let i=t;return this.request({method:"elicitation/create",params:i},Fa,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let i=t.mode==="form"?t:{...t,mode:"form"},o=await this.request({method:"elicitation/create",params:i},Fa,r);if(o.action==="accept"&&o.content&&i.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(i.requestedSchema)(o.content);if(!s.valid)throw new R(q.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof R?a:new R(q.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return o}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},jd,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Nf=ft(require("node:process"),1);var js=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
48
|
-
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),
|
|
49
|
-
`}var Ts=class{constructor(t=Nf.default.stdin,r=Nf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new js,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=p$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var je=ft(require("fs/promises")),ye=ft(require("path")),In=10*1024*1024,f$=1e3,Es=class{skillsPath;cachedSkills=null;loadingPromise=null;skillMap=new Map;contentCache=new Map;canonicalPathMap=new Map;scanEpoch=0;lastSuccessfulScanAt=0;constructor(t){this.skillsPath=ye.resolve(t)}stripQuotes(t){return t.replace(/^"(.*)"$|^'(.*)'$/,"$1$2").trim()}parseFrontmatter(t){let r=t;if(r.charCodeAt(0)===65279&&(r=r.slice(1)),!r.startsWith("---"))return{name:"",description:"",body:r.trim()};let n=r.slice(3).match(/\r?\n[ \t]*---[ \t]*(?:\r?\n|$)/);if(!n||n.index===void 0)return{name:"",description:"",body:r.trim()};let
|
|
50
|
-
`),null}}));for(let d of l.filter(p=>p!==null).sort((p,f)=>p.directoryName<f.directoryName?-1:p.directoryName>f.directoryName?1:0)){let{item:p,body:f,realFilePath:m,directoryName:h}=d,y=new Set([p.name.toLowerCase(),h.toLowerCase()]),$=[...y].find(b=>
|
|
51
|
-
`);continue}n.push(p);for(let b of y)
|
|
52
|
-
`)}return s&&t===this.scanEpoch&&(this.skillMap=
|
|
53
|
-
`||l==="\r")&&(a=!1,n.push(l));continue}if(s){l==="*"&&d==="/"&&(s=!1,u++);continue}if(
|
|
54
|
-
`&&l!=="\r"&&(c=-1),n.push(l)}return n.join("")}function
|
|
45
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");let _=f.compile();return(b,T)=>_(p,b,T)},i,a=hr,s=!ki.jitless,u=s&&Hs.value,l=t.catchall,d;e._zod.parse=(p,f)=>{d??(d=n.value);let m=p.value;return a(m)?s&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=o(t.shape)),p=i(p,f),l?Bm([],m,p,f,d,e):p):r(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p)}});function Cm(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Xt(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>He(a,n,xe())))}),t)}var co=g("$ZodUnion",(e,t)=>{V.init(e,t),H(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),H(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),H(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),H(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Hn(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)s.push(u),a=!0;else{if(u.issues.length===0)return u;s.push(u)}}return a?Promise.all(s).then(c=>Cm(c,o,e,i)):Cm(s,o,e,i)}});function Zm(e,t,r,n){let o=e.filter(i=>i.issues.length===0);return o.length===1?(t.value=o[0].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>He(a,n,xe())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var du=g("$ZodXor",(e,t)=>{co.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of t.options){let u=c._zod.run({value:o.value,issues:[]},i);u instanceof Promise?(s.push(u),a=!0):s.push(u)}return a?Promise.all(s).then(c=>Zm(c,o,e,i)):Zm(s,o,e,i)}}),pu=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,co.init(e,t);let r=e._zod.parse;H(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Xr(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!hr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),fu=g("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Am(r,c,u)):Am(r,i,a)}});function Pc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Gt(e)&&Gt(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Pc(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],a=Pc(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 Am(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),Xt(e))return e;let a=Pc(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Ui=g("$ZodTuple",(e,t)=>{V.init(e,t);let r=t.items;e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){let l=i.length>r.length,d=i.length<c-1;if(l||d)return n.issues.push({...l?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(p=>Oi(p,n,u))):Oi(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let p=t.rest._zod.run({value:d,issues:[]},o);p instanceof Promise?a.push(p.then(f=>Oi(f,n,u))):Oi(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Oi(e,t,r){e.issues.length&&t.issues.push(...Qe(r,e.issues)),t.value[r]=e.value}var mu=g("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Gt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Qe(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Qe(u,l.issues)),r.value[u]=l.value)}let c;for(let u in o)s.has(u)||(c=c??[],c.push(u));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=t.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof s=="string"&&Ti.test(s)&&c.issues.length){let d=t.keyType._zod.run({value:Number(s),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(c=d)}if(c.issues.length){t.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(d=>He(d,n,xe())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Qe(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Qe(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),hu=g("$ZodMap",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=t.keyType._zod.run({value:a,issues:[]},n),u=t.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{Um(l,d,r,a,o,e,n)})):Um(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function Um(e,t,r,n,o,i,a){e.issues.length&&(Kn.has(typeof n)?r.issues.push(...Qe(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>He(s,a,xe()))})),t.issues.length&&(Kn.has(typeof n)?r.issues.push(...Qe(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>He(s,a,xe()))})),r.value.set(e.value,t.value)}var gu=g("$ZodSet",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=t.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>Mm(c,r))):Mm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Mm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var vu=g("$ZodEnum",(e,t)=>{V.init(e,t);let r=Jn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Kn.has(typeof o)).map(o=>typeof o=="string"?it(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),yu=g("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?it(n):n?it(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),_u=g("$ZodFile",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),$u=g("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);let o=t.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 kt;return r.value=o,r}});function Fm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Mi=g("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),H(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Hn(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Fm(i,r.value)):Fm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),bu=g("$ZodExactOptional",(e,t)=>{Mi.init(e,t),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),xu=g("$ZodNullable",(e,t)=>{V.init(e,t),H(e._zod,"optin",()=>t.innerType._zod.optin),H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Hn(r.source)}|null)$`):void 0}),H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ku=g("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>qm(i,t)):qm(o,t)}});function qm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var wu=g("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Su=g("$ZodNonOptional",(e,t)=>{V.init(e,t),H(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Lm(i,e)):Lm(o,e)}});function Lm(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var zu=g("$ZodSuccess",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr("ZodSuccess");let o=t.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)}}),Iu=g("$ZodCatch",(e,t)=>{V.init(e,t),H(e._zod,"optin",()=>t.innerType._zod.optin),H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>He(a,n,xe()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>He(i,n,xe()))},input:r.value}),r.issues=[]),r)}}),Pu=g("$ZodNaN",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),ju=g("$ZodPipe",(e,t)=>{V.init(e,t),H(e._zod,"values",()=>t.in._zod.values),H(e._zod,"optin",()=>t.in._zod.optin),H(e._zod,"optout",()=>t.out._zod.optout),H(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Di(a,t.in,n)):Di(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Di(i,t.out,n)):Di(o,t.out,n)}});function Di(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var uo=g("$ZodCodec",(e,t)=>{V.init(e,t),H(e._zod,"values",()=>t.in._zod.values),H(e._zod,"optin",()=>t.in._zod.optin),H(e._zod,"optout",()=>t.out._zod.optout),H(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Ni(a,t,n)):Ni(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ni(a,t,n)):Ni(i,t,n)}}});function Ni(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Ri(e,i,t.out,r)):Ri(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Ri(e,i,t.in,r)):Ri(e,o,t.in,r)}}function Ri(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Tu=g("$ZodReadonly",(e,t)=>{V.init(e,t),H(e._zod,"propValues",()=>t.innerType._zod.propValues),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"optin",()=>t.innerType?._zod?.optin),H(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Vm):Vm(o)}});function Vm(e){return e.value=Object.freeze(e.value),e}var Eu=g("$ZodTemplateLiteral",(e,t)=>{V.init(e,t);let r=[];for(let n of t.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||Bs.has(typeof n))r.push(it(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Ou=g("$ZodFunction",(e,t)=>(V.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=e._def.input?Yn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Yn(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=e._def.input?await eo(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await eo(e._def.output,i):i}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Ui({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Du=g("$ZodPromise",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),Nu=g("$ZodLazy",(e,t)=>{V.init(e,t),H(e._zod,"innerType",()=>t.getter()),H(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),H(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),H(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),H(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ru=g("$ZodCustom",(e,t)=>{ue.init(e,t),V.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Jm(i,r,n,e));Jm(o,r,n,e)}});function Jm(e,t,r,n){if(!e){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),t.issues.push(Yr(o))}}var ex=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??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"},n={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{let i=n[o.expected]??o.expected,a=F(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${A(o.values[0])}`:`Invalid option: expected one of ${Z(o.values,"|")}`;case"too_big":{let i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{let i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{let i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${r[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${Z(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Cu(){return{localeError:ex()}}var Xm;var Au=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Uu(){return new Au}(Xm=globalThis).__zod_globalRegistry??(Xm.__zod_globalRegistry=Uu());var Fe=globalThis.__zod_globalRegistry;function Mu(e,t){return new e({type:"string",...z(t)})}function Fi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}function lo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function qi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}function Li(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}function Vi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}function Ji(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}function po(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function Hi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}function Ki(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}function Bi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}function Wi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}function Gi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}function Xi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}function Yi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}function Qi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function ea(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function Fu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...z(t)})}function ta(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}function ra(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}function na(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}function oa(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}function ia(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}function aa(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}function qu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}function Lu(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}function Vu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}function Ju(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}function Hu(e,t){return new e({type:"number",checks:[],...z(t)})}function Ku(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}function Bu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...z(t)})}function Wu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...z(t)})}function Gu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...z(t)})}function Xu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...z(t)})}function Yu(e,t){return new e({type:"boolean",...z(t)})}function Qu(e,t){return new e({type:"bigint",...z(t)})}function el(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...z(t)})}function tl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...z(t)})}function rl(e,t){return new e({type:"symbol",...z(t)})}function nl(e,t){return new e({type:"undefined",...z(t)})}function ol(e,t){return new e({type:"null",...z(t)})}function il(e){return new e({type:"any"})}function al(e){return new e({type:"unknown"})}function sl(e,t){return new e({type:"never",...z(t)})}function cl(e,t){return new e({type:"void",...z(t)})}function ul(e,t){return new e({type:"date",...z(t)})}function ll(e,t){return new e({type:"nan",...z(t)})}function Ct(e,t){return new zc({check:"less_than",...z(t),value:e,inclusive:!1})}function et(e,t){return new zc({check:"less_than",...z(t),value:e,inclusive:!0})}function Zt(e,t){return new Ic({check:"greater_than",...z(t),value:e,inclusive:!1})}function qe(e,t){return new Ic({check:"greater_than",...z(t),value:e,inclusive:!0})}function dl(e){return Zt(0,e)}function pl(e){return Ct(0,e)}function fl(e){return et(0,e)}function ml(e){return qe(0,e)}function yr(e,t){return new hm({check:"multiple_of",...z(t),value:e})}function _r(e,t){return new ym({check:"max_size",...z(t),maximum:e})}function At(e,t){return new _m({check:"min_size",...z(t),minimum:e})}function en(e,t){return new $m({check:"size_equals",...z(t),size:e})}function tn(e,t){return new bm({check:"max_length",...z(t),maximum:e})}function Yt(e,t){return new xm({check:"min_length",...z(t),minimum:e})}function rn(e,t){return new km({check:"length_equals",...z(t),length:e})}function fo(e,t){return new wm({check:"string_format",format:"regex",...z(t),pattern:e})}function mo(e){return new Sm({check:"string_format",format:"lowercase",...z(e)})}function ho(e){return new zm({check:"string_format",format:"uppercase",...z(e)})}function go(e,t){return new Im({check:"string_format",format:"includes",...z(t),includes:e})}function vo(e,t){return new Pm({check:"string_format",format:"starts_with",...z(t),prefix:e})}function yo(e,t){return new jm({check:"string_format",format:"ends_with",...z(t),suffix:e})}function hl(e,t,r){return new Tm({check:"property",property:e,schema:t,...z(r)})}function _o(e,t){return new Em({check:"mime_type",mime:e,...z(t)})}function wt(e){return new Om({check:"overwrite",tx:e})}function $o(e){return wt(t=>t.normalize(e))}function bo(){return wt(e=>e.trim())}function xo(){return wt(e=>e.toLowerCase())}function ko(){return wt(e=>e.toUpperCase())}function sa(){return wt(e=>Js(e))}function Ym(e,t,r){return new e({type:"array",element:t,...z(r)})}function gl(e,t){return new e({type:"file",...z(t)})}function vl(e,t,r){let n=z(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function yl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...z(r)})}function _l(e){let t=ox(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Yr(n,r.value,t._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=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Yr(o))}},e(r.value,r)));return t}function ox(e,t){let r=new ue({check:"custom",...z(t)});return r._zod.check=e,r}function $l(e){let t=new ue({check:"describe"});return t._zod.onattach=[r=>{let n=Fe.get(r)??{};Fe.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function bl(e){let t=new ue({check:"meta"});return t._zod.onattach=[r=>{let n=Fe.get(r)??{};Fe.add(r,{...n,...e})}],t._zod.check=()=>{},t}function xl(e,t){let r=z(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(f=>typeof f=="string"?f.toLowerCase():f),o=o.map(f=>typeof f=="string"?f.toLowerCase():f));let i=new Set(n),a=new Set(o),s=e.Codec??uo,c=e.Boolean??so,u=e.String??vr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((f,m)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(m.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:m.value,inst:p,continue:!1}),{})}),reverseTransform:((f,m)=>f===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function nn(e,t,r,n={}){let o=z(n),i={...z(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}function ca(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Fe,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function fe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let p=a.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Le(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function ua(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=n.get(s);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(s,a[0])}}let o=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,p=e.external.uri??(m=>m);if(d)return{ref:p(d)};let f=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${s}/${f}`}}if(a[1]===r)return{ref:"#"};let u=`#/${s}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+l}},i=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=o(a);s.def={...s.schema},u&&(s.defId=u);let l=s.schema;for(let d in l)delete l[d];l.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
46
|
+
|
|
47
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1&&e.reused==="ref"){i(a);continue}}}function la(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=e.seen.get(a);if(s.ref===null)return;let c=s.def??s.schema,u={...c},l=s.ref;if(s.ref=null,l){n(l);let p=e.seen.get(l),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(f.$ref&&p.def)for(let h in c)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(c[h])===JSON.stringify(p.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let p=e.seen.get(d);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:wo(t,"input",e.processors),output:wo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Le(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Le(n.element,r);if(n.type==="set")return Le(n.valueType,r);if(n.type==="lazy")return Le(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 Le(n.innerType,r);if(n.type==="intersection")return Le(n.left,r)||Le(n.right,r);if(n.type==="record"||n.type==="map")return Le(n.keyType,r)||Le(n.valueType,r);if(n.type==="pipe")return Le(n.in,r)||Le(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Le(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Le(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Le(o,r))return!0;return!!(n.rest&&Le(n.rest,r))}return!1}var Qm=(e,t={})=>r=>{let n=ca({...r,processors:t});return fe(e,n),ua(n,e),la(n,e)},wo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=ca({...o??{},target:i,io:t,processors:r});return fe(e,a),ua(a,e),la(a,e)};var ix={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},eh=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),s&&(o.format=ix[s]??s,o.format===""&&delete o.format,s==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let l=[...c];l.length===1?o.pattern=l[0].source:l.length>1&&(o.allOf=[...l.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},th=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=e._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&t.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},rh=(e,t,r,n)=>{r.type="boolean"},nh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},oh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},ih=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ah=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},ch=(e,t,r,n)=>{r.not={}},uh=(e,t,r,n)=>{},lh=(e,t,r,n)=>{},dh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ph=(e,t,r,n)=>{let o=e._zod.def,i=Jn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},fh=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.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,t.target==="draft-04"||t.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},mh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},hh=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},gh=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(o,i)):(Object.assign(o,i),o.anyOf=c.map(u=>({contentMediaType:u}))):Object.assign(o,i)},vh=(e,t,r,n)=>{r.type="boolean"},yh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},_h=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},$h=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},xh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},kh=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,t,{...n,path:[...n.path,"items"]})},wh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},kl=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Sh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},zh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,f)=>fe(p,t,{...n,path:[...n.path,a,f]})),u=i.rest?fe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},Ih=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=fe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},Ph=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},jh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Th=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Eh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Oh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);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},Dh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,t,n);let a=t.seen.get(e);a.ref=i},Nh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Rh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},wl=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ch=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o};function on(e){return!!e._zod}function Qt(e,t){return on(e)?Qr(e,t):e.safeParse(t)}function da(e){if(!e)return;let t;if(on(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Mh(e){if(on(e)){let i=e._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=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=e.value;if(n!==void 0)return n}var So={};En(So,{ZodAny:()=>og,ZodArray:()=>cg,ZodBase64:()=>Bl,ZodBase64URL:()=>Wl,ZodBigInt:()=>$a,ZodBigIntFormat:()=>Yl,ZodBoolean:()=>_a,ZodCIDRv4:()=>Hl,ZodCIDRv6:()=>Kl,ZodCUID:()=>Ul,ZodCUID2:()=>Ml,ZodCatch:()=>Pg,ZodCodec:()=>id,ZodCustom:()=>Sa,ZodCustomStringFormat:()=>Io,ZodDate:()=>ed,ZodDefault:()=>xg,ZodDiscriminatedUnion:()=>lg,ZodE164:()=>Gl,ZodEmail:()=>Cl,ZodEmoji:()=>Zl,ZodEnum:()=>zo,ZodExactOptional:()=>_g,ZodFile:()=>vg,ZodFunction:()=>Zg,ZodGUID:()=>fa,ZodIPv4:()=>Vl,ZodIPv6:()=>Jl,ZodIntersection:()=>dg,ZodJWT:()=>Xl,ZodKSUID:()=>Ll,ZodLazy:()=>Ng,ZodLiteral:()=>gg,ZodMAC:()=>eg,ZodMap:()=>mg,ZodNaN:()=>Tg,ZodNanoID:()=>Al,ZodNever:()=>ag,ZodNonOptional:()=>nd,ZodNull:()=>ng,ZodNullable:()=>bg,ZodNumber:()=>ya,ZodNumberFormat:()=>an,ZodObject:()=>ba,ZodOptional:()=>rd,ZodPipe:()=>od,ZodPrefault:()=>wg,ZodPromise:()=>Cg,ZodReadonly:()=>Eg,ZodRecord:()=>wa,ZodSet:()=>hg,ZodString:()=>ga,ZodStringFormat:()=>le,ZodSuccess:()=>Ig,ZodSymbol:()=>tg,ZodTemplateLiteral:()=>Dg,ZodTransform:()=>yg,ZodTuple:()=>pg,ZodType:()=>K,ZodULID:()=>Fl,ZodURL:()=>va,ZodUUID:()=>Ut,ZodUndefined:()=>rg,ZodUnion:()=>xa,ZodUnknown:()=>ig,ZodVoid:()=>sg,ZodXID:()=>ql,ZodXor:()=>ug,_ZodString:()=>Rl,_default:()=>kg,_function:()=>kk,any:()=>ik,array:()=>Y,base64:()=>qx,base64url:()=>Lx,bigint:()=>ek,boolean:()=>be,catch:()=>jg,check:()=>wk,cidrv4:()=>Mx,cidrv6:()=>Fx,codec:()=>$k,cuid:()=>Ox,cuid2:()=>Dx,custom:()=>ad,date:()=>sk,describe:()=>Sk,discriminatedUnion:()=>ka,e164:()=>Vx,email:()=>xx,emoji:()=>Tx,enum:()=>Oe,exactOptional:()=>$g,file:()=>gk,float32:()=>Gx,float64:()=>Xx,function:()=>kk,guid:()=>kx,hash:()=>Wx,hex:()=>Bx,hostname:()=>Kx,httpUrl:()=>jx,instanceof:()=>Ik,int:()=>Nl,int32:()=>Yx,int64:()=>tk,intersection:()=>jo,ipv4:()=>Zx,ipv6:()=>Ux,json:()=>jk,jwt:()=>Jx,keyof:()=>ck,ksuid:()=>Cx,lazy:()=>Rg,literal:()=>D,looseObject:()=>Ee,looseRecord:()=>pk,mac:()=>Ax,map:()=>fk,meta:()=>zk,nan:()=>_k,nanoid:()=>Ex,nativeEnum:()=>hk,never:()=>Ql,nonoptional:()=>zg,null:()=>Po,nullable:()=>ma,nullish:()=>vk,number:()=>ie,object:()=>j,optional:()=>he,partialRecord:()=>dk,pipe:()=>ha,prefault:()=>Sg,preprocess:()=>za,promise:()=>xk,readonly:()=>Og,record:()=>me,refine:()=>Ag,set:()=>mk,strictObject:()=>uk,string:()=>v,stringFormat:()=>Hx,stringbool:()=>Pk,success:()=>yk,superRefine:()=>Ug,symbol:()=>nk,templateLiteral:()=>bk,transform:()=>td,tuple:()=>fg,uint32:()=>Qx,uint64:()=>rk,ulid:()=>Nx,undefined:()=>ok,union:()=>se,unknown:()=>de,url:()=>Px,uuid:()=>wx,uuidv4:()=>Sx,uuidv6:()=>zx,uuidv7:()=>Ix,void:()=>ak,xid:()=>Rx,xor:()=>lk});var pa={};En(pa,{endsWith:()=>yo,gt:()=>Zt,gte:()=>qe,includes:()=>go,length:()=>rn,lowercase:()=>mo,lt:()=>Ct,lte:()=>et,maxLength:()=>tn,maxSize:()=>_r,mime:()=>_o,minLength:()=>Yt,minSize:()=>At,multipleOf:()=>yr,negative:()=>pl,nonnegative:()=>ml,nonpositive:()=>fl,normalize:()=>$o,overwrite:()=>wt,positive:()=>dl,property:()=>hl,regex:()=>fo,size:()=>en,slugify:()=>sa,startsWith:()=>vo,toLowerCase:()=>xo,toUpperCase:()=>ko,trim:()=>bo,uppercase:()=>ho});var $r={};En($r,{ZodISODate:()=>Pl,ZodISODateTime:()=>zl,ZodISODuration:()=>Ol,ZodISOTime:()=>Tl,date:()=>jl,datetime:()=>Il,duration:()=>Dl,time:()=>El});var zl=g("ZodISODateTime",(e,t)=>{Mc.init(e,t),le.init(e,t)});function Il(e){return qu(zl,e)}var Pl=g("ZodISODate",(e,t)=>{Fc.init(e,t),le.init(e,t)});function jl(e){return Lu(Pl,e)}var Tl=g("ZodISOTime",(e,t)=>{qc.init(e,t),le.init(e,t)});function El(e){return Vu(Tl,e)}var Ol=g("ZodISODuration",(e,t)=>{Lc.init(e,t),le.init(e,t)});function Dl(e){return Ju(Ol,e)}var Fh=(e,t)=>{zi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Pi(e,r)},flatten:{value:r=>Ii(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Gr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Gr,2)}},isEmpty:{get(){return e.issues.length===0}}})},GN=g("ZodError",Fh),tt=g("ZodError",Fh,{Parent:Error});var qh=Xn(tt),Lh=Qn(tt),Vh=to(tt),Jh=ro(tt),Hh=rm(tt),Kh=nm(tt),Bh=om(tt),Wh=im(tt),Gh=am(tt),Xh=sm(tt),Yh=cm(tt),Qh=um(tt);var K=g("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:wo(e,"input"),output:wo(e,"output")}}),e.toJSONSchema=Qm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(k.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>Me(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>qh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Vh(e,r,n),e.parseAsync=async(r,n)=>Lh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Jh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Hh(e,r,n),e.decode=(r,n)=>Kh(e,r,n),e.encodeAsync=async(r,n)=>Bh(e,r,n),e.decodeAsync=async(r,n)=>Wh(e,r,n),e.safeEncode=(r,n)=>Gh(e,r,n),e.safeDecode=(r,n)=>Xh(e,r,n),e.safeEncodeAsync=async(r,n)=>Yh(e,r,n),e.safeDecodeAsync=async(r,n)=>Qh(e,r,n),e.refine=(r,n)=>e.check(Ag(r,n)),e.superRefine=r=>e.check(Ug(r)),e.overwrite=r=>e.check(wt(r)),e.optional=()=>he(e),e.exactOptional=()=>$g(e),e.nullable=()=>ma(e),e.nullish=()=>he(ma(e)),e.nonoptional=r=>zg(e,r),e.array=()=>Y(e),e.or=r=>se([e,r]),e.and=r=>jo(e,r),e.transform=r=>ha(e,td(r)),e.default=r=>kg(e,r),e.prefault=r=>Sg(e,r),e.catch=r=>jg(e,r),e.pipe=r=>ha(e,r),e.readonly=()=>Og(e),e.describe=r=>{let n=e.clone();return Fe.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Fe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Fe.get(e);let n=e.clone();return Fe.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Rl=g("_ZodString",(e,t)=>{vr.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,o,i)=>eh(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(fo(...n)),e.includes=(...n)=>e.check(go(...n)),e.startsWith=(...n)=>e.check(vo(...n)),e.endsWith=(...n)=>e.check(yo(...n)),e.min=(...n)=>e.check(Yt(...n)),e.max=(...n)=>e.check(tn(...n)),e.length=(...n)=>e.check(rn(...n)),e.nonempty=(...n)=>e.check(Yt(1,...n)),e.lowercase=n=>e.check(mo(n)),e.uppercase=n=>e.check(ho(n)),e.trim=()=>e.check(bo()),e.normalize=(...n)=>e.check($o(...n)),e.toLowerCase=()=>e.check(xo()),e.toUpperCase=()=>e.check(ko()),e.slugify=()=>e.check(sa())}),ga=g("ZodString",(e,t)=>{vr.init(e,t),Rl.init(e,t),e.email=r=>e.check(Fi(Cl,r)),e.url=r=>e.check(po(va,r)),e.jwt=r=>e.check(aa(Xl,r)),e.emoji=r=>e.check(Hi(Zl,r)),e.guid=r=>e.check(lo(fa,r)),e.uuid=r=>e.check(qi(Ut,r)),e.uuidv4=r=>e.check(Li(Ut,r)),e.uuidv6=r=>e.check(Vi(Ut,r)),e.uuidv7=r=>e.check(Ji(Ut,r)),e.nanoid=r=>e.check(Ki(Al,r)),e.guid=r=>e.check(lo(fa,r)),e.cuid=r=>e.check(Bi(Ul,r)),e.cuid2=r=>e.check(Wi(Ml,r)),e.ulid=r=>e.check(Gi(Fl,r)),e.base64=r=>e.check(na(Bl,r)),e.base64url=r=>e.check(oa(Wl,r)),e.xid=r=>e.check(Xi(ql,r)),e.ksuid=r=>e.check(Yi(Ll,r)),e.ipv4=r=>e.check(Qi(Vl,r)),e.ipv6=r=>e.check(ea(Jl,r)),e.cidrv4=r=>e.check(ta(Hl,r)),e.cidrv6=r=>e.check(ra(Kl,r)),e.e164=r=>e.check(ia(Gl,r)),e.datetime=r=>e.check(Il(r)),e.date=r=>e.check(jl(r)),e.time=r=>e.check(El(r)),e.duration=r=>e.check(Dl(r))});function v(e){return Mu(ga,e)}var le=g("ZodStringFormat",(e,t)=>{ae.init(e,t),Rl.init(e,t)}),Cl=g("ZodEmail",(e,t)=>{Ec.init(e,t),le.init(e,t)});function xx(e){return Fi(Cl,e)}var fa=g("ZodGUID",(e,t)=>{jc.init(e,t),le.init(e,t)});function kx(e){return lo(fa,e)}var Ut=g("ZodUUID",(e,t)=>{Tc.init(e,t),le.init(e,t)});function wx(e){return qi(Ut,e)}function Sx(e){return Li(Ut,e)}function zx(e){return Vi(Ut,e)}function Ix(e){return Ji(Ut,e)}var va=g("ZodURL",(e,t)=>{Oc.init(e,t),le.init(e,t)});function Px(e){return po(va,e)}function jx(e){return po(va,{protocol:/^https?$/,hostname:at.domain,...k.normalizeParams(e)})}var Zl=g("ZodEmoji",(e,t)=>{Dc.init(e,t),le.init(e,t)});function Tx(e){return Hi(Zl,e)}var Al=g("ZodNanoID",(e,t)=>{Nc.init(e,t),le.init(e,t)});function Ex(e){return Ki(Al,e)}var Ul=g("ZodCUID",(e,t)=>{Rc.init(e,t),le.init(e,t)});function Ox(e){return Bi(Ul,e)}var Ml=g("ZodCUID2",(e,t)=>{Cc.init(e,t),le.init(e,t)});function Dx(e){return Wi(Ml,e)}var Fl=g("ZodULID",(e,t)=>{Zc.init(e,t),le.init(e,t)});function Nx(e){return Gi(Fl,e)}var ql=g("ZodXID",(e,t)=>{Ac.init(e,t),le.init(e,t)});function Rx(e){return Xi(ql,e)}var Ll=g("ZodKSUID",(e,t)=>{Uc.init(e,t),le.init(e,t)});function Cx(e){return Yi(Ll,e)}var Vl=g("ZodIPv4",(e,t)=>{Vc.init(e,t),le.init(e,t)});function Zx(e){return Qi(Vl,e)}var eg=g("ZodMAC",(e,t)=>{Hc.init(e,t),le.init(e,t)});function Ax(e){return Fu(eg,e)}var Jl=g("ZodIPv6",(e,t)=>{Jc.init(e,t),le.init(e,t)});function Ux(e){return ea(Jl,e)}var Hl=g("ZodCIDRv4",(e,t)=>{Kc.init(e,t),le.init(e,t)});function Mx(e){return ta(Hl,e)}var Kl=g("ZodCIDRv6",(e,t)=>{Bc.init(e,t),le.init(e,t)});function Fx(e){return ra(Kl,e)}var Bl=g("ZodBase64",(e,t)=>{Wc.init(e,t),le.init(e,t)});function qx(e){return na(Bl,e)}var Wl=g("ZodBase64URL",(e,t)=>{Gc.init(e,t),le.init(e,t)});function Lx(e){return oa(Wl,e)}var Gl=g("ZodE164",(e,t)=>{Xc.init(e,t),le.init(e,t)});function Vx(e){return ia(Gl,e)}var Xl=g("ZodJWT",(e,t)=>{Yc.init(e,t),le.init(e,t)});function Jx(e){return aa(Xl,e)}var Io=g("ZodCustomStringFormat",(e,t)=>{Qc.init(e,t),le.init(e,t)});function Hx(e,t,r={}){return nn(Io,e,t,r)}function Kx(e){return nn(Io,"hostname",at.hostname,e)}function Bx(e){return nn(Io,"hex",at.hex,e)}function Wx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=at[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return nn(Io,n,o,t)}var ya=g("ZodNumber",(e,t)=>{Zi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,o,i)=>th(e,n,o,i),e.gt=(n,o)=>e.check(Zt(n,o)),e.gte=(n,o)=>e.check(qe(n,o)),e.min=(n,o)=>e.check(qe(n,o)),e.lt=(n,o)=>e.check(Ct(n,o)),e.lte=(n,o)=>e.check(et(n,o)),e.max=(n,o)=>e.check(et(n,o)),e.int=n=>e.check(Nl(n)),e.safe=n=>e.check(Nl(n)),e.positive=n=>e.check(Zt(0,n)),e.nonnegative=n=>e.check(qe(0,n)),e.negative=n=>e.check(Ct(0,n)),e.nonpositive=n=>e.check(et(0,n)),e.multipleOf=(n,o)=>e.check(yr(n,o)),e.step=(n,o)=>e.check(yr(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ie(e){return Hu(ya,e)}var an=g("ZodNumberFormat",(e,t)=>{eu.init(e,t),ya.init(e,t)});function Nl(e){return Ku(an,e)}function Gx(e){return Bu(an,e)}function Xx(e){return Wu(an,e)}function Yx(e){return Gu(an,e)}function Qx(e){return Xu(an,e)}var _a=g("ZodBoolean",(e,t)=>{so.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o)});function be(e){return Yu(_a,e)}var $a=g("ZodBigInt",(e,t)=>{Ai.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,o,i)=>nh(e,n,o,i),e.gte=(n,o)=>e.check(qe(n,o)),e.min=(n,o)=>e.check(qe(n,o)),e.gt=(n,o)=>e.check(Zt(n,o)),e.gte=(n,o)=>e.check(qe(n,o)),e.min=(n,o)=>e.check(qe(n,o)),e.lt=(n,o)=>e.check(Ct(n,o)),e.lte=(n,o)=>e.check(et(n,o)),e.max=(n,o)=>e.check(et(n,o)),e.positive=n=>e.check(Zt(BigInt(0),n)),e.negative=n=>e.check(Ct(BigInt(0),n)),e.nonpositive=n=>e.check(et(BigInt(0),n)),e.nonnegative=n=>e.check(qe(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(yr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function ek(e){return Qu($a,e)}var Yl=g("ZodBigIntFormat",(e,t)=>{tu.init(e,t),$a.init(e,t)});function tk(e){return el(Yl,e)}function rk(e){return tl(Yl,e)}var tg=g("ZodSymbol",(e,t)=>{ru.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o)});function nk(e){return rl(tg,e)}var rg=g("ZodUndefined",(e,t)=>{nu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o)});function ok(e){return nl(rg,e)}var ng=g("ZodNull",(e,t)=>{ou.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o)});function Po(e){return ol(ng,e)}var og=g("ZodAny",(e,t)=>{iu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o)});function ik(){return il(og)}var ig=g("ZodUnknown",(e,t)=>{au.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o)});function de(){return al(ig)}var ag=g("ZodNever",(e,t)=>{su.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ch(e,r,n,o)});function Ql(e){return sl(ag,e)}var sg=g("ZodVoid",(e,t)=>{cu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sh(e,r,n,o)});function ak(e){return cl(sg,e)}var ed=g("ZodDate",(e,t)=>{uu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,o,i)=>dh(e,n,o,i),e.min=(n,o)=>e.check(qe(n,o)),e.max=(n,o)=>e.check(et(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function sk(e){return ul(ed,e)}var cg=g("ZodArray",(e,t)=>{lu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Yt(r,n)),e.nonempty=r=>e.check(Yt(1,r)),e.max=(r,n)=>e.check(tn(r,n)),e.length=(r,n)=>e.check(rn(r,n)),e.unwrap=()=>e.element});function Y(e,t){return Ym(cg,e,t)}function ck(e){let t=e._zod.def.shape;return Oe(Object.keys(t))}var ba=g("ZodObject",(e,t)=>{Gm.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wh(e,r,n,o),k.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Oe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:de()}),e.loose=()=>e.clone({...e._zod.def,catchall:de()}),e.strict=()=>e.clone({...e._zod.def,catchall:Ql()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>k.extend(e,r),e.safeExtend=r=>k.safeExtend(e,r),e.merge=r=>k.merge(e,r),e.pick=r=>k.pick(e,r),e.omit=r=>k.omit(e,r),e.partial=(...r)=>k.partial(rd,e,r[0]),e.required=(...r)=>k.required(nd,e,r[0])});function j(e,t){let r={type:"object",shape:e??{},...k.normalizeParams(t)};return new ba(r)}function uk(e,t){return new ba({type:"object",shape:e,catchall:Ql(),...k.normalizeParams(t)})}function Ee(e,t){return new ba({type:"object",shape:e,catchall:de(),...k.normalizeParams(t)})}var xa=g("ZodUnion",(e,t)=>{co.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kl(e,r,n,o),e.options=t.options});function se(e,t){return new xa({type:"union",options:e,...k.normalizeParams(t)})}var ug=g("ZodXor",(e,t)=>{xa.init(e,t),du.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kl(e,r,n,o),e.options=t.options});function lk(e,t){return new ug({type:"union",options:e,inclusive:!1,...k.normalizeParams(t)})}var lg=g("ZodDiscriminatedUnion",(e,t)=>{xa.init(e,t),pu.init(e,t)});function ka(e,t,r){return new lg({type:"union",options:t,discriminator:e,...k.normalizeParams(r)})}var dg=g("ZodIntersection",(e,t)=>{fu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o)});function jo(e,t){return new dg({type:"intersection",left:e,right:t})}var pg=g("ZodTuple",(e,t)=>{Ui.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function fg(e,t,r){let n=t instanceof V,o=n?r:t,i=n?t:null;return new pg({type:"tuple",items:e,rest:i,...k.normalizeParams(o)})}var wa=g("ZodRecord",(e,t)=>{mu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function me(e,t,r){return new wa({type:"record",keyType:e,valueType:t,...k.normalizeParams(r)})}function dk(e,t,r){let n=Me(e);return n._zod.values=void 0,new wa({type:"record",keyType:n,valueType:t,...k.normalizeParams(r)})}function pk(e,t,r){return new wa({type:"record",keyType:e,valueType:t,mode:"loose",...k.normalizeParams(r)})}var mg=g("ZodMap",(e,t)=>{hu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(en(...r))});function fk(e,t,r){return new mg({type:"map",keyType:e,valueType:t,...k.normalizeParams(r)})}var hg=g("ZodSet",(e,t)=>{gu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o),e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(en(...r))});function mk(e,t){return new hg({type:"set",valueType:e,...k.normalizeParams(t)})}var zo=g("ZodEnum",(e,t)=>{vu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ph(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new zo({...t,checks:[],...k.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.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 zo({...t,checks:[],...k.normalizeParams(o),entries:i})}});function Oe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new zo({type:"enum",entries:r,...k.normalizeParams(t)})}function hk(e,t){return new zo({type:"enum",entries:e,...k.normalizeParams(t)})}var gg=g("ZodLiteral",(e,t)=>{yu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fh(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function D(e,t){return new gg({type:"literal",values:Array.isArray(e)?e:[e],...k.normalizeParams(t)})}var vg=g("ZodFile",(e,t)=>{_u.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o),e.min=(r,n)=>e.check(At(r,n)),e.max=(r,n)=>e.check(_r(r,n)),e.mime=(r,n)=>e.check(_o(Array.isArray(r)?r:[r],n))});function gk(e){return gl(vg,e)}var yg=g("ZodTransform",(e,t)=>{$u.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(k.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(k.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function td(e){return new yg({type:"transform",transform:e})}var rd=g("ZodOptional",(e,t)=>{Mi.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function he(e){return new rd({type:"optional",innerType:e})}var _g=g("ZodExactOptional",(e,t)=>{bu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function $g(e){return new _g({type:"optional",innerType:e})}var bg=g("ZodNullable",(e,t)=>{xu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ph(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ma(e){return new bg({type:"nullable",innerType:e})}function vk(e){return he(ma(e))}var xg=g("ZodDefault",(e,t)=>{ku.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function kg(e,t){return new xg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var wg=g("ZodPrefault",(e,t)=>{wu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Sg(e,t){return new wg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var nd=g("ZodNonOptional",(e,t)=>{Su.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zg(e,t){return new nd({type:"nonoptional",innerType:e,...k.normalizeParams(t)})}var Ig=g("ZodSuccess",(e,t)=>{zu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function yk(e){return new Ig({type:"success",innerType:e})}var Pg=g("ZodCatch",(e,t)=>{Iu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jg(e,t){return new Pg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Tg=g("ZodNaN",(e,t)=>{Pu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o)});function _k(e){return ll(Tg,e)}var od=g("ZodPipe",(e,t)=>{ju.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dh(e,r,n,o),e.in=t.in,e.out=t.out});function ha(e,t){return new od({type:"pipe",in:e,out:t})}var id=g("ZodCodec",(e,t)=>{od.init(e,t),uo.init(e,t)});function $k(e,t,r){return new id({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Eg=g("ZodReadonly",(e,t)=>{Tu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Og(e){return new Eg({type:"readonly",innerType:e})}var Dg=g("ZodTemplateLiteral",(e,t)=>{Eu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o)});function bk(e,t){return new Dg({type:"template_literal",parts:e,...k.normalizeParams(t)})}var Ng=g("ZodLazy",(e,t)=>{Nu.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ch(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Rg(e){return new Ng({type:"lazy",getter:e})}var Cg=g("ZodPromise",(e,t)=>{Du.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xk(e){return new Cg({type:"promise",innerType:e})}var Zg=g("ZodFunction",(e,t)=>{Ou.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o)});function kk(e){return new Zg({type:"function",input:Array.isArray(e?.input)?fg(e?.input):e?.input??Y(de()),output:e?.output??de()})}var Sa=g("ZodCustom",(e,t)=>{Ru.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o)});function wk(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function ad(e,t){return vl(Sa,e??(()=>!0),t)}function Ag(e,t={}){return yl(Sa,e,t)}function Ug(e){return _l(e)}var Sk=$l,zk=bl;function Ik(e,t={}){let r=new Sa({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...k.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var Pk=(...e)=>xl({Codec:id,Boolean:_a,String:ga},...e);function jk(e){let t=Rg(()=>se([v(e),ie(),be(),Po(),Y(t),me(v(),t)]));return t}function za(e,t){return ha(td(e),t)}var Mg;Mg||(Mg={});var o4={...So,...pa,iso:$r};xe(Cu());var cd="2025-11-25";var Fg=[cd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],er="io.modelcontextprotocol/related-task",Pa="2.0",ke=ad(e=>e!==null&&(typeof e=="object"||typeof e=="function")),qg=se([v(),ie().int()]),Lg=v(),k4=Ee({ttl:se([ie(),Po()]).optional(),pollInterval:ie().optional()}),Dk=j({ttl:ie().optional()}),Nk=j({taskId:v()}),ud=Ee({progressToken:qg.optional(),[er]:Nk.optional()}),rt=j({_meta:ud.optional()}),To=rt.extend({task:Dk.optional()}),Vg=e=>To.safeParse(e).success,we=j({method:v(),params:rt.loose().optional()}),st=j({_meta:ud.optional()}),ct=j({method:v(),params:st.loose().optional()}),Se=Ee({_meta:ud.optional()}),ja=se([v(),ie().int()]),Jg=j({jsonrpc:D(Pa),id:ja,...we.shape}).strict(),ld=e=>Jg.safeParse(e).success,Hg=j({jsonrpc:D(Pa),...ct.shape}).strict(),Kg=e=>Hg.safeParse(e).success,dd=j({jsonrpc:D(Pa),id:ja,result:Se}).strict(),Eo=e=>dd.safeParse(e).success;var q;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(q||(q={}));var pd=j({jsonrpc:D(Pa),id:ja.optional(),error:j({code:ie().int(),message:v(),data:de().optional()})}).strict();var Bg=e=>pd.safeParse(e).success;var Wg=se([Jg,Hg,dd,pd]),w4=se([dd,pd]),Ta=Se.strict(),Rk=st.extend({requestId:ja.optional(),reason:v().optional()}),Ea=ct.extend({method:D("notifications/cancelled"),params:Rk}),Ck=j({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Oe(["light","dark"]).optional()}),Oo=j({icons:Y(Ck).optional()}),sn=j({name:v(),title:v().optional()}),Gg=sn.extend({...sn.shape,...Oo.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Zk=jo(j({applyDefaults:be().optional()}),me(v(),de())),Ak=za(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,jo(j({form:Zk.optional(),url:ke.optional()}),me(v(),de()).optional())),Uk=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({sampling:Ee({createMessage:ke.optional()}).optional(),elicitation:Ee({create:ke.optional()}).optional()}).optional()}),Mk=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({tools:Ee({call:ke.optional()}).optional()}).optional()}),Fk=j({experimental:me(v(),ke).optional(),sampling:j({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:Ak.optional(),roots:j({listChanged:be().optional()}).optional(),tasks:Uk.optional()}),qk=rt.extend({protocolVersion:v(),capabilities:Fk,clientInfo:Gg}),fd=we.extend({method:D("initialize"),params:qk});var Lk=j({experimental:me(v(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:j({listChanged:be().optional()}).optional(),resources:j({subscribe:be().optional(),listChanged:be().optional()}).optional(),tools:j({listChanged:be().optional()}).optional(),tasks:Mk.optional()}),Vk=Se.extend({protocolVersion:v(),capabilities:Lk,serverInfo:Gg,instructions:v().optional()}),md=ct.extend({method:D("notifications/initialized"),params:st.optional()});var Oa=we.extend({method:D("ping"),params:rt.optional()}),Jk=j({progress:ie(),total:he(ie()),message:he(v())}),Hk=j({...st.shape,...Jk.shape,progressToken:qg}),Da=ct.extend({method:D("notifications/progress"),params:Hk}),Kk=rt.extend({cursor:Lg.optional()}),Do=we.extend({params:Kk.optional()}),No=Se.extend({nextCursor:Lg.optional()}),Bk=Oe(["working","input_required","completed","failed","cancelled"]),Ro=j({taskId:v(),status:Bk,ttl:se([ie(),Po()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:he(ie()),statusMessage:he(v())}),cn=Se.extend({task:Ro}),Wk=st.merge(Ro),Co=ct.extend({method:D("notifications/tasks/status"),params:Wk}),Na=we.extend({method:D("tasks/get"),params:rt.extend({taskId:v()})}),Ra=Se.merge(Ro),Ca=we.extend({method:D("tasks/result"),params:rt.extend({taskId:v()})}),S4=Se.loose(),Za=Do.extend({method:D("tasks/list")}),Aa=No.extend({tasks:Y(Ro)}),Ua=we.extend({method:D("tasks/cancel"),params:rt.extend({taskId:v()})}),Xg=Se.merge(Ro),Yg=j({uri:v(),mimeType:he(v()),_meta:me(v(),de()).optional()}),Qg=Yg.extend({text:v()}),hd=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ev=Yg.extend({blob:hd}),Zo=Oe(["user","assistant"]),un=j({audience:Y(Zo).optional(),priority:ie().min(0).max(1).optional(),lastModified:$r.datetime({offset:!0}).optional()}),tv=j({...sn.shape,...Oo.shape,uri:v(),description:he(v()),mimeType:he(v()),annotations:un.optional(),_meta:he(Ee({}))}),Gk=j({...sn.shape,...Oo.shape,uriTemplate:v(),description:he(v()),mimeType:he(v()),annotations:un.optional(),_meta:he(Ee({}))}),gd=Do.extend({method:D("resources/list")}),Xk=No.extend({resources:Y(tv)}),Yk=Do.extend({method:D("resources/templates/list")}),Qk=No.extend({resourceTemplates:Y(Gk)}),vd=rt.extend({uri:v()}),ew=vd,yd=we.extend({method:D("resources/read"),params:ew}),tw=Se.extend({contents:Y(se([Qg,ev]))}),rw=ct.extend({method:D("notifications/resources/list_changed"),params:st.optional()}),nw=vd,ow=we.extend({method:D("resources/subscribe"),params:nw}),iw=vd,aw=we.extend({method:D("resources/unsubscribe"),params:iw}),sw=st.extend({uri:v()}),cw=ct.extend({method:D("notifications/resources/updated"),params:sw}),uw=j({name:v(),description:he(v()),required:he(be())}),lw=j({...sn.shape,...Oo.shape,description:he(v()),arguments:he(Y(uw)),_meta:he(Ee({}))}),_d=Do.extend({method:D("prompts/list")}),dw=No.extend({prompts:Y(lw)}),pw=rt.extend({name:v(),arguments:me(v(),v()).optional()}),$d=we.extend({method:D("prompts/get"),params:pw}),bd=j({type:D("text"),text:v(),annotations:un.optional(),_meta:me(v(),de()).optional()}),xd=j({type:D("image"),data:hd,mimeType:v(),annotations:un.optional(),_meta:me(v(),de()).optional()}),kd=j({type:D("audio"),data:hd,mimeType:v(),annotations:un.optional(),_meta:me(v(),de()).optional()}),fw=j({type:D("tool_use"),name:v(),id:v(),input:me(v(),de()),_meta:me(v(),de()).optional()}),mw=j({type:D("resource"),resource:se([Qg,ev]),annotations:un.optional(),_meta:me(v(),de()).optional()}),hw=tv.extend({type:D("resource_link")}),wd=se([bd,xd,kd,hw,mw]),gw=j({role:Zo,content:wd}),vw=Se.extend({description:v().optional(),messages:Y(gw)}),yw=ct.extend({method:D("notifications/prompts/list_changed"),params:st.optional()}),_w=j({title:v().optional(),readOnlyHint:be().optional(),destructiveHint:be().optional(),idempotentHint:be().optional(),openWorldHint:be().optional()}),$w=j({taskSupport:Oe(["required","optional","forbidden"]).optional()}),rv=j({...sn.shape,...Oo.shape,description:v().optional(),inputSchema:j({type:D("object"),properties:me(v(),ke).optional(),required:Y(v()).optional()}).catchall(de()),outputSchema:j({type:D("object"),properties:me(v(),ke).optional(),required:Y(v()).optional()}).catchall(de()).optional(),annotations:_w.optional(),execution:$w.optional(),_meta:me(v(),de()).optional()}),Sd=Do.extend({method:D("tools/list")}),bw=No.extend({tools:Y(rv)}),Ma=Se.extend({content:Y(wd).default([]),structuredContent:me(v(),de()).optional(),isError:be().optional()}),z4=Ma.or(Se.extend({toolResult:de()})),xw=To.extend({name:v(),arguments:me(v(),de()).optional()}),Ao=we.extend({method:D("tools/call"),params:xw}),kw=ct.extend({method:D("notifications/tools/list_changed"),params:st.optional()}),I4=j({autoRefresh:be().default(!0),debounceMs:ie().int().nonnegative().default(300)}),Uo=Oe(["debug","info","notice","warning","error","critical","alert","emergency"]),ww=rt.extend({level:Uo}),zd=we.extend({method:D("logging/setLevel"),params:ww}),Sw=st.extend({level:Uo,logger:v().optional(),data:de()}),zw=ct.extend({method:D("notifications/message"),params:Sw}),Iw=j({name:v().optional()}),Pw=j({hints:Y(Iw).optional(),costPriority:ie().min(0).max(1).optional(),speedPriority:ie().min(0).max(1).optional(),intelligencePriority:ie().min(0).max(1).optional()}),jw=j({mode:Oe(["auto","required","none"]).optional()}),Tw=j({type:D("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:Y(wd).default([]),structuredContent:j({}).loose().optional(),isError:be().optional(),_meta:me(v(),de()).optional()}),Ew=ka("type",[bd,xd,kd]),Ia=ka("type",[bd,xd,kd,fw,Tw]),Ow=j({role:Zo,content:se([Ia,Y(Ia)]),_meta:me(v(),de()).optional()}),Dw=To.extend({messages:Y(Ow),modelPreferences:Pw.optional(),systemPrompt:v().optional(),includeContext:Oe(["none","thisServer","allServers"]).optional(),temperature:ie().optional(),maxTokens:ie().int(),stopSequences:Y(v()).optional(),metadata:ke.optional(),tools:Y(rv).optional(),toolChoice:jw.optional()}),Nw=we.extend({method:D("sampling/createMessage"),params:Dw}),Id=Se.extend({model:v(),stopReason:he(Oe(["endTurn","stopSequence","maxTokens"]).or(v())),role:Zo,content:Ew}),Pd=Se.extend({model:v(),stopReason:he(Oe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:Zo,content:se([Ia,Y(Ia)])}),Rw=j({type:D("boolean"),title:v().optional(),description:v().optional(),default:be().optional()}),Cw=j({type:D("string"),title:v().optional(),description:v().optional(),minLength:ie().optional(),maxLength:ie().optional(),format:Oe(["email","uri","date","date-time"]).optional(),default:v().optional()}),Zw=j({type:Oe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ie().optional(),maximum:ie().optional(),default:ie().optional()}),Aw=j({type:D("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),Uw=j({type:D("string"),title:v().optional(),description:v().optional(),oneOf:Y(j({const:v(),title:v()})),default:v().optional()}),Mw=j({type:D("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),Fw=se([Aw,Uw]),qw=j({type:D("array"),title:v().optional(),description:v().optional(),minItems:ie().optional(),maxItems:ie().optional(),items:j({type:D("string"),enum:Y(v())}),default:Y(v()).optional()}),Lw=j({type:D("array"),title:v().optional(),description:v().optional(),minItems:ie().optional(),maxItems:ie().optional(),items:j({anyOf:Y(j({const:v(),title:v()}))}),default:Y(v()).optional()}),Vw=se([qw,Lw]),Jw=se([Mw,Fw,Vw]),Hw=se([Jw,Rw,Cw,Zw]),Kw=To.extend({mode:D("form").optional(),message:v(),requestedSchema:j({type:D("object"),properties:me(v(),Hw),required:Y(v()).optional()})}),Bw=To.extend({mode:D("url"),message:v(),elicitationId:v(),url:v().url()}),Ww=se([Kw,Bw]),Gw=we.extend({method:D("elicitation/create"),params:Ww}),Xw=st.extend({elicitationId:v()}),Yw=ct.extend({method:D("notifications/elicitation/complete"),params:Xw}),Fa=Se.extend({action:Oe(["accept","decline","cancel"]),content:za(e=>e===null?void 0:e,me(v(),se([v(),ie(),be(),Y(v())])).optional())}),Qw=j({type:D("ref/resource"),uri:v()});var eS=j({type:D("ref/prompt"),name:v()}),tS=rt.extend({ref:se([eS,Qw]),argument:j({name:v(),value:v()}),context:j({arguments:me(v(),v()).optional()}).optional()}),rS=we.extend({method:D("completion/complete"),params:tS});var nS=Se.extend({completion:Ee({values:Y(v()).max(100),total:he(ie().int()),hasMore:he(be())})}),oS=j({uri:v().startsWith("file://"),name:v().optional(),_meta:me(v(),de()).optional()}),iS=we.extend({method:D("roots/list"),params:rt.optional()}),jd=Se.extend({roots:Y(oS)}),aS=ct.extend({method:D("notifications/roots/list_changed"),params:st.optional()}),P4=se([Oa,fd,rS,zd,$d,_d,gd,Yk,yd,ow,aw,Ao,Sd,Na,Ca,Za,Ua]),j4=se([Ea,Da,md,aS,Co]),T4=se([Ta,Id,Pd,Fa,jd,Ra,Aa,cn]),E4=se([Oa,Nw,Gw,iS,Na,Ca,Za,Ua]),O4=se([Ea,Da,zw,cw,rw,kw,yw,Co,Yw]),D4=se([Ta,Vk,nS,vw,dw,Xk,Qk,tw,Ma,bw,Ra,Aa,cn]),R=class e extends Error{constructor(t,r,n){super(`MCP error ${t}: ${r}`),this.code=t,this.data=n,this.name="McpError"}static fromError(t,r,n){if(t===q.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new sd(o.elicitations,r)}return new e(t,r,n)}},sd=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(q.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function tr(e){return e==="completed"||e==="failed"||e==="cancelled"}var fR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Td(e){let r=da(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Mh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Ed(e,t){let r=Qt(e,t);if(!r.success)throw r.error;return r.data}var pS=6e4,qa=class{constructor(t){this._options=t,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(Ea,r=>{this._oncancel(r)}),this.setNotificationHandler(Da,r=>{this._onprogress(r)}),this.setRequestHandler(Oa,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Na,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(q.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ca,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 c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new R(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new R(q.InvalidParams,`Task not found: ${i}`);if(!tr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(tr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[er]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Za,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 R(q.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Ua,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(q.InvalidParams,`Task not found: ${r.params.taskId}`);if(tr(o.status))throw new R(q.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 R(q.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof R?o:new R(q.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(t){if(!t.params.requestId)return;this._requestHandlerAbortControllers.get(t.params.requestId)?.abort(t.params.reason)}_setupTimeout(t,r,n,o,i=!1){this._timeoutInfo.set(t,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(t){let r=this._timeoutInfo.get(t);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(t),R.fromError(q.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(t){let r=this._timeoutInfo.get(t);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(t))}async connect(t){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=t;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),Eo(i)||Bg(i)?this._onresponse(i):ld(i)?this._onrequest(i,a):Kg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=R.fromError(q.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[er]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:q.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(t.id,a);let s=Vg(t.params)?t.params.task:void 0,c=this._taskStore?this.requestTaskStore(t,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:t.params?._meta,sendNotification:async l=>{if(a.signal.aborted)return;let d={relatedRequestId:t.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{if(a.signal.aborted)throw new R(q.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:t.id};i&&!f.relatedTask&&(f.relatedTask={taskId:i});let m=f.relatedTask?.taskId??i;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:t.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(t.method)}).then(()=>n(t,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:t.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(a.signal.aborted)return;let d={jsonrpc:"2.0",id:t.id,error:{code:Number.isSafeInteger(l.code)?l.code:q.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.delete(t.id)})}_onprogress(t){let{progressToken:r,...n}=t.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(t)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(t){let r=Number(t.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),Eo(t))n(t);else{let a=new R(t.error.code,t.error.message,t.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(t)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(Eo(t)&&t.result&&typeof t.result=="object"){let a=t.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),Eo(t))o(t);else{let a=R.fromError(t.error.code,t.error.message,t.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(t,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(t,r,n)}}catch(a){yield{type:"error",error:a instanceof R?a:new R(q.InternalError,String(a))}}return}let i;try{let a=await this.request(t,cn,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new R(q.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},tr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new R(q.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new R(q.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let c=s.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(a){yield{type:"error",error:a instanceof R?a:new R(q.InternalError,String(a))}}}request(t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=_=>{l(_)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method),s&&this.assertTaskCapability(t.method)}catch(_){d(_);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...t,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...t.params,_meta:{...t.params?._meta||{},progressToken:p}}),s&&(f.params={...f.params,task:s}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[er]:c}});let m=_=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(_)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(T=>this._onerror(new Error(`Failed to send cancellation: ${T}`)));let b=_ instanceof R?_:new R(q.RequestTimeout,String(_));l(b)};this._responseHandlers.set(p,_=>{if(!n?.signal?.aborted){if(_ instanceof Error)return l(_);try{let b=Qt(r,_.result);b.success?u(b.data):l(b.error)}catch(b){l(b)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let h=n?.timeout??pS,y=()=>m(R.fromError(q.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(p,h,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let $=c?.taskId;if($){let _=b=>{let T=this._responseHandlers.get(p);T?T(b):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,_),this._enqueueTaskMessage($,{type:"request",message:f,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(p),l(b)})}else this._transport.send(f,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(_=>{this._cleanupTimeout(p),l(_)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ra,r)}async getTaskResult(t,r,n){return this.request({method:"tasks/result",params:t},r,n)}async listTasks(t,r){return this.request({method:"tasks/list",params:t},Aa,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Xg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[er]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[er]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[er]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Td(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Ed(t,o);return Promise.resolve(r(a,i))})}removeRequestHandler(t){this._requestHandlers.delete(t)}assertCanSetRequestHandler(t){if(this._requestHandlers.has(t))throw new Error(`A request handler for ${t} already exists, which would be overridden`)}setNotificationHandler(t,r){let n=Td(t);this._notificationHandlers.set(n,o=>{let i=Ed(t,o);return Promise.resolve(r(i))})}removeNotificationHandler(t){this._notificationHandlers.delete(t)}_cleanupTaskProgressHandler(t){let r=this._taskProgressTokens.get(t);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(t))}async _enqueueTaskMessage(t,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(t,r,n,o)}async _clearTaskQueue(t,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(t,r);for(let o of n)if(o.type==="request"&&ld(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new R(q.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${t} cleanup`))}}}async _waitForTaskUpdate(t,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(t);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new R(q.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new R(q.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(t,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!t)throw new Error("No request provided");return await n.createTask(o,t.id,{method:t.method,params:t.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new R(q.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 c=Co.parse({method:"notifications/tasks/status",params:s});await this.notification(c),tr(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 R(q.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(tr(s.status))throw new R(q.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 c=await n.getTask(o,r);if(c){let u=Co.parse({method:"notifications/tasks/status",params:c});await this.notification(u),tr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function nv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ov(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];nv(a)&&nv(i)?r[o]={...a,...i}:r[o]=i}return r}var c$=ft(zf(),1),u$=ft(s$(),1);function UT(){let e=new c$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,u$.default)(e),e}var zs=class{constructor(t){this._ajv=t??UT()}getValidator(t){let r="$id"in t&&typeof t.$id=="string"?this._ajv.getSchema(t.$id)??this._ajv.compile(t):this._ajv.compile(t);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var Is=class{constructor(t){this._server=t}requestStream(t,r,n){return this._server.requestStream(t,r,n)}async getTask(t,r){return this._server.getTask({taskId:t},r)}async getTaskResult(t,r,n){return this._server.getTaskResult({taskId:t},r,n)}async listTasks(t,r){return this._server.listTasks(t?{cursor:t}:void 0,r)}async cancelTask(t,r){return this._server.cancelTask({taskId:t},r)}};function l$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function d$(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}var Ps=class extends qa{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Uo.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let i=this._loggingLevels.get(o);return i?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(i):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new zs,this.setRequestHandler(fd,n=>this._oninitialize(n)),this.setNotificationHandler(md,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(zd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Uo.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Is(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ov(this._capabilities,t)}setRequestHandler(t,r){let o=da(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(on(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");if(i==="tools/call"){let s=async(c,u)=>{let l=Qt(Ao,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(q.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let m=Qt(cn,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new R(q.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let f=Qt(Ma,p);if(!f.success){let m=f.error instanceof Error?f.error.message:String(f.error);throw new R(q.InvalidParams,`Invalid tools/call result: ${m}`)}return f.data};return super.setRequestHandler(t,s)}return super.setRequestHandler(t,r)}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${t})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${t})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${t})`);break;case"ping":break}}assertNotificationCapability(t){switch(t){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${t})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${t})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${t})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${t})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(t){if(this._capabilities)switch(t){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${t})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${t})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${t})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${t})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${t})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${t})`);break;case"ping":case"initialize":break}}assertTaskCapability(t){d$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&l$(this._capabilities.tasks?.requests,t,"Server")}async _oninitialize(t){let r=t.params.protocolVersion;return this._clientCapabilities=t.params.capabilities,this._clientVersion=t.params.clientInfo,{protocolVersion:Fg.includes(r)?r:cd,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Ta)}async createMessage(t,r){if((t.tools||t.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(t.messages.length>0){let n=t.messages[t.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=t.messages.length>1?t.messages[t.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some(u=>u.type==="tool_use");if(i){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return t.tools?this.request({method:"sampling/createMessage",params:t},Pd,r):this.request({method:"sampling/createMessage",params:t},Id,r)}async elicitInput(t,r){switch(t.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=t;return this.request({method:"elicitation/create",params:o},Fa,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=t.mode==="form"?t:{...t,mode:"form"},i=await this.request({method:"elicitation/create",params:o},Fa,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new R(q.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof R?a:new R(q.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(t,r){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:t}},r)}async listRoots(t,r){return this.request({method:"roots/list",params:t},jd,r)}async sendLoggingMessage(t,r){if(this._capabilities.logging&&!this.isMessageIgnored(t.level,r))return this.notification({method:"notifications/message",params:t})}async sendResourceUpdated(t){return this.notification({method:"notifications/resources/updated",params:t})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Nf=ft(require("node:process"),1);var js=class{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;let t=this._buffer.indexOf(`
|
|
48
|
+
`);if(t===-1)return null;let r=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),MT(r)}clear(){this._buffer=void 0}};function MT(e){return Wg.parse(JSON.parse(e))}function p$(e){return JSON.stringify(e)+`
|
|
49
|
+
`}var Ts=class{constructor(t=Nf.default.stdin,r=Nf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new js,this._started=!1,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer()},this._onerror=n=>{this.onerror?.(n)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let t=this._readBuffer.readMessage();if(t===null)break;this.onmessage?.(t)}catch(t){this.onerror?.(t)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(t){return new Promise(r=>{let n=p$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var je=ft(require("fs/promises")),ye=ft(require("path")),In=10*1024*1024,f$=1e3,Es=class{skillsPath;cachedSkills=null;loadingPromise=null;skillMap=new Map;contentCache=new Map;canonicalPathMap=new Map;scanEpoch=0;lastSuccessfulScanAt=0;constructor(t){this.skillsPath=ye.resolve(t)}stripQuotes(t){return t.replace(/^"(.*)"$|^'(.*)'$/,"$1$2").trim()}parseFrontmatter(t){let r=t;if(r.charCodeAt(0)===65279&&(r=r.slice(1)),!r.startsWith("---"))return{name:"",description:"",body:r.trim()};let n=r.slice(3).match(/\r?\n[ \t]*---[ \t]*(?:\r?\n|$)/);if(!n||n.index===void 0)return{name:"",description:"",body:r.trim()};let o=r.slice(3,3+n.index),i=r.slice(3+n.index+n[0].length).trim(),a=o.split(/\r?\n/),s="",c="",u=!1;for(let l of a){let d=l.match(/^name:\s*(.*?)\s*$/);if(d){s=this.stripQuotes(d[1]),u=!1;continue}let p=l.match(/^description:\s*(.*?)\s*$/);if(p){c=this.stripQuotes(p[1]),u=!0;continue}u&&/^\s+/.test(l)?c+=" "+l.trim():u=!1}return{name:s,description:c,body:i}}async listSkills(t=!1){let r=Date.now()-this.lastSuccessfulScanAt<f$;if(this.cachedSkills&&!t&&r)return this.cachedSkills;if(this.loadingPromise&&!t)return this.loadingPromise;t&&(this.contentCache.clear(),this.canonicalPathMap.clear());let n=++this.scanEpoch,o=this.internalListSkills(n);this.loadingPromise=o;try{return await o}finally{this.loadingPromise===o&&(this.loadingPromise=null)}}async internalListSkills(t=this.scanEpoch){let r;try{let c=ye.resolve(this.skillsPath),u=await je.realpath(c),l=await je.stat(u);if(!l.isDirectory())return this.cachedSkills??[];r={realRootPath:u,rootStat:l}}catch{return this.cachedSkills??[]}let n=[],o=new Map,i=new Map,a=new Map,s=!1;try{let u=(await je.readdir(this.skillsPath,{withFileTypes:!0})).filter(d=>d.isDirectory()||d.isSymbolicLink()),l=await Promise.all(u.map(async d=>{let p=ye.join(this.skillsPath,d.name),f=ye.join(p,"SKILL.md");try{let{content:m,realFilePath:h}=await this.readFileNoFollow(f,this.skillsPath,r),{name:y,description:$,body:_}=this.parseFrontmatter(m);return{item:{name:y||d.name,description:$,skillPath:f},body:_,realFilePath:h,directoryName:d.name}}catch(m){return m&&typeof m=="object"&&"code"in m&&m.code==="ENOENT"||process.stderr.write(`Warning: Failed to read skill file in directory "${d.name}"
|
|
50
|
+
`),null}}));for(let d of l.filter(p=>p!==null).sort((p,f)=>p.directoryName<f.directoryName?-1:p.directoryName>f.directoryName?1:0)){let{item:p,body:f,realFilePath:m,directoryName:h}=d,y=new Set([p.name.toLowerCase(),h.toLowerCase()]),$=[...y].find(b=>o.has(b));if($){process.stderr.write(`Warning: Skipping skill directory "${h}" because name or alias "${$}" is already registered
|
|
51
|
+
`);continue}n.push(p);for(let b of y)o.set(b,p);let _=ye.resolve(p.skillPath);i.set(m,f),a.set(_,m),a.set(m,m)}s=!0}catch(c){process.stderr.write(`Error reading skills directory: ${String(c)}
|
|
52
|
+
`)}return s&&t===this.scanEpoch&&(this.skillMap=o,this.cachedSkills=n.sort((c,u)=>c.name.localeCompare(u.name)),this.lastSuccessfulScanAt=Date.now(),this.contentCache=i,this.canonicalPathMap=a),this.cachedSkills??[]}async findSkill(t){let r=typeof t=="string"?t.trim():"";if(!(!r||r==="."||r===".."||r.includes("/")||r.includes("\\")||r.includes("\0")))return this.cachedSkills||await this.listSkills(),this.skillMap.get(r.toLowerCase())}async readFileNoFollow(t,r,n){let o=ye.resolve(t),i=ye.resolve(r),a=async()=>{let d=await je.realpath(o),p=n?n.realRootPath:await je.realpath(i);if(!(n?n.rootStat:await je.stat(p)).isDirectory())throw new Error("Skills directory must be a directory");let m=ye.relative(p,d);if(m===".."||m.startsWith(`..${ye.sep}`)||ye.isAbsolute(m))throw new Error("File is outside skills directory");let h=await je.stat(d);if(!h.isFile()||h.nlink<1)throw new Error("Skill path is not a regular file");if(h.size>In)throw new Error("Skill file exceeds size limit");return{realFilePath:d,stat:h}},s=await a(),c=await a();if(s.realFilePath!==c.realFilePath||s.stat.dev!==c.stat.dev||s.stat.ino!==c.stat.ino)throw new Error("File changed while validating its path");let u=process.platform==="win32"?0:je.constants.O_NOFOLLOW,l=await je.open(c.realFilePath,je.constants.O_RDONLY|u);try{let d=await l.stat();if(!d.isFile()||d.nlink<1||d.dev!==c.stat.dev||d.ino!==c.stat.ino||d.size>In)throw new Error("File changed while opening");let p=d.size,f;if(p<=64*1024){f=Buffer.allocUnsafe(p);let h=0;for(;h<p;){let{bytesRead:y}=await l.read(f,h,p-h,null);if(y===0)break;h+=y}h<p&&(f=f.subarray(0,h))}else{let h=[],$=0;for(;$<=In;){let _=Buffer.allocUnsafe(Math.min(65536,In+1-$)),{bytesRead:b}=await l.read(_,0,_.length,null);if(b===0)break;if($+=b,h.push(_.subarray(0,b)),$>In)throw new Error("Skill file exceeds size limit")}f=Buffer.concat(h,$)}let m=await l.stat();if(m.size>In||m.dev!==c.stat.dev||m.ino!==c.stat.ino)throw new Error("File changed while reading");return{content:f.toString("utf-8"),realFilePath:c.realFilePath}}finally{await l.close()}}async readSkillContent(t,r=!1){!r&&this.cachedSkills&&Date.now()-this.lastSuccessfulScanAt>=f$&&await this.listSkills(!0);let n=ye.isAbsolute(t)?ye.resolve(t):ye.resolve(this.skillsPath,t),o=this.canonicalPathMap.get(n);if(!r&&o&&this.contentCache.has(o))return this.contentCache.get(o);let i=ye.resolve(this.skillsPath),a=n,s=i;try{a=await je.realpath(n),s=await je.realpath(i)}catch{}let c=ye.relative(s,a);if(c===".."||c.startsWith(`..${ye.sep}`)||ye.isAbsolute(c))throw new Error(`Access denied: path "${t}" is outside skills directory`);if(!r&&this.contentCache.has(a)){let u=this.contentCache.get(a);return this.canonicalPathMap.set(n,a),u}try{let{content:u,realFilePath:l}=await this.readFileNoFollow(t,this.skillsPath),{body:d}=this.parseFrontmatter(u);return this.contentCache.set(l,d),this.canonicalPathMap.set(n,l),this.canonicalPathMap.set(l,l),d}catch(u){throw new Error(`Failed to read skill content: ${u instanceof Error?u.message:String(u)}`)}}clearCache(){this.cachedSkills=null,this.loadingPromise=null,this.skillMap.clear(),this.contentCache.clear(),this.canonicalPathMap.clear(),this.lastSuccessfulScanAt=0}};var U=ft(require("fs")),w=ft(require("path")),Dr=ft(require("os")),h$=ft(require("crypto")),yi={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>w.join(t,".lmstudio","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},roo:{name:"Roo Code (VS Code Desktop)",aliases:["roo","roo-code","roocode"],getConfigPath:(e,t,r)=>{let n=e==="win32"?r||w.join(t,"AppData","Roaming"):e==="darwin"?w.join(t,"Library","Application Support"):w.join(t,".config");return w.join(n,"Code","User","globalStorage","rooveterinaryinc.roo-cline","settings","mcp_settings.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},copilot:{name:"GitHub Copilot (VS Code)",aliases:["vscode","code","copilot"],getConfigPath:(e,t,r,n)=>e==="win32"?w.join(r||w.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?w.join(t,"Library","Application Support","Code","User","mcp.json"):w.join(t,".config","Code","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},"copilot-insiders":{name:"GitHub Copilot (VS Code Insiders)",aliases:["vscode-insiders","code-insiders","insiders","insider","vscode-insider","code-insider","copilot-insider"],getConfigPath:(e,t,r,n)=>e==="win32"?w.join(r||w.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?w.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):w.join(t,".config","Code - Insiders","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},cursor:{name:"Cursor",aliases:["cursor"],getConfigPath:(e,t)=>w.join(t,".cursor","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},hermes:{name:"Hermes Desktop / Agent",aliases:["hermes","hermes-desktop"],getConfigPath:(e,t,r,n)=>{if(e==="win32"){let o=n||w.join(t,"AppData","Local");return w.join(o,"hermes","config.yaml")}return w.join(t,".hermes","config.yaml")},type:"yaml",defaultConfig:(e,t)=>({command:e,args:t})},kimi:{name:"Kimi Work / Kimi Code",aliases:["kimi","kimi-work","kimi-code"],getConfigPath:(e,t)=>w.join(t,".kimi-code","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},claude:{name:"Claude Desktop",aliases:["claude","claude-desktop"],getConfigPath:(e,t,r)=>e==="win32"?w.join(r||w.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?w.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):w.join(t,".config","Claude","claude_desktop_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},devin:{name:"Devin Desktop (formerly Windsurf)",aliases:["devin","devin-desktop","windsurf","codeium"],getConfigPath:(e,t)=>{let r=w.join(t,".config","devin","mcp_config.json");return U.existsSync(r)?r:w.join(t,".codeium","windsurf","mcp_config.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},antigravity:{name:"Antigravity (Google DeepMind)",aliases:["antigravity","agy","gemini"],getConfigPath:(e,t)=>w.join(t,".gemini","config","mcp_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},"pi-desktop":{name:"Pi Desktop / Pi Agent",aliases:["pi-desktop","pi","pi-agent"],getConfigPath:(e,t,r)=>{if(e==="win32"){let i=w.join(r||w.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(U.existsSync(i))return i;let a=w.join(t,".pi","agent","mcp.json");if(U.existsSync(a))return a;let s=w.join(t,".pi","mcp.json");return U.existsSync(s)?s:a}let n=w.join(t,".pi","agent","mcp.json");if(U.existsSync(n))return n;let o=w.join(t,".pi","mcp.json");return U.existsSync(o)?o:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},qwenpaw:{name:"QwenPaw (Personal Agent Workstation)",aliases:["qwenpaw","qwen-paw","copaw"],getConfigPath:(e,t)=>{let r=w.join(t,".qwenpaw","config.json");if(U.existsSync(r))return r;let n=w.join(t,".copaw","config.json");return U.existsSync(n)?n:r},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},cline:{name:"Cline (VS Code / CLI)",aliases:["cline","claude-dev"],getConfigPath:(e,t,r)=>{let n="";if(e==="win32"?n=w.join(r||w.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?n=w.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):n=w.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),U.existsSync(n))return n;let o=w.join(t,".cline","data","settings","cline_mcp_settings.json");return U.existsSync(o)?o:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t)=>{let r=w.join(t,".config","kilo","kilo.jsonc");if(U.existsSync(r))return r;let n=w.join(t,".config","kilo","kilo.json");return U.existsSync(n)?n:r},type:"json-mcp",defaultConfig:(e,t)=>({type:"local",command:[e,...t],enabled:!0})},qoder:{name:"Qoder",aliases:["qoder"],getConfigPath:(e,t)=>w.join(t,".qoder","settings.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kiro:{name:"Kiro",aliases:["kiro","kiro-code"],getConfigPath:(e,t)=>w.join(t,".kiro","settings","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},trae:{name:"Trae",aliases:["trae"],getConfigPath:(e,t,r)=>{if(e==="win32"){let n=w.join(r||w.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(U.existsSync(n))return n;let o=w.join(r||w.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return U.existsSync(o)?o:n}else if(e==="darwin"){let n=w.join(t,"Library","Application Support","Trae","User","mcp.json");if(U.existsSync(n))return n;let o=w.join(t,"Library","Application Support","Trae CN","User","mcp.json");return U.existsSync(o)?o:n}else{let n=w.join(t,".config","Trae","User","mcp.json");if(U.existsSync(n))return n;let o=w.join(t,".config","Trae CN","User","mcp.json");return U.existsSync(o)?o:n}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}};function Rf(e){return Object.prototype.toString.call(e)==="[object Object]"}function FT(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let r=e.length,n=[],o=!1,i=!1,a=!1,s=!1,c=-1;for(let u=0;u<r;u++){let l=e[u],d=u+1<r?e[u+1]:"";if(a){(l===`
|
|
53
|
+
`||l==="\r")&&(a=!1,n.push(l));continue}if(s){l==="*"&&d==="/"&&(s=!1,u++);continue}if(o){n.push(l),i?i=!1:l==="\\"?i=!0:l==='"'&&(o=!1);continue}if(l==='"'){o=!0,i=!1,c=-1,n.push(l);continue}if(l==="/"&&d==="/"){a=!0,u++;continue}if(l==="/"&&d==="*"){s=!0,u++;continue}if(l===","){c=n.length,n.push(l);continue}if(l==="}"||l==="]"){c!==-1&&(n[c]=" ",c=-1),n.push(l);continue}l!==" "&&l!==" "&&l!==`
|
|
54
|
+
`&&l!=="\r"&&(c=-1),n.push(l)}return n.join("")}var m$=/\s/;function qT(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!m$.test(e[t-1]))continue;let r=t-1;for(;r>0&&m$.test(e[r-1]);)r--;return e.slice(r)}return""}function LT(e,t,r,n=!1){let o=e?e.split(/\r?\n/):[],i=o.map((p,f)=>{let m=p.match(/^(\s*)mcp_servers:/);return m?{index:f,indent:m[1],tail:p.slice(m[0].length).trim()}:null}).filter(p=>p!==null);if(i.length>1)throw new Error("Cannot safely update YAML with duplicate mcp_servers keys");if(i.length===1){let p=i[0];if(p.indent!==""||p.tail!==""&&!p.tail.startsWith("#"))throw new Error("Cannot safely update YAML unless mcp_servers is a root-level block mapping")}let a=" ";if(i.length===1)for(let p=i[0].index+1;p<o.length;p++){if(o[p].trim()===""||o[p].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(o[p]))break;let f=o[p].match(/^(\s+)[a-zA-Z0-9_-]+:/);f&&(a=f[1]);break}if(n){let p=[],f=!1,m=0,h=!1,y=0;for(let $=0;$<o.length;$++){let _=o[$],b=_.match(/^(\s*)mcp_servers:\s*(?:#.*)?$/);if(b){f=!0,m=b[1].length,p.push(_);continue}if(f){let T=_.match(/^(\s*)/)?.[1].length||0;if(_.trimStart().startsWith("#")){p.push(_);continue}if(_.trim()!==""&&T<=m)f=!1,h=!1;else{let E=_.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(E&&E[1]===a){h=!0,y=E[1].length;continue}if(h){if(T>y||_.trim()==="")continue;h=!1}}}p.push(_)}return p.join(`
|
|
55
55
|
`)}let s=JSON.stringify(t),c=JSON.stringify(r),u=[`${a}superpowers:`,`${a}${a}command: ${s}`,`${a}${a}args: ${c}`];if(!e||e.trim()==="")return`mcp_servers:
|
|
56
56
|
${u.join(`
|
|
57
57
|
`)}
|
|
58
|
-
`;let l=
|
|
58
|
+
`;let l=i.length===1?i[0].index:-1;if(l===-1)return`${e.trimEnd()}
|
|
59
59
|
|
|
60
60
|
mcp_servers:
|
|
61
61
|
${u.join(`
|
|
62
62
|
`)}
|
|
63
|
-
`;let d=-1;for(let p=l+1;p<
|
|
64
|
-
`)}else return
|
|
65
|
-
`)}function
|
|
66
|
-
`}function
|
|
67
|
-
`),process.exit(1)),
|
|
68
|
-
`),process.exit(1)),
|
|
69
|
-
`),process.exit(1))}if(console.log(`
|
|
63
|
+
`;let d=-1;for(let p=l+1;p<o.length;p++){let f=o[p];if(/^[^\s#]/.test(f))break;if((f.match(/^(\s*)/)?.[1]||"")===a&&/^\s+superpowers:\s*(?:#.*)?$/.test(f)){d=p;break}}if(d!==-1){let p=o[d].match(/^(\s*)/)?.[1].length||2,f=d+1;for(;f<o.length;){let m=o[f];if((m.match(/^(\s*)/)?.[1].length||0)>p||m.trim()==="")f++;else break}return u[0]+=qT(o[d]),o.splice(d,f-d,...u),o.join(`
|
|
64
|
+
`)}else return o.splice(l+1,0,...u),o.join(`
|
|
65
|
+
`)}function VT(e,t,r,n,o=!1,i){let a={};if(e&&e.trim()!=="")try{let u=JSON.parse(e);if(!Rf(u))throw new Error("Existing JSON root must be an object");a=u}catch{try{let l=FT(e,!0),d=JSON.parse(l);if(!Rf(d))throw new Error("Existing JSON root must be an object");a=d}catch(l){let d=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse existing JSON: ${d}`)}}let s="mcpServers";if(t==="json-servers"?s="servers":t==="json-mcp"&&(s="mcp"),a[s]!==void 0&&!Rf(a[s]))throw new Error(`Existing JSON field "${s}" must be an object`);a[s]===void 0&&(a[s]={});let c=a[s];return o?delete c.superpowers:i?c.superpowers=i:t==="json-servers"?c.superpowers={command:r,args:n,type:"stdio"}:t==="json-mcp"?c.superpowers={type:"local",command:[r,...n],enabled:!0}:c.superpowers={command:r,args:n},JSON.stringify(a,null,2)+`
|
|
66
|
+
`}function JT(e,t,r=!1,n=[],o){if(n.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let i=e;try{let _=U.lstatSync(e,{throwIfNoEntry:!1});if(_&&_.isSymbolicLink()){try{i=U.realpathSync(e)}catch{let jn=U.readlinkSync(e);i=w.resolve(w.dirname(e),jn)}let b=w.normalize(w.resolve(i)).toLowerCase(),T=w.normalize(w.resolve(Dr.tmpdir())).toLowerCase();if(!(b===T||b.startsWith(T+w.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(Ae=>b===Ae||b.startsWith(Ae+w.sep))||b==="/var"||b.startsWith("/var"+w.sep)&&!b.startsWith("/var/folders"+w.sep)||b==="/private/var"||b.startsWith("/private/var"+w.sep)&&!b.startsWith("/private/var/folders"+w.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${i}`)}}catch(_){if(_ instanceof Error&&_.message.includes("Refusing to write to unsafe symlink target"))throw _}let a=w.dirname(i);U.existsSync(a)||U.mkdirSync(a,{recursive:!0,mode:448});let s=U.realpathSync(a),c=U.statSync(s);i=w.join(s,w.basename(i));let u=w.normalize(w.resolve(i)).toLowerCase(),l=w.normalize(w.resolve(Dr.tmpdir())).toLowerCase(),d=u===l||u.startsWith(l+w.sep),f=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(_=>u===_||u.startsWith(_+w.sep))||u==="/var"||u.startsWith("/var"+w.sep)&&!u.startsWith("/var/folders"+w.sep)||u==="/private/var"||u.startsWith("/private/var"+w.sep)&&!u.startsWith("/private/var/folders"+w.sep);if(!d&&f)throw new Error(`Refusing to write to unsafe configuration target: ${i}`);if(!n.some(_=>{if(!_)return!1;let b=w.resolve(_);try{b=U.realpathSync(b)}catch{}let T=w.relative(b,i);return T!==".."&&!T.startsWith(`..${w.sep}`)&&!w.isAbsolute(T)}))throw new Error(`Refusing to write configuration outside allowed roots: ${i}`);let h=384;if(U.existsSync(i)){try{h=U.statSync(i).mode}catch{}if(r){let _=U.readFileSync(i,"utf8"),b=`${i}.${Date.now()}.bak`;try{U.writeFileSync(b,_,{encoding:"utf8",mode:h})}catch(T){let E=T instanceof Error?T.message:String(T);throw new Error(`Failed to create safe backup before write: ${E}`)}}}let y=h$.randomBytes(8).toString("hex"),$=w.join(s,`.tmp.${w.basename(i)}.${process.pid}.${y}`);try{U.writeFileSync($,t,{encoding:"utf8",mode:h,flag:"wx"});let _=U.existsSync(i);if(o===null&&_)throw new Error("Configuration changed concurrently before it could be created");if(o!=null&&(!_||U.readFileSync(i,"utf8")!==o))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let b=U.realpathSync(a),T=U.statSync(b);if(b!==s||T.dev!==c.dev||T.ino!==c.ino)throw new Error("Configuration directory changed while writing");U.renameSync($,i)}catch(_){try{U.existsSync($)&&U.unlinkSync($)}catch{}throw _}}async function HT(e={}){let t=e.platform||Dr.platform(),r=e.homeDir||Dr.homedir(),n=e.appData||process.env.APPDATA,o=e.localAppData||process.env.LOCALAPPDATA,i=!!e.dryRun,a=!!e.remove,s=!!e.bun,c=e.target?e.target.toLowerCase():null,u=s?"bunx":"npx",l=["-y","superpowers-mcp"],d=[];if(!c)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(yi).join("|")}>.`);let p=Object.keys(yi).find(m=>m===c||yi[m].aliases.includes(c));if(!p)throw new Error(`Unknown harness target: "${c}". Supported targets: ${Object.keys(yi).join(", ")}`);let f=[p];for(let m of f){let h=yi[m],y=h.getConfigPath(t,r,n,o),$=U.existsSync(y);if(a&&!$){d.push({target:m,name:h.name,path:y,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let _="";$&&(_=U.readFileSync(y,"utf8"));let b="";if(h.type==="yaml")b=LT(_,u,l,a);else{let T=typeof h.defaultConfig=="function"?h.defaultConfig(u,l):void 0;b=VT(_,h.type,u,l,a,T)}if(_.trim()===b.trim()&&$){d.push({target:m,name:h.name,path:y,status:"up-to-date",message:a?"Already not configured":"Already configured and up-to-date"});continue}i||JT(y,b,!!e.backup,[r,n||"",o||""],$?_:null),d.push({target:m,name:h.name,path:y,status:a?"removed":$?"updated":"created",message:i?`[Dry Run] Would ${a?"remove from":$?"update":"create"} ${y}`:`Successfully ${a?"removed from":$?"updated":"configured"}!`})}catch(_){let b=_ instanceof Error?_.message:String(_);d.push({target:m,name:h.name,path:y,status:"error",message:b})}}return d}async function g$(e=process.argv.slice(2)){let t=!1,r={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let n=0;n<e.length;n++){let o=e[n];if(!(o==="setup"||o==="--setup"))if(o==="--print-config")t=!0;else if(o==="--dry-run")r.dryRun=!0;else if(o==="--remove"||o==="--uninstall")r.remove=!0;else if(o==="--bun")r.bun=!0;else if(o==="--backup")r.backup=!0;else if(o==="--target"||o==="-t"){let i=e[n+1];(!i||i.startsWith("-"))&&(console.error(`\u274C Error: Missing value for --target flag.
|
|
67
|
+
`),process.exit(1)),r.target=e[++n]}else if(o.startsWith("--target=")){let i=o.split("=")[1];i||(console.error(`\u274C Error: Missing value for --target flag.
|
|
68
|
+
`),process.exit(1)),r.target=i}else if(o==="--help"||o==="-h"){KT();return}else!o.startsWith("-")&&!r.target&&o!=="setup"?r.target=o:o.startsWith("-")&&(console.error(`\u274C Error: Unknown option "${o}". Use --help for usage.
|
|
69
|
+
`),process.exit(1))}if(t){if(r.target||r.remove||r.backup||r.dryRun){console.error("--print-config supports only --bun; omit target and file-operation flags."),process.exitCode=1;return}console.log(JSON.stringify({mcpServers:{superpowers:{command:r.bun?"bunx":"npx",args:["-y","superpowers-mcp"]}}},null,2));return}if(console.log(`
|
|
70
70
|
========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
|
|
71
|
-
`),!
|
|
72
|
-
`),console.log(" npx -y superpowers-mcp setup --target antigravity # Antigravity (~/.gemini/config/mcp_config.json)"),console.log(" npx -y superpowers-mcp setup --target pi-desktop # Pi Desktop / Pi Agent (~/.pi/agent/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target cursor # Cursor (~/.cursor/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot # GitHub Copilot (VS Code mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot-insiders # GitHub Copilot (VS Code Insiders mcp.json)"),console.log(" npx -y superpowers-mcp setup --target hermes # Hermes Desktop / Agent"),console.log(" npx -y superpowers-mcp setup --target kimi # Kimi Work / Kimi Code"),console.log(" npx -y superpowers-mcp setup --target claude # Claude Desktop"),console.log(" npx -y superpowers-mcp setup --target devin # Devin Desktop (formerly Windsurf)"),console.log(" npx -y superpowers-mcp setup --target qwenpaw # QwenPaw / CoPaw (~/.qwenpaw/config.json)"),console.log(" npx -y superpowers-mcp setup --target cline # Cline (~/.../cline_mcp_settings.json)"),console.log(" npx -y superpowers-mcp setup --target kilo # Kilo Code (~/.config/kilo/kilo.jsonc)"),console.log(" npx -y superpowers-mcp setup --target qoder # Qoder (~/.qoder/settings.json)"),console.log(" npx -y superpowers-mcp setup --target kiro # Kiro (~/.kiro/settings/mcp.json)"),console.log(` npx -y superpowers-mcp setup --target trae # Trae (~/.../Trae/User/mcp.json)
|
|
71
|
+
`),!r.target){console.log(`Please select which AI Agent client you would like to configure:
|
|
72
|
+
`),console.log(" npx -y superpowers-mcp setup --target lmstudio # LM Studio (~/.lmstudio/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target roo # Roo Code in VS Code Desktop"),console.log(" npx -y superpowers-mcp setup --print-config # JSON for desktop app import"),console.log(" npx -y superpowers-mcp setup --target antigravity # Antigravity (~/.gemini/config/mcp_config.json)"),console.log(" npx -y superpowers-mcp setup --target pi-desktop # Pi Desktop / Pi Agent (~/.pi/agent/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target cursor # Cursor (~/.cursor/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot # GitHub Copilot (VS Code mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot-insiders # GitHub Copilot (VS Code Insiders mcp.json)"),console.log(" npx -y superpowers-mcp setup --target hermes # Hermes Desktop / Agent"),console.log(" npx -y superpowers-mcp setup --target kimi # Kimi Work / Kimi Code"),console.log(" npx -y superpowers-mcp setup --target claude # Claude Desktop"),console.log(" npx -y superpowers-mcp setup --target devin # Devin Desktop (formerly Windsurf)"),console.log(" npx -y superpowers-mcp setup --target qwenpaw # QwenPaw / CoPaw (~/.qwenpaw/config.json)"),console.log(" npx -y superpowers-mcp setup --target cline # Cline (~/.../cline_mcp_settings.json)"),console.log(" npx -y superpowers-mcp setup --target kilo # Kilo Code (~/.config/kilo/kilo.jsonc)"),console.log(" npx -y superpowers-mcp setup --target qoder # Qoder (~/.qoder/settings.json)"),console.log(" npx -y superpowers-mcp setup --target kiro # Kiro (~/.kiro/settings/mcp.json)"),console.log(` npx -y superpowers-mcp setup --target trae # Trae (~/.../Trae/User/mcp.json)
|
|
73
73
|
`),console.log("\u{1F4A1} Tip:"),console.log(" You can run this setup command from ANY folder on your system."),console.log(` It automatically targets your global config files (~/...) without needing to clone this repo.
|
|
74
74
|
`),console.log("\u{1F4A1} Privacy & Safety:"),console.log(" Superpowers MCP only configures the specific client you explicitly choose."),console.log(` It will NEVER silently scan or modify unselected environments.
|
|
75
|
-
`);return}try{let
|
|
76
|
-
`),
|
|
77
|
-
`),process.exit(1)}}function
|
|
75
|
+
`);return}try{let n=await HT(r),o=0,i=0,a=0;for(let s of n){let c=s.status==="created"||s.status==="updated"||s.status==="removed"?"\u2705":s.status==="up-to-date"?"\u2728":s.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${c} [${s.name}] (${s.status})`),console.log(` Path: ${s.path}`),console.log(` Info: ${s.message}
|
|
76
|
+
`),s.status==="created"||s.status==="updated"||s.status==="up-to-date"||s.status==="removed"?o++:s.status==="skipped"?i++:s.status==="error"&&a++}console.log("--------------------------------------------------------"),a>0&&(console.error(`\u26A0\uFE0F Setup finished with errors: ${a} failure(s), ${o} succeeded.`),process.exit(1)),console.log(`\u{1F389} Setup complete! ${o} environment(s) ready.`)}catch(n){let o=n instanceof Error?n.message:String(n);console.error(`\u274C Setup failed: ${o}
|
|
77
|
+
`),process.exit(1)}}function KT(){console.log(`
|
|
78
78
|
Superpowers MCP - Targeted Global Setup
|
|
79
79
|
|
|
80
80
|
Usage:
|
|
@@ -86,7 +86,8 @@ Options:
|
|
|
86
86
|
copilot (vscode), copilot-insiders (vscode-insiders, code-insiders, insiders),
|
|
87
87
|
hermes, kimi, claude, devin (windsurf),
|
|
88
88
|
qwenpaw (qwen-paw, copaw), cline (claude-dev), kilo (kilocode),
|
|
89
|
-
qoder, kiro (kiro-code), trae
|
|
89
|
+
qoder, kiro (kiro-code), trae, lmstudio (lm-studio), roo (roo-code, roocode)
|
|
90
|
+
--print-config Print importable mcpServers JSON without writing files (optional --bun)
|
|
90
91
|
--bun Use "bunx" instead of "npx" in server commands
|
|
91
92
|
--backup Create a timestamped .bak backup before modifying (Default: false, zero-pollution)
|
|
92
93
|
--remove Remove superpowers MCP configuration from target
|
|
@@ -117,13 +118,13 @@ Any Directory:
|
|
|
117
118
|
Privacy & Safety:
|
|
118
119
|
Superpowers MCP only touches the client you explicitly choose.
|
|
119
120
|
It never bulk-modifies your environment without your consent.
|
|
120
|
-
`)}var Nr={promptName:"feature-pipeline",title:"Feature Development Pipeline",purpose:"Start an interactive feature workflow from requirements through branch finishing.",stages:[{title:"Requirements & Architecture Discovery",skills:[{name:"brainstorming"}],instructions:["Clarify user intent, requirements, constraints, and architecture decisions.","Produce a design specification document (for example, in `docs/superpowers/specs/`).","Stop at the skill's design-approval gate and wait for explicit user approval."]},{title:"Plan Construction",skills:[{name:"writing-plans"}],instructions:["Decompose the approved spec into bite-sized, independently testable tasks.","Specify recommended skills for each task and save the plan under `docs/superpowers/plans/`.","Stop at the plan-review gate and wait for explicit user approval before implementation."]},{title:"Workspace Isolation",skills:[{name:"using-git-worktrees"}],instructions:["Create or verify an isolated Git worktree before implementation."]},{title:"Execution & Implementation",skills:[{name:"subagent-driven-development",when:"when the host provides multi-agent tools"},{name:"executing-plans",when:"otherwise, as the inline fallback"},{name:"test-driven-development",when:"for implementation tasks"}],instructions:["Use Red -> Green -> Refactor for implementation work.","Run task-level verification and review as required by the selected execution skill.","Never claim that subagents were dispatched when the host does not provide multi-agent tools."]},{title:"Full Suite Verification",skills:[{name:"verification-before-completion"}],instructions:["Run the complete repository test suite, linter, and type checks; do not skip."]},{title:"Code Review",skills:[{name:"requesting-code-review"},{name:"receiving-code-review",when:"when findings are returned"}],instructions:["Generate a review package and resolve or explicitly rule on every finding."]},{title:"Branch Finishing & Cleanup",skills:[{name:"finishing-a-development-branch"}],instructions:["Present the skill's branch-finishing choices and wait for the user to select one.","Do not merge, push, create a PR, or delete a worktree without the authorization required by the skill."]}]},Rr={promptName:"structured-debug",title:"Structured Troubleshooting Pipeline",purpose:"Start an interactive root-cause debugging and regression-fix workflow.",stages:[{title:"Systematic Root Cause Analysis",skills:[{name:"systematic-debugging"}],instructions:["Gather exact error traces, logs, and state.","Decompose the failure into testable hypotheses before proposing fixes."]},{title:"Workspace Isolation",skills:[{name:"using-git-worktrees"}],instructions:["Create or verify an isolated worktree before changing code."]},{title:"Hypothesis Verification",skills:[{name:"dispatching-parallel-agents",when:"only when independent hypotheses and multi-agent tools are available"}],instructions:["Investigate independent hypotheses in parallel only when the host supports safe subagent dispatch.","Otherwise investigate hypotheses sequentially in the current agent; do not claim that subagents ran."]},{title:"Test-Driven Bugfix",skills:[{name:"test-driven-development"}],instructions:["Write a minimal failing reproduction test first, apply the smallest fix, and refactor only while green."]},{title:"Full Regression Verification",skills:[{name:"verification-before-completion"}],instructions:["Run the complete repository verification suite and report exact evidence."]},{title:"Review & Findings Resolution",skills:[{name:"requesting-code-review"},{name:"receiving-code-review",when:"when findings are returned"}],instructions:["Review the fix delta and resolve or explicitly rule on every finding."]},{title:"Branch Finishing & Cleanup",skills:[{name:"finishing-a-development-branch"}],instructions:["Present branch-finishing choices and perform only the option selected by the user."]}]};function
|
|
121
|
-
`)}function
|
|
121
|
+
`)}var Nr={promptName:"feature-pipeline",title:"Feature Development Pipeline",purpose:"Start an interactive feature workflow from requirements through branch finishing.",stages:[{title:"Requirements & Architecture Discovery",skills:[{name:"brainstorming"}],instructions:["Clarify user intent, requirements, constraints, and architecture decisions.","Produce a design specification document (for example, in `docs/superpowers/specs/`).","Stop at the skill's design-approval gate and wait for explicit user approval."]},{title:"Plan Construction",skills:[{name:"writing-plans"}],instructions:["Decompose the approved spec into bite-sized, independently testable tasks.","Specify recommended skills for each task and save the plan under `docs/superpowers/plans/`.","Stop at the plan-review gate and wait for explicit user approval before implementation."]},{title:"Workspace Isolation",skills:[{name:"using-git-worktrees"}],instructions:["Create or verify an isolated Git worktree before implementation."]},{title:"Execution & Implementation",skills:[{name:"subagent-driven-development",when:"when the host provides multi-agent tools"},{name:"executing-plans",when:"otherwise, as the inline fallback"},{name:"test-driven-development",when:"for implementation tasks"}],instructions:["Use Red -> Green -> Refactor for implementation work.","Run task-level verification and review as required by the selected execution skill.","Never claim that subagents were dispatched when the host does not provide multi-agent tools."]},{title:"Full Suite Verification",skills:[{name:"verification-before-completion"}],instructions:["Run the complete repository test suite, linter, and type checks; do not skip."]},{title:"Code Review",skills:[{name:"requesting-code-review"},{name:"receiving-code-review",when:"when findings are returned"}],instructions:["Generate a review package and resolve or explicitly rule on every finding."]},{title:"Branch Finishing & Cleanup",skills:[{name:"finishing-a-development-branch"}],instructions:["Present the skill's branch-finishing choices and wait for the user to select one.","Do not merge, push, create a PR, or delete a worktree without the authorization required by the skill."]}]},Rr={promptName:"structured-debug",title:"Structured Troubleshooting Pipeline",purpose:"Start an interactive root-cause debugging and regression-fix workflow.",stages:[{title:"Systematic Root Cause Analysis",skills:[{name:"systematic-debugging"}],instructions:["Gather exact error traces, logs, and state.","Decompose the failure into testable hypotheses before proposing fixes."]},{title:"Workspace Isolation",skills:[{name:"using-git-worktrees"}],instructions:["Create or verify an isolated worktree before changing code."]},{title:"Hypothesis Verification",skills:[{name:"dispatching-parallel-agents",when:"only when independent hypotheses and multi-agent tools are available"}],instructions:["Investigate independent hypotheses in parallel only when the host supports safe subagent dispatch.","Otherwise investigate hypotheses sequentially in the current agent; do not claim that subagents ran."]},{title:"Test-Driven Bugfix",skills:[{name:"test-driven-development"}],instructions:["Write a minimal failing reproduction test first, apply the smallest fix, and refactor only while green."]},{title:"Full Regression Verification",skills:[{name:"verification-before-completion"}],instructions:["Run the complete repository verification suite and report exact evidence."]},{title:"Review & Findings Resolution",skills:[{name:"requesting-code-review"},{name:"receiving-code-review",when:"when findings are returned"}],instructions:["Review the fix delta and resolve or explicitly rule on every finding."]},{title:"Branch Finishing & Cleanup",skills:[{name:"finishing-a-development-branch"}],instructions:["Present branch-finishing choices and perform only the option selected by the user."]}]};function v$(e){let t=e.when?` (${e.when})`:"";return[` - **Skill:** \`superpowers:${e.name}\`${t}`,` - **Load it with:** \`read_skill({"skill_name":"${e.name}"})\``].join(`
|
|
122
|
+
`)}function y$(e,t){let r=t?`
|
|
122
123
|
### Requirements / Context:
|
|
123
124
|
${t}
|
|
124
|
-
`:"",n=Nr.stages.map((i
|
|
125
|
-
`),s=
|
|
126
|
-
`);return`${
|
|
125
|
+
`:"",n=Nr.stages.map((o,i)=>{let a=o.skills.map(v$).join(`
|
|
126
|
+
`),s=o.instructions.map(c=>` - ${c}`).join(`
|
|
127
|
+
`);return`${i+1}. **Stage ${i+1}: ${o.title}**
|
|
127
128
|
${a}
|
|
128
129
|
${s}`}).join(`
|
|
129
130
|
|
|
@@ -137,15 +138,15 @@ For every stage, call \`read_skill\` with the exact bare skill name shown below
|
|
|
137
138
|
${r}
|
|
138
139
|
## Mandatory Execution Stages
|
|
139
140
|
|
|
140
|
-
${n}`}function
|
|
141
|
+
${n}`}function _$(e,t){let r=e?`
|
|
141
142
|
### Issue Description / Logs:
|
|
142
143
|
${e}
|
|
143
144
|
`:"",n=t?`
|
|
144
145
|
### Failing Tests:
|
|
145
146
|
${t}
|
|
146
|
-
`:"",
|
|
147
|
-
`),c=
|
|
148
|
-
`);return`${a+1}. **Stage ${a+1}: ${
|
|
147
|
+
`:"",o=Rr.stages.map((i,a)=>{let s=i.skills.map(v$).join(`
|
|
148
|
+
`),c=i.instructions.map(u=>` - ${u}`).join(`
|
|
149
|
+
`);return`${a+1}. **Stage ${a+1}: ${i.title}**
|
|
149
150
|
${s}
|
|
150
151
|
${c}`}).join(`
|
|
151
152
|
|
|
@@ -157,8 +158,8 @@ For every applicable stage, call \`read_skill\` with the exact bare skill name s
|
|
|
157
158
|
${r}${n}
|
|
158
159
|
## Mandatory Troubleshooting Stages
|
|
159
160
|
|
|
160
|
-
${
|
|
161
|
-
`);else return n}let t=
|
|
161
|
+
${o}`}function BT(){let e=process.env.SKILLS_PATH;if(e){let r=Ze.resolve(e),n=r,o=!0;try{n=Pn.realpathSync(r)}catch{o=!1}let i=l=>process.platform==="darwin"||process.platform==="win32"?l.toLowerCase():l,a=i(Ze.normalize(n)),s=i(Ze.parse(n).root);if(!o||a===s||["/etc","/var","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","/private/var","c:\\windows","c:\\program files","c:\\program files (x86)"].some(l=>{let d=i(Ze.normalize(l));return a===d||a.startsWith(d+Ze.sep)}))process.stderr.write(`Warning: Potentially unsafe SKILLS_PATH: "${e}". Fallback to default.
|
|
162
|
+
`);else return n}let t=Ze.join(__dirname,"..","skills");return Pn.existsSync(t)?t:Ze.join(__dirname,"skills")}var Cf=BT(),Tt=new Es(Cf),Zf="guide://superpowers/skill-compositions",WT=Ze.join(__dirname,"..","docs","skill-compositions.md");function k$(e){return e.trim().replace(/^superpowers:/i,"")}var dr=new Ps({name:"superpowers-mcp",version:"6.3.9"},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});dr.setRequestHandler(gd,async()=>({resources:[...(await Tt.listSkills()).map(t=>({uri:`skill://superpowers/${encodeURIComponent(t.name)}`,name:t.name,description:t.description,mimeType:"text/markdown"})),{uri:Zf,name:"Skill Compositions Guide",description:"Workflow selection, prerequisites, invocation, and lifecycle guidance for Superpowers pipelines.",mimeType:"text/markdown"}]}));dr.setRequestHandler(yd,async e=>{let t=e.params.uri;if(t===Zf)try{let i=await Pn.promises.readFile(WT,"utf8");return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}}catch{throw new R(q.InternalError,"Failed to read the skill compositions guide.")}let r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new R(q.InvalidRequest,`Invalid skill URI: ${t}`);let n;try{n=decodeURIComponent(r[1])}catch{throw new R(q.InvalidRequest,`Invalid skill URI: ${t}`)}let o=await Tt.findSkill(k$(n));if(!o)throw new R(q.InvalidRequest,`Skill not found: ${n}`);try{let i=await Tt.readSkillContent(o.skillPath);return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}}catch{throw new R(q.InternalError,"Failed to read skill content safely.")}});function $$(e,t){return e.endsWith(t)?`${e.slice(0,-t.length)}-review.md`:""}function b$(e,t){if(!e||!t)return!1;let r=n=>{let o=Ze.resolve(n);return process.platform==="darwin"||process.platform==="win32"?o.toLowerCase():o};return r(e)===r(t)}function x$(e,t,r){if(e&&!b$(e,t)&&!b$(e,r))return e;let n=$$(t,"-report.md")||$$(r,"-brief.md");return n||(t?`${t.replace(/(\.[^./\\]*)?$/,"")}-review.md`:"")}function _i(e,t){let r=Object.keys(t).filter(i=>{let a=t[i];return a!==void 0&&a!==""});if(r.length===0)return e;let n=r.sort((i,a)=>a.length-i.length).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),o=new RegExp(n,"g");return e.replace(o,i=>{let a=t[i];return a!==void 0&&a!==""?String(a):i})}dr.setRequestHandler(_d,async()=>({prompts:[{name:"session-start",description:"Inject the Superpowers context into an AI agent session. Tells the agent it has superpowers and how to use the skill system."},{name:"sdd-implementer",description:"Subagent-Driven Development (SDD) Implementer Prompt. Directs a subagent to implement a specific task using TDD and self-verification.",arguments:[{name:"brief_file",description:"Path to the task brief file (scripts/task-brief PLAN N)",required:!1},{name:"task_name",description:"Name or description of the task to implement",required:!1},{name:"report_file",description:"Path where the implementer should write its detailed report",required:!1},{name:"work_dir",description:"Working directory path for implementation",required:!1},{name:"model",description:"Model tier/name selection for implementer",required:!1},{name:"plan_file",description:"Legacy alias: Path to the task brief or plan file",required:!1},{name:"task_description",description:"Legacy alias: Task description",required:!1}]},{name:"sdd-task-reviewer",description:"Subagent-Driven Development (SDD) Task Reviewer Prompt. Evaluates task implementation against specification and code quality.",arguments:[{name:"brief_file",description:"Path to the task brief file",required:!1},{name:"report_file",description:"Path to the implementer's report file",required:!1},{name:"diff_file",description:"Path to the review package diff file",required:!1},{name:"review_file",description:"Path the reviewer writes its full report to; defaults to the report or brief file's -review.md sibling",required:!1},{name:"base_sha",description:"Base commit SHA before this task",required:!1},{name:"head_sha",description:"Head commit SHA for this task",required:!1},{name:"global_constraints",description:"Binding global constraints copied verbatim from the plan or spec",required:!1},{name:"model",description:"Reviewer model selection",required:!1},{name:"task_description",description:"Legacy alias: Description of the task being reviewed",required:!1},{name:"review_target",description:"Legacy alias: Review target or diff path",required:!1}]},{name:"sdd-re-review",description:"SDD Scoped Re-Review Prompt. Reviews only fix-round deltas and previous feedback to prevent context bloat.",arguments:[{name:"brief_file",description:"Path to the task brief file",required:!1},{name:"report_file",description:"Path to the implementer's report file with fix notes",required:!1},{name:"diff_file",description:"Path to the scoped review package diff file over fix range",required:!1},{name:"review_file",description:"Path to the task's review file; this round's verdicts are appended to it",required:!1},{name:"fix_base_sha",description:"Alias: the head the previous review saw (same as base_sha for a fix round)",required:!1},{name:"previous_findings",description:"Previous reviewer findings that needed fixing",required:!1},{name:"base_sha",description:"Base commit SHA for the fix round",required:!1},{name:"head_sha",description:"Current head commit SHA",required:!1},{name:"model",description:"Re-reviewer model selection",required:!1},{name:"fix_summary",description:"Legacy alias: Summary of changes made to address previous findings",required:!1}]},{name:"spec-reviewer",description:"Spec Document Reviewer Prompt. Adversarially reviews a design specification across requirements, architecture, and edge cases.",arguments:[{name:"spec_file",description:"Path to the specification document to review (e.g., docs/superpowers/specs/...)",required:!1}]},{name:"plan-reviewer",description:"Plan Document Reviewer Prompt. Adversarially reviews an implementation plan for completeness, testability, and task contracts.",arguments:[{name:"plan_file",description:"Path to the implementation plan document to review",required:!1},{name:"spec_file",description:"Path to the reference specification document",required:!1}]},{name:Nr.promptName,description:Nr.purpose,arguments:[{name:"feature_name",description:"Name or title of the feature to develop",required:!0},{name:"requirements",description:"Initial feature requirements, constraints, or description",required:!1}]},{name:Rr.promptName,description:Rr.purpose,arguments:[{name:"issue_description",description:"Description of the bug, error logs, or symptoms",required:!1},{name:"failing_tests",description:"Names or paths of failing tests",required:!1}]},{name:"skill-composition",description:"Skill Composition & Workflow Guide Prompt. Recommends multi-skill compositions for feature development, debugging, refactoring, or legacy safety net.",arguments:[{name:"scenario",description:"Development scenario (feature, debug, refactor, legacy-safety)",required:!1}]}]}));dr.setRequestHandler($d,async e=>{let t=e.params.name,r=e.params.arguments||{},n=32*1024,o=(a,s=n)=>{let c=Object.prototype.hasOwnProperty.call(r,a)?r[a]:void 0,u="";return typeof c=="string"?u=c.trim():c!=null&&(u=String(c).trim()),u.length>s?u.slice(0,s):u},i=async a=>{let s=Ze.join(Cf,a);try{return await Tt.readSkillContent(s)}catch{return""}};if(t==="session-start"){let a="";try{let c=await Tt.findSkill("using-superpowers"),u=c?c.skillPath:Ze.join(Cf,"using-superpowers","SKILL.md");a=await Tt.readSkillContent(u)}catch{a=`# Superpowers
|
|
162
163
|
|
|
163
164
|
You have superpowers. Use the read_skill and list_skills tools to discover and load skills.`}return{description:"Superpowers session start context \u2014 establishes how to find and use skills",messages:[{role:"user",content:{type:"text",text:`<EXTREMELY_IMPORTANT>
|
|
164
165
|
You have superpowers.
|
|
@@ -166,34 +167,34 @@ You have superpowers.
|
|
|
166
167
|
**Below is the full content of your 'superpowers:using-superpowers' skill - your introduction to using skills. For all other skills, use the read_skill tool:**
|
|
167
168
|
|
|
168
169
|
${a}
|
|
169
|
-
</EXTREMELY_IMPORTANT>`}}]}}if(t==="sdd-implementer"){let a=await
|
|
170
|
+
</EXTREMELY_IMPORTANT>`}}]}}if(t==="sdd-implementer"){let a=await i("subagent-driven-development/implementer-prompt.md"),s=o("brief_file")||o("plan_file"),c=o("task_name")||o("task_description"),u=o("report_file"),l=o("work_dir"),d=o("model"),p=o("task_description"),f=o("plan_file"),m=_i(a,{"[BRIEF_FILE]":s,"[task name]":c,"[REPORT_FILE]":u,"[directory]":l,"[MODEL]":d}),h=[p&&!m.includes(p)?`
|
|
170
171
|
|
|
171
172
|
### Target Task:
|
|
172
173
|
${p}`:"",f&&!m.includes(f)?`
|
|
173
174
|
|
|
174
175
|
### Plan / Brief File:
|
|
175
|
-
${f}`:""].join("");return{description:"Subagent-Driven Development Implementer Prompt",messages:[{role:"user",content:{type:"text",text:`${m}${h}`}}]}}if(t==="sdd-task-reviewer"){let a=await
|
|
176
|
+
${f}`:""].join("");return{description:"Subagent-Driven Development Implementer Prompt",messages:[{role:"user",content:{type:"text",text:`${m}${h}`}}]}}if(t==="sdd-task-reviewer"){let a=await i("subagent-driven-development/task-reviewer-prompt.md"),s=o("brief_file"),c=o("report_file"),u=o("diff_file")||o("review_target"),l=x$(o("review_file"),c,s),d=o("base_sha"),p=o("head_sha"),f=o("global_constraints"),m=o("model"),h=o("task_description"),y=o("review_target"),$=_i(a,{"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[BASE_SHA]":d,"[HEAD_SHA]":p,"[GLOBAL_CONSTRAINTS]":f,"[REVIEW_FILE]":l,"[MODEL]":m}),_=[h&&!$.includes(h)?`
|
|
176
177
|
|
|
177
178
|
### Reviewed Task:
|
|
178
179
|
${h}`:"",y&&!$.includes(y)?`
|
|
179
180
|
|
|
180
181
|
### Review Target:
|
|
181
|
-
${y}`:""].join("");return{description:"Subagent-Driven Development Task Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${$}${_}`}}]}}if(t==="sdd-re-review"){let a=await
|
|
182
|
+
${y}`:""].join("");return{description:"Subagent-Driven Development Task Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${$}${_}`}}]}}if(t==="sdd-re-review"){let a=await i("subagent-driven-development/re-review-prompt.md"),s=o("brief_file"),c=o("report_file"),u=o("diff_file"),l=x$(o("review_file"),c,s),d=o("previous_findings"),p=o("base_sha")||o("fix_base_sha"),f=o("head_sha"),m=o("model"),h=o("fix_summary"),y=_i(a,{"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[REVIEW_FILE]":l,"[FINDINGS]":d,"[BASE_SHA]":p,"[FIX_BASE_SHA]":p,"[HEAD_SHA]":f,"[MODEL]":m}),$=[d&&!y.includes(d)?`
|
|
182
183
|
|
|
183
184
|
### Previous Findings:
|
|
184
185
|
${d}`:"",h?`
|
|
185
186
|
|
|
186
187
|
### Fix Summary:
|
|
187
|
-
${h}`:""].join("");return{description:"SDD Scoped Re-Review Prompt",messages:[{role:"user",content:{type:"text",text:`${y}${$}`}}]}}if(t==="spec-reviewer"){let a=await
|
|
188
|
+
${h}`:""].join("");return{description:"SDD Scoped Re-Review Prompt",messages:[{role:"user",content:{type:"text",text:`${y}${$}`}}]}}if(t==="spec-reviewer"){let a=await i("brainstorming/spec-document-reviewer-prompt.md"),s=o("spec_file"),c=_i(a,{"[SPEC_FILE_PATH]":s}),u=s&&!c.includes(s)?`
|
|
188
189
|
|
|
189
190
|
### Target Specification:
|
|
190
|
-
${s}`:"";return{description:"Brainstorming Spec Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${c}${u}`}}]}}if(t==="plan-reviewer"){let a=await
|
|
191
|
+
${s}`:"";return{description:"Brainstorming Spec Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${c}${u}`}}]}}if(t==="plan-reviewer"){let a=await i("writing-plans/plan-document-reviewer-prompt.md"),s=o("plan_file"),c=o("spec_file"),u=_i(a,{"[PLAN_FILE_PATH]":s,"[SPEC_FILE_PATH]":c}),l=s&&!u.includes(s)?`
|
|
191
192
|
|
|
192
193
|
### Target Implementation Plan:
|
|
193
194
|
${s}`:"",d=c&&!u.includes(c)?`
|
|
194
195
|
|
|
195
196
|
### Reference Specification:
|
|
196
|
-
${c}`:"";return{description:"Writing-Plans Plan Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${u}${l}${d}`}}]}}if(t===Nr.promptName){let a=
|
|
197
|
+
${c}`:"";return{description:"Writing-Plans Plan Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${u}${l}${d}`}}]}}if(t===Nr.promptName){let a=o("feature_name"),s=a?a.replace(/[\r\n]+/g," "):"(Unspecified feature)",c=o("requirements"),u=y$(s,c);return{description:Nr.purpose,messages:[{role:"user",content:{type:"text",text:u}}]}}if(t===Rr.promptName){let a=o("issue_description"),s=o("failing_tests"),c=_$(a,s);return{description:Rr.purpose,messages:[{role:"user",content:{type:"text",text:c}}]}}if(t==="skill-composition"){let a=o("scenario"),s=a?`
|
|
197
198
|
### Selected Scenario:
|
|
198
199
|
${a}
|
|
199
200
|
`:"",c="";if(a){let l=a.toLowerCase();l.includes("debug")||l.includes("troubleshoot")||l.includes("bug")||l.includes("fix")?c=`
|
|
@@ -210,7 +211,7 @@ You are selecting or executing a multi-skill workflow pipeline.
|
|
|
210
211
|
${s}${c}
|
|
211
212
|
## Available Workflow Pipelines
|
|
212
213
|
|
|
213
|
-
The canonical published guide is available as the MCP resource \`${
|
|
214
|
+
The canonical published guide is available as the MCP resource \`${Zf}\`.
|
|
214
215
|
|
|
215
216
|
1. **New Feature Development:**
|
|
216
217
|
\`brainstorming\` \u2794 \`writing-plans\` \u2794 \`using-git-worktrees\` \u2794 \`subagent-driven-development\` (TDD) \u2794 \`verification-before-completion\` \u2794 \`requesting-code-review\` \u2794 \`finishing-a-development-branch\`
|
|
@@ -224,8 +225,8 @@ The canonical published guide is available as the MCP resource \`${Cf}\`.
|
|
|
224
225
|
4. **Legacy Codebase Safety Net:**
|
|
225
226
|
\`brainstorming\` \u2794 \`writing-plans\` \u2794 \`test-driven-development\` (characterization tests) \u2794 \`systematic-debugging\` \u2794 \`verification-before-completion\`
|
|
226
227
|
|
|
227
|
-
Use \`read_skill(skill_name)\` to inspect any skill before starting.`}}]}}throw new R(q.InvalidRequest,`Unknown prompt: ${t}`)});dr.setRequestHandler(Sd,async()=>({tools:[{name:"list_skills",description:"List all available Superpowers skills with their names and descriptions. Use this to discover which skills are available before loading one.",inputSchema:{type:"object",properties:{},required:[]}},{name:"read_skill",description:"Read the full content of a Superpowers skill by name. The skill content contains instructions, checklists, and patterns to follow. Read a skill before attempting the task it covers.",inputSchema:{type:"object",properties:{skill_name:{type:"string",description:'Name of the skill to read (e.g. "brainstorming", "test-driven-development", "systematic-debugging")'}},required:["skill_name"]}}]}));dr.setRequestHandler(
|
|
228
|
-
${
|
|
228
|
+
Use \`read_skill(skill_name)\` to inspect any skill before starting.`}}]}}throw new R(q.InvalidRequest,`Unknown prompt: ${t}`)});dr.setRequestHandler(Sd,async()=>({tools:[{name:"list_skills",description:"List all available Superpowers skills with their names and descriptions. Use this to discover which skills are available before loading one.",inputSchema:{type:"object",properties:{},required:[]}},{name:"read_skill",description:"Read the full content of a Superpowers skill by name. The skill content contains instructions, checklists, and patterns to follow. Read a skill before attempting the task it covers.",inputSchema:{type:"object",properties:{skill_name:{type:"string",description:'Name of the skill to read (e.g. "brainstorming", "test-driven-development", "systematic-debugging")'}},required:["skill_name"]}}]}));dr.setRequestHandler(Ao,async e=>{let{name:t,arguments:r}=e.params;if(t==="list_skills"){let n=await Tt.listSkills(),o=n.map(i=>`**${i.name}**
|
|
229
|
+
${i.description}`).join(`
|
|
229
230
|
|
|
230
231
|
---
|
|
231
232
|
|
|
@@ -235,7 +236,7 @@ Use \`read_skill\` with the skill name to load its full content.
|
|
|
235
236
|
|
|
236
237
|
---
|
|
237
238
|
|
|
238
|
-
${
|
|
239
|
+
${o}`}]}}if(t==="read_skill"){let n=r,o=typeof n?.skill_name=="string"?k$(n.skill_name):void 0;if(!o)throw new R(q.InvalidParams,"skill_name is required");let i=await Tt.findSkill(o);if(!i){let s=(await Tt.listSkills()).map(c=>c.name).join(", ");throw new R(q.InvalidRequest,`Skill "${o}" not found. Available skills: ${s}`)}try{let a=await Tt.readSkillContent(i.skillPath);return{content:[{type:"text",text:`# Skill: ${i.name}
|
|
239
240
|
|
|
240
|
-
${a}`}]}}catch{throw new R(q.InternalError,`Failed to read skill "${
|
|
241
|
+
${a}`}]}}catch{throw new R(q.InternalError,`Failed to read skill "${o}" due to an internal error.`)}}throw new R(q.MethodNotFound,`Unknown tool: ${t}`)});async function GT(){let e=process.argv.slice(2),t=e[0];if(t==="setup"||t==="--setup"){try{await g$(e),process.exit(process.exitCode||0)}catch(o){console.error("Setup failed:",o),process.exit(1)}return}let r=new Ts;await dr.connect(r);let n=async()=>{try{await dr.close()}catch{}process.exit(0)};process.on("SIGINT",n),process.on("SIGTERM",n)}GT().catch(e=>{process.stderr.write(`MCP Server fatal error: ${String(e)}
|
|
241
242
|
`),process.exit(1)});
|