superpowers-mcp 6.4.3 → 6.4.5

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/out/server.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var T$=Object.create;var As=Object.defineProperty;var O$=Object.getOwnPropertyDescriptor;var N$=Object.getOwnPropertyNames;var D$=Object.getPrototypeOf,R$=Object.prototype.hasOwnProperty;var j=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Nn=(e,t)=>{for(var r in t)As(e,r,{get:t[r],enumerable:!0})},C$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of N$(t))!R$.call(e,o)&&o!==r&&As(e,o,{get:()=>t[o],enumerable:!(n=O$(t,o))||n.enumerable});return e};var it=(e,t,r)=>(r=e!=null?T$(D$(e)):{},C$(t||!e||!e.__esModule?As(r,"default",{value:e,enumerable:!0}):r,e));var Jo=j(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 qo=class{};ie._CodeOrName=qo;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var kr=class extends qo{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=kr;var dt=class extends qo{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 kr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=dt;ie.nil=new dt("");function uv(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Cd(r,t[n]),r.push(e[++n]);return new dt(r)}ie._=uv;var Rd=new dt("+");function lv(e,...t){let r=[Vo(e[0])],n=0;for(;n<t.length;)r.push(Rd),Cd(r,t[n]),r.push(Rd,Vo(e[++n]));return _S(r),new dt(r)}ie.str=lv;function Cd(e,t){t instanceof dt?e.push(...t._items):t instanceof kr?e.push(t):e.push(xS(t))}ie.addCodeArg=Cd;function _S(e){let t=1;for(;t<e.length-1;){if(e[t]===Rd){let r=$S(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function $S(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof kr||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 kr))return`"${e}${t.slice(1)}`}function bS(e,t){return t.emptyStr()?e:e.emptyStr()?t:lv`${e}${t}`}ie.strConcat=bS;function xS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Vo(Array.isArray(e)?e.join(","):e)}function kS(e){return new dt(Vo(e))}ie.stringify=kS;function Vo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=Vo;function wS(e){return typeof e=="string"&&ie.IDENTIFIER.test(e)?new dt(`.${e}`):uv`[${e}]`}ie.getProperty=wS;function SS(e){if(typeof e=="string"&&ie.IDENTIFIER.test(e))return new dt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ie.getEsmExportName=SS;function zS(e){return new dt(e.toString())}ie.regexpCode=zS});var Ud=j(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.ValueScope=Ge.ValueScopeName=Ge.Scope=Ge.varKinds=Ge.UsedValueState=void 0;var We=Jo(),Ad=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ka;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ka||(Ge.UsedValueState=Ka={}));Ge.varKinds={const:new We.Name("const"),let:new We.Name("let"),var:new We.Name("var")};var Ba=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof We.Name?t:this.name(t)}name(t){return new We.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}}};Ge.Scope=Ba;var Ha=class extends We.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,We._)`.${new We.Name(r)}[${n}]`}};Ge.ValueScopeName=Ha;var IS=(0,We._)`\n`,Zd=class extends Ba{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?IS:We.nil}}get(){return this._scope}name(t){return new Ha(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,We._)`${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=We.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,Ka.Started);let l=r(u);if(l){let d=this.opts.es5?Ge.varKinds.var:Ge.varKinds.const;i=(0,We._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,We._)`${i}${l}${this.opts._n}`;else throw new Ad(u);c.set(u,Ka.Completed)})}return i}};Ge.ValueScope=Zd});var W=j(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 re=Jo(),yt=Ud(),nr=Jo();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return nr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return nr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return nr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return nr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return nr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return nr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return nr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return nr.Name}});var Ya=Ud();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Ya.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Ya.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Ya.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Ya.varKinds}});X.operators={GT:new re._Code(">"),GTE:new re._Code(">="),LT:new re._Code("<"),LTE:new re._Code("<="),EQ:new re._Code("==="),NEQ:new re._Code("!=="),NOT:new re._Code("!"),OR:new re._Code("||"),AND:new re._Code("&&"),ADD:new re._Code("+")};var Ft=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Md=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?yt.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=mn(this.rhs,t,r)),this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}},Wa=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 re.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=mn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof re.Name?{}:{...this.lhs.names};return Xa(t,this.rhs)}},Fd=class extends Wa{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Ld=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},qd=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Vd=class extends Ft{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Jd=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=mn(this.code,t,r),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}},Ko=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)||(PS(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>zr(t,r.names),{})}},Lt=class extends Ko{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Kd=class extends Ko{},fn=class extends Lt{};fn.kind="else";var wr=class e extends Lt{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 fn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(dv(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=mn(this.condition,t,r),this}get names(){let t=super.names;return Xa(t,this.condition),this.else&&zr(t,this.else.names),t}};wr.kind="if";var Sr=class extends Lt{};Sr.kind="for";var Bd=class extends Sr{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=mn(this.iteration,t,r),this}get names(){return zr(super.names,this.iteration.names)}},Hd=class extends Sr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?yt.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=Xa(super.names,this.from);return Xa(t,this.to)}},Ga=class extends Sr{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=mn(this.iterable,t,r),this}get names(){return zr(super.names,this.iterable.names)}},Bo=class extends Lt{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)}};Bo.kind="func";var Ho=class extends Ko{render(t){return"return "+super.render(t)}};Ho.kind="return";var Wd=class extends Lt{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&&zr(t,this.catch.names),this.finally&&zr(t,this.finally.names),t}},Wo=class extends Lt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Wo.kind="catch";var Go=class extends Lt{render(t){return"finally"+super.render(t)}};Go.kind="finally";var Gd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
- `:""},this._extScope=t,this._scope=new yt.Scope({parent:t}),this._nodes=[new Kd]}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 Md(t,i,n)),i}const(t,r,n){return this._def(yt.varKinds.const,t,r,n)}let(t,r,n){return this._def(yt.varKinds.let,t,r,n)}var(t,r,n){return this._def(yt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Wa(t,r,n))}add(t,r){return this._leafNode(new Fd(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==re.nil&&this._leafNode(new Jd(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,re.addCodeArg)(r,o));return r.push("}"),new re._Code(r)}if(t,r,n){if(this._blockNode(new wr(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 wr(t))}else(){return this._elseNode(new fn)}endIf(){return this._endBlockNode(wr,fn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Bd(t),r)}forRange(t,r,n,o,i=this.opts.es5?yt.varKinds.var:yt.varKinds.let){let a=this._scope.toName(t);return this._for(new Hd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=yt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof re.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,re._)`${a}.length`,s=>{this.var(i,(0,re._)`${a}[${s}]`),n(i)})}return this._for(new Ga("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?yt.varKinds.var:yt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,re._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new Ga("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(Sr)}label(t){return this._leafNode(new Ld(t))}break(t){return this._leafNode(new qd(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 Wd;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new Wo(i),r(i)}return n&&(this._currNode=o.finally=new Go,this.code(n)),this._endBlockNode(Wo,Go)}throw(t){return this._leafNode(new Vd(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=re.nil,n,o){return this._blockNode(new Bo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Bo)}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 wr))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=Gd;function zr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Xa(e,t){return t instanceof re._CodeOrName?zr(e,t.names):e}function mn(e,t,r){if(e instanceof re.Name)return n(e);if(!o(e))return e;return new re._Code(e._items.reduce((i,a)=>(a instanceof re.Name&&(a=n(a)),a instanceof re._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof re._Code&&i._items.some(a=>a instanceof re.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function PS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function dv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,re._)`!${Xd(e)}`}X.not=dv;var jS=pv(X.operators.AND);function ES(...e){return e.reduce(jS)}X.and=ES;var TS=pv(X.operators.OR);function OS(...e){return e.reduce(TS)}X.or=OS;function pv(e){return(t,r)=>t===re.nil?r:r===re.nil?t:(0,re._)`${Xd(t)} ${e} ${Xd(r)}`}function Xd(e){return e instanceof re.Name?e:(0,re._)`(${e})`}});var ne=j(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 me=W(),NS=Jo();function DS(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=DS;function RS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(hv(e,t),!gv(t,e.self.RULES.all))}Q.alwaysValidSchema=RS;function hv(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]||_v(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=hv;function gv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=gv;function CS(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=CS;function AS({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,me._)`${r}`}return(0,me._)`${e}${t}${(0,me.getProperty)(n)}`}Q.schemaRefOrVal=AS;function ZS(e){return vv(decodeURIComponent(e))}Q.unescapeFragment=ZS;function US(e){return encodeURIComponent(Qd(e))}Q.escapeFragment=US;function Qd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Qd;function vv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=vv;function MS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=MS;function fv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof me.Name?(i instanceof me.Name?e(o,i,a):t(o,i,a),a):i instanceof me.Name?(t(o,a,i),i):r(i,a);return s===me.Name&&!(c instanceof me.Name)?n(o,c):c}}Q.mergeEvaluated={props:fv({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,me._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,me._)`${r} || {}`).code((0,me._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,me._)`${r} || {}`),ep(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:yv}),items:fv({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,me._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,me._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function yv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,me._)`{}`);return t!==void 0&&ep(e,r,t),r}Q.evaluatedPropsToName=yv;function ep(e,t,r){Object.keys(r).forEach(n=>e.assign((0,me._)`${t}${(0,me.getProperty)(n)}`,!0))}Q.setEvaluated=ep;var mv={};function FS(e,t){return e.scopeValue("func",{ref:t,code:mv[t.code]||(mv[t.code]=new NS._Code(t.code))})}Q.useFunc=FS;var Yd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Yd||(Q.Type=Yd={}));function LS(e,t,r){if(e instanceof me.Name){let n=t===Yd.Num;return r?n?(0,me._)`"[" + ${e} + "]"`:(0,me._)`"['" + ${e} + "']"`:n?(0,me._)`"/" + ${e}`:(0,me._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,me.getProperty)(e).toString():"/"+Qd(e)}Q.getErrorPath=LS;function _v(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=_v});var qt=j(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});var Ae=W(),qS={data:new Ae.Name("data"),valCxt:new Ae.Name("valCxt"),instancePath:new Ae.Name("instancePath"),parentData:new Ae.Name("parentData"),parentDataProperty:new Ae.Name("parentDataProperty"),rootData:new Ae.Name("rootData"),dynamicAnchors:new Ae.Name("dynamicAnchors"),vErrors:new Ae.Name("vErrors"),errors:new Ae.Name("errors"),this:new Ae.Name("this"),self:new Ae.Name("self"),scope:new Ae.Name("scope"),json:new Ae.Name("json"),jsonPos:new Ae.Name("jsonPos"),jsonLen:new Ae.Name("jsonLen"),jsonPart:new Ae.Name("jsonPart")};tp.default=qS});var Xo=j(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.extendErrors=Ze.resetErrorsCount=Ze.reportExtraError=Ze.reportError=Ze.keyword$DataError=Ze.keywordError=void 0;var oe=W(),Qa=ne(),Ke=qt();Ze.keywordError={message:({keyword:e})=>(0,oe.str)`must pass "${e}" keyword validation`};Ze.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,oe.str)`"${e}" keyword must be ${t} ($data)`:(0,oe.str)`"${e}" keyword is invalid ($data)`};function VS(e,t=Ze.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=xv(e,t,r);n??(a||s)?$v(i,c):bv(o,(0,oe._)`[${c}]`)}Ze.reportError=VS;function JS(e,t=Ze.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=xv(e,t,r);$v(o,s),i||a||bv(n,Ke.default.vErrors)}Ze.reportExtraError=JS;function KS(e,t){e.assign(Ke.default.errors,t),e.if((0,oe._)`${Ke.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,oe._)`${Ke.default.vErrors}.length`,t),()=>e.assign(Ke.default.vErrors,null)))}Ze.resetErrorsCount=KS;function BS({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,Ke.default.errors,s=>{e.const(a,(0,oe._)`${Ke.default.vErrors}[${s}]`),e.if((0,oe._)`${a}.instancePath === undefined`,()=>e.assign((0,oe._)`${a}.instancePath`,(0,oe.strConcat)(Ke.default.instancePath,i.errorPath))),e.assign((0,oe._)`${a}.schemaPath`,(0,oe.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,oe._)`${a}.schema`,r),e.assign((0,oe._)`${a}.data`,n))})}Ze.extendErrors=BS;function $v(e,t){let r=e.const("err",t);e.if((0,oe._)`${Ke.default.vErrors} === null`,()=>e.assign(Ke.default.vErrors,(0,oe._)`[${r}]`),(0,oe._)`${Ke.default.vErrors}.push(${r})`),e.code((0,oe._)`${Ke.default.errors}++`)}function bv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,oe._)`new ${e.ValidationError}(${t})`):(r.assign((0,oe._)`${n}.errors`,t),r.return(!1))}var Ir={keyword:new oe.Name("keyword"),schemaPath:new oe.Name("schemaPath"),params:new oe.Name("params"),propertyName:new oe.Name("propertyName"),message:new oe.Name("message"),schema:new oe.Name("schema"),parentSchema:new oe.Name("parentSchema")};function xv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,oe._)`{}`:HS(e,t,r)}function HS(e,t,r={}){let{gen:n,it:o}=e,i=[WS(o,r),GS(e,r)];return XS(e,t,i),n.object(...i)}function WS({errorPath:e},{instancePath:t}){let r=t?(0,oe.str)`${e}${(0,Qa.getErrorPath)(t,Qa.Type.Str)}`:e;return[Ke.default.instancePath,(0,oe.strConcat)(Ke.default.instancePath,r)]}function GS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,oe.str)`${t}/${e}`;return r&&(o=(0,oe.str)`${o}${(0,Qa.getErrorPath)(r,Qa.Type.Str)}`),[Ir.schemaPath,o]}function XS(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([Ir.keyword,o],[Ir.params,typeof t=="function"?t(e):t||(0,oe._)`{}`]),c.messages&&n.push([Ir.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Ir.schema,a],[Ir.parentSchema,(0,oe._)`${l}${d}`],[Ke.default.data,i]),u&&n.push([Ir.propertyName,u])}});var wv=j(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.boolOrEmptySchema=hn.topBoolOrEmptySchema=void 0;var YS=Xo(),QS=W(),e0=qt(),t0={message:"boolean schema is false"};function r0(e){let{gen:t,schema:r,validateName:n}=e;r===!1?kv(e,!1):typeof r=="object"&&r.$async===!0?t.return(e0.default.data):(t.assign((0,QS._)`${n}.errors`,null),t.return(!0))}hn.topBoolOrEmptySchema=r0;function n0(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),kv(e)):r.var(t,!0)}hn.boolOrEmptySchema=n0;function kv(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,YS.reportError)(o,t0,void 0,t)}});var rp=j(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.getRules=gn.isJSONType=void 0;var o0=["string","number","integer","boolean","null","object","array"],i0=new Set(o0);function a0(e){return typeof e=="string"&&i0.has(e)}gn.isJSONType=a0;function s0(){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:{}}}gn.getRules=s0});var np=j(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.shouldUseRule=or.shouldUseGroup=or.schemaHasRulesForType=void 0;function c0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Sv(e,n)}or.schemaHasRulesForType=c0;function Sv(e,t){return t.rules.some(r=>zv(e,r))}or.shouldUseGroup=Sv;function zv(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))}or.shouldUseRule=zv});var Yo=j(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.reportTypeError=Ue.checkDataTypes=Ue.checkDataType=Ue.coerceAndCheckDataType=Ue.getJSONTypes=Ue.getSchemaTypes=Ue.DataType=void 0;var u0=rp(),l0=np(),d0=Xo(),H=W(),Iv=ne(),vn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(vn||(Ue.DataType=vn={}));function p0(e){let t=Pv(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}Ue.getSchemaTypes=p0;function Pv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(u0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ue.getJSONTypes=Pv;function f0(e,t){let{gen:r,data:n,opts:o}=e,i=m0(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,l0.schemaHasRulesForType)(e,t[0]));if(a){let s=ip(t,n,o.strictNumbers,vn.Wrong);r.if(s,()=>{i.length?h0(e,t,i):ap(e)})}return a}Ue.coerceAndCheckDataType=f0;var jv=new Set(["string","number","integer","boolean","null"]);function m0(e,t){return t?e.filter(r=>jv.has(r)||t==="array"&&r==="array"):[]}function h0(e,t,r){let{gen:n,data:o,opts:i}=e,a=n.let("dataType",(0,H._)`typeof ${o}`),s=n.let("coerced",(0,H._)`undefined`);i.coerceTypes==="array"&&n.if((0,H._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,H._)`${o}[0]`).assign(a,(0,H._)`typeof ${o}`).if(ip(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,H._)`${s} !== undefined`);for(let u of r)(jv.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ap(e),n.endIf(),n.if((0,H._)`${s} !== undefined`,()=>{n.assign(o,s),g0(e,s)});function c(u){switch(u){case"string":n.elseIf((0,H._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,H._)`"" + ${o}`).elseIf((0,H._)`${o} === null`).assign(s,(0,H._)`""`);return;case"number":n.elseIf((0,H._)`${a} == "boolean" || ${o} === null
4
- || (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,H._)`+${o}`);return;case"integer":n.elseIf((0,H._)`${a} === "boolean" || ${o} === null
5
- || (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,H._)`+${o}`);return;case"boolean":n.elseIf((0,H._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,H._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,H._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,H._)`${a} === "string" || ${a} === "number"
6
- || ${a} === "boolean" || ${o} === null`).assign(s,(0,H._)`[${o}]`)}}}function g0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,H._)`${t} !== undefined`,()=>e.assign((0,H._)`${t}[${r}]`,n))}function op(e,t,r,n=vn.Correct){let o=n===vn.Correct?H.operators.EQ:H.operators.NEQ,i;switch(e){case"null":return(0,H._)`${t} ${o} null`;case"array":i=(0,H._)`Array.isArray(${t})`;break;case"object":i=(0,H._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a((0,H._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return(0,H._)`typeof ${t} ${o} ${e}`}return n===vn.Correct?i:(0,H.not)(i);function a(s=H.nil){return(0,H.and)((0,H._)`typeof ${t} == "number"`,s,r?(0,H._)`isFinite(${t})`:H.nil)}}Ue.checkDataType=op;function ip(e,t,r,n){if(e.length===1)return op(e[0],t,r,n);let o,i=(0,Iv.toHash)(e);if(i.array&&i.object){let a=(0,H._)`typeof ${t} != "object"`;o=i.null?a:(0,H._)`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else o=H.nil;i.number&&delete i.integer;for(let a in i)o=(0,H.and)(o,op(a,t,r,n));return o}Ue.checkDataTypes=ip;var v0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,H._)`{type: ${e}}`:(0,H._)`{type: ${t}}`};function ap(e){let t=y0(e);(0,d0.reportError)(t,v0)}Ue.reportTypeError=ap;function y0(e){let{gen:t,data:r,schema:n}=e,o=(0,Iv.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Tv=j(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.assignDefaults=void 0;var yn=W(),_0=ne();function $0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Ev(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Ev(e,i,o.default))}es.assignDefaults=$0;function Ev(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,yn._)`${i}${(0,yn.getProperty)(t)}`;if(o){(0,_0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,yn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,yn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,yn._)`${s} = ${(0,yn.stringify)(r)}`)}});var pt=j(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.validateUnion=le.validateArray=le.usePattern=le.callValidateCode=le.schemaProperties=le.allSchemaProperties=le.noPropertyInData=le.propertyInData=le.isOwnProperty=le.hasPropFunc=le.reportMissingProp=le.checkMissingProp=le.checkReportMissingProp=void 0;var ye=W(),sp=ne(),ir=qt(),b0=ne();function x0(e,t){let{gen:r,data:n,it:o}=e;r.if(up(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ye._)`${t}`},!0),e.error()})}le.checkReportMissingProp=x0;function k0({gen:e,data:t,it:{opts:r}},n,o){return(0,ye.or)(...n.map(i=>(0,ye.and)(up(e,t,i,r.ownProperties),(0,ye._)`${o} = ${i}`)))}le.checkMissingProp=k0;function w0(e,t){e.setParams({missingProperty:t},!0),e.error()}le.reportMissingProp=w0;function Ov(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ye._)`Object.prototype.hasOwnProperty`})}le.hasPropFunc=Ov;function cp(e,t,r){return(0,ye._)`${Ov(e)}.call(${t}, ${r})`}le.isOwnProperty=cp;function S0(e,t,r,n){let o=(0,ye._)`${t}${(0,ye.getProperty)(r)} !== undefined`;return n?(0,ye._)`${o} && ${cp(e,t,r)}`:o}le.propertyInData=S0;function up(e,t,r,n){let o=(0,ye._)`${t}${(0,ye.getProperty)(r)} === undefined`;return n?(0,ye.or)(o,(0,ye.not)(cp(e,t,r))):o}le.noPropertyInData=up;function Nv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}le.allSchemaProperties=Nv;function z0(e,t){return Nv(t).filter(r=>!(0,sp.alwaysValidSchema)(e,t[r]))}le.schemaProperties=z0;function I0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ye._)`${e}, ${t}, ${n}${o}`:t,d=[[ir.default.instancePath,(0,ye.strConcat)(ir.default.instancePath,i)],[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 f=(0,ye._)`${l}, ${r.object(...d)}`;return c!==ye.nil?(0,ye._)`${s}.call(${c}, ${f})`:(0,ye._)`${s}(${f})`}le.callValidateCode=I0;var P0=(0,ye._)`new RegExp`;function j0({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,ye._)`${o.code==="new RegExp"?P0:(0,b0.useFunc)(e,o)}(${r}, ${n})`})}le.usePattern=j0;function E0(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,ye._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:sp.Type.Num},i),t.if((0,ye.not)(i),s)})}}le.validateArray=E0;function T0(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,sp.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,ye._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ye.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}le.validateUnion=T0});var Cv=j(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.validateKeywordUsage=zt.validSchemaType=zt.funcKeywordCode=zt.macroKeywordCode=void 0;var Be=W(),Pr=qt(),O0=pt(),N0=Xo();function D0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=Rv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Be.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}zt.macroKeywordCode=D0;function R0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;A0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=Rv(n,o,u),d=n.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1)h(),t.modifying&&Dv(e),g(()=>e.error());else{let y=t.async?p():m();t.modifying&&Dv(e),g(()=>C0(e,y))}}function p(){let y=n.let("ruleErrs",null);return n.try(()=>h((0,Be._)`await `),_=>n.assign(d,!1).if((0,Be._)`${_} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,Be._)`${_}.errors`),()=>n.throw(_))),y}function m(){let y=(0,Be._)`${l}.errors`;return n.assign(y,null),h(Be.nil),y}function h(y=t.async?(0,Be._)`await `:Be.nil){let _=c.opts.passContext?Pr.default.this:Pr.default.self,b=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Be._)`${y}${(0,O0.callValidateCode)(e,l,_,b)}`,t.modifying)}function g(y){var _;n.if((0,Be.not)((_=t.valid)!==null&&_!==void 0?_:d),y)}}zt.funcKeywordCode=R0;function Dv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Be._)`${n.parentData}[${n.parentDataProperty}]`))}function C0(e,t){let{gen:r}=e;r.if((0,Be._)`Array.isArray(${t})`,()=>{r.assign(Pr.default.vErrors,(0,Be._)`${Pr.default.vErrors} === null ? ${t} : ${Pr.default.vErrors}.concat(${t})`).assign(Pr.default.errors,(0,Be._)`${Pr.default.vErrors}.length`),(0,N0.extendErrors)(e)},()=>e.error())}function A0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Rv(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,Be.stringify)(r)})}function Z0(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")}zt.validSchemaType=Z0;function U0({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)}}zt.validateKeywordUsage=U0});var Zv=j(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.extendSubschemaMode=ar.extendSubschemaData=ar.getSubschema=void 0;var It=W(),Av=ne();function M0(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,It._)`${e.schemaPath}${(0,It.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,It._)`${e.schemaPath}${(0,It.getProperty)(t)}${(0,It.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Av.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')}ar.getSubschema=M0;function F0(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,f=s.let("data",(0,It._)`${t.data}${(0,It.getProperty)(r)}`,!0);c(f),e.errorPath=(0,It.str)`${u}${(0,Av.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,It._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof It.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]}}ar.extendSubschemaData=F0;function L0(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}ar.extendSubschemaMode=L0});var lp=j((VZ,Uv)=>{"use strict";Uv.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 Fv=j((JZ,Mv)=>{"use strict";var sr=Mv.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(){};ts(t,n,o,e,"",e)};sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};sr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};sr.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 ts(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 sr.arrayKeywords)for(var f=0;f<d.length;f++)ts(e,t,r,d[f],o+"/"+l+"/"+f,i,o,l,n,f)}else if(l in sr.propsKeywords){if(d&&typeof d=="object")for(var p in d)ts(e,t,r,d[p],o+"/"+l+"/"+q0(p),i,o,l,n,p)}else(l in sr.keywords||e.allKeys&&!(l in sr.skipKeywords))&&ts(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function q0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Qo=j(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getSchemaRefs=Xe.resolveUrl=Xe.normalizeId=Xe._getFullPath=Xe.getFullPath=Xe.inlineRef=void 0;var V0=ne(),J0=lp(),K0=Fv(),B0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function H0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!dp(e):t?Lv(e)<=t:!1}Xe.inlineRef=H0;var W0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function dp(e){for(let t in e){if(W0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(dp)||typeof r=="object"&&dp(r))return!0}return!1}function Lv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!B0.has(r)&&(typeof e[r]=="object"&&(0,V0.eachItem)(e[r],n=>t+=Lv(n)),t===1/0))return 1/0}return t}function qv(e,t="",r){r!==!1&&(t=_n(t));let n=e.parse(t);return Vv(e,n)}Xe.getFullPath=qv;function Vv(e,t){return e.serialize(t).split("#")[0]+"#"}Xe._getFullPath=Vv;var G0=/#\/?$/;function _n(e){return e?e.replace(G0,""):""}Xe.normalizeId=_n;function X0(e,t,r){return r=_n(r),e.resolve(t,r)}Xe.resolveUrl=X0;var Y0=/^[a-z_][-a-z0-9._]*$/i;function Q0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=_n(e[r]||t),i={"":o},a=qv(n,o,!1),s={},c=new Set;return K0(e,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=a+f,g=i[m];typeof d[r]=="string"&&(g=y.call(this,d[r])),_.call(this,d.$anchor),_.call(this,d.$dynamicAnchor),i[f]=g;function y(b){let S=this.opts.uriResolver.resolve;if(b=_n(g?S(g,b):b),c.has(b))throw l(b);c.add(b);let z=this.refs[b];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?u(d,z.schema,b):b!==_n(h)&&(b[0]==="#"?(u(d,s[b],b),s[b]=d):this.refs[b]=h),b}function _(b){if(typeof b=="string"){if(!Y0.test(b))throw new Error(`invalid anchor "${b}"`);y.call(this,`#${b}`)}}}),s;function u(d,f,p){if(f!==void 0&&!J0(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Xe.getSchemaRefs=Q0});var ri=j(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.getData=cr.KeywordCxt=cr.validateFunctionCode=void 0;var Wv=wv(),Jv=Yo(),fp=np(),rs=Yo(),ez=Tv(),ti=Cv(),pp=Zv(),D=W(),q=qt(),tz=Qo(),Vt=ne(),ei=Xo();function rz(e){if(Yv(e)&&(Qv(e),Xv(e))){iz(e);return}Gv(e,()=>(0,Wv.topBoolOrEmptySchema)(e))}cr.validateFunctionCode=rz;function Gv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,D._)`${q.default.data}, ${q.default.valCxt}`,n.$async,()=>{e.code((0,D._)`"use strict"; ${Kv(r,o)}`),oz(e,o),e.code(i)}):e.func(t,(0,D._)`${q.default.data}, ${nz(o)}`,n.$async,()=>e.code(Kv(r,o)).code(i))}function nz(e){return(0,D._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${e.dynamicRef?(0,D._)`, ${q.default.dynamicAnchors}={}`:D.nil}}={}`}function oz(e,t){e.if(q.default.valCxt,()=>{e.var(q.default.instancePath,(0,D._)`${q.default.valCxt}.${q.default.instancePath}`),e.var(q.default.parentData,(0,D._)`${q.default.valCxt}.${q.default.parentData}`),e.var(q.default.parentDataProperty,(0,D._)`${q.default.valCxt}.${q.default.parentDataProperty}`),e.var(q.default.rootData,(0,D._)`${q.default.valCxt}.${q.default.rootData}`),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{e.var(q.default.instancePath,(0,D._)`""`),e.var(q.default.parentData,(0,D._)`undefined`),e.var(q.default.parentDataProperty,(0,D._)`undefined`),e.var(q.default.rootData,q.default.data),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`{}`)})}function iz(e){let{schema:t,opts:r,gen:n}=e;Gv(e,()=>{r.$comment&&t.$comment&&ty(e),lz(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&az(e),ey(e),fz(e)})}function az(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,D._)`${r}.evaluated`),t.if((0,D._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,D._)`${e.evaluated}.props`,(0,D._)`undefined`)),t.if((0,D._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,D._)`${e.evaluated}.items`,(0,D._)`undefined`))}function Kv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function sz(e,t){if(Yv(e)&&(Qv(e),Xv(e))){cz(e,t);return}(0,Wv.boolOrEmptySchema)(e,t)}function Xv({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 Yv(e){return typeof e.schema!="boolean"}function cz(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&ty(e),dz(e),pz(e);let i=n.const("_errs",q.default.errors);ey(e,i),n.var(t,(0,D._)`${i} === ${q.default.errors}`)}function Qv(e){(0,Vt.checkUnknownRules)(e),uz(e)}function ey(e,t){if(e.opts.jtd)return Bv(e,[],!1,t);let r=(0,Jv.getSchemaTypes)(e.schema),n=(0,Jv.coerceAndCheckDataType)(e,r);Bv(e,r,!n,t)}function uz(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 lz(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 dz(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,tz.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function pz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function ty({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,D._)`${q.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,D.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,D._)`${q.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function fz(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,D._)`${q.default.errors} === 0`,()=>t.return(q.default.data),()=>t.throw((0,D._)`new ${o}(${q.default.vErrors})`)):(t.assign((0,D._)`${n}.errors`,q.default.vErrors),i.unevaluated&&mz(e),t.return((0,D._)`${q.default.errors} === 0`))}function mz({gen:e,evaluated:t,props:r,items:n}){r instanceof D.Name&&e.assign((0,D._)`${t}.props`,r),n instanceof D.Name&&e.assign((0,D._)`${t}.items`,n)}function Bv(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(()=>ny(e,"$ref",l.all.$ref.definition));return}c.jtd||hz(e,t),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,fp.shouldUseGroup)(i,f)&&(f.type?(o.if((0,rs.checkDataType)(f.type,a,c.strictNumbers)),Hv(e,f),t.length===1&&t[0]===f.type&&r&&(o.else(),(0,rs.reportTypeError)(e)),o.endIf()):Hv(e,f),s||o.if((0,D._)`${q.default.errors} === ${n||0}`))}}function Hv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,ez.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,fp.shouldUseRule)(n,i)&&ny(e,i.keyword,i.definition,t.type)})}function hz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(gz(e,t),e.opts.allowUnionTypes||vz(e,t),yz(e,e.dataTypes))}function gz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{ry(e.dataTypes,r)||mp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),$z(e,t)}}function vz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&mp(e,"use allowUnionTypes to allow union type keyword")}function yz(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,fp.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>_z(t,a))&&mp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function _z(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function ry(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function $z(e,t){let r=[];for(let n of e.dataTypes)ry(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function mp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Vt.checkStrictMode)(e,t,e.opts.strictTypes)}var ns=class{constructor(t,r,n){if((0,ti.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",oy(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,ti.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",q.default.errors))}result(t,r,n){this.failResult((0,D.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,D.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,D._)`${r} !== undefined && (${(0,D.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?ei.reportExtraError:ei.reportError)(this,this.def.error,r)}$dataError(){(0,ei.reportError)(this,this.def.$dataError||ei.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ei.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=D.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=D.nil,r=D.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,D.or)((0,D._)`${o} === undefined`,r)),t!==D.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==D.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,D.or)(a(),s());function a(){if(n.length){if(!(r instanceof D.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,D._)`${(0,rs.checkDataTypes)(c,r,i.opts.strictNumbers,rs.DataType.Wrong)}`}return D.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,D._)`!${c}(${r})`}return D.nil}}subschema(t,r){let n=(0,pp.getSubschema)(this.it,t);(0,pp.extendSubschemaData)(n,this.it,t),(0,pp.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return sz(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,D.Name)),!0}};cr.KeywordCxt=ns;function ny(e,t,r,n){let o=new ns(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,ti.funcKeywordCode)(o,r):"macro"in r?(0,ti.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,ti.funcKeywordCode)(o,r)}var bz=/^\/(?:[^~]|~0|~1)*$/,xz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function oy(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!bz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=q.default.rootData}else{let u=xz.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,D._)`${i}${(0,D.getProperty)((0,Vt.unescapeJsonPointer)(u))}`,a=(0,D._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}cr.getData=oy});var os=j(gp=>{"use strict";Object.defineProperty(gp,"__esModule",{value:!0});var hp=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};gp.default=hp});var ni=j(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});var vp=Qo(),yp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,vp.resolveUrl)(t,r,n),this.missingSchema=(0,vp.normalizeId)((0,vp.getFullPath)(t,this.missingRef))}};_p.default=yp});var as=j(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.resolveSchema=ft.getCompilingSchema=ft.resolveRef=ft.compileSchema=ft.SchemaEnv=void 0;var _t=W(),kz=os(),jr=qt(),$t=Qo(),iy=ne(),wz=ri(),$n=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={}}};ft.SchemaEnv=$n;function bp(e){let t=ay.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 _t.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:kz.default,code:(0,_t._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:jr.default.data,parentData:jr.default.parentData,parentDataProperty:jr.default.parentDataProperty,dataNames:[jr.default.data],dataPathArr:[_t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,_t.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:_t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,_t._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,wz.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(jr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${jr.default.self}`,`${jr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:m,items:h}=u;p.evaluated={props:m instanceof _t.Name?void 0:m,items:h instanceof _t.Name?void 0:h,dynamicProps:m instanceof _t.Name,dynamicItems:h instanceof _t.Name},p.source&&(p.source.evaluated=(0,_t.stringify)(p.evaluated))}return e.validate=p,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)}}ft.compileSchema=bp;function Sz(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=Pz.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 $n({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=zz.call(this,i)}ft.resolveRef=Sz;function zz(e){return(0,$t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:bp.call(this,e)}function ay(e){for(let t of this._compilations)if(Iz(t,e))return t}ft.getCompilingSchema=ay;function Iz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Pz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||is.call(this,e,t)}function is(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 $p.call(this,r,e);let i=(0,$t.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=is.call(this,e,a);return typeof s?.schema!="object"?void 0:$p.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||bp.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 $n({schema:s,schemaId:c,root:e,baseId:o})}return $p.call(this,r,a)}}ft.resolveSchema=is;var jz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function $p(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,iy.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!jz.has(s)&&u&&(t=(0,$t.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,iy.schemaHasRulesButRef)(r,this.RULES)){let s=(0,$t.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=is.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new $n({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var sy=j((XZ,Ez)=>{Ez.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 Pp=j((YZ,fy)=>{"use strict";var Tz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),kp=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),Oz=RegExp.prototype.test.bind(/^\d*$/u),Er=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),wp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),uy=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),Sp=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Nz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function Dz(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 Rz=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Cz=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Az=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Zz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),Uz=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),Mz=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function Fz(e){return Uz(e)||Mz(e)}function Lz(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Az(e[t])){if(e[t]==="%"&&t+2<e.length&&Er(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function cy(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 qz(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||!kp(c))return;i+=2;continue}if(!Rz(c))return;o[s]=parseInt(c,16).toString(16),i++}if(t===-1)return i!==8?void 0:cy(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 cy(a)}function xp(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&&Cz(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Vz(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),!Lz(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=qz(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(o?"%"+o:""),escapedHost:a+(o?"%25"+o:""),isIPV6:!0}}function Vz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Jz(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 Kz={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Bz=/[@/?#:]/g,Hz=/[@/?#]/g;function ly(e,t){let r=t?Hz:Bz;return r.lastIndex=0,e.replace(r,n=>Kz[n])}function dy(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(Er(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));t&&wp(a)?r+=a:r+="%"+i,n+=2;continue}}r+=e[n]}return r}var Me=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Me[t]="%"+e[t>>4]+e[t&15]}function zp(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?Me[192|e>>6]+Me[128|e&63]:e<65536?Me[224|e>>12]+Me[128|e>>6&63]+Me[128|e&63]:Me[240|e>>18]+Me[128|e>>12&63]+Me[128|e>>6&63]+Me[128|e&63]}function Wz(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(Er(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&wp(a)?t+=a:t+="%"+i,r+=2;continue}}if(uy(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=zp(o)?n:Me[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 Gz(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(Er(a)){r+="%"+a.toUpperCase(),o+=2;continue}}if(i==="/"&&(n=!1),uy(i)&&(i!==":"||!n))r+=i;else{let a=e.charCodeAt(o);if(a<128)r+=Me[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 Xz(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(Er(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));wp(a)?t+=a:t+="%"+i,r+=2;continue}}if(Sp(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=zp(o)?n:Me[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 Ip(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(Er(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let i=e.charCodeAt(n);if(i<128)r+=Me[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 py(e){return Ip(e,Nz)}function Yz(e){return Ip(e,Sp)}function Qz(e){return Ip(e,Sp)}function eI(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(Er(i)){t+="%"+i.toUpperCase(),r+=2;continue}}let o=e.charCodeAt(r);if(o<128)t+=zp(o)?n:Me[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 tI(e){let t=[];if(e.userinfo!==void 0&&(t.push(py(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!kp(r)){let n=xp(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=dy(r,!0),n=xp(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=ly(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!Oz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}fy.exports={BYTE_HEX:Me,percentEncodeNonAscii:$e,nonSimpleDomain:Zz,nonSimpleMailtoDomain:Fz,recomposeAuthority:tI,reescapeHostDelimiters:ly,normalizePercentEncoding:dy,normalizePathEncoding:Wz,serializePathEncoding:Gz,normalizeQueryFragmentEncoding:Xz,encodeUserinfo:py,encodeQuery:Yz,encodeFragment:Qz,escapePreservingEscapes:eI,removeDotSegments:Jz,isIPv4:kp,isUUID:Tz,normalizeIPv6:xp,stringArrayToHexStripped:Dz}});var ky=j((QZ,xy)=>{"use strict";var{isUUID:rI,BYTE_HEX:nI,percentEncodeNonAscii:jp,nonSimpleMailtoDomain:oI}=Pp(),iI=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,aI=["http","https","ws","wss","urn","urn:uuid","mailto"];function sI(e){return aI.indexOf(e)!==-1}function Tp(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 vy(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function yy(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 cI(e){return e.secure=Tp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function uI(e){if((e.port===(Tp(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 lI(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(iI);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=Op(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function dI(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=Op(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 pI(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!rI(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function fI(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var _y={scheme:"http",domainHost:!0,parse:vy,serialize:yy},mI={scheme:"https",domainHost:_y.domainHost,parse:vy,serialize:yy},ss={scheme:"ws",domainHost:!0,parse:cI,serialize:uI},hI={scheme:"wss",domainHost:ss.domainHost,parse:ss.parse,serialize:ss.serialize},gI={scheme:"urn",parse:lI,serialize:dI,skipNormalize:!0},vI={scheme:"urn:uuid",parse:pI,serialize:fI,skipNormalize:!0},yI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=",_I="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@",$y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function us(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 $I=us(yI),my=us(_I),bI=us($y),xI=us($y,!0),kI=/^[\da-f]{2}$/iu,wI=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,Ep="URI mailto has an invalid recipient domain.",hy=/[\uD800-\uDFFF]/u;function ur(e){if(typeof e!="string"||e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function gy(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 oi(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&&kI.test(e.slice(o+1,o+3))?(n+="%"+e.slice(o+1,o+3).toUpperCase(),o+=2):n+=nI[i];continue}if(i<55296||i>57343){n+=t.allowNonAscii?e[o]:jp(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]:jp(65536+(i-55296<<10)+(a-56320)),o++;continue}}n+=t.allowNonAscii?"\uFFFD":jp(65533)}return n}function by(e,t,r){let n=String(e).toLowerCase();if(wI.test(n)||n!==""&&!oI(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(Ep);return t&&t.unicodeSupport?n:o.hostname}catch{return r&&(r.error=r.error||Ep),n}}function SI(e,t){let r=t&&t.unicodeSupport?xI:bI;return e.length>1&&e[0]==="["&&e[e.length-1]==="]"?"["+oi(e.slice(1,-1),r)+"]":oi(e,r)}function zI(e,t){let r=e,n=r.path,o=r.query;n&&hy.test(n)&&(n=gy(n)),o&&hy.test(o)&&(o=gy(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),f=l===-1?"":u.slice(l+1);if(d==="to"){let p=f.split(",");for(let m=0;m<p.length;m++)i.push(p[m]);continue}if(d==="subject"){r.subject=ur(f);continue}if(d==="body"){r.body=ur(f);continue}a===null&&(a=Object.create(null)),a[ur(d)]=ur(f)}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||Ep,i[a]=ur(s);continue}let u=ur(s.slice(0,c)),l=by(ur(s.slice(c+1)),t,r);i[a]=u+"@"+l}return i.length&&(r.to=i),r}function II(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):"",f=oi(l,$I),p=ur(d),m=by(p,t);n[s]=f+"@"+SI(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+=oi(s,my)+"="+oi(String(o[s]),my);return a!==0?r.query=i:r.headers=void 0,r}var PI={scheme:"mailto",parse:zI,serialize:II,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0},cs={http:_y,https:mI,ws:ss,wss:hI,urn:gI,"urn:uuid":vI,mailto:PI};Object.setPrototypeOf(cs,null);function Op(e){return e&&(cs[e]||cs[e.toLowerCase()])||void 0}xy.exports={wsIsSecure:Tp,SCHEMES:cs,isValidSchemeName:sI,getSchemeHandler:Op}});var Ay=j((eU,ps)=>{"use strict";var{normalizeIPv6:Py,removeDotSegments:ai,recomposeAuthority:jI,normalizePercentEncoding:jy,normalizePathEncoding:EI,serializePathEncoding:wy,normalizeQueryFragmentEncoding:Sy,encodeQuery:TI,encodeFragment:OI,reescapeHostDelimiters:NI,isIPv4:Ey,nonSimpleDomain:DI}=Pp(),{SCHEMES:Ty,getSchemeHandler:Np}=ky(),Oy=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Ny="URI scheme is malformed.";function zy(e){let t=unescape(String(e));if(!Oy.test(t))throw new TypeError(Ny);return t}function RI(e,t){return typeof e=="string"?e=qI(e,t):typeof e=="object"&&(e=ds(Tr(e,t),t)),e}function CI(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}=ls(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:h}=ls(t,n);if(i||d||a||f||s||p||c||m||u||h)throw new Error(o.error||l.error||"URI is malformed.");let g=Dy(o,l,n,!0),y=Np(r&&r.scheme||g.scheme),_=g.host,b=_!==void 0&&_!==""&&(Ey(_)||Py(_).isIPV6);Ry(g,r||{},y,b);let S=_&&_.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(_);if(g.error&&!S)throw new Error(g.error);return n.skipEscape=!0,Tr(g,n)}function Dy(e,t,r,n){let o={};return n||(e=ds(Tr(e,r),r),t=ds(Tr(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=ai(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=ai(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=ai(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=ai(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 AI(e,t,r){let n=Iy(e,r),o=Iy(t,r);return n!==void 0&&o!==void 0&&n===o}function Tr(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=zy(r.scheme));let i=Np(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=jy(r.path):r.path=wy(r.path,s)),n.reference!=="suffix"&&r.scheme&&(r.scheme=zy(r.scheme),o.push(r.scheme,":"));let c=jI(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=ai(u)),s&&(u=wy(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",TI(r.query)),r.fragment!==void 0&&o.push("#",OI(r.fragment)),o.join("")}var ZI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,UI=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,MI=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function FI(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 ii(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 Dp(e){return e[0]==="["&&e[e.length-1]==="]"}function LI(e){let t=e[4];return ii(e[3])||t!==void 0&&!Dp(t)&&ii(t)||ii(e[6])||ii(e[7])||ii(e[8])}function Ry(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&&!Dp(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&!o&&DI(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 ls(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(UI);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let f=e.match(MI);if(f!==null){let m=f[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 p=e.match(ZI);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||"",n.query=p[7],n.fragment=p[8],n.scheme!==void 0){let g=unescape(n.scheme);Oy.test(g)?n.scheme=g.toLowerCase():(n.error=n.error||Ny,u=!0)}i=LI(p),i&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=p[5]);let m=FI(n,p);if(m!==void 0&&(n.error=n.error||m,o=!0),n.host)if(Ey(n.host)===!1){let y=Dp(n.host),_=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,b=Py(n.host);l=b.isIPV6||b.isIPVFuture===!0,c=_&&(!y||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=Np(r.scheme||n.scheme);if(c||(s=Ry(n,r,h,l)),!h||h&&!h.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let g=l?n.host:jy(n.host,!0);n.host=NI(g,l)}n.path&&(n.path=EI(n.path)),n.query&&(n.query=Sy(n.query)),n.fragment&&(n.fragment=Sy(n.fragment))}h&&h.parse&&(h.parse(n,r),h===Ty.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 ds(e,t){return ls(e,t).parsed}function qI(e,t){return Cy(e,t).normalized}function Cy(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}=ls(e,t);return{normalized:n||o||i||a||s?e:Tr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}}function Iy(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Tr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=Cy(r,t);return o||i||a||s||c?void 0:n}var Rp={SCHEMES:Ty,normalize:RI,resolve:CI,resolveComponent:Dy,equal:AI,serialize:Tr,parse:ds};ps.exports=Rp;ps.exports.default=Rp;ps.exports.fastUri=Rp});var Uy=j(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var Zy=Ay();Zy.code='require("ajv/dist/runtime/uri").default';Cp.default=Zy});var By=j(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.CodeGen=Te.Name=Te.nil=Te.stringify=Te.str=Te._=Te.KeywordCxt=void 0;var VI=ri();Object.defineProperty(Te,"KeywordCxt",{enumerable:!0,get:function(){return VI.KeywordCxt}});var bn=W();Object.defineProperty(Te,"_",{enumerable:!0,get:function(){return bn._}});Object.defineProperty(Te,"str",{enumerable:!0,get:function(){return bn.str}});Object.defineProperty(Te,"stringify",{enumerable:!0,get:function(){return bn.stringify}});Object.defineProperty(Te,"nil",{enumerable:!0,get:function(){return bn.nil}});Object.defineProperty(Te,"Name",{enumerable:!0,get:function(){return bn.Name}});Object.defineProperty(Te,"CodeGen",{enumerable:!0,get:function(){return bn.CodeGen}});var JI=os(),Vy=ni(),KI=rp(),si=as(),BI=W(),ci=Qo(),fs=Yo(),Zp=ne(),My=sy(),HI=Uy(),Jy=(e,t)=>new RegExp(e,t);Jy.code="new RegExp";var WI=["removeAdditional","useDefaults","coerceTypes"],GI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),XI={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."},YI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Fy=200;function QI(e){var t,r,n,o,i,a,s,c,u,l,d,f,p,m,h,g,y,_,b,S,z,te,ae,Ne,fr;let On=e.strict,Cs=(t=e.code)===null||t===void 0?void 0:t.optimize,Lf=Cs===!0||Cs===void 0?1:Cs||0,qf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Jy,E$=(o=e.uriResolver)!==null&&o!==void 0?o:HI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:On)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:On)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:On)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:On)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:On)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:Lf,regExp:qf}:{optimize:Lf,regExp:qf},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:Fy,loopEnum:(g=e.loopEnum)!==null&&g!==void 0?g:Fy,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(_=e.messages)!==null&&_!==void 0?_:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(S=e.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(z=e.addUsedSchema)!==null&&z!==void 0?z:!0,validateSchema:(te=e.validateSchema)!==null&&te!==void 0?te:!0,validateFormats:(ae=e.validateFormats)!==null&&ae!==void 0?ae:!0,unicodeRegExp:(Ne=e.unicodeRegExp)!==null&&Ne!==void 0?Ne:!0,int32range:(fr=e.int32range)!==null&&fr!==void 0?fr:!0,uriResolver:E$}}var ui=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...QI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new BI.ValueScope({scope:{},prefixes:GI,es5:r,lines:n}),this.logger=iP(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,KI.getRules)(),Ly.call(this,XI,t,"NOT SUPPORTED"),Ly.call(this,YI,t,"DEPRECATED","warn"),this._metaOpts=nP.call(this),t.formats&&tP.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&rP.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),eP.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=My;n==="id"&&(o={...My},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 f=this._addSchema(l,d);return f.validate||a.call(this,f)}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 Vy.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,ci.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=qy.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new si.SchemaEnv({schema:{},schemaId:n});if(r=si.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=qy.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,ci.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(sP.call(this,n,r),!r)return(0,Zp.eachItem)(n,i=>Ap.call(this,i)),this;uP.call(this,r);let o={...r,type:(0,fs.getJSONTypes)(r.type),schemaType:(0,fs.getJSONTypes)(r.schemaType)};return(0,Zp.eachItem)(n,o.type.length===0?i=>Ap.call(this,i,o):i=>o.type.forEach(a=>Ap.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]=Ky(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,ci.normalizeId)(a||n);let u=ci.getSchemaRefs.call(this,t,n);return c=new si.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):si.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{si.compileSchema.call(this,t)}finally{this.opts=r}}};ui.ValidationError=JI.default;ui.MissingRefError=Vy.default;Te.default=ui;function Ly(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 qy(e){return e=(0,ci.normalizeId)(e),this.schemas[e]||this.refs[e]}function eP(){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 tP(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function rP(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 nP(){let e={...this.opts};for(let t of WI)delete e[t];return e}var oP={log(){},warn(){},error(){}};function iP(e){if(e===!1)return oP;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 aP=/^[a-z_$][a-z0-9_$:-]*$/i;function sP(e,t){let{RULES:r}=this;if((0,Zp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!aP.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 Ap(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,fs.getJSONTypes)(t.type),schemaType:(0,fs.getJSONTypes)(t.schemaType)}};t.before?cP.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 cP(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 uP(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Ky(t)),e.validateSchema=this.compile(t,!0))}var lP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ky(e){return{anyOf:[e,lP]}}});var Hy=j(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var dP={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Up.default=dP});var Yy=j(Or=>{"use strict";Object.defineProperty(Or,"__esModule",{value:!0});Or.callRef=Or.getValidate=void 0;var pP=ni(),Wy=pt(),Ye=W(),xn=qt(),Gy=as(),ms=ne(),fP={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=Gy.resolveRef.call(c,u,o,r);if(l===void 0)throw new pP.default(n.opts.uriResolver,o,r);if(l instanceof Gy.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return hs(e,a,i,i.$async);let m=t.scopeValue("root",{ref:u});return hs(e,(0,Ye._)`${m}.validate`,u,u.$async)}function f(m){let h=Xy(e,m);hs(e,h,m,m.$async)}function p(m){let h=t.scopeValue("schema",s.code.source===!0?{ref:m,code:(0,Ye.stringify)(m)}:{ref:m}),g=t.name("valid"),y=e.subschema({schema:m,dataTypes:[],schemaPath:Ye.nil,topSchemaRef:h,errSchemaPath:r},g);e.mergeEvaluated(y),e.ok(g)}}};function Xy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ye._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Or.getValidate=Xy;function hs(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?xn.default.this:Ye.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,Ye._)`await ${(0,Wy.callValidateCode)(e,t,u)}`),p(t),a||o.assign(m,!0)},h=>{o.if((0,Ye._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),f(h),a||o.assign(m,!1)}),e.ok(m)}function d(){e.result((0,Wy.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(m){let h=(0,Ye._)`${m}.errors`;o.assign(xn.default.vErrors,(0,Ye._)`${xn.default.vErrors} === null ? ${h} : ${xn.default.vErrors}.concat(${h})`),o.assign(xn.default.errors,(0,Ye._)`${xn.default.vErrors}.length`)}function p(m){var h;if(!i.opts.unevaluated)return;let g=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(i.props=ms.mergeEvaluated.props(o,g.props,i.props));else{let y=o.var("props",(0,Ye._)`${m}.evaluated.props`);i.props=ms.mergeEvaluated.props(o,y,i.props,Ye.Name)}if(i.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(i.items=ms.mergeEvaluated.items(o,g.items,i.items));else{let y=o.var("items",(0,Ye._)`${m}.evaluated.items`);i.items=ms.mergeEvaluated.items(o,y,i.items,Ye.Name)}}}Or.callRef=hs;Or.default=fP});var Qy=j(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var mP=Hy(),hP=Yy(),gP=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",mP.default,hP.default];Mp.default=gP});var e_=j(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var gs=W(),lr=gs.operators,vs={maximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},minimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},exclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},exclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},vP={message:({keyword:e,schemaCode:t})=>(0,gs.str)`must be ${vs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,gs._)`{comparison: ${vs[e].okStr}, limit: ${t}}`},yP={keyword:Object.keys(vs),type:"number",schemaType:"number",$data:!0,error:vP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,gs._)`${r} ${vs[t].fail} ${n} || isNaN(${r})`)}};Fp.default=yP});var t_=j(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var li=W(),_P={message:({schemaCode:e})=>(0,li.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,li._)`{multipleOf: ${e}}`},$P={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:_P,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,li._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,li._)`${a} !== parseInt(${a})`;e.fail$data((0,li._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Lp.default=$P});var n_=j(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});function r_(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}qp.default=r_;r_.code='require("ajv/dist/runtime/ucs2length").default'});var o_=j(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var Nr=W(),bP=ne(),xP=n_(),kP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Nr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Nr._)`{limit: ${e}}`},wP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:kP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Nr.operators.GT:Nr.operators.LT,a=o.opts.unicode===!1?(0,Nr._)`${r}.length`:(0,Nr._)`${(0,bP.useFunc)(e.gen,xP.default)}(${r})`;e.fail$data((0,Nr._)`${a} ${i} ${n}`)}};Vp.default=wP});var i_=j(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var SP=pt(),zP=ne(),kn=W(),IP={message:({schemaCode:e})=>(0,kn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,kn._)`{pattern: ${e}}`},PP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:IP,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,kn._)`new RegExp`:(0,zP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,kn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,kn._)`!${l}`)}else{let c=(0,SP.usePattern)(e,o);e.fail$data((0,kn._)`!${c}.test(${r})`)}}};Jp.default=PP});var a_=j(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});var di=W(),jP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,di.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,di._)`{limit: ${e}}`},EP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:jP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?di.operators.GT:di.operators.LT;e.fail$data((0,di._)`Object.keys(${r}).length ${o} ${n}`)}};Kp.default=EP});var s_=j(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var pi=pt(),fi=W(),TP=ne(),OP={message:({params:{missingProperty:e}})=>(0,fi.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,fi._)`{missingProperty: ${e}}`},NP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:OP,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 p=e.parentSchema.properties,{definedProperties:m}=e.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let g=a.schemaEnv.baseId+a.errSchemaPath,y=`required property "${h}" is not defined at "${g}" (strictRequired)`;(0,TP.checkStrictMode)(a,y,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(fi.nil,d);else for(let p of r)(0,pi.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||i){let m=t.let("valid",!0);e.block$data(m,()=>f(p,m)),e.ok(m)}else t.if((0,pi.checkMissingProp)(e,r,p)),(0,pi.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,pi.noPropertyInData)(t,o,p,s.ownProperties),()=>e.error())})}function f(p,m){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(m,(0,pi.propertyInData)(t,o,p,s.ownProperties)),t.if((0,fi.not)(m),()=>{e.error(),t.break()})},fi.nil)}}};Bp.default=NP});var c_=j(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var mi=W(),DP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,mi.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,mi._)`{limit: ${e}}`},RP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:DP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?mi.operators.GT:mi.operators.LT;e.fail$data((0,mi._)`${r}.length ${o} ${n}`)}};Hp.default=RP});var ys=j(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var u_=lp();u_.code='require("ajv/dist/runtime/equal").default';Wp.default=u_});var l_=j(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var Gp=Yo(),Oe=W(),CP=ne(),AP=ys(),ZP={message:({params:{i:e,j:t}})=>(0,Oe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Oe._)`{i: ${e}, j: ${t}}`},UP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:ZP,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,Gp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Oe._)`${a} === false`),e.ok(c);function l(){let m=t.let("i",(0,Oe._)`${r}.length`),h=t.let("j");e.setParams({i:m,j:h}),t.assign(c,!0),t.if((0,Oe._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,h){let g=t.name("item"),y=(0,Gp.checkDataTypes)(u,g,s.opts.strictNumbers,Gp.DataType.Wrong),_=t.const("indices",(0,Oe._)`{}`);t.for((0,Oe._)`;${m}--;`,()=>{t.let(g,(0,Oe._)`${r}[${m}]`),t.if(y,(0,Oe._)`continue`),u.length>1&&t.if((0,Oe._)`typeof ${g} == "string"`,(0,Oe._)`${g} += "_"`),t.if((0,Oe._)`typeof ${_}[${g}] == "number"`,()=>{t.assign(h,(0,Oe._)`${_}[${g}]`),e.error(),t.assign(c,!1).break()}).code((0,Oe._)`${_}[${g}] = ${m}`)})}function p(m,h){let g=(0,CP.useFunc)(t,AP.default),y=t.name("outer");t.label(y).for((0,Oe._)`;${m}--;`,()=>t.for((0,Oe._)`${h} = ${m}; ${h}--;`,()=>t.if((0,Oe._)`${g}(${r}[${m}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};Xp.default=UP});var d_=j(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var Yp=W(),MP=ne(),FP=ys(),LP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Yp._)`{allowedValue: ${e}}`},qP={keyword:"const",$data:!0,error:LP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Yp._)`!${(0,MP.useFunc)(t,FP.default)}(${r}, ${o})`):e.fail((0,Yp._)`${i} !== ${r}`)}};Qp.default=qP});var p_=j(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var hi=W(),VP=ne(),JP=ys(),KP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,hi._)`{allowedValues: ${e}}`},BP={keyword:"enum",schemaType:"array",$data:!0,error:KP,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,VP.useFunc)(t,JP.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 p=t.const("vSchema",i);l=(0,hi.or)(...o.map((m,h)=>f(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,p=>t.if((0,hi._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,m){let h=o[m];return typeof h=="object"&&h!==null?(0,hi._)`${u()}(${r}, ${p}[${m}])`:(0,hi._)`${r} === ${h}`}}};ef.default=BP});var f_=j(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var HP=e_(),WP=t_(),GP=o_(),XP=i_(),YP=a_(),QP=s_(),ej=c_(),tj=l_(),rj=d_(),nj=p_(),oj=[HP.default,WP.default,GP.default,XP.default,YP.default,QP.default,ej.default,tj.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},rj.default,nj.default];tf.default=oj});var nf=j(gi=>{"use strict";Object.defineProperty(gi,"__esModule",{value:!0});gi.validateAdditionalItems=void 0;var Dr=W(),rf=ne(),ij={message:({params:{len:e}})=>(0,Dr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Dr._)`{limit: ${e}}`},aj={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:ij,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,rf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}m_(e,n)}};function m_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Dr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Dr._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,rf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Dr._)`${s} <= ${t.length}`);r.if((0,Dr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:rf.Type.Num},u),a.allErrors||r.if((0,Dr.not)(u),()=>r.break())})}}gi.validateAdditionalItems=m_;gi.default=aj});var of=j(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.validateTuple=void 0;var h_=W(),_s=ne(),sj=pt(),cj={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return g_(e,"additionalItems",t);r.items=!0,!(0,_s.alwaysValidSchema)(r,t)&&e.ok((0,sj.validateArray)(e))}};function g_(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=_s.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,h_._)`${i}.length`);r.forEach((d,f)=>{(0,_s.alwaysValidSchema)(s,d)||(n.if((0,h_._)`${u} > ${f}`,()=>e.subschema({keyword:a,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=s,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(f.strictTuples&&!h){let g=`"${a}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,_s.checkStrictMode)(s,g,f.strictTuples)}}}vi.validateTuple=g_;vi.default=cj});var v_=j(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});var uj=of(),lj={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,uj.validateTuple)(e,"items")};af.default=lj});var __=j(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});var y_=W(),dj=ne(),pj=pt(),fj=nf(),mj={message:({params:{len:e}})=>(0,y_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,y_._)`{limit: ${e}}`},hj={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:mj,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,dj.alwaysValidSchema)(n,t)&&(o?(0,fj.validateAdditionalItems)(e,o):e.ok((0,pj.validateArray)(e)))}};sf.default=hj});var $_=j(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var mt=W(),$s=ne(),gj={message:({params:{min:e,max:t}})=>t===void 0?(0,mt.str)`must contain at least ${e} valid item(s)`:(0,mt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,mt._)`{minContains: ${e}}`:(0,mt._)`{minContains: ${e}, maxContains: ${t}}`},vj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:gj,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,mt._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,$s.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,$s.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,$s.alwaysValidSchema)(i,r)){let h=(0,mt._)`${l} >= ${a}`;s!==void 0&&(h=(0,mt._)`${h} && ${l} <= ${s}`),e.pass(h);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?p(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,mt._)`${o}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let h=t.name("_valid"),g=t.let("count",0);p(h,()=>t.if(h,()=>m(g)))}function p(h,g){t.forRange("i",0,l,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:$s.Type.Num,compositeRule:!0},h),g()})}function m(h){t.code((0,mt._)`${h}++`),s===void 0?t.if((0,mt._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,mt._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,mt._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};cf.default=vj});var k_=j(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.validateSchemaDeps=Pt.validatePropertyDeps=Pt.error=void 0;var uf=W(),yj=ne(),yi=pt();Pt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,uf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,uf._)`{property: ${e},
2
+ "use strict";var N$=Object.create;var Us=Object.defineProperty;var D$=Object.getOwnPropertyDescriptor;var R$=Object.getOwnPropertyNames;var C$=Object.getPrototypeOf,Z$=Object.prototype.hasOwnProperty;var j=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Dn=(e,t)=>{for(var r in t)Us(e,r,{get:t[r],enumerable:!0})},A$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of R$(t))!Z$.call(e,o)&&o!==r&&Us(e,o,{get:()=>t[o],enumerable:!(n=D$(t,o))||n.enumerable});return e};var it=(e,t,r)=>(r=e!=null?N$(C$(e)):{},A$(t||!e||!e.__esModule?Us(r,"default",{value:e,enumerable:!0}):r,e));var Ko=j(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 Vo=class{};ie._CodeOrName=Vo;ie.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var wr=class extends Vo{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=wr;var dt=class extends Vo{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 wr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ie._Code=dt;ie.nil=new dt("");function pv(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Ad(r,t[n]),r.push(e[++n]);return new dt(r)}ie._=pv;var Zd=new dt("+");function fv(e,...t){let r=[Jo(e[0])],n=0;for(;n<t.length;)r.push(Zd),Ad(r,t[n]),r.push(Zd,Jo(e[++n]));return bS(r),new dt(r)}ie.str=fv;function Ad(e,t){t instanceof dt?e.push(...t._items):t instanceof wr?e.push(t):e.push(wS(t))}ie.addCodeArg=Ad;function bS(e){let t=1;for(;t<e.length-1;){if(e[t]===Zd){let r=xS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function xS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof wr||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 wr))return`"${e}${t.slice(1)}`}function kS(e,t){return t.emptyStr()?e:e.emptyStr()?t:fv`${e}${t}`}ie.strConcat=kS;function wS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Jo(Array.isArray(e)?e.join(","):e)}function SS(e){return new dt(Jo(e))}ie.stringify=SS;function Jo(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ie.safeStringify=Jo;function zS(e){return typeof e=="string"&&ie.IDENTIFIER.test(e)?new dt(`.${e}`):pv`[${e}]`}ie.getProperty=zS;function IS(e){if(typeof e=="string"&&ie.IDENTIFIER.test(e))return new dt(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}ie.getEsmExportName=IS;function PS(e){return new dt(e.toString())}ie.regexpCode=PS});var Fd=j(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.ValueScope=Ge.ValueScopeName=Ge.Scope=Ge.varKinds=Ge.UsedValueState=void 0;var We=Ko(),Ud=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ha;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ha||(Ge.UsedValueState=Ha={}));Ge.varKinds={const:new We.Name("const"),let:new We.Name("let"),var:new We.Name("var")};var Ba=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof We.Name?t:this.name(t)}name(t){return new We.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}}};Ge.Scope=Ba;var Wa=class extends We.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,We._)`.${new We.Name(r)}[${n}]`}};Ge.ValueScopeName=Wa;var jS=(0,We._)`\n`,Md=class extends Ba{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?jS:We.nil}}get(){return this._scope}name(t){return new Wa(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,We._)`${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=We.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,Ha.Started);let l=r(u);if(l){let d=this.opts.es5?Ge.varKinds.var:Ge.varKinds.const;i=(0,We._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,We._)`${i}${l}${this.opts._n}`;else throw new Ud(u);c.set(u,Ha.Completed)})}return i}};Ge.ValueScope=Md});var W=j(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 re=Ko(),yt=Fd(),nr=Ko();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return nr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return nr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return nr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return nr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return nr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return nr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return nr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return nr.Name}});var Qa=Fd();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Qa.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Qa.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Qa.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Qa.varKinds}});X.operators={GT:new re._Code(">"),GTE:new re._Code(">="),LT:new re._Code("<"),LTE:new re._Code("<="),EQ:new re._Code("==="),NEQ:new re._Code("!=="),NOT:new re._Code("!"),OR:new re._Code("||"),AND:new re._Code("&&"),ADD:new re._Code("+")};var Ft=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Ld=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?yt.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=hn(this.rhs,t,r)),this}get names(){return this.rhs instanceof re._CodeOrName?this.rhs.names:{}}},Ga=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 re.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=hn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof re.Name?{}:{...this.lhs.names};return Ya(t,this.rhs)}},qd=class extends Ga{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Vd=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Jd=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Kd=class extends Ft{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Hd=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=hn(this.code,t,r),this}get names(){return this.code instanceof re._CodeOrName?this.code.names:{}}},Ho=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)||(ES(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>Ir(t,r.names),{})}},Lt=class extends Ho{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Bd=class extends Ho{},mn=class extends Lt{};mn.kind="else";var Sr=class e extends Lt{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 mn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(mv(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=hn(this.condition,t,r),this}get names(){let t=super.names;return Ya(t,this.condition),this.else&&Ir(t,this.else.names),t}};Sr.kind="if";var zr=class extends Lt{};zr.kind="for";var Wd=class extends zr{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=hn(this.iteration,t,r),this}get names(){return Ir(super.names,this.iteration.names)}},Gd=class extends zr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?yt.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=Ya(super.names,this.from);return Ya(t,this.to)}},Xa=class extends zr{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=hn(this.iterable,t,r),this}get names(){return Ir(super.names,this.iterable.names)}},Bo=class extends Lt{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)}};Bo.kind="func";var Wo=class extends Ho{render(t){return"return "+super.render(t)}};Wo.kind="return";var Xd=class extends Lt{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&&Ir(t,this.catch.names),this.finally&&Ir(t,this.finally.names),t}},Go=class extends Lt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Go.kind="catch";var Xo=class extends Lt{render(t){return"finally"+super.render(t)}};Xo.kind="finally";var Yd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ `:""},this._extScope=t,this._scope=new yt.Scope({parent:t}),this._nodes=[new Bd]}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 Ld(t,i,n)),i}const(t,r,n){return this._def(yt.varKinds.const,t,r,n)}let(t,r,n){return this._def(yt.varKinds.let,t,r,n)}var(t,r,n){return this._def(yt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Ga(t,r,n))}add(t,r){return this._leafNode(new qd(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==re.nil&&this._leafNode(new Hd(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,re.addCodeArg)(r,o));return r.push("}"),new re._Code(r)}if(t,r,n){if(this._blockNode(new Sr(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 Sr(t))}else(){return this._elseNode(new mn)}endIf(){return this._endBlockNode(Sr,mn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Wd(t),r)}forRange(t,r,n,o,i=this.opts.es5?yt.varKinds.var:yt.varKinds.let){let a=this._scope.toName(t);return this._for(new Gd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=yt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof re.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,re._)`${a}.length`,s=>{this.var(i,(0,re._)`${a}[${s}]`),n(i)})}return this._for(new Xa("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?yt.varKinds.var:yt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,re._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new Xa("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(zr)}label(t){return this._leafNode(new Vd(t))}break(t){return this._leafNode(new Jd(t))}return(t){let r=new Wo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Wo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Xd;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new Go(i),r(i)}return n&&(this._currNode=o.finally=new Xo,this.code(n)),this._endBlockNode(Go,Xo)}throw(t){return this._leafNode(new Kd(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=re.nil,n,o){return this._blockNode(new Bo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Bo)}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 Sr))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=Yd;function Ir(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Ya(e,t){return t instanceof re._CodeOrName?Ir(e,t.names):e}function hn(e,t,r){if(e instanceof re.Name)return n(e);if(!o(e))return e;return new re._Code(e._items.reduce((i,a)=>(a instanceof re.Name&&(a=n(a)),a instanceof re._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof re._Code&&i._items.some(a=>a instanceof re.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function ES(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function mv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,re._)`!${Qd(e)}`}X.not=mv;var TS=hv(X.operators.AND);function OS(...e){return e.reduce(TS)}X.and=OS;var NS=hv(X.operators.OR);function DS(...e){return e.reduce(NS)}X.or=DS;function hv(e){return(t,r)=>t===re.nil?r:r===re.nil?t:(0,re._)`${Qd(t)} ${e} ${Qd(r)}`}function Qd(e){return e instanceof re.Name?e:(0,re._)`(${e})`}});var ne=j(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 me=W(),RS=Ko();function CS(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=CS;function ZS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(yv(e,t),!_v(t,e.self.RULES.all))}Q.alwaysValidSchema=ZS;function yv(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]||xv(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=yv;function _v(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=_v;function AS(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=AS;function US({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,me._)`${r}`}return(0,me._)`${e}${t}${(0,me.getProperty)(n)}`}Q.schemaRefOrVal=US;function MS(e){return $v(decodeURIComponent(e))}Q.unescapeFragment=MS;function FS(e){return encodeURIComponent(tp(e))}Q.escapeFragment=FS;function tp(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=tp;function $v(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=$v;function LS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=LS;function gv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof me.Name?(i instanceof me.Name?e(o,i,a):t(o,i,a),a):i instanceof me.Name?(t(o,a,i),i):r(i,a);return s===me.Name&&!(c instanceof me.Name)?n(o,c):c}}Q.mergeEvaluated={props:gv({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,me._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,me._)`${r} || {}`).code((0,me._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,me._)`${r} || {}`),rp(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:bv}),items:gv({mergeNames:(e,t,r)=>e.if((0,me._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,me._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,me._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,me._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function bv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,me._)`{}`);return t!==void 0&&rp(e,r,t),r}Q.evaluatedPropsToName=bv;function rp(e,t,r){Object.keys(r).forEach(n=>e.assign((0,me._)`${t}${(0,me.getProperty)(n)}`,!0))}Q.setEvaluated=rp;var vv={};function qS(e,t){return e.scopeValue("func",{ref:t,code:vv[t.code]||(vv[t.code]=new RS._Code(t.code))})}Q.useFunc=qS;var ep;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(ep||(Q.Type=ep={}));function VS(e,t,r){if(e instanceof me.Name){let n=t===ep.Num;return r?n?(0,me._)`"[" + ${e} + "]"`:(0,me._)`"['" + ${e} + "']"`:n?(0,me._)`"/" + ${e}`:(0,me._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,me.getProperty)(e).toString():"/"+tp(e)}Q.getErrorPath=VS;function xv(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=xv});var qt=j(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});var Ze=W(),JS={data:new Ze.Name("data"),valCxt:new Ze.Name("valCxt"),instancePath:new Ze.Name("instancePath"),parentData:new Ze.Name("parentData"),parentDataProperty:new Ze.Name("parentDataProperty"),rootData:new Ze.Name("rootData"),dynamicAnchors:new Ze.Name("dynamicAnchors"),vErrors:new Ze.Name("vErrors"),errors:new Ze.Name("errors"),this:new Ze.Name("this"),self:new Ze.Name("self"),scope:new Ze.Name("scope"),json:new Ze.Name("json"),jsonPos:new Ze.Name("jsonPos"),jsonLen:new Ze.Name("jsonLen"),jsonPart:new Ze.Name("jsonPart")};np.default=JS});var Yo=j(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.extendErrors=Ae.resetErrorsCount=Ae.reportExtraError=Ae.reportError=Ae.keyword$DataError=Ae.keywordError=void 0;var oe=W(),es=ne(),Ke=qt();Ae.keywordError={message:({keyword:e})=>(0,oe.str)`must pass "${e}" keyword validation`};Ae.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,oe.str)`"${e}" keyword must be ${t} ($data)`:(0,oe.str)`"${e}" keyword is invalid ($data)`};function KS(e,t=Ae.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=Sv(e,t,r);n??(a||s)?kv(i,c):wv(o,(0,oe._)`[${c}]`)}Ae.reportError=KS;function HS(e,t=Ae.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=Sv(e,t,r);kv(o,s),i||a||wv(n,Ke.default.vErrors)}Ae.reportExtraError=HS;function BS(e,t){e.assign(Ke.default.errors,t),e.if((0,oe._)`${Ke.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,oe._)`${Ke.default.vErrors}.length`,t),()=>e.assign(Ke.default.vErrors,null)))}Ae.resetErrorsCount=BS;function WS({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,Ke.default.errors,s=>{e.const(a,(0,oe._)`${Ke.default.vErrors}[${s}]`),e.if((0,oe._)`${a}.instancePath === undefined`,()=>e.assign((0,oe._)`${a}.instancePath`,(0,oe.strConcat)(Ke.default.instancePath,i.errorPath))),e.assign((0,oe._)`${a}.schemaPath`,(0,oe.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,oe._)`${a}.schema`,r),e.assign((0,oe._)`${a}.data`,n))})}Ae.extendErrors=WS;function kv(e,t){let r=e.const("err",t);e.if((0,oe._)`${Ke.default.vErrors} === null`,()=>e.assign(Ke.default.vErrors,(0,oe._)`[${r}]`),(0,oe._)`${Ke.default.vErrors}.push(${r})`),e.code((0,oe._)`${Ke.default.errors}++`)}function wv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,oe._)`new ${e.ValidationError}(${t})`):(r.assign((0,oe._)`${n}.errors`,t),r.return(!1))}var Pr={keyword:new oe.Name("keyword"),schemaPath:new oe.Name("schemaPath"),params:new oe.Name("params"),propertyName:new oe.Name("propertyName"),message:new oe.Name("message"),schema:new oe.Name("schema"),parentSchema:new oe.Name("parentSchema")};function Sv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,oe._)`{}`:GS(e,t,r)}function GS(e,t,r={}){let{gen:n,it:o}=e,i=[XS(o,r),YS(e,r)];return QS(e,t,i),n.object(...i)}function XS({errorPath:e},{instancePath:t}){let r=t?(0,oe.str)`${e}${(0,es.getErrorPath)(t,es.Type.Str)}`:e;return[Ke.default.instancePath,(0,oe.strConcat)(Ke.default.instancePath,r)]}function YS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,oe.str)`${t}/${e}`;return r&&(o=(0,oe.str)`${o}${(0,es.getErrorPath)(r,es.Type.Str)}`),[Pr.schemaPath,o]}function QS(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([Pr.keyword,o],[Pr.params,typeof t=="function"?t(e):t||(0,oe._)`{}`]),c.messages&&n.push([Pr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Pr.schema,a],[Pr.parentSchema,(0,oe._)`${l}${d}`],[Ke.default.data,i]),u&&n.push([Pr.propertyName,u])}});var Iv=j(gn=>{"use strict";Object.defineProperty(gn,"__esModule",{value:!0});gn.boolOrEmptySchema=gn.topBoolOrEmptySchema=void 0;var e0=Yo(),t0=W(),r0=qt(),n0={message:"boolean schema is false"};function o0(e){let{gen:t,schema:r,validateName:n}=e;r===!1?zv(e,!1):typeof r=="object"&&r.$async===!0?t.return(r0.default.data):(t.assign((0,t0._)`${n}.errors`,null),t.return(!0))}gn.topBoolOrEmptySchema=o0;function i0(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),zv(e)):r.var(t,!0)}gn.boolOrEmptySchema=i0;function zv(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,e0.reportError)(o,n0,void 0,t)}});var op=j(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.getRules=vn.isJSONType=void 0;var a0=["string","number","integer","boolean","null","object","array"],s0=new Set(a0);function c0(e){return typeof e=="string"&&s0.has(e)}vn.isJSONType=c0;function u0(){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:{}}}vn.getRules=u0});var ip=j(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.shouldUseRule=or.shouldUseGroup=or.schemaHasRulesForType=void 0;function l0({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&Pv(e,n)}or.schemaHasRulesForType=l0;function Pv(e,t){return t.rules.some(r=>jv(e,r))}or.shouldUseGroup=Pv;function jv(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))}or.shouldUseRule=jv});var Qo=j(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.reportTypeError=Ue.checkDataTypes=Ue.checkDataType=Ue.coerceAndCheckDataType=Ue.getJSONTypes=Ue.getSchemaTypes=Ue.DataType=void 0;var d0=op(),p0=ip(),f0=Yo(),B=W(),Ev=ne(),yn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(yn||(Ue.DataType=yn={}));function m0(e){let t=Tv(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}Ue.getSchemaTypes=m0;function Tv(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(d0.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Ue.getJSONTypes=Tv;function h0(e,t){let{gen:r,data:n,opts:o}=e,i=g0(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,p0.schemaHasRulesForType)(e,t[0]));if(a){let s=sp(t,n,o.strictNumbers,yn.Wrong);r.if(s,()=>{i.length?v0(e,t,i):cp(e)})}return a}Ue.coerceAndCheckDataType=h0;var Ov=new Set(["string","number","integer","boolean","null"]);function g0(e,t){return t?e.filter(r=>Ov.has(r)||t==="array"&&r==="array"):[]}function v0(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(sp(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,B._)`${s} !== undefined`);for(let u of r)(Ov.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),cp(e),n.endIf(),n.if((0,B._)`${s} !== undefined`,()=>{n.assign(o,s),y0(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 y0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,B._)`${t} !== undefined`,()=>e.assign((0,B._)`${t}[${r}]`,n))}function ap(e,t,r,n=yn.Correct){let o=n===yn.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===yn.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)}}Ue.checkDataType=ap;function sp(e,t,r,n){if(e.length===1)return ap(e[0],t,r,n);let o,i=(0,Ev.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,ap(a,t,r,n));return o}Ue.checkDataTypes=sp;var _0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,B._)`{type: ${e}}`:(0,B._)`{type: ${t}}`};function cp(e){let t=$0(e);(0,f0.reportError)(t,_0)}Ue.reportTypeError=cp;function $0(e){let{gen:t,data:r,schema:n}=e,o=(0,Ev.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var Dv=j(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.assignDefaults=void 0;var _n=W(),b0=ne();function x0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)Nv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Nv(e,i,o.default))}ts.assignDefaults=x0;function Nv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,_n._)`${i}${(0,_n.getProperty)(t)}`;if(o){(0,b0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,_n._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,_n._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,_n._)`${s} = ${(0,_n.stringify)(r)}`)}});var pt=j(le=>{"use strict";Object.defineProperty(le,"__esModule",{value:!0});le.validateUnion=le.validateArray=le.usePattern=le.callValidateCode=le.schemaProperties=le.allSchemaProperties=le.noPropertyInData=le.propertyInData=le.isOwnProperty=le.hasPropFunc=le.reportMissingProp=le.checkMissingProp=le.checkReportMissingProp=void 0;var ye=W(),up=ne(),ir=qt(),k0=ne();function w0(e,t){let{gen:r,data:n,it:o}=e;r.if(dp(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ye._)`${t}`},!0),e.error()})}le.checkReportMissingProp=w0;function S0({gen:e,data:t,it:{opts:r}},n,o){return(0,ye.or)(...n.map(i=>(0,ye.and)(dp(e,t,i,r.ownProperties),(0,ye._)`${o} = ${i}`)))}le.checkMissingProp=S0;function z0(e,t){e.setParams({missingProperty:t},!0),e.error()}le.reportMissingProp=z0;function Rv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ye._)`Object.prototype.hasOwnProperty`})}le.hasPropFunc=Rv;function lp(e,t,r){return(0,ye._)`${Rv(e)}.call(${t}, ${r})`}le.isOwnProperty=lp;function I0(e,t,r,n){let o=(0,ye._)`${t}${(0,ye.getProperty)(r)} !== undefined`;return n?(0,ye._)`${o} && ${lp(e,t,r)}`:o}le.propertyInData=I0;function dp(e,t,r,n){let o=(0,ye._)`${t}${(0,ye.getProperty)(r)} === undefined`;return n?(0,ye.or)(o,(0,ye.not)(lp(e,t,r))):o}le.noPropertyInData=dp;function Cv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}le.allSchemaProperties=Cv;function P0(e,t){return Cv(t).filter(r=>!(0,up.alwaysValidSchema)(e,t[r]))}le.schemaProperties=P0;function j0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ye._)`${e}, ${t}, ${n}${o}`:t,d=[[ir.default.instancePath,(0,ye.strConcat)(ir.default.instancePath,i)],[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 f=(0,ye._)`${l}, ${r.object(...d)}`;return c!==ye.nil?(0,ye._)`${s}.call(${c}, ${f})`:(0,ye._)`${s}(${f})`}le.callValidateCode=j0;var E0=(0,ye._)`new RegExp`;function T0({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,ye._)`${o.code==="new RegExp"?E0:(0,k0.useFunc)(e,o)}(${r}, ${n})`})}le.usePattern=T0;function O0(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,ye._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:up.Type.Num},i),t.if((0,ye.not)(i),s)})}}le.validateArray=O0;function N0(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,up.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,ye._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ye.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}le.validateUnion=N0});var Uv=j(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.validateKeywordUsage=zt.validSchemaType=zt.funcKeywordCode=zt.macroKeywordCode=void 0;var He=W(),jr=qt(),D0=pt(),R0=Yo();function C0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=Av(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:He.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}zt.macroKeywordCode=C0;function Z0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;U0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=Av(n,o,u),d=n.let("valid");e.block$data(d,f),e.ok((r=t.valid)!==null&&r!==void 0?r:d);function f(){if(t.errors===!1)h(),t.modifying&&Zv(e),m(()=>e.error());else{let y=t.async?p():g();t.modifying&&Zv(e),m(()=>A0(e,y))}}function p(){let y=n.let("ruleErrs",null);return n.try(()=>h((0,He._)`await `),_=>n.assign(d,!1).if((0,He._)`${_} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,He._)`${_}.errors`),()=>n.throw(_))),y}function g(){let y=(0,He._)`${l}.errors`;return n.assign(y,null),h(He.nil),y}function h(y=t.async?(0,He._)`await `:He.nil){let _=c.opts.passContext?jr.default.this:jr.default.self,b=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,He._)`${y}${(0,D0.callValidateCode)(e,l,_,b)}`,t.modifying)}function m(y){var _;n.if((0,He.not)((_=t.valid)!==null&&_!==void 0?_:d),y)}}zt.funcKeywordCode=Z0;function Zv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,He._)`${n.parentData}[${n.parentDataProperty}]`))}function A0(e,t){let{gen:r}=e;r.if((0,He._)`Array.isArray(${t})`,()=>{r.assign(jr.default.vErrors,(0,He._)`${jr.default.vErrors} === null ? ${t} : ${jr.default.vErrors}.concat(${t})`).assign(jr.default.errors,(0,He._)`${jr.default.vErrors}.length`),(0,R0.extendErrors)(e)},()=>e.error())}function U0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Av(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,He.stringify)(r)})}function M0(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")}zt.validSchemaType=M0;function F0({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)}}zt.validateKeywordUsage=F0});var Fv=j(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.extendSubschemaMode=ar.extendSubschemaData=ar.getSubschema=void 0;var It=W(),Mv=ne();function L0(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,It._)`${e.schemaPath}${(0,It.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,It._)`${e.schemaPath}${(0,It.getProperty)(t)}${(0,It.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,Mv.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')}ar.getSubschema=L0;function q0(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,f=s.let("data",(0,It._)`${t.data}${(0,It.getProperty)(r)}`,!0);c(f),e.errorPath=(0,It.str)`${u}${(0,Mv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,It._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof It.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]}}ar.extendSubschemaData=q0;function V0(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}ar.extendSubschemaMode=V0});var pp=j((GA,Lv)=>{"use strict";Lv.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 Vv=j((XA,qv)=>{"use strict";var sr=qv.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(){};rs(t,n,o,e,"",e)};sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};sr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};sr.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 rs(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 sr.arrayKeywords)for(var f=0;f<d.length;f++)rs(e,t,r,d[f],o+"/"+l+"/"+f,i,o,l,n,f)}else if(l in sr.propsKeywords){if(d&&typeof d=="object")for(var p in d)rs(e,t,r,d[p],o+"/"+l+"/"+J0(p),i,o,l,n,p)}else(l in sr.keywords||e.allKeys&&!(l in sr.skipKeywords))&&rs(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function J0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var ei=j(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getSchemaRefs=Xe.resolveUrl=Xe.normalizeId=Xe._getFullPath=Xe.getFullPath=Xe.inlineRef=void 0;var K0=ne(),H0=pp(),B0=Vv(),W0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function G0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!fp(e):t?Jv(e)<=t:!1}Xe.inlineRef=G0;var X0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function fp(e){for(let t in e){if(X0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(fp)||typeof r=="object"&&fp(r))return!0}return!1}function Jv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!W0.has(r)&&(typeof e[r]=="object"&&(0,K0.eachItem)(e[r],n=>t+=Jv(n)),t===1/0))return 1/0}return t}function Kv(e,t="",r){r!==!1&&(t=$n(t));let n=e.parse(t);return Hv(e,n)}Xe.getFullPath=Kv;function Hv(e,t){return e.serialize(t).split("#")[0]+"#"}Xe._getFullPath=Hv;var Y0=/#\/?$/;function $n(e){return e?e.replace(Y0,""):""}Xe.normalizeId=$n;function Q0(e,t,r){return r=$n(r),e.resolve(t,r)}Xe.resolveUrl=Q0;var ez=/^[a-z_][-a-z0-9._]*$/i;function tz(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=$n(e[r]||t),i={"":o},a=Kv(n,o,!1),s={},c=new Set;return B0(e,{allKeys:!0},(d,f,p,g)=>{if(g===void 0)return;let h=a+f,m=i[g];typeof d[r]=="string"&&(m=y.call(this,d[r])),_.call(this,d.$anchor),_.call(this,d.$dynamicAnchor),i[f]=m;function y(b){let S=this.opts.uriResolver.resolve;if(b=$n(m?S(m,b):b),c.has(b))throw l(b);c.add(b);let z=this.refs[b];return typeof z=="string"&&(z=this.refs[z]),typeof z=="object"?u(d,z.schema,b):b!==$n(h)&&(b[0]==="#"?(u(d,s[b],b),s[b]=d):this.refs[b]=h),b}function _(b){if(typeof b=="string"){if(!ez.test(b))throw new Error(`invalid anchor "${b}"`);y.call(this,`#${b}`)}}}),s;function u(d,f,p){if(f!==void 0&&!H0(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Xe.getSchemaRefs=tz});var ni=j(cr=>{"use strict";Object.defineProperty(cr,"__esModule",{value:!0});cr.getData=cr.KeywordCxt=cr.validateFunctionCode=void 0;var Yv=Iv(),Bv=Qo(),hp=ip(),ns=Qo(),rz=Dv(),ri=Uv(),mp=Fv(),D=W(),q=qt(),nz=ei(),Vt=ne(),ti=Yo();function oz(e){if(ty(e)&&(ry(e),ey(e))){sz(e);return}Qv(e,()=>(0,Yv.topBoolOrEmptySchema)(e))}cr.validateFunctionCode=oz;function Qv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,D._)`${q.default.data}, ${q.default.valCxt}`,n.$async,()=>{e.code((0,D._)`"use strict"; ${Wv(r,o)}`),az(e,o),e.code(i)}):e.func(t,(0,D._)`${q.default.data}, ${iz(o)}`,n.$async,()=>e.code(Wv(r,o)).code(i))}function iz(e){return(0,D._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${e.dynamicRef?(0,D._)`, ${q.default.dynamicAnchors}={}`:D.nil}}={}`}function az(e,t){e.if(q.default.valCxt,()=>{e.var(q.default.instancePath,(0,D._)`${q.default.valCxt}.${q.default.instancePath}`),e.var(q.default.parentData,(0,D._)`${q.default.valCxt}.${q.default.parentData}`),e.var(q.default.parentDataProperty,(0,D._)`${q.default.valCxt}.${q.default.parentDataProperty}`),e.var(q.default.rootData,(0,D._)`${q.default.valCxt}.${q.default.rootData}`),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{e.var(q.default.instancePath,(0,D._)`""`),e.var(q.default.parentData,(0,D._)`undefined`),e.var(q.default.parentDataProperty,(0,D._)`undefined`),e.var(q.default.rootData,q.default.data),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,D._)`{}`)})}function sz(e){let{schema:t,opts:r,gen:n}=e;Qv(e,()=>{r.$comment&&t.$comment&&oy(e),pz(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&cz(e),ny(e),hz(e)})}function cz(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,D._)`${r}.evaluated`),t.if((0,D._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,D._)`${e.evaluated}.props`,(0,D._)`undefined`)),t.if((0,D._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,D._)`${e.evaluated}.items`,(0,D._)`undefined`))}function Wv(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,D._)`/*# sourceURL=${r} */`:D.nil}function uz(e,t){if(ty(e)&&(ry(e),ey(e))){lz(e,t);return}(0,Yv.boolOrEmptySchema)(e,t)}function ey({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 ty(e){return typeof e.schema!="boolean"}function lz(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&oy(e),fz(e),mz(e);let i=n.const("_errs",q.default.errors);ny(e,i),n.var(t,(0,D._)`${i} === ${q.default.errors}`)}function ry(e){(0,Vt.checkUnknownRules)(e),dz(e)}function ny(e,t){if(e.opts.jtd)return Gv(e,[],!1,t);let r=(0,Bv.getSchemaTypes)(e.schema),n=(0,Bv.coerceAndCheckDataType)(e,r);Gv(e,r,!n,t)}function dz(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 pz(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 fz(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,nz.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function mz(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function oy({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,D._)`${q.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,D.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,D._)`${q.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function hz(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,D._)`${q.default.errors} === 0`,()=>t.return(q.default.data),()=>t.throw((0,D._)`new ${o}(${q.default.vErrors})`)):(t.assign((0,D._)`${n}.errors`,q.default.vErrors),i.unevaluated&&gz(e),t.return((0,D._)`${q.default.errors} === 0`))}function gz({gen:e,evaluated:t,props:r,items:n}){r instanceof D.Name&&e.assign((0,D._)`${t}.props`,r),n instanceof D.Name&&e.assign((0,D._)`${t}.items`,n)}function Gv(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(()=>ay(e,"$ref",l.all.$ref.definition));return}c.jtd||vz(e,t),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,hp.shouldUseGroup)(i,f)&&(f.type?(o.if((0,ns.checkDataType)(f.type,a,c.strictNumbers)),Xv(e,f),t.length===1&&t[0]===f.type&&r&&(o.else(),(0,ns.reportTypeError)(e)),o.endIf()):Xv(e,f),s||o.if((0,D._)`${q.default.errors} === ${n||0}`))}}function Xv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,rz.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,hp.shouldUseRule)(n,i)&&ay(e,i.keyword,i.definition,t.type)})}function vz(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(yz(e,t),e.opts.allowUnionTypes||_z(e,t),$z(e,e.dataTypes))}function yz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{iy(e.dataTypes,r)||gp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),xz(e,t)}}function _z(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&gp(e,"use allowUnionTypes to allow union type keyword")}function $z(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,hp.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>bz(t,a))&&gp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function bz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function iy(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function xz(e,t){let r=[];for(let n of e.dataTypes)iy(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function gp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Vt.checkStrictMode)(e,t,e.opts.strictTypes)}var os=class{constructor(t,r,n){if((0,ri.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",sy(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,ri.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",q.default.errors))}result(t,r,n){this.failResult((0,D.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,D.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,D._)`${r} !== undefined && (${(0,D.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?ti.reportExtraError:ti.reportError)(this,this.def.error,r)}$dataError(){(0,ti.reportError)(this,this.def.$dataError||ti.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,ti.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=D.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=D.nil,r=D.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,D.or)((0,D._)`${o} === undefined`,r)),t!==D.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==D.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,D.or)(a(),s());function a(){if(n.length){if(!(r instanceof D.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,D._)`${(0,ns.checkDataTypes)(c,r,i.opts.strictNumbers,ns.DataType.Wrong)}`}return D.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,D._)`!${c}(${r})`}return D.nil}}subschema(t,r){let n=(0,mp.getSubschema)(this.it,t);(0,mp.extendSubschemaData)(n,this.it,t),(0,mp.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return uz(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,D.Name)),!0}};cr.KeywordCxt=os;function ay(e,t,r,n){let o=new os(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,ri.funcKeywordCode)(o,r):"macro"in r?(0,ri.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,ri.funcKeywordCode)(o,r)}var kz=/^\/(?:[^~]|~0|~1)*$/,wz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function sy(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!kz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=q.default.rootData}else{let u=wz.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,D._)`${i}${(0,D.getProperty)((0,Vt.unescapeJsonPointer)(u))}`,a=(0,D._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}cr.getData=sy});var is=j(yp=>{"use strict";Object.defineProperty(yp,"__esModule",{value:!0});var vp=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};yp.default=vp});var oi=j(bp=>{"use strict";Object.defineProperty(bp,"__esModule",{value:!0});var _p=ei(),$p=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,_p.resolveUrl)(t,r,n),this.missingSchema=(0,_p.normalizeId)((0,_p.getFullPath)(t,this.missingRef))}};bp.default=$p});var ss=j(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.resolveSchema=ft.getCompilingSchema=ft.resolveRef=ft.compileSchema=ft.SchemaEnv=void 0;var _t=W(),Sz=is(),Er=qt(),$t=ei(),cy=ne(),zz=ni(),bn=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={}}};ft.SchemaEnv=bn;function kp(e){let t=uy.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 _t.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:Sz.default,code:(0,_t._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Er.default.data,parentData:Er.default.parentData,parentDataProperty:Er.default.parentDataProperty,dataNames:[Er.default.data],dataPathArr:[_t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,_t.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:_t.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,_t._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,zz.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Er.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${Er.default.self}`,`${Er.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=e.schema,p.schemaEnv=e,e.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:g,items:h}=u;p.evaluated={props:g instanceof _t.Name?void 0:g,items:h instanceof _t.Name?void 0:h,dynamicProps:g instanceof _t.Name,dynamicItems:h instanceof _t.Name},p.source&&(p.source.evaluated=(0,_t.stringify)(p.evaluated))}return e.validate=p,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)}}ft.compileSchema=kp;function Iz(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=Ez.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 bn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=Pz.call(this,i)}ft.resolveRef=Iz;function Pz(e){return(0,$t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:kp.call(this,e)}function uy(e){for(let t of this._compilations)if(jz(t,e))return t}ft.getCompilingSchema=uy;function jz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Ez(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||as.call(this,e,t)}function as(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 xp.call(this,r,e);let i=(0,$t.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=as.call(this,e,a);return typeof s?.schema!="object"?void 0:xp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||kp.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 bn({schema:s,schemaId:c,root:e,baseId:o})}return xp.call(this,r,a)}}ft.resolveSchema=as;var Tz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function xp(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,cy.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Tz.has(s)&&u&&(t=(0,$t.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,cy.schemaHasRulesButRef)(r,this.RULES)){let s=(0,$t.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=as.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new bn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var ly=j((nU,Oz)=>{Oz.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 jp=j((oU,gy)=>{"use strict";var Nz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),wp=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),Dz=RegExp.prototype.test.bind(/^\d*$/u),Tr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Sp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),py=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),zp=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),Rz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function Cz(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 Zz=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),Az=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),Uz=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),Mz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),Fz=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),Lz=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function qz(e){return Fz(e)||Lz(e)}function Vz(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!Uz(e[t])){if(e[t]==="%"&&t+2<e.length&&Tr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function dy(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 Jz(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||!wp(c))return;i+=2;continue}if(!Zz(c))return;o[s]=parseInt(c,16).toString(16),i++}if(t===-1)return i!==8?void 0:dy(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 dy(a)}function cs(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&&Az(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(Kz(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),!Vz(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=Jz(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(o?"%"+o:""),escapedHost:a+(o?"%25"+o:""),isIPV6:!0}}function Kz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Hz(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 Bz={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Wz=/[@/?#:]/g,Gz=/[@/?#]/g;function fy(e,t){let r=t?Gz:Wz;return r.lastIndex=0,e.replace(r,n=>Bz[n])}function my(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(Tr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));t&&Sp(a)?r+=a:r+="%"+i,n+=2;continue}}r+=e[n]}return r}var Me=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Me[t]="%"+e[t>>4]+e[t&15]}function Ip(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?Me[192|e>>6]+Me[128|e&63]:e<65536?Me[224|e>>12]+Me[128|e>>6&63]+Me[128|e&63]:Me[240|e>>18]+Me[128|e>>12&63]+Me[128|e>>6&63]+Me[128|e&63]}function Xz(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(Tr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&Sp(a)?t+=a:t+="%"+i,r+=2;continue}}if(py(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Ip(o)?n:Me[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 Yz(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(Tr(a)){r+="%"+a.toUpperCase(),o+=2;continue}}if(i==="/"&&(n=!1),py(i)&&(i!==":"||!n))r+=i;else{let a=e.charCodeAt(o);if(a<128)r+=Me[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 Qz(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(Tr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));Sp(a)?t+=a:t+="%"+i,r+=2;continue}}if(zp(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=Ip(o)?n:Me[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 Pp(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(Tr(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let i=e.charCodeAt(n);if(i<128)r+=Me[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 hy(e){return Pp(e,Rz)}function eI(e){return Pp(e,zp)}function tI(e){return Pp(e,zp)}function rI(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(Tr(i)){t+="%"+i.toUpperCase(),r+=2;continue}}let o=e.charCodeAt(r);if(o<128)t+=Ip(o)?n:Me[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 nI(e){let t=e.ipv6Zone;if(t===void 0)return;let r=e.host,n=r.indexOf("%");if(n===-1)return;let i=r.slice(0,n)+"%25"+t,a=cs("["+i+"]");if(a.isIPV6===!0&&a.host===r)return"["+i+"]"}function oI(e){let t=[];if(e.userinfo!==void 0&&(t.push(hy(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!wp(r)){let n=nI(e);if(n!==void 0)r=n;else{let o=cs(r);o.isIPV6!==!0&&o.isIPVFuture!==!0&&(r=my(r,!0),o=cs(r)),o.isIPV6===!0||o.isIPVFuture===!0?r=`[${o.escapedHost}]`:r=fy(r,!1)}}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!Dz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}gy.exports={BYTE_HEX:Me,percentEncodeNonAscii:$e,nonSimpleDomain:Mz,nonSimpleMailtoDomain:qz,recomposeAuthority:oI,reescapeHostDelimiters:fy,normalizePercentEncoding:my,normalizePathEncoding:Xz,serializePathEncoding:Yz,normalizeQueryFragmentEncoding:Qz,encodeUserinfo:hy,encodeQuery:eI,encodeFragment:tI,escapePreservingEscapes:rI,removeDotSegments:Hz,isIPv4:wp,isUUID:Nz,normalizeIPv6:cs,stringArrayToHexStripped:Cz}});var zy=j((iU,Sy)=>{"use strict";var{isUUID:iI,BYTE_HEX:aI,percentEncodeNonAscii:Ep,nonSimpleMailtoDomain:sI}=jp(),cI=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,uI=["http","https","ws","wss","urn","urn:uuid","mailto"];function lI(e){return uI.indexOf(e)!==-1}function Op(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 _y(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function $y(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 dI(e){return e.secure=Op(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function pI(e){if((e.port===(Op(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 fI(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(cI);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=Np(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function mI(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=Np(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 hI(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!iI(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function gI(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var by={scheme:"http",domainHost:!0,parse:_y,serialize:$y},vI={scheme:"https",domainHost:by.domainHost,parse:_y,serialize:$y},us={scheme:"ws",domainHost:!0,parse:dI,serialize:pI},yI={scheme:"wss",domainHost:us.domainHost,parse:us.parse,serialize:us.serialize},_I={scheme:"urn",parse:fI,serialize:mI,skipNormalize:!0},$I={scheme:"urn:uuid",parse:hI,serialize:gI,skipNormalize:!0},bI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=",xI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@",xy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function ds(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 kI=ds(bI),ky=ds(xI),wI=ds(xy),SI=ds(xy,!0),zI=/^[\da-f]{2}$/iu,II=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,Tp="URI mailto has an invalid recipient domain.",PI="URI mailto must not have an authority component.",vy=/[\uD800-\uDFFF]/u;function ur(e){if(typeof e!="string"||e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function yy(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 ii(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&&zI.test(e.slice(o+1,o+3))?(n+="%"+e.slice(o+1,o+3).toUpperCase(),o+=2):n+=aI[i];continue}if(i<55296||i>57343){n+=t.allowNonAscii?e[o]:Ep(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]:Ep(65536+(i-55296<<10)+(a-56320)),o++;continue}}n+=t.allowNonAscii?"\uFFFD":Ep(65533)}return n}function wy(e,t,r){let n=String(e).toLowerCase();if(II.test(n)||n!==""&&!sI(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(Tp);return t&&t.unicodeSupport?n:o.hostname}catch{return r&&(r.error=r.error||Tp),n}}function jI(e,t){let r=t&&t.unicodeSupport?SI:wI;return e.length>1&&e[0]==="["&&e[e.length-1]==="]"?"["+ii(e.slice(1,-1),r)+"]":ii(e,r)}function EI(e,t){let r=e,n=r.path,o=r.query;n&&vy.test(n)&&(n=yy(n)),o&&vy.test(o)&&(o=yy(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=ur(l===-1?u:u.slice(0,l)),f=d.toLowerCase(),p=l===-1?"":u.slice(l+1);if(f==="to"){let g=p.split(",");for(let h=0;h<g.length;h++)i.push(g[h]);continue}if(f==="subject"){r.subject=ur(p);continue}if(f==="body"){r.body=ur(p);continue}a===null&&(a=Object.create(null)),a[d]=ur(p)}a!==null&&(r.headers=a)}r.query=void 0,i.length>0&&(r.userinfo!==void 0||r.host!==void 0||r.port!==void 0)&&(r.userinfo=void 0,r.host=void 0,r.port=void 0,r.error=r.error||PI);for(let a=0;a<i.length;a++){let s=i[a],c=s.lastIndexOf("@");if(c<0){r.error=r.error||Tp,i[a]=ur(s);continue}let u=ur(s.slice(0,c)),l=wy(ur(s.slice(c+1)),t,r);i[a]=u+"@"+l}return i.length&&(r.to=i),r}function TI(e){return ii(e.replace(/%/gu,"%25"),ky)}function OI(e,t){let r=e,n=Array.isArray(r.to)?r.to.slice():[],o=r.headers&&typeof r.headers=="object"?Object.assign(Object.create(null),r.headers):Object.create(null),i=Object.create(null);for(let c in o){let u=c.toLowerCase();if(u==="to"){let l=String(o[c]).split(",");for(let d=0;d<l.length;d++)n.push(l[d])}else u==="subject"||u==="body"?i[u]=o[c]:i[c]=o[c]}if(r.subject!==void 0&&(i.subject=r.subject),r.body!==void 0&&(i.body=r.body),r.headers=i,n.length){r.userinfo=void 0,r.host=void 0,r.port=void 0;for(let c=0;c<n.length;c++){let u=String(n[c]),l=u.lastIndexOf("@"),d=l>=0?u.slice(0,l):u,f=l>=0?u.slice(l+1):"",p=ii(d,kI),g=ur(f),h=wy(g,t);n[c]=p+"@"+jI(h,t)}r.path=n.join(","),t.skipEscape=!0}else r.path=void 0;let a="",s=0;for(let c in i)s++!==0&&(a+="&"),a+=TI(c)+"="+ii(String(i[c]),ky);return s!==0?r.query=a:r.headers=void 0,r}var NI={scheme:"mailto",parse:EI,serialize:OI,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0},ls={http:by,https:vI,ws:us,wss:yI,urn:_I,"urn:uuid":$I,mailto:NI};Object.setPrototypeOf(ls,null);function Np(e){return e&&(ls[e]||ls[e.toLowerCase()])||void 0}Sy.exports={wsIsSecure:Op,SCHEMES:ls,isValidSchemeName:lI,getSchemeHandler:Np}});var Uy=j((aU,ms)=>{"use strict";var{normalizeIPv6:Ty,removeDotSegments:si,recomposeAuthority:DI,normalizePercentEncoding:Rp,normalizePathEncoding:RI,serializePathEncoding:Iy,normalizeQueryFragmentEncoding:Py,encodeQuery:CI,encodeFragment:ZI,reescapeHostDelimiters:AI,isIPv4:Oy,nonSimpleDomain:UI}=jp(),{SCHEMES:Ny,getSchemeHandler:Cp}=zy(),Dy=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Ry="URI scheme is malformed.";function jy(e){let t=unescape(String(e));if(!Dy.test(t))throw new TypeError(Ry);return t}function MI(e,t){return typeof e=="string"?e=BI(e,t):typeof e=="object"&&(e=fs(Or(e,t),t)),e}function FI(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}=ps(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:g,malformedScheme:h}=ps(t,n);if(i||d||a||f||s||p||c||g||u||h)throw new Error(o.error||l.error||"URI is malformed.");let m=Cy(o,l,n,!0),y=Cp(r&&r.scheme||m.scheme),_=m.host,b=_!==void 0&&_!==""&&(Oy(_)||Ty(_).isIPV6);Zy(m,r||{},y,b);let S=_&&_.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(_);if(m.error&&!S)throw new Error(m.error);return n.skipEscape=!0,Or(m,n)}function Dp(e,t){e.host=t.host,t.ipv6Zone!==void 0&&(e.ipv6Zone=t.ipv6Zone)}function Cy(e,t,r,n){let o={};return n||(e=fs(Or(e,r),r),t=fs(Or(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,Dp(o,t),o.port=t.port,o.path=si(t.path||""),o.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(o.userinfo=t.userinfo,Dp(o,t),o.port=t.port,o.path=si(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=si(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=si(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,Dp(o,e),o.port=e.port),o.scheme=e.scheme),o.fragment=t.fragment,o}function LI(e,t,r){let n=Ey(e,r),o=Ey(t,r);return n!==void 0&&o!==void 0&&n===o}function Or(e,t){let r={host:e.host,ipv6Zone:e.ipv6Zone,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=jy(r.scheme));let i=Cp(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=Rp(r.path):r.path=Iy(r.path,s)),n.reference!=="suffix"&&r.scheme&&(r.scheme=jy(r.scheme),o.push(r.scheme,":"));let c=DI(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=si(u)),s&&(u=Iy(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",CI(r.query)),r.fragment!==void 0&&o.push("#",ZI(r.fragment)),o.join("")}var qI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,VI=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,JI=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function KI(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 ai(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 Zp(e){return e[0]==="["&&e[e.length-1]==="]"}function HI(e){let t=e[4];return ai(e[3])||t!==void 0&&!Zp(t)&&ai(t)||ai(e[6])||ai(e[7])||ai(e[8])}function Zy(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&&!Zp(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&!o&&UI(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 ps(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(VI);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let f=e.match(JI);if(f!==null){let g=f[1],h=g.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):g.length!==h.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let p=e.match(qI);if(p){if(n.scheme=p[1],n.userinfo=p[3],n.host=p[4],n.port=parseInt(p[5],10),n.path=p[6]||"",n.query=p[7],n.fragment=p[8],n.scheme!==void 0){let m=unescape(n.scheme);Dy.test(m)?n.scheme=m.toLowerCase():(n.error=n.error||Ry,u=!0)}i=HI(p),i&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=p[5]);let g=KI(n,p);if(g!==void 0&&(n.error=n.error||g,o=!0),n.host)if(Oy(n.host)===!1){let y=Zp(n.host),_=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,b=Ty(n.host);l=b.isIPV6||b.isIPVFuture===!0,c=_&&(!y||b.error===!0),n.host=l?b.host:b.host.toLowerCase(),l&&b.isIPV6===!0&&n.host.indexOf("%")!==-1&&(n.ipv6Zone=n.host.slice(n.host.indexOf("%")+1)),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=Cp(r.scheme||n.scheme);if(c||(s=Zy(n,r,h,l)),e.indexOf("%")!==-1&&n.host!==void 0&&!c){let m=l?n.host:Rp(n.host,!0);l||(m=Rp(m.toLowerCase())),n.host=AI(m,l)}(!h||h&&!h.skipNormalize)&&(n.path&&(n.path=RI(n.path)),n.query&&(n.query=Py(n.query)),n.fragment&&(n.fragment=Py(n.fragment))),h&&h.parse&&(h.parse(n,r),h===Ny.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 fs(e,t){return ps(e,t).parsed}function BI(e,t){return Ay(e,t).normalized}function Ay(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}=ps(e,t);return{normalized:n||o||i||a||s?e:Or(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}}function Ey(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:Or(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=Ay(r,t);return o||i||a||s||c?void 0:n}var Ap={SCHEMES:Ny,normalize:MI,resolve:FI,resolveComponent:Cy,equal:LI,serialize:Or,parse:fs};ms.exports=Ap;ms.exports.default=Ap;ms.exports.fastUri=Ap});var Fy=j(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var My=Uy();My.code='require("ajv/dist/runtime/uri").default';Up.default=My});var Wy=j(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.CodeGen=Te.Name=Te.nil=Te.stringify=Te.str=Te._=Te.KeywordCxt=void 0;var WI=ni();Object.defineProperty(Te,"KeywordCxt",{enumerable:!0,get:function(){return WI.KeywordCxt}});var xn=W();Object.defineProperty(Te,"_",{enumerable:!0,get:function(){return xn._}});Object.defineProperty(Te,"str",{enumerable:!0,get:function(){return xn.str}});Object.defineProperty(Te,"stringify",{enumerable:!0,get:function(){return xn.stringify}});Object.defineProperty(Te,"nil",{enumerable:!0,get:function(){return xn.nil}});Object.defineProperty(Te,"Name",{enumerable:!0,get:function(){return xn.Name}});Object.defineProperty(Te,"CodeGen",{enumerable:!0,get:function(){return xn.CodeGen}});var GI=is(),Ky=oi(),XI=op(),ci=ss(),YI=W(),ui=ei(),hs=Qo(),Fp=ne(),Ly=ly(),QI=Fy(),Hy=(e,t)=>new RegExp(e,t);Hy.code="new RegExp";var eP=["removeAdditional","useDefaults","coerceTypes"],tP=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),rP={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."},nP={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},qy=200;function oP(e){var t,r,n,o,i,a,s,c,u,l,d,f,p,g,h,m,y,_,b,S,z,te,ae,Ne,mr;let Nn=e.strict,As=(t=e.code)===null||t===void 0?void 0:t.optimize,Jf=As===!0||As===void 0?1:As||0,Kf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Hy,O$=(o=e.uriResolver)!==null&&o!==void 0?o:QI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Nn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Nn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Nn)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:Nn)!==null&&f!==void 0?f:"log",strictRequired:(g=(p=e.strictRequired)!==null&&p!==void 0?p:Nn)!==null&&g!==void 0?g:!1,code:e.code?{...e.code,optimize:Jf,regExp:Kf}:{optimize:Jf,regExp:Kf},loopRequired:(h=e.loopRequired)!==null&&h!==void 0?h:qy,loopEnum:(m=e.loopEnum)!==null&&m!==void 0?m:qy,meta:(y=e.meta)!==null&&y!==void 0?y:!0,messages:(_=e.messages)!==null&&_!==void 0?_:!0,inlineRefs:(b=e.inlineRefs)!==null&&b!==void 0?b:!0,schemaId:(S=e.schemaId)!==null&&S!==void 0?S:"$id",addUsedSchema:(z=e.addUsedSchema)!==null&&z!==void 0?z:!0,validateSchema:(te=e.validateSchema)!==null&&te!==void 0?te:!0,validateFormats:(ae=e.validateFormats)!==null&&ae!==void 0?ae:!0,unicodeRegExp:(Ne=e.unicodeRegExp)!==null&&Ne!==void 0?Ne:!0,int32range:(mr=e.int32range)!==null&&mr!==void 0?mr:!0,uriResolver:O$}}var li=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...oP(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new YI.ValueScope({scope:{},prefixes:tP,es5:r,lines:n}),this.logger=lP(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,XI.getRules)(),Vy.call(this,rP,t,"NOT SUPPORTED"),Vy.call(this,nP,t,"DEPRECATED","warn"),this._metaOpts=cP.call(this),t.formats&&aP.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&sP.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),iP.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Ly;n==="id"&&(o={...Ly},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 f=this._addSchema(l,d);return f.validate||a.call(this,f)}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 Ky.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,ui.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=Jy.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new ci.SchemaEnv({schema:{},schemaId:n});if(r=ci.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=Jy.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,ui.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(pP.call(this,n,r),!r)return(0,Fp.eachItem)(n,i=>Mp.call(this,i)),this;mP.call(this,r);let o={...r,type:(0,hs.getJSONTypes)(r.type),schemaType:(0,hs.getJSONTypes)(r.schemaType)};return(0,Fp.eachItem)(n,o.type.length===0?i=>Mp.call(this,i,o):i=>o.type.forEach(a=>Mp.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]=By(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,ui.normalizeId)(a||n);let u=ui.getSchemaRefs.call(this,t,n);return c=new ci.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):ci.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{ci.compileSchema.call(this,t)}finally{this.opts=r}}};li.ValidationError=GI.default;li.MissingRefError=Ky.default;Te.default=li;function Vy(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 Jy(e){return e=(0,ui.normalizeId)(e),this.schemas[e]||this.refs[e]}function iP(){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 aP(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function sP(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 cP(){let e={...this.opts};for(let t of eP)delete e[t];return e}var uP={log(){},warn(){},error(){}};function lP(e){if(e===!1)return uP;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 dP=/^[a-z_$][a-z0-9_$:-]*$/i;function pP(e,t){let{RULES:r}=this;if((0,Fp.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!dP.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 Mp(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,hs.getJSONTypes)(t.type),schemaType:(0,hs.getJSONTypes)(t.schemaType)}};t.before?fP.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 fP(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 mP(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=By(t)),e.validateSchema=this.compile(t,!0))}var hP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function By(e){return{anyOf:[e,hP]}}});var Gy=j(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var gP={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Lp.default=gP});var e_=j(Nr=>{"use strict";Object.defineProperty(Nr,"__esModule",{value:!0});Nr.callRef=Nr.getValidate=void 0;var vP=oi(),Xy=pt(),Ye=W(),kn=qt(),Yy=ss(),gs=ne(),yP={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=Yy.resolveRef.call(c,u,o,r);if(l===void 0)throw new vP.default(n.opts.uriResolver,o,r);if(l instanceof Yy.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return vs(e,a,i,i.$async);let g=t.scopeValue("root",{ref:u});return vs(e,(0,Ye._)`${g}.validate`,u,u.$async)}function f(g){let h=Qy(e,g);vs(e,h,g,g.$async)}function p(g){let h=t.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,Ye.stringify)(g)}:{ref:g}),m=t.name("valid"),y=e.subschema({schema:g,dataTypes:[],schemaPath:Ye.nil,topSchemaRef:h,errSchemaPath:r},m);e.mergeEvaluated(y),e.ok(m)}}};function Qy(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Ye._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Nr.getValidate=Qy;function vs(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?kn.default.this:Ye.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,Ye._)`await ${(0,Xy.callValidateCode)(e,t,u)}`),p(t),a||o.assign(g,!0)},h=>{o.if((0,Ye._)`!(${h} instanceof ${i.ValidationError})`,()=>o.throw(h)),f(h),a||o.assign(g,!1)}),e.ok(g)}function d(){e.result((0,Xy.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(g){let h=(0,Ye._)`${g}.errors`;o.assign(kn.default.vErrors,(0,Ye._)`${kn.default.vErrors} === null ? ${h} : ${kn.default.vErrors}.concat(${h})`),o.assign(kn.default.errors,(0,Ye._)`${kn.default.vErrors}.length`)}function p(g){var h;if(!i.opts.unevaluated)return;let m=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(i.props!==!0)if(m&&!m.dynamicProps)m.props!==void 0&&(i.props=gs.mergeEvaluated.props(o,m.props,i.props));else{let y=o.var("props",(0,Ye._)`${g}.evaluated.props`);i.props=gs.mergeEvaluated.props(o,y,i.props,Ye.Name)}if(i.items!==!0)if(m&&!m.dynamicItems)m.items!==void 0&&(i.items=gs.mergeEvaluated.items(o,m.items,i.items));else{let y=o.var("items",(0,Ye._)`${g}.evaluated.items`);i.items=gs.mergeEvaluated.items(o,y,i.items,Ye.Name)}}}Nr.callRef=vs;Nr.default=yP});var t_=j(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var _P=Gy(),$P=e_(),bP=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",_P.default,$P.default];qp.default=bP});var r_=j(Vp=>{"use strict";Object.defineProperty(Vp,"__esModule",{value:!0});var ys=W(),lr=ys.operators,_s={maximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},minimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},exclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},exclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},xP={message:({keyword:e,schemaCode:t})=>(0,ys.str)`must be ${_s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,ys._)`{comparison: ${_s[e].okStr}, limit: ${t}}`},kP={keyword:Object.keys(_s),type:"number",schemaType:"number",$data:!0,error:xP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,ys._)`${r} ${_s[t].fail} ${n} || isNaN(${r})`)}};Vp.default=kP});var n_=j(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var di=W(),wP={message:({schemaCode:e})=>(0,di.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,di._)`{multipleOf: ${e}}`},SP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:wP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,di._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,di._)`${a} !== parseInt(${a})`;e.fail$data((0,di._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Jp.default=SP});var i_=j(Kp=>{"use strict";Object.defineProperty(Kp,"__esModule",{value:!0});function o_(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}Kp.default=o_;o_.code='require("ajv/dist/runtime/ucs2length").default'});var a_=j(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var Dr=W(),zP=ne(),IP=i_(),PP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Dr.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Dr._)`{limit: ${e}}`},jP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:PP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Dr.operators.GT:Dr.operators.LT,a=o.opts.unicode===!1?(0,Dr._)`${r}.length`:(0,Dr._)`${(0,zP.useFunc)(e.gen,IP.default)}(${r})`;e.fail$data((0,Dr._)`${a} ${i} ${n}`)}};Hp.default=jP});var s_=j(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var EP=pt(),TP=ne(),wn=W(),OP={message:({schemaCode:e})=>(0,wn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,wn._)`{pattern: ${e}}`},NP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:OP,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,wn._)`new RegExp`:(0,TP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,wn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,wn._)`!${l}`)}else{let c=(0,EP.usePattern)(e,o);e.fail$data((0,wn._)`!${c}.test(${r})`)}}};Bp.default=NP});var c_=j(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var pi=W(),DP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,pi.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,pi._)`{limit: ${e}}`},RP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:DP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?pi.operators.GT:pi.operators.LT;e.fail$data((0,pi._)`Object.keys(${r}).length ${o} ${n}`)}};Wp.default=RP});var u_=j(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var fi=pt(),mi=W(),CP=ne(),ZP={message:({params:{missingProperty:e}})=>(0,mi.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,mi._)`{missingProperty: ${e}}`},AP={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 p=e.parentSchema.properties,{definedProperties:g}=e.it;for(let h of r)if(p?.[h]===void 0&&!g.has(h)){let m=a.schemaEnv.baseId+a.errSchemaPath,y=`required property "${h}" is not defined at "${m}" (strictRequired)`;(0,CP.checkStrictMode)(a,y,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(mi.nil,d);else for(let p of r)(0,fi.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||i){let g=t.let("valid",!0);e.block$data(g,()=>f(p,g)),e.ok(g)}else t.if((0,fi.checkMissingProp)(e,r,p)),(0,fi.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,fi.noPropertyInData)(t,o,p,s.ownProperties),()=>e.error())})}function f(p,g){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(g,(0,fi.propertyInData)(t,o,p,s.ownProperties)),t.if((0,mi.not)(g),()=>{e.error(),t.break()})},mi.nil)}}};Gp.default=AP});var l_=j(Xp=>{"use strict";Object.defineProperty(Xp,"__esModule",{value:!0});var hi=W(),UP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,hi.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,hi._)`{limit: ${e}}`},MP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:UP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?hi.operators.GT:hi.operators.LT;e.fail$data((0,hi._)`${r}.length ${o} ${n}`)}};Xp.default=MP});var $s=j(Yp=>{"use strict";Object.defineProperty(Yp,"__esModule",{value:!0});var d_=pp();d_.code='require("ajv/dist/runtime/equal").default';Yp.default=d_});var p_=j(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var Qp=Qo(),Oe=W(),FP=ne(),LP=$s(),qP={message:({params:{i:e,j:t}})=>(0,Oe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Oe._)`{i: ${e}, j: ${t}}`},VP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:qP,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,Qp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Oe._)`${a} === false`),e.ok(c);function l(){let g=t.let("i",(0,Oe._)`${r}.length`),h=t.let("j");e.setParams({i:g,j:h}),t.assign(c,!0),t.if((0,Oe._)`${g} > 1`,()=>(d()?f:p)(g,h))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function f(g,h){let m=t.name("item"),y=(0,Qp.checkDataTypes)(u,m,s.opts.strictNumbers,Qp.DataType.Wrong),_=t.const("indices",(0,Oe._)`{}`);t.for((0,Oe._)`;${g}--;`,()=>{t.let(m,(0,Oe._)`${r}[${g}]`),t.if(y,(0,Oe._)`continue`),u.length>1&&t.if((0,Oe._)`typeof ${m} == "string"`,(0,Oe._)`${m} += "_"`),t.if((0,Oe._)`typeof ${_}[${m}] == "number"`,()=>{t.assign(h,(0,Oe._)`${_}[${m}]`),e.error(),t.assign(c,!1).break()}).code((0,Oe._)`${_}[${m}] = ${g}`)})}function p(g,h){let m=(0,FP.useFunc)(t,LP.default),y=t.name("outer");t.label(y).for((0,Oe._)`;${g}--;`,()=>t.for((0,Oe._)`${h} = ${g}; ${h}--;`,()=>t.if((0,Oe._)`${m}(${r}[${g}], ${r}[${h}])`,()=>{e.error(),t.assign(c,!1).break(y)})))}}};ef.default=VP});var f_=j(rf=>{"use strict";Object.defineProperty(rf,"__esModule",{value:!0});var tf=W(),JP=ne(),KP=$s(),HP={message:"must be equal to constant",params:({schemaCode:e})=>(0,tf._)`{allowedValue: ${e}}`},BP={keyword:"const",$data:!0,error:HP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,tf._)`!${(0,JP.useFunc)(t,KP.default)}(${r}, ${o})`):e.fail((0,tf._)`${i} !== ${r}`)}};rf.default=BP});var m_=j(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var gi=W(),WP=ne(),GP=$s(),XP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,gi._)`{allowedValues: ${e}}`},YP={keyword:"enum",schemaType:"array",$data:!0,error:XP,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,WP.useFunc)(t,GP.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 p=t.const("vSchema",i);l=(0,gi.or)(...o.map((g,h)=>f(p,h)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,p=>t.if((0,gi._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,g){let h=o[g];return typeof h=="object"&&h!==null?(0,gi._)`${u()}(${r}, ${p}[${g}])`:(0,gi._)`${r} === ${h}`}}};nf.default=YP});var h_=j(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var QP=r_(),ej=n_(),tj=a_(),rj=s_(),nj=c_(),oj=u_(),ij=l_(),aj=p_(),sj=f_(),cj=m_(),uj=[QP.default,ej.default,tj.default,rj.default,nj.default,oj.default,ij.default,aj.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},sj.default,cj.default];of.default=uj});var sf=j(vi=>{"use strict";Object.defineProperty(vi,"__esModule",{value:!0});vi.validateAdditionalItems=void 0;var Rr=W(),af=ne(),lj={message:({params:{len:e}})=>(0,Rr.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Rr._)`{limit: ${e}}`},dj={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:lj,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,af.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}g_(e,n)}};function g_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Rr._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Rr._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,af.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Rr._)`${s} <= ${t.length}`);r.if((0,Rr.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:af.Type.Num},u),a.allErrors||r.if((0,Rr.not)(u),()=>r.break())})}}vi.validateAdditionalItems=g_;vi.default=dj});var cf=j(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.validateTuple=void 0;var v_=W(),bs=ne(),pj=pt(),fj={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return y_(e,"additionalItems",t);r.items=!0,!(0,bs.alwaysValidSchema)(r,t)&&e.ok((0,pj.validateArray)(e))}};function y_(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=bs.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,v_._)`${i}.length`);r.forEach((d,f)=>{(0,bs.alwaysValidSchema)(s,d)||(n.if((0,v_._)`${u} > ${f}`,()=>e.subschema({keyword:a,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=s,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[t]===!1);if(f.strictTuples&&!h){let m=`"${a}" is ${g}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,bs.checkStrictMode)(s,m,f.strictTuples)}}}yi.validateTuple=y_;yi.default=fj});var __=j(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var mj=cf(),hj={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,mj.validateTuple)(e,"items")};uf.default=hj});var b_=j(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var $_=W(),gj=ne(),vj=pt(),yj=sf(),_j={message:({params:{len:e}})=>(0,$_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,$_._)`{limit: ${e}}`},$j={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:_j,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,gj.alwaysValidSchema)(n,t)&&(o?(0,yj.validateAdditionalItems)(e,o):e.ok((0,vj.validateArray)(e)))}};lf.default=$j});var x_=j(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var mt=W(),xs=ne(),bj={message:({params:{min:e,max:t}})=>t===void 0?(0,mt.str)`must contain at least ${e} valid item(s)`:(0,mt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,mt._)`{minContains: ${e}}`:(0,mt._)`{minContains: ${e}, maxContains: ${t}}`},xj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:bj,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,mt._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,xs.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,xs.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,xs.alwaysValidSchema)(i,r)){let h=(0,mt._)`${l} >= ${a}`;s!==void 0&&(h=(0,mt._)`${h} && ${l} <= ${s}`),e.pass(h);return}i.items=!0;let d=t.name("valid");s===void 0&&a===1?p(d,()=>t.if(d,()=>t.break())):a===0?(t.let(d,!0),s!==void 0&&t.if((0,mt._)`${o}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let h=t.name("_valid"),m=t.let("count",0);p(h,()=>t.if(h,()=>g(m)))}function p(h,m){t.forRange("i",0,l,y=>{e.subschema({keyword:"contains",dataProp:y,dataPropType:xs.Type.Num,compositeRule:!0},h),m()})}function g(h){t.code((0,mt._)`${h}++`),s===void 0?t.if((0,mt._)`${h} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,mt._)`${h} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,mt._)`${h} >= ${a}`,()=>t.assign(d,!0)))}}};df.default=xj});var S_=j(Pt=>{"use strict";Object.defineProperty(Pt,"__esModule",{value:!0});Pt.validateSchemaDeps=Pt.validatePropertyDeps=Pt.error=void 0;var pf=W(),kj=ne(),_i=pt();Pt.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,pf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,pf._)`{property: ${e},
7
7
  missingProperty: ${n},
8
8
  depsCount: ${t},
9
- deps: ${r}}`};var _j={keyword:"dependencies",type:"object",schemaType:"object",error:Pt.error,code(e){let[t,r]=$j(e);b_(e,t),x_(e,r)}};function $j({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 b_(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,yi.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,yi.checkReportMissingProp)(e,u)}):(r.if((0,uf._)`${c} && (${(0,yi.checkMissingProp)(e,s,i)})`),(0,yi.reportMissingProp)(e,i),r.else())}}Pt.validatePropertyDeps=b_;function x_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,yj.alwaysValidSchema)(i,t[s])||(r.if((0,yi.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))}Pt.validateSchemaDeps=x_;Pt.default=_j});var S_=j(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var w_=W(),bj=ne(),xj={message:"property name must be valid",params:({params:e})=>(0,w_._)`{propertyName: ${e.propertyName}}`},kj={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:xj,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,bj.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,w_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};lf.default=kj});var pf=j(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var bs=pt(),bt=W(),wj=qt(),xs=ne(),Sj={message:"must NOT have additional properties",params:({params:e})=>(0,bt._)`{additionalProperty: ${e.additionalProperty}}`},zj={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Sj,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,xs.alwaysValidSchema)(a,r))return;let u=(0,bs.allSchemaProperties)(n.properties),l=(0,bs.allSchemaProperties)(n.patternProperties);d(),e.ok((0,bt._)`${i} === ${wj.default.errors}`);function d(){t.forIn("key",o,g=>{!u.length&&!l.length?m(g):t.if(f(g),()=>m(g))})}function f(g){let y;if(u.length>8){let _=(0,xs.schemaRefOrVal)(a,n.properties,"properties");y=(0,bs.isOwnProperty)(t,_,g)}else u.length?y=(0,bt.or)(...u.map(_=>(0,bt._)`${g} === ${_}`)):y=bt.nil;return l.length&&(y=(0,bt.or)(y,...l.map(_=>(0,bt._)`${(0,bs.usePattern)(e,_)}.test(${g})`))),(0,bt.not)(y)}function p(g){t.code((0,bt._)`delete ${o}[${g}]`)}function m(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(g);return}if(r===!1){e.setParams({additionalProperty:g}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,xs.alwaysValidSchema)(a,r)){let y=t.name("valid");c.removeAdditional==="failing"?(h(g,y,!1),t.if((0,bt.not)(y),()=>{e.reset(),p(g)})):(h(g,y),s||t.if((0,bt.not)(y),()=>t.break()))}}function h(g,y,_){let b={keyword:"additionalProperties",dataProp:g,dataPropType:xs.Type.Str};_===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,y)}}};df.default=zj});var P_=j(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var Ij=ri(),z_=pt(),ff=ne(),I_=pf(),Pj={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&&I_.default.code(new Ij.KeywordCxt(i,I_.default,"additionalProperties"));let a=(0,z_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=ff.mergeEvaluated.props(t,(0,ff.toHash)(a),i.props));let s=a.filter(d=>!(0,ff.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,z_.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)}}};mf.default=Pj});var O_=j(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var j_=pt(),ks=W(),E_=ne(),T_=ne(),jj={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,j_.allSchemaProperties)(r),c=s.filter(h=>(0,E_.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 ks.Name)&&(i.props=(0,T_.evaluatedPropsToName)(t,i.props));let{props:d}=i;f();function f(){for(let h of s)u&&p(h),i.allErrors?m(h):(t.var(l,!0),m(h),t.if(l))}function p(h){for(let g in u)new RegExp(h).test(g)&&(0,E_.checkStrictMode)(i,`property ${g} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){t.forIn("key",n,g=>{t.if((0,ks._)`${(0,j_.usePattern)(e,h)}.test(${g})`,()=>{let y=c.includes(h);y||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:g,dataPropType:T_.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,ks._)`${d}[${g}]`,!0):!y&&!i.allErrors&&t.if((0,ks.not)(l),()=>t.break())})})}}};hf.default=jj});var N_=j(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var Ej=ne(),Tj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Ej.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"}};gf.default=Tj});var D_=j(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var Oj=pt(),Nj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Oj.validateUnion,error:{message:"must match a schema in anyOf"}};vf.default=Nj});var R_=j(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var ws=W(),Dj=ne(),Rj={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,ws._)`{passingSchemas: ${e.passing}}`},Cj={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Rj,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 f;(0,Dj.alwaysValidSchema)(o,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,ws._)`${c} && ${a}`).assign(a,!1).assign(s,(0,ws._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),f&&e.mergeEvaluated(f,ws.Name)})})}}};yf.default=Cj});var C_=j(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Aj=ne(),Zj={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,Aj.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};_f.default=Zj});var U_=j($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var Ss=W(),Z_=ne(),Uj={message:({params:e})=>(0,Ss.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Ss._)`{failingKeyword: ${e.ifClause}}`},Mj={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Uj,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,Z_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=A_(n,"then"),i=A_(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,Ss.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 f=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(f,a),d?t.assign(d,(0,Ss._)`${l}`):e.setParams({ifClause:l})}}}};function A_(e,t){let r=e.schema[t];return r!==void 0&&!(0,Z_.alwaysValidSchema)(e,r)}$f.default=Mj});var M_=j(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var Fj=ne(),Lj={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Fj.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};bf.default=Lj});var F_=j(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});var qj=nf(),Vj=v_(),Jj=of(),Kj=__(),Bj=$_(),Hj=k_(),Wj=S_(),Gj=pf(),Xj=P_(),Yj=O_(),Qj=N_(),eE=D_(),tE=R_(),rE=C_(),nE=U_(),oE=M_();function iE(e=!1){let t=[Qj.default,eE.default,tE.default,rE.default,nE.default,oE.default,Wj.default,Gj.default,Hj.default,Xj.default,Yj.default];return e?t.push(Vj.default,Kj.default):t.push(qj.default,Jj.default),t.push(Bj.default),t}xf.default=iE});var L_=j(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});var be=W(),aE={message:({schemaCode:e})=>(0,be.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,be._)`{format: ${e}}`},sE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:aE,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?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,be._)`${m}[${a}]`),g=r.let("fType"),y=r.let("format");r.if((0,be._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(g,(0,be._)`${h}.type || "string"`).assign(y,(0,be._)`${h}.validate`),()=>r.assign(g,(0,be._)`"string"`).assign(y,h)),e.fail$data((0,be.or)(_(),b()));function _(){return c.strictSchema===!1?be.nil:(0,be._)`${a} && !${y}`}function b(){let S=l.$async?(0,be._)`(${h}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,be._)`${y}(${n})`,z=(0,be._)`(typeof ${y} == "function" ? ${S} : ${y}.test(${n}))`;return(0,be._)`${y} && ${y} !== true && ${g} === ${t} && !${z}`}}function p(){let m=d.formats[i];if(!m){_();return}if(m===!0)return;let[h,g,y]=b(m);h===t&&e.pass(S());function _(){if(c.strictSchema===!1){d.logger.warn(z());return}throw new Error(z());function z(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function b(z){let te=z instanceof RegExp?(0,be.regexpCode)(z):c.code.formats?(0,be._)`${c.code.formats}${(0,be.getProperty)(i)}`:void 0,ae=r.scopeValue("formats",{key:i,ref:z,code:te});return typeof z=="object"&&!(z instanceof RegExp)?[z.type||"string",z.validate,(0,be._)`${ae}.validate`]:["string",z,ae]}function S(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,be._)`await ${y}(${n})`}return typeof g=="function"?(0,be._)`${y}(${n})`:(0,be._)`${y}.test(${n})`}}}};kf.default=sE});var q_=j(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});var cE=L_(),uE=[cE.default];wf.default=uE});var V_=j(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});wn.contentVocabulary=wn.metadataVocabulary=void 0;wn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];wn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var K_=j(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});var lE=Qy(),dE=f_(),pE=F_(),fE=q_(),J_=V_(),mE=[lE.default,dE.default,(0,pE.default)(),fE.default,J_.metadataVocabulary,J_.contentVocabulary];Sf.default=mE});var H_=j(zs=>{"use strict";Object.defineProperty(zs,"__esModule",{value:!0});zs.DiscrError=void 0;var B_;(function(e){e.Tag="tag",e.Mapping="mapping"})(B_||(zs.DiscrError=B_={}))});var G_=j(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var Sn=W(),zf=H_(),W_=as(),hE=ni(),gE=ne(),vE={message:({params:{discrError:e,tagName:t}})=>e===zf.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,Sn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},yE={keyword:"discriminator",type:"object",schemaType:"object",error:vE,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,Sn._)`${r}${(0,Sn.getProperty)(s)}`);t.if((0,Sn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:zf.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=f();t.if(!1);for(let m in p)t.elseIf((0,Sn._)`${u} === ${m}`),t.assign(c,d(p[m]));t.else(),e.error(!1,{discrError:zf.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let m=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},m);return e.mergeEvaluated(h,Sn.Name),m}function f(){var p;let m={},h=y(o),g=!0;for(let S=0;S<a.length;S++){let z=a[S];if(z?.$ref&&!(0,gE.schemaHasRulesButRef)(z,i.self.RULES)){let ae=z.$ref;if(z=W_.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,ae),z instanceof W_.SchemaEnv&&(z=z.schema),z===void 0)throw new hE.default(i.opts.uriResolver,i.baseId,ae)}let te=(p=z?.properties)===null||p===void 0?void 0:p[s];if(typeof te!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);g=g&&(h||y(z)),_(te,S)}if(!g)throw new Error(`discriminator: "${s}" must be required`);return m;function y({required:S}){return Array.isArray(S)&&S.includes(s)}function _(S,z){if(S.const)b(S.const,z);else if(S.enum)for(let te of S.enum)b(te,z);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function b(S,z){if(typeof S!="string"||S in m)throw new Error(`discriminator: "${s}" values must be unique strings`);m[S]=z}}}};If.default=yE});var X_=j((LU,_E)=>{_E.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 jf=j((_e,Pf)=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.MissingRefError=_e.ValidationError=_e.CodeGen=_e.Name=_e.nil=_e.stringify=_e.str=_e._=_e.KeywordCxt=_e.Ajv=void 0;var $E=By(),bE=K_(),xE=G_(),Y_=X_(),kE=["/properties"],Is="http://json-schema.org/draft-07/schema",zn=class extends $E.default{_addVocabularies(){super._addVocabularies(),bE.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(xE.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(Y_,kE):Y_;this.addMetaSchema(t,Is,!1),this.refs["http://json-schema.org/schema"]=Is}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Is)?Is:void 0)}};_e.Ajv=zn;Pf.exports=_e=zn;Pf.exports.Ajv=zn;Object.defineProperty(_e,"__esModule",{value:!0});_e.default=zn;var wE=ri();Object.defineProperty(_e,"KeywordCxt",{enumerable:!0,get:function(){return wE.KeywordCxt}});var In=W();Object.defineProperty(_e,"_",{enumerable:!0,get:function(){return In._}});Object.defineProperty(_e,"str",{enumerable:!0,get:function(){return In.str}});Object.defineProperty(_e,"stringify",{enumerable:!0,get:function(){return In.stringify}});Object.defineProperty(_e,"nil",{enumerable:!0,get:function(){return In.nil}});Object.defineProperty(_e,"Name",{enumerable:!0,get:function(){return In.Name}});Object.defineProperty(_e,"CodeGen",{enumerable:!0,get:function(){return In.CodeGen}});var SE=os();Object.defineProperty(_e,"ValidationError",{enumerable:!0,get:function(){return SE.default}});var zE=ni();Object.defineProperty(_e,"MissingRefError",{enumerable:!0,get:function(){return zE.default}})});var a$=j(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.formatNames=Et.fastFormats=Et.fullFormats=void 0;function jt(e,t){return{validate:e,compare:t}}Et.fullFormats={date:jt(r$,Nf),time:jt(Tf(!0),Df),"date-time":jt(Q_(!0),o$),"iso-time":jt(Tf(),n$),"iso-date-time":jt(Q_(),i$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:OE,"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:UE,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:NE,int32:{type:"number",validate:CE},int64:{type:"number",validate:AE},float:{type:"number",validate:t$},double:{type:"number",validate:t$},password:!0,binary:!0};Et.fastFormats={...Et.fullFormats,date:jt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Nf),time:jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Df),"date-time":jt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,o$),"iso-time":jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,n$),"iso-date-time":jt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,i$),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};Et.formatNames=Object.keys(Et.fullFormats);function IE(e){return e%4===0&&(e%100!==0||e%400===0)}var PE=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,jE=[0,31,28,31,30,31,30,31,31,30,31,30,31];function r$(e){let t=PE.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&&IE(r)?29:jE[n])}function Nf(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Ef=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Tf(e){return function(r){let n=Ef.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,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function Df(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 n$(e,t){if(!(e&&t))return;let r=Ef.exec(e),n=Ef.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 Of=/t|\s/i;function Q_(e){let t=Tf(e);return function(n){let o=n.split(Of);return o.length===2&&r$(o[0])&&t(o[1])}}function o$(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function i$(e,t){if(!(e&&t))return;let[r,n]=e.split(Of),[o,i]=t.split(Of),a=Nf(r,o);if(a!==void 0)return a||Df(n,i)}var EE=/\/|:/,TE=/^(?:[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 OE(e){return EE.test(e)&&TE.test(e)}var e$=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function NE(e){return e$.lastIndex=0,e$.test(e)}var DE=-(2**31),RE=2**31-1;function CE(e){return Number.isInteger(e)&&e<=RE&&e>=DE}function AE(e){return Number.isInteger(e)}function t$(){return!0}var ZE=/[^\\]\\Z/;function UE(e){if(ZE.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var s$=j(Pn=>{"use strict";Object.defineProperty(Pn,"__esModule",{value:!0});Pn.formatLimitDefinition=void 0;var ME=jf(),xt=W(),dr=xt.operators,Ps={formatMaximum:{okStr:"<=",ok:dr.LTE,fail:dr.GT},formatMinimum:{okStr:">=",ok:dr.GTE,fail:dr.LT},formatExclusiveMaximum:{okStr:"<",ok:dr.LT,fail:dr.GTE},formatExclusiveMinimum:{okStr:">",ok:dr.GT,fail:dr.LTE}},FE={message:({keyword:e,schemaCode:t})=>(0,xt.str)`should be ${Ps[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,xt._)`{comparison: ${Ps[e].okStr}, limit: ${t}}`};Pn.formatLimitDefinition={keyword:Object.keys(Ps),type:"string",schemaType:"string",$data:!0,error:FE,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 ME.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,xt._)`${f}[${c.schemaCode}]`);e.fail$data((0,xt.or)((0,xt._)`typeof ${p} != "object"`,(0,xt._)`${p} instanceof RegExp`,(0,xt._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=s.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let m=t.scopeValue("formats",{key:f,ref:p,code:a.code.formats?(0,xt._)`${a.code.formats}${(0,xt.getProperty)(f)}`:void 0});e.fail$data(d(m))}function d(f){return(0,xt._)`${f}.compare(${r}, ${n}) ${Ps[o].fail} 0`}},dependencies:["format"]};var LE=e=>(e.addKeyword(Pn.formatLimitDefinition),e);Pn.default=LE});var d$=j((_i,l$)=>{"use strict";Object.defineProperty(_i,"__esModule",{value:!0});var jn=a$(),qE=s$(),Rf=W(),c$=new Rf.Name("fullFormats"),VE=new Rf.Name("fastFormats"),Cf=(e,t={keywords:!0})=>{if(Array.isArray(t))return u$(e,t,jn.fullFormats,c$),e;let[r,n]=t.mode==="fast"?[jn.fastFormats,VE]:[jn.fullFormats,c$],o=t.formats||jn.formatNames;return u$(e,o,r,n),t.keywords&&(0,qE.default)(e),e};Cf.get=(e,t="full")=>{let n=(t==="fast"?jn.fastFormats:jn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function u$(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,Rf._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}l$.exports=_i=Cf;Object.defineProperty(_i,"__esModule",{value:!0});_i.default=Cf});var ze=it(require("path")),Zr=it(require("fs")),P$=it(require("os"));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 Vf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Vf||(Vf={}));var E=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tt=e=>{switch(typeof e){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(e)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(e)?E.array:e===null?E.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?E.promise:typeof Map<"u"&&e instanceof Map?E.map:typeof Set<"u"&&e instanceof Set?E.set:typeof Date<"u"&&e instanceof Date?E.date:E.object;default:return E.unknown}};var k=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 Qe=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()}};Qe.create=e=>new Qe(e);var A$=(e,t)=>{let r;switch(e.code){case k.invalid_type:e.received===E.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case k.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case k.invalid_union:r="Invalid input";break;case k.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case k.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case k.invalid_arguments:r="Invalid function arguments";break;case k.invalid_return_type:r="Invalid function return type";break;case k.invalid_date:r="Invalid date";break;case k.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 k.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 k.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 k.custom:r="Invalid input";break;case k.invalid_intersection_types:r="Intersection results could not be merged";break;case k.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case k.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},Kt=A$;var Z$=Kt;function Dn(){return Z$}var ki=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 I(e,t){let r=Dn(),n=ki({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Kt?void 0:Kt].filter(o=>!!o)});e.common.issues.push(n)}var De=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 F;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 F;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}}},F=Object.freeze({status:"aborted"}),Ur=e=>({status:"dirty",value:e}),Fe=e=>({status:"valid",value:e}),Zs=e=>e.status==="aborted",Us=e=>e.status==="dirty",mr=e=>e.status==="valid",Rn=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 at=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}},Jf=(e,t)=>{if(mr(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 Qe(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 Tt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new De,ctx:{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Rn(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:Tt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Jf(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return mr(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=>mr(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:Tt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Rn(o)?o:Promise.resolve(o));return Jf(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:k.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 gt({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 ht.create(this,this._def)}nullable(){return Dt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ht.create(this)}promise(){return hr.create(this,this._def)}or(t){return Vr.create([this,t],this._def)}and(t){return Jr.create(this,t,this._def)}transform(t){return new gt({...J(this._def),schema:this,typeName:Z.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Gr({...J(this._def),innerType:this,defaultValue:r,typeName:Z.ZodDefault})}brand(){return new wi({typeName:Z.ZodBranded,type:this,...J(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Xr({...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 Si.create(this,t)}readonly(){return Yr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},U$=/^c[^\s-]{8,}$/i,M$=/^[0-9a-z]+$/,F$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,L$=/^[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,q$=/^[a-z0-9_-]{21}$/i,V$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,J$=/^[-+]?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)?)??$/,K$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,B$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ms,H$=/^(?:(?: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])$/,W$=/^(?:(?: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])$/,G$=/^(([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]))$/,X$=/^(([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])$/,Y$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Q$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Kf="((\\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])))",eb=new RegExp(`^${Kf}$`);function Bf(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 tb(e){return new RegExp(`^${Bf(e)}$`)}function rb(e){let t=`${Kf}T${Bf(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 nb(e,t){return!!((t==="v4"||!t)&&H$.test(e)||(t==="v6"||!t)&&G$.test(e))}function ob(e,t){if(!V$.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 ib(e,t){return!!((t==="v4"||!t)&&W$.test(e)||(t==="v6"||!t)&&X$.test(e))}var Fr=class e extends G{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==E.string){let i=this._getOrReturnCtx(t);return I(i,{code:k.invalid_type,expected:E.string,received:i.parsedType}),F}let n=new De,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),I(o,{code:k.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),I(o,{code:k.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?I(o,{code:k.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&I(o,{code:k.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")K$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"email",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ms||(Ms=new RegExp(B$,"u")),Ms.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"emoji",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")L$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"uuid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")q$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"nanoid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")U$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"cuid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")M$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"cuid2",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")F$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"ulid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),I(o,{validation:"url",code:k.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),I(o,{validation:"regex",code:k.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),I(o,{code:k.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),I(o,{code:k.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),I(o,{code:k.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?rb(i).test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{code:k.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?eb.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{code:k.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?tb(i).test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{code:k.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?J$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"duration",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?nb(t.data,i.version)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"ip",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?ob(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"jwt",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?ib(t.data,i.version)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"cidr",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Y$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"base64",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Q$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"base64url",code:k.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:k.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}};Fr.create=e=>new Fr({checks:[],typeName:Z.ZodString,coerce:e?.coerce??!1,...J(e)});function ab(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 Cn=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)!==E.number){let i=this._getOrReturnCtx(t);return I(i,{code:k.invalid_type,expected:E.number,received:i.parsedType}),F}let n,o=new De;for(let i of this._def.checks)i.kind==="int"?ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),I(n,{code:k.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),I(n,{code:k.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),I(n,{code:k.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?ab(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),I(n,{code:k.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),I(n,{code:k.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)}};Cn.create=e=>new Cn({checks:[],typeName:Z.ZodNumber,coerce:e?.coerce||!1,...J(e)});var An=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)!==E.bigint)return this._getInvalidInput(t);let n,o=new De;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),I(n,{code:k.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),I(n,{code:k.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),I(n,{code:k.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 I(r,{code:k.invalid_type,expected:E.bigint,received:r.parsedType}),F}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}};An.create=e=>new An({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)!==E.boolean){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.boolean,received:n.parsedType}),F}return Fe(t.data)}};Zn.create=e=>new Zn({typeName:Z.ZodBoolean,coerce:e?.coerce||!1,...J(e)});var Un=class e extends G{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==E.date){let i=this._getOrReturnCtx(t);return I(i,{code:k.invalid_type,expected:E.date,received:i.parsedType}),F}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return I(i,{code:k.invalid_date}),F}let n=new De,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),I(o,{code:k.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),I(o,{code:k.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}};Un.create=e=>new Un({checks:[],coerce:e?.coerce||!1,typeName:Z.ZodDate,...J(e)});var Mn=class extends G{_parse(t){if(this._getType(t)!==E.symbol){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.symbol,received:n.parsedType}),F}return Fe(t.data)}};Mn.create=e=>new Mn({typeName:Z.ZodSymbol,...J(e)});var Lr=class extends G{_parse(t){if(this._getType(t)!==E.undefined){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.undefined,received:n.parsedType}),F}return Fe(t.data)}};Lr.create=e=>new Lr({typeName:Z.ZodUndefined,...J(e)});var qr=class extends G{_parse(t){if(this._getType(t)!==E.null){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.null,received:n.parsedType}),F}return Fe(t.data)}};qr.create=e=>new qr({typeName:Z.ZodNull,...J(e)});var Fn=class extends G{constructor(){super(...arguments),this._any=!0}_parse(t){return Fe(t.data)}};Fn.create=e=>new Fn({typeName:Z.ZodAny,...J(e)});var Bt=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Fe(t.data)}};Bt.create=e=>new Bt({typeName:Z.ZodUnknown,...J(e)});var kt=class extends G{_parse(t){let r=this._getOrReturnCtx(t);return I(r,{code:k.invalid_type,expected:E.never,received:r.parsedType}),F}};kt.create=e=>new kt({typeName:Z.ZodNever,...J(e)});var Ln=class extends G{_parse(t){if(this._getType(t)!==E.undefined){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.void,received:n.parsedType}),F}return Fe(t.data)}};Ln.create=e=>new Ln({typeName:Z.ZodVoid,...J(e)});var Ht=class e extends G{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==E.array)return I(r,{code:k.invalid_type,expected:E.array,received:r.parsedType}),F;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(I(r,{code:a?k.too_big:k.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&&(I(r,{code:k.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&&(I(r,{code:k.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 at(r,a,r.path,s)))).then(a=>De.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new at(r,a,r.path,s)));return De.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)}};Ht.create=(e,t)=>new Ht({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Z.ZodArray,...J(t)});function Mr(e){if(e instanceof et){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ht.create(Mr(n))}return new et({...e._def,shape:()=>t})}else return e instanceof Ht?new Ht({...e._def,type:Mr(e.element)}):e instanceof ht?ht.create(Mr(e.unwrap())):e instanceof Dt?Dt.create(Mr(e.unwrap())):e instanceof Nt?Nt.create(e.items.map(t=>Mr(t))):e}var et=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)!==E.object){let u=this._getOrReturnCtx(t);return I(u,{code:k.invalid_type,expected:E.object,received:u.parsedType}),F}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof kt&&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 at(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof kt){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&&(I(o,{code:k.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 at(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,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>De.mergeObjectSync(n,u)):De.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: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 Mr(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 ht;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Hf(ee.objectKeys(this.shape))}};et.create=(e,t)=>new et({shape:()=>e,unknownKeys:"strip",catchall:kt.create(),typeName:Z.ZodObject,...J(t)});et.strictCreate=(e,t)=>new et({shape:()=>e,unknownKeys:"strict",catchall:kt.create(),typeName:Z.ZodObject,...J(t)});et.lazycreate=(e,t)=>new et({shape:e,unknownKeys:"strip",catchall:kt.create(),typeName:Z.ZodObject,...J(t)});var Vr=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 Qe(s.ctx.common.issues));return I(r,{code:k.invalid_union,unionErrors:a}),F}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 Qe(c));return I(r,{code:k.invalid_union,unionErrors:s}),F}}get options(){return this._def.options}};Vr.create=(e,t)=>new Vr({options:e,typeName:Z.ZodUnion,...J(t)});var Ot=e=>e instanceof Kr?Ot(e.schema):e instanceof gt?Ot(e.innerType()):e instanceof Br?[e.value]:e instanceof Hr?e.options:e instanceof Wr?ee.objectValues(e.enum):e instanceof Gr?Ot(e._def.innerType):e instanceof Lr?[void 0]:e instanceof qr?[null]:e instanceof ht?[void 0,...Ot(e.unwrap())]:e instanceof Dt?[null,...Ot(e.unwrap())]:e instanceof wi||e instanceof Yr?Ot(e.unwrap()):e instanceof Xr?Ot(e._def.innerType):[],Fs=class e extends G{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.object)return I(r,{code:k.invalid_type,expected:E.object,received:r.parsedType}),F;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}):(I(r,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),F)}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:Z.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...J(n)})}};function Ls(e,t){let r=Tt(e),n=Tt(t);if(e===t)return{valid:!0,data:e};if(r===E.object&&n===E.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=Ls(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===E.array&&n===E.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=Ls(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===E.date&&n===E.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Jr=class extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Zs(i)||Zs(a))return F;let s=Ls(i.value,a.value);return s.valid?((Us(i)||Us(a))&&r.dirty(),{status:r.value,value:s.data}):(I(n,{code:k.invalid_intersection_types}),F)};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}))}};Jr.create=(e,t,r)=>new Jr({left:e,right:t,typeName:Z.ZodIntersection,...J(r)});var Nt=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.array)return I(n,{code:k.invalid_type,expected:E.array,received:n.parsedType}),F;if(n.data.length<this._def.items.length)return I(n,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&n.data.length>this._def.items.length&&(I(n,{code:k.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 at(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>De.mergeArray(r,a)):De.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Nt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Nt({items:e,typeName:Z.ZodTuple,rest:null,...J(t)})};var qs=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!==E.object)return I(n,{code:k.invalid_type,expected:E.object,received:n.parsedType}),F;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new at(n,s,n.path,s)),value:a._parse(new at(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?De.mergeObjectAsync(r,o):De.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:Z.ZodRecord,...J(n)}):new e({keyType:Fr.create(),valueType:t,typeName:Z.ZodRecord,...J(r)})}},qn=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!==E.map)return I(n,{code:k.invalid_type,expected:E.map,received:n.parsedType}),F;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new at(n,s,n.path,[u,"key"])),value:i._parse(new at(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 F;(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 F;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};qn.create=(e,t,r)=>new qn({valueType:t,keyType:e,typeName:Z.ZodMap,...J(r)});var Vn=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.set)return I(n,{code:k.invalid_type,expected:E.set,received:n.parsedType}),F;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(I(n,{code:k.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&&(I(n,{code:k.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 F;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 at(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)}};Vn.create=(e,t)=>new Vn({valueType:e,minSize:null,maxSize:null,typeName:Z.ZodSet,...J(t)});var Vs=class e extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.function)return I(r,{code:k.invalid_type,expected:E.function,received:r.parsedType}),F;function n(s,c){return ki({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Dn(),Kt].filter(u=>!!u),issueData:{code:k.invalid_arguments,argumentsError:c}})}function o(s,c){return ki({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Dn(),Kt].filter(u=>!!u),issueData:{code:k.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof hr){let s=this;return Fe(async function(...c){let u=new Qe([]),l=await s._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let s=this;return Fe(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Qe([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Qe([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:Nt.create(t).rest(Bt.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||Nt.create([]).rest(Bt.create()),returns:r||Bt.create(),typeName:Z.ZodFunction,...J(n)})}},Kr=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})}};Kr.create=(e,t)=>new Kr({getter:e,typeName:Z.ZodLazy,...J(t)});var Br=class extends G{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return I(r,{received:r.data,code:k.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:t.data}}get value(){return this._def.value}};Br.create=(e,t)=>new Br({value:e,typeName:Z.ZodLiteral,...J(t)});function Hf(e,t){return new Hr({values:e,typeName:Z.ZodEnum,...J(t)})}var Hr=class e extends G{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return I(r,{expected:ee.joinValues(n),received:r.parsedType,code:k.invalid_type}),F}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 I(r,{received:r.data,code:k.invalid_enum_value,options:n}),F}return Fe(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})}};Hr.create=Hf;var Wr=class extends G{_parse(t){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==E.string&&n.parsedType!==E.number){let o=ee.objectValues(r);return I(n,{expected:ee.joinValues(o),received:n.parsedType,code:k.invalid_type}),F}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=ee.objectValues(r);return I(n,{received:n.data,code:k.invalid_enum_value,options:o}),F}return Fe(t.data)}get enum(){return this._def.values}};Wr.create=(e,t)=>new Wr({values:e,typeName:Z.ZodNativeEnum,...J(t)});var hr=class extends G{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.promise&&r.common.async===!1)return I(r,{code:k.invalid_type,expected:E.promise,received:r.parsedType}),F;let n=r.parsedType===E.promise?r.data:Promise.resolve(r.data);return Fe(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};hr.create=(e,t)=>new hr({type:e,typeName:Z.ZodPromise,...J(t)});var gt=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),o=this._def.effect||null,i={addIssue:a=>{I(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 F;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?F:c.status==="dirty"?Ur(c.value):r.value==="dirty"?Ur(c.value):c});{if(r.value==="aborted")return F;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?F:s.status==="dirty"?Ur(s.value):r.value==="dirty"?Ur(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"?F:(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"?F:(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(!mr(a))return F;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=>mr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):F);ee.assertNever(o)}};gt.create=(e,t,r)=>new gt({schema:e,typeName:Z.ZodEffects,effect:t,...J(r)});gt.createWithPreprocess=(e,t,r)=>new gt({schema:t,effect:{type:"preprocess",transform:e},typeName:Z.ZodEffects,...J(r)});var ht=class extends G{_parse(t){return this._getType(t)===E.undefined?Fe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ht.create=(e,t)=>new ht({innerType:e,typeName:Z.ZodOptional,...J(t)});var Dt=class extends G{_parse(t){return this._getType(t)===E.null?Fe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Dt.create=(e,t)=>new Dt({innerType:e,typeName:Z.ZodNullable,...J(t)});var Gr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===E.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Gr.create=(e,t)=>new Gr({innerType:e,typeName:Z.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});var Xr=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 Rn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Qe(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Qe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Xr.create=(e,t)=>new Xr({innerType:e,typeName:Z.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});var Jn=class extends G{_parse(t){if(this._getType(t)!==E.nan){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.nan,received:n.parsedType}),F}return{status:"valid",value:t.data}}};Jn.create=e=>new Jn({typeName:Z.ZodNaN,...J(e)});var wi=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}},Si=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"?F:i.status==="dirty"?(r.dirty(),Ur(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"?F: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:Z.ZodPipeline})}},Yr=class extends G{_parse(t){let r=this._def.innerType._parse(t),n=o=>(mr(o)&&(o.value=Object.freeze(o.value)),o);return Rn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Yr.create=(e,t)=>new Yr({innerType:e,typeName:Z.ZodReadonly,...J(t)});var TT={object:et.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 OT=Fr.create,NT=Cn.create,DT=Jn.create,RT=An.create,CT=Zn.create,AT=Un.create,ZT=Mn.create,UT=Lr.create,MT=qr.create,FT=Fn.create,LT=Bt.create,qT=kt.create,VT=Ln.create,JT=Ht.create,sb=et.create,KT=et.strictCreate,BT=Vr.create,HT=Fs.create,WT=Jr.create,GT=Nt.create,XT=qs.create,YT=qn.create,QT=Vn.create,eO=Vs.create,tO=Kr.create,rO=Br.create,nO=Hr.create,oO=Wr.create,iO=hr.create,aO=gt.create,sO=ht.create,cO=Dt.create,uO=gt.createWithPreprocess,lO=Si.create;var Wf=Object.freeze({status:"aborted"});function v(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 f=l[d];f in s||(s[f]=u[f].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 wt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},gr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},zi={};function we(e){return e&&Object.assign(zi,e),zi}var w={};Nn(w,{BIGINT_FORMAT_RANGES:()=>ec,Class:()=>Ks,NUMBER_FORMAT_RANGES:()=>Qs,aborted:()=>Yt,allowsEval:()=>Ws,assert:()=>mb,assertEqual:()=>lb,assertIs:()=>pb,assertNever:()=>fb,assertNotEqual:()=>db,assignProp:()=>Gt,base64ToUint8Array:()=>nm,base64urlToUint8Array:()=>Sb,cached:()=>en,captureStackTrace:()=>Pi,cleanEnum:()=>wb,cleanRegex:()=>Hn,clone:()=>Le,cloneDef:()=>gb,createTransparentProxy:()=>xb,defineLazy:()=>K,esc:()=>Ii,escapeRegex:()=>st,extend:()=>Qf,finalizeIssue:()=>He,floatSafeRemainder:()=>Bs,getElementAtPath:()=>vb,getEnumValues:()=>Bn,getLengthableOrigin:()=>Xn,getParsedType:()=>bb,getSizableOrigin:()=>Gn,hexToUint8Array:()=>Ib,isObject:()=>vr,isPlainObject:()=>Xt,issue:()=>tn,joinValues:()=>U,jsonStringifyReplacer:()=>Qr,merge:()=>kb,mergeDefs:()=>Rt,normalizeParams:()=>P,nullish:()=>Wt,numKeys:()=>$b,objectClone:()=>hb,omit:()=>Yf,optionalKeys:()=>Ys,parsedType:()=>L,partial:()=>tm,pick:()=>Xf,prefixIssues:()=>tt,primitiveTypes:()=>Xs,promiseAllObject:()=>yb,propertyKeyTypes:()=>Wn,randomString:()=>_b,required:()=>rm,safeExtend:()=>em,shallowClone:()=>Gs,slugify:()=>Hs,stringifyPrimitive:()=>M,uint8ArrayToBase64:()=>om,uint8ArrayToBase64url:()=>zb,uint8ArrayToHex:()=>Pb,unwrapMessage:()=>Kn});function lb(e){return e}function db(e){return e}function pb(e){}function fb(e){throw new Error("Unexpected value in exhaustive check")}function mb(e){}function Bn(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 U(e,t="|"){return e.map(r=>M(r)).join(t)}function Qr(e,t){return typeof t=="bigint"?t.toString():t}function en(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Wt(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 Bs(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 Gf=Symbol("evaluating");function K(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Gf)return n===void 0&&(n=Gf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function hb(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Gt(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 gb(e){return Rt(e._zod.def)}function vb(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function yb(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 _b(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Ii(e){return JSON.stringify(e)}function Hs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Pi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function vr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ws=en(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Xt(e){if(vr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(vr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Gs(e){return Xt(e)?{...e}:Array.isArray(e)?[...e]:e}function $b(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var bb=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}`)}},Wn=new Set(["string","number","symbol"]),Xs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function st(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Le(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function P(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 xb(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 M(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ys(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Qs={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]},ec={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Xf(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 Gt(this,"shape",a),a},checks:[]});return Le(e,i)}function Yf(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 Gt(this,"shape",a),a},checks:[]});return Le(e,i)}function Qf(e,t){if(!Xt(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 Gt(this,"shape",i),i}});return Le(e,o)}function em(e,t){if(!Xt(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 Gt(this,"shape",n),n}});return Le(e,r)}function kb(e,t){let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Gt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Le(e,r)}function tm(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 Gt(this,"shape",c),c},checks:[]});return Le(t,a)}function rm(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 Gt(this,"shape",i),i}});return Le(t,n)}function Yt(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 tt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Kn(e){return typeof e=="string"?e:e?.message}function He(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Kn(e.inst?._zod.def?.error?.(e))??Kn(t?.error?.(e))??Kn(r.customError?.(e))??Kn(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Gn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Xn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function L(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 tn(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function wb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function nm(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 om(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Sb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return nm(t+r)}function zb(e){return om(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ib(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 Pb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ks=class{constructor(...t){}};var im=(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,Qr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ji=v("$ZodError",im),Yn=v("$ZodError",im,{Parent:Error});function Ei(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 Ti(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 Qn=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 wt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>He(c,i,we())));throw Pi(s,o?.callee),s}return a.value},eo=Qn(Yn),to=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,we())));throw Pi(s,o?.callee),s}return a.value},ro=to(Yn),no=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 wt;return i.issues.length?{success:!1,error:new(e??ji)(i.issues.map(a=>He(a,o,we())))}:{success:!0,data:i.value}},rn=no(Yn),oo=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,we())))}:{success:!0,data:i.value}},io=oo(Yn),am=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Qn(e)(t,r,o)};var sm=e=>(t,r,n)=>Qn(e)(t,r,n);var cm=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return to(e)(t,r,o)};var um=e=>async(t,r,n)=>to(e)(t,r,n);var lm=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return no(e)(t,r,o)};var dm=e=>(t,r,n)=>no(e)(t,r,n);var pm=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return oo(e)(t,r,o)};var fm=e=>async(t,r,n)=>oo(e)(t,r,n);var ct={};Nn(ct,{base64:()=>gc,base64url:()=>Oi,bigint:()=>xc,boolean:()=>wc,browserEmail:()=>Ab,cidrv4:()=>mc,cidrv6:()=>hc,cuid:()=>tc,cuid2:()=>rc,date:()=>yc,datetime:()=>$c,domain:()=>Mb,duration:()=>sc,e164:()=>vc,email:()=>uc,emoji:()=>lc,extendedDuration:()=>Eb,guid:()=>cc,hex:()=>Fb,hostname:()=>Ub,html5Email:()=>Db,idnEmail:()=>Cb,integer:()=>kc,ipv4:()=>dc,ipv6:()=>pc,ksuid:()=>ic,lowercase:()=>Ic,mac:()=>fc,md5_base64:()=>qb,md5_base64url:()=>Vb,md5_hex:()=>Lb,nanoid:()=>ac,null:()=>Sc,number:()=>Ni,rfc5322Email:()=>Rb,sha1_base64:()=>Kb,sha1_base64url:()=>Bb,sha1_hex:()=>Jb,sha256_base64:()=>Wb,sha256_base64url:()=>Gb,sha256_hex:()=>Hb,sha384_base64:()=>Yb,sha384_base64url:()=>Qb,sha384_hex:()=>Xb,sha512_base64:()=>tx,sha512_base64url:()=>rx,sha512_hex:()=>ex,string:()=>bc,time:()=>_c,ulid:()=>nc,undefined:()=>zc,unicodeEmail:()=>mm,uppercase:()=>Pc,uuid:()=>yr,uuid4:()=>Tb,uuid6:()=>Ob,uuid7:()=>Nb,xid:()=>oc});var tc=/^[cC][^\s-]{8,}$/,rc=/^[0-9a-z]+$/,nc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,oc=/^[0-9a-vA-V]{20}$/,ic=/^[A-Za-z0-9]{27}$/,ac=/^[a-zA-Z0-9_-]{21}$/,sc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Eb=/^[-+]?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)?)??$/,cc=/^([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})$/,yr=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)$/,Tb=yr(4),Ob=yr(6),Nb=yr(7),uc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Db=/^[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])?)*$/,Rb=/^(([^<>()\[\]\\.,;:\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,}))$/,mm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Cb=mm,Ab=/^[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])?)*$/,Zb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function lc(){return new RegExp(Zb,"u")}var dc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pc=/^(([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}|:))$/,fc=e=>{let t=st(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},mc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,hc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,gc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Oi=/^[A-Za-z0-9_-]*$/,Ub=/^(?=.{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])?)*\.?$/,Mb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,vc=/^\+[1-9]\d{6,14}$/,hm="(?:(?:\\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])))",yc=new RegExp(`^${hm}$`);function gm(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 _c(e){return new RegExp(`^${gm(e)}$`)}function $c(e){let t=gm({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(`^${hm}T(?:${n})$`)}var bc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},xc=/^-?\d+n?$/,kc=/^-?\d+$/,Ni=/^-?\d+(?:\.\d+)?$/,wc=/^(?:true|false)$/i,Sc=/^null$/i;var zc=/^undefined$/i;var Ic=/^[^A-Z]*$/,Pc=/^[^a-z]*$/,Fb=/^[0-9a-fA-F]*$/;function ao(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function so(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Lb=/^[0-9a-fA-F]{32}$/,qb=ao(22,"=="),Vb=so(22),Jb=/^[0-9a-fA-F]{40}$/,Kb=ao(27,"="),Bb=so(27),Hb=/^[0-9a-fA-F]{64}$/,Wb=ao(43,"="),Gb=so(43),Xb=/^[0-9a-fA-F]{96}$/,Yb=ao(64,""),Qb=so(64),ex=/^[0-9a-fA-F]{128}$/,tx=ao(86,"=="),rx=so(86);var de=v("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ym={number:"number",bigint:"bigint",object:"date"},jc=v("$ZodCheckLessThan",(e,t)=>{de.init(e,t);let r=ym[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})}}),Ec=v("$ZodCheckGreaterThan",(e,t)=>{de.init(e,t);let r=ym[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})}}),_m=v("$ZodCheckMultipleOf",(e,t)=>{de.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):Bs(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})}}),$m=v("$ZodCheckNumberFormat",(e,t)=>{de.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Qs[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=kc)}),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})}}),bm=v("$ZodCheckBigIntFormat",(e,t)=>{de.init(e,t);let[r,n]=ec[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})}}),xm=v("$ZodCheckMaxSize",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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:Gn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),km=v("$ZodCheckMinSize",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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:Gn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),wm=v("$ZodCheckSizeEquals",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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:Gn(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})}}),Sm=v("$ZodCheckMaxLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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=Xn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zm=v("$ZodCheckMinLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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=Xn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Im=v("$ZodCheckLengthEquals",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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=Xn(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})}}),co=v("$ZodCheckStringFormat",(e,t)=>{var r,n;de.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=()=>{})}),Pm=v("$ZodCheckRegex",(e,t)=>{co.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})}}),jm=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ic),co.init(e,t)}),Em=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Pc),co.init(e,t)}),Tm=v("$ZodCheckIncludes",(e,t)=>{de.init(e,t);let r=st(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})}}),Om=v("$ZodCheckStartsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`^${st(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})}}),Nm=v("$ZodCheckEndsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`.*${st(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 vm(e,t,r){e.issues.length&&t.issues.push(...tt(r,e.issues))}var Dm=v("$ZodCheckProperty",(e,t)=>{de.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=>vm(o,r,t.property));vm(n,r,t.property)}}),Rm=v("$ZodCheckMimeType",(e,t)=>{de.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})}}),Cm=v("$ZodCheckOverwrite",(e,t)=>{de.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Di=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(`
9
+ deps: ${r}}`};var wj={keyword:"dependencies",type:"object",schemaType:"object",error:Pt.error,code(e){let[t,r]=Sj(e);k_(e,t),w_(e,r)}};function Sj({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 k_(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,_i.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,_i.checkReportMissingProp)(e,u)}):(r.if((0,pf._)`${c} && (${(0,_i.checkMissingProp)(e,s,i)})`),(0,_i.reportMissingProp)(e,i),r.else())}}Pt.validatePropertyDeps=k_;function w_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,kj.alwaysValidSchema)(i,t[s])||(r.if((0,_i.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))}Pt.validateSchemaDeps=w_;Pt.default=wj});var I_=j(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});var z_=W(),zj=ne(),Ij={message:"property name must be valid",params:({params:e})=>(0,z_._)`{propertyName: ${e.propertyName}}`},Pj={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Ij,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,zj.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,z_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};ff.default=Pj});var hf=j(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var ks=pt(),bt=W(),jj=qt(),ws=ne(),Ej={message:"must NOT have additional properties",params:({params:e})=>(0,bt._)`{additionalProperty: ${e.additionalProperty}}`},Tj={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Ej,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,ws.alwaysValidSchema)(a,r))return;let u=(0,ks.allSchemaProperties)(n.properties),l=(0,ks.allSchemaProperties)(n.patternProperties);d(),e.ok((0,bt._)`${i} === ${jj.default.errors}`);function d(){t.forIn("key",o,m=>{!u.length&&!l.length?g(m):t.if(f(m),()=>g(m))})}function f(m){let y;if(u.length>8){let _=(0,ws.schemaRefOrVal)(a,n.properties,"properties");y=(0,ks.isOwnProperty)(t,_,m)}else u.length?y=(0,bt.or)(...u.map(_=>(0,bt._)`${m} === ${_}`)):y=bt.nil;return l.length&&(y=(0,bt.or)(y,...l.map(_=>(0,bt._)`${(0,ks.usePattern)(e,_)}.test(${m})`))),(0,bt.not)(y)}function p(m){t.code((0,bt._)`delete ${o}[${m}]`)}function g(m){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(m);return}if(r===!1){e.setParams({additionalProperty:m}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,ws.alwaysValidSchema)(a,r)){let y=t.name("valid");c.removeAdditional==="failing"?(h(m,y,!1),t.if((0,bt.not)(y),()=>{e.reset(),p(m)})):(h(m,y),s||t.if((0,bt.not)(y),()=>t.break()))}}function h(m,y,_){let b={keyword:"additionalProperties",dataProp:m,dataPropType:ws.Type.Str};_===!1&&Object.assign(b,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(b,y)}}};mf.default=Tj});var E_=j(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var Oj=ni(),P_=pt(),gf=ne(),j_=hf(),Nj={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&&j_.default.code(new Oj.KeywordCxt(i,j_.default,"additionalProperties"));let a=(0,P_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=gf.mergeEvaluated.props(t,(0,gf.toHash)(a),i.props));let s=a.filter(d=>!(0,gf.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,P_.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)}}};vf.default=Nj});var D_=j(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var T_=pt(),Ss=W(),O_=ne(),N_=ne(),Dj={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,T_.allSchemaProperties)(r),c=s.filter(h=>(0,O_.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 Ss.Name)&&(i.props=(0,N_.evaluatedPropsToName)(t,i.props));let{props:d}=i;f();function f(){for(let h of s)u&&p(h),i.allErrors?g(h):(t.var(l,!0),g(h),t.if(l))}function p(h){for(let m in u)new RegExp(h).test(m)&&(0,O_.checkStrictMode)(i,`property ${m} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){t.forIn("key",n,m=>{t.if((0,Ss._)`${(0,T_.usePattern)(e,h)}.test(${m})`,()=>{let y=c.includes(h);y||e.subschema({keyword:"patternProperties",schemaProp:h,dataProp:m,dataPropType:N_.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,Ss._)`${d}[${m}]`,!0):!y&&!i.allErrors&&t.if((0,Ss.not)(l),()=>t.break())})})}}};yf.default=Dj});var R_=j(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Rj=ne(),Cj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,Rj.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"}};_f.default=Cj});var C_=j($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var Zj=pt(),Aj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Zj.validateUnion,error:{message:"must match a schema in anyOf"}};$f.default=Aj});var Z_=j(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var zs=W(),Uj=ne(),Mj={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,zs._)`{passingSchemas: ${e.passing}}`},Fj={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Mj,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 f;(0,Uj.alwaysValidSchema)(o,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,zs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,zs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),f&&e.mergeEvaluated(f,zs.Name)})})}}};bf.default=Fj});var A_=j(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});var Lj=ne(),qj={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,Lj.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};xf.default=qj});var F_=j(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});var Is=W(),M_=ne(),Vj={message:({params:e})=>(0,Is.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,Is._)`{failingKeyword: ${e.ifClause}}`},Jj={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Vj,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,M_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=U_(n,"then"),i=U_(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,Is.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 f=e.subschema({keyword:l},s);t.assign(a,s),e.mergeValidEvaluated(f,a),d?t.assign(d,(0,Is._)`${l}`):e.setParams({ifClause:l})}}}};function U_(e,t){let r=e.schema[t];return r!==void 0&&!(0,M_.alwaysValidSchema)(e,r)}kf.default=Jj});var L_=j(wf=>{"use strict";Object.defineProperty(wf,"__esModule",{value:!0});var Kj=ne(),Hj={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,Kj.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};wf.default=Hj});var q_=j(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});var Bj=sf(),Wj=__(),Gj=cf(),Xj=b_(),Yj=x_(),Qj=S_(),eE=I_(),tE=hf(),rE=E_(),nE=D_(),oE=R_(),iE=C_(),aE=Z_(),sE=A_(),cE=F_(),uE=L_();function lE(e=!1){let t=[oE.default,iE.default,aE.default,sE.default,cE.default,uE.default,eE.default,tE.default,Qj.default,rE.default,nE.default];return e?t.push(Wj.default,Xj.default):t.push(Bj.default,Gj.default),t.push(Yj.default),t}Sf.default=lE});var V_=j(zf=>{"use strict";Object.defineProperty(zf,"__esModule",{value:!0});var be=W(),dE={message:({schemaCode:e})=>(0,be.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,be._)`{format: ${e}}`},pE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:dE,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?f():p();function f(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,be._)`${g}[${a}]`),m=r.let("fType"),y=r.let("format");r.if((0,be._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(m,(0,be._)`${h}.type || "string"`).assign(y,(0,be._)`${h}.validate`),()=>r.assign(m,(0,be._)`"string"`).assign(y,h)),e.fail$data((0,be.or)(_(),b()));function _(){return c.strictSchema===!1?be.nil:(0,be._)`${a} && !${y}`}function b(){let S=l.$async?(0,be._)`(${h}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,be._)`${y}(${n})`,z=(0,be._)`(typeof ${y} == "function" ? ${S} : ${y}.test(${n}))`;return(0,be._)`${y} && ${y} !== true && ${m} === ${t} && !${z}`}}function p(){let g=d.formats[i];if(!g){_();return}if(g===!0)return;let[h,m,y]=b(g);h===t&&e.pass(S());function _(){if(c.strictSchema===!1){d.logger.warn(z());return}throw new Error(z());function z(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function b(z){let te=z instanceof RegExp?(0,be.regexpCode)(z):c.code.formats?(0,be._)`${c.code.formats}${(0,be.getProperty)(i)}`:void 0,ae=r.scopeValue("formats",{key:i,ref:z,code:te});return typeof z=="object"&&!(z instanceof RegExp)?[z.type||"string",z.validate,(0,be._)`${ae}.validate`]:["string",z,ae]}function S(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,be._)`await ${y}(${n})`}return typeof m=="function"?(0,be._)`${y}(${n})`:(0,be._)`${y}.test(${n})`}}}};zf.default=pE});var J_=j(If=>{"use strict";Object.defineProperty(If,"__esModule",{value:!0});var fE=V_(),mE=[fE.default];If.default=mE});var K_=j(Sn=>{"use strict";Object.defineProperty(Sn,"__esModule",{value:!0});Sn.contentVocabulary=Sn.metadataVocabulary=void 0;Sn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Sn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var B_=j(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});var hE=t_(),gE=h_(),vE=q_(),yE=J_(),H_=K_(),_E=[hE.default,gE.default,(0,vE.default)(),yE.default,H_.metadataVocabulary,H_.contentVocabulary];Pf.default=_E});var G_=j(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.DiscrError=void 0;var W_;(function(e){e.Tag="tag",e.Mapping="mapping"})(W_||(Ps.DiscrError=W_={}))});var Y_=j(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});var zn=W(),jf=G_(),X_=ss(),$E=oi(),bE=ne(),xE={message:({params:{discrError:e,tagName:t}})=>e===jf.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,zn._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},kE={keyword:"discriminator",type:"object",schemaType:"object",error:xE,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,zn._)`${r}${(0,zn.getProperty)(s)}`);t.if((0,zn._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:jf.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=f();t.if(!1);for(let g in p)t.elseIf((0,zn._)`${u} === ${g}`),t.assign(c,d(p[g]));t.else(),e.error(!1,{discrError:jf.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let g=t.name("valid"),h=e.subschema({keyword:"oneOf",schemaProp:p},g);return e.mergeEvaluated(h,zn.Name),g}function f(){var p;let g={},h=y(o),m=!0;for(let S=0;S<a.length;S++){let z=a[S];if(z?.$ref&&!(0,bE.schemaHasRulesButRef)(z,i.self.RULES)){let ae=z.$ref;if(z=X_.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,ae),z instanceof X_.SchemaEnv&&(z=z.schema),z===void 0)throw new $E.default(i.opts.uriResolver,i.baseId,ae)}let te=(p=z?.properties)===null||p===void 0?void 0:p[s];if(typeof te!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);m=m&&(h||y(z)),_(te,S)}if(!m)throw new Error(`discriminator: "${s}" must be required`);return g;function y({required:S}){return Array.isArray(S)&&S.includes(s)}function _(S,z){if(S.const)b(S.const,z);else if(S.enum)for(let te of S.enum)b(te,z);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function b(S,z){if(typeof S!="string"||S in g)throw new Error(`discriminator: "${s}" values must be unique strings`);g[S]=z}}}};Ef.default=kE});var Q_=j((BU,wE)=>{wE.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Of=j((_e,Tf)=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.MissingRefError=_e.ValidationError=_e.CodeGen=_e.Name=_e.nil=_e.stringify=_e.str=_e._=_e.KeywordCxt=_e.Ajv=void 0;var SE=Wy(),zE=B_(),IE=Y_(),e$=Q_(),PE=["/properties"],js="http://json-schema.org/draft-07/schema",In=class extends SE.default{_addVocabularies(){super._addVocabularies(),zE.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(IE.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(e$,PE):e$;this.addMetaSchema(t,js,!1),this.refs["http://json-schema.org/schema"]=js}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(js)?js:void 0)}};_e.Ajv=In;Tf.exports=_e=In;Tf.exports.Ajv=In;Object.defineProperty(_e,"__esModule",{value:!0});_e.default=In;var jE=ni();Object.defineProperty(_e,"KeywordCxt",{enumerable:!0,get:function(){return jE.KeywordCxt}});var Pn=W();Object.defineProperty(_e,"_",{enumerable:!0,get:function(){return Pn._}});Object.defineProperty(_e,"str",{enumerable:!0,get:function(){return Pn.str}});Object.defineProperty(_e,"stringify",{enumerable:!0,get:function(){return Pn.stringify}});Object.defineProperty(_e,"nil",{enumerable:!0,get:function(){return Pn.nil}});Object.defineProperty(_e,"Name",{enumerable:!0,get:function(){return Pn.Name}});Object.defineProperty(_e,"CodeGen",{enumerable:!0,get:function(){return Pn.CodeGen}});var EE=is();Object.defineProperty(_e,"ValidationError",{enumerable:!0,get:function(){return EE.default}});var TE=oi();Object.defineProperty(_e,"MissingRefError",{enumerable:!0,get:function(){return TE.default}})});var c$=j(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.formatNames=Et.fastFormats=Et.fullFormats=void 0;function jt(e,t){return{validate:e,compare:t}}Et.fullFormats={date:jt(o$,Cf),time:jt(Df(!0),Zf),"date-time":jt(t$(!0),a$),"iso-time":jt(Df(),i$),"iso-date-time":jt(t$(),s$),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:ZE,"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:VE,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:AE,int32:{type:"number",validate:FE},int64:{type:"number",validate:LE},float:{type:"number",validate:n$},double:{type:"number",validate:n$},password:!0,binary:!0};Et.fastFormats={...Et.fullFormats,date:jt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Cf),time:jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Zf),"date-time":jt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,a$),"iso-time":jt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,i$),"iso-date-time":jt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,s$),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};Et.formatNames=Object.keys(Et.fullFormats);function OE(e){return e%4===0&&(e%100!==0||e%400===0)}var NE=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,DE=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o$(e){let t=NE.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&&OE(r)?29:DE[n])}function Cf(e,t){if(e&&t)return e>t?1:e<t?-1:0}var Nf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Df(e){return function(r){let n=Nf.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,f=o-u*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&a<61}}function Zf(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 i$(e,t){if(!(e&&t))return;let r=Nf.exec(e),n=Nf.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 Rf=/t|\s/i;function t$(e){let t=Df(e);return function(n){let o=n.split(Rf);return o.length===2&&o$(o[0])&&t(o[1])}}function a$(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function s$(e,t){if(!(e&&t))return;let[r,n]=e.split(Rf),[o,i]=t.split(Rf),a=Cf(r,o);if(a!==void 0)return a||Zf(n,i)}var RE=/\/|:/,CE=/^(?:[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 ZE(e){return RE.test(e)&&CE.test(e)}var r$=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function AE(e){return r$.lastIndex=0,r$.test(e)}var UE=-(2**31),ME=2**31-1;function FE(e){return Number.isInteger(e)&&e<=ME&&e>=UE}function LE(e){return Number.isInteger(e)}function n$(){return!0}var qE=/[^\\]\\Z/;function VE(e){if(qE.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var u$=j(jn=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});jn.formatLimitDefinition=void 0;var JE=Of(),xt=W(),dr=xt.operators,Es={formatMaximum:{okStr:"<=",ok:dr.LTE,fail:dr.GT},formatMinimum:{okStr:">=",ok:dr.GTE,fail:dr.LT},formatExclusiveMaximum:{okStr:"<",ok:dr.LT,fail:dr.GTE},formatExclusiveMinimum:{okStr:">",ok:dr.GT,fail:dr.LTE}},KE={message:({keyword:e,schemaCode:t})=>(0,xt.str)`should be ${Es[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,xt._)`{comparison: ${Es[e].okStr}, limit: ${t}}`};jn.formatLimitDefinition={keyword:Object.keys(Es),type:"string",schemaType:"string",$data:!0,error:KE,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 JE.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let f=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),p=t.const("fmt",(0,xt._)`${f}[${c.schemaCode}]`);e.fail$data((0,xt.or)((0,xt._)`typeof ${p} != "object"`,(0,xt._)`${p} instanceof RegExp`,(0,xt._)`typeof ${p}.compare != "function"`,d(p)))}function l(){let f=c.schema,p=s.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${o}": format "${f}" does not define "compare" function`);let g=t.scopeValue("formats",{key:f,ref:p,code:a.code.formats?(0,xt._)`${a.code.formats}${(0,xt.getProperty)(f)}`:void 0});e.fail$data(d(g))}function d(f){return(0,xt._)`${f}.compare(${r}, ${n}) ${Es[o].fail} 0`}},dependencies:["format"]};var HE=e=>(e.addKeyword(jn.formatLimitDefinition),e);jn.default=HE});var f$=j(($i,p$)=>{"use strict";Object.defineProperty($i,"__esModule",{value:!0});var En=c$(),BE=u$(),Af=W(),l$=new Af.Name("fullFormats"),WE=new Af.Name("fastFormats"),Uf=(e,t={keywords:!0})=>{if(Array.isArray(t))return d$(e,t,En.fullFormats,l$),e;let[r,n]=t.mode==="fast"?[En.fastFormats,WE]:[En.fullFormats,l$],o=t.formats||En.formatNames;return d$(e,o,r,n),t.keywords&&(0,BE.default)(e),e};Uf.get=(e,t="full")=>{let n=(t==="fast"?En.fastFormats:En.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function d$(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,Af._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}p$.exports=$i=Uf;Object.defineProperty($i,"__esModule",{value:!0});$i.default=Uf});var ze=it(require("path")),Ur=it(require("fs")),E$=it(require("os"));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 Hf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Hf||(Hf={}));var E=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Tt=e=>{switch(typeof e){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(e)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(e)?E.array:e===null?E.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?E.promise:typeof Map<"u"&&e instanceof Map?E.map:typeof Set<"u"&&e instanceof Set?E.set:typeof Date<"u"&&e instanceof Date?E.date:E.object;default:return E.unknown}};var k=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 Qe=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()}};Qe.create=e=>new Qe(e);var U$=(e,t)=>{let r;switch(e.code){case k.invalid_type:e.received===E.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case k.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case k.invalid_union:r="Invalid input";break;case k.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case k.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case k.invalid_arguments:r="Invalid function arguments";break;case k.invalid_return_type:r="Invalid function return type";break;case k.invalid_date:r="Invalid date";break;case k.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 k.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 k.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 k.custom:r="Invalid input";break;case k.invalid_intersection_types:r="Intersection results could not be merged";break;case k.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case k.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},Kt=U$;var M$=Kt;function Rn(){return M$}var wi=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 I(e,t){let r=Rn(),n=wi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Kt?void 0:Kt].filter(o=>!!o)});e.common.issues.push(n)}var De=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 F;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 F;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}}},F=Object.freeze({status:"aborted"}),Mr=e=>({status:"dirty",value:e}),Fe=e=>({status:"valid",value:e}),Ms=e=>e.status==="aborted",Fs=e=>e.status==="dirty",hr=e=>e.status==="valid",Cn=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 at=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}},Bf=(e,t)=>{if(hr(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 Qe(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 Tt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new De,ctx:{common:t.parent.common,data:t.data,parsedType:Tt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Cn(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:Tt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Bf(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Tt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return hr(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=>hr(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:Tt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Cn(o)?o:Promise.resolve(o));return Bf(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:k.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 gt({schema:this,typeName:A.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 ht.create(this,this._def)}nullable(){return Dt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Bt.create(this)}promise(){return gr.create(this,this._def)}or(t){return Jr.create([this,t],this._def)}and(t){return Kr.create(this,t,this._def)}transform(t){return new gt({...J(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Xr({...J(this._def),innerType:this,defaultValue:r,typeName:A.ZodDefault})}brand(){return new Si({typeName:A.ZodBranded,type:this,...J(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Yr({...J(this._def),innerType:this,catchValue:r,typeName:A.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return zi.create(this,t)}readonly(){return Qr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},F$=/^c[^\s-]{8,}$/i,L$=/^[0-9a-z]+$/,q$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,V$=/^[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,J$=/^[a-z0-9_-]{21}$/i,K$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,H$=/^[-+]?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)?)??$/,B$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,W$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ls,G$=/^(?:(?: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])$/,X$=/^(?:(?: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])$/,Y$=/^(([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]))$/,Q$=/^(([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])$/,eb=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tb=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Wf="((\\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])))",rb=new RegExp(`^${Wf}$`);function Gf(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 nb(e){return new RegExp(`^${Gf(e)}$`)}function ob(e){let t=`${Wf}T${Gf(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 ib(e,t){return!!((t==="v4"||!t)&&G$.test(e)||(t==="v6"||!t)&&Y$.test(e))}function ab(e,t){if(!K$.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 sb(e,t){return!!((t==="v4"||!t)&&X$.test(e)||(t==="v6"||!t)&&Q$.test(e))}var Lr=class e extends G{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==E.string){let i=this._getOrReturnCtx(t);return I(i,{code:k.invalid_type,expected:E.string,received:i.parsedType}),F}let n=new De,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),I(o,{code:k.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),I(o,{code:k.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?I(o,{code:k.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&I(o,{code:k.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")B$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"email",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ls||(Ls=new RegExp(W$,"u")),Ls.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"emoji",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")V$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"uuid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")J$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"nanoid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")F$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"cuid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")L$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"cuid2",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")q$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"ulid",code:k.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),I(o,{validation:"url",code:k.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),I(o,{validation:"regex",code:k.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),I(o,{code:k.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),I(o,{code:k.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),I(o,{code:k.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?ob(i).test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{code:k.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?rb.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{code:k.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?nb(i).test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{code:k.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?H$.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"duration",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ib(t.data,i.version)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"ip",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?ab(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"jwt",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?sb(t.data,i.version)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"cidr",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?eb.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"base64",code:k.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?tb.test(t.data)||(o=this._getOrReturnCtx(t,o),I(o,{validation:"base64url",code:k.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:k.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}};Lr.create=e=>new Lr({checks:[],typeName:A.ZodString,coerce:e?.coerce??!1,...J(e)});function cb(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 Zn=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)!==E.number){let i=this._getOrReturnCtx(t);return I(i,{code:k.invalid_type,expected:E.number,received:i.parsedType}),F}let n,o=new De;for(let i of this._def.checks)i.kind==="int"?ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),I(n,{code:k.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),I(n,{code:k.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),I(n,{code:k.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?cb(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),I(n,{code:k.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),I(n,{code:k.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)}};Zn.create=e=>new Zn({checks:[],typeName:A.ZodNumber,coerce:e?.coerce||!1,...J(e)});var An=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)!==E.bigint)return this._getInvalidInput(t);let n,o=new De;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),I(n,{code:k.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),I(n,{code:k.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),I(n,{code:k.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 I(r,{code:k.invalid_type,expected:E.bigint,received:r.parsedType}),F}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}};An.create=e=>new An({checks:[],typeName:A.ZodBigInt,coerce:e?.coerce??!1,...J(e)});var Un=class extends G{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==E.boolean){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.boolean,received:n.parsedType}),F}return Fe(t.data)}};Un.create=e=>new Un({typeName:A.ZodBoolean,coerce:e?.coerce||!1,...J(e)});var Mn=class e extends G{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==E.date){let i=this._getOrReturnCtx(t);return I(i,{code:k.invalid_type,expected:E.date,received:i.parsedType}),F}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return I(i,{code:k.invalid_date}),F}let n=new De,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),I(o,{code:k.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),I(o,{code:k.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}};Mn.create=e=>new Mn({checks:[],coerce:e?.coerce||!1,typeName:A.ZodDate,...J(e)});var Fn=class extends G{_parse(t){if(this._getType(t)!==E.symbol){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.symbol,received:n.parsedType}),F}return Fe(t.data)}};Fn.create=e=>new Fn({typeName:A.ZodSymbol,...J(e)});var qr=class extends G{_parse(t){if(this._getType(t)!==E.undefined){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.undefined,received:n.parsedType}),F}return Fe(t.data)}};qr.create=e=>new qr({typeName:A.ZodUndefined,...J(e)});var Vr=class extends G{_parse(t){if(this._getType(t)!==E.null){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.null,received:n.parsedType}),F}return Fe(t.data)}};Vr.create=e=>new Vr({typeName:A.ZodNull,...J(e)});var Ln=class extends G{constructor(){super(...arguments),this._any=!0}_parse(t){return Fe(t.data)}};Ln.create=e=>new Ln({typeName:A.ZodAny,...J(e)});var Ht=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Fe(t.data)}};Ht.create=e=>new Ht({typeName:A.ZodUnknown,...J(e)});var kt=class extends G{_parse(t){let r=this._getOrReturnCtx(t);return I(r,{code:k.invalid_type,expected:E.never,received:r.parsedType}),F}};kt.create=e=>new kt({typeName:A.ZodNever,...J(e)});var qn=class extends G{_parse(t){if(this._getType(t)!==E.undefined){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.void,received:n.parsedType}),F}return Fe(t.data)}};qn.create=e=>new qn({typeName:A.ZodVoid,...J(e)});var Bt=class e extends G{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==E.array)return I(r,{code:k.invalid_type,expected:E.array,received:r.parsedType}),F;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(I(r,{code:a?k.too_big:k.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&&(I(r,{code:k.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&&(I(r,{code:k.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 at(r,a,r.path,s)))).then(a=>De.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new at(r,a,r.path,s)));return De.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)}};Bt.create=(e,t)=>new Bt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...J(t)});function Fr(e){if(e instanceof et){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ht.create(Fr(n))}return new et({...e._def,shape:()=>t})}else return e instanceof Bt?new Bt({...e._def,type:Fr(e.element)}):e instanceof ht?ht.create(Fr(e.unwrap())):e instanceof Dt?Dt.create(Fr(e.unwrap())):e instanceof Nt?Nt.create(e.items.map(t=>Fr(t))):e}var et=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)!==E.object){let u=this._getOrReturnCtx(t);return I(u,{code:k.invalid_type,expected:E.object,received:u.parsedType}),F}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof kt&&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 at(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof kt){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&&(I(o,{code:k.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 at(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,f=await l.value;u.push({key:d,value:f,alwaysSet:l.alwaysSet})}return u}).then(u=>De.mergeObjectSync(n,u)):De.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:A.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 Fr(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 ht;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Xf(ee.objectKeys(this.shape))}};et.create=(e,t)=>new et({shape:()=>e,unknownKeys:"strip",catchall:kt.create(),typeName:A.ZodObject,...J(t)});et.strictCreate=(e,t)=>new et({shape:()=>e,unknownKeys:"strict",catchall:kt.create(),typeName:A.ZodObject,...J(t)});et.lazycreate=(e,t)=>new et({shape:e,unknownKeys:"strip",catchall:kt.create(),typeName:A.ZodObject,...J(t)});var Jr=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 Qe(s.ctx.common.issues));return I(r,{code:k.invalid_union,unionErrors:a}),F}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 Qe(c));return I(r,{code:k.invalid_union,unionErrors:s}),F}}get options(){return this._def.options}};Jr.create=(e,t)=>new Jr({options:e,typeName:A.ZodUnion,...J(t)});var Ot=e=>e instanceof Hr?Ot(e.schema):e instanceof gt?Ot(e.innerType()):e instanceof Br?[e.value]:e instanceof Wr?e.options:e instanceof Gr?ee.objectValues(e.enum):e instanceof Xr?Ot(e._def.innerType):e instanceof qr?[void 0]:e instanceof Vr?[null]:e instanceof ht?[void 0,...Ot(e.unwrap())]:e instanceof Dt?[null,...Ot(e.unwrap())]:e instanceof Si||e instanceof Qr?Ot(e.unwrap()):e instanceof Yr?Ot(e._def.innerType):[],qs=class e extends G{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.object)return I(r,{code:k.invalid_type,expected:E.object,received:r.parsedType}),F;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}):(I(r,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),F)}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:A.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...J(n)})}};function Vs(e,t){let r=Tt(e),n=Tt(t);if(e===t)return{valid:!0,data:e};if(r===E.object&&n===E.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=Vs(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===E.array&&n===E.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=Vs(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===E.date&&n===E.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Kr=class extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Ms(i)||Ms(a))return F;let s=Vs(i.value,a.value);return s.valid?((Fs(i)||Fs(a))&&r.dirty(),{status:r.value,value:s.data}):(I(n,{code:k.invalid_intersection_types}),F)};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}))}};Kr.create=(e,t,r)=>new Kr({left:e,right:t,typeName:A.ZodIntersection,...J(r)});var Nt=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.array)return I(n,{code:k.invalid_type,expected:E.array,received:n.parsedType}),F;if(n.data.length<this._def.items.length)return I(n,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&n.data.length>this._def.items.length&&(I(n,{code:k.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 at(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>De.mergeArray(r,a)):De.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Nt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Nt({items:e,typeName:A.ZodTuple,rest:null,...J(t)})};var Js=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!==E.object)return I(n,{code:k.invalid_type,expected:E.object,received:n.parsedType}),F;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new at(n,s,n.path,s)),value:a._parse(new at(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?De.mergeObjectAsync(r,o):De.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:A.ZodRecord,...J(n)}):new e({keyType:Lr.create(),valueType:t,typeName:A.ZodRecord,...J(r)})}},Vn=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!==E.map)return I(n,{code:k.invalid_type,expected:E.map,received:n.parsedType}),F;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new at(n,s,n.path,[u,"key"])),value:i._parse(new at(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 F;(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 F;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Vn.create=(e,t,r)=>new Vn({valueType:t,keyType:e,typeName:A.ZodMap,...J(r)});var Jn=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==E.set)return I(n,{code:k.invalid_type,expected:E.set,received:n.parsedType}),F;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(I(n,{code:k.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&&(I(n,{code:k.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 F;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 at(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)}};Jn.create=(e,t)=>new Jn({valueType:e,minSize:null,maxSize:null,typeName:A.ZodSet,...J(t)});var Ks=class e extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.function)return I(r,{code:k.invalid_type,expected:E.function,received:r.parsedType}),F;function n(s,c){return wi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Rn(),Kt].filter(u=>!!u),issueData:{code:k.invalid_arguments,argumentsError:c}})}function o(s,c){return wi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Rn(),Kt].filter(u=>!!u),issueData:{code:k.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof gr){let s=this;return Fe(async function(...c){let u=new Qe([]),l=await s._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(n(c,p)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(p=>{throw u.addIssue(o(d,p)),u})})}else{let s=this;return Fe(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Qe([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Qe([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:Nt.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||Nt.create([]).rest(Ht.create()),returns:r||Ht.create(),typeName:A.ZodFunction,...J(n)})}},Hr=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})}};Hr.create=(e,t)=>new Hr({getter:e,typeName:A.ZodLazy,...J(t)});var Br=class extends G{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return I(r,{received:r.data,code:k.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:t.data}}get value(){return this._def.value}};Br.create=(e,t)=>new Br({value:e,typeName:A.ZodLiteral,...J(t)});function Xf(e,t){return new Wr({values:e,typeName:A.ZodEnum,...J(t)})}var Wr=class e extends G{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return I(r,{expected:ee.joinValues(n),received:r.parsedType,code:k.invalid_type}),F}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 I(r,{received:r.data,code:k.invalid_enum_value,options:n}),F}return Fe(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})}};Wr.create=Xf;var Gr=class extends G{_parse(t){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==E.string&&n.parsedType!==E.number){let o=ee.objectValues(r);return I(n,{expected:ee.joinValues(o),received:n.parsedType,code:k.invalid_type}),F}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=ee.objectValues(r);return I(n,{received:n.data,code:k.invalid_enum_value,options:o}),F}return Fe(t.data)}get enum(){return this._def.values}};Gr.create=(e,t)=>new Gr({values:e,typeName:A.ZodNativeEnum,...J(t)});var gr=class extends G{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==E.promise&&r.common.async===!1)return I(r,{code:k.invalid_type,expected:E.promise,received:r.parsedType}),F;let n=r.parsedType===E.promise?r.data:Promise.resolve(r.data);return Fe(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};gr.create=(e,t)=>new gr({type:e,typeName:A.ZodPromise,...J(t)});var gt=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.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=>{I(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 F;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?F:c.status==="dirty"?Mr(c.value):r.value==="dirty"?Mr(c.value):c});{if(r.value==="aborted")return F;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?F:s.status==="dirty"?Mr(s.value):r.value==="dirty"?Mr(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"?F:(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"?F:(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(!hr(a))return F;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=>hr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):F);ee.assertNever(o)}};gt.create=(e,t,r)=>new gt({schema:e,typeName:A.ZodEffects,effect:t,...J(r)});gt.createWithPreprocess=(e,t,r)=>new gt({schema:t,effect:{type:"preprocess",transform:e},typeName:A.ZodEffects,...J(r)});var ht=class extends G{_parse(t){return this._getType(t)===E.undefined?Fe(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};ht.create=(e,t)=>new ht({innerType:e,typeName:A.ZodOptional,...J(t)});var Dt=class extends G{_parse(t){return this._getType(t)===E.null?Fe(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Dt.create=(e,t)=>new Dt({innerType:e,typeName:A.ZodNullable,...J(t)});var Xr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===E.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Xr.create=(e,t)=>new Xr({innerType:e,typeName:A.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});var Yr=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 Cn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Qe(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Qe(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Yr.create=(e,t)=>new Yr({innerType:e,typeName:A.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});var Kn=class extends G{_parse(t){if(this._getType(t)!==E.nan){let n=this._getOrReturnCtx(t);return I(n,{code:k.invalid_type,expected:E.nan,received:n.parsedType}),F}return{status:"valid",value:t.data}}};Kn.create=e=>new Kn({typeName:A.ZodNaN,...J(e)});var Si=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}},zi=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"?F:i.status==="dirty"?(r.dirty(),Mr(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"?F: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:A.ZodPipeline})}},Qr=class extends G{_parse(t){let r=this._def.innerType._parse(t),n=o=>(hr(o)&&(o.value=Object.freeze(o.value)),o);return Cn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Qr.create=(e,t)=>new Qr({innerType:e,typeName:A.ZodReadonly,...J(t)});var ZT={object:et.lazycreate},A;(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"})(A||(A={}));var AT=Lr.create,UT=Zn.create,MT=Kn.create,FT=An.create,LT=Un.create,qT=Mn.create,VT=Fn.create,JT=qr.create,KT=Vr.create,HT=Ln.create,BT=Ht.create,WT=kt.create,GT=qn.create,XT=Bt.create,ub=et.create,YT=et.strictCreate,QT=Jr.create,eO=qs.create,tO=Kr.create,rO=Nt.create,nO=Js.create,oO=Vn.create,iO=Jn.create,aO=Ks.create,sO=Hr.create,cO=Br.create,uO=Wr.create,lO=Gr.create,dO=gr.create,pO=gt.create,fO=ht.create,mO=Dt.create,hO=gt.createWithPreprocess,gO=zi.create;var Yf=Object.freeze({status:"aborted"});function v(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 f=l[d];f in s||(s[f]=u[f].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 wt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},vr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Ii={};function we(e){return e&&Object.assign(Ii,e),Ii}var w={};Dn(w,{BIGINT_FORMAT_RANGES:()=>rc,Class:()=>Bs,NUMBER_FORMAT_RANGES:()=>tc,aborted:()=>Yt,allowsEval:()=>Xs,assert:()=>gb,assertEqual:()=>pb,assertIs:()=>mb,assertNever:()=>hb,assertNotEqual:()=>fb,assignProp:()=>Gt,base64ToUint8Array:()=>am,base64urlToUint8Array:()=>Ib,cached:()=>tn,captureStackTrace:()=>ji,cleanEnum:()=>zb,cleanRegex:()=>Wn,clone:()=>Le,cloneDef:()=>yb,createTransparentProxy:()=>wb,defineLazy:()=>K,esc:()=>Pi,escapeRegex:()=>st,extend:()=>rm,finalizeIssue:()=>Be,floatSafeRemainder:()=>Ws,getElementAtPath:()=>_b,getEnumValues:()=>Bn,getLengthableOrigin:()=>Yn,getParsedType:()=>kb,getSizableOrigin:()=>Xn,hexToUint8Array:()=>jb,isObject:()=>yr,isPlainObject:()=>Xt,issue:()=>rn,joinValues:()=>U,jsonStringifyReplacer:()=>en,merge:()=>Sb,mergeDefs:()=>Rt,normalizeParams:()=>P,nullish:()=>Wt,numKeys:()=>xb,objectClone:()=>vb,omit:()=>tm,optionalKeys:()=>ec,parsedType:()=>L,partial:()=>om,pick:()=>em,prefixIssues:()=>tt,primitiveTypes:()=>Qs,promiseAllObject:()=>$b,propertyKeyTypes:()=>Gn,randomString:()=>bb,required:()=>im,safeExtend:()=>nm,shallowClone:()=>Ys,slugify:()=>Gs,stringifyPrimitive:()=>M,uint8ArrayToBase64:()=>sm,uint8ArrayToBase64url:()=>Pb,uint8ArrayToHex:()=>Eb,unwrapMessage:()=>Hn});function pb(e){return e}function fb(e){return e}function mb(e){}function hb(e){throw new Error("Unexpected value in exhaustive check")}function gb(e){}function Bn(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 U(e,t="|"){return e.map(r=>M(r)).join(t)}function en(e,t){return typeof t=="bigint"?t.toString():t}function tn(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Wt(e){return e==null}function Wn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ws(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 Qf=Symbol("evaluating");function K(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Qf)return n===void 0&&(n=Qf,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vb(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Gt(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 yb(e){return Rt(e._zod.def)}function _b(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function $b(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 bb(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Pi(e){return JSON.stringify(e)}function Gs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ji="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Xs=tn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Xt(e){if(yr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(yr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ys(e){return Xt(e)?{...e}:Array.isArray(e)?[...e]:e}function xb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var kb=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}`)}},Gn=new Set(["string","number","symbol"]),Qs=new Set(["string","number","bigint","boolean","symbol","undefined"]);function st(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Le(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function P(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 wb(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 M(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ec(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var tc={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]},rc={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function em(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 Gt(this,"shape",a),a},checks:[]});return Le(e,i)}function tm(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 Gt(this,"shape",a),a},checks:[]});return Le(e,i)}function rm(e,t){if(!Xt(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 Gt(this,"shape",i),i}});return Le(e,o)}function nm(e,t){if(!Xt(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 Gt(this,"shape",n),n}});return Le(e,r)}function Sb(e,t){let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Gt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Le(e,r)}function om(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 Gt(this,"shape",c),c},checks:[]});return Le(t,a)}function im(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 Gt(this,"shape",i),i}});return Le(t,n)}function Yt(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 tt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Hn(e){return typeof e=="string"?e:e?.message}function Be(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Hn(e.inst?._zod.def?.error?.(e))??Hn(t?.error?.(e))??Hn(r.customError?.(e))??Hn(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Xn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Yn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function L(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 rn(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function zb(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function am(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 sm(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Ib(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return am(t+r)}function Pb(e){return sm(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function jb(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 Eb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Bs=class{constructor(...t){}};var cm=(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,en,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ei=v("$ZodError",cm),Qn=v("$ZodError",cm,{Parent:Error});function Ti(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 Oi(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 eo=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 wt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Be(c,i,we())));throw ji(s,o?.callee),s}return a.value},to=eo(Qn),ro=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=>Be(c,i,we())));throw ji(s,o?.callee),s}return a.value},no=ro(Qn),oo=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 wt;return i.issues.length?{success:!1,error:new(e??Ei)(i.issues.map(a=>Be(a,o,we())))}:{success:!0,data:i.value}},nn=oo(Qn),io=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=>Be(a,o,we())))}:{success:!0,data:i.value}},ao=io(Qn),um=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return eo(e)(t,r,o)};var lm=e=>(t,r,n)=>eo(e)(t,r,n);var dm=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ro(e)(t,r,o)};var pm=e=>async(t,r,n)=>ro(e)(t,r,n);var fm=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return oo(e)(t,r,o)};var mm=e=>(t,r,n)=>oo(e)(t,r,n);var hm=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return io(e)(t,r,o)};var gm=e=>async(t,r,n)=>io(e)(t,r,n);var ct={};Dn(ct,{base64:()=>yc,base64url:()=>Ni,bigint:()=>wc,boolean:()=>zc,browserEmail:()=>Ub,cidrv4:()=>gc,cidrv6:()=>vc,cuid:()=>nc,cuid2:()=>oc,date:()=>$c,datetime:()=>xc,domain:()=>Lb,duration:()=>uc,e164:()=>_c,email:()=>dc,emoji:()=>pc,extendedDuration:()=>Ob,guid:()=>lc,hex:()=>qb,hostname:()=>Fb,html5Email:()=>Cb,idnEmail:()=>Ab,integer:()=>Sc,ipv4:()=>fc,ipv6:()=>mc,ksuid:()=>sc,lowercase:()=>jc,mac:()=>hc,md5_base64:()=>Jb,md5_base64url:()=>Kb,md5_hex:()=>Vb,nanoid:()=>cc,null:()=>Ic,number:()=>Di,rfc5322Email:()=>Zb,sha1_base64:()=>Bb,sha1_base64url:()=>Wb,sha1_hex:()=>Hb,sha256_base64:()=>Xb,sha256_base64url:()=>Yb,sha256_hex:()=>Gb,sha384_base64:()=>ex,sha384_base64url:()=>tx,sha384_hex:()=>Qb,sha512_base64:()=>nx,sha512_base64url:()=>ox,sha512_hex:()=>rx,string:()=>kc,time:()=>bc,ulid:()=>ic,undefined:()=>Pc,unicodeEmail:()=>vm,uppercase:()=>Ec,uuid:()=>_r,uuid4:()=>Nb,uuid6:()=>Db,uuid7:()=>Rb,xid:()=>ac});var nc=/^[cC][^\s-]{8,}$/,oc=/^[0-9a-z]+$/,ic=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,ac=/^[0-9a-vA-V]{20}$/,sc=/^[A-Za-z0-9]{27}$/,cc=/^[a-zA-Z0-9_-]{21}$/,uc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ob=/^[-+]?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)?)??$/,lc=/^([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})$/,_r=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)$/,Nb=_r(4),Db=_r(6),Rb=_r(7),dc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Cb=/^[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])?)*$/,Zb=/^(([^<>()\[\]\\.,;:\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,}))$/,vm=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Ab=vm,Ub=/^[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])?)*$/,Mb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function pc(){return new RegExp(Mb,"u")}var fc=/^(?:(?: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])$/,mc=/^(([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}|:))$/,hc=e=>{let t=st(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},gc=/^((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])$/,vc=/^(([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])$/,yc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ni=/^[A-Za-z0-9_-]*$/,Fb=/^(?=.{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])?)*\.?$/,Lb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,_c=/^\+[1-9]\d{6,14}$/,ym="(?:(?:\\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])))",$c=new RegExp(`^${ym}$`);function _m(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 bc(e){return new RegExp(`^${_m(e)}$`)}function xc(e){let t=_m({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(`^${ym}T(?:${n})$`)}var kc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},wc=/^-?\d+n?$/,Sc=/^-?\d+$/,Di=/^-?\d+(?:\.\d+)?$/,zc=/^(?:true|false)$/i,Ic=/^null$/i;var Pc=/^undefined$/i;var jc=/^[^A-Z]*$/,Ec=/^[^a-z]*$/,qb=/^[0-9a-fA-F]*$/;function so(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function co(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Vb=/^[0-9a-fA-F]{32}$/,Jb=so(22,"=="),Kb=co(22),Hb=/^[0-9a-fA-F]{40}$/,Bb=so(27,"="),Wb=co(27),Gb=/^[0-9a-fA-F]{64}$/,Xb=so(43,"="),Yb=co(43),Qb=/^[0-9a-fA-F]{96}$/,ex=so(64,""),tx=co(64),rx=/^[0-9a-fA-F]{128}$/,nx=so(86,"=="),ox=co(86);var de=v("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),bm={number:"number",bigint:"bigint",object:"date"},Tc=v("$ZodCheckLessThan",(e,t)=>{de.init(e,t);let r=bm[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})}}),Oc=v("$ZodCheckGreaterThan",(e,t)=>{de.init(e,t);let r=bm[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})}}),xm=v("$ZodCheckMultipleOf",(e,t)=>{de.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):Ws(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})}}),km=v("$ZodCheckNumberFormat",(e,t)=>{de.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=tc[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=Sc)}),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})}}),wm=v("$ZodCheckBigIntFormat",(e,t)=>{de.init(e,t);let[r,n]=rc[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})}}),Sm=v("$ZodCheckMaxSize",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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:Xn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),zm=v("$ZodCheckMinSize",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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:Xn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Im=v("$ZodCheckSizeEquals",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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:Xn(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})}}),Pm=v("$ZodCheckMaxLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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=Yn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),jm=v("$ZodCheckMinLength",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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=Yn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Em=v("$ZodCheckLengthEquals",(e,t)=>{var r;de.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Wt(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=Yn(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})}}),uo=v("$ZodCheckStringFormat",(e,t)=>{var r,n;de.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=()=>{})}),Tm=v("$ZodCheckRegex",(e,t)=>{uo.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})}}),Om=v("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=jc),uo.init(e,t)}),Nm=v("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ec),uo.init(e,t)}),Dm=v("$ZodCheckIncludes",(e,t)=>{de.init(e,t);let r=st(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})}}),Rm=v("$ZodCheckStartsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`^${st(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})}}),Cm=v("$ZodCheckEndsWith",(e,t)=>{de.init(e,t);let r=new RegExp(`.*${st(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 $m(e,t,r){e.issues.length&&t.issues.push(...tt(r,e.issues))}var Zm=v("$ZodCheckProperty",(e,t)=>{de.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=>$m(o,r,t.property));$m(n,r,t.property)}}),Am=v("$ZodCheckMimeType",(e,t)=>{de.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})}}),Um=v("$ZodCheckOverwrite",(e,t)=>{de.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ri=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
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 Zm={major:4,minor:3,patch:6};var V=v("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Zm;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=Yt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new wt;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=Yt(a,f)))});else{if(a.issues.length===f)continue;u||(u=Yt(a,f))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Yt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new wt;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 wt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}K(e,"~standard",()=>({validate:o=>{try{let i=rn(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return io(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),_r=v("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??bc(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}}),ce=v("$ZodStringFormat",(e,t)=>{co.init(e,t),_r.init(e,t)}),Oc=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=cc),ce.init(e,t)}),Nc=v("$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=yr(n))}else t.pattern??(t.pattern=yr());ce.init(e,t)}),Dc=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=uc),ce.init(e,t)}),Rc=v("$ZodURL",(e,t)=>{ce.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})}}}),Cc=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lc()),ce.init(e,t)}),Ac=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ac),ce.init(e,t)}),Zc=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=tc),ce.init(e,t)}),Uc=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=rc),ce.init(e,t)}),Mc=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=nc),ce.init(e,t)}),Fc=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=oc),ce.init(e,t)}),Lc=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ic),ce.init(e,t)}),qc=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=$c(t)),ce.init(e,t)}),Vc=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=yc),ce.init(e,t)}),Jc=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=_c(t)),ce.init(e,t)}),Kc=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=sc),ce.init(e,t)}),Bc=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=dc),ce.init(e,t),e._zod.bag.format="ipv4"}),Hc=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=pc),ce.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})}}}),Wc=v("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=fc(t.delimiter)),ce.init(e,t),e._zod.bag.format="mac"}),Gc=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=mc),ce.init(e,t)}),Xc=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=hc),ce.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 Gm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Yc=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gc),ce.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Gm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function nx(e){if(!Oi.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Gm(r)}var Qc=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Oi),ce.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{nx(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),eu=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vc),ce.init(e,t)});function ox(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 tu=v("$ZodJWT",(e,t)=>{ce.init(e,t),e._zod.check=r=>{ox(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ru=v("$ZodCustomStringFormat",(e,t)=>{ce.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})}}),Mi=v("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ni,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}}),nu=v("$ZodNumberFormat",(e,t)=>{$m.init(e,t),Mi.init(e,t)}),uo=v("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=wc,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}}),Fi=v("$ZodBigInt",(e,t)=>{V.init(e,t),e._zod.pattern=xc,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}}),ou=v("$ZodBigIntFormat",(e,t)=>{bm.init(e,t),Fi.init(e,t)}),iu=v("$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}}),au=v("$ZodUndefined",(e,t)=>{V.init(e,t),e._zod.pattern=zc,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}}),su=v("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=Sc,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}}),cu=v("$ZodAny",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),uu=v("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),lu=v("$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)}),du=v("$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}}),pu=v("$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 Um(e,t,r){e.issues.length&&t.issues.push(...tt(r,e.issues)),t.value[r]=e.value}var fu=v("$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=>Um(u,r,a))):Um(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ui(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...tt(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Xm(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=Ys(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ym(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 f=c.run({value:t[d],issues:[]},n);f instanceof Promise?e.push(f.then(p=>Ui(p,r,d,t,l))):Ui(f,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 Qm=v("$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=en(()=>Xm(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 o=vr,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 f of a.keys){let p=d[f],m=p._zod.optout==="optional",h=p._zod.run({value:u[f],issues:[]},c);h instanceof Promise?l.push(h.then(g=>Ui(g,s,f,u,m))):Ui(h,s,f,u,m)}return i?Ym(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),eh=v("$ZodObjectJIT",(e,t)=>{Qm.init(e,t);let r=e._zod.parse,n=en(()=>Xm(t)),o=f=>{let p=new Di(["shape","payload","ctx"]),m=n.value,h=b=>{let S=Ii(b);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};p.write("const input = payload.value;");let g=Object.create(null),y=0;for(let b of m.keys)g[b]=`key_${y++}`;p.write("const newResult = {};");for(let b of m.keys){let S=g[b],z=Ii(b),ae=f[b]?._zod?.optout==="optional";p.write(`const ${S} = ${h(b)};`),ae?p.write(`
11
+ `))}};var Fm={major:4,minor:3,patch:6};var V=v("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fm;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=Yt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new wt;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=Yt(a,f)))});else{if(a.issues.length===f)continue;u||(u=Yt(a,f))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Yt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new wt;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 wt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}K(e,"~standard",()=>({validate:o=>{try{let i=nn(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return ao(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),$r=v("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??kc(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}}),ce=v("$ZodStringFormat",(e,t)=>{uo.init(e,t),$r.init(e,t)}),Dc=v("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=lc),ce.init(e,t)}),Rc=v("$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=_r(n))}else t.pattern??(t.pattern=_r());ce.init(e,t)}),Cc=v("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=dc),ce.init(e,t)}),Zc=v("$ZodURL",(e,t)=>{ce.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})}}}),Ac=v("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=pc()),ce.init(e,t)}),Uc=v("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=cc),ce.init(e,t)}),Mc=v("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=nc),ce.init(e,t)}),Fc=v("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=oc),ce.init(e,t)}),Lc=v("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ic),ce.init(e,t)}),qc=v("$ZodXID",(e,t)=>{t.pattern??(t.pattern=ac),ce.init(e,t)}),Vc=v("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=sc),ce.init(e,t)}),Jc=v("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=xc(t)),ce.init(e,t)}),Kc=v("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=$c),ce.init(e,t)}),Hc=v("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=bc(t)),ce.init(e,t)}),Bc=v("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=uc),ce.init(e,t)}),Wc=v("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=fc),ce.init(e,t),e._zod.bag.format="ipv4"}),Gc=v("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=mc),ce.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})}}}),Xc=v("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=hc(t.delimiter)),ce.init(e,t),e._zod.bag.format="mac"}),Yc=v("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=gc),ce.init(e,t)}),Qc=v("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=vc),ce.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 Qm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var eu=v("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=yc),ce.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Qm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function ix(e){if(!Ni.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Qm(r)}var tu=v("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ni),ce.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{ix(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ru=v("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_c),ce.init(e,t)});function ax(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 nu=v("$ZodJWT",(e,t)=>{ce.init(e,t),e._zod.check=r=>{ax(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ou=v("$ZodCustomStringFormat",(e,t)=>{ce.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})}}),Fi=v("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??Di,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}}),iu=v("$ZodNumberFormat",(e,t)=>{km.init(e,t),Fi.init(e,t)}),lo=v("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=zc,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}}),Li=v("$ZodBigInt",(e,t)=>{V.init(e,t),e._zod.pattern=wc,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}}),au=v("$ZodBigIntFormat",(e,t)=>{wm.init(e,t),Li.init(e,t)}),su=v("$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}}),cu=v("$ZodUndefined",(e,t)=>{V.init(e,t),e._zod.pattern=Pc,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}}),uu=v("$ZodNull",(e,t)=>{V.init(e,t),e._zod.pattern=Ic,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}}),lu=v("$ZodAny",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),du=v("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=r=>r}),pu=v("$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)}),fu=v("$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}}),mu=v("$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 Lm(e,t,r){e.issues.length&&t.issues.push(...tt(r,e.issues)),t.value[r]=e.value}var hu=v("$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=>Lm(u,r,a))):Lm(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Mi(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...tt(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function eh(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=ec(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function th(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 f=c.run({value:t[d],issues:[]},n);f instanceof Promise?e.push(f.then(p=>Mi(p,r,d,t,l))):Mi(f,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 rh=v("$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=tn(()=>eh(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 o=yr,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 f of a.keys){let p=d[f],g=p._zod.optout==="optional",h=p._zod.run({value:u[f],issues:[]},c);h instanceof Promise?l.push(h.then(m=>Mi(m,s,f,u,g))):Mi(h,s,f,u,g)}return i?th(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),nh=v("$ZodObjectJIT",(e,t)=>{rh.init(e,t);let r=e._zod.parse,n=tn(()=>eh(t)),o=f=>{let p=new Ri(["shape","payload","ctx"]),g=n.value,h=b=>{let S=Pi(b);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};p.write("const input = payload.value;");let m=Object.create(null),y=0;for(let b of g.keys)m[b]=`key_${y++}`;p.write("const newResult = {};");for(let b of g.keys){let S=m[b],z=Pi(b),ae=f[b]?._zod?.optout==="optional";p.write(`const ${S} = ${h(b)};`),ae?p.write(`
12
12
  if (${S}.issues.length) {
13
13
  if (${z} in input) {
14
14
  payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
@@ -42,40 +42,41 @@
42
42
  newResult[${z}] = ${S}.value;
43
43
  }
44
44
 
45
- `)}p.write("payload.value = newResult;"),p.write("return payload;");let _=p.compile();return(b,S)=>_(f,b,S)},i,a=vr,s=!zi.jitless,u=s&&Ws.value,l=t.catchall,d;e._zod.parse=(f,p)=>{d??(d=n.value);let m=f.value;return a(m)?s&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(t.shape)),f=i(f,p),l?Ym([],m,f,p,d,e):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function Mm(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=>!Yt(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,we())))}),t)}var lo=v("$ZodUnion",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),K(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),K(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),K(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=>Mm(c,o,e,i)):Mm(s,o,e,i)}});function Fm(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,we())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var mu=v("$ZodXor",(e,t)=>{lo.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=>Fm(c,o,e,i)):Fm(s,o,e,i)}}),hu=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,lo.init(e,t);let r=e._zod.parse;K(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=en(()=>{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(!vr(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)}}),gu=v("$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])=>Lm(r,c,u)):Lm(r,i,a)}});function Tc(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(Xt(e)&&Xt(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=Tc(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=Tc(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 Lm(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}),Yt(e))return e;let a=Tc(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 Li=v("$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(f=>Ri(f,n,u))):Ri(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let f=t.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?a.push(f.then(p=>Ri(p,n,u))):Ri(f,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Ri(e,t,r){e.issues.length&&t.issues.push(...tt(r,e.issues)),t.value[r]=e.value}var vu=v("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Xt(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(...tt(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...tt(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"&&Ni.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,we())),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(...tt(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...tt(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),yu=v("$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])=>{qm(l,d,r,a,o,e,n)})):qm(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function qm(e,t,r,n,o,i,a){e.issues.length&&(Wn.has(typeof n)?r.issues.push(...tt(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>He(s,a,we()))})),t.issues.length&&(Wn.has(typeof n)?r.issues.push(...tt(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,we()))})),r.value.set(e.value,t.value)}var _u=v("$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=>Vm(c,r))):Vm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Vm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var $u=v("$ZodEnum",(e,t)=>{V.init(e,t);let r=Bn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Wn.has(typeof o)).map(o=>typeof o=="string"?st(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}}),bu=v("$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"?st(n):n?st(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}}),xu=v("$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}}),ku=v("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gr(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 wt;return r.value=o,r}});function Jm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var qi=v("$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(`^(${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=>Jm(i,r.value)):Jm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),wu=v("$ZodExactOptional",(e,t)=>{qi.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)}),Su=v("$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(`^(${Hn(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)}),zu=v("$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 o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Km(i,t)):Km(o,t)}});function Km(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Iu=v("$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))}),Pu=v("$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 o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Bm(i,e)):Bm(o,e)}});function Bm(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 ju=v("$ZodSuccess",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gr("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)}}),Eu=v("$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 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,we()))},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,we()))},input:r.value}),r.issues=[]),r)}}),Tu=v("$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)}),Ou=v("$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 i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ci(a,t.in,n)):Ci(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Ci(i,t.out,n)):Ci(o,t.out,n)}});function Ci(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var po=v("$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 i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Ai(a,t,n)):Ai(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ai(a,t,n)):Ai(i,t,n)}}});function Ai(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=>Zi(e,i,t.out,r)):Zi(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Zi(e,i,t.in,r)):Zi(e,o,t.in,r)}}function Zi(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Nu=v("$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 o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Hm):Hm(o)}});function Hm(e){return e.value=Object.freeze(e.value),e}var Du=v("$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||Xs.has(typeof n))r.push(st(`${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)}),Ru=v("$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?eo(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?eo(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 ro(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await ro(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 Li({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)),Cu=v("$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))}),Au=v("$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)}),Zu=v("$ZodCustom",(e,t)=>{de.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=>Wm(i,r,n,e));Wm(o,r,n,e)}});function Wm(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(tn(o))}}var ax=()=>{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=L(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${M(o.values[0])}`:`Invalid option: expected one of ${U(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":""}: ${U(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 Uu(){return{localeError:ax()}}var th;var Fu=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 Lu(){return new Fu}(th=globalThis).__zod_globalRegistry??(th.__zod_globalRegistry=Lu());var qe=globalThis.__zod_globalRegistry;function qu(e,t){return new e({type:"string",...P(t)})}function Vi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...P(t)})}function fo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...P(t)})}function Ji(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...P(t)})}function Ki(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...P(t)})}function Bi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...P(t)})}function Hi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...P(t)})}function mo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...P(t)})}function Wi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...P(t)})}function Gi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...P(t)})}function Xi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...P(t)})}function Yi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...P(t)})}function Qi(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...P(t)})}function ea(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...P(t)})}function ta(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...P(t)})}function ra(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...P(t)})}function na(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...P(t)})}function Vu(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...P(t)})}function oa(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...P(t)})}function ia(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...P(t)})}function aa(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...P(t)})}function sa(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...P(t)})}function ca(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...P(t)})}function ua(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...P(t)})}function Ju(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...P(t)})}function Ku(e,t){return new e({type:"string",format:"date",check:"string_format",...P(t)})}function Bu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...P(t)})}function Hu(e,t){return new e({type:"string",format:"duration",check:"string_format",...P(t)})}function Wu(e,t){return new e({type:"number",checks:[],...P(t)})}function Gu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...P(t)})}function Xu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...P(t)})}function Yu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...P(t)})}function Qu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...P(t)})}function el(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...P(t)})}function tl(e,t){return new e({type:"boolean",...P(t)})}function rl(e,t){return new e({type:"bigint",...P(t)})}function nl(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...P(t)})}function ol(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...P(t)})}function il(e,t){return new e({type:"symbol",...P(t)})}function al(e,t){return new e({type:"undefined",...P(t)})}function sl(e,t){return new e({type:"null",...P(t)})}function cl(e){return new e({type:"any"})}function ul(e){return new e({type:"unknown"})}function ll(e,t){return new e({type:"never",...P(t)})}function dl(e,t){return new e({type:"void",...P(t)})}function pl(e,t){return new e({type:"date",...P(t)})}function fl(e,t){return new e({type:"nan",...P(t)})}function Ct(e,t){return new jc({check:"less_than",...P(t),value:e,inclusive:!1})}function rt(e,t){return new jc({check:"less_than",...P(t),value:e,inclusive:!0})}function At(e,t){return new Ec({check:"greater_than",...P(t),value:e,inclusive:!1})}function Ve(e,t){return new Ec({check:"greater_than",...P(t),value:e,inclusive:!0})}function ml(e){return At(0,e)}function hl(e){return Ct(0,e)}function gl(e){return rt(0,e)}function vl(e){return Ve(0,e)}function $r(e,t){return new _m({check:"multiple_of",...P(t),value:e})}function br(e,t){return new xm({check:"max_size",...P(t),maximum:e})}function Zt(e,t){return new km({check:"min_size",...P(t),minimum:e})}function nn(e,t){return new wm({check:"size_equals",...P(t),size:e})}function on(e,t){return new Sm({check:"max_length",...P(t),maximum:e})}function Qt(e,t){return new zm({check:"min_length",...P(t),minimum:e})}function an(e,t){return new Im({check:"length_equals",...P(t),length:e})}function ho(e,t){return new Pm({check:"string_format",format:"regex",...P(t),pattern:e})}function go(e){return new jm({check:"string_format",format:"lowercase",...P(e)})}function vo(e){return new Em({check:"string_format",format:"uppercase",...P(e)})}function yo(e,t){return new Tm({check:"string_format",format:"includes",...P(t),includes:e})}function _o(e,t){return new Om({check:"string_format",format:"starts_with",...P(t),prefix:e})}function $o(e,t){return new Nm({check:"string_format",format:"ends_with",...P(t),suffix:e})}function yl(e,t,r){return new Dm({check:"property",property:e,schema:t,...P(r)})}function bo(e,t){return new Rm({check:"mime_type",mime:e,...P(t)})}function St(e){return new Cm({check:"overwrite",tx:e})}function xo(e){return St(t=>t.normalize(e))}function ko(){return St(e=>e.trim())}function wo(){return St(e=>e.toLowerCase())}function So(){return St(e=>e.toUpperCase())}function la(){return St(e=>Hs(e))}function rh(e,t,r){return new e({type:"array",element:t,...P(r)})}function _l(e,t){return new e({type:"file",...P(t)})}function $l(e,t,r){let n=P(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function bl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...P(r)})}function xl(e){let t=lx(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(tn(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(tn(o))}},e(r.value,r)));return t}function lx(e,t){let r=new de({check:"custom",...P(t)});return r._zod.check=e,r}function kl(e){let t=new de({check:"describe"});return t._zod.onattach=[r=>{let n=qe.get(r)??{};qe.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function wl(e){let t=new de({check:"meta"});return t._zod.onattach=[r=>{let n=qe.get(r)??{};qe.add(r,{...n,...e})}],t._zod.check=()=>{},t}function Sl(e,t){let r=P(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(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),a=new Set(o),s=e.Codec??po,c=e.Boolean??uo,u=e.String??_r,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:l,out:d,transform:((p,m)=>{let h=p;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:f,continue:!1}),{})}),reverseTransform:((p,m)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function sn(e,t,r,n={}){let o=P(n),i={...P(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 da(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??qe,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 he(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 f=a.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,f,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),he(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"&&Je(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 pa(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,f=e.external.uri??(m=>m);if(d)return{ref:f(d)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${f("__shared")}#/${s}/${p}`}}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 fa(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 f=e.seen.get(l),p=f.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(p.$ref&&f.def)for(let h in c)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(c[h])===JSON.stringify(f.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let f=e.seen.get(d);if(f?.schema.$ref&&(c.$ref=f.schema.$ref,f.def))for(let p in c)p==="$ref"||p==="allOf"||p in f.def&&JSON.stringify(c[p])===JSON.stringify(f.def[p])&&delete c[p]}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:zo(t,"input",e.processors),output:zo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Je(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 Je(n.element,r);if(n.type==="set")return Je(n.valueType,r);if(n.type==="lazy")return Je(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 Je(n.innerType,r);if(n.type==="intersection")return Je(n.left,r)||Je(n.right,r);if(n.type==="record"||n.type==="map")return Je(n.keyType,r)||Je(n.valueType,r);if(n.type==="pipe")return Je(n.in,r)||Je(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Je(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Je(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Je(o,r))return!0;return!!(n.rest&&Je(n.rest,r))}return!1}var nh=(e,t={})=>r=>{let n=da({...r,processors:t});return he(e,n),pa(n,e),fa(n,e)},zo=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=da({...o??{},target:i,io:t,processors:r});return he(e,a),pa(a,e),fa(a,e)};var dx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oh=(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=dx[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}))])}},ih=(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)},ah=(e,t,r,n)=>{r.type="boolean"},sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},ch=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},uh=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},lh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},dh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},ph=(e,t,r,n)=>{r.not={}},fh=(e,t,r,n)=>{},mh=(e,t,r,n)=>{},hh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},gh=(e,t,r,n)=>{let o=e._zod.def,i=Bn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},vh=(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},yh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},_h=(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},$h=(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)},bh=(e,t,r,n)=>{r.type="boolean"},xh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},kh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},wh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},zh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Ih=(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=he(i.element,t,{...n,path:[...n.path,"items"]})},Ph=(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]=he(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=he(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},zl=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>he(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},jh=(e,t,r,n)=>{let o=e._zod.def,i=he(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=he(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},Eh=(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((f,p)=>he(f,t,{...n,path:[...n.path,a,p]})),u=i.rest?he(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)},Th=(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=he(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=he(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=he(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)}},Oh=(e,t,r,n)=>{let o=e._zod.def,i=he(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"}]},Nh=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Dh=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Rh=(e,t,r,n)=>{let o=e._zod.def;he(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)))},Ch=(e,t,r,n)=>{let o=e._zod.def;he(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},Ah=(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;he(i,t,n);let a=t.seen.get(e);a.ref=i},Zh=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Uh=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Il=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Mh=(e,t,r,n)=>{let o=e._zod.innerType;he(o,t,n);let i=t.seen.get(e);i.ref=o};function cn(e){return!!e._zod}function er(e,t){return cn(e)?rn(e,t):e.safeParse(t)}function ma(e){if(!e)return;let t;if(cn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Vh(e){if(cn(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 Io={};Nn(Io,{ZodAny:()=>cg,ZodArray:()=>pg,ZodBase64:()=>Xl,ZodBase64URL:()=>Yl,ZodBigInt:()=>ka,ZodBigIntFormat:()=>td,ZodBoolean:()=>xa,ZodCIDRv4:()=>Wl,ZodCIDRv6:()=>Gl,ZodCUID:()=>Ll,ZodCUID2:()=>ql,ZodCatch:()=>Og,ZodCodec:()=>cd,ZodCustom:()=>Pa,ZodCustomStringFormat:()=>jo,ZodDate:()=>nd,ZodDefault:()=>zg,ZodDiscriminatedUnion:()=>mg,ZodE164:()=>Ql,ZodEmail:()=>Ul,ZodEmoji:()=>Ml,ZodEnum:()=>Po,ZodExactOptional:()=>kg,ZodFile:()=>bg,ZodFunction:()=>Fg,ZodGUID:()=>ga,ZodIPv4:()=>Bl,ZodIPv6:()=>Hl,ZodIntersection:()=>hg,ZodJWT:()=>ed,ZodKSUID:()=>Kl,ZodLazy:()=>Zg,ZodLiteral:()=>$g,ZodMAC:()=>og,ZodMap:()=>yg,ZodNaN:()=>Dg,ZodNanoID:()=>Fl,ZodNever:()=>lg,ZodNonOptional:()=>ad,ZodNull:()=>sg,ZodNullable:()=>Sg,ZodNumber:()=>ba,ZodNumberFormat:()=>un,ZodObject:()=>wa,ZodOptional:()=>id,ZodPipe:()=>sd,ZodPrefault:()=>Pg,ZodPromise:()=>Mg,ZodReadonly:()=>Rg,ZodRecord:()=>Ia,ZodSet:()=>_g,ZodString:()=>_a,ZodStringFormat:()=>pe,ZodSuccess:()=>Tg,ZodSymbol:()=>ig,ZodTemplateLiteral:()=>Ag,ZodTransform:()=>xg,ZodTuple:()=>gg,ZodType:()=>B,ZodULID:()=>Vl,ZodURL:()=>$a,ZodUUID:()=>Ut,ZodUndefined:()=>ag,ZodUnion:()=>Sa,ZodUnknown:()=>ug,ZodVoid:()=>dg,ZodXID:()=>Jl,ZodXor:()=>fg,_ZodString:()=>Zl,_default:()=>Ig,_function:()=>jk,any:()=>dk,array:()=>Y,base64:()=>Hx,base64url:()=>Wx,bigint:()=>ak,boolean:()=>xe,catch:()=>Ng,check:()=>Ek,cidrv4:()=>Kx,cidrv6:()=>Bx,codec:()=>zk,cuid:()=>Zx,cuid2:()=>Ux,custom:()=>ud,date:()=>fk,describe:()=>Tk,discriminatedUnion:()=>za,e164:()=>Gx,email:()=>Px,emoji:()=>Cx,enum:()=>Ce,exactOptional:()=>wg,file:()=>xk,float32:()=>rk,float64:()=>nk,function:()=>jk,guid:()=>jx,hash:()=>tk,hex:()=>ek,hostname:()=>Qx,httpUrl:()=>Rx,instanceof:()=>Nk,int:()=>Al,int32:()=>ok,int64:()=>sk,intersection:()=>To,ipv4:()=>qx,ipv6:()=>Jx,json:()=>Rk,jwt:()=>Xx,keyof:()=>mk,ksuid:()=>Lx,lazy:()=>Ug,literal:()=>N,looseObject:()=>Re,looseRecord:()=>yk,mac:()=>Vx,map:()=>_k,meta:()=>Ok,nan:()=>Sk,nanoid:()=>Ax,nativeEnum:()=>bk,never:()=>rd,nonoptional:()=>Eg,null:()=>Eo,nullable:()=>va,nullish:()=>kk,number:()=>se,object:()=>T,optional:()=>ve,partialRecord:()=>vk,pipe:()=>ya,prefault:()=>jg,preprocess:()=>ja,promise:()=>Pk,readonly:()=>Cg,record:()=>ge,refine:()=>Lg,set:()=>$k,strictObject:()=>hk,string:()=>$,stringFormat:()=>Yx,stringbool:()=>Dk,success:()=>wk,superRefine:()=>qg,symbol:()=>uk,templateLiteral:()=>Ik,transform:()=>od,tuple:()=>vg,uint32:()=>ik,uint64:()=>ck,ulid:()=>Mx,undefined:()=>lk,union:()=>ue,unknown:()=>fe,url:()=>Dx,uuid:()=>Ex,uuidv4:()=>Tx,uuidv6:()=>Ox,uuidv7:()=>Nx,void:()=>pk,xid:()=>Fx,xor:()=>gk});var ha={};Nn(ha,{endsWith:()=>$o,gt:()=>At,gte:()=>Ve,includes:()=>yo,length:()=>an,lowercase:()=>go,lt:()=>Ct,lte:()=>rt,maxLength:()=>on,maxSize:()=>br,mime:()=>bo,minLength:()=>Qt,minSize:()=>Zt,multipleOf:()=>$r,negative:()=>hl,nonnegative:()=>vl,nonpositive:()=>gl,normalize:()=>xo,overwrite:()=>St,positive:()=>ml,property:()=>yl,regex:()=>ho,size:()=>nn,slugify:()=>la,startsWith:()=>_o,toLowerCase:()=>wo,toUpperCase:()=>So,trim:()=>ko,uppercase:()=>vo});var xr={};Nn(xr,{ZodISODate:()=>Tl,ZodISODateTime:()=>jl,ZodISODuration:()=>Rl,ZodISOTime:()=>Nl,date:()=>Ol,datetime:()=>El,duration:()=>Cl,time:()=>Dl});var jl=v("ZodISODateTime",(e,t)=>{qc.init(e,t),pe.init(e,t)});function El(e){return Ju(jl,e)}var Tl=v("ZodISODate",(e,t)=>{Vc.init(e,t),pe.init(e,t)});function Ol(e){return Ku(Tl,e)}var Nl=v("ZodISOTime",(e,t)=>{Jc.init(e,t),pe.init(e,t)});function Dl(e){return Bu(Nl,e)}var Rl=v("ZodISODuration",(e,t)=>{Kc.init(e,t),pe.init(e,t)});function Cl(e){return Hu(Rl,e)}var Jh=(e,t)=>{ji.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ti(e,r)},flatten:{value:r=>Ei(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Qr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Qr,2)}},isEmpty:{get(){return e.issues.length===0}}})},pR=v("ZodError",Jh),nt=v("ZodError",Jh,{Parent:Error});var Kh=Qn(nt),Bh=to(nt),Hh=no(nt),Wh=oo(nt),Gh=am(nt),Xh=sm(nt),Yh=cm(nt),Qh=um(nt),eg=lm(nt),tg=dm(nt),rg=pm(nt),ng=fm(nt);var B=v("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:zo(e,"input"),output:zo(e,"output")}}),e.toJSONSchema=nh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(w.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)=>Le(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Kh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Hh(e,r,n),e.parseAsync=async(r,n)=>Bh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Wh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Gh(e,r,n),e.decode=(r,n)=>Xh(e,r,n),e.encodeAsync=async(r,n)=>Yh(e,r,n),e.decodeAsync=async(r,n)=>Qh(e,r,n),e.safeEncode=(r,n)=>eg(e,r,n),e.safeDecode=(r,n)=>tg(e,r,n),e.safeEncodeAsync=async(r,n)=>rg(e,r,n),e.safeDecodeAsync=async(r,n)=>ng(e,r,n),e.refine=(r,n)=>e.check(Lg(r,n)),e.superRefine=r=>e.check(qg(r)),e.overwrite=r=>e.check(St(r)),e.optional=()=>ve(e),e.exactOptional=()=>wg(e),e.nullable=()=>va(e),e.nullish=()=>ve(va(e)),e.nonoptional=r=>Eg(e,r),e.array=()=>Y(e),e.or=r=>ue([e,r]),e.and=r=>To(e,r),e.transform=r=>ya(e,od(r)),e.default=r=>Ig(e,r),e.prefault=r=>jg(e,r),e.catch=r=>Ng(e,r),e.pipe=r=>ya(e,r),e.readonly=()=>Cg(e),e.describe=r=>{let n=e.clone();return qe.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return qe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return qe.get(e);let n=e.clone();return qe.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Zl=v("_ZodString",(e,t)=>{_r.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>oh(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(ho(...n)),e.includes=(...n)=>e.check(yo(...n)),e.startsWith=(...n)=>e.check(_o(...n)),e.endsWith=(...n)=>e.check($o(...n)),e.min=(...n)=>e.check(Qt(...n)),e.max=(...n)=>e.check(on(...n)),e.length=(...n)=>e.check(an(...n)),e.nonempty=(...n)=>e.check(Qt(1,...n)),e.lowercase=n=>e.check(go(n)),e.uppercase=n=>e.check(vo(n)),e.trim=()=>e.check(ko()),e.normalize=(...n)=>e.check(xo(...n)),e.toLowerCase=()=>e.check(wo()),e.toUpperCase=()=>e.check(So()),e.slugify=()=>e.check(la())}),_a=v("ZodString",(e,t)=>{_r.init(e,t),Zl.init(e,t),e.email=r=>e.check(Vi(Ul,r)),e.url=r=>e.check(mo($a,r)),e.jwt=r=>e.check(ua(ed,r)),e.emoji=r=>e.check(Wi(Ml,r)),e.guid=r=>e.check(fo(ga,r)),e.uuid=r=>e.check(Ji(Ut,r)),e.uuidv4=r=>e.check(Ki(Ut,r)),e.uuidv6=r=>e.check(Bi(Ut,r)),e.uuidv7=r=>e.check(Hi(Ut,r)),e.nanoid=r=>e.check(Gi(Fl,r)),e.guid=r=>e.check(fo(ga,r)),e.cuid=r=>e.check(Xi(Ll,r)),e.cuid2=r=>e.check(Yi(ql,r)),e.ulid=r=>e.check(Qi(Vl,r)),e.base64=r=>e.check(aa(Xl,r)),e.base64url=r=>e.check(sa(Yl,r)),e.xid=r=>e.check(ea(Jl,r)),e.ksuid=r=>e.check(ta(Kl,r)),e.ipv4=r=>e.check(ra(Bl,r)),e.ipv6=r=>e.check(na(Hl,r)),e.cidrv4=r=>e.check(oa(Wl,r)),e.cidrv6=r=>e.check(ia(Gl,r)),e.e164=r=>e.check(ca(Ql,r)),e.datetime=r=>e.check(El(r)),e.date=r=>e.check(Ol(r)),e.time=r=>e.check(Dl(r)),e.duration=r=>e.check(Cl(r))});function $(e){return qu(_a,e)}var pe=v("ZodStringFormat",(e,t)=>{ce.init(e,t),Zl.init(e,t)}),Ul=v("ZodEmail",(e,t)=>{Dc.init(e,t),pe.init(e,t)});function Px(e){return Vi(Ul,e)}var ga=v("ZodGUID",(e,t)=>{Oc.init(e,t),pe.init(e,t)});function jx(e){return fo(ga,e)}var Ut=v("ZodUUID",(e,t)=>{Nc.init(e,t),pe.init(e,t)});function Ex(e){return Ji(Ut,e)}function Tx(e){return Ki(Ut,e)}function Ox(e){return Bi(Ut,e)}function Nx(e){return Hi(Ut,e)}var $a=v("ZodURL",(e,t)=>{Rc.init(e,t),pe.init(e,t)});function Dx(e){return mo($a,e)}function Rx(e){return mo($a,{protocol:/^https?$/,hostname:ct.domain,...w.normalizeParams(e)})}var Ml=v("ZodEmoji",(e,t)=>{Cc.init(e,t),pe.init(e,t)});function Cx(e){return Wi(Ml,e)}var Fl=v("ZodNanoID",(e,t)=>{Ac.init(e,t),pe.init(e,t)});function Ax(e){return Gi(Fl,e)}var Ll=v("ZodCUID",(e,t)=>{Zc.init(e,t),pe.init(e,t)});function Zx(e){return Xi(Ll,e)}var ql=v("ZodCUID2",(e,t)=>{Uc.init(e,t),pe.init(e,t)});function Ux(e){return Yi(ql,e)}var Vl=v("ZodULID",(e,t)=>{Mc.init(e,t),pe.init(e,t)});function Mx(e){return Qi(Vl,e)}var Jl=v("ZodXID",(e,t)=>{Fc.init(e,t),pe.init(e,t)});function Fx(e){return ea(Jl,e)}var Kl=v("ZodKSUID",(e,t)=>{Lc.init(e,t),pe.init(e,t)});function Lx(e){return ta(Kl,e)}var Bl=v("ZodIPv4",(e,t)=>{Bc.init(e,t),pe.init(e,t)});function qx(e){return ra(Bl,e)}var og=v("ZodMAC",(e,t)=>{Wc.init(e,t),pe.init(e,t)});function Vx(e){return Vu(og,e)}var Hl=v("ZodIPv6",(e,t)=>{Hc.init(e,t),pe.init(e,t)});function Jx(e){return na(Hl,e)}var Wl=v("ZodCIDRv4",(e,t)=>{Gc.init(e,t),pe.init(e,t)});function Kx(e){return oa(Wl,e)}var Gl=v("ZodCIDRv6",(e,t)=>{Xc.init(e,t),pe.init(e,t)});function Bx(e){return ia(Gl,e)}var Xl=v("ZodBase64",(e,t)=>{Yc.init(e,t),pe.init(e,t)});function Hx(e){return aa(Xl,e)}var Yl=v("ZodBase64URL",(e,t)=>{Qc.init(e,t),pe.init(e,t)});function Wx(e){return sa(Yl,e)}var Ql=v("ZodE164",(e,t)=>{eu.init(e,t),pe.init(e,t)});function Gx(e){return ca(Ql,e)}var ed=v("ZodJWT",(e,t)=>{tu.init(e,t),pe.init(e,t)});function Xx(e){return ua(ed,e)}var jo=v("ZodCustomStringFormat",(e,t)=>{ru.init(e,t),pe.init(e,t)});function Yx(e,t,r={}){return sn(jo,e,t,r)}function Qx(e){return sn(jo,"hostname",ct.hostname,e)}function ek(e){return sn(jo,"hex",ct.hex,e)}function tk(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=ct[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return sn(jo,n,o,t)}var ba=v("ZodNumber",(e,t)=>{Mi.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ih(e,n,o,i),e.gt=(n,o)=>e.check(At(n,o)),e.gte=(n,o)=>e.check(Ve(n,o)),e.min=(n,o)=>e.check(Ve(n,o)),e.lt=(n,o)=>e.check(Ct(n,o)),e.lte=(n,o)=>e.check(rt(n,o)),e.max=(n,o)=>e.check(rt(n,o)),e.int=n=>e.check(Al(n)),e.safe=n=>e.check(Al(n)),e.positive=n=>e.check(At(0,n)),e.nonnegative=n=>e.check(Ve(0,n)),e.negative=n=>e.check(Ct(0,n)),e.nonpositive=n=>e.check(rt(0,n)),e.multipleOf=(n,o)=>e.check($r(n,o)),e.step=(n,o)=>e.check($r(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 se(e){return Wu(ba,e)}var un=v("ZodNumberFormat",(e,t)=>{nu.init(e,t),ba.init(e,t)});function Al(e){return Gu(un,e)}function rk(e){return Xu(un,e)}function nk(e){return Yu(un,e)}function ok(e){return Qu(un,e)}function ik(e){return el(un,e)}var xa=v("ZodBoolean",(e,t)=>{uo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o)});function xe(e){return tl(xa,e)}var ka=v("ZodBigInt",(e,t)=>{Fi.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>sh(e,n,o,i),e.gte=(n,o)=>e.check(Ve(n,o)),e.min=(n,o)=>e.check(Ve(n,o)),e.gt=(n,o)=>e.check(At(n,o)),e.gte=(n,o)=>e.check(Ve(n,o)),e.min=(n,o)=>e.check(Ve(n,o)),e.lt=(n,o)=>e.check(Ct(n,o)),e.lte=(n,o)=>e.check(rt(n,o)),e.max=(n,o)=>e.check(rt(n,o)),e.positive=n=>e.check(At(BigInt(0),n)),e.negative=n=>e.check(Ct(BigInt(0),n)),e.nonpositive=n=>e.check(rt(BigInt(0),n)),e.nonnegative=n=>e.check(Ve(BigInt(0),n)),e.multipleOf=(n,o)=>e.check($r(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function ak(e){return rl(ka,e)}var td=v("ZodBigIntFormat",(e,t)=>{ou.init(e,t),ka.init(e,t)});function sk(e){return nl(td,e)}function ck(e){return ol(td,e)}var ig=v("ZodSymbol",(e,t)=>{iu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ch(e,r,n,o)});function uk(e){return il(ig,e)}var ag=v("ZodUndefined",(e,t)=>{au.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o)});function lk(e){return al(ag,e)}var sg=v("ZodNull",(e,t)=>{su.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o)});function Eo(e){return sl(sg,e)}var cg=v("ZodAny",(e,t)=>{cu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fh(e,r,n,o)});function dk(){return cl(cg)}var ug=v("ZodUnknown",(e,t)=>{uu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o)});function fe(){return ul(ug)}var lg=v("ZodNever",(e,t)=>{lu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ph(e,r,n,o)});function rd(e){return ll(lg,e)}var dg=v("ZodVoid",(e,t)=>{du.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dh(e,r,n,o)});function pk(e){return dl(dg,e)}var nd=v("ZodDate",(e,t)=>{pu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>hh(e,n,o,i),e.min=(n,o)=>e.check(Ve(n,o)),e.max=(n,o)=>e.check(rt(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 fk(e){return pl(nd,e)}var pg=v("ZodArray",(e,t)=>{fu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Qt(r,n)),e.nonempty=r=>e.check(Qt(1,r)),e.max=(r,n)=>e.check(on(r,n)),e.length=(r,n)=>e.check(an(r,n)),e.unwrap=()=>e.element});function Y(e,t){return rh(pg,e,t)}function mk(e){let t=e._zod.def.shape;return Ce(Object.keys(t))}var wa=v("ZodObject",(e,t)=>{eh.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ph(e,r,n,o),w.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Ce(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:fe()}),e.loose=()=>e.clone({...e._zod.def,catchall:fe()}),e.strict=()=>e.clone({...e._zod.def,catchall:rd()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>w.extend(e,r),e.safeExtend=r=>w.safeExtend(e,r),e.merge=r=>w.merge(e,r),e.pick=r=>w.pick(e,r),e.omit=r=>w.omit(e,r),e.partial=(...r)=>w.partial(id,e,r[0]),e.required=(...r)=>w.required(ad,e,r[0])});function T(e,t){let r={type:"object",shape:e??{},...w.normalizeParams(t)};return new wa(r)}function hk(e,t){return new wa({type:"object",shape:e,catchall:rd(),...w.normalizeParams(t)})}function Re(e,t){return new wa({type:"object",shape:e,catchall:fe(),...w.normalizeParams(t)})}var Sa=v("ZodUnion",(e,t)=>{lo.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zl(e,r,n,o),e.options=t.options});function ue(e,t){return new Sa({type:"union",options:e,...w.normalizeParams(t)})}var fg=v("ZodXor",(e,t)=>{Sa.init(e,t),mu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zl(e,r,n,o),e.options=t.options});function gk(e,t){return new fg({type:"union",options:e,inclusive:!1,...w.normalizeParams(t)})}var mg=v("ZodDiscriminatedUnion",(e,t)=>{Sa.init(e,t),hu.init(e,t)});function za(e,t,r){return new mg({type:"union",options:t,discriminator:e,...w.normalizeParams(r)})}var hg=v("ZodIntersection",(e,t)=>{gu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jh(e,r,n,o)});function To(e,t){return new hg({type:"intersection",left:e,right:t})}var gg=v("ZodTuple",(e,t)=>{Li.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function vg(e,t,r){let n=t instanceof V,o=n?r:t,i=n?t:null;return new gg({type:"tuple",items:e,rest:i,...w.normalizeParams(o)})}var Ia=v("ZodRecord",(e,t)=>{vu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ge(e,t,r){return new Ia({type:"record",keyType:e,valueType:t,...w.normalizeParams(r)})}function vk(e,t,r){let n=Le(e);return n._zod.values=void 0,new Ia({type:"record",keyType:n,valueType:t,...w.normalizeParams(r)})}function yk(e,t,r){return new Ia({type:"record",keyType:e,valueType:t,mode:"loose",...w.normalizeParams(r)})}var yg=v("ZodMap",(e,t)=>{yu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(Zt(...r)),e.nonempty=r=>e.check(Zt(1,r)),e.max=(...r)=>e.check(br(...r)),e.size=(...r)=>e.check(nn(...r))});function _k(e,t,r){return new yg({type:"map",keyType:e,valueType:t,...w.normalizeParams(r)})}var _g=v("ZodSet",(e,t)=>{_u.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zh(e,r,n,o),e.min=(...r)=>e.check(Zt(...r)),e.nonempty=r=>e.check(Zt(1,r)),e.max=(...r)=>e.check(br(...r)),e.size=(...r)=>e.check(nn(...r))});function $k(e,t){return new _g({type:"set",valueType:e,...w.normalizeParams(t)})}var Po=v("ZodEnum",(e,t)=>{$u.init(e,t),B.init(e,t),e._zod.processJSONSchema=(n,o,i)=>gh(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 Po({...t,checks:[],...w.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 Po({...t,checks:[],...w.normalizeParams(o),entries:i})}});function Ce(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Po({type:"enum",entries:r,...w.normalizeParams(t)})}function bk(e,t){return new Po({type:"enum",entries:e,...w.normalizeParams(t)})}var $g=v("ZodLiteral",(e,t)=>{bu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(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 N(e,t){return new $g({type:"literal",values:Array.isArray(e)?e:[e],...w.normalizeParams(t)})}var bg=v("ZodFile",(e,t)=>{xu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o),e.min=(r,n)=>e.check(Zt(r,n)),e.max=(r,n)=>e.check(br(r,n)),e.mime=(r,n)=>e.check(bo(Array.isArray(r)?r:[r],n))});function xk(e){return _l(bg,e)}var xg=v("ZodTransform",(e,t)=>{ku.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wh(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new gr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(w.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(w.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 od(e){return new xg({type:"transform",transform:e})}var id=v("ZodOptional",(e,t)=>{qi.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Il(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ve(e){return new id({type:"optional",innerType:e})}var kg=v("ZodExactOptional",(e,t)=>{wu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Il(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function wg(e){return new kg({type:"optional",innerType:e})}var Sg=v("ZodNullable",(e,t)=>{Su.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function va(e){return new Sg({type:"nullable",innerType:e})}function kk(e){return ve(va(e))}var zg=v("ZodDefault",(e,t)=>{zu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ig(e,t){return new zg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var Pg=v("ZodPrefault",(e,t)=>{Iu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function jg(e,t){return new Pg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var ad=v("ZodNonOptional",(e,t)=>{Pu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Eg(e,t){return new ad({type:"nonoptional",innerType:e,...w.normalizeParams(t)})}var Tg=v("ZodSuccess",(e,t)=>{ju.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function wk(e){return new Tg({type:"success",innerType:e})}var Og=v("ZodCatch",(e,t)=>{Eu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ch(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ng(e,t){return new Og({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Dg=v("ZodNaN",(e,t)=>{Tu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o)});function Sk(e){return fl(Dg,e)}var sd=v("ZodPipe",(e,t)=>{Ou.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ah(e,r,n,o),e.in=t.in,e.out=t.out});function ya(e,t){return new sd({type:"pipe",in:e,out:t})}var cd=v("ZodCodec",(e,t)=>{sd.init(e,t),po.init(e,t)});function zk(e,t,r){return new cd({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Rg=v("ZodReadonly",(e,t)=>{Nu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Cg(e){return new Rg({type:"readonly",innerType:e})}var Ag=v("ZodTemplateLiteral",(e,t)=>{Du.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o)});function Ik(e,t){return new Ag({type:"template_literal",parts:e,...w.normalizeParams(t)})}var Zg=v("ZodLazy",(e,t)=>{Au.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mh(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Ug(e){return new Zg({type:"lazy",getter:e})}var Mg=v("ZodPromise",(e,t)=>{Cu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Pk(e){return new Mg({type:"promise",innerType:e})}var Fg=v("ZodFunction",(e,t)=>{Ru.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o)});function jk(e){return new Fg({type:"function",input:Array.isArray(e?.input)?vg(e?.input):e?.input??Y(fe()),output:e?.output??fe()})}var Pa=v("ZodCustom",(e,t)=>{Zu.init(e,t),B.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o)});function Ek(e){let t=new de({check:"custom"});return t._zod.check=e,t}function ud(e,t){return $l(Pa,e??(()=>!0),t)}function Lg(e,t={}){return bl(Pa,e,t)}function qg(e){return xl(e)}var Tk=kl,Ok=wl;function Nk(e,t={}){let r=new Pa({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...w.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 Dk=(...e)=>Sl({Codec:cd,Boolean:xa,String:_a},...e);function Rk(e){let t=Ug(()=>ue([$(e),se(),xe(),Eo(),Y(t),ge($(),t)]));return t}function ja(e,t){return ya(od(e),t)}var Vg;Vg||(Vg={});var $R={...Io,...ha,iso:xr};we(Uu());var dd="2025-11-25";var Jg=[dd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],tr="io.modelcontextprotocol/related-task",Ta="2.0",Ie=ud(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Kg=ue([$(),se().int()]),Bg=$(),UR=Re({ttl:ue([se(),Eo()]).optional(),pollInterval:se().optional()}),Uk=T({ttl:se().optional()}),Mk=T({taskId:$()}),pd=Re({progressToken:Kg.optional(),[tr]:Mk.optional()}),ot=T({_meta:pd.optional()}),Oo=ot.extend({task:Uk.optional()}),Hg=e=>Oo.safeParse(e).success,Pe=T({method:$(),params:ot.loose().optional()}),ut=T({_meta:pd.optional()}),lt=T({method:$(),params:ut.loose().optional()}),je=Re({_meta:pd.optional()}),Oa=ue([$(),se().int()]),Wg=T({jsonrpc:N(Ta),id:Oa,...Pe.shape}).strict(),fd=e=>Wg.safeParse(e).success,Gg=T({jsonrpc:N(Ta),...lt.shape}).strict(),Xg=e=>Gg.safeParse(e).success,md=T({jsonrpc:N(Ta),id:Oa,result:je}).strict(),No=e=>md.safeParse(e).success;var A;(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"})(A||(A={}));var hd=T({jsonrpc:N(Ta),id:Oa.optional(),error:T({code:se().int(),message:$(),data:fe().optional()})}).strict();var Yg=e=>hd.safeParse(e).success;var Qg=ue([Wg,Gg,md,hd]),MR=ue([md,hd]),Na=je.strict(),Fk=ut.extend({requestId:Oa.optional(),reason:$().optional()}),Da=lt.extend({method:N("notifications/cancelled"),params:Fk}),Lk=T({src:$(),mimeType:$().optional(),sizes:Y($()).optional(),theme:Ce(["light","dark"]).optional()}),Do=T({icons:Y(Lk).optional()}),ln=T({name:$(),title:$().optional()}),ev=ln.extend({...ln.shape,...Do.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),qk=To(T({applyDefaults:xe().optional()}),ge($(),fe())),Vk=ja(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,To(T({form:qk.optional(),url:Ie.optional()}),ge($(),fe()).optional())),Jk=Re({list:Ie.optional(),cancel:Ie.optional(),requests:Re({sampling:Re({createMessage:Ie.optional()}).optional(),elicitation:Re({create:Ie.optional()}).optional()}).optional()}),Kk=Re({list:Ie.optional(),cancel:Ie.optional(),requests:Re({tools:Re({call:Ie.optional()}).optional()}).optional()}),Bk=T({experimental:ge($(),Ie).optional(),sampling:T({context:Ie.optional(),tools:Ie.optional()}).optional(),elicitation:Vk.optional(),roots:T({listChanged:xe().optional()}).optional(),tasks:Jk.optional()}),Hk=ot.extend({protocolVersion:$(),capabilities:Bk,clientInfo:ev}),gd=Pe.extend({method:N("initialize"),params:Hk});var Wk=T({experimental:ge($(),Ie).optional(),logging:Ie.optional(),completions:Ie.optional(),prompts:T({listChanged:xe().optional()}).optional(),resources:T({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:T({listChanged:xe().optional()}).optional(),tasks:Kk.optional()}),Gk=je.extend({protocolVersion:$(),capabilities:Wk,serverInfo:ev,instructions:$().optional()}),vd=lt.extend({method:N("notifications/initialized"),params:ut.optional()});var Ra=Pe.extend({method:N("ping"),params:ot.optional()}),Xk=T({progress:se(),total:ve(se()),message:ve($())}),Yk=T({...ut.shape,...Xk.shape,progressToken:Kg}),Ca=lt.extend({method:N("notifications/progress"),params:Yk}),Qk=ot.extend({cursor:Bg.optional()}),Ro=Pe.extend({params:Qk.optional()}),Co=je.extend({nextCursor:Bg.optional()}),ew=Ce(["working","input_required","completed","failed","cancelled"]),Ao=T({taskId:$(),status:ew,ttl:ue([se(),Eo()]),createdAt:$(),lastUpdatedAt:$(),pollInterval:ve(se()),statusMessage:ve($())}),dn=je.extend({task:Ao}),tw=ut.merge(Ao),Zo=lt.extend({method:N("notifications/tasks/status"),params:tw}),Aa=Pe.extend({method:N("tasks/get"),params:ot.extend({taskId:$()})}),Za=je.merge(Ao),Ua=Pe.extend({method:N("tasks/result"),params:ot.extend({taskId:$()})}),FR=je.loose(),Ma=Ro.extend({method:N("tasks/list")}),Fa=Co.extend({tasks:Y(Ao)}),La=Pe.extend({method:N("tasks/cancel"),params:ot.extend({taskId:$()})}),tv=je.merge(Ao),rv=T({uri:$(),mimeType:ve($()),_meta:ge($(),fe()).optional()}),nv=rv.extend({text:$()}),yd=$().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),ov=rv.extend({blob:yd}),Uo=Ce(["user","assistant"]),pn=T({audience:Y(Uo).optional(),priority:se().min(0).max(1).optional(),lastModified:xr.datetime({offset:!0}).optional()}),iv=T({...ln.shape,...Do.shape,uri:$(),description:ve($()),mimeType:ve($()),annotations:pn.optional(),_meta:ve(Re({}))}),rw=T({...ln.shape,...Do.shape,uriTemplate:$(),description:ve($()),mimeType:ve($()),annotations:pn.optional(),_meta:ve(Re({}))}),_d=Ro.extend({method:N("resources/list")}),nw=Co.extend({resources:Y(iv)}),ow=Ro.extend({method:N("resources/templates/list")}),iw=Co.extend({resourceTemplates:Y(rw)}),$d=ot.extend({uri:$()}),aw=$d,bd=Pe.extend({method:N("resources/read"),params:aw}),sw=je.extend({contents:Y(ue([nv,ov]))}),cw=lt.extend({method:N("notifications/resources/list_changed"),params:ut.optional()}),uw=$d,lw=Pe.extend({method:N("resources/subscribe"),params:uw}),dw=$d,pw=Pe.extend({method:N("resources/unsubscribe"),params:dw}),fw=ut.extend({uri:$()}),mw=lt.extend({method:N("notifications/resources/updated"),params:fw}),hw=T({name:$(),description:ve($()),required:ve(xe())}),gw=T({...ln.shape,...Do.shape,description:ve($()),arguments:ve(Y(hw)),_meta:ve(Re({}))}),xd=Ro.extend({method:N("prompts/list")}),vw=Co.extend({prompts:Y(gw)}),yw=ot.extend({name:$(),arguments:ge($(),$()).optional()}),kd=Pe.extend({method:N("prompts/get"),params:yw}),wd=T({type:N("text"),text:$(),annotations:pn.optional(),_meta:ge($(),fe()).optional()}),Sd=T({type:N("image"),data:yd,mimeType:$(),annotations:pn.optional(),_meta:ge($(),fe()).optional()}),zd=T({type:N("audio"),data:yd,mimeType:$(),annotations:pn.optional(),_meta:ge($(),fe()).optional()}),_w=T({type:N("tool_use"),name:$(),id:$(),input:ge($(),fe()),_meta:ge($(),fe()).optional()}),$w=T({type:N("resource"),resource:ue([nv,ov]),annotations:pn.optional(),_meta:ge($(),fe()).optional()}),bw=iv.extend({type:N("resource_link")}),Id=ue([wd,Sd,zd,bw,$w]),xw=T({role:Uo,content:Id}),kw=je.extend({description:$().optional(),messages:Y(xw)}),ww=lt.extend({method:N("notifications/prompts/list_changed"),params:ut.optional()}),Sw=T({title:$().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),zw=T({taskSupport:Ce(["required","optional","forbidden"]).optional()}),av=T({...ln.shape,...Do.shape,description:$().optional(),inputSchema:T({type:N("object"),properties:ge($(),Ie).optional(),required:Y($()).optional()}).catchall(fe()),outputSchema:T({type:N("object"),properties:ge($(),Ie).optional(),required:Y($()).optional()}).catchall(fe()).optional(),annotations:Sw.optional(),execution:zw.optional(),_meta:ge($(),fe()).optional()}),Pd=Ro.extend({method:N("tools/list")}),Iw=Co.extend({tools:Y(av)}),qa=je.extend({content:Y(Id).default([]),structuredContent:ge($(),fe()).optional(),isError:xe().optional()}),LR=qa.or(je.extend({toolResult:fe()})),Pw=Oo.extend({name:$(),arguments:ge($(),fe()).optional()}),Mo=Pe.extend({method:N("tools/call"),params:Pw}),jw=lt.extend({method:N("notifications/tools/list_changed"),params:ut.optional()}),qR=T({autoRefresh:xe().default(!0),debounceMs:se().int().nonnegative().default(300)}),Fo=Ce(["debug","info","notice","warning","error","critical","alert","emergency"]),Ew=ot.extend({level:Fo}),jd=Pe.extend({method:N("logging/setLevel"),params:Ew}),Tw=ut.extend({level:Fo,logger:$().optional(),data:fe()}),Ow=lt.extend({method:N("notifications/message"),params:Tw}),Nw=T({name:$().optional()}),Dw=T({hints:Y(Nw).optional(),costPriority:se().min(0).max(1).optional(),speedPriority:se().min(0).max(1).optional(),intelligencePriority:se().min(0).max(1).optional()}),Rw=T({mode:Ce(["auto","required","none"]).optional()}),Cw=T({type:N("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:Y(Id).default([]),structuredContent:T({}).loose().optional(),isError:xe().optional(),_meta:ge($(),fe()).optional()}),Aw=za("type",[wd,Sd,zd]),Ea=za("type",[wd,Sd,zd,_w,Cw]),Zw=T({role:Uo,content:ue([Ea,Y(Ea)]),_meta:ge($(),fe()).optional()}),Uw=Oo.extend({messages:Y(Zw),modelPreferences:Dw.optional(),systemPrompt:$().optional(),includeContext:Ce(["none","thisServer","allServers"]).optional(),temperature:se().optional(),maxTokens:se().int(),stopSequences:Y($()).optional(),metadata:Ie.optional(),tools:Y(av).optional(),toolChoice:Rw.optional()}),Mw=Pe.extend({method:N("sampling/createMessage"),params:Uw}),Ed=je.extend({model:$(),stopReason:ve(Ce(["endTurn","stopSequence","maxTokens"]).or($())),role:Uo,content:Aw}),Td=je.extend({model:$(),stopReason:ve(Ce(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:Uo,content:ue([Ea,Y(Ea)])}),Fw=T({type:N("boolean"),title:$().optional(),description:$().optional(),default:xe().optional()}),Lw=T({type:N("string"),title:$().optional(),description:$().optional(),minLength:se().optional(),maxLength:se().optional(),format:Ce(["email","uri","date","date-time"]).optional(),default:$().optional()}),qw=T({type:Ce(["number","integer"]),title:$().optional(),description:$().optional(),minimum:se().optional(),maximum:se().optional(),default:se().optional()}),Vw=T({type:N("string"),title:$().optional(),description:$().optional(),enum:Y($()),default:$().optional()}),Jw=T({type:N("string"),title:$().optional(),description:$().optional(),oneOf:Y(T({const:$(),title:$()})),default:$().optional()}),Kw=T({type:N("string"),title:$().optional(),description:$().optional(),enum:Y($()),enumNames:Y($()).optional(),default:$().optional()}),Bw=ue([Vw,Jw]),Hw=T({type:N("array"),title:$().optional(),description:$().optional(),minItems:se().optional(),maxItems:se().optional(),items:T({type:N("string"),enum:Y($())}),default:Y($()).optional()}),Ww=T({type:N("array"),title:$().optional(),description:$().optional(),minItems:se().optional(),maxItems:se().optional(),items:T({anyOf:Y(T({const:$(),title:$()}))}),default:Y($()).optional()}),Gw=ue([Hw,Ww]),Xw=ue([Kw,Bw,Gw]),Yw=ue([Xw,Fw,Lw,qw]),Qw=Oo.extend({mode:N("form").optional(),message:$(),requestedSchema:T({type:N("object"),properties:ge($(),Yw),required:Y($()).optional()})}),eS=Oo.extend({mode:N("url"),message:$(),elicitationId:$(),url:$().url()}),tS=ue([Qw,eS]),rS=Pe.extend({method:N("elicitation/create"),params:tS}),nS=ut.extend({elicitationId:$()}),oS=lt.extend({method:N("notifications/elicitation/complete"),params:nS}),Va=je.extend({action:Ce(["accept","decline","cancel"]),content:ja(e=>e===null?void 0:e,ge($(),ue([$(),se(),xe(),Y($())])).optional())}),iS=T({type:N("ref/resource"),uri:$()});var aS=T({type:N("ref/prompt"),name:$()}),sS=ot.extend({ref:ue([aS,iS]),argument:T({name:$(),value:$()}),context:T({arguments:ge($(),$()).optional()}).optional()}),cS=Pe.extend({method:N("completion/complete"),params:sS});var uS=je.extend({completion:Re({values:Y($()).max(100),total:ve(se().int()),hasMore:ve(xe())})}),lS=T({uri:$().startsWith("file://"),name:$().optional(),_meta:ge($(),fe()).optional()}),dS=Pe.extend({method:N("roots/list"),params:ot.optional()}),Od=je.extend({roots:Y(lS)}),pS=lt.extend({method:N("notifications/roots/list_changed"),params:ut.optional()}),VR=ue([Ra,gd,cS,jd,kd,xd,_d,ow,bd,lw,pw,Mo,Pd,Aa,Ua,Ma,La]),JR=ue([Da,Ca,vd,pS,Zo]),KR=ue([Na,Ed,Td,Va,Od,Za,Fa,dn]),BR=ue([Ra,Mw,rS,dS,Aa,Ua,Ma,La]),HR=ue([Da,Ca,Ow,mw,cw,jw,ww,Zo,oS]),WR=ue([Na,Gk,uS,kw,vw,nw,iw,sw,qa,Iw,Za,Fa,dn]),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===A.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new ld(o.elicitations,r)}return new e(t,r,n)}},ld=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(A.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function rr(e){return e==="completed"||e==="failed"||e==="cancelled"}var j4=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Nd(e){let r=ma(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Vh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Dd(e,t){let r=er(e,t);if(!r.success)throw r.error;return r.data}var yS=6e4,Ja=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(Da,r=>{this._oncancel(r)}),this.setNotificationHandler(Ca,r=>{this._onprogress(r)}),this.setRequestHandler(Ra,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Aa,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(A.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ua,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,f=new R(d.error.code,d.error.message,d.error.data);l(f)}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(A.InvalidParams,`Task not found: ${i}`);if(!rr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(rr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[tr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Ma,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(A.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(La,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(A.InvalidParams,`Task not found: ${r.params.taskId}`);if(rr(o.status))throw new R(A.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(A.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof R?o:new R(A.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(A.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),No(i)||Yg(i)?this._onresponse(i):fd(i)?this._onrequest(i,a):Xg(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(A.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?.[tr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:A.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=Hg(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,f)=>{if(a.signal.aborted)throw new R(A.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:t.id};i&&!p.relatedTask&&(p.relatedTask={taskId:i});let m=p.relatedTask?.taskId??i;return m&&c&&await c.updateTaskStatus(m,"input_required"),await this.request(l,d,p)},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:A.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),No(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(No(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),No(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(A.InternalError,String(a))}}return}let i;try{let a=await this.request(t,dn,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new R(A.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},rr(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(A.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new R(A.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(A.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 f=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[tr]:c}});let m=_=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(_)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let b=_ instanceof R?_:new R(A.RequestTimeout,String(_));l(b)};this._responseHandlers.set(f,_=>{if(!n?.signal?.aborted){if(_ instanceof Error)return l(_);try{let b=er(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??yS,g=()=>m(R.fromError(A.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(f,h,n?.maxTotalTimeout,g,n?.resetTimeoutOnProgress??!1);let y=c?.taskId;if(y){let _=b=>{let S=this._responseHandlers.get(f);S?S(b):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,_),this._enqueueTaskMessage(y,{type:"request",message:p,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(f),l(b)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(_=>{this._cleanupTimeout(f),l(_)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Za,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},Fa,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},tv,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||{},[tr]: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||{},[tr]: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||{},[tr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Nd(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Dd(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=Nd(t);this._notificationHandlers.set(n,o=>{let i=Dd(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"&&fd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new R(A.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(A.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new R(A.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(A.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=Zo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),rr(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(A.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(rr(s.status))throw new R(A.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=Zo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),rr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function sv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function cv(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];sv(a)&&sv(i)?r[o]={...a,...i}:r[o]=i}return r}var p$=it(jf(),1),f$=it(d$(),1);function JE(){let e=new p$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,f$.default)(e),e}var js=class{constructor(t){this._ajv=t??JE()}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 Es=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 m$(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 h$(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 Ts=class extends Ja{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Fo.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 js,this.setRequestHandler(gd,n=>this._oninitialize(n)),this.setNotificationHandler(vd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(jd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Fo.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Es(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=cv(this._capabilities,t)}setRequestHandler(t,r){let o=ma(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(cn(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=er(Mo,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new R(A.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let m=er(dn,f);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new R(A.InvalidParams,`Invalid task creation result: ${h}`)}return m.data}let p=er(qa,f);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new R(A.InvalidParams,`Invalid tools/call result: ${m}`)}return p.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){h$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&m$(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:Jg.includes(r)?r:dd,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"},Na)}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},Td,r):this.request({method:"sampling/createMessage",params:t},Ed,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},Va,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},Va,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(A.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof R?a:new R(A.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},Od,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 Af=it(require("node:process"),1);var Os=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),KE(r)}clear(){this._buffer=void 0}};function KE(e){return Qg.parse(JSON.parse(e))}function g$(e){return JSON.stringify(e)+`
49
- `}var Ns=class{constructor(t=Af.default.stdin,r=Af.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Os,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=g$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Se=it(require("fs/promises")),ke=it(require("path")),En=10*1024*1024,BE=1e3,Ds=class{skillsPath;cachedSkills=null;loadingPromise=null;loadingEpoch=-1;skillMap=new Map;contentCache=new Map;contentCacheStat=new Map;canonicalPathMap=new Map;scanEpoch=0;lastSuccessfulScanAt=0;skillSignature=null;constructor(t){this.skillsPath=ke.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 f=l.match(/^description:\s*(.*?)\s*$/);if(f){c=this.stripQuotes(f[1]),u=!0;continue}u&&/^\s+/.test(l)?c+=" "+l.trim():u=!1}return{name:s,description:c,body:i}}async listSkills(t=!1){if(!t&&this.cachedSkills&&Date.now()-this.lastSuccessfulScanAt<BE)return this.cachedSkills;let r=await this.computeSkillSignature();if(!t&&this.cachedSkills&&this.skillSignature!==null&&r===this.skillSignature)return this.lastSuccessfulScanAt=Date.now(),this.cachedSkills;t&&this.dropContentCaches();let n=this.loadingPromise;if(!t&&n&&this.loadingEpoch===this.scanEpoch)return n;let o=++this.scanEpoch,i=this.internalListSkills(o,r);this.loadingPromise=i,this.loadingEpoch=o;try{return await i}finally{this.loadingPromise===i&&(this.loadingPromise=null,this.loadingEpoch=-1)}}dropContentCaches(){this.contentCache.clear(),this.contentCacheStat.clear(),this.canonicalPathMap.clear(),this.skillSignature=null}async computeSkillSignature(){let t=async r=>{try{let n=await Se.lstat(r);return`${n.mode}\0${n.ino}\0${n.size}\0${n.mtimeMs}`}catch{return"-"}};try{let n=(await Se.readdir(this.skillsPath,{withFileTypes:!0})).filter(i=>i.isDirectory()||i.isSymbolicLink()),o=await Promise.all(n.map(async i=>{let a=ke.join(this.skillsPath,i.name),s=i.isDirectory()?"d":"l",c=s==="l"?await t(a):"-",u=await t(ke.join(a,"SKILL.md"));return`${i.name}\0${s}\0${c}\0${u}`}));return o.sort(),o.join("")}catch{return null}}async internalListSkills(t=this.scanEpoch,r){let n;try{let d=ke.resolve(this.skillsPath),f=await Se.realpath(d),p=await Se.stat(f);if(!p.isDirectory())return this.cachedSkills??[];n={realRootPath:f,rootStat:p}}catch{return this.cachedSkills??[]}let o=r!==void 0?r:await this.computeSkillSignature(),i=[],a=new Map,s=new Map,c=new Map,u=new Map,l=!1;try{let f=(await Se.readdir(this.skillsPath,{withFileTypes:!0})).filter(m=>m.isDirectory()||m.isSymbolicLink()),p=await Promise.all(f.map(async m=>{let h=ke.join(this.skillsPath,m.name),g=ke.join(h,"SKILL.md");try{let{content:y,realFilePath:_,stat:b}=await this.readFileNoFollow(g,this.skillsPath,n),{name:S,description:z,body:te}=this.parseFrontmatter(y);return{item:{name:S||m.name,description:z,skillPath:g},body:te,realFilePath:_,directoryName:m.name,stat:b}}catch(y){return y&&typeof y=="object"&&"code"in y&&y.code==="ENOENT"||process.stderr.write(`Warning: Failed to read skill file in directory "${m.name}"
50
- `),null}}));for(let m of p.filter(h=>h!==null).sort((h,g)=>h.directoryName<g.directoryName?-1:h.directoryName>g.directoryName?1:0)){let{item:h,body:g,realFilePath:y,directoryName:_,stat:b}=m,S=new Set([h.name.toLowerCase(),_.toLowerCase()]),z=[...S].find(ae=>a.has(ae));if(z){process.stderr.write(`Warning: Skipping skill directory "${_}" because name or alias "${z}" is already registered
51
- `);continue}i.push(h);for(let ae of S)a.set(ae,h);let te=ke.resolve(h.skillPath);s.set(y,g),c.set(y,{dev:b.dev,ino:b.ino,size:b.size,mtimeMs:b.mtimeMs}),u.set(te,y),u.set(y,y)}l=!0}catch(d){process.stderr.write(`Error reading skills directory: ${String(d)}
52
- `)}return l&&t===this.scanEpoch?(this.skillMap=a,this.cachedSkills=i.sort((d,f)=>d.name.localeCompare(f.name)),this.lastSuccessfulScanAt=Date.now(),this.contentCache=s,this.contentCacheStat=c,this.canonicalPathMap=u,this.skillSignature=o):l||(this.skillSignature=null),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=ke.resolve(t),i=ke.resolve(r),a=await Se.realpath(o),s=n?n.realRootPath:await Se.realpath(i);if(!(n?n.rootStat:await Se.stat(s)).isDirectory())throw new Error("Skills directory must be a directory");let u=ke.relative(s,a);if(u===".."||u.startsWith(`..${ke.sep}`)||ke.isAbsolute(u))throw new Error("File is outside skills directory");let l=await Se.stat(a);if(!l.isFile()||l.nlink<1)throw new Error("Skill path is not a regular file");if(l.size>En)throw new Error("Skill file exceeds size limit");let d=process.platform==="win32"?0:Se.constants.O_NOFOLLOW,f=await Se.open(a,Se.constants.O_RDONLY|d);try{let p=await f.stat();if(!p.isFile()||p.nlink<1||p.dev!==l.dev||p.ino!==l.ino||p.size>En)throw new Error("File changed while opening");let m=p.size,h;if(m<=64*1024){h=Buffer.allocUnsafe(m);let y=0;for(;y<m;){let{bytesRead:_}=await f.read(h,y,m-y,null);if(_===0)break;y+=_}y<m&&(h=h.subarray(0,y))}else{let y=[],b=0;for(;b<=En;){let S=Buffer.allocUnsafe(Math.min(65536,En+1-b)),{bytesRead:z}=await f.read(S,0,S.length,null);if(z===0)break;if(b+=z,y.push(S.subarray(0,z)),b>En)throw new Error("Skill file exceeds size limit")}h=Buffer.concat(y,b)}let g=await f.stat();if(g.size>En||g.dev!==l.dev||g.ino!==l.ino||g.size!==l.size||g.mtimeMs!==l.mtimeMs)throw new Error("File changed while reading");return{content:h.toString("utf-8"),realFilePath:a,stat:g}}finally{await f.close()}}async readSkillContent(t,r=!1){let n=ke.isAbsolute(t)?ke.resolve(t):ke.resolve(this.skillsPath,t);if(!r){let o=await this.tryReadFromContentCache(n);if(o!==void 0)return o}try{let{content:o,realFilePath:i,stat:a}=await this.readFileNoFollow(n,this.skillsPath),{body:s}=this.parseFrontmatter(o);return this.contentCache.set(i,s),this.contentCacheStat.set(i,{dev:a.dev,ino:a.ino,size:a.size,mtimeMs:a.mtimeMs}),this.canonicalPathMap.set(n,i),this.canonicalPathMap.set(i,i),s}catch(o){throw new Error(`Failed to read skill content: ${o instanceof Error?o.message:String(o)}`)}}async tryReadFromContentCache(t){let r=this.canonicalPathMap.get(t);if(!r)return;let n=this.contentCache.get(r),o=this.contentCacheStat.get(r);if(!(n===void 0||!o))try{let i=await Se.stat(t);if(i.isFile()&&i.dev===o.dev&&i.ino===o.ino&&i.size===o.size&&i.mtimeMs===o.mtimeMs)return n}catch{}}clearCache(){this.scanEpoch++,this.cachedSkills=null,this.loadingPromise=null,this.loadingEpoch=-1,this.skillMap.clear(),this.contentCache.clear(),this.contentCacheStat.clear(),this.canonicalPathMap.clear(),this.skillSignature=null,this.lastSuccessfulScanAt=0}};var C=it(require("fs")),x=it(require("path")),Rr=it(require("os")),$$=it(require("crypto")),$i={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>x.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||x.join(t,"AppData","Roaming"):e==="darwin"?x.join(t,"Library","Application Support"):x.join(t,".config");return x.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"?x.join(r||x.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?x.join(t,"Library","Application Support","Code","User","mcp.json"):x.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"?x.join(r||x.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?x.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):x.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)=>x.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||x.join(t,"AppData","Local");return x.join(o,"hermes","config.yaml")}return x.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)=>x.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"?x.join(r||x.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?x.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):x.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,r)=>{let n=e==="win32"&&r?r:x.join(t,".config"),o=x.join(n,"devin","mcp_config.json");return C.existsSync(o)?o:x.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)=>x.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=x.join(r||x.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(C.existsSync(i))return i;let a=x.join(t,".pi","agent","mcp.json");if(C.existsSync(a))return a;let s=x.join(t,".pi","mcp.json");return C.existsSync(s)?s:a}let n=x.join(t,".pi","agent","mcp.json");if(C.existsSync(n))return n;let o=x.join(t,".pi","mcp.json");return C.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=x.join(t,".qwenpaw","config.json");if(C.existsSync(r))return r;let n=x.join(t,".copaw","config.json");return C.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=x.join(r||x.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?n=x.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):n=x.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),C.existsSync(n))return n;let o=x.join(t,".cline","data","settings","cline_mcp_settings.json");return C.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=x.join(t,".config","kilo","kilo.jsonc");if(C.existsSync(r))return r;let n=x.join(t,".config","kilo","kilo.json");return C.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)=>x.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)=>x.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=x.join(r||x.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(C.existsSync(n))return n;let o=x.join(r||x.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return C.existsSync(o)?o:n}else if(e==="darwin"){let n=x.join(t,"Library","Application Support","Trae","User","mcp.json");if(C.existsSync(n))return n;let o=x.join(t,"Library","Application Support","Trae CN","User","mcp.json");return C.existsSync(o)?o:n}else{let n=x.join(t,".config","Trae","User","mcp.json");if(C.existsSync(n))return n;let o=x.join(t,".config","Trae CN","User","mcp.json");return C.existsSync(o)?o:n}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},codex:{name:"Codex",aliases:["codex"],getConfigPath:(e,t)=>x.join(t,".codex","config.toml"),type:"toml",defaultConfig:(e,t)=>({command:e,args:t})},openclaw:{name:"OpenClaw",aliases:["openclaw","open-claw"],getConfigPath:(e,t)=>x.join(t,".openclaw","openclaw.json"),type:"json-mcpServers",serverPath:["mcp","servers"],defaultConfig:(e,t)=>({command:e,args:t})},goose:{name:"Goose",aliases:["goose"],getConfigPath:(e,t,r)=>e==="win32"?x.join(r||x.join(t,"AppData","Roaming"),"Block","goose","config","config.yaml"):x.join(t,".config","goose","config.yaml"),type:"yaml",yamlProfile:"goose",defaultConfig:(e,t)=>({cmd:e,args:t})}},HE=["mcpServers","servers","mcp"];function Tn(e){return Object.prototype.toString.call(e)==="[object Object]"}function WE(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===`
45
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");let _=p.compile();return(b,S)=>_(f,b,S)},i,a=yr,s=!Ii.jitless,u=s&&Xs.value,l=t.catchall,d;e._zod.parse=(f,p)=>{d??(d=n.value);let g=f.value;return a(g)?s&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(t.shape)),f=i(f,p),l?th([],g,f,p,d,e):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),f)}});function qm(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=>!Yt(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=>Be(a,n,we())))}),t)}var po=v("$ZodUnion",(e,t)=>{V.init(e,t),K(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),K(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),K(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),K(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=>Wn(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=>qm(c,o,e,i)):qm(s,o,e,i)}});function Vm(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=>Be(a,n,we())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var gu=v("$ZodXor",(e,t)=>{po.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=>Vm(c,o,e,i)):Vm(s,o,e,i)}}),vu=v("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,po.init(e,t);let r=e._zod.parse;K(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=tn(()=>{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(!yr(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)}}),yu=v("$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])=>Jm(r,c,u)):Jm(r,i,a)}});function Nc(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(Xt(e)&&Xt(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=Nc(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=Nc(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 Jm(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}),Yt(e))return e;let a=Nc(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 qi=v("$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(f=>Ci(f,n,u))):Ci(d,n,u)}if(t.rest){let l=i.slice(r.length);for(let d of l){u++;let f=t.rest._zod.run({value:d,issues:[]},o);f instanceof Promise?a.push(f.then(p=>Ci(p,n,u))):Ci(f,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Ci(e,t,r){e.issues.length&&t.issues.push(...tt(r,e.issues)),t.value[r]=e.value}var _u=v("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Xt(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(...tt(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...tt(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"&&Di.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=>Be(d,n,we())),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(...tt(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...tt(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),$u=v("$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])=>{Km(l,d,r,a,o,e,n)})):Km(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function Km(e,t,r,n,o,i,a){e.issues.length&&(Gn.has(typeof n)?r.issues.push(...tt(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>Be(s,a,we()))})),t.issues.length&&(Gn.has(typeof n)?r.issues.push(...tt(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>Be(s,a,we()))})),r.value.set(e.value,t.value)}var bu=v("$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=>Hm(c,r))):Hm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Hm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var xu=v("$ZodEnum",(e,t)=>{V.init(e,t);let r=Bn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Gn.has(typeof o)).map(o=>typeof o=="string"?st(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}}),ku=v("$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"?st(n):n?st(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}}),wu=v("$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}}),Su=v("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(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 wt;return r.value=o,r}});function Bm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Vi=v("$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(`^(${Wn(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=>Bm(i,r.value)):Bm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),zu=v("$ZodExactOptional",(e,t)=>{Vi.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)}),Iu=v("$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(`^(${Wn(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)}),Pu=v("$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 o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Wm(i,t)):Wm(o,t)}});function Wm(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ju=v("$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))}),Eu=v("$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 o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Gm(i,e)):Gm(o,e)}});function Gm(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 Tu=v("$ZodSuccess",(e,t)=>{V.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr("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)}}),Ou=v("$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 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=>Be(a,n,we()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Be(i,n,we()))},input:r.value}),r.issues=[]),r)}}),Nu=v("$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)}),Du=v("$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 i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Zi(a,t.in,n)):Zi(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Zi(i,t.out,n)):Zi(o,t.out,n)}});function Zi(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var fo=v("$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 i=t.in._zod.run(r,n);return i instanceof Promise?i.then(a=>Ai(a,t,n)):Ai(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ai(a,t,n)):Ai(i,t,n)}}});function Ai(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=>Ui(e,i,t.out,r)):Ui(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Ui(e,i,t.in,r)):Ui(e,o,t.in,r)}}function Ui(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Ru=v("$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 o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Xm):Xm(o)}});function Xm(e){return e.value=Object.freeze(e.value),e}var Cu=v("$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||Qs.has(typeof n))r.push(st(`${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)}),Zu=v("$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?to(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?to(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 no(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await no(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 qi({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)),Au=v("$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))}),Uu=v("$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)}),Mu=v("$ZodCustom",(e,t)=>{de.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=>Ym(i,r,n,e));Ym(o,r,n,e)}});function Ym(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(rn(o))}}var cx=()=>{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=L(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${M(o.values[0])}`:`Invalid option: expected one of ${U(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":""}: ${U(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 Fu(){return{localeError:cx()}}var oh;var qu=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 Vu(){return new qu}(oh=globalThis).__zod_globalRegistry??(oh.__zod_globalRegistry=Vu());var qe=globalThis.__zod_globalRegistry;function Ju(e,t){return new e({type:"string",...P(t)})}function Ji(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...P(t)})}function mo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...P(t)})}function Ki(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...P(t)})}function Hi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...P(t)})}function Bi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...P(t)})}function Wi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...P(t)})}function ho(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...P(t)})}function Gi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...P(t)})}function Xi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...P(t)})}function Yi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...P(t)})}function Qi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...P(t)})}function ea(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...P(t)})}function ta(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...P(t)})}function ra(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...P(t)})}function na(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...P(t)})}function oa(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...P(t)})}function Ku(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...P(t)})}function ia(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...P(t)})}function aa(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...P(t)})}function sa(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...P(t)})}function ca(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...P(t)})}function ua(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...P(t)})}function la(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...P(t)})}function Hu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...P(t)})}function Bu(e,t){return new e({type:"string",format:"date",check:"string_format",...P(t)})}function Wu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...P(t)})}function Gu(e,t){return new e({type:"string",format:"duration",check:"string_format",...P(t)})}function Xu(e,t){return new e({type:"number",checks:[],...P(t)})}function Yu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...P(t)})}function Qu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...P(t)})}function el(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...P(t)})}function tl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...P(t)})}function rl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...P(t)})}function nl(e,t){return new e({type:"boolean",...P(t)})}function ol(e,t){return new e({type:"bigint",...P(t)})}function il(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...P(t)})}function al(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...P(t)})}function sl(e,t){return new e({type:"symbol",...P(t)})}function cl(e,t){return new e({type:"undefined",...P(t)})}function ul(e,t){return new e({type:"null",...P(t)})}function ll(e){return new e({type:"any"})}function dl(e){return new e({type:"unknown"})}function pl(e,t){return new e({type:"never",...P(t)})}function fl(e,t){return new e({type:"void",...P(t)})}function ml(e,t){return new e({type:"date",...P(t)})}function hl(e,t){return new e({type:"nan",...P(t)})}function Ct(e,t){return new Tc({check:"less_than",...P(t),value:e,inclusive:!1})}function rt(e,t){return new Tc({check:"less_than",...P(t),value:e,inclusive:!0})}function Zt(e,t){return new Oc({check:"greater_than",...P(t),value:e,inclusive:!1})}function Ve(e,t){return new Oc({check:"greater_than",...P(t),value:e,inclusive:!0})}function gl(e){return Zt(0,e)}function vl(e){return Ct(0,e)}function yl(e){return rt(0,e)}function _l(e){return Ve(0,e)}function br(e,t){return new xm({check:"multiple_of",...P(t),value:e})}function xr(e,t){return new Sm({check:"max_size",...P(t),maximum:e})}function At(e,t){return new zm({check:"min_size",...P(t),minimum:e})}function on(e,t){return new Im({check:"size_equals",...P(t),size:e})}function an(e,t){return new Pm({check:"max_length",...P(t),maximum:e})}function Qt(e,t){return new jm({check:"min_length",...P(t),minimum:e})}function sn(e,t){return new Em({check:"length_equals",...P(t),length:e})}function go(e,t){return new Tm({check:"string_format",format:"regex",...P(t),pattern:e})}function vo(e){return new Om({check:"string_format",format:"lowercase",...P(e)})}function yo(e){return new Nm({check:"string_format",format:"uppercase",...P(e)})}function _o(e,t){return new Dm({check:"string_format",format:"includes",...P(t),includes:e})}function $o(e,t){return new Rm({check:"string_format",format:"starts_with",...P(t),prefix:e})}function bo(e,t){return new Cm({check:"string_format",format:"ends_with",...P(t),suffix:e})}function $l(e,t,r){return new Zm({check:"property",property:e,schema:t,...P(r)})}function xo(e,t){return new Am({check:"mime_type",mime:e,...P(t)})}function St(e){return new Um({check:"overwrite",tx:e})}function ko(e){return St(t=>t.normalize(e))}function wo(){return St(e=>e.trim())}function So(){return St(e=>e.toLowerCase())}function zo(){return St(e=>e.toUpperCase())}function da(){return St(e=>Gs(e))}function ih(e,t,r){return new e({type:"array",element:t,...P(r)})}function bl(e,t){return new e({type:"file",...P(t)})}function xl(e,t,r){let n=P(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function kl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...P(r)})}function wl(e){let t=px(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(rn(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(rn(o))}},e(r.value,r)));return t}function px(e,t){let r=new de({check:"custom",...P(t)});return r._zod.check=e,r}function Sl(e){let t=new de({check:"describe"});return t._zod.onattach=[r=>{let n=qe.get(r)??{};qe.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function zl(e){let t=new de({check:"meta"});return t._zod.onattach=[r=>{let n=qe.get(r)??{};qe.add(r,{...n,...e})}],t._zod.check=()=>{},t}function Il(e,t){let r=P(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(p=>typeof p=="string"?p.toLowerCase():p),o=o.map(p=>typeof p=="string"?p.toLowerCase():p));let i=new Set(n),a=new Set(o),s=e.Codec??fo,c=e.Boolean??lo,u=e.String??$r,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:l,out:d,transform:((p,g)=>{let h=p;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:f,continue:!1}),{})}),reverseTransform:((p,g)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function cn(e,t,r,n={}){let o=P(n),i={...P(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 pa(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??qe,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 he(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 f=a.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,f,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),he(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"&&Je(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 fa(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,f=e.external.uri??(g=>g);if(d)return{ref:f(d)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${f("__shared")}#/${s}/${p}`}}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 ma(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 f=e.seen.get(l),p=f.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===l)for(let h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(p.$ref&&f.def)for(let h in c)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(c[h])===JSON.stringify(f.def[h])&&delete c[h]}let d=a._zod.parent;if(d&&d!==l){n(d);let f=e.seen.get(d);if(f?.schema.$ref&&(c.$ref=f.schema.$ref,f.def))for(let p in c)p==="$ref"||p==="allOf"||p in f.def&&JSON.stringify(c[p])===JSON.stringify(f.def[p])&&delete c[p]}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:Io(t,"input",e.processors),output:Io(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Je(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 Je(n.element,r);if(n.type==="set")return Je(n.valueType,r);if(n.type==="lazy")return Je(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 Je(n.innerType,r);if(n.type==="intersection")return Je(n.left,r)||Je(n.right,r);if(n.type==="record"||n.type==="map")return Je(n.keyType,r)||Je(n.valueType,r);if(n.type==="pipe")return Je(n.in,r)||Je(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Je(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Je(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Je(o,r))return!0;return!!(n.rest&&Je(n.rest,r))}return!1}var ah=(e,t={})=>r=>{let n=pa({...r,processors:t});return he(e,n),fa(n,e),ma(n,e)},Io=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=pa({...o??{},target:i,io:t,processors:r});return he(e,a),fa(a,e),ma(a,e)};var fx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sh=(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=fx[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}))])}},ch=(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)},uh=(e,t,r,n)=>{r.type="boolean"},lh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},dh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},ph=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},fh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},mh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},hh=(e,t,r,n)=>{r.not={}},gh=(e,t,r,n)=>{},vh=(e,t,r,n)=>{},yh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},_h=(e,t,r,n)=>{let o=e._zod.def,i=Bn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},$h=(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},bh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},xh=(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},kh=(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)},wh=(e,t,r,n)=>{r.type="boolean"},Sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},zh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Ih=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ph=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},jh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Eh=(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=he(i.element,t,{...n,path:[...n.path,"items"]})},Th=(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]=he(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=he(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Pl=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>he(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Oh=(e,t,r,n)=>{let o=e._zod.def,i=he(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=he(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},Nh=(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((f,p)=>he(f,t,{...n,path:[...n.path,a,p]})),u=i.rest?he(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)},Dh=(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=he(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=he(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=he(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)}},Rh=(e,t,r,n)=>{let o=e._zod.def,i=he(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"}]},Ch=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Zh=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Ah=(e,t,r,n)=>{let o=e._zod.def;he(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)))},Uh=(e,t,r,n)=>{let o=e._zod.def;he(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},Mh=(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;he(i,t,n);let a=t.seen.get(e);a.ref=i},Fh=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Lh=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},jl=(e,t,r,n)=>{let o=e._zod.def;he(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},qh=(e,t,r,n)=>{let o=e._zod.innerType;he(o,t,n);let i=t.seen.get(e);i.ref=o};function un(e){return!!e._zod}function er(e,t){return un(e)?nn(e,t):e.safeParse(t)}function ha(e){if(!e)return;let t;if(un(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Hh(e){if(un(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 Po={};Dn(Po,{ZodAny:()=>dg,ZodArray:()=>hg,ZodBase64:()=>Ql,ZodBase64URL:()=>ed,ZodBigInt:()=>wa,ZodBigIntFormat:()=>nd,ZodBoolean:()=>ka,ZodCIDRv4:()=>Xl,ZodCIDRv6:()=>Yl,ZodCUID:()=>Vl,ZodCUID2:()=>Jl,ZodCatch:()=>Rg,ZodCodec:()=>ld,ZodCustom:()=>ja,ZodCustomStringFormat:()=>Eo,ZodDate:()=>id,ZodDefault:()=>jg,ZodDiscriminatedUnion:()=>vg,ZodE164:()=>td,ZodEmail:()=>Fl,ZodEmoji:()=>Ll,ZodEnum:()=>jo,ZodExactOptional:()=>zg,ZodFile:()=>wg,ZodFunction:()=>Vg,ZodGUID:()=>va,ZodIPv4:()=>Wl,ZodIPv6:()=>Gl,ZodIntersection:()=>yg,ZodJWT:()=>rd,ZodKSUID:()=>Bl,ZodLazy:()=>Fg,ZodLiteral:()=>kg,ZodMAC:()=>sg,ZodMap:()=>bg,ZodNaN:()=>Zg,ZodNanoID:()=>ql,ZodNever:()=>fg,ZodNonOptional:()=>cd,ZodNull:()=>lg,ZodNullable:()=>Pg,ZodNumber:()=>xa,ZodNumberFormat:()=>ln,ZodObject:()=>Sa,ZodOptional:()=>sd,ZodPipe:()=>ud,ZodPrefault:()=>Tg,ZodPromise:()=>qg,ZodReadonly:()=>Ag,ZodRecord:()=>Pa,ZodSet:()=>xg,ZodString:()=>$a,ZodStringFormat:()=>pe,ZodSuccess:()=>Dg,ZodSymbol:()=>cg,ZodTemplateLiteral:()=>Mg,ZodTransform:()=>Sg,ZodTuple:()=>_g,ZodType:()=>H,ZodULID:()=>Kl,ZodURL:()=>ba,ZodUUID:()=>Ut,ZodUndefined:()=>ug,ZodUnion:()=>za,ZodUnknown:()=>pg,ZodVoid:()=>mg,ZodXID:()=>Hl,ZodXor:()=>gg,_ZodString:()=>Ml,_default:()=>Eg,_function:()=>Tk,any:()=>fk,array:()=>Y,base64:()=>Gx,base64url:()=>Xx,bigint:()=>ck,boolean:()=>xe,catch:()=>Cg,check:()=>Ok,cidrv4:()=>Bx,cidrv6:()=>Wx,codec:()=>Pk,cuid:()=>Mx,cuid2:()=>Fx,custom:()=>dd,date:()=>hk,describe:()=>Nk,discriminatedUnion:()=>Ia,e164:()=>Yx,email:()=>Ex,emoji:()=>Ax,enum:()=>Ce,exactOptional:()=>Ig,file:()=>wk,float32:()=>ok,float64:()=>ik,function:()=>Tk,guid:()=>Tx,hash:()=>nk,hex:()=>rk,hostname:()=>tk,httpUrl:()=>Zx,instanceof:()=>Rk,int:()=>Ul,int32:()=>ak,int64:()=>uk,intersection:()=>Oo,ipv4:()=>Jx,ipv6:()=>Hx,json:()=>Zk,jwt:()=>Qx,keyof:()=>gk,ksuid:()=>Vx,lazy:()=>Lg,literal:()=>N,looseObject:()=>Re,looseRecord:()=>$k,mac:()=>Kx,map:()=>bk,meta:()=>Dk,nan:()=>Ik,nanoid:()=>Ux,nativeEnum:()=>kk,never:()=>od,nonoptional:()=>Ng,null:()=>To,nullable:()=>ya,nullish:()=>Sk,number:()=>se,object:()=>T,optional:()=>ve,partialRecord:()=>_k,pipe:()=>_a,prefault:()=>Og,preprocess:()=>Ea,promise:()=>Ek,readonly:()=>Ug,record:()=>ge,refine:()=>Jg,set:()=>xk,strictObject:()=>vk,string:()=>$,stringFormat:()=>ek,stringbool:()=>Ck,success:()=>zk,superRefine:()=>Kg,symbol:()=>dk,templateLiteral:()=>jk,transform:()=>ad,tuple:()=>$g,uint32:()=>sk,uint64:()=>lk,ulid:()=>Lx,undefined:()=>pk,union:()=>ue,unknown:()=>fe,url:()=>Cx,uuid:()=>Ox,uuidv4:()=>Nx,uuidv6:()=>Dx,uuidv7:()=>Rx,void:()=>mk,xid:()=>qx,xor:()=>yk});var ga={};Dn(ga,{endsWith:()=>bo,gt:()=>Zt,gte:()=>Ve,includes:()=>_o,length:()=>sn,lowercase:()=>vo,lt:()=>Ct,lte:()=>rt,maxLength:()=>an,maxSize:()=>xr,mime:()=>xo,minLength:()=>Qt,minSize:()=>At,multipleOf:()=>br,negative:()=>vl,nonnegative:()=>_l,nonpositive:()=>yl,normalize:()=>ko,overwrite:()=>St,positive:()=>gl,property:()=>$l,regex:()=>go,size:()=>on,slugify:()=>da,startsWith:()=>$o,toLowerCase:()=>So,toUpperCase:()=>zo,trim:()=>wo,uppercase:()=>yo});var kr={};Dn(kr,{ZodISODate:()=>Nl,ZodISODateTime:()=>Tl,ZodISODuration:()=>Zl,ZodISOTime:()=>Rl,date:()=>Dl,datetime:()=>Ol,duration:()=>Al,time:()=>Cl});var Tl=v("ZodISODateTime",(e,t)=>{Jc.init(e,t),pe.init(e,t)});function Ol(e){return Hu(Tl,e)}var Nl=v("ZodISODate",(e,t)=>{Kc.init(e,t),pe.init(e,t)});function Dl(e){return Bu(Nl,e)}var Rl=v("ZodISOTime",(e,t)=>{Hc.init(e,t),pe.init(e,t)});function Cl(e){return Wu(Rl,e)}var Zl=v("ZodISODuration",(e,t)=>{Bc.init(e,t),pe.init(e,t)});function Al(e){return Gu(Zl,e)}var Bh=(e,t)=>{Ei.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Oi(e,r)},flatten:{value:r=>Ti(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,en,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,en,2)}},isEmpty:{get(){return e.issues.length===0}}})},yR=v("ZodError",Bh),nt=v("ZodError",Bh,{Parent:Error});var Wh=eo(nt),Gh=ro(nt),Xh=oo(nt),Yh=io(nt),Qh=um(nt),eg=lm(nt),tg=dm(nt),rg=pm(nt),ng=fm(nt),og=mm(nt),ig=hm(nt),ag=gm(nt);var H=v("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Io(e,"input"),output:Io(e,"output")}}),e.toJSONSchema=ah(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(w.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)=>Le(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Wh(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Xh(e,r,n),e.parseAsync=async(r,n)=>Gh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Yh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Qh(e,r,n),e.decode=(r,n)=>eg(e,r,n),e.encodeAsync=async(r,n)=>tg(e,r,n),e.decodeAsync=async(r,n)=>rg(e,r,n),e.safeEncode=(r,n)=>ng(e,r,n),e.safeDecode=(r,n)=>og(e,r,n),e.safeEncodeAsync=async(r,n)=>ig(e,r,n),e.safeDecodeAsync=async(r,n)=>ag(e,r,n),e.refine=(r,n)=>e.check(Jg(r,n)),e.superRefine=r=>e.check(Kg(r)),e.overwrite=r=>e.check(St(r)),e.optional=()=>ve(e),e.exactOptional=()=>Ig(e),e.nullable=()=>ya(e),e.nullish=()=>ve(ya(e)),e.nonoptional=r=>Ng(e,r),e.array=()=>Y(e),e.or=r=>ue([e,r]),e.and=r=>Oo(e,r),e.transform=r=>_a(e,ad(r)),e.default=r=>Eg(e,r),e.prefault=r=>Og(e,r),e.catch=r=>Cg(e,r),e.pipe=r=>_a(e,r),e.readonly=()=>Ug(e),e.describe=r=>{let n=e.clone();return qe.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return qe.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return qe.get(e);let n=e.clone();return qe.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Ml=v("_ZodString",(e,t)=>{$r.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>sh(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(go(...n)),e.includes=(...n)=>e.check(_o(...n)),e.startsWith=(...n)=>e.check($o(...n)),e.endsWith=(...n)=>e.check(bo(...n)),e.min=(...n)=>e.check(Qt(...n)),e.max=(...n)=>e.check(an(...n)),e.length=(...n)=>e.check(sn(...n)),e.nonempty=(...n)=>e.check(Qt(1,...n)),e.lowercase=n=>e.check(vo(n)),e.uppercase=n=>e.check(yo(n)),e.trim=()=>e.check(wo()),e.normalize=(...n)=>e.check(ko(...n)),e.toLowerCase=()=>e.check(So()),e.toUpperCase=()=>e.check(zo()),e.slugify=()=>e.check(da())}),$a=v("ZodString",(e,t)=>{$r.init(e,t),Ml.init(e,t),e.email=r=>e.check(Ji(Fl,r)),e.url=r=>e.check(ho(ba,r)),e.jwt=r=>e.check(la(rd,r)),e.emoji=r=>e.check(Gi(Ll,r)),e.guid=r=>e.check(mo(va,r)),e.uuid=r=>e.check(Ki(Ut,r)),e.uuidv4=r=>e.check(Hi(Ut,r)),e.uuidv6=r=>e.check(Bi(Ut,r)),e.uuidv7=r=>e.check(Wi(Ut,r)),e.nanoid=r=>e.check(Xi(ql,r)),e.guid=r=>e.check(mo(va,r)),e.cuid=r=>e.check(Yi(Vl,r)),e.cuid2=r=>e.check(Qi(Jl,r)),e.ulid=r=>e.check(ea(Kl,r)),e.base64=r=>e.check(sa(Ql,r)),e.base64url=r=>e.check(ca(ed,r)),e.xid=r=>e.check(ta(Hl,r)),e.ksuid=r=>e.check(ra(Bl,r)),e.ipv4=r=>e.check(na(Wl,r)),e.ipv6=r=>e.check(oa(Gl,r)),e.cidrv4=r=>e.check(ia(Xl,r)),e.cidrv6=r=>e.check(aa(Yl,r)),e.e164=r=>e.check(ua(td,r)),e.datetime=r=>e.check(Ol(r)),e.date=r=>e.check(Dl(r)),e.time=r=>e.check(Cl(r)),e.duration=r=>e.check(Al(r))});function $(e){return Ju($a,e)}var pe=v("ZodStringFormat",(e,t)=>{ce.init(e,t),Ml.init(e,t)}),Fl=v("ZodEmail",(e,t)=>{Cc.init(e,t),pe.init(e,t)});function Ex(e){return Ji(Fl,e)}var va=v("ZodGUID",(e,t)=>{Dc.init(e,t),pe.init(e,t)});function Tx(e){return mo(va,e)}var Ut=v("ZodUUID",(e,t)=>{Rc.init(e,t),pe.init(e,t)});function Ox(e){return Ki(Ut,e)}function Nx(e){return Hi(Ut,e)}function Dx(e){return Bi(Ut,e)}function Rx(e){return Wi(Ut,e)}var ba=v("ZodURL",(e,t)=>{Zc.init(e,t),pe.init(e,t)});function Cx(e){return ho(ba,e)}function Zx(e){return ho(ba,{protocol:/^https?$/,hostname:ct.domain,...w.normalizeParams(e)})}var Ll=v("ZodEmoji",(e,t)=>{Ac.init(e,t),pe.init(e,t)});function Ax(e){return Gi(Ll,e)}var ql=v("ZodNanoID",(e,t)=>{Uc.init(e,t),pe.init(e,t)});function Ux(e){return Xi(ql,e)}var Vl=v("ZodCUID",(e,t)=>{Mc.init(e,t),pe.init(e,t)});function Mx(e){return Yi(Vl,e)}var Jl=v("ZodCUID2",(e,t)=>{Fc.init(e,t),pe.init(e,t)});function Fx(e){return Qi(Jl,e)}var Kl=v("ZodULID",(e,t)=>{Lc.init(e,t),pe.init(e,t)});function Lx(e){return ea(Kl,e)}var Hl=v("ZodXID",(e,t)=>{qc.init(e,t),pe.init(e,t)});function qx(e){return ta(Hl,e)}var Bl=v("ZodKSUID",(e,t)=>{Vc.init(e,t),pe.init(e,t)});function Vx(e){return ra(Bl,e)}var Wl=v("ZodIPv4",(e,t)=>{Wc.init(e,t),pe.init(e,t)});function Jx(e){return na(Wl,e)}var sg=v("ZodMAC",(e,t)=>{Xc.init(e,t),pe.init(e,t)});function Kx(e){return Ku(sg,e)}var Gl=v("ZodIPv6",(e,t)=>{Gc.init(e,t),pe.init(e,t)});function Hx(e){return oa(Gl,e)}var Xl=v("ZodCIDRv4",(e,t)=>{Yc.init(e,t),pe.init(e,t)});function Bx(e){return ia(Xl,e)}var Yl=v("ZodCIDRv6",(e,t)=>{Qc.init(e,t),pe.init(e,t)});function Wx(e){return aa(Yl,e)}var Ql=v("ZodBase64",(e,t)=>{eu.init(e,t),pe.init(e,t)});function Gx(e){return sa(Ql,e)}var ed=v("ZodBase64URL",(e,t)=>{tu.init(e,t),pe.init(e,t)});function Xx(e){return ca(ed,e)}var td=v("ZodE164",(e,t)=>{ru.init(e,t),pe.init(e,t)});function Yx(e){return ua(td,e)}var rd=v("ZodJWT",(e,t)=>{nu.init(e,t),pe.init(e,t)});function Qx(e){return la(rd,e)}var Eo=v("ZodCustomStringFormat",(e,t)=>{ou.init(e,t),pe.init(e,t)});function ek(e,t,r={}){return cn(Eo,e,t,r)}function tk(e){return cn(Eo,"hostname",ct.hostname,e)}function rk(e){return cn(Eo,"hex",ct.hex,e)}function nk(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=ct[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return cn(Eo,n,o,t)}var xa=v("ZodNumber",(e,t)=>{Fi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ch(e,n,o,i),e.gt=(n,o)=>e.check(Zt(n,o)),e.gte=(n,o)=>e.check(Ve(n,o)),e.min=(n,o)=>e.check(Ve(n,o)),e.lt=(n,o)=>e.check(Ct(n,o)),e.lte=(n,o)=>e.check(rt(n,o)),e.max=(n,o)=>e.check(rt(n,o)),e.int=n=>e.check(Ul(n)),e.safe=n=>e.check(Ul(n)),e.positive=n=>e.check(Zt(0,n)),e.nonnegative=n=>e.check(Ve(0,n)),e.negative=n=>e.check(Ct(0,n)),e.nonpositive=n=>e.check(rt(0,n)),e.multipleOf=(n,o)=>e.check(br(n,o)),e.step=(n,o)=>e.check(br(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 se(e){return Xu(xa,e)}var ln=v("ZodNumberFormat",(e,t)=>{iu.init(e,t),xa.init(e,t)});function Ul(e){return Yu(ln,e)}function ok(e){return Qu(ln,e)}function ik(e){return el(ln,e)}function ak(e){return tl(ln,e)}function sk(e){return rl(ln,e)}var ka=v("ZodBoolean",(e,t)=>{lo.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(e,r,n,o)});function xe(e){return nl(ka,e)}var wa=v("ZodBigInt",(e,t)=>{Li.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>lh(e,n,o,i),e.gte=(n,o)=>e.check(Ve(n,o)),e.min=(n,o)=>e.check(Ve(n,o)),e.gt=(n,o)=>e.check(Zt(n,o)),e.gte=(n,o)=>e.check(Ve(n,o)),e.min=(n,o)=>e.check(Ve(n,o)),e.lt=(n,o)=>e.check(Ct(n,o)),e.lte=(n,o)=>e.check(rt(n,o)),e.max=(n,o)=>e.check(rt(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(rt(BigInt(0),n)),e.nonnegative=n=>e.check(Ve(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(br(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function ck(e){return ol(wa,e)}var nd=v("ZodBigIntFormat",(e,t)=>{au.init(e,t),wa.init(e,t)});function uk(e){return il(nd,e)}function lk(e){return al(nd,e)}var cg=v("ZodSymbol",(e,t)=>{su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dh(e,r,n,o)});function dk(e){return sl(cg,e)}var ug=v("ZodUndefined",(e,t)=>{cu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fh(e,r,n,o)});function pk(e){return cl(ug,e)}var lg=v("ZodNull",(e,t)=>{uu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ph(e,r,n,o)});function To(e){return ul(lg,e)}var dg=v("ZodAny",(e,t)=>{lu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o)});function fk(){return ll(dg)}var pg=v("ZodUnknown",(e,t)=>{du.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o)});function fe(){return dl(pg)}var fg=v("ZodNever",(e,t)=>{pu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o)});function od(e){return pl(fg,e)}var mg=v("ZodVoid",(e,t)=>{fu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o)});function mk(e){return fl(mg,e)}var id=v("ZodDate",(e,t)=>{mu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>yh(e,n,o,i),e.min=(n,o)=>e.check(Ve(n,o)),e.max=(n,o)=>e.check(rt(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 hk(e){return ml(id,e)}var hg=v("ZodArray",(e,t)=>{hu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Qt(r,n)),e.nonempty=r=>e.check(Qt(1,r)),e.max=(r,n)=>e.check(an(r,n)),e.length=(r,n)=>e.check(sn(r,n)),e.unwrap=()=>e.element});function Y(e,t){return ih(hg,e,t)}function gk(e){let t=e._zod.def.shape;return Ce(Object.keys(t))}var Sa=v("ZodObject",(e,t)=>{nh.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),w.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Ce(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:fe()}),e.loose=()=>e.clone({...e._zod.def,catchall:fe()}),e.strict=()=>e.clone({...e._zod.def,catchall:od()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>w.extend(e,r),e.safeExtend=r=>w.safeExtend(e,r),e.merge=r=>w.merge(e,r),e.pick=r=>w.pick(e,r),e.omit=r=>w.omit(e,r),e.partial=(...r)=>w.partial(sd,e,r[0]),e.required=(...r)=>w.required(cd,e,r[0])});function T(e,t){let r={type:"object",shape:e??{},...w.normalizeParams(t)};return new Sa(r)}function vk(e,t){return new Sa({type:"object",shape:e,catchall:od(),...w.normalizeParams(t)})}function Re(e,t){return new Sa({type:"object",shape:e,catchall:fe(),...w.normalizeParams(t)})}var za=v("ZodUnion",(e,t)=>{po.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pl(e,r,n,o),e.options=t.options});function ue(e,t){return new za({type:"union",options:e,...w.normalizeParams(t)})}var gg=v("ZodXor",(e,t)=>{za.init(e,t),gu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pl(e,r,n,o),e.options=t.options});function yk(e,t){return new gg({type:"union",options:e,inclusive:!1,...w.normalizeParams(t)})}var vg=v("ZodDiscriminatedUnion",(e,t)=>{za.init(e,t),vu.init(e,t)});function Ia(e,t,r){return new vg({type:"union",options:t,discriminator:e,...w.normalizeParams(r)})}var yg=v("ZodIntersection",(e,t)=>{yu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oh(e,r,n,o)});function Oo(e,t){return new yg({type:"intersection",left:e,right:t})}var _g=v("ZodTuple",(e,t)=>{qi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function $g(e,t,r){let n=t instanceof V,o=n?r:t,i=n?t:null;return new _g({type:"tuple",items:e,rest:i,...w.normalizeParams(o)})}var Pa=v("ZodRecord",(e,t)=>{_u.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Dh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function ge(e,t,r){return new Pa({type:"record",keyType:e,valueType:t,...w.normalizeParams(r)})}function _k(e,t,r){let n=Le(e);return n._zod.values=void 0,new Pa({type:"record",keyType:n,valueType:t,...w.normalizeParams(r)})}function $k(e,t,r){return new Pa({type:"record",keyType:e,valueType:t,mode:"loose",...w.normalizeParams(r)})}var bg=v("ZodMap",(e,t)=>{$u.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ph(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(xr(...r)),e.size=(...r)=>e.check(on(...r))});function bk(e,t,r){return new bg({type:"map",keyType:e,valueType:t,...w.normalizeParams(r)})}var xg=v("ZodSet",(e,t)=>{bu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jh(e,r,n,o),e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(xr(...r)),e.size=(...r)=>e.check(on(...r))});function xk(e,t){return new xg({type:"set",valueType:e,...w.normalizeParams(t)})}var jo=v("ZodEnum",(e,t)=>{xu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>_h(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 jo({...t,checks:[],...w.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 jo({...t,checks:[],...w.normalizeParams(o),entries:i})}});function Ce(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new jo({type:"enum",entries:r,...w.normalizeParams(t)})}function kk(e,t){return new jo({type:"enum",entries:e,...w.normalizeParams(t)})}var kg=v("ZodLiteral",(e,t)=>{ku.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(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 N(e,t){return new kg({type:"literal",values:Array.isArray(e)?e:[e],...w.normalizeParams(t)})}var wg=v("ZodFile",(e,t)=>{wu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o),e.min=(r,n)=>e.check(At(r,n)),e.max=(r,n)=>e.check(xr(r,n)),e.mime=(r,n)=>e.check(xo(Array.isArray(r)?r:[r],n))});function wk(e){return bl(wg,e)}var Sg=v("ZodTransform",(e,t)=>{Su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new vr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(w.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(w.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 ad(e){return new Sg({type:"transform",transform:e})}var sd=v("ZodOptional",(e,t)=>{Vi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ve(e){return new sd({type:"optional",innerType:e})}var zg=v("ZodExactOptional",(e,t)=>{zu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ig(e){return new zg({type:"optional",innerType:e})}var Pg=v("ZodNullable",(e,t)=>{Iu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ya(e){return new Pg({type:"nullable",innerType:e})}function Sk(e){return ve(ya(e))}var jg=v("ZodDefault",(e,t)=>{Pu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Eg(e,t){return new jg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var Tg=v("ZodPrefault",(e,t)=>{ju.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ah(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Og(e,t){return new Tg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():w.shallowClone(t)}})}var cd=v("ZodNonOptional",(e,t)=>{Eu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ch(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ng(e,t){return new cd({type:"nonoptional",innerType:e,...w.normalizeParams(t)})}var Dg=v("ZodSuccess",(e,t)=>{Tu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function zk(e){return new Dg({type:"success",innerType:e})}var Rg=v("ZodCatch",(e,t)=>{Ou.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Cg(e,t){return new Rg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Zg=v("ZodNaN",(e,t)=>{Nu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o)});function Ik(e){return hl(Zg,e)}var ud=v("ZodPipe",(e,t)=>{Du.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mh(e,r,n,o),e.in=t.in,e.out=t.out});function _a(e,t){return new ud({type:"pipe",in:e,out:t})}var ld=v("ZodCodec",(e,t)=>{ud.init(e,t),fo.init(e,t)});function Pk(e,t,r){return new ld({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Ag=v("ZodReadonly",(e,t)=>{Ru.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ug(e){return new Ag({type:"readonly",innerType:e})}var Mg=v("ZodTemplateLiteral",(e,t)=>{Cu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o)});function jk(e,t){return new Mg({type:"template_literal",parts:e,...w.normalizeParams(t)})}var Fg=v("ZodLazy",(e,t)=>{Uu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qh(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Lg(e){return new Fg({type:"lazy",getter:e})}var qg=v("ZodPromise",(e,t)=>{Au.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ek(e){return new qg({type:"promise",innerType:e})}var Vg=v("ZodFunction",(e,t)=>{Zu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zh(e,r,n,o)});function Tk(e){return new Vg({type:"function",input:Array.isArray(e?.input)?$g(e?.input):e?.input??Y(fe()),output:e?.output??fe()})}var ja=v("ZodCustom",(e,t)=>{Mu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o)});function Ok(e){let t=new de({check:"custom"});return t._zod.check=e,t}function dd(e,t){return xl(ja,e??(()=>!0),t)}function Jg(e,t={}){return kl(ja,e,t)}function Kg(e){return wl(e)}var Nk=Sl,Dk=zl;function Rk(e,t={}){let r=new ja({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...w.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 Ck=(...e)=>Il({Codec:ld,Boolean:ka,String:$a},...e);function Zk(e){let t=Lg(()=>ue([$(e),se(),xe(),To(),Y(t),ge($(),t)]));return t}function Ea(e,t){return _a(ad(e),t)}var Hg;Hg||(Hg={});var zR={...Po,...ga,iso:kr};we(Fu());var fd="2025-11-25";var Bg=[fd,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],tr="io.modelcontextprotocol/related-task",Oa="2.0",Ie=dd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Wg=ue([$(),se().int()]),Gg=$(),JR=Re({ttl:ue([se(),To()]).optional(),pollInterval:se().optional()}),Fk=T({ttl:se().optional()}),Lk=T({taskId:$()}),md=Re({progressToken:Wg.optional(),[tr]:Lk.optional()}),ot=T({_meta:md.optional()}),No=ot.extend({task:Fk.optional()}),Xg=e=>No.safeParse(e).success,Pe=T({method:$(),params:ot.loose().optional()}),ut=T({_meta:md.optional()}),lt=T({method:$(),params:ut.loose().optional()}),je=Re({_meta:md.optional()}),Na=ue([$(),se().int()]),Yg=T({jsonrpc:N(Oa),id:Na,...Pe.shape}).strict(),hd=e=>Yg.safeParse(e).success,Qg=T({jsonrpc:N(Oa),...lt.shape}).strict(),ev=e=>Qg.safeParse(e).success,gd=T({jsonrpc:N(Oa),id:Na,result:je}).strict(),Do=e=>gd.safeParse(e).success;var Z;(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"})(Z||(Z={}));var vd=T({jsonrpc:N(Oa),id:Na.optional(),error:T({code:se().int(),message:$(),data:fe().optional()})}).strict();var tv=e=>vd.safeParse(e).success;var rv=ue([Yg,Qg,gd,vd]),KR=ue([gd,vd]),Da=je.strict(),qk=ut.extend({requestId:Na.optional(),reason:$().optional()}),Ra=lt.extend({method:N("notifications/cancelled"),params:qk}),Vk=T({src:$(),mimeType:$().optional(),sizes:Y($()).optional(),theme:Ce(["light","dark"]).optional()}),Ro=T({icons:Y(Vk).optional()}),dn=T({name:$(),title:$().optional()}),nv=dn.extend({...dn.shape,...Ro.shape,version:$(),websiteUrl:$().optional(),description:$().optional()}),Jk=Oo(T({applyDefaults:xe().optional()}),ge($(),fe())),Kk=Ea(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Oo(T({form:Jk.optional(),url:Ie.optional()}),ge($(),fe()).optional())),Hk=Re({list:Ie.optional(),cancel:Ie.optional(),requests:Re({sampling:Re({createMessage:Ie.optional()}).optional(),elicitation:Re({create:Ie.optional()}).optional()}).optional()}),Bk=Re({list:Ie.optional(),cancel:Ie.optional(),requests:Re({tools:Re({call:Ie.optional()}).optional()}).optional()}),Wk=T({experimental:ge($(),Ie).optional(),sampling:T({context:Ie.optional(),tools:Ie.optional()}).optional(),elicitation:Kk.optional(),roots:T({listChanged:xe().optional()}).optional(),tasks:Hk.optional()}),Gk=ot.extend({protocolVersion:$(),capabilities:Wk,clientInfo:nv}),yd=Pe.extend({method:N("initialize"),params:Gk});var Xk=T({experimental:ge($(),Ie).optional(),logging:Ie.optional(),completions:Ie.optional(),prompts:T({listChanged:xe().optional()}).optional(),resources:T({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:T({listChanged:xe().optional()}).optional(),tasks:Bk.optional()}),Yk=je.extend({protocolVersion:$(),capabilities:Xk,serverInfo:nv,instructions:$().optional()}),_d=lt.extend({method:N("notifications/initialized"),params:ut.optional()});var Ca=Pe.extend({method:N("ping"),params:ot.optional()}),Qk=T({progress:se(),total:ve(se()),message:ve($())}),ew=T({...ut.shape,...Qk.shape,progressToken:Wg}),Za=lt.extend({method:N("notifications/progress"),params:ew}),tw=ot.extend({cursor:Gg.optional()}),Co=Pe.extend({params:tw.optional()}),Zo=je.extend({nextCursor:Gg.optional()}),rw=Ce(["working","input_required","completed","failed","cancelled"]),Ao=T({taskId:$(),status:rw,ttl:ue([se(),To()]),createdAt:$(),lastUpdatedAt:$(),pollInterval:ve(se()),statusMessage:ve($())}),pn=je.extend({task:Ao}),nw=ut.merge(Ao),Uo=lt.extend({method:N("notifications/tasks/status"),params:nw}),Aa=Pe.extend({method:N("tasks/get"),params:ot.extend({taskId:$()})}),Ua=je.merge(Ao),Ma=Pe.extend({method:N("tasks/result"),params:ot.extend({taskId:$()})}),HR=je.loose(),Fa=Co.extend({method:N("tasks/list")}),La=Zo.extend({tasks:Y(Ao)}),qa=Pe.extend({method:N("tasks/cancel"),params:ot.extend({taskId:$()})}),ov=je.merge(Ao),iv=T({uri:$(),mimeType:ve($()),_meta:ge($(),fe()).optional()}),av=iv.extend({text:$()}),$d=$().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),sv=iv.extend({blob:$d}),Mo=Ce(["user","assistant"]),fn=T({audience:Y(Mo).optional(),priority:se().min(0).max(1).optional(),lastModified:kr.datetime({offset:!0}).optional()}),cv=T({...dn.shape,...Ro.shape,uri:$(),description:ve($()),mimeType:ve($()),annotations:fn.optional(),_meta:ve(Re({}))}),ow=T({...dn.shape,...Ro.shape,uriTemplate:$(),description:ve($()),mimeType:ve($()),annotations:fn.optional(),_meta:ve(Re({}))}),bd=Co.extend({method:N("resources/list")}),iw=Zo.extend({resources:Y(cv)}),aw=Co.extend({method:N("resources/templates/list")}),sw=Zo.extend({resourceTemplates:Y(ow)}),xd=ot.extend({uri:$()}),cw=xd,kd=Pe.extend({method:N("resources/read"),params:cw}),uw=je.extend({contents:Y(ue([av,sv]))}),lw=lt.extend({method:N("notifications/resources/list_changed"),params:ut.optional()}),dw=xd,pw=Pe.extend({method:N("resources/subscribe"),params:dw}),fw=xd,mw=Pe.extend({method:N("resources/unsubscribe"),params:fw}),hw=ut.extend({uri:$()}),gw=lt.extend({method:N("notifications/resources/updated"),params:hw}),vw=T({name:$(),description:ve($()),required:ve(xe())}),yw=T({...dn.shape,...Ro.shape,description:ve($()),arguments:ve(Y(vw)),_meta:ve(Re({}))}),wd=Co.extend({method:N("prompts/list")}),_w=Zo.extend({prompts:Y(yw)}),$w=ot.extend({name:$(),arguments:ge($(),$()).optional()}),Sd=Pe.extend({method:N("prompts/get"),params:$w}),zd=T({type:N("text"),text:$(),annotations:fn.optional(),_meta:ge($(),fe()).optional()}),Id=T({type:N("image"),data:$d,mimeType:$(),annotations:fn.optional(),_meta:ge($(),fe()).optional()}),Pd=T({type:N("audio"),data:$d,mimeType:$(),annotations:fn.optional(),_meta:ge($(),fe()).optional()}),bw=T({type:N("tool_use"),name:$(),id:$(),input:ge($(),fe()),_meta:ge($(),fe()).optional()}),xw=T({type:N("resource"),resource:ue([av,sv]),annotations:fn.optional(),_meta:ge($(),fe()).optional()}),kw=cv.extend({type:N("resource_link")}),jd=ue([zd,Id,Pd,kw,xw]),ww=T({role:Mo,content:jd}),Sw=je.extend({description:$().optional(),messages:Y(ww)}),zw=lt.extend({method:N("notifications/prompts/list_changed"),params:ut.optional()}),Iw=T({title:$().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),Pw=T({taskSupport:Ce(["required","optional","forbidden"]).optional()}),uv=T({...dn.shape,...Ro.shape,description:$().optional(),inputSchema:T({type:N("object"),properties:ge($(),Ie).optional(),required:Y($()).optional()}).catchall(fe()),outputSchema:T({type:N("object"),properties:ge($(),Ie).optional(),required:Y($()).optional()}).catchall(fe()).optional(),annotations:Iw.optional(),execution:Pw.optional(),_meta:ge($(),fe()).optional()}),Ed=Co.extend({method:N("tools/list")}),jw=Zo.extend({tools:Y(uv)}),Va=je.extend({content:Y(jd).default([]),structuredContent:ge($(),fe()).optional(),isError:xe().optional()}),BR=Va.or(je.extend({toolResult:fe()})),Ew=No.extend({name:$(),arguments:ge($(),fe()).optional()}),Fo=Pe.extend({method:N("tools/call"),params:Ew}),Tw=lt.extend({method:N("notifications/tools/list_changed"),params:ut.optional()}),WR=T({autoRefresh:xe().default(!0),debounceMs:se().int().nonnegative().default(300)}),Lo=Ce(["debug","info","notice","warning","error","critical","alert","emergency"]),Ow=ot.extend({level:Lo}),Td=Pe.extend({method:N("logging/setLevel"),params:Ow}),Nw=ut.extend({level:Lo,logger:$().optional(),data:fe()}),Dw=lt.extend({method:N("notifications/message"),params:Nw}),Rw=T({name:$().optional()}),Cw=T({hints:Y(Rw).optional(),costPriority:se().min(0).max(1).optional(),speedPriority:se().min(0).max(1).optional(),intelligencePriority:se().min(0).max(1).optional()}),Zw=T({mode:Ce(["auto","required","none"]).optional()}),Aw=T({type:N("tool_result"),toolUseId:$().describe("The unique identifier for the corresponding tool call."),content:Y(jd).default([]),structuredContent:T({}).loose().optional(),isError:xe().optional(),_meta:ge($(),fe()).optional()}),Uw=Ia("type",[zd,Id,Pd]),Ta=Ia("type",[zd,Id,Pd,bw,Aw]),Mw=T({role:Mo,content:ue([Ta,Y(Ta)]),_meta:ge($(),fe()).optional()}),Fw=No.extend({messages:Y(Mw),modelPreferences:Cw.optional(),systemPrompt:$().optional(),includeContext:Ce(["none","thisServer","allServers"]).optional(),temperature:se().optional(),maxTokens:se().int(),stopSequences:Y($()).optional(),metadata:Ie.optional(),tools:Y(uv).optional(),toolChoice:Zw.optional()}),Lw=Pe.extend({method:N("sampling/createMessage"),params:Fw}),Od=je.extend({model:$(),stopReason:ve(Ce(["endTurn","stopSequence","maxTokens"]).or($())),role:Mo,content:Uw}),Nd=je.extend({model:$(),stopReason:ve(Ce(["endTurn","stopSequence","maxTokens","toolUse"]).or($())),role:Mo,content:ue([Ta,Y(Ta)])}),qw=T({type:N("boolean"),title:$().optional(),description:$().optional(),default:xe().optional()}),Vw=T({type:N("string"),title:$().optional(),description:$().optional(),minLength:se().optional(),maxLength:se().optional(),format:Ce(["email","uri","date","date-time"]).optional(),default:$().optional()}),Jw=T({type:Ce(["number","integer"]),title:$().optional(),description:$().optional(),minimum:se().optional(),maximum:se().optional(),default:se().optional()}),Kw=T({type:N("string"),title:$().optional(),description:$().optional(),enum:Y($()),default:$().optional()}),Hw=T({type:N("string"),title:$().optional(),description:$().optional(),oneOf:Y(T({const:$(),title:$()})),default:$().optional()}),Bw=T({type:N("string"),title:$().optional(),description:$().optional(),enum:Y($()),enumNames:Y($()).optional(),default:$().optional()}),Ww=ue([Kw,Hw]),Gw=T({type:N("array"),title:$().optional(),description:$().optional(),minItems:se().optional(),maxItems:se().optional(),items:T({type:N("string"),enum:Y($())}),default:Y($()).optional()}),Xw=T({type:N("array"),title:$().optional(),description:$().optional(),minItems:se().optional(),maxItems:se().optional(),items:T({anyOf:Y(T({const:$(),title:$()}))}),default:Y($()).optional()}),Yw=ue([Gw,Xw]),Qw=ue([Bw,Ww,Yw]),eS=ue([Qw,qw,Vw,Jw]),tS=No.extend({mode:N("form").optional(),message:$(),requestedSchema:T({type:N("object"),properties:ge($(),eS),required:Y($()).optional()})}),rS=No.extend({mode:N("url"),message:$(),elicitationId:$(),url:$().url()}),nS=ue([tS,rS]),oS=Pe.extend({method:N("elicitation/create"),params:nS}),iS=ut.extend({elicitationId:$()}),aS=lt.extend({method:N("notifications/elicitation/complete"),params:iS}),Ja=je.extend({action:Ce(["accept","decline","cancel"]),content:Ea(e=>e===null?void 0:e,ge($(),ue([$(),se(),xe(),Y($())])).optional())}),sS=T({type:N("ref/resource"),uri:$()});var cS=T({type:N("ref/prompt"),name:$()}),uS=ot.extend({ref:ue([cS,sS]),argument:T({name:$(),value:$()}),context:T({arguments:ge($(),$()).optional()}).optional()}),lS=Pe.extend({method:N("completion/complete"),params:uS});var dS=je.extend({completion:Re({values:Y($()).max(100),total:ve(se().int()),hasMore:ve(xe())})}),pS=T({uri:$().startsWith("file://"),name:$().optional(),_meta:ge($(),fe()).optional()}),fS=Pe.extend({method:N("roots/list"),params:ot.optional()}),Dd=je.extend({roots:Y(pS)}),mS=lt.extend({method:N("notifications/roots/list_changed"),params:ut.optional()}),GR=ue([Ca,yd,lS,Td,Sd,wd,bd,aw,kd,pw,mw,Fo,Ed,Aa,Ma,Fa,qa]),XR=ue([Ra,Za,_d,mS,Uo]),YR=ue([Da,Od,Nd,Ja,Dd,Ua,La,pn]),QR=ue([Ca,Lw,oS,fS,Aa,Ma,Fa,qa]),e4=ue([Ra,Za,Dw,gw,lw,Tw,zw,Uo,aS]),t4=ue([Da,Yk,dS,Sw,_w,iw,sw,uw,Va,jw,Ua,La,pn]),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===Z.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new pd(o.elicitations,r)}return new e(t,r,n)}},pd=class extends R{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(Z.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function rr(e){return e==="completed"||e==="failed"||e==="cancelled"}var R4=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Rd(e){let r=ha(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Hh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Cd(e,t){let r=er(e,t);if(!r.success)throw r.error;return r.data}var $S=6e4,Ka=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(Ra,r=>{this._oncancel(r)}),this.setNotificationHandler(Za,r=>{this._onprogress(r)}),this.setRequestHandler(Ca,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Aa,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(Z.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ma,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,f=new R(d.error.code,d.error.message,d.error.data);l(f)}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(Z.InvalidParams,`Task not found: ${i}`);if(!rr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(rr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[tr]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Fa,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(Z.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(qa,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(Z.InvalidParams,`Task not found: ${r.params.taskId}`);if(rr(o.status))throw new R(Z.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(Z.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof R?o:new R(Z.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(Z.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),Do(i)||tv(i)?this._onresponse(i):hd(i)?this._onrequest(i,a):ev(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(Z.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?.[tr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:Z.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=Xg(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,f)=>{if(a.signal.aborted)throw new R(Z.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:t.id};i&&!p.relatedTask&&(p.relatedTask={taskId:i});let g=p.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,p)},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:Z.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),Do(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(Do(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),Do(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(Z.InternalError,String(a))}}return}let i;try{let a=await this.request(t,pn,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new R(Z.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},rr(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(Z.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new R(Z.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(Z.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 f=this._requestMessageId++,p={...t,jsonrpc:"2.0",id:f};n?.onprogress&&(this._progressHandlers.set(f,n.onprogress),p.params={...t.params,_meta:{...t.params?._meta||{},progressToken:f}}),s&&(p.params={...p.params,task:s}),c&&(p.params={...p.params,_meta:{...p.params?._meta||{},[tr]:c}});let g=_=>{this._responseHandlers.delete(f),this._progressHandlers.delete(f),this._cleanupTimeout(f),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:f,reason:String(_)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(S=>this._onerror(new Error(`Failed to send cancellation: ${S}`)));let b=_ instanceof R?_:new R(Z.RequestTimeout,String(_));l(b)};this._responseHandlers.set(f,_=>{if(!n?.signal?.aborted){if(_ instanceof Error)return l(_);try{let b=er(r,_.result);b.success?u(b.data):l(b.error)}catch(b){l(b)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let h=n?.timeout??$S,m=()=>g(R.fromError(Z.RequestTimeout,"Request timed out",{timeout:h}));this._setupTimeout(f,h,n?.maxTotalTimeout,m,n?.resetTimeoutOnProgress??!1);let y=c?.taskId;if(y){let _=b=>{let S=this._responseHandlers.get(f);S?S(b):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,_),this._enqueueTaskMessage(y,{type:"request",message:p,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(f),l(b)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(_=>{this._cleanupTimeout(f),l(_)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ua,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},La,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},ov,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||{},[tr]: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||{},[tr]: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||{},[tr]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Rd(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Cd(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=Rd(t);this._notificationHandlers.set(n,o=>{let i=Cd(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"&&hd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new R(Z.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(Z.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new R(Z.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(Z.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=Uo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),rr(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(Z.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(rr(s.status))throw new R(Z.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=Uo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),rr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function lv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function dv(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];lv(a)&&lv(i)?r[o]={...a,...i}:r[o]=i}return r}var m$=it(Of(),1),h$=it(f$(),1);function GE(){let e=new m$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,h$.default)(e),e}var Ts=class{constructor(t){this._ajv=t??GE()}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 Os=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 g$(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 v$(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 Ns=class extends Ka{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Lo.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 Ts,this.setRequestHandler(yd,n=>this._oninitialize(n)),this.setNotificationHandler(_d,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Td,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Lo.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Os(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=dv(this._capabilities,t)}setRequestHandler(t,r){let o=ha(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(un(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=er(Fo,c);if(!l.success){let g=l.error instanceof Error?l.error.message:String(l.error);throw new R(Z.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let g=er(pn,f);if(!g.success){let h=g.error instanceof Error?g.error.message:String(g.error);throw new R(Z.InvalidParams,`Invalid task creation result: ${h}`)}return g.data}let p=er(Va,f);if(!p.success){let g=p.error instanceof Error?p.error.message:String(p.error);throw new R(Z.InvalidParams,`Invalid tools/call result: ${g}`)}return p.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){v$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&g$(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:Bg.includes(r)?r:fd,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"},Da)}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},Nd,r):this.request({method:"sampling/createMessage",params:t},Od,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},Ja,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},Ja,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(Z.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof R?a:new R(Z.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},Dd,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 Mf=it(require("node:process"),1);var Ds=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),XE(r)}clear(){this._buffer=void 0}};function XE(e){return rv.parse(JSON.parse(e))}function y$(e){return JSON.stringify(e)+`
49
+ `}var Rs=class{constructor(t=Mf.default.stdin,r=Mf.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Ds,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=y$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var Se=it(require("fs/promises")),ke=it(require("path")),Tn=10*1024*1024,YE=1e3,Cs=class{skillsPath;cachedSkills=null;loadingPromise=null;loadingEpoch=-1;skillMap=new Map;contentCache=new Map;contentCacheStat=new Map;canonicalPathMap=new Map;scanEpoch=0;lastSuccessfulScanAt=0;skillSignature=null;constructor(t){this.skillsPath=ke.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 f=l.match(/^description:\s*(.*?)\s*$/);if(f){c=this.stripQuotes(f[1]),u=!0;continue}u&&/^\s+/.test(l)?c+=" "+l.trim():u=!1}return{name:s,description:c,body:i}}async listSkills(t=!1){if(!t&&this.cachedSkills&&Date.now()-this.lastSuccessfulScanAt<YE)return this.cachedSkills;let r=await this.computeSkillSignature();if(!t&&this.cachedSkills&&this.skillSignature!==null&&r===this.skillSignature)return this.lastSuccessfulScanAt=Date.now(),this.cachedSkills;t&&this.dropContentCaches();let n=this.loadingPromise;if(!t&&n&&this.loadingEpoch===this.scanEpoch)return n;let o=++this.scanEpoch,i=this.internalListSkills(o,r);this.loadingPromise=i,this.loadingEpoch=o;try{return await i}finally{this.loadingPromise===i&&(this.loadingPromise=null,this.loadingEpoch=-1)}}dropContentCaches(){this.contentCache.clear(),this.contentCacheStat.clear(),this.canonicalPathMap.clear(),this.skillSignature=null}async computeSkillSignature(){let t=async r=>{try{let n=await Se.lstat(r);return`${n.mode}\0${n.ino}\0${n.size}\0${n.mtimeMs}`}catch{return"-"}};try{let n=(await Se.readdir(this.skillsPath,{withFileTypes:!0})).filter(i=>i.isDirectory()||i.isSymbolicLink()),o=await Promise.all(n.map(async i=>{let a=ke.join(this.skillsPath,i.name),s=i.isDirectory()?"d":"l",c=s==="l"?await t(a):"-",u=await t(ke.join(a,"SKILL.md"));return`${i.name}\0${s}\0${c}\0${u}`}));return o.sort(),o.join("")}catch{return null}}async internalListSkills(t=this.scanEpoch,r){let n;try{let d=ke.resolve(this.skillsPath),f=await Se.realpath(d),p=await Se.stat(f);if(!p.isDirectory())return this.cachedSkills??[];n={realRootPath:f,rootStat:p}}catch{return this.cachedSkills??[]}let o=r!==void 0?r:await this.computeSkillSignature(),i=[],a=new Map,s=new Map,c=new Map,u=new Map,l=!1;try{let f=(await Se.readdir(this.skillsPath,{withFileTypes:!0})).filter(g=>g.isDirectory()||g.isSymbolicLink()),p=await Promise.all(f.map(async g=>{let h=ke.join(this.skillsPath,g.name),m=ke.join(h,"SKILL.md");try{let{content:y,realFilePath:_,stat:b}=await this.readFileNoFollow(m,this.skillsPath,n),{name:S,description:z,body:te}=this.parseFrontmatter(y);return{item:{name:S||g.name,description:z,skillPath:m},body:te,realFilePath:_,directoryName:g.name,stat:b}}catch(y){return y&&typeof y=="object"&&"code"in y&&y.code==="ENOENT"||process.stderr.write(`Warning: Failed to read skill file in directory "${g.name}"
50
+ `),null}}));for(let g of p.filter(h=>h!==null).sort((h,m)=>h.directoryName<m.directoryName?-1:h.directoryName>m.directoryName?1:0)){let{item:h,body:m,realFilePath:y,directoryName:_,stat:b}=g,S=new Set([h.name.toLowerCase(),_.toLowerCase()]),z=[...S].find(ae=>a.has(ae));if(z){process.stderr.write(`Warning: Skipping skill directory "${_}" because name or alias "${z}" is already registered
51
+ `);continue}i.push(h);for(let ae of S)a.set(ae,h);let te=ke.resolve(h.skillPath);s.set(y,m),c.set(y,{dev:b.dev,ino:b.ino,size:b.size,mtimeMs:b.mtimeMs}),u.set(te,y),u.set(y,y)}l=!0}catch(d){process.stderr.write(`Error reading skills directory: ${String(d)}
52
+ `)}return l&&t===this.scanEpoch?(this.skillMap=a,this.cachedSkills=i.sort((d,f)=>d.name.localeCompare(f.name)),this.lastSuccessfulScanAt=Date.now(),this.contentCache=s,this.contentCacheStat=c,this.canonicalPathMap=u,this.skillSignature=o):l||(this.skillSignature=null),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=ke.resolve(t),i=ke.resolve(r),a=await Se.realpath(o),s=n?n.realRootPath:await Se.realpath(i);if(!(n?n.rootStat:await Se.stat(s)).isDirectory())throw new Error("Skills directory must be a directory");let u=ke.relative(s,a);if(u===".."||u.startsWith(`..${ke.sep}`)||ke.isAbsolute(u))throw new Error("File is outside skills directory");let l=await Se.stat(a);if(!l.isFile()||l.nlink<1)throw new Error("Skill path is not a regular file");if(l.size>Tn)throw new Error("Skill file exceeds size limit");let d=process.platform==="win32"?0:Se.constants.O_NOFOLLOW,f=await Se.open(a,Se.constants.O_RDONLY|d);try{let p=await f.stat();if(!p.isFile()||p.nlink<1||p.dev!==l.dev||p.ino!==l.ino||p.size>Tn)throw new Error("File changed while opening");let g=p.size,h;if(g<=64*1024){h=Buffer.allocUnsafe(g);let y=0;for(;y<g;){let{bytesRead:_}=await f.read(h,y,g-y,null);if(_===0)break;y+=_}y<g&&(h=h.subarray(0,y))}else{let y=[],b=0;for(;b<=Tn;){let S=Buffer.allocUnsafe(Math.min(65536,Tn+1-b)),{bytesRead:z}=await f.read(S,0,S.length,null);if(z===0)break;if(b+=z,y.push(S.subarray(0,z)),b>Tn)throw new Error("Skill file exceeds size limit")}h=Buffer.concat(y,b)}let m=await f.stat();if(m.size>Tn||m.dev!==l.dev||m.ino!==l.ino||m.size!==l.size||m.mtimeMs!==l.mtimeMs)throw new Error("File changed while reading");return{content:h.toString("utf-8"),realFilePath:a,stat:m}}finally{await f.close()}}async readSkillContent(t,r=!1){let n=ke.isAbsolute(t)?ke.resolve(t):ke.resolve(this.skillsPath,t);if(!r){let o=await this.tryReadFromContentCache(n);if(o!==void 0)return o}try{let{content:o,realFilePath:i,stat:a}=await this.readFileNoFollow(n,this.skillsPath),{body:s}=this.parseFrontmatter(o);return this.contentCache.set(i,s),this.contentCacheStat.set(i,{dev:a.dev,ino:a.ino,size:a.size,mtimeMs:a.mtimeMs}),this.canonicalPathMap.set(n,i),this.canonicalPathMap.set(i,i),s}catch(o){throw new Error(`Failed to read skill content: ${o instanceof Error?o.message:String(o)}`)}}async tryReadFromContentCache(t){let r=this.canonicalPathMap.get(t);if(!r)return;let n=this.contentCache.get(r),o=this.contentCacheStat.get(r);if(!(n===void 0||!o))try{let i=await Se.stat(t);if(i.isFile()&&i.dev===o.dev&&i.ino===o.ino&&i.size===o.size&&i.mtimeMs===o.mtimeMs)return n}catch{}}clearCache(){this.scanEpoch++,this.cachedSkills=null,this.loadingPromise=null,this.loadingEpoch=-1,this.skillMap.clear(),this.contentCache.clear(),this.contentCacheStat.clear(),this.canonicalPathMap.clear(),this.skillSignature=null,this.lastSuccessfulScanAt=0}};var C=it(require("fs")),x=it(require("path")),Cr=it(require("os")),x$=it(require("crypto")),bi={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>x.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||x.join(t,"AppData","Roaming"):e==="darwin"?x.join(t,"Library","Application Support"):x.join(t,".config");return x.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"?x.join(r||x.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?x.join(t,"Library","Application Support","Code","User","mcp.json"):x.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"?x.join(r||x.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?x.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):x.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)=>x.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||x.join(t,"AppData","Local");return x.join(o,"hermes","config.yaml")}return x.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)=>x.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"?x.join(r||x.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?x.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):x.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,r)=>{let n=e==="win32"&&r?r:x.join(t,".config"),o=x.join(n,"devin","mcp_config.json");return C.existsSync(o)?o:x.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)=>x.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=x.join(r||x.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(C.existsSync(i))return i;let a=x.join(t,".pi","agent","mcp.json");if(C.existsSync(a))return a;let s=x.join(t,".pi","mcp.json");return C.existsSync(s)?s:a}let n=x.join(t,".pi","agent","mcp.json");if(C.existsSync(n))return n;let o=x.join(t,".pi","mcp.json");return C.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=x.join(t,".qwenpaw","config.json");if(C.existsSync(r))return r;let n=x.join(t,".copaw","config.json");return C.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=x.join(r||x.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?n=x.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):n=x.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),C.existsSync(n))return n;let o=x.join(t,".cline","data","settings","cline_mcp_settings.json");return C.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=x.join(t,".config","kilo","kilo.jsonc");if(C.existsSync(r))return r;let n=x.join(t,".config","kilo","kilo.json");return C.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)=>x.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)=>x.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=x.join(r||x.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(C.existsSync(n))return n;let o=x.join(r||x.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return C.existsSync(o)?o:n}else if(e==="darwin"){let n=x.join(t,"Library","Application Support","Trae","User","mcp.json");if(C.existsSync(n))return n;let o=x.join(t,"Library","Application Support","Trae CN","User","mcp.json");return C.existsSync(o)?o:n}else{let n=x.join(t,".config","Trae","User","mcp.json");if(C.existsSync(n))return n;let o=x.join(t,".config","Trae CN","User","mcp.json");return C.existsSync(o)?o:n}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},codex:{name:"Codex",aliases:["codex"],getConfigPath:(e,t)=>x.join(t,".codex","config.toml"),type:"toml",defaultConfig:(e,t)=>({command:e,args:t})},openclaw:{name:"OpenClaw",aliases:["openclaw","open-claw"],getConfigPath:(e,t)=>x.join(t,".openclaw","openclaw.json"),type:"json-mcpServers",serverPath:["mcp","servers"],defaultConfig:(e,t)=>({command:e,args:t})},goose:{name:"Goose",aliases:["goose"],getConfigPath:(e,t,r)=>e==="win32"?x.join(r||x.join(t,"AppData","Roaming"),"Block","goose","config","config.yaml"):x.join(t,".config","goose","config.yaml"),type:"yaml",yamlProfile:"goose",defaultConfig:(e,t)=>({cmd:e,args:t})}},QE=["mcpServers","servers","mcp"];function On(e){return Object.prototype.toString.call(e)==="[object Object]"}function eT(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
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 Zf=/\s/;function GE(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!Zf.test(e[t-1]))continue;let r=t-1;for(;r>0&&Zf.test(e[r-1]);)r--;return e.slice(r)}return""}function XE(e,t,r,n=!1,o="mcp"){let i=o==="goose"?{rootKey:"extensions",ownedKeys:["cmd","args","type"],freshEntry:(g,y,_)=>[`${g}superpowers:`,`${g}${g}name: "Superpowers"`,`${g}${g}cmd: ${JSON.stringify(y)}`,`${g}${g}args: ${JSON.stringify(_)}`,`${g}${g}enabled: true`,`${g}${g}type: stdio`,`${g}${g}timeout: 300`]}:{rootKey:"mcp_servers",ownedKeys:["command","args"],freshEntry:(g,y,_)=>[`${g}superpowers:`,`${g}${g}command: ${JSON.stringify(y)}`,`${g}${g}args: ${JSON.stringify(_)}`]};if(!/^[A-Za-z0-9_-]+$/.test(i.rootKey))throw new Error("Invalid YAML root key");let a=new RegExp(`^(\\s*)${i.rootKey}\\s*:`),s=new RegExp(`^(\\s*)${i.rootKey}\\s*:\\s*(?:#.*)?$`),c=new RegExp(`^\\s*["']?(?:${i.ownedKeys.join("|")})["']?\\s*:`),u=e?e.split(/\r?\n/):[],l=u.map((g,y)=>{let _=g.match(a);return _?{index:y,indent:_[1],tail:g.slice(_[0].length).trim()}:null}).filter(g=>g!==null),d=l.filter(g=>g.indent==="");if(d.length>1)throw new Error(`Cannot safely update YAML with duplicate ${i.rootKey} keys`);if(d.length===1){let g=d[0];if(g.tail!==""&&!g.tail.startsWith("#"))throw new Error(`Cannot safely update YAML unless ${i.rootKey} is a root-level block mapping`)}else if(l.length>0)throw new Error(`Cannot safely update YAML unless ${i.rootKey} is a root-level block mapping`);let f=" ";if(d.length===1)for(let g=d[0].index+1;g<u.length;g++){if(u[g].trim()===""||u[g].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(u[g]))break;let y=u[g].match(/^(\s+)\S/);y&&(f=y[1]);break}if(n){let g=[],y=!1,_=0,b=!1,S=0;for(let z=0;z<u.length;z++){let te=u[z],ae=te.match(s);if(ae){y=!0,_=ae[1].length,g.push(te);continue}if(y){let Ne=te.match(/^(\s*)/)?.[1].length||0;if(te.trimStart().startsWith("#")){g.push(te);continue}if(te.trim()!==""&&Ne<=_)y=!1,b=!1;else{let fr=te.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(fr&&fr[1]===f){b=!0,S=fr[1].length;continue}if(b){if(Ne>S||te.trim()==="")continue;b=!1}}}g.push(te)}return g.join(`
54
+ `&&l!=="\r"&&(c=-1),n.push(l)}return n.join("")}var Ff=/\s/;function tT(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!Ff.test(e[t-1]))continue;let r=t-1;for(;r>0&&Ff.test(e[r-1]);)r--;return e.slice(r)}return""}function rT(e,t,r,n=!1,o="mcp"){let i=o==="goose"?{rootKey:"extensions",ownedKeys:["cmd","args","type"],freshEntry:(m,y,_)=>[`${m}superpowers:`,`${m}${m}name: "Superpowers"`,`${m}${m}cmd: ${JSON.stringify(y)}`,`${m}${m}args: ${JSON.stringify(_)}`,`${m}${m}enabled: true`,`${m}${m}type: stdio`,`${m}${m}timeout: 300`]}:{rootKey:"mcp_servers",ownedKeys:["command","args"],freshEntry:(m,y,_)=>[`${m}superpowers:`,`${m}${m}command: ${JSON.stringify(y)}`,`${m}${m}args: ${JSON.stringify(_)}`]};if(!/^[A-Za-z0-9_-]+$/.test(i.rootKey))throw new Error("Invalid YAML root key");let a=new RegExp(`^(\\s*)${i.rootKey}\\s*:`),s=new RegExp(`^(\\s*)${i.rootKey}\\s*:\\s*(?:#.*)?$`),c=new RegExp(`^\\s*["']?(?:${i.ownedKeys.join("|")})["']?\\s*:`),u=e?e.split(/\r?\n/):[],l=u.map((m,y)=>{let _=m.match(a);return _?{index:y,indent:_[1],tail:m.slice(_[0].length).trim()}:null}).filter(m=>m!==null),d=l.filter(m=>m.indent==="");if(d.length>1)throw new Error(`Cannot safely update YAML with duplicate ${i.rootKey} keys`);if(d.length===1){let m=d[0];if(m.tail!==""&&!m.tail.startsWith("#"))throw new Error(`Cannot safely update YAML unless ${i.rootKey} is a root-level block mapping`)}else if(l.length>0)throw new Error(`Cannot safely update YAML unless ${i.rootKey} is a root-level block mapping`);let f=" ";if(d.length===1)for(let m=d[0].index+1;m<u.length;m++){if(u[m].trim()===""||u[m].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(u[m]))break;let y=u[m].match(/^(\s+)\S/);y&&(f=y[1]);break}if(n){let m=[],y=!1,_=0,b=!1,S=0;for(let z=0;z<u.length;z++){let te=u[z],ae=te.match(s);if(ae){y=!0,_=ae[1].length,m.push(te);continue}if(y){let Ne=te.match(/^(\s*)/)?.[1].length||0;if(te.trimStart().startsWith("#")){m.push(te);continue}if(te.trim()!==""&&Ne<=_)y=!1,b=!1;else{let mr=te.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(mr&&mr[1]===f){b=!0,S=mr[1].length;continue}if(b){if(Ne>S||te.trim()==="")continue;b=!1}}}m.push(te)}return m.join(`
55
55
  `)}let p=i.freshEntry(f,t,r);if(!e||e.trim()==="")return`${i.rootKey}:
56
56
  ${p.join(`
57
57
  `)}
58
- `;let m=d.length===1?d[0].index:-1;if(m===-1)return`${e.trimEnd()}
58
+ `;let g=d.length===1?d[0].index:-1;if(g===-1)return`${e.trimEnd()}
59
59
 
60
60
  ${i.rootKey}:
61
61
  ${p.join(`
62
62
  `)}
63
- `;let h=-1;for(let g=m+1;g<u.length;g++){let y=u[g];if(/^[^\s#]/.test(y))break;if((y.match(/^(\s*)/)?.[1]||"")===f&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(y)){h=g;break}}if(h!==-1){let g=u[h].match(/^(\s*)/)?.[1].length||2,y=h+1;for(;y<u.length;){let te=u[y];if((te.match(/^(\s*)/)?.[1].length||0)>g||te.trim()==="")y++;else break}let _=[],b=-1,S=g+f.length;for(let te=h+1;te<y;te++){let ae=u[te];if(ae.trim()==="")continue;let Ne=ae.match(/^(\s*)/)?.[1].length??0;if(!(b!==-1&&Ne>b)){if(b=-1,Ne===S&&c.test(ae)){b=Ne;continue}_.push(ae)}}p[0]+=GE(u[h]);let z=p.filter((te,ae)=>{if(ae===0)return!0;let Ne=te.match(/^\s*["']?([A-Za-z0-9_-]+)["']?\s*:/);return!Ne||i.ownedKeys.includes(Ne[1])});return u.splice(h,y-h,...z,..._),u.join(`
64
- `)}else return u.splice(m+1,0,...p),u.join(`
65
- `)}function v$(e){let t=null;for(let r=0;r<e.length;r++){let n=e[r];if(t){if(t==='"'&&n==="\\"&&r+1<e.length){r++;continue}n===t&&(t=null);continue}if(n==='"'||n==="'"){t=n;continue}if(n==="#"){let o=r;for(;o>0&&Zf.test(e[o-1]);)o--;return[e.slice(0,o),e.slice(o)]}}return[e,""]}var YE=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\]\s*(?:#.*)?$/,y$=/^\s*\[.*\]\s*(?:#.*)?$/,QE=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\./,eT=/^\s*\[.*["']mcp_servers["'].*["']superpowers["'].*\]\s*(?:#.*)?$/,tT=/^\s*(command|args)\s*=/;function rT(e,t,r,n=!1){let o=e?e.split(/\r?\n/):[];for(let _ of o)if(/^\s*mcp_servers(?:\s*\.\s*[A-Za-z0-9_-]+)*\s*=/.test(_))throw new Error("Cannot safely update TOML with inline mcp_servers assignment (expected [mcp_servers.superpowers] table)");let i=[];for(let _=0;_<o.length;_++){if(eT.test(o[_]))throw new Error("Cannot safely update TOML with quoted mcp_servers.superpowers table names");YE.test(o[_])&&i.push(_)}if(i.length>1)throw new Error("Cannot safely update TOML with duplicate mcp_servers.superpowers tables");let a=`command = ${JSON.stringify(t)}`,s=`args = ${JSON.stringify(r)}`,c=_=>_.replace(/'/g,'"').replace(/\s+/g,"");if(i.length===0){if(n)return e;let _=`[mcp_servers.superpowers]
63
+ `;let h=-1;for(let m=g+1;m<u.length;m++){let y=u[m];if(/^[^\s#]/.test(y))break;if((y.match(/^(\s*)/)?.[1]||"")===f&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(y)){h=m;break}}if(h!==-1){let m=u[h].match(/^(\s*)/)?.[1].length||2,y=h+1;for(;y<u.length;){let te=u[y];if((te.match(/^(\s*)/)?.[1].length||0)>m||te.trim()==="")y++;else break}let _=[],b=-1,S=m+f.length;for(let te=h+1;te<y;te++){let ae=u[te];if(ae.trim()==="")continue;let Ne=ae.match(/^(\s*)/)?.[1].length??0;if(!(b!==-1&&Ne>b)){if(b=-1,Ne===S&&c.test(ae)){b=Ne;continue}_.push(ae)}}p[0]+=tT(u[h]);let z=p.filter((te,ae)=>{if(ae===0)return!0;let Ne=te.match(/^\s*["']?([A-Za-z0-9_-]+)["']?\s*:/);return!Ne||i.ownedKeys.includes(Ne[1])});return u.splice(h,y-h,...z,..._),u.join(`
64
+ `)}else return u.splice(g+1,0,...p),u.join(`
65
+ `)}function _$(e){let t=null;for(let r=0;r<e.length;r++){let n=e[r];if(t){if(t==='"'&&n==="\\"&&r+1<e.length){r++;continue}n===t&&(t=null);continue}if(n==='"'||n==="'"){t=n;continue}if(n==="#"){let o=r;for(;o>0&&Ff.test(e[o-1]);)o--;return[e.slice(0,o),e.slice(o)]}}return[e,""]}var nT=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\]\s*(?:#.*)?$/;function pr(e){return e===" "||e===" "||e===`
66
+ `||e==="\r"||e==="\f"||e==="\v"}function $$(e){let t=0;for(;t<e.length&&pr(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&pr(e[n]);)n++;return n>=e.length?!0:e[n]==="#"}var oT=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\./;function iT(e){let t=0;for(;t<e.length&&pr(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&pr(e[n]);)n++;if(n<e.length&&e[n]!=="#")return!1;let o=e.slice(t+1,r);return!o.includes("mcp_servers")||!o.includes("superpowers")?!1:o.includes('"')||o.includes("'")}function aT(e){let t=0;for(;t<e.length&&pr(e[t]);)t++;let r=null;if(e.startsWith("command",t))r="command",t+=7;else if(e.startsWith("args",t))r="args",t+=4;else return null;for(;t<e.length&&pr(e[t]);)t++;if(t>=e.length||e[t]!=="=")return null;for(t++;t<e.length&&pr(e[t]);)t++;let n=e.length;for(;n>t&&pr(e[n-1]);)n--;return{key:r,value:e.slice(t,n)}}var sT=/^\s*(command|args)\s*=/;function cT(e,t,r,n=!1){let o=e?e.split(/\r?\n/):[];for(let _ of o)if(/^\s*mcp_servers(?:\s*\.\s*[A-Za-z0-9_-]+)*\s*=/.test(_))throw new Error("Cannot safely update TOML with inline mcp_servers assignment (expected [mcp_servers.superpowers] table)");let i=[];for(let _=0;_<o.length;_++){if(iT(o[_]))throw new Error("Cannot safely update TOML with quoted mcp_servers.superpowers table names");nT.test(o[_])&&i.push(_)}if(i.length>1)throw new Error("Cannot safely update TOML with duplicate mcp_servers.superpowers tables");let a=`command = ${JSON.stringify(t)}`,s=`args = ${JSON.stringify(r)}`,c=_=>_.replace(/'/g,'"').replace(/\s+/g,"");if(i.length===0){if(n)return e;let _=`[mcp_servers.superpowers]
66
67
  ${a}
67
68
  ${s}
68
69
  `;return!e||e.trim()===""?_:`${e.trimEnd()}
69
70
 
70
- ${_}`}let u=i[0],l=u+1;for(;l<o.length&&!(y$.test(o[l])&&!QE.test(o[l]));)l++;let d=l;for(let _=u+1;_<l;_++)if(y$.test(o[_])){d=_;break}if(n)return o.slice(0,u).concat(o.slice(l)).join(`
71
- `);let f=null,p=null,m={};for(let _=u+1;_<d;_++){let[b,S]=v$(o[_]),z=b.match(/^\s*(command|args)\s*=\s*([\s\S]*?)\s*$/);z&&(z[1]==="command"?f===null&&(f=c(z[2])):p===null&&(p=c(z[2])),z[1]in m||(m[z[1]]=S))}if(f===c(JSON.stringify(t))&&p===c(JSON.stringify(r)))return e;let h=[`${a}${m.command??""}`,`${s}${m.args??""}`],g=o.slice(0,u+1),y=!1;for(let _=u+1;_<d;_++){let[b]=v$(o[_]);if(tT.test(b)){y||(g.push(...h),y=!0);continue}g.push(o[_])}return y||g.push(...h),g.push(...o.slice(d,l)),g.push(...o.slice(l)),g.join(`
72
- `)}function _$(e,t,r){if(!Tn(e))return t;let n={...e,...t};return(e.enabled!==void 0||e.disabled!==void 0)&&(e.enabled!==void 0?n.enabled=e.enabled:delete n.enabled),r==="json-mcp"&&Array.isArray(n.command)&&delete n.args,n}function nT(e,t,r,n,o=!1,i,a){let s={},c=!1;if(e&&e.trim()!=="")try{let p=JSON.parse(e);if(!Tn(p))throw new Error("Existing JSON root must be an object");s=p}catch(p){try{let m=WE(e,!0),h=JSON.parse(m);if(!Tn(h))throw new Error("Existing JSON root must be an object");s=h,c=m!==e}catch(m){let h=m instanceof Error?m.message:String(m),g=p instanceof Error?p.message:String(p);throw new Error(`Failed to parse existing JSON: ${h} (raw JSON error: ${g})`)}}let u=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers";if(a&&a.length>0){let p=a.join("."),m=s;for(let g of a){let y=m[g];if(y===void 0){if(o)return e;m[g]={}}else if(!Tn(y))throw new Error(`Existing JSON field "${p}" must be an object`);m=m[g]}if(o)delete m.superpowers;else{let g=i?{...i}:{command:r,args:n};m.superpowers=_$(m.superpowers,g,t)}let h=JSON.stringify(s,null,2)+`
71
+ ${_}`}let u=i[0],l=u+1;for(;l<o.length&&!($$(o[l])&&!oT.test(o[l]));)l++;let d=l;for(let _=u+1;_<l;_++)if($$(o[_])){d=_;break}if(n)return o.slice(0,u).concat(o.slice(l)).join(`
72
+ `);let f=null,p=null,g={};for(let _=u+1;_<d;_++){let[b,S]=_$(o[_]),z=aT(b);z&&(z.key==="command"?f===null&&(f=c(z.value)):p===null&&(p=c(z.value)),z.key in g||(g[z.key]=S))}if(f===c(JSON.stringify(t))&&p===c(JSON.stringify(r)))return e;let h=[`${a}${g.command??""}`,`${s}${g.args??""}`],m=o.slice(0,u+1),y=!1;for(let _=u+1;_<d;_++){let[b]=_$(o[_]);if(sT.test(b)){y||(m.push(...h),y=!0);continue}m.push(o[_])}return y||m.push(...h),m.push(...o.slice(d,l)),m.push(...o.slice(l)),m.join(`
73
+ `)}function b$(e,t,r){if(!On(e))return t;let n={...e,...t};return(e.enabled!==void 0||e.disabled!==void 0)&&(e.enabled!==void 0?n.enabled=e.enabled:delete n.enabled),r==="json-mcp"&&Array.isArray(n.command)&&delete n.args,n}function uT(e,t,r,n,o=!1,i,a){let s={},c=!1;if(e&&e.trim()!=="")try{let p=JSON.parse(e);if(!On(p))throw new Error("Existing JSON root must be an object");s=p}catch(p){try{let g=eT(e,!0),h=JSON.parse(g);if(!On(h))throw new Error("Existing JSON root must be an object");s=h,c=g!==e}catch(g){let h=g instanceof Error?g.message:String(g),m=p instanceof Error?p.message:String(p);throw new Error(`Failed to parse existing JSON: ${h} (raw JSON error: ${m})`)}}let u=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers";if(a&&a.length>0){let p=a.join(".");for(let m of a){if(typeof m!="string"||m.length===0)throw new Error(`Invalid JSON field "${p}"`);if(m==="__proto__"||m==="constructor"||m==="prototype")throw new Error(`Refusing to use unsafe JSON field "${p}"`);if(!/^[A-Za-z0-9_-]+$/.test(m))throw new Error(`Invalid JSON field "${p}"`)}let g=s;for(let m of a){if(m==="__proto__"||m==="constructor"||m==="prototype")throw new Error(`Refusing to use unsafe JSON field "${p}"`);let y=g[m];if(y===void 0){if(o)return e;g[m]={}}else if(!On(y))throw new Error(`Existing JSON field "${p}" must be an object`);g=g[m]}if(o)delete g.superpowers;else{let m=i?{...i}:{command:r,args:n};g.superpowers=b$(g.superpowers,m,t)}let h=JSON.stringify(s,null,2)+`
73
74
  `;return c&&h!==e&&process.stderr.write(`[superpowers-mcp] Warning: JSONC comments/trailing commas in the existing config were removed while updating it (the file is rewritten as plain JSON).
74
- `),h}let l=HE.find(p=>Tn(s[p])&&s[p].superpowers!==void 0)??u;if(s[l]!==void 0&&!Tn(s[l]))throw new Error(`Existing JSON field "${l}" must be an object`);s[l]===void 0&&(s[l]={});let d=s[l];if(o)delete d.superpowers;else{let p;i?p={...i}:t==="json-servers"?p={command:r,args:n,type:"stdio"}:t==="json-mcp"?p={type:"local",command:[r,...n],enabled:!0}:p={command:r,args:n},d.superpowers=_$(d.superpowers,p,t)}let f=JSON.stringify(s,null,2)+`
75
+ `),h}let l=QE.find(p=>On(s[p])&&s[p].superpowers!==void 0)??u;if(s[l]!==void 0&&!On(s[l]))throw new Error(`Existing JSON field "${l}" must be an object`);s[l]===void 0&&(s[l]={});let d=s[l];if(o)delete d.superpowers;else{let p;i?p={...i}:t==="json-servers"?p={command:r,args:n,type:"stdio"}:t==="json-mcp"?p={type:"local",command:[r,...n],enabled:!0}:p={command:r,args:n},d.superpowers=b$(d.superpowers,p,t)}let f=JSON.stringify(s,null,2)+`
75
76
  `;return c&&f!==e&&process.stderr.write(`[superpowers-mcp] Warning: JSONC comments/trailing commas in the existing config were removed while updating it (the file is rewritten as plain JSON).
76
- `),f}function oT(e,t=10){try{let r=x.dirname(e),n=`${x.basename(e)}.`,o=".bak",i=C.readdirSync(r).filter(a=>{if(!a.startsWith(n)||!a.endsWith(o))return!1;let s=a.slice(n.length,a.length-o.length);return/^\d+$/.test(s)}).map(a=>{let s=x.join(r,a);try{return{full:s,mtimeMs:C.statSync(s).mtimeMs}}catch{return{full:s,mtimeMs:0}}}).sort((a,s)=>s.mtimeMs-a.mtimeMs);for(let a of i.slice(t))try{C.unlinkSync(a.full)}catch{}}catch{}}function iT(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 _=C.lstatSync(e,{throwIfNoEntry:!1});if(_&&_.isSymbolicLink()){try{i=C.realpathSync(e)}catch{let Ne=C.readlinkSync(e);i=x.resolve(x.dirname(e),Ne)}let b=x.normalize(x.resolve(i)).toLowerCase(),S=x.normalize(x.resolve(Rr.tmpdir())).toLowerCase();if(!(b===S||b.startsWith(S+x.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(ae=>b===ae||b.startsWith(ae+x.sep))||b==="/var"||b.startsWith("/var"+x.sep)&&!b.startsWith("/var/folders"+x.sep)||b==="/private/var"||b.startsWith("/private/var"+x.sep)&&!b.startsWith("/private/var/folders"+x.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=x.dirname(i);C.existsSync(a)||C.mkdirSync(a,{recursive:!0,mode:448});let s=C.realpathSync(a),c=C.statSync(s);i=x.join(s,x.basename(i));let u=x.normalize(x.resolve(i)).toLowerCase(),l=x.normalize(x.resolve(Rr.tmpdir())).toLowerCase(),d=u===l||u.startsWith(l+x.sep),p=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(_=>u===_||u.startsWith(_+x.sep))||u==="/var"||u.startsWith("/var"+x.sep)&&!u.startsWith("/var/folders"+x.sep)||u==="/private/var"||u.startsWith("/private/var"+x.sep)&&!u.startsWith("/private/var/folders"+x.sep);if(!d&&p)throw new Error(`Refusing to write to unsafe configuration target: ${i}`);if(!n.some(_=>{if(!_)return!1;let b=x.resolve(_);try{b=C.realpathSync(b)}catch{}let S=x.relative(b,i);return S!==".."&&!S.startsWith(`..${x.sep}`)&&!x.isAbsolute(S)}))throw new Error(`Refusing to write configuration outside allowed roots: ${i}`);let h=384;if(C.existsSync(i)){try{h=C.statSync(i).mode}catch{}if(r){let _=C.readFileSync(i,"utf8"),b=`${i}.${Date.now()}.bak`;try{C.writeFileSync(b,_,{encoding:"utf8",mode:h})}catch(S){let z=S instanceof Error?S.message:String(S);throw new Error(`Failed to create safe backup before write: ${z}`)}oT(i)}}let g=$$.randomBytes(8).toString("hex"),y=x.join(s,`.tmp.${x.basename(i)}.${process.pid}.${g}`);try{C.writeFileSync(y,t,{encoding:"utf8",mode:h,flag:"wx"});let _=C.existsSync(i);if(o===null&&_)throw new Error("Configuration changed concurrently before it could be created");if(o!=null&&(!_||C.readFileSync(i,"utf8")!==o))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let b=C.realpathSync(a),S=C.statSync(b);if(b!==s||S.dev!==c.dev||S.ino!==c.ino)throw new Error("Configuration directory changed while writing");C.renameSync(y,i)}catch(_){try{C.existsSync(y)&&C.unlinkSync(y)}catch{}throw _}}async function aT(e={}){let t=e.platform||Rr.platform(),r=e.homeDir||Rr.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($i).join("|")}>.`);let f=Object.keys($i).find(m=>m===c||$i[m].aliases.includes(c));if(!f)throw new Error(`Unknown harness target: "${c}". Supported targets: ${Object.keys($i).join(", ")}`);let p=[f];for(let m of p){let h=$i[m],g=h.getConfigPath(t,r,n,o),y=C.existsSync(g);if(a&&!y){d.push({target:m,name:h.name,path:g,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let _="";y&&(_=C.readFileSync(g,"utf8"));let b="";if(h.type==="yaml")b=XE(_,u,l,a,h.yamlProfile);else if(h.type==="toml")b=rT(_,u,l,a);else{let S=typeof h.defaultConfig=="function"?h.defaultConfig(u,l):void 0;b=nT(_,h.type,u,l,a,S,h.serverPath)}if(_.trim()===b.trim()&&y){d.push({target:m,name:h.name,path:g,status:"up-to-date",message:a?"Already not configured":"Already configured and up-to-date"});continue}i||iT(g,b,!!e.backup,[r,n||"",o||""],y?_:null),d.push({target:m,name:h.name,path:g,status:a?"removed":y?"updated":"created",message:i?`[Dry Run] Would ${a?"remove from":y?"update":"create"} ${g}`:`Successfully ${a?"removed from":y?"updated":"configured"}!`})}catch(_){let b=_ instanceof Error?_.message:String(_);d.push({target:m,name:h.name,path:g,status:"error",message:b})}}return d}async function b$(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==="install"||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];if(!i||i.startsWith("-")){console.error(`\u274C Error: Missing value for --target flag.
77
+ `),f}function lT(e,t=10){try{let r=x.dirname(e),n=`${x.basename(e)}.`,o=".bak",i=C.readdirSync(r).filter(a=>{if(!a.startsWith(n)||!a.endsWith(o))return!1;let s=a.slice(n.length,a.length-o.length);return/^\d+$/.test(s)}).map(a=>{let s=x.join(r,a);try{return{full:s,mtimeMs:C.statSync(s).mtimeMs}}catch{return{full:s,mtimeMs:0}}}).sort((a,s)=>s.mtimeMs-a.mtimeMs);for(let a of i.slice(t))try{C.unlinkSync(a.full)}catch{}}catch{}}function dT(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 _=C.lstatSync(e,{throwIfNoEntry:!1});if(_&&_.isSymbolicLink()){try{i=C.realpathSync(e)}catch{let Ne=C.readlinkSync(e);i=x.resolve(x.dirname(e),Ne)}let b=x.normalize(x.resolve(i)).toLowerCase(),S=x.normalize(x.resolve(Cr.tmpdir())).toLowerCase();if(!(b===S||b.startsWith(S+x.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(ae=>b===ae||b.startsWith(ae+x.sep))||b==="/var"||b.startsWith("/var"+x.sep)&&!b.startsWith("/var/folders"+x.sep)||b==="/private/var"||b.startsWith("/private/var"+x.sep)&&!b.startsWith("/private/var/folders"+x.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=x.dirname(i);C.existsSync(a)||C.mkdirSync(a,{recursive:!0,mode:448});let s=C.realpathSync(a),c=C.statSync(s);i=x.join(s,x.basename(i));let u=x.normalize(x.resolve(i)).toLowerCase(),l=x.normalize(x.resolve(Cr.tmpdir())).toLowerCase(),d=u===l||u.startsWith(l+x.sep),p=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(_=>u===_||u.startsWith(_+x.sep))||u==="/var"||u.startsWith("/var"+x.sep)&&!u.startsWith("/var/folders"+x.sep)||u==="/private/var"||u.startsWith("/private/var"+x.sep)&&!u.startsWith("/private/var/folders"+x.sep);if(!d&&p)throw new Error(`Refusing to write to unsafe configuration target: ${i}`);if(!n.some(_=>{if(!_)return!1;let b=x.resolve(_);try{b=C.realpathSync(b)}catch{}let S=x.relative(b,i);return S!==".."&&!S.startsWith(`..${x.sep}`)&&!x.isAbsolute(S)}))throw new Error(`Refusing to write configuration outside allowed roots: ${i}`);let h=384;if(C.existsSync(i)){try{h=C.statSync(i).mode}catch{}if(r){let _=C.readFileSync(i,"utf8"),b=`${i}.${Date.now()}.bak`;try{C.writeFileSync(b,_,{encoding:"utf8",mode:h})}catch(S){let z=S instanceof Error?S.message:String(S);throw new Error(`Failed to create safe backup before write: ${z}`)}lT(i)}}let m=x$.randomBytes(8).toString("hex"),y=x.join(s,`.tmp.${x.basename(i)}.${process.pid}.${m}`);try{C.writeFileSync(y,t,{encoding:"utf8",mode:h,flag:"wx"});let _=C.existsSync(i);if(o===null&&_)throw new Error("Configuration changed concurrently before it could be created");if(o!=null&&(!_||C.readFileSync(i,"utf8")!==o))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let b=C.realpathSync(a),S=C.statSync(b);if(b!==s||S.dev!==c.dev||S.ino!==c.ino)throw new Error("Configuration directory changed while writing");C.renameSync(y,i)}catch(_){try{C.existsSync(y)&&C.unlinkSync(y)}catch{}throw _}}async function pT(e={}){let t=e.platform||Cr.platform(),r=e.homeDir||Cr.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(bi).join("|")}>.`);let f=Object.keys(bi).find(g=>g===c||bi[g].aliases.includes(c));if(!f)throw new Error(`Unknown harness target: "${c}". Supported targets: ${Object.keys(bi).join(", ")}`);let p=[f];for(let g of p){let h=bi[g],m=h.getConfigPath(t,r,n,o),y=C.existsSync(m);if(a&&!y){d.push({target:g,name:h.name,path:m,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let _="";y&&(_=C.readFileSync(m,"utf8"));let b="";if(h.type==="yaml")b=rT(_,u,l,a,h.yamlProfile);else if(h.type==="toml")b=cT(_,u,l,a);else{let S=typeof h.defaultConfig=="function"?h.defaultConfig(u,l):void 0;b=uT(_,h.type,u,l,a,S,h.serverPath)}if(_.trim()===b.trim()&&y){d.push({target:g,name:h.name,path:m,status:"up-to-date",message:a?"Already not configured":"Already configured and up-to-date"});continue}i||dT(m,b,!!e.backup,[r,n||"",o||""],y?_:null),d.push({target:g,name:h.name,path:m,status:a?"removed":y?"updated":"created",message:i?`[Dry Run] Would ${a?"remove from":y?"update":"create"} ${m}`:`Successfully ${a?"removed from":y?"updated":"configured"}!`})}catch(_){let b=_ instanceof Error?_.message:String(_);d.push({target:g,name:h.name,path:m,status:"error",message:b})}}return d}async function k$(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==="install"||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];if(!i||i.startsWith("-")){console.error(`\u274C Error: Missing value for --target flag.
77
78
  `),process.exitCode=1;return}r.target=e[++n]}else if(o.startsWith("--target=")){let i=o.split("=")[1];if(!i){console.error(`\u274C Error: Missing value for --target flag.
78
- `),process.exitCode=1;return}r.target=i}else if(o==="--help"||o==="-h"){sT();return}else if(o.startsWith("-")){console.error(`\u274C Error: Unknown option "${o}". Use --help for usage.
79
+ `),process.exitCode=1;return}r.target=i}else if(o==="--help"||o==="-h"){fT();return}else if(o.startsWith("-")){console.error(`\u274C Error: Unknown option "${o}". Use --help for usage.
79
80
  `),process.exitCode=1;return}else if(!r.target)r.target=o;else{console.error(`\u274C Error: Unexpected argument "${o}". Use --help for usage.
80
81
  `),process.exitCode=1;return}}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(`
81
82
  ========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
@@ -83,9 +84,9 @@ ${_}`}let u=i[0],l=u+1;for(;l<o.length&&!(y$.test(o[l])&&!QE.test(o[l]));)l++;le
83
84
  `),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)"),console.log(" npx -y superpowers-mcp setup --target codex # Codex (~/.codex/config.toml)"),console.log(" npx -y superpowers-mcp setup --target openclaw # OpenClaw (~/.openclaw/openclaw.json)"),console.log(` npx -y superpowers-mcp setup --target goose # Goose (~/.config/goose/config.yaml)
84
85
  `),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.
85
86
  `),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.
86
- `),process.exitCode=1;return}try{let n=await aT(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}
87
+ `),process.exitCode=1;return}try{let n=await pT(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}
87
88
  `),s.status==="created"||s.status==="updated"||s.status==="up-to-date"||s.status==="removed"?o++:s.status==="skipped"?i++:s.status==="error"&&a++}if(console.log("--------------------------------------------------------"),a>0){console.error(`\u26A0\uFE0F Setup finished with errors: ${a} failure(s), ${o} succeeded.`),process.exitCode=1;return}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}
88
- `),process.exitCode=1}}function sT(){console.log(`
89
+ `),process.exitCode=1}}function fT(){console.log(`
89
90
  Superpowers MCP - Targeted Global Setup
90
91
 
91
92
  Usage:
@@ -133,17 +134,17 @@ Any Directory:
133
134
  Privacy & Safety:
134
135
  Superpowers MCP only touches the client you explicitly choose.
135
136
  It never bulk-modifies your environment without your consent.
136
- `)}var Cr={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."]}]},Ar={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 x$(e){let t=e.when?` (${e.when})`:"";return[` - **Skill:** \`superpowers:${e.name}\`${t}`,` - **Load it with:** \`read_skill({"skill_name":"${e.name}"})\``].join(`
137
- `)}function k$(e,t){let r=t?`
137
+ `)}var Zr={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."]}]},Ar={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 w$(e){let t=e.when?` (${e.when})`:"";return[` - **Skill:** \`superpowers:${e.name}\`${t}`,` - **Load it with:** \`read_skill({"skill_name":"${e.name}"})\``].join(`
138
+ `)}function S$(e,t){let r=t?`
138
139
  ### Requirements / Context:
139
140
  ${t}
140
- `:"",n=Cr.stages.map((o,i)=>{let a=o.skills.map(x$).join(`
141
+ `:"",n=Zr.stages.map((o,i)=>{let a=o.skills.map(w$).join(`
141
142
  `),s=o.instructions.map(c=>` - ${c}`).join(`
142
143
  `);return`${i+1}. **Stage ${i+1}: ${o.title}**
143
144
  ${a}
144
145
  ${s}`}).join(`
145
146
 
146
- `);return`# ${Cr.title}
147
+ `);return`# ${Zr.title}
147
148
 
148
149
  This prompt starts an interactive, agent-guided workflow. It does not execute the stages server-side and it must pause at the design, plan-review, and branch-finishing decision gates.
149
150
 
@@ -153,13 +154,13 @@ For every stage, call \`read_skill\` with the exact bare skill name shown below
153
154
  ${r}
154
155
  ## Mandatory Execution Stages
155
156
 
156
- ${n}`}function w$(e,t){let r=e?`
157
+ ${n}`}function z$(e,t){let r=e?`
157
158
  ### Issue Description / Logs:
158
159
  ${e}
159
160
  `:"",n=t?`
160
161
  ### Failing Tests:
161
162
  ${t}
162
- `:"",o=Ar.stages.map((i,a)=>{let s=i.skills.map(x$).join(`
163
+ `:"",o=Ar.stages.map((i,a)=>{let s=i.skills.map(w$).join(`
163
164
  `),c=i.instructions.map(u=>` - ${u}`).join(`
164
165
  `);return`${a+1}. **Stage ${a+1}: ${i.title}**
165
166
  ${s}
@@ -173,11 +174,11 @@ For every applicable stage, call \`read_skill\` with the exact bare skill name s
173
174
  ${r}${n}
174
175
  ## Mandatory Troubleshooting Stages
175
176
 
176
- ${o}`}function cT(){let e=process.env.SKILLS_PATH;if(e){let r=ze.resolve(e),n=r,o=!0;try{n=Zr.realpathSync(r)}catch{o=!1}let i=f=>process.platform==="darwin"||process.platform==="win32"?f.toLowerCase():f,a=i(ze.normalize(n)),s=i(ze.parse(n).root),c=["/etc","/var","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","/private/var","c:\\windows","c:\\program files","c:\\program files (x86)"],u=(()=>{try{return i(ze.normalize(Zr.realpathSync(P$.tmpdir())))}catch{return null}})();if(!(u!==null&&(a===u||a.startsWith(u+ze.sep)))&&(!o||a===s||c.some(f=>{let p=i(ze.normalize(f));return a===p||a.startsWith(p+ze.sep)})))process.stderr.write(`Warning: Potentially unsafe SKILLS_PATH: "${e}". Fallback to default.
177
- `);else return n}let t=ze.join(__dirname,"..","skills");return Zr.existsSync(t)?t:ze.join(__dirname,"skills")}var Mf=cT(),Jt=new Ds(Mf),Ff="guide://superpowers/skill-compositions",uT=ze.join(__dirname,"..","docs","skill-compositions.md"),Uf=null;function j$(e){return e.trim().replace(/^superpowers:/i,"")}var lT="6.4.3",pr=new Ts({name:"superpowers-mcp",version:lT},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});pr.setRequestHandler(_d,async()=>({resources:[...(await Jt.listSkills()).map(t=>({uri:`skill://superpowers/${encodeURIComponent(t.name)}`,name:t.name,description:t.description,mimeType:"text/markdown"})),{uri:Ff,name:"Skill Compositions Guide",description:"Workflow selection, prerequisites, invocation, and lifecycle guidance for Superpowers pipelines.",mimeType:"text/markdown"}]}));pr.setRequestHandler(bd,async e=>{let t=e.params.uri;if(t===Ff)try{return Uf===null&&(Uf=await Zr.promises.readFile(uT,"utf8")),{contents:[{uri:t,mimeType:"text/markdown",text:Uf}]}}catch(i){let a=i instanceof Error?i.message:String(i);throw process.stderr.write(`[superpowers-mcp] Failed to read compositions guide: ${a}
178
- `),new R(A.InternalError,`Failed to read the skill compositions guide: ${a}`)}let r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new R(A.InvalidRequest,`Invalid skill URI: ${t}`);let n;try{n=decodeURIComponent(r[1])}catch{throw new R(A.InvalidRequest,`Invalid skill URI: ${t}`)}if(!n||n.includes("/")||n.includes("\\")||n.includes("..")||n.includes("\0"))throw new R(A.InvalidRequest,`Invalid skill URI: ${t}`);let o=await Jt.findSkill(j$(n));if(!o)throw new R(A.InvalidRequest,`Skill not found: ${n}`);try{let i=await Jt.readSkillContent(o.skillPath);return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}}catch(i){let a=i instanceof Error?i.message:String(i);throw process.stderr.write(`[superpowers-mcp] Failed to read resource "${t}": ${a}
179
- `),new R(A.InternalError,`Failed to read skill content for "${n}": ${a}`)}});function S$(e,t){return e.endsWith(t)?`${e.slice(0,-t.length)}-review.md`:""}function z$(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 I$(e,t,r){if(e&&!z$(e,t)&&!z$(e,r))return e;let n=S$(t,"-report.md")||S$(r,"-brief.md");if(n)return n;if(t){let o=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),i=t.slice(0,o+1),s=t.slice(o+1).replace(/\.[^./\\]*$/,"");return s===""?`${t}-review.md`:`${i}${s}-review.md`}return""}var Rs=new Map;function dT(e){let t=Rs.get(e);if(t)return t;let r=new RegExp(e,"g");return Rs.size>=64&&Rs.clear(),Rs.set(e,r),r}function bi(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=dT(n);return o.lastIndex=0,e.replace(o,i=>{let a=t[i];return a!==void 0&&a!==""?String(a):i})}function xi(e,t){let r=new Set;for(let[n,o]of Object.entries(t))o!==void 0&&o!==""&&e.includes(n)&&r.add(n);return r}pr.setRequestHandler(xd,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:Cr.promptName,description:Cr.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:Ar.promptName,description:Ar.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}]}]}));pr.setRequestHandler(kd,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;if(c==null)return"";if(typeof c!="string")throw new R(A.InvalidParams,`Prompt argument "${a}" must be a string`);let u=c.trim();if(u.length>s)throw new R(A.InvalidParams,`Prompt argument "${a}" exceeds the maximum length of ${s} characters`);return u},i=async a=>{let s=ze.join(Mf,a);try{let c=await Jt.readSkillContent(s);if(c.trim()==="")throw new Error("prompt template is empty");return c}catch(c){let u=c instanceof Error?c.message:String(c);throw process.stderr.write(`[superpowers-mcp] Failed to load prompt template "${a}": ${u}
180
- `),new R(A.InternalError,`Failed to load prompt template "${a}": ${u}. The Superpowers skills directory may be missing or incomplete.`)}};if(t==="session-start"){let a="";try{let c=await Jt.findSkill("using-superpowers"),u=c?c.skillPath:ze.join(Mf,"using-superpowers","SKILL.md");a=await Jt.readSkillContent(u)}catch(c){let u=c instanceof Error?c.message:String(c);process.stderr.write(`[superpowers-mcp] Failed to load using-superpowers skill, using fallback: ${u}
177
+ ${o}`}function mT(){let e=process.env.SKILLS_PATH;if(e){let r=ze.resolve(e),n=r,o=!0;try{n=Ur.realpathSync(r)}catch{o=!1}let i=f=>process.platform==="darwin"||process.platform==="win32"?f.toLowerCase():f,a=i(ze.normalize(n)),s=i(ze.parse(n).root),c=["/etc","/var","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","/private/var","c:\\windows","c:\\program files","c:\\program files (x86)"],u=(()=>{try{return i(ze.normalize(Ur.realpathSync(E$.tmpdir())))}catch{return null}})();if(!(u!==null&&(a===u||a.startsWith(u+ze.sep)))&&(!o||a===s||c.some(f=>{let p=i(ze.normalize(f));return a===p||a.startsWith(p+ze.sep)})))process.stderr.write(`Warning: Potentially unsafe SKILLS_PATH: "${e}". Fallback to default.
178
+ `);else return n}let t=ze.join(__dirname,"..","skills");return Ur.existsSync(t)?t:ze.join(__dirname,"skills")}var qf=mT(),Jt=new Cs(qf),Vf="guide://superpowers/skill-compositions",hT=ze.join(__dirname,"..","docs","skill-compositions.md"),Lf=null;function T$(e){return e.trim().replace(/^superpowers:/i,"")}var gT="6.4.5",fr=new Ns({name:"superpowers-mcp",version:gT},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});fr.setRequestHandler(bd,async()=>({resources:[...(await Jt.listSkills()).map(t=>({uri:`skill://superpowers/${encodeURIComponent(t.name)}`,name:t.name,description:t.description,mimeType:"text/markdown"})),{uri:Vf,name:"Skill Compositions Guide",description:"Workflow selection, prerequisites, invocation, and lifecycle guidance for Superpowers pipelines.",mimeType:"text/markdown"}]}));fr.setRequestHandler(kd,async e=>{let t=e.params.uri;if(t===Vf)try{return Lf===null&&(Lf=await Ur.promises.readFile(hT,"utf8")),{contents:[{uri:t,mimeType:"text/markdown",text:Lf}]}}catch(i){let a=i instanceof Error?i.message:String(i);throw process.stderr.write(`[superpowers-mcp] Failed to read compositions guide: ${a}
179
+ `),new R(Z.InternalError,`Failed to read the skill compositions guide: ${a}`)}let r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new R(Z.InvalidRequest,`Invalid skill URI: ${t}`);let n;try{n=decodeURIComponent(r[1])}catch{throw new R(Z.InvalidRequest,`Invalid skill URI: ${t}`)}if(!n||n.includes("/")||n.includes("\\")||n.includes("..")||n.includes("\0"))throw new R(Z.InvalidRequest,`Invalid skill URI: ${t}`);let o=await Jt.findSkill(T$(n));if(!o)throw new R(Z.InvalidRequest,`Skill not found: ${n}`);try{let i=await Jt.readSkillContent(o.skillPath);return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}}catch(i){let a=i instanceof Error?i.message:String(i);throw process.stderr.write(`[superpowers-mcp] Failed to read resource "${t}": ${a}
180
+ `),new R(Z.InternalError,`Failed to read skill content for "${n}": ${a}`)}});function I$(e,t){return e.endsWith(t)?`${e.slice(0,-t.length)}-review.md`:""}function P$(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 j$(e,t,r){if(e&&!P$(e,t)&&!P$(e,r))return e;let n=I$(t,"-report.md")||I$(r,"-brief.md");if(n)return n;if(t){let o=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\")),i=t.slice(0,o+1),s=t.slice(o+1).replace(/\.[^./\\]*$/,"");return s===""?`${t}-review.md`:`${i}${s}-review.md`}return""}var Zs=new Map;function vT(e){let t=Zs.get(e);if(t)return t;let r=new RegExp(e,"g");return Zs.size>=64&&Zs.clear(),Zs.set(e,r),r}function xi(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=vT(n);return o.lastIndex=0,e.replace(o,i=>{let a=t[i];return a!==void 0&&a!==""?String(a):i})}function ki(e,t){let r=new Set;for(let[n,o]of Object.entries(t))o!==void 0&&o!==""&&e.includes(n)&&r.add(n);return r}fr.setRequestHandler(wd,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:Zr.promptName,description:Zr.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:Ar.promptName,description:Ar.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}]}]}));fr.setRequestHandler(Sd,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;if(c==null)return"";if(typeof c!="string")throw new R(Z.InvalidParams,`Prompt argument "${a}" must be a string`);let u=c.trim();if(u.length>s)throw new R(Z.InvalidParams,`Prompt argument "${a}" exceeds the maximum length of ${s} characters`);return u},i=async a=>{let s=ze.join(qf,a);try{let c=await Jt.readSkillContent(s);if(c.trim()==="")throw new Error("prompt template is empty");return c}catch(c){let u=c instanceof Error?c.message:String(c);throw process.stderr.write(`[superpowers-mcp] Failed to load prompt template "${a}": ${u}
181
+ `),new R(Z.InternalError,`Failed to load prompt template "${a}": ${u}. The Superpowers skills directory may be missing or incomplete.`)}};if(t==="session-start"){let a="";try{let c=await Jt.findSkill("using-superpowers"),u=c?c.skillPath:ze.join(qf,"using-superpowers","SKILL.md");a=await Jt.readSkillContent(u)}catch(c){let u=c instanceof Error?c.message:String(c);process.stderr.write(`[superpowers-mcp] Failed to load using-superpowers skill, using fallback: ${u}
181
182
  `),a=`# Superpowers
182
183
 
183
184
  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>
@@ -186,34 +187,34 @@ You have superpowers.
186
187
  **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:**
187
188
 
188
189
  ${a}
189
- </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"),f=o("task_description"),p=o("plan_file"),m={"[BRIEF_FILE]":s,"[task name]":c,"[REPORT_FILE]":u,"[directory]":l,"[MODEL]":d},h=bi(a,m),g=xi(a,m),y=[f&&!g.has("[task name]")?`
190
+ </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"),f=o("task_description"),p=o("plan_file"),g={"[BRIEF_FILE]":s,"[task name]":c,"[REPORT_FILE]":u,"[directory]":l,"[MODEL]":d},h=xi(a,g),m=ki(a,g),y=[f&&!m.has("[task name]")?`
190
191
 
191
192
  ### Target Task:
192
- ${f}`:"",p&&!g.has("[BRIEF_FILE]")?`
193
+ ${f}`:"",p&&!m.has("[BRIEF_FILE]")?`
193
194
 
194
195
  ### Plan / Brief File:
195
- ${p}`:""].join("");return{description:"Subagent-Driven Development Implementer Prompt",messages:[{role:"user",content:{type:"text",text:`${h}${y}`}}]}}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=I$(o("review_file"),c,s),d=o("base_sha"),f=o("head_sha"),p=o("global_constraints"),m=o("model"),h=o("task_description"),g=o("review_target"),y={"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[BASE_SHA]":d,"[HEAD_SHA]":f,"[GLOBAL_CONSTRAINTS]":p,"[REVIEW_FILE]":l,"[MODEL]":m},_=bi(a,y),b=xi(a,y),S=[h&&!b.has(h)?`
196
+ ${p}`:""].join("");return{description:"Subagent-Driven Development Implementer Prompt",messages:[{role:"user",content:{type:"text",text:`${h}${y}`}}]}}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=j$(o("review_file"),c,s),d=o("base_sha"),f=o("head_sha"),p=o("global_constraints"),g=o("model"),h=o("task_description"),m=o("review_target"),y={"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[BASE_SHA]":d,"[HEAD_SHA]":f,"[GLOBAL_CONSTRAINTS]":p,"[REVIEW_FILE]":l,"[MODEL]":g},_=xi(a,y),b=ki(a,y),S=[h&&!b.has(h)?`
196
197
 
197
198
  ### Reviewed Task:
198
- ${h}`:"",g&&!b.has(g)?`
199
+ ${h}`:"",m&&!b.has(m)?`
199
200
 
200
201
  ### Review Target:
201
- ${g}`:""].join("");return{description:"Subagent-Driven Development Task Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${_}${S}`}}]}}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=I$(o("review_file"),c,s),d=o("previous_findings"),f=o("base_sha")||o("fix_base_sha"),p=o("fix_base_sha")||f,m=o("head_sha"),h=o("model"),g=o("fix_summary"),y={"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[REVIEW_FILE]":l,"[FINDINGS]":d,"[BASE_SHA]":f,"[FIX_BASE_SHA]":p,"[HEAD_SHA]":m,"[MODEL]":h},_=bi(a,y),b=xi(a,y),S=[d&&!b.has("[FINDINGS]")?`
202
+ ${m}`:""].join("");return{description:"Subagent-Driven Development Task Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${_}${S}`}}]}}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=j$(o("review_file"),c,s),d=o("previous_findings"),f=o("base_sha")||o("fix_base_sha"),p=o("fix_base_sha")||f,g=o("head_sha"),h=o("model"),m=o("fix_summary"),y={"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[REVIEW_FILE]":l,"[FINDINGS]":d,"[BASE_SHA]":f,"[FIX_BASE_SHA]":p,"[HEAD_SHA]":g,"[MODEL]":h},_=xi(a,y),b=ki(a,y),S=[d&&!b.has("[FINDINGS]")?`
202
203
 
203
204
  ### Previous Findings:
204
- ${d}`:"",g?`
205
+ ${d}`:"",m?`
205
206
 
206
207
  ### Fix Summary:
207
- ${g}`:""].join("");return{description:"SDD Scoped Re-Review Prompt",messages:[{role:"user",content:{type:"text",text:`${_}${S}`}}]}}if(t==="spec-reviewer"){let a=await i("brainstorming/spec-document-reviewer-prompt.md"),s=o("spec_file"),c={"[SPEC_FILE_PATH]":s},u=bi(a,c),l=xi(a,c),d=s&&!l.has(s)?`
208
+ ${m}`:""].join("");return{description:"SDD Scoped Re-Review Prompt",messages:[{role:"user",content:{type:"text",text:`${_}${S}`}}]}}if(t==="spec-reviewer"){let a=await i("brainstorming/spec-document-reviewer-prompt.md"),s=o("spec_file"),c={"[SPEC_FILE_PATH]":s},u=xi(a,c),l=ki(a,c),d=s&&!l.has(s)?`
208
209
 
209
210
  ### Target Specification:
210
- ${s}`:"";return{description:"Brainstorming Spec Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${u}${d}`}}]}}if(t==="plan-reviewer"){let a=await i("writing-plans/plan-document-reviewer-prompt.md"),s=o("plan_file"),c=o("spec_file"),u={"[PLAN_FILE_PATH]":s,"[SPEC_FILE_PATH]":c},l=bi(a,u),d=xi(a,u),f=s&&!d.has(s)?`
211
+ ${s}`:"";return{description:"Brainstorming Spec Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${u}${d}`}}]}}if(t==="plan-reviewer"){let a=await i("writing-plans/plan-document-reviewer-prompt.md"),s=o("plan_file"),c=o("spec_file"),u={"[PLAN_FILE_PATH]":s,"[SPEC_FILE_PATH]":c},l=xi(a,u),d=ki(a,u),f=s&&!d.has(s)?`
211
212
 
212
213
  ### Target Implementation Plan:
213
214
  ${s}`:"",p=c&&!d.has(c)?`
214
215
 
215
216
  ### Reference Specification:
216
- ${c}`:"";return{description:"Writing-Plans Plan Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${l}${f}${p}`}}]}}if(t===Cr.promptName){if(!Object.prototype.hasOwnProperty.call(r,"feature_name"))throw new R(A.InvalidParams,'Prompt argument "feature_name" is required for the feature-pipeline prompt');let a=o("feature_name"),s=a?a.replace(/[\r\n]+/g," "):"(Unspecified feature)",c=o("requirements"),u=k$(s,c);return{description:Cr.purpose,messages:[{role:"user",content:{type:"text",text:u}}]}}if(t===Ar.promptName){let a=o("issue_description"),s=o("failing_tests"),c=w$(a,s);return{description:Ar.purpose,messages:[{role:"user",content:{type:"text",text:c}}]}}if(t==="skill-composition"){let a=o("scenario"),s=a?`
217
+ ${c}`:"";return{description:"Writing-Plans Plan Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${l}${f}${p}`}}]}}if(t===Zr.promptName){if(!Object.prototype.hasOwnProperty.call(r,"feature_name"))throw new R(Z.InvalidParams,'Prompt argument "feature_name" is required for the feature-pipeline prompt');let a=o("feature_name"),s=a?a.replace(/[\r\n]+/g," "):"(Unspecified feature)",c=o("requirements"),u=S$(s,c);return{description:Zr.purpose,messages:[{role:"user",content:{type:"text",text:u}}]}}if(t===Ar.promptName){let a=o("issue_description"),s=o("failing_tests"),c=z$(a,s);return{description:Ar.purpose,messages:[{role:"user",content:{type:"text",text:c}}]}}if(t==="skill-composition"){let a=o("scenario"),s=a?`
217
218
  ### Selected Scenario:
218
219
  ${a}
219
220
  `:"",c="";if(a){let l=a.toLowerCase();l.includes("debug")||l.includes("troubleshoot")||l.includes("bug")||/\bfix(ing|ed)?\b/.test(l)?c=`
@@ -230,7 +231,7 @@ You are selecting or executing a multi-skill workflow pipeline.
230
231
  ${s}${c}
231
232
  ## Available Workflow Pipelines
232
233
 
233
- The canonical published guide is available as the MCP resource \`${Ff}\`.
234
+ The canonical published guide is available as the MCP resource \`${Vf}\`.
234
235
 
235
236
  1. **New Feature Development:**
236
237
  \`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\`
@@ -244,7 +245,7 @@ The canonical published guide is available as the MCP resource \`${Ff}\`.
244
245
  4. **Legacy Codebase Safety Net:**
245
246
  \`brainstorming\` \u2794 \`writing-plans\` \u2794 \`test-driven-development\` (characterization tests) \u2794 \`systematic-debugging\` \u2794 \`verification-before-completion\`
246
247
 
247
- Use \`read_skill(skill_name)\` to inspect any skill before starting.`}}]}}throw new R(A.InvalidParams,`Unknown prompt: ${t}`)});pr.setRequestHandler(Pd,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"]}}]}));pr.setRequestHandler(Mo,async e=>{let{name:t,arguments:r}=e.params;if(t==="list_skills"){let n=await Jt.listSkills(),o=n.map(i=>`**${i.name}**
248
+ Use \`read_skill(skill_name)\` to inspect any skill before starting.`}}]}}throw new R(Z.InvalidParams,`Unknown prompt: ${t}`)});fr.setRequestHandler(Ed,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"]}}]}));fr.setRequestHandler(Fo,async e=>{let{name:t,arguments:r}=e.params;if(t==="list_skills"){let n=await Jt.listSkills(),o=n.map(i=>`**${i.name}**
248
249
  ${i.description}`).join(`
249
250
 
250
251
  ---
@@ -255,8 +256,8 @@ Use \`read_skill\` with the skill name to load its full content.
255
256
 
256
257
  ---
257
258
 
258
- ${o}`}]}}if(t==="read_skill"){let n=r,o=typeof n?.skill_name=="string"?j$(n.skill_name):void 0;if(!o)throw new R(A.InvalidParams,"skill_name is required");let i=await Jt.findSkill(o);if(!i)throw new R(A.InvalidParams,`Skill "${o}" not found. Use the list_skills tool to see available skills.`);try{let a=await Jt.readSkillContent(i.skillPath);return{content:[{type:"text",text:`# Skill: ${i.name}
259
+ ${o}`}]}}if(t==="read_skill"){let n=r,o=typeof n?.skill_name=="string"?T$(n.skill_name):void 0;if(!o)throw new R(Z.InvalidParams,"skill_name is required");let i=await Jt.findSkill(o);if(!i)throw new R(Z.InvalidParams,`Skill "${o}" not found. Use the list_skills tool to see available skills.`);try{let a=await Jt.readSkillContent(i.skillPath);return{content:[{type:"text",text:`# Skill: ${i.name}
259
260
 
260
261
  ${a}`}]}}catch(a){let s=a instanceof Error?a.message:String(a);throw process.stderr.write(`[superpowers-mcp] read_skill("${o}") failed: ${s}
261
- `),new R(A.InternalError,`Failed to read skill "${o}": ${s}`)}}throw new R(A.InvalidParams,`Unknown tool: ${t}`)});async function pT(){let e=process.argv.slice(2),t=e[0];if(t==="setup"||t==="--setup"){try{await b$(e)}catch(i){console.error("Setup failed:",i),process.exitCode=1}return}let r=new Ns;await pr.connect(r);let n=!1,o=async()=>{if(!n){n=!0;try{await pr.close()}catch{}process.exitCode=0}};process.on("SIGINT",o),process.on("SIGTERM",o)}pT().catch(e=>{process.stderr.write(`MCP Server fatal error: ${String(e)}
262
+ `),new R(Z.InternalError,`Failed to read skill "${o}": ${s}`)}}throw new R(Z.InvalidParams,`Unknown tool: ${t}`)});async function yT(){let e=process.argv.slice(2),t=e[0];if(t==="setup"||t==="--setup"){try{await k$(e)}catch(i){console.error("Setup failed:",i),process.exitCode=1}return}let r=new Rs;await fr.connect(r);let n=!1,o=async()=>{if(!n){n=!0;try{await fr.close()}catch{}process.exitCode=0}};process.on("SIGINT",o),process.on("SIGTERM",o)}yT().catch(e=>{process.stderr.write(`MCP Server fatal error: ${String(e)}
262
263
  `),process.exitCode=1});