superpowers-mcp 6.3.5 → 6.3.7

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.
Files changed (29) hide show
  1. package/README.ja.md +52 -56
  2. package/README.ko.md +52 -56
  3. package/README.md +52 -56
  4. package/README.zh-TW.md +52 -56
  5. package/out/server.js +46 -44
  6. package/out/setup-runner.js +15 -13
  7. package/out/setup.js +16 -14
  8. package/package.json +10 -5
  9. package/scripts/upstream-drift.js +346 -0
  10. package/skills/brainstorming/SKILL.md +125 -25
  11. package/skills/brainstorming/scripts/start-server.ps1 +20 -1
  12. package/skills/brainstorming/scripts/start-server.sh +2 -2
  13. package/skills/executing-plans/SKILL.md +7 -1
  14. package/skills/finishing-a-development-branch/SKILL.md +15 -0
  15. package/skills/subagent-driven-development/SKILL.md +121 -36
  16. package/skills/subagent-driven-development/implementer-prompt.md +19 -0
  17. package/skills/subagent-driven-development/re-review-prompt.md +10 -4
  18. package/skills/subagent-driven-development/scripts/review-package +6 -0
  19. package/skills/subagent-driven-development/scripts/review-package.ps1 +7 -0
  20. package/skills/subagent-driven-development/scripts/sdd-workspace +8 -1
  21. package/skills/subagent-driven-development/scripts/sdd-workspace.ps1 +23 -2
  22. package/skills/subagent-driven-development/task-reviewer-prompt.md +28 -10
  23. package/skills/systematic-debugging/SKILL.md +1 -1
  24. package/skills/test-driven-development/SKILL.md +27 -3
  25. package/skills/test-driven-development/writing-good-tests.md +7 -0
  26. package/skills/using-git-worktrees/SKILL.md +12 -0
  27. package/skills/verification-before-completion/SKILL.md +54 -1
  28. package/skills/writing-plans/SKILL.md +20 -5
  29. package/skills/writing-skills/SKILL.md +30 -0
package/out/server.js CHANGED
@@ -1,54 +1,56 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var f$=Object.create;var Es=Object.defineProperty;var m$=Object.getOwnPropertyDescriptor;var h$=Object.getOwnPropertyNames;var g$=Object.getPrototypeOf,v$=Object.prototype.hasOwnProperty;var z=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},zn=(e,t)=>{for(var r in t)Es(e,r,{get:t[r],enumerable:!0})},y$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of h$(t))!v$.call(e,o)&&o!==r&&Es(e,o,{get:()=>t[o],enumerable:!(n=m$(t,o))||n.enumerable});return e};var ft=(e,t,r)=>(r=e!=null?f$(g$(e)):{},y$(t||!e||!e.__esModule?Es(r,"default",{value:e,enumerable:!0}):r,e));var Ao=z(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.regexpCode=oe.getEsmExportName=oe.getProperty=oe.safeStringify=oe.stringify=oe.strConcat=oe.addCodeArg=oe.str=oe._=oe.nil=oe._Code=oe.Name=oe.IDENTIFIER=oe._CodeOrName=void 0;var Zo=class{};oe._CodeOrName=Zo;oe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var br=class extends Zo{constructor(t){if(super(),!oe.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};oe.Name=br;var st=class extends Zo{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof br&&(r[n.str]=(r[n.str]||0)+1),r),{})}};oe._Code=st;oe.nil=new st("");function tv(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Td(r,t[n]),r.push(e[++n]);return new st(r)}oe._=tv;var jd=new st("+");function rv(e,...t){let r=[Co(e[0])],n=0;for(;n<t.length;)r.push(jd),Td(r,t[n]),r.push(jd,Co(e[++n]));return tS(r),new st(r)}oe.str=rv;function Td(e,t){t instanceof st?e.push(...t._items):t instanceof br?e.push(t):e.push(oS(t))}oe.addCodeArg=Td;function tS(e){let t=1;for(;t<e.length-1;){if(e[t]===jd){let r=rS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function rS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof br||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof br))return`"${e}${t.slice(1)}`}function nS(e,t){return t.emptyStr()?e:e.emptyStr()?t:rv`${e}${t}`}oe.strConcat=nS;function oS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Co(Array.isArray(e)?e.join(","):e)}function iS(e){return new st(Co(e))}oe.stringify=iS;function Co(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}oe.safeStringify=Co;function aS(e){return typeof e=="string"&&oe.IDENTIFIER.test(e)?new st(`.${e}`):tv`[${e}]`}oe.getProperty=aS;function sS(e){if(typeof e=="string"&&oe.IDENTIFIER.test(e))return new st(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}oe.getEsmExportName=sS;function cS(e){return new st(e.toString())}oe.regexpCode=cS});var Dd=z(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.ValueScope=Ke.ValueScopeName=Ke.Scope=Ke.varKinds=Ke.UsedValueState=void 0;var Je=Ao(),Ed=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Aa;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Aa||(Ke.UsedValueState=Aa={}));Ke.varKinds={const:new Je.Name("const"),let:new Je.Name("let"),var:new Je.Name("var")};var Ua=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Je.Name?t:this.name(t)}name(t){return new Je.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}}};Ke.Scope=Ua;var Ma=class extends Je.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Je._)`.${new Je.Name(r)}[${n}]`}};Ke.ValueScopeName=Ma;var uS=(0,Je._)`\n`,Od=class extends Ua{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?uS:Je.nil}}get(){return this._scope}name(t){return new Ma(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,Je._)`${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=Je.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,Aa.Started);let l=r(u);if(l){let d=this.opts.es5?Ke.varKinds.var:Ke.varKinds.const;i=(0,Je._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Je._)`${i}${l}${this.opts._n}`;else throw new Ed(u);c.set(u,Aa.Completed)})}return i}};Ke.ValueScope=Od});var G=z(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.or=X.and=X.not=X.CodeGen=X.operators=X.varKinds=X.ValueScopeName=X.ValueScope=X.Scope=X.Name=X.regexpCode=X.stringify=X.getProperty=X.nil=X.strConcat=X.str=X._=void 0;var te=Ao(),vt=Dd(),rr=Ao();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return rr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return rr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return rr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return rr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return rr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return rr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return rr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return rr.Name}});var Va=Dd();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Va.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Va.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Va.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Va.varKinds}});X.operators={GT:new te._Code(">"),GTE:new te._Code(">="),LT:new te._Code("<"),LTE:new te._Code("<="),EQ:new te._Code("==="),NEQ:new te._Code("!=="),NOT:new te._Code("!"),OR:new te._Code("||"),AND:new te._Code("&&"),ADD:new te._Code("+")};var Ft=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Nd=class extends Ft{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?vt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=cn(this.rhs,t,r)),this}get names(){return this.rhs instanceof te._CodeOrName?this.rhs.names:{}}},Fa=class extends Ft{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof te.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=cn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof te.Name?{}:{...this.lhs.names};return La(t,this.rhs)}},Rd=class extends Fa{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Zd=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Cd=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Ad=class extends Ft{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Ud=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=cn(this.code,t,r),this}get names(){return this.code instanceof te._CodeOrName?this.code.names:{}}},Uo=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)||(lS(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>wr(t,r.names),{})}},qt=class extends Uo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Md=class extends Uo{},sn=class extends qt{};sn.kind="else";var xr=class e extends qt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new sn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(nv(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=cn(this.condition,t,r),this}get names(){let t=super.names;return La(t,this.condition),this.else&&wr(t,this.else.names),t}};xr.kind="if";var kr=class extends qt{};kr.kind="for";var Fd=class extends kr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=cn(this.iteration,t,r),this}get names(){return wr(super.names,this.iteration.names)}},qd=class extends kr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?vt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=La(super.names,this.from);return La(t,this.to)}},qa=class extends kr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=cn(this.iterable,t,r),this}get names(){return wr(super.names,this.iterable.names)}},Mo=class extends qt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Mo.kind="func";var Fo=class extends Uo{render(t){return"return "+super.render(t)}};Fo.kind="return";var Ld=class extends qt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&wr(t,this.catch.names),this.finally&&wr(t,this.finally.names),t}},qo=class extends qt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};qo.kind="catch";var Lo=class extends qt{render(t){return"finally"+super.render(t)}};Lo.kind="finally";var Vd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
- `:""},this._extScope=t,this._scope=new vt.Scope({parent:t}),this._nodes=[new Md]}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 Nd(t,i,n)),i}const(t,r,n){return this._def(vt.varKinds.const,t,r,n)}let(t,r,n){return this._def(vt.varKinds.let,t,r,n)}var(t,r,n){return this._def(vt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new Fa(t,r,n))}add(t,r){return this._leafNode(new Rd(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==te.nil&&this._leafNode(new Ud(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,te.addCodeArg)(r,o));return r.push("}"),new te._Code(r)}if(t,r,n){if(this._blockNode(new xr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new xr(t))}else(){return this._elseNode(new sn)}endIf(){return this._endBlockNode(xr,sn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Fd(t),r)}forRange(t,r,n,o,i=this.opts.es5?vt.varKinds.var:vt.varKinds.let){let a=this._scope.toName(t);return this._for(new qd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=vt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof te.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,te._)`${a}.length`,s=>{this.var(i,(0,te._)`${a}[${s}]`),n(i)})}return this._for(new qa("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?vt.varKinds.var:vt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,te._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new qa("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(kr)}label(t){return this._leafNode(new Zd(t))}break(t){return this._leafNode(new Cd(t))}return(t){let r=new Fo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Fo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Ld;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new qo(i),r(i)}return n&&(this._currNode=o.finally=new Lo,this.code(n)),this._endBlockNode(qo,Lo)}throw(t){return this._leafNode(new Ad(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=te.nil,n,o){return this._blockNode(new Mo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Mo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof xr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};X.CodeGen=Vd;function wr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function La(e,t){return t instanceof te._CodeOrName?wr(e,t.names):e}function cn(e,t,r){if(e instanceof te.Name)return n(e);if(!o(e))return e;return new te._Code(e._items.reduce((i,a)=>(a instanceof te.Name&&(a=n(a)),a instanceof te._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof te._Code&&i._items.some(a=>a instanceof te.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function lS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function nv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,te._)`!${Jd(e)}`}X.not=nv;var dS=ov(X.operators.AND);function pS(...e){return e.reduce(dS)}X.and=pS;var fS=ov(X.operators.OR);function mS(...e){return e.reduce(fS)}X.or=mS;function ov(e){return(t,r)=>t===te.nil?r:r===te.nil?t:(0,te._)`${Jd(t)} ${e} ${Jd(r)}`}function Jd(e){return e instanceof te.Name?e:(0,te._)`(${e})`}});var re=z(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;var pe=G(),hS=Ao();function gS(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=gS;function vS(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(sv(e,t),!cv(t,e.self.RULES.all))}Q.alwaysValidSchema=vS;function sv(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]||dv(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=sv;function cv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=cv;function yS(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=yS;function _S({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${e}${t}${(0,pe.getProperty)(n)}`}Q.schemaRefOrVal=_S;function $S(e){return uv(decodeURIComponent(e))}Q.unescapeFragment=$S;function bS(e){return encodeURIComponent(Hd(e))}Q.escapeFragment=bS;function Hd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Hd;function uv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=uv;function xS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=xS;function iv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof pe.Name?(i instanceof pe.Name?e(o,i,a):t(o,i,a),a):i instanceof pe.Name?(t(o,a,i),i):r(i,a);return s===pe.Name&&!(c instanceof pe.Name)?n(o,c):c}}Q.mergeEvaluated={props:iv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,pe._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,pe._)`${r} || {}`),Bd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:lv}),items:iv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,pe._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,pe._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function lv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,pe._)`{}`);return t!==void 0&&Bd(e,r,t),r}Q.evaluatedPropsToName=lv;function Bd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,pe._)`${t}${(0,pe.getProperty)(n)}`,!0))}Q.setEvaluated=Bd;var av={};function kS(e,t){return e.scopeValue("func",{ref:t,code:av[t.code]||(av[t.code]=new hS._Code(t.code))})}Q.useFunc=kS;var Kd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Kd||(Q.Type=Kd={}));function wS(e,t,r){if(e instanceof pe.Name){let n=t===Kd.Num;return r?n?(0,pe._)`"[" + ${e} + "]"`:(0,pe._)`"['" + ${e} + "']"`:n?(0,pe._)`"/" + ${e}`:(0,pe._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(e).toString():"/"+Hd(e)}Q.getErrorPath=wS;function dv(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=dv});var Lt=z(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var De=G(),SS={data:new De.Name("data"),valCxt:new De.Name("valCxt"),instancePath:new De.Name("instancePath"),parentData:new De.Name("parentData"),parentDataProperty:new De.Name("parentDataProperty"),rootData:new De.Name("rootData"),dynamicAnchors:new De.Name("dynamicAnchors"),vErrors:new De.Name("vErrors"),errors:new De.Name("errors"),this:new De.Name("this"),self:new De.Name("self"),scope:new De.Name("scope"),json:new De.Name("json"),jsonPos:new De.Name("jsonPos"),jsonLen:new De.Name("jsonLen"),jsonPart:new De.Name("jsonPart")};Gd.default=SS});var Vo=z(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.extendErrors=Ne.resetErrorsCount=Ne.reportExtraError=Ne.reportError=Ne.keyword$DataError=Ne.keywordError=void 0;var ne=G(),Ja=re(),qe=Lt();Ne.keywordError={message:({keyword:e})=>(0,ne.str)`must pass "${e}" keyword validation`};Ne.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ne.str)`"${e}" keyword must be ${t} ($data)`:(0,ne.str)`"${e}" keyword is invalid ($data)`};function zS(e,t=Ne.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=mv(e,t,r);n??(a||s)?pv(i,c):fv(o,(0,ne._)`[${c}]`)}Ne.reportError=zS;function IS(e,t=Ne.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=mv(e,t,r);pv(o,s),i||a||fv(n,qe.default.vErrors)}Ne.reportExtraError=IS;function PS(e,t){e.assign(qe.default.errors,t),e.if((0,ne._)`${qe.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ne._)`${qe.default.vErrors}.length`,t),()=>e.assign(qe.default.vErrors,null)))}Ne.resetErrorsCount=PS;function jS({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,qe.default.errors,s=>{e.const(a,(0,ne._)`${qe.default.vErrors}[${s}]`),e.if((0,ne._)`${a}.instancePath === undefined`,()=>e.assign((0,ne._)`${a}.instancePath`,(0,ne.strConcat)(qe.default.instancePath,i.errorPath))),e.assign((0,ne._)`${a}.schemaPath`,(0,ne.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,ne._)`${a}.schema`,r),e.assign((0,ne._)`${a}.data`,n))})}Ne.extendErrors=jS;function pv(e,t){let r=e.const("err",t);e.if((0,ne._)`${qe.default.vErrors} === null`,()=>e.assign(qe.default.vErrors,(0,ne._)`[${r}]`),(0,ne._)`${qe.default.vErrors}.push(${r})`),e.code((0,ne._)`${qe.default.errors}++`)}function fv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,ne._)`new ${e.ValidationError}(${t})`):(r.assign((0,ne._)`${n}.errors`,t),r.return(!1))}var Sr={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function mv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ne._)`{}`:TS(e,t,r)}function TS(e,t,r={}){let{gen:n,it:o}=e,i=[ES(o,r),OS(e,r)];return DS(e,t,i),n.object(...i)}function ES({errorPath:e},{instancePath:t}){let r=t?(0,ne.str)`${e}${(0,Ja.getErrorPath)(t,Ja.Type.Str)}`:e;return[qe.default.instancePath,(0,ne.strConcat)(qe.default.instancePath,r)]}function OS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,ne.str)`${t}/${e}`;return r&&(o=(0,ne.str)`${o}${(0,Ja.getErrorPath)(r,Ja.Type.Str)}`),[Sr.schemaPath,o]}function DS(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Sr.keyword,o],[Sr.params,typeof t=="function"?t(e):t||(0,ne._)`{}`]),c.messages&&n.push([Sr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Sr.schema,a],[Sr.parentSchema,(0,ne._)`${l}${d}`],[qe.default.data,i]),u&&n.push([Sr.propertyName,u])}});var gv=z(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.boolOrEmptySchema=un.topBoolOrEmptySchema=void 0;var NS=Vo(),RS=G(),ZS=Lt(),CS={message:"boolean schema is false"};function AS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?hv(e,!1):typeof r=="object"&&r.$async===!0?t.return(ZS.default.data):(t.assign((0,RS._)`${n}.errors`,null),t.return(!0))}un.topBoolOrEmptySchema=AS;function US(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),hv(e)):r.var(t,!0)}un.boolOrEmptySchema=US;function hv(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,NS.reportError)(o,CS,void 0,t)}});var Wd=z(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.getRules=ln.isJSONType=void 0;var MS=["string","number","integer","boolean","null","object","array"],FS=new Set(MS);function qS(e){return typeof e=="string"&&FS.has(e)}ln.isJSONType=qS;function LS(){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:{}}}ln.getRules=LS});var Xd=z(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function VS({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&vv(e,n)}nr.schemaHasRulesForType=VS;function vv(e,t){return t.rules.some(r=>yv(e,r))}nr.shouldUseGroup=vv;function yv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}nr.shouldUseRule=yv});var Jo=z(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var JS=Wd(),KS=Xd(),HS=Vo(),B=G(),_v=re(),dn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(dn||(Re.DataType=dn={}));function BS(e){let t=$v(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Re.getSchemaTypes=BS;function $v(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(JS.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Re.getJSONTypes=$v;function GS(e,t){let{gen:r,data:n,opts:o}=e,i=WS(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,KS.schemaHasRulesForType)(e,t[0]));if(a){let s=Qd(t,n,o.strictNumbers,dn.Wrong);r.if(s,()=>{i.length?XS(e,t,i):ep(e)})}return a}Re.coerceAndCheckDataType=GS;var bv=new Set(["string","number","integer","boolean","null"]);function WS(e,t){return t?e.filter(r=>bv.has(r)||t==="array"&&r==="array"):[]}function XS(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(Qd(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,B._)`${s} !== undefined`);for(let u of r)(bv.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ep(e),n.endIf(),n.if((0,B._)`${s} !== undefined`,()=>{n.assign(o,s),YS(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
2
+ "use strict";var g$=Object.create;var Es=Object.defineProperty;var v$=Object.getOwnPropertyDescriptor;var y$=Object.getOwnPropertyNames;var _$=Object.getPrototypeOf,$$=Object.prototype.hasOwnProperty;var z=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},In=(e,t)=>{for(var r in t)Es(e,r,{get:t[r],enumerable:!0})},b$=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of y$(t))!$$.call(e,o)&&o!==r&&Es(e,o,{get:()=>t[o],enumerable:!(n=v$(t,o))||n.enumerable});return e};var ft=(e,t,r)=>(r=e!=null?g$(_$(e)):{},b$(t||!e||!e.__esModule?Es(r,"default",{value:e,enumerable:!0}):r,e));var Uo=z(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.regexpCode=oe.getEsmExportName=oe.getProperty=oe.safeStringify=oe.stringify=oe.strConcat=oe.addCodeArg=oe.str=oe._=oe.nil=oe._Code=oe.Name=oe.IDENTIFIER=oe._CodeOrName=void 0;var Co=class{};oe._CodeOrName=Co;oe.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var br=class extends Co{constructor(t){if(super(),!oe.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};oe.Name=br;var st=class extends Co{constructor(t){super(),this._items=typeof t=="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>(n instanceof br&&(r[n.str]=(r[n.str]||0)+1),r),{})}};oe._Code=st;oe.nil=new st("");function tv(e,...t){let r=[e[0]],n=0;for(;n<t.length;)Td(r,t[n]),r.push(e[++n]);return new st(r)}oe._=tv;var jd=new st("+");function rv(e,...t){let r=[Ao(e[0])],n=0;for(;n<t.length;)r.push(jd),Td(r,t[n]),r.push(jd,Ao(e[++n]));return oS(r),new st(r)}oe.str=rv;function Td(e,t){t instanceof st?e.push(...t._items):t instanceof br?e.push(t):e.push(sS(t))}oe.addCodeArg=Td;function oS(e){let t=1;for(;t<e.length-1;){if(e[t]===jd){let r=iS(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}function iS(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string")return t instanceof br||e[e.length-1]!=='"'?void 0:typeof t!="string"?`${e.slice(0,-1)}${t}"`:t[0]==='"'?e.slice(0,-1)+t.slice(1):void 0;if(typeof t=="string"&&t[0]==='"'&&!(e instanceof br))return`"${e}${t.slice(1)}`}function aS(e,t){return t.emptyStr()?e:e.emptyStr()?t:rv`${e}${t}`}oe.strConcat=aS;function sS(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:Ao(Array.isArray(e)?e.join(","):e)}function cS(e){return new st(Ao(e))}oe.stringify=cS;function Ao(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}oe.safeStringify=Ao;function uS(e){return typeof e=="string"&&oe.IDENTIFIER.test(e)?new st(`.${e}`):tv`[${e}]`}oe.getProperty=uS;function lS(e){if(typeof e=="string"&&oe.IDENTIFIER.test(e))return new st(`${e}`);throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}oe.getEsmExportName=lS;function dS(e){return new st(e.toString())}oe.regexpCode=dS});var Dd=z(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.ValueScope=Ke.ValueScopeName=Ke.Scope=Ke.varKinds=Ke.UsedValueState=void 0;var Je=Uo(),Ed=class extends Error{constructor(t){super(`CodeGen: "code" for ${t} not defined`),this.value=t.value}},Ua;(function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"})(Ua||(Ke.UsedValueState=Ua={}));Ke.varKinds={const:new Je.Name("const"),let:new Je.Name("let"),var:new Je.Name("var")};var Ma=class{constructor({prefixes:t,parent:r}={}){this._names={},this._prefixes=t,this._parent=r}toName(t){return t instanceof Je.Name?t:this.name(t)}name(t){return new Je.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}}};Ke.Scope=Ma;var Fa=class extends Je.Name{constructor(t,r){super(r),this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t,this.scopePath=(0,Je._)`.${new Je.Name(r)}[${n}]`}};Ke.ValueScopeName=Fa;var pS=(0,Je._)`\n`,Od=class extends Ma{constructor(t){super(t),this._values={},this._scope=t.scope,this.opts={...t,_n:t.lines?pS:Je.nil}}get(){return this._scope}name(t){return new Fa(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,Je._)`${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=Je.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,Ua.Started);let l=r(u);if(l){let d=this.opts.es5?Ke.varKinds.var:Ke.varKinds.const;i=(0,Je._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Je._)`${i}${l}${this.opts._n}`;else throw new Ed(u);c.set(u,Ua.Completed)})}return i}};Ke.ValueScope=Od});var W=z(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.or=X.and=X.not=X.CodeGen=X.operators=X.varKinds=X.ValueScopeName=X.ValueScope=X.Scope=X.Name=X.regexpCode=X.stringify=X.getProperty=X.nil=X.strConcat=X.str=X._=void 0;var te=Uo(),vt=Dd(),rr=Uo();Object.defineProperty(X,"_",{enumerable:!0,get:function(){return rr._}});Object.defineProperty(X,"str",{enumerable:!0,get:function(){return rr.str}});Object.defineProperty(X,"strConcat",{enumerable:!0,get:function(){return rr.strConcat}});Object.defineProperty(X,"nil",{enumerable:!0,get:function(){return rr.nil}});Object.defineProperty(X,"getProperty",{enumerable:!0,get:function(){return rr.getProperty}});Object.defineProperty(X,"stringify",{enumerable:!0,get:function(){return rr.stringify}});Object.defineProperty(X,"regexpCode",{enumerable:!0,get:function(){return rr.regexpCode}});Object.defineProperty(X,"Name",{enumerable:!0,get:function(){return rr.Name}});var Ja=Dd();Object.defineProperty(X,"Scope",{enumerable:!0,get:function(){return Ja.Scope}});Object.defineProperty(X,"ValueScope",{enumerable:!0,get:function(){return Ja.ValueScope}});Object.defineProperty(X,"ValueScopeName",{enumerable:!0,get:function(){return Ja.ValueScopeName}});Object.defineProperty(X,"varKinds",{enumerable:!0,get:function(){return Ja.varKinds}});X.operators={GT:new te._Code(">"),GTE:new te._Code(">="),LT:new te._Code("<"),LTE:new te._Code("<="),EQ:new te._Code("==="),NEQ:new te._Code("!=="),NOT:new te._Code("!"),OR:new te._Code("||"),AND:new te._Code("&&"),ADD:new te._Code("+")};var Ft=class{optimizeNodes(){return this}optimizeNames(t,r){return this}},Nd=class extends Ft{constructor(t,r,n){super(),this.varKind=t,this.name=r,this.rhs=n}render({es5:t,_n:r}){let n=t?vt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(t,r){if(t[this.name.str])return this.rhs&&(this.rhs=cn(this.rhs,t,r)),this}get names(){return this.rhs instanceof te._CodeOrName?this.rhs.names:{}}},qa=class extends Ft{constructor(t,r,n){super(),this.lhs=t,this.rhs=r,this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(!(this.lhs instanceof te.Name&&!t[this.lhs.str]&&!this.sideEffects))return this.rhs=cn(this.rhs,t,r),this}get names(){let t=this.lhs instanceof te.Name?{}:{...this.lhs.names};return Va(t,this.rhs)}},Rd=class extends qa{constructor(t,r,n,o){super(t,n,o),this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}},Zd=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`${this.label}:`+t}},Cd=class extends Ft{constructor(t){super(),this.label=t,this.names={}}render({_n:t}){return`break${this.label?` ${this.label}`:""};`+t}},Ad=class extends Ft{constructor(t){super(),this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}},Ud=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=cn(this.code,t,r),this}get names(){return this.code instanceof te._CodeOrName?this.code.names:{}}},Mo=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)||(fS(t,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>wr(t,r.names),{})}},qt=class extends Mo{render(t){return"{"+t._n+super.render(t)+"}"+t._n}},Md=class extends Mo{},sn=class extends qt{};sn.kind="else";var xr=class e extends qt{constructor(t,r){super(r),this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);return this.else&&(r+="else "+this.else.render(t)),r}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new sn(n):n}if(r)return t===!1?r instanceof e?r:r.nodes:this.nodes.length?this:new e(nv(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=cn(this.condition,t,r),this}get names(){let t=super.names;return Va(t,this.condition),this.else&&wr(t,this.else.names),t}};xr.kind="if";var kr=class extends qt{};kr.kind="for";var Fd=class extends kr{constructor(t){super(),this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iteration=cn(this.iteration,t,r),this}get names(){return wr(super.names,this.iteration.names)}},qd=class extends kr{constructor(t,r,n,o){super(),this.varKind=t,this.name=r,this.from=n,this.to=o}render(t){let r=t.es5?vt.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(t)}get names(){let t=Va(super.names,this.from);return Va(t,this.to)}},La=class extends kr{constructor(t,r,n,o){super(),this.loop=t,this.varKind=r,this.name=n,this.iterable=o}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(super.optimizeNames(t,r))return this.iterable=cn(this.iterable,t,r),this}get names(){return wr(super.names,this.iterable.names)}},Fo=class extends qt{constructor(t,r,n){super(),this.name=t,this.args=r,this.async=n}render(t){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(t)}};Fo.kind="func";var qo=class extends Mo{render(t){return"return "+super.render(t)}};qo.kind="return";var Ld=class extends qt{render(t){let r="try"+super.render(t);return this.catch&&(r+=this.catch.render(t)),this.finally&&(r+=this.finally.render(t)),r}optimizeNodes(){var t,r;return super.optimizeNodes(),(t=this.catch)===null||t===void 0||t.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(t,r){var n,o;return super.optimizeNames(t,r),(n=this.catch)===null||n===void 0||n.optimizeNames(t,r),(o=this.finally)===null||o===void 0||o.optimizeNames(t,r),this}get names(){let t=super.names;return this.catch&&wr(t,this.catch.names),this.finally&&wr(t,this.finally.names),t}},Lo=class extends qt{constructor(t){super(),this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};Lo.kind="catch";var Vo=class extends qt{render(t){return"finally"+super.render(t)}};Vo.kind="finally";var Vd=class{constructor(t,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
3
+ `:""},this._extScope=t,this._scope=new vt.Scope({parent:t}),this._nodes=[new Md]}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 Nd(t,i,n)),i}const(t,r,n){return this._def(vt.varKinds.const,t,r,n)}let(t,r,n){return this._def(vt.varKinds.let,t,r,n)}var(t,r,n){return this._def(vt.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new qa(t,r,n))}add(t,r){return this._leafNode(new Rd(t,X.operators.ADD,r))}code(t){return typeof t=="function"?t():t!==te.nil&&this._leafNode(new Ud(t)),this}object(...t){let r=["{"];for(let[n,o]of t)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,te.addCodeArg)(r,o));return r.push("}"),new te._Code(r)}if(t,r,n){if(this._blockNode(new xr(t)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(t){return this._elseNode(new xr(t))}else(){return this._elseNode(new sn)}endIf(){return this._endBlockNode(xr,sn)}_for(t,r){return this._blockNode(t),r&&this.code(r).endFor(),this}for(t,r){return this._for(new Fd(t),r)}forRange(t,r,n,o,i=this.opts.es5?vt.varKinds.var:vt.varKinds.let){let a=this._scope.toName(t);return this._for(new qd(i,a,r,n),()=>o(a))}forOf(t,r,n,o=vt.varKinds.const){let i=this._scope.toName(t);if(this.opts.es5){let a=r instanceof te.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,te._)`${a}.length`,s=>{this.var(i,(0,te._)`${a}[${s}]`),n(i)})}return this._for(new La("of",o,i,r),()=>n(i))}forIn(t,r,n,o=this.opts.es5?vt.varKinds.var:vt.varKinds.const){if(this.opts.ownProperties)return this.forOf(t,(0,te._)`Object.keys(${r})`,n);let i=this._scope.toName(t);return this._for(new La("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(kr)}label(t){return this._leafNode(new Zd(t))}break(t){return this._leafNode(new Cd(t))}return(t){let r=new qo;if(this._blockNode(r),this.code(t),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(qo)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Ld;if(this._blockNode(o),this.code(t),r){let i=this.name("e");this._currNode=o.catch=new Lo(i),r(i)}return n&&(this._currNode=o.finally=new Vo,this.code(n)),this._endBlockNode(Lo,Vo)}throw(t){return this._leafNode(new Ad(t))}block(t,r){return this._blockStarts.push(this._nodes.length),t&&this.code(t).endBlock(r),this}endBlock(t){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`);return this._nodes.length=r,this}func(t,r=te.nil,n,o){return this._blockNode(new Fo(t,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Fo)}optimize(t=1){for(;t-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(t){return this._currNode.nodes.push(t),this}_blockNode(t){this._currNode.nodes.push(t),this._nodes.push(t)}_endBlockNode(t,r){let n=this._currNode;if(n instanceof t||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){let r=this._currNode;if(!(r instanceof xr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=t,this}get _root(){return this._nodes[0]}get _currNode(){let t=this._nodes;return t[t.length-1]}set _currNode(t){let r=this._nodes;r[r.length-1]=t}};X.CodeGen=Vd;function wr(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function Va(e,t){return t instanceof te._CodeOrName?wr(e,t.names):e}function cn(e,t,r){if(e instanceof te.Name)return n(e);if(!o(e))return e;return new te._Code(e._items.reduce((i,a)=>(a instanceof te.Name&&(a=n(a)),a instanceof te._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||t[i.str]!==1?i:(delete t[i.str],a)}function o(i){return i instanceof te._Code&&i._items.some(a=>a instanceof te.Name&&t[a.str]===1&&r[a.str]!==void 0)}}function fS(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}function nv(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,te._)`!${Jd(e)}`}X.not=nv;var mS=ov(X.operators.AND);function hS(...e){return e.reduce(mS)}X.and=hS;var gS=ov(X.operators.OR);function vS(...e){return e.reduce(gS)}X.or=vS;function ov(e){return(t,r)=>t===te.nil?r:r===te.nil?t:(0,te._)`${Jd(t)} ${e} ${Jd(r)}`}function Jd(e){return e instanceof te.Name?e:(0,te._)`(${e})`}});var re=z(Q=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.checkStrictMode=Q.getErrorPath=Q.Type=Q.useFunc=Q.setEvaluated=Q.evaluatedPropsToName=Q.mergeEvaluated=Q.eachItem=Q.unescapeJsonPointer=Q.escapeJsonPointer=Q.escapeFragment=Q.unescapeFragment=Q.schemaRefOrVal=Q.schemaHasRulesButRef=Q.schemaHasRules=Q.checkUnknownRules=Q.alwaysValidSchema=Q.toHash=void 0;var pe=W(),yS=Uo();function _S(e){let t={};for(let r of e)t[r]=!0;return t}Q.toHash=_S;function $S(e,t){return typeof t=="boolean"?t:Object.keys(t).length===0?!0:(sv(e,t),!cv(t,e.self.RULES.all))}Q.alwaysValidSchema=$S;function sv(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]||dv(e,`unknown keyword: "${i}"`)}Q.checkUnknownRules=sv;function cv(e,t){if(typeof e=="boolean")return!e;for(let r in e)if(t[r])return!0;return!1}Q.schemaHasRules=cv;function bS(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=bS;function xS({topSchemaRef:e,schemaPath:t},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,pe._)`${r}`}return(0,pe._)`${e}${t}${(0,pe.getProperty)(n)}`}Q.schemaRefOrVal=xS;function kS(e){return uv(decodeURIComponent(e))}Q.unescapeFragment=kS;function wS(e){return encodeURIComponent(Hd(e))}Q.escapeFragment=wS;function Hd(e){return typeof e=="number"?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}Q.escapeJsonPointer=Hd;function uv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Q.unescapeJsonPointer=uv;function SS(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)}Q.eachItem=SS;function iv({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof pe.Name?(i instanceof pe.Name?e(o,i,a):t(o,i,a),a):i instanceof pe.Name?(t(o,a,i),i):r(i,a);return s===pe.Name&&!(c instanceof pe.Name)?n(o,c):c}}Q.mergeEvaluated={props:iv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,pe._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,pe._)`${r} || {}`).code((0,pe._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>{t===!0?e.assign(r,!0):(e.assign(r,(0,pe._)`${r} || {}`),Bd(e,r,t))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:lv}),items:iv({mergeNames:(e,t,r)=>e.if((0,pe._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,pe._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,pe._)`${r} !== true`,()=>e.assign(r,t===!0?!0:(0,pe._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function lv(e,t){if(t===!0)return e.var("props",!0);let r=e.var("props",(0,pe._)`{}`);return t!==void 0&&Bd(e,r,t),r}Q.evaluatedPropsToName=lv;function Bd(e,t,r){Object.keys(r).forEach(n=>e.assign((0,pe._)`${t}${(0,pe.getProperty)(n)}`,!0))}Q.setEvaluated=Bd;var av={};function zS(e,t){return e.scopeValue("func",{ref:t,code:av[t.code]||(av[t.code]=new yS._Code(t.code))})}Q.useFunc=zS;var Kd;(function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"})(Kd||(Q.Type=Kd={}));function IS(e,t,r){if(e instanceof pe.Name){let n=t===Kd.Num;return r?n?(0,pe._)`"[" + ${e} + "]"`:(0,pe._)`"['" + ${e} + "']"`:n?(0,pe._)`"/" + ${e}`:(0,pe._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,pe.getProperty)(e).toString():"/"+Hd(e)}Q.getErrorPath=IS;function dv(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=dv});var Lt=z(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});var De=W(),PS={data:new De.Name("data"),valCxt:new De.Name("valCxt"),instancePath:new De.Name("instancePath"),parentData:new De.Name("parentData"),parentDataProperty:new De.Name("parentDataProperty"),rootData:new De.Name("rootData"),dynamicAnchors:new De.Name("dynamicAnchors"),vErrors:new De.Name("vErrors"),errors:new De.Name("errors"),this:new De.Name("this"),self:new De.Name("self"),scope:new De.Name("scope"),json:new De.Name("json"),jsonPos:new De.Name("jsonPos"),jsonLen:new De.Name("jsonLen"),jsonPart:new De.Name("jsonPart")};Wd.default=PS});var Jo=z(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.extendErrors=Ne.resetErrorsCount=Ne.reportExtraError=Ne.reportError=Ne.keyword$DataError=Ne.keywordError=void 0;var ne=W(),Ka=re(),qe=Lt();Ne.keywordError={message:({keyword:e})=>(0,ne.str)`must pass "${e}" keyword validation`};Ne.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,ne.str)`"${e}" keyword must be ${t} ($data)`:(0,ne.str)`"${e}" keyword is invalid ($data)`};function jS(e,t=Ne.keywordError,r,n){let{it:o}=e,{gen:i,compositeRule:a,allErrors:s}=o,c=mv(e,t,r);n??(a||s)?pv(i,c):fv(o,(0,ne._)`[${c}]`)}Ne.reportError=jS;function TS(e,t=Ne.keywordError,r){let{it:n}=e,{gen:o,compositeRule:i,allErrors:a}=n,s=mv(e,t,r);pv(o,s),i||a||fv(n,qe.default.vErrors)}Ne.reportExtraError=TS;function ES(e,t){e.assign(qe.default.errors,t),e.if((0,ne._)`${qe.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,ne._)`${qe.default.vErrors}.length`,t),()=>e.assign(qe.default.vErrors,null)))}Ne.resetErrorsCount=ES;function OS({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,qe.default.errors,s=>{e.const(a,(0,ne._)`${qe.default.vErrors}[${s}]`),e.if((0,ne._)`${a}.instancePath === undefined`,()=>e.assign((0,ne._)`${a}.instancePath`,(0,ne.strConcat)(qe.default.instancePath,i.errorPath))),e.assign((0,ne._)`${a}.schemaPath`,(0,ne.str)`${i.errSchemaPath}/${t}`),i.opts.verbose&&(e.assign((0,ne._)`${a}.schema`,r),e.assign((0,ne._)`${a}.data`,n))})}Ne.extendErrors=OS;function pv(e,t){let r=e.const("err",t);e.if((0,ne._)`${qe.default.vErrors} === null`,()=>e.assign(qe.default.vErrors,(0,ne._)`[${r}]`),(0,ne._)`${qe.default.vErrors}.push(${r})`),e.code((0,ne._)`${qe.default.errors}++`)}function fv(e,t){let{gen:r,validateName:n,schemaEnv:o}=e;o.$async?r.throw((0,ne._)`new ${e.ValidationError}(${t})`):(r.assign((0,ne._)`${n}.errors`,t),r.return(!1))}var Sr={keyword:new ne.Name("keyword"),schemaPath:new ne.Name("schemaPath"),params:new ne.Name("params"),propertyName:new ne.Name("propertyName"),message:new ne.Name("message"),schema:new ne.Name("schema"),parentSchema:new ne.Name("parentSchema")};function mv(e,t,r){let{createErrors:n}=e.it;return n===!1?(0,ne._)`{}`:DS(e,t,r)}function DS(e,t,r={}){let{gen:n,it:o}=e,i=[NS(o,r),RS(e,r)];return ZS(e,t,i),n.object(...i)}function NS({errorPath:e},{instancePath:t}){let r=t?(0,ne.str)`${e}${(0,Ka.getErrorPath)(t,Ka.Type.Str)}`:e;return[qe.default.instancePath,(0,ne.strConcat)(qe.default.instancePath,r)]}function RS({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let o=n?t:(0,ne.str)`${t}/${e}`;return r&&(o=(0,ne.str)`${o}${(0,Ka.getErrorPath)(r,Ka.Type.Str)}`),[Sr.schemaPath,o]}function ZS(e,{params:t,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=e,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([Sr.keyword,o],[Sr.params,typeof t=="function"?t(e):t||(0,ne._)`{}`]),c.messages&&n.push([Sr.message,typeof r=="function"?r(e):r]),c.verbose&&n.push([Sr.schema,a],[Sr.parentSchema,(0,ne._)`${l}${d}`],[qe.default.data,i]),u&&n.push([Sr.propertyName,u])}});var gv=z(un=>{"use strict";Object.defineProperty(un,"__esModule",{value:!0});un.boolOrEmptySchema=un.topBoolOrEmptySchema=void 0;var CS=Jo(),AS=W(),US=Lt(),MS={message:"boolean schema is false"};function FS(e){let{gen:t,schema:r,validateName:n}=e;r===!1?hv(e,!1):typeof r=="object"&&r.$async===!0?t.return(US.default.data):(t.assign((0,AS._)`${n}.errors`,null),t.return(!0))}un.topBoolOrEmptySchema=FS;function qS(e,t){let{gen:r,schema:n}=e;n===!1?(r.var(t,!1),hv(e)):r.var(t,!0)}un.boolOrEmptySchema=qS;function hv(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,CS.reportError)(o,MS,void 0,t)}});var Gd=z(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.getRules=ln.isJSONType=void 0;var LS=["string","number","integer","boolean","null","object","array"],VS=new Set(LS);function JS(e){return typeof e=="string"&&VS.has(e)}ln.isJSONType=JS;function KS(){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:{}}}ln.getRules=KS});var Xd=z(nr=>{"use strict";Object.defineProperty(nr,"__esModule",{value:!0});nr.shouldUseRule=nr.shouldUseGroup=nr.schemaHasRulesForType=void 0;function HS({schema:e,self:t},r){let n=t.RULES.types[r];return n&&n!==!0&&vv(e,n)}nr.schemaHasRulesForType=HS;function vv(e,t){return t.rules.some(r=>yv(e,r))}nr.shouldUseGroup=vv;function yv(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}nr.shouldUseRule=yv});var Ko=z(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.reportTypeError=Re.checkDataTypes=Re.checkDataType=Re.coerceAndCheckDataType=Re.getJSONTypes=Re.getSchemaTypes=Re.DataType=void 0;var BS=Gd(),WS=Xd(),GS=Jo(),B=W(),_v=re(),dn;(function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"})(dn||(Re.DataType=dn={}));function XS(e){let t=$v(e.type);if(t.includes("null")){if(e.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');e.nullable===!0&&t.push("null")}return t}Re.getSchemaTypes=XS;function $v(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(BS.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}Re.getJSONTypes=$v;function YS(e,t){let{gen:r,data:n,opts:o}=e,i=QS(t,o.coerceTypes),a=t.length>0&&!(i.length===0&&t.length===1&&(0,WS.schemaHasRulesForType)(e,t[0]));if(a){let s=Qd(t,n,o.strictNumbers,dn.Wrong);r.if(s,()=>{i.length?e0(e,t,i):ep(e)})}return a}Re.coerceAndCheckDataType=YS;var bv=new Set(["string","number","integer","boolean","null"]);function QS(e,t){return t?e.filter(r=>bv.has(r)||t==="array"&&r==="array"):[]}function e0(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(Qd(t,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,B._)`${s} !== undefined`);for(let u of r)(bv.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),ep(e),n.endIf(),n.if((0,B._)`${s} !== undefined`,()=>{n.assign(o,s),t0(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
4
  || (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,B._)`+${o}`);return;case"integer":n.elseIf((0,B._)`${a} === "boolean" || ${o} === null
5
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 YS({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,B._)`${t} !== undefined`,()=>e.assign((0,B._)`${t}[${r}]`,n))}function Yd(e,t,r,n=dn.Correct){let o=n===dn.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===dn.Correct?i:(0,B.not)(i);function a(s=B.nil){return(0,B.and)((0,B._)`typeof ${t} == "number"`,s,r?(0,B._)`isFinite(${t})`:B.nil)}}Re.checkDataType=Yd;function Qd(e,t,r,n){if(e.length===1)return Yd(e[0],t,r,n);let o,i=(0,_v.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,Yd(a,t,r,n));return o}Re.checkDataTypes=Qd;var QS={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,B._)`{type: ${e}}`:(0,B._)`{type: ${t}}`};function ep(e){let t=e0(e);(0,HS.reportError)(t,QS)}Re.reportTypeError=ep;function e0(e){let{gen:t,data:r,schema:n}=e,o=(0,_v.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var kv=z(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});Ka.assignDefaults=void 0;var pn=G(),t0=re();function r0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)xv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>xv(e,i,o.default))}Ka.assignDefaults=r0;function xv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,pn._)`${i}${(0,pn.getProperty)(t)}`;if(o){(0,t0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,pn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,pn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,pn._)`${s} = ${(0,pn.stringify)(r)}`)}});var ct=z(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.validateUnion=ce.validateArray=ce.usePattern=ce.callValidateCode=ce.schemaProperties=ce.allSchemaProperties=ce.noPropertyInData=ce.propertyInData=ce.isOwnProperty=ce.hasPropFunc=ce.reportMissingProp=ce.checkMissingProp=ce.checkReportMissingProp=void 0;var ge=G(),tp=re(),or=Lt(),n0=re();function o0(e,t){let{gen:r,data:n,it:o}=e;r.if(np(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ge._)`${t}`},!0),e.error()})}ce.checkReportMissingProp=o0;function i0({gen:e,data:t,it:{opts:r}},n,o){return(0,ge.or)(...n.map(i=>(0,ge.and)(np(e,t,i,r.ownProperties),(0,ge._)`${o} = ${i}`)))}ce.checkMissingProp=i0;function a0(e,t){e.setParams({missingProperty:t},!0),e.error()}ce.reportMissingProp=a0;function wv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ge._)`Object.prototype.hasOwnProperty`})}ce.hasPropFunc=wv;function rp(e,t,r){return(0,ge._)`${wv(e)}.call(${t}, ${r})`}ce.isOwnProperty=rp;function s0(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} !== undefined`;return n?(0,ge._)`${o} && ${rp(e,t,r)}`:o}ce.propertyInData=s0;function np(e,t,r,n){let o=(0,ge._)`${t}${(0,ge.getProperty)(r)} === undefined`;return n?(0,ge.or)(o,(0,ge.not)(rp(e,t,r))):o}ce.noPropertyInData=np;function Sv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ce.allSchemaProperties=Sv;function c0(e,t){return Sv(t).filter(r=>!(0,tp.alwaysValidSchema)(e,t[r]))}ce.schemaProperties=c0;function u0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ge._)`${e}, ${t}, ${n}${o}`:t,d=[[or.default.instancePath,(0,ge.strConcat)(or.default.instancePath,i)],[or.default.parentData,a.parentData],[or.default.parentDataProperty,a.parentDataProperty],[or.default.rootData,or.default.rootData]];a.opts.dynamicRef&&d.push([or.default.dynamicAnchors,or.default.dynamicAnchors]);let f=(0,ge._)`${l}, ${r.object(...d)}`;return c!==ge.nil?(0,ge._)`${s}.call(${c}, ${f})`:(0,ge._)`${s}(${f})`}ce.callValidateCode=u0;var l0=(0,ge._)`new RegExp`;function d0({gen:e,it:{opts:t}},r){let n=t.unicodeRegExp?"u":"",{regExp:o}=t.code,i=o(r,n);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,ge._)`${o.code==="new RegExp"?l0:(0,n0.useFunc)(e,o)}(${r}, ${n})`})}ce.usePattern=d0;function p0(e){let{gen:t,data:r,keyword:n,it:o}=e,i=t.name("valid");if(o.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",(0,ge._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:tp.Type.Num},i),t.if((0,ge.not)(i),s)})}}ce.validateArray=p0;function f0(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,tp.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let l=e.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);t.assign(a,(0,ge._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ge.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ce.validateUnion=f0});var Pv=z(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateKeywordUsage=St.validSchemaType=St.funcKeywordCode=St.macroKeywordCode=void 0;var Le=G(),zr=Lt(),m0=ct(),h0=Vo();function g0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=Iv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Le.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}St.macroKeywordCode=g0;function v0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;_0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=Iv(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)g(),t.modifying&&zv(e),y(()=>e.error());else{let $=t.async?p():h();t.modifying&&zv(e),y(()=>y0(e,$))}}function p(){let $=n.let("ruleErrs",null);return n.try(()=>g((0,Le._)`await `),k=>n.assign(d,!1).if((0,Le._)`${k} instanceof ${c.ValidationError}`,()=>n.assign($,(0,Le._)`${k}.errors`),()=>n.throw(k))),$}function h(){let $=(0,Le._)`${l}.errors`;return n.assign($,null),g(Le.nil),$}function g($=t.async?(0,Le._)`await `:Le.nil){let k=c.opts.passContext?zr.default.this:zr.default.self,x=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Le._)`${$}${(0,m0.callValidateCode)(e,l,k,x)}`,t.modifying)}function y($){var k;n.if((0,Le.not)((k=t.valid)!==null&&k!==void 0?k:d),$)}}St.funcKeywordCode=v0;function zv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Le._)`${n.parentData}[${n.parentDataProperty}]`))}function y0(e,t){let{gen:r}=e;r.if((0,Le._)`Array.isArray(${t})`,()=>{r.assign(zr.default.vErrors,(0,Le._)`${zr.default.vErrors} === null ? ${t} : ${zr.default.vErrors}.concat(${t})`).assign(zr.default.errors,(0,Le._)`${zr.default.vErrors}.length`),(0,h0.extendErrors)(e)},()=>e.error())}function _0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Iv(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,Le.stringify)(r)})}function $0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}St.validSchemaType=$0;function b0({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}St.validateKeywordUsage=b0});var Tv=z(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.extendSubschemaMode=ir.extendSubschemaData=ir.getSubschema=void 0;var zt=G(),jv=re();function x0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}${(0,zt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,jv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}ir.getSubschema=x0;function k0(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,zt._)`${t.data}${(0,zt.getProperty)(r)}`,!0);c(f),e.errorPath=(0,zt.str)`${u}${(0,jv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,zt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof zt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}ir.extendSubschemaData=k0;function w0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}ir.extendSubschemaMode=w0});var op=z((mA,Ev)=>{"use strict";Ev.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 Dv=z((hA,Ov)=>{"use strict";var ar=Ov.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(){};Ha(t,n,o,e,"",e)};ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ar.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ar.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Ha(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ar.arrayKeywords)for(var f=0;f<d.length;f++)Ha(e,t,r,d[f],o+"/"+l+"/"+f,i,o,l,n,f)}else if(l in ar.propsKeywords){if(d&&typeof d=="object")for(var p in d)Ha(e,t,r,d[p],o+"/"+l+"/"+S0(p),i,o,l,n,p)}else(l in ar.keywords||e.allKeys&&!(l in ar.skipKeywords))&&Ha(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function S0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ko=z(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.getSchemaRefs=He.resolveUrl=He.normalizeId=He._getFullPath=He.getFullPath=He.inlineRef=void 0;var z0=re(),I0=op(),P0=Dv(),j0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function T0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ip(e):t?Nv(e)<=t:!1}He.inlineRef=T0;var E0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ip(e){for(let t in e){if(E0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(ip)||typeof r=="object"&&ip(r))return!0}return!1}function Nv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!j0.has(r)&&(typeof e[r]=="object"&&(0,z0.eachItem)(e[r],n=>t+=Nv(n)),t===1/0))return 1/0}return t}function Rv(e,t="",r){r!==!1&&(t=fn(t));let n=e.parse(t);return Zv(e,n)}He.getFullPath=Rv;function Zv(e,t){return e.serialize(t).split("#")[0]+"#"}He._getFullPath=Zv;var O0=/#\/?$/;function fn(e){return e?e.replace(O0,""):""}He.normalizeId=fn;function D0(e,t,r){return r=fn(r),e.resolve(t,r)}He.resolveUrl=D0;var N0=/^[a-z_][-a-z0-9._]*$/i;function R0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=fn(e[r]||t),i={"":o},a=Rv(n,o,!1),s={},c=new Set;return P0(e,{allKeys:!0},(d,f,p,h)=>{if(h===void 0)return;let g=a+f,y=i[h];typeof d[r]=="string"&&(y=$.call(this,d[r])),k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),i[f]=y;function $(x){let D=this.opts.uriResolver.resolve;if(x=fn(y?D(y,x):x),c.has(x))throw l(x);c.add(x);let O=this.refs[x];return typeof O=="string"&&(O=this.refs[O]),typeof O=="object"?u(d,O.schema,x):x!==fn(g)&&(x[0]==="#"?(u(d,s[x],x),s[x]=d):this.refs[x]=g),x}function k(x){if(typeof x=="string"){if(!N0.test(x))throw new Error(`invalid anchor "${x}"`);$.call(this,`#${x}`)}}}),s;function u(d,f,p){if(f!==void 0&&!I0(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}He.getSchemaRefs=R0});var Go=z(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.getData=sr.KeywordCxt=sr.validateFunctionCode=void 0;var Fv=gv(),Cv=Jo(),sp=Xd(),Ba=Jo(),Z0=kv(),Bo=Pv(),ap=Tv(),E=G(),q=Lt(),C0=Ko(),Vt=re(),Ho=Vo();function A0(e){if(Vv(e)&&(Jv(e),Lv(e))){F0(e);return}qv(e,()=>(0,Fv.topBoolOrEmptySchema)(e))}sr.validateFunctionCode=A0;function qv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,E._)`${q.default.data}, ${q.default.valCxt}`,n.$async,()=>{e.code((0,E._)`"use strict"; ${Av(r,o)}`),M0(e,o),e.code(i)}):e.func(t,(0,E._)`${q.default.data}, ${U0(o)}`,n.$async,()=>e.code(Av(r,o)).code(i))}function U0(e){return(0,E._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${e.dynamicRef?(0,E._)`, ${q.default.dynamicAnchors}={}`:E.nil}}={}`}function M0(e,t){e.if(q.default.valCxt,()=>{e.var(q.default.instancePath,(0,E._)`${q.default.valCxt}.${q.default.instancePath}`),e.var(q.default.parentData,(0,E._)`${q.default.valCxt}.${q.default.parentData}`),e.var(q.default.parentDataProperty,(0,E._)`${q.default.valCxt}.${q.default.parentDataProperty}`),e.var(q.default.rootData,(0,E._)`${q.default.valCxt}.${q.default.rootData}`),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,E._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{e.var(q.default.instancePath,(0,E._)`""`),e.var(q.default.parentData,(0,E._)`undefined`),e.var(q.default.parentDataProperty,(0,E._)`undefined`),e.var(q.default.rootData,q.default.data),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,E._)`{}`)})}function F0(e){let{schema:t,opts:r,gen:n}=e;qv(e,()=>{r.$comment&&t.$comment&&Hv(e),K0(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&q0(e),Kv(e),G0(e)})}function q0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,E._)`${r}.evaluated`),t.if((0,E._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,E._)`${e.evaluated}.props`,(0,E._)`undefined`)),t.if((0,E._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,E._)`${e.evaluated}.items`,(0,E._)`undefined`))}function Av(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,E._)`/*# sourceURL=${r} */`:E.nil}function L0(e,t){if(Vv(e)&&(Jv(e),Lv(e))){V0(e,t);return}(0,Fv.boolOrEmptySchema)(e,t)}function Lv({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 Vv(e){return typeof e.schema!="boolean"}function V0(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Hv(e),H0(e),B0(e);let i=n.const("_errs",q.default.errors);Kv(e,i),n.var(t,(0,E._)`${i} === ${q.default.errors}`)}function Jv(e){(0,Vt.checkUnknownRules)(e),J0(e)}function Kv(e,t){if(e.opts.jtd)return Uv(e,[],!1,t);let r=(0,Cv.getSchemaTypes)(e.schema),n=(0,Cv.coerceAndCheckDataType)(e,r);Uv(e,r,!n,t)}function J0(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 K0(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 H0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,C0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function B0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Hv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,E._)`${q.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,E.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,E._)`${q.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function G0(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,E._)`${q.default.errors} === 0`,()=>t.return(q.default.data),()=>t.throw((0,E._)`new ${o}(${q.default.vErrors})`)):(t.assign((0,E._)`${n}.errors`,q.default.vErrors),i.unevaluated&&W0(e),t.return((0,E._)`${q.default.errors} === 0`))}function W0({gen:e,evaluated:t,props:r,items:n}){r instanceof E.Name&&e.assign((0,E._)`${t}.props`,r),n instanceof E.Name&&e.assign((0,E._)`${t}.items`,n)}function Uv(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(()=>Gv(e,"$ref",l.all.$ref.definition));return}c.jtd||X0(e,t),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,sp.shouldUseGroup)(i,f)&&(f.type?(o.if((0,Ba.checkDataType)(f.type,a,c.strictNumbers)),Mv(e,f),t.length===1&&t[0]===f.type&&r&&(o.else(),(0,Ba.reportTypeError)(e)),o.endIf()):Mv(e,f),s||o.if((0,E._)`${q.default.errors} === ${n||0}`))}}function Mv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,Z0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,sp.shouldUseRule)(n,i)&&Gv(e,i.keyword,i.definition,t.type)})}function X0(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(Y0(e,t),e.opts.allowUnionTypes||Q0(e,t),ez(e,e.dataTypes))}function Y0(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Bv(e.dataTypes,r)||cp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),rz(e,t)}}function Q0(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&cp(e,"use allowUnionTypes to allow union type keyword")}function ez(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,sp.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>tz(t,a))&&cp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function tz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Bv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function rz(e,t){let r=[];for(let n of e.dataTypes)Bv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function cp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Vt.checkStrictMode)(e,t,e.opts.strictTypes)}var Ga=class{constructor(t,r,n){if((0,Bo.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",Wv(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Bo.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,E.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,E.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,E._)`${r} !== undefined && (${(0,E.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?Ho.reportExtraError:Ho.reportError)(this,this.def.error,r)}$dataError(){(0,Ho.reportError)(this,this.def.$dataError||Ho.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ho.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=E.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=E.nil,r=E.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,E.or)((0,E._)`${o} === undefined`,r)),t!==E.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==E.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,E.or)(a(),s());function a(){if(n.length){if(!(r instanceof E.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,E._)`${(0,Ba.checkDataTypes)(c,r,i.opts.strictNumbers,Ba.DataType.Wrong)}`}return E.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,E._)`!${c}(${r})`}return E.nil}}subschema(t,r){let n=(0,ap.getSubschema)(this.it,t);(0,ap.extendSubschemaData)(n,this.it,t),(0,ap.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return L0(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,E.Name)),!0}};sr.KeywordCxt=Ga;function Gv(e,t,r,n){let o=new Ga(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Bo.funcKeywordCode)(o,r):"macro"in r?(0,Bo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Bo.funcKeywordCode)(o,r)}var nz=/^\/(?:[^~]|~0|~1)*$/,oz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Wv(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!nz.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=q.default.rootData}else{let u=oz.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,E._)`${i}${(0,E.getProperty)((0,Vt.unescapeJsonPointer)(u))}`,a=(0,E._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}sr.getData=Wv});var Wa=z(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var up=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};lp.default=up});var Wo=z(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var dp=Ko(),pp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,dp.resolveUrl)(t,r,n),this.missingSchema=(0,dp.normalizeId)((0,dp.getFullPath)(t,this.missingRef))}};fp.default=pp});var Ya=z(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.resolveSchema=ut.getCompilingSchema=ut.resolveRef=ut.compileSchema=ut.SchemaEnv=void 0;var yt=G(),iz=Wa(),Ir=Lt(),_t=Ko(),Xv=re(),az=Go(),mn=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={}}};ut.SchemaEnv=mn;function hp(e){let t=Yv.call(this,e);if(t)return t;let r=(0,_t.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new yt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:iz.default,code:(0,yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,yt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:yt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,az.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${Ir.default.self}`,`${Ir.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:h,items:g}=u;p.evaluated={props:h instanceof yt.Name?void 0:h,items:g instanceof yt.Name?void 0:g,dynamicProps:h instanceof yt.Name,dynamicItems:g instanceof yt.Name},p.source&&(p.source.evaluated=(0,yt.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)}}ut.compileSchema=hp;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=lz.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 mn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=cz.call(this,i)}ut.resolveRef=sz;function cz(e){return(0,_t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:hp.call(this,e)}function Yv(e){for(let t of this._compilations)if(uz(t,e))return t}ut.getCompilingSchema=Yv;function uz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function lz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Xa.call(this,e,t)}function Xa(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 mp.call(this,r,e);let i=(0,_t.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Xa.call(this,e,a);return typeof s?.schema!="object"?void 0:mp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||hp.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 mn({schema:s,schemaId:c,root:e,baseId:o})}return mp.call(this,r,a)}}ut.resolveSchema=Xa;var dz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function mp(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,Xv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!dz.has(s)&&u&&(t=(0,_t.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Xv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,_t.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Xa.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new mn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var Qv=z((bA,pz)=>{pz.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 xp=z((xA,iy)=>{"use strict";var fz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),vp=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),mz=RegExp.prototype.test.bind(/^\d*$/u),Pr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),yp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),ty=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),_p=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),hz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function gz(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 vz=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),yz=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),_z=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),$z=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),bz=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),xz=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function kz(e){return bz(e)||xz(e)}function wz(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!_z(e[t])){if(e[t]==="%"&&t+2<e.length&&Pr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function ey(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 Sz(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||!vp(c))return;i+=2;continue}if(!vz(c))return;o[s]=parseInt(c,16).toString(16),i++}if(t===-1)return i!==8?void 0:ey(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 ey(a)}function gp(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&&yz(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(zz(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),!wz(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=Sz(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(o?"%"+o:""),escapedHost:a+(o?"%25"+o:""),isIPV6:!0}}function zz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Iz(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 Pz={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},jz=/[@/?#:]/g,Tz=/[@/?#]/g;function ry(e,t){let r=t?Tz:jz;return r.lastIndex=0,e.replace(r,n=>Pz[n])}function ny(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));t&&yp(a)?r+=a:r+="%"+i,n+=2;continue}}r+=e[n]}return r}var Ze=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ze[t]="%"+e[t>>4]+e[t&15]}function $p(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 ye(e){return e<2048?Ze[192|e>>6]+Ze[128|e&63]:e<65536?Ze[224|e>>12]+Ze[128|e>>6&63]+Ze[128|e&63]:Ze[240|e>>18]+Ze[128|e>>12&63]+Ze[128|e>>6&63]+Ze[128|e&63]}function Ez(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&yp(a)?t+=a:t+="%"+i,r+=2;continue}}if(ty(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=$p(o)?n:Ze[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=ye(65536+(o-55296<<10)+(i-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function Oz(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let i=e[o];if(i==="%"&&o+2<e.length){let a=e.slice(o+1,o+3);if(Pr(a)){r+="%"+a.toUpperCase(),o+=2;continue}}if(i==="/"&&(n=!1),ty(i)&&(i!==":"||!n))r+=i;else{let a=e.charCodeAt(o);if(a<128)r+=Ze[a];else if(a<55296||a>57343)r+=ye(a);else if(a<=56319&&o+1<e.length){let s=e.charCodeAt(o+1);s>=56320&&s<=57343?(r+=ye(65536+(a-55296<<10)+(s-56320)),o++):r+=ye(65533)}else r+=ye(65533)}}return r}function Dz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));yp(a)?t+=a:t+="%"+i,r+=2;continue}}if(_p(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=$p(o)?n:Ze[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=ye(65536+(o-55296<<10)+(i-56320)),r++):t+=ye(65533)}else t+=ye(65533)}}return t}function bp(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Pr(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let i=e.charCodeAt(n);if(i<128)r+=Ze[i];else if(i<55296||i>57343)r+=ye(i);else if(i<=56319&&n+1<e.length){let a=e.charCodeAt(n+1);a>=56320&&a<=57343?(r+=ye(65536+(i-55296<<10)+(a-56320)),n++):r+=ye(65533)}else r+=ye(65533)}}return r}function oy(e){return bp(e,hz)}function Nz(e){return bp(e,_p)}function Rz(e){return bp(e,_p)}function Zz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Pr(i)){t+="%"+i.toUpperCase(),r+=2;continue}}let o=e.charCodeAt(r);if(o<128)t+=$p(o)?n:Ze[o];else if(o<55296||o>57343)t+=ye(o);else if(o<=56319&&r+1<e.length){let i=e.charCodeAt(r+1);i>=56320&&i<=57343?(t+=ye(65536+(o-55296<<10)+(i-56320)),r++):t+=ye(65533)}else t+=ye(65533)}return t}function Cz(e){let t=[];if(e.userinfo!==void 0&&(t.push(oy(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!vp(r)){let n=gp(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=ny(r,!0),n=gp(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=ry(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!mz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}iy.exports={BYTE_HEX:Ze,percentEncodeNonAscii:ye,nonSimpleDomain:$z,nonSimpleMailtoDomain:kz,recomposeAuthority:Cz,reescapeHostDelimiters:ry,normalizePercentEncoding:ny,normalizePathEncoding:Ez,serializePathEncoding:Oz,normalizeQueryFragmentEncoding:Dz,encodeUserinfo:oy,encodeQuery:Nz,encodeFragment:Rz,escapePreservingEscapes:Zz,removeDotSegments:Iz,isIPv4:vp,isUUID:fz,normalizeIPv6:gp,stringArrayToHexStripped:gz}});var hy=z((kA,my)=>{"use strict";var{isUUID:Az,BYTE_HEX:Uz,percentEncodeNonAscii:kp,nonSimpleMailtoDomain:Mz}=xp(),Fz=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,qz=["http","https","ws","wss","urn","urn:uuid","mailto"];function Lz(e){return qz.indexOf(e)!==-1}function Sp(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 uy(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function ly(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 Vz(e){return e.secure=Sp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Jz(e){if((e.port===(Sp(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 Kz(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Fz);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=zp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Hz(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=zp(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 Bz(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Az(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Gz(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var dy={scheme:"http",domainHost:!0,parse:uy,serialize:ly},Wz={scheme:"https",domainHost:dy.domainHost,parse:uy,serialize:ly},Qa={scheme:"ws",domainHost:!0,parse:Vz,serialize:Jz},Xz={scheme:"wss",domainHost:Qa.domainHost,parse:Qa.parse,serialize:Qa.serialize},Yz={scheme:"urn",parse:Kz,serialize:Hz,skipNormalize:!0},Qz={scheme:"urn:uuid",parse:Bz,serialize:Gz,skipNormalize:!0},eI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=",tI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@",py="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function ts(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 rI=ts(eI),ay=ts(tI),nI=ts(py),oI=ts(py,!0),iI=/^[\da-f]{2}$/iu,aI=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,wp="URI mailto has an invalid recipient domain.",sy=/[\uD800-\uDFFF]/u;function cr(e){if(typeof e!="string"||e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function cy(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 Xo(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&&iI.test(e.slice(o+1,o+3))?(n+="%"+e.slice(o+1,o+3).toUpperCase(),o+=2):n+=Uz[i];continue}if(i<55296||i>57343){n+=t.allowNonAscii?e[o]:kp(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]:kp(65536+(i-55296<<10)+(a-56320)),o++;continue}}n+=t.allowNonAscii?"\uFFFD":kp(65533)}return n}function fy(e,t,r){let n=String(e).toLowerCase();if(aI.test(n)||n!==""&&!Mz(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(wp);return t&&t.unicodeSupport?n:o.hostname}catch{return r&&(r.error=r.error||wp),n}}function sI(e,t){let r=t&&t.unicodeSupport?oI:nI;return e.length>1&&e[0]==="["&&e[e.length-1]==="]"?"["+Xo(e.slice(1,-1),r)+"]":Xo(e,r)}function cI(e,t){let r=e,n=r.path,o=r.query;n&&sy.test(n)&&(n=cy(n)),o&&sy.test(o)&&(o=cy(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 h=0;h<p.length;h++)i.push(p[h]);continue}if(d==="subject"){r.subject=cr(f);continue}if(d==="body"){r.body=cr(f);continue}a===null&&(a=Object.create(null)),a[cr(d)]=cr(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||wp,i[a]=cr(s);continue}let u=cr(s.slice(0,c)),l=fy(cr(s.slice(c+1)),t,r);i[a]=u+"@"+l}return i.length&&(r.to=i),r}function uI(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=Xo(l,rI),p=cr(d),h=fy(p,t);n[s]=f+"@"+sI(h,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+=Xo(s,ay)+"="+Xo(String(o[s]),ay);return a!==0?r.query=i:r.headers=void 0,r}var lI={scheme:"mailto",parse:cI,serialize:uI,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0},es={http:dy,https:Wz,ws:Qa,wss:Xz,urn:Yz,"urn:uuid":Qz,mailto:lI};Object.setPrototypeOf(es,null);function zp(e){return e&&(es[e]||es[e.toLowerCase()])||void 0}my.exports={wsIsSecure:Sp,SCHEMES:es,isValidSchemeName:Lz,getSchemeHandler:zp}});var jy=z((wA,os)=>{"use strict";var{normalizeIPv6:$y,removeDotSegments:Qo,recomposeAuthority:dI,normalizePercentEncoding:by,normalizePathEncoding:pI,serializePathEncoding:gy,normalizeQueryFragmentEncoding:vy,encodeQuery:fI,encodeFragment:mI,reescapeHostDelimiters:hI,isIPv4:xy,nonSimpleDomain:gI}=xp(),{SCHEMES:ky,getSchemeHandler:Ip}=hy(),wy=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Sy="URI scheme is malformed.";function yy(e){let t=unescape(String(e));if(!wy.test(t))throw new TypeError(Sy);return t}function vI(e,t){return typeof e=="string"?e=SI(e,t):typeof e=="object"&&(e=ns(jr(e,t),t)),e}function yI(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}=rs(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:h,malformedScheme:g}=rs(t,n);if(i||d||a||f||s||p||c||h||u||g)throw new Error(o.error||l.error||"URI is malformed.");let y=zy(o,l,n,!0),$=Ip(r&&r.scheme||y.scheme),k=y.host,x=k!==void 0&&k!==""&&(xy(k)||$y(k).isIPV6);Iy(y,r||{},$,x);let D=k&&k.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(k);if(y.error&&!D)throw new Error(y.error);return n.skipEscape=!0,jr(y,n)}function zy(e,t,r,n){let o={};return n||(e=ns(jr(e,r),r),t=ns(jr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=Qo(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=Qo(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=Qo(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=Qo(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 _I(e,t,r){let n=_y(e,r),o=_y(t,r);return n!==void 0&&o!==void 0&&n===o}function jr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,to:e.to,subject:e.subject,body:e.body,headers:e.headers,error:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=yy(r.scheme));let i=Ip(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=by(r.path):r.path=gy(r.path,s)),n.reference!=="suffix"&&r.scheme&&(r.scheme=yy(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=Qo(u)),s&&(u=gy(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",fI(r.query)),r.fragment!==void 0&&o.push("#",mI(r.fragment)),o.join("")}var $I=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,bI=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,xI=/^(?:[^#/:?]+:)?([/\\\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 Yo(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 Pp(e){return e[0]==="["&&e[e.length-1]==="]"}function wI(e){let t=e[4];return Yo(e[3])||t!==void 0&&!Pp(t)&&Yo(t)||Yo(e[6])||Yo(e[7])||Yo(e[8])}function Iy(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&&!Pp(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&!o&&gI(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 rs(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(bI);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let f=e.match(xI);if(f!==null){let h=f[1],g=h.replace(/[\t\n\r]/g,"");g.length>=2&&(g.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):h.length!==g.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let p=e.match($I);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 y=unescape(n.scheme);wy.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||Sy,u=!0)}i=wI(p),i&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=p[5]);let h=kI(n,p);if(h!==void 0&&(n.error=n.error||h,o=!0),n.host)if(xy(n.host)===!1){let $=Pp(n.host),k=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,x=$y(n.host);l=x.isIPV6||x.isIPVFuture===!0,c=k&&(!$||x.error===!0),n.host=l?x.host:x.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 g=Ip(r.scheme||n.scheme);if(c||(s=Iy(n,r,g,l)),!g||g&&!g.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:by(n.host,!0);n.host=hI(y,l)}n.path&&(n.path=pI(n.path)),n.query&&(n.query=vy(n.query)),n.fragment&&(n.fragment=vy(n.fragment))}g&&g.parse&&(g.parse(n,r),g===ky.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 ns(e,t){return rs(e,t).parsed}function SI(e,t){return Py(e,t).normalized}function Py(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}=rs(e,t);return{normalized:n||o||i||a||s?e:jr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}}function _y(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:jr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=Py(r,t);return o||i||a||s||c?void 0:n}var jp={SCHEMES:ky,normalize:vI,resolve:yI,resolveComponent:zy,equal:_I,serialize:jr,parse:ns};os.exports=jp;os.exports.default=jp;os.exports.fastUri=jp});var Ey=z(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var Ty=jy();Ty.code='require("ajv/dist/runtime/uri").default';Tp.default=Ty});var Uy=z(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.CodeGen=Ie.Name=Ie.nil=Ie.stringify=Ie.str=Ie._=Ie.KeywordCxt=void 0;var zI=Go();Object.defineProperty(Ie,"KeywordCxt",{enumerable:!0,get:function(){return zI.KeywordCxt}});var hn=G();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return hn._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return hn.str}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return hn.stringify}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return hn.nil}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return hn.Name}});Object.defineProperty(Ie,"CodeGen",{enumerable:!0,get:function(){return hn.CodeGen}});var II=Wa(),Zy=Wo(),PI=Wd(),ei=Ya(),jI=G(),ti=Ko(),is=Jo(),Op=re(),Oy=Qv(),TI=Ey(),Cy=(e,t)=>new RegExp(e,t);Cy.code="new RegExp";var EI=["removeAdditional","useDefaults","coerceTypes"],OI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),DI={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."},NI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Dy=200;function RI(e){var t,r,n,o,i,a,s,c,u,l,d,f,p,h,g,y,$,k,x,D,O,dt,pt,Ps,js;let Sn=e.strict,Ts=(t=e.code)===null||t===void 0?void 0:t.optimize,Nf=Ts===!0||Ts===void 0?1:Ts||0,Rf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Cy,p$=(o=e.uriResolver)!==null&&o!==void 0?o:TI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:Sn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:Sn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:Sn)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:Sn)!==null&&f!==void 0?f:"log",strictRequired:(h=(p=e.strictRequired)!==null&&p!==void 0?p:Sn)!==null&&h!==void 0?h:!1,code:e.code?{...e.code,optimize:Nf,regExp:Rf}:{optimize:Nf,regExp:Rf},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Dy,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:Dy,meta:($=e.meta)!==null&&$!==void 0?$:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(D=e.schemaId)!==null&&D!==void 0?D:"$id",addUsedSchema:(O=e.addUsedSchema)!==null&&O!==void 0?O:!0,validateSchema:(dt=e.validateSchema)!==null&&dt!==void 0?dt:!0,validateFormats:(pt=e.validateFormats)!==null&&pt!==void 0?pt:!0,unicodeRegExp:(Ps=e.unicodeRegExp)!==null&&Ps!==void 0?Ps:!0,int32range:(js=e.int32range)!==null&&js!==void 0?js:!0,uriResolver:p$}}var ri=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...RI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new jI.ValueScope({scope:{},prefixes:OI,es5:r,lines:n}),this.logger=FI(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,PI.getRules)(),Ny.call(this,DI,t,"NOT SUPPORTED"),Ny.call(this,NI,t,"DEPRECATED","warn"),this._metaOpts=UI.call(this),t.formats&&CI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&AI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),ZI.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Oy;n==="id"&&(o={...Oy},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 Zy.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,ti.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=Ry.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new ei.SchemaEnv({schema:{},schemaId:n});if(r=ei.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=Ry.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,ti.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(LI.call(this,n,r),!r)return(0,Op.eachItem)(n,i=>Ep.call(this,i)),this;JI.call(this,r);let o={...r,type:(0,is.getJSONTypes)(r.type),schemaType:(0,is.getJSONTypes)(r.schemaType)};return(0,Op.eachItem)(n,o.type.length===0?i=>Ep.call(this,i,o):i=>o.type.forEach(a=>Ep.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]=Ay(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,ti.normalizeId)(a||n);let u=ti.getSchemaRefs.call(this,t,n);return c=new ei.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):ei.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{ei.compileSchema.call(this,t)}finally{this.opts=r}}};ri.ValidationError=II.default;ri.MissingRefError=Zy.default;Ie.default=ri;function Ny(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 Ry(e){return e=(0,ti.normalizeId)(e),this.schemas[e]||this.refs[e]}function ZI(){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 CI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function AI(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 UI(){let e={...this.opts};for(let t of EI)delete e[t];return e}var MI={log(){},warn(){},error(){}};function FI(e){if(e===!1)return MI;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}var qI=/^[a-z_$][a-z0-9_$:-]*$/i;function LI(e,t){let{RULES:r}=this;if((0,Op.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!qI.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!t&&t.$data&&!("code"in t||"validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function Ep(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,is.getJSONTypes)(t.type),schemaType:(0,is.getJSONTypes)(t.schemaType)}};t.before?VI.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 VI(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 JI(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Ay(t)),e.validateSchema=this.compile(t,!0))}var KI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ay(e){return{anyOf:[e,KI]}}});var My=z(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var HI={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Dp.default=HI});var Vy=z(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.callRef=Tr.getValidate=void 0;var BI=Wo(),Fy=ct(),Be=G(),gn=Lt(),qy=Ya(),as=re(),GI={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=qy.resolveRef.call(c,u,o,r);if(l===void 0)throw new BI.default(n.opts.uriResolver,o,r);if(l instanceof qy.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return ss(e,a,i,i.$async);let h=t.scopeValue("root",{ref:u});return ss(e,(0,Be._)`${h}.validate`,u,u.$async)}function f(h){let g=Ly(e,h);ss(e,g,h,h.$async)}function p(h){let g=t.scopeValue("schema",s.code.source===!0?{ref:h,code:(0,Be.stringify)(h)}:{ref:h}),y=t.name("valid"),$=e.subschema({schema:h,dataTypes:[],schemaPath:Be.nil,topSchemaRef:g,errSchemaPath:r},y);e.mergeEvaluated($),e.ok(y)}}};function Ly(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Be._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Tr.getValidate=Ly;function ss(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?gn.default.this:Be.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0,Be._)`await ${(0,Fy.callValidateCode)(e,t,u)}`),p(t),a||o.assign(h,!0)},g=>{o.if((0,Be._)`!(${g} instanceof ${i.ValidationError})`,()=>o.throw(g)),f(g),a||o.assign(h,!1)}),e.ok(h)}function d(){e.result((0,Fy.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(h){let g=(0,Be._)`${h}.errors`;o.assign(gn.default.vErrors,(0,Be._)`${gn.default.vErrors} === null ? ${g} : ${gn.default.vErrors}.concat(${g})`),o.assign(gn.default.errors,(0,Be._)`${gn.default.vErrors}.length`)}function p(h){var g;if(!i.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(i.props=as.mergeEvaluated.props(o,y.props,i.props));else{let $=o.var("props",(0,Be._)`${h}.evaluated.props`);i.props=as.mergeEvaluated.props(o,$,i.props,Be.Name)}if(i.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(i.items=as.mergeEvaluated.items(o,y.items,i.items));else{let $=o.var("items",(0,Be._)`${h}.evaluated.items`);i.items=as.mergeEvaluated.items(o,$,i.items,Be.Name)}}}Tr.callRef=ss;Tr.default=GI});var Jy=z(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var WI=My(),XI=Vy(),YI=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",WI.default,XI.default];Np.default=YI});var Ky=z(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var cs=G(),ur=cs.operators,us={maximum:{okStr:"<=",ok:ur.LTE,fail:ur.GT},minimum:{okStr:">=",ok:ur.GTE,fail:ur.LT},exclusiveMaximum:{okStr:"<",ok:ur.LT,fail:ur.GTE},exclusiveMinimum:{okStr:">",ok:ur.GT,fail:ur.LTE}},QI={message:({keyword:e,schemaCode:t})=>(0,cs.str)`must be ${us[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,cs._)`{comparison: ${us[e].okStr}, limit: ${t}}`},eP={keyword:Object.keys(us),type:"number",schemaType:"number",$data:!0,error:QI,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,cs._)`${r} ${us[t].fail} ${n} || isNaN(${r})`)}};Rp.default=eP});var Hy=z(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var ni=G(),tP={message:({schemaCode:e})=>(0,ni.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,ni._)`{multipleOf: ${e}}`},rP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:tP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,ni._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,ni._)`${a} !== parseInt(${a})`;e.fail$data((0,ni._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Zp.default=rP});var Gy=z(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});function By(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}Cp.default=By;By.code='require("ajv/dist/runtime/ucs2length").default'});var Wy=z(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var Er=G(),nP=re(),oP=Gy(),iP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Er.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Er._)`{limit: ${e}}`},aP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:iP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Er.operators.GT:Er.operators.LT,a=o.opts.unicode===!1?(0,Er._)`${r}.length`:(0,Er._)`${(0,nP.useFunc)(e.gen,oP.default)}(${r})`;e.fail$data((0,Er._)`${a} ${i} ${n}`)}};Ap.default=aP});var Xy=z(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var sP=ct(),cP=re(),vn=G(),uP={message:({schemaCode:e})=>(0,vn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,vn._)`{pattern: ${e}}`},lP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:uP,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,vn._)`new RegExp`:(0,cP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,vn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,vn._)`!${l}`)}else{let c=(0,sP.usePattern)(e,o);e.fail$data((0,vn._)`!${c}.test(${r})`)}}};Up.default=lP});var Yy=z(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var oi=G(),dP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,oi.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,oi._)`{limit: ${e}}`},pP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:dP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?oi.operators.GT:oi.operators.LT;e.fail$data((0,oi._)`Object.keys(${r}).length ${o} ${n}`)}};Mp.default=pP});var Qy=z(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var ii=ct(),ai=G(),fP=re(),mP={message:({params:{missingProperty:e}})=>(0,ai.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,ai._)`{missingProperty: ${e}}`},hP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:mP,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:h}=e.it;for(let g of r)if(p?.[g]===void 0&&!h.has(g)){let y=a.schemaEnv.baseId+a.errSchemaPath,$=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,fP.checkStrictMode)(a,$,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(ai.nil,d);else for(let p of r)(0,ii.checkReportMissingProp)(e,p)}function l(){let p=t.let("missing");if(c||i){let h=t.let("valid",!0);e.block$data(h,()=>f(p,h)),e.ok(h)}else t.if((0,ii.checkMissingProp)(e,r,p)),(0,ii.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,ii.noPropertyInData)(t,o,p,s.ownProperties),()=>e.error())})}function f(p,h){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(h,(0,ii.propertyInData)(t,o,p,s.ownProperties)),t.if((0,ai.not)(h),()=>{e.error(),t.break()})},ai.nil)}}};Fp.default=hP});var e_=z(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var si=G(),gP={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,si.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,si._)`{limit: ${e}}`},vP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:gP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?si.operators.GT:si.operators.LT;e.fail$data((0,si._)`${r}.length ${o} ${n}`)}};qp.default=vP});var ls=z(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var t_=op();t_.code='require("ajv/dist/runtime/equal").default';Lp.default=t_});var r_=z(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var Vp=Jo(),Pe=G(),yP=re(),_P=ls(),$P={message:({params:{i:e,j:t}})=>(0,Pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Pe._)`{i: ${e}, j: ${t}}`},bP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:$P,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,Vp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Pe._)`${a} === false`),e.ok(c);function l(){let h=t.let("i",(0,Pe._)`${r}.length`),g=t.let("j");e.setParams({i:h,j:g}),t.assign(c,!0),t.if((0,Pe._)`${h} > 1`,()=>(d()?f:p)(h,g))}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function f(h,g){let y=t.name("item"),$=(0,Vp.checkDataTypes)(u,y,s.opts.strictNumbers,Vp.DataType.Wrong),k=t.const("indices",(0,Pe._)`{}`);t.for((0,Pe._)`;${h}--;`,()=>{t.let(y,(0,Pe._)`${r}[${h}]`),t.if($,(0,Pe._)`continue`),u.length>1&&t.if((0,Pe._)`typeof ${y} == "string"`,(0,Pe._)`${y} += "_"`),t.if((0,Pe._)`typeof ${k}[${y}] == "number"`,()=>{t.assign(g,(0,Pe._)`${k}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,Pe._)`${k}[${y}] = ${h}`)})}function p(h,g){let y=(0,yP.useFunc)(t,_P.default),$=t.name("outer");t.label($).for((0,Pe._)`;${h}--;`,()=>t.for((0,Pe._)`${g} = ${h}; ${g}--;`,()=>t.if((0,Pe._)`${y}(${r}[${h}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break($)})))}}};Jp.default=bP});var n_=z(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var Kp=G(),xP=re(),kP=ls(),wP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Kp._)`{allowedValue: ${e}}`},SP={keyword:"const",$data:!0,error:wP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Kp._)`!${(0,xP.useFunc)(t,kP.default)}(${r}, ${o})`):e.fail((0,Kp._)`${i} !== ${r}`)}};Hp.default=SP});var o_=z(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var ci=G(),zP=re(),IP=ls(),PP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,ci._)`{allowedValues: ${e}}`},jP={keyword:"enum",schemaType:"array",$data:!0,error:PP,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,zP.useFunc)(t,IP.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,ci.or)(...o.map((h,g)=>f(p,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,p=>t.if((0,ci._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,h){let g=o[h];return typeof g=="object"&&g!==null?(0,ci._)`${u()}(${r}, ${p}[${h}])`:(0,ci._)`${r} === ${g}`}}};Bp.default=jP});var i_=z(Gp=>{"use strict";Object.defineProperty(Gp,"__esModule",{value:!0});var TP=Ky(),EP=Hy(),OP=Wy(),DP=Xy(),NP=Yy(),RP=Qy(),ZP=e_(),CP=r_(),AP=n_(),UP=o_(),MP=[TP.default,EP.default,OP.default,DP.default,NP.default,RP.default,ZP.default,CP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},AP.default,UP.default];Gp.default=MP});var Xp=z(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.validateAdditionalItems=void 0;var Or=G(),Wp=re(),FP={message:({params:{len:e}})=>(0,Or.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Or._)`{limit: ${e}}`},qP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:FP,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Wp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}a_(e,n)}};function a_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Or._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Or._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Wp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Or._)`${s} <= ${t.length}`);r.if((0,Or.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Wp.Type.Num},u),a.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}ui.validateAdditionalItems=a_;ui.default=qP});var Yp=z(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.validateTuple=void 0;var s_=G(),ds=re(),LP=ct(),VP={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return c_(e,"additionalItems",t);r.items=!0,!(0,ds.alwaysValidSchema)(r,t)&&e.ok((0,LP.validateArray)(e))}};function c_(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=ds.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,s_._)`${i}.length`);r.forEach((d,f)=>{(0,ds.alwaysValidSchema)(s,d)||(n.if((0,s_._)`${u} > ${f}`,()=>e.subschema({keyword:a,schemaProp:f,dataProp:f},c)),e.ok(c))});function l(d){let{opts:f,errSchemaPath:p}=s,h=r.length,g=h===d.minItems&&(h===d.maxItems||d[t]===!1);if(f.strictTuples&&!g){let y=`"${a}" is ${h}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,ds.checkStrictMode)(s,y,f.strictTuples)}}}li.validateTuple=c_;li.default=VP});var u_=z(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var JP=Yp(),KP={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,JP.validateTuple)(e,"items")};Qp.default=KP});var d_=z(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var l_=G(),HP=re(),BP=ct(),GP=Xp(),WP={message:({params:{len:e}})=>(0,l_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,l_._)`{limit: ${e}}`},XP={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:WP,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,HP.alwaysValidSchema)(n,t)&&(o?(0,GP.validateAdditionalItems)(e,o):e.ok((0,BP.validateArray)(e)))}};ef.default=XP});var p_=z(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var lt=G(),ps=re(),YP={message:({params:{min:e,max:t}})=>t===void 0?(0,lt.str)`must contain at least ${e} valid item(s)`:(0,lt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,lt._)`{minContains: ${e}}`:(0,lt._)`{minContains: ${e}, maxContains: ${t}}`},QP={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:YP,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,lt._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,ps.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,ps.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,ps.alwaysValidSchema)(i,r)){let g=(0,lt._)`${l} >= ${a}`;s!==void 0&&(g=(0,lt._)`${g} && ${l} <= ${s}`),e.pass(g);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,lt._)`${o}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let g=t.name("_valid"),y=t.let("count",0);p(g,()=>t.if(g,()=>h(y)))}function p(g,y){t.forRange("i",0,l,$=>{e.subschema({keyword:"contains",dataProp:$,dataPropType:ps.Type.Num,compositeRule:!0},g),y()})}function h(g){t.code((0,lt._)`${g}++`),s===void 0?t.if((0,lt._)`${g} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,lt._)`${g} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,lt._)`${g} >= ${a}`,()=>t.assign(d,!0)))}}};tf.default=QP});var h_=z(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateSchemaDeps=It.validatePropertyDeps=It.error=void 0;var rf=G(),ej=re(),di=ct();It.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,rf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,rf._)`{property: ${e},
6
+ || ${a} === "boolean" || ${o} === null`).assign(s,(0,B._)`[${o}]`)}}}function t0({gen:e,parentData:t,parentDataProperty:r},n){e.if((0,B._)`${t} !== undefined`,()=>e.assign((0,B._)`${t}[${r}]`,n))}function Yd(e,t,r,n=dn.Correct){let o=n===dn.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===dn.Correct?i:(0,B.not)(i);function a(s=B.nil){return(0,B.and)((0,B._)`typeof ${t} == "number"`,s,r?(0,B._)`isFinite(${t})`:B.nil)}}Re.checkDataType=Yd;function Qd(e,t,r,n){if(e.length===1)return Yd(e[0],t,r,n);let o,i=(0,_v.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,Yd(a,t,r,n));return o}Re.checkDataTypes=Qd;var r0={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?(0,B._)`{type: ${e}}`:(0,B._)`{type: ${t}}`};function ep(e){let t=n0(e);(0,GS.reportError)(t,r0)}Re.reportTypeError=ep;function n0(e){let{gen:t,data:r,schema:n}=e,o=(0,_v.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:e}}});var kv=z(Ha=>{"use strict";Object.defineProperty(Ha,"__esModule",{value:!0});Ha.assignDefaults=void 0;var pn=W(),o0=re();function i0(e,t){let{properties:r,items:n}=e.schema;if(t==="object"&&r)for(let o in r)xv(e,o,r[o].default);else t==="array"&&Array.isArray(n)&&n.forEach((o,i)=>xv(e,i,o.default))}Ha.assignDefaults=i0;function xv(e,t,r){let{gen:n,compositeRule:o,data:i,opts:a}=e;if(r===void 0)return;let s=(0,pn._)`${i}${(0,pn.getProperty)(t)}`;if(o){(0,o0.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=(0,pn._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,pn._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,pn._)`${s} = ${(0,pn.stringify)(r)}`)}});var ct=z(ce=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.validateUnion=ce.validateArray=ce.usePattern=ce.callValidateCode=ce.schemaProperties=ce.allSchemaProperties=ce.noPropertyInData=ce.propertyInData=ce.isOwnProperty=ce.hasPropFunc=ce.reportMissingProp=ce.checkMissingProp=ce.checkReportMissingProp=void 0;var ve=W(),tp=re(),or=Lt(),a0=re();function s0(e,t){let{gen:r,data:n,it:o}=e;r.if(np(r,n,t,o.opts.ownProperties),()=>{e.setParams({missingProperty:(0,ve._)`${t}`},!0),e.error()})}ce.checkReportMissingProp=s0;function c0({gen:e,data:t,it:{opts:r}},n,o){return(0,ve.or)(...n.map(i=>(0,ve.and)(np(e,t,i,r.ownProperties),(0,ve._)`${o} = ${i}`)))}ce.checkMissingProp=c0;function u0(e,t){e.setParams({missingProperty:t},!0),e.error()}ce.reportMissingProp=u0;function wv(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ve._)`Object.prototype.hasOwnProperty`})}ce.hasPropFunc=wv;function rp(e,t,r){return(0,ve._)`${wv(e)}.call(${t}, ${r})`}ce.isOwnProperty=rp;function l0(e,t,r,n){let o=(0,ve._)`${t}${(0,ve.getProperty)(r)} !== undefined`;return n?(0,ve._)`${o} && ${rp(e,t,r)}`:o}ce.propertyInData=l0;function np(e,t,r,n){let o=(0,ve._)`${t}${(0,ve.getProperty)(r)} === undefined`;return n?(0,ve.or)(o,(0,ve.not)(rp(e,t,r))):o}ce.noPropertyInData=np;function Sv(e){return e?Object.keys(e).filter(t=>t!=="__proto__"):[]}ce.allSchemaProperties=Sv;function d0(e,t){return Sv(t).filter(r=>!(0,tp.alwaysValidSchema)(e,t[r]))}ce.schemaProperties=d0;function p0({schemaCode:e,data:t,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,ve._)`${e}, ${t}, ${n}${o}`:t,d=[[or.default.instancePath,(0,ve.strConcat)(or.default.instancePath,i)],[or.default.parentData,a.parentData],[or.default.parentDataProperty,a.parentDataProperty],[or.default.rootData,or.default.rootData]];a.opts.dynamicRef&&d.push([or.default.dynamicAnchors,or.default.dynamicAnchors]);let f=(0,ve._)`${l}, ${r.object(...d)}`;return c!==ve.nil?(0,ve._)`${s}.call(${c}, ${f})`:(0,ve._)`${s}(${f})`}ce.callValidateCode=p0;var f0=(0,ve._)`new RegExp`;function m0({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,ve._)`${o.code==="new RegExp"?f0:(0,a0.useFunc)(e,o)}(${r}, ${n})`})}ce.usePattern=m0;function h0(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,ve._)`${r}.length`);t.forRange("i",0,c,u=>{e.subschema({keyword:n,dataProp:u,dataPropType:tp.Type.Num},i),t.if((0,ve.not)(i),s)})}}ce.validateArray=h0;function g0(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,tp.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,ve._)`${a} || ${s}`),e.mergeValidEvaluated(l,s)||t.if((0,ve.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}ce.validateUnion=g0});var Pv=z(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateKeywordUsage=St.validSchemaType=St.funcKeywordCode=St.macroKeywordCode=void 0;var Le=W(),zr=Lt(),v0=ct(),y0=Jo();function _0(e,t){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=e,s=t.macro.call(a.self,o,i,a),c=Iv(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:Le.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}St.macroKeywordCode=_0;function $0(e,t){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=e;x0(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,l=Iv(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)g(),t.modifying&&zv(e),y(()=>e.error());else{let _=t.async?p():m();t.modifying&&zv(e),y(()=>b0(e,_))}}function p(){let _=n.let("ruleErrs",null);return n.try(()=>g((0,Le._)`await `),k=>n.assign(d,!1).if((0,Le._)`${k} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,Le._)`${k}.errors`),()=>n.throw(k))),_}function m(){let _=(0,Le._)`${l}.errors`;return n.assign(_,null),g(Le.nil),_}function g(_=t.async?(0,Le._)`await `:Le.nil){let k=c.opts.passContext?zr.default.this:zr.default.self,x=!("compile"in t&&!s||t.schema===!1);n.assign(d,(0,Le._)`${_}${(0,v0.callValidateCode)(e,l,k,x)}`,t.modifying)}function y(_){var k;n.if((0,Le.not)((k=t.valid)!==null&&k!==void 0?k:d),_)}}St.funcKeywordCode=$0;function zv(e){let{gen:t,data:r,it:n}=e;t.if(n.parentData,()=>t.assign(r,(0,Le._)`${n.parentData}[${n.parentDataProperty}]`))}function b0(e,t){let{gen:r}=e;r.if((0,Le._)`Array.isArray(${t})`,()=>{r.assign(zr.default.vErrors,(0,Le._)`${zr.default.vErrors} === null ? ${t} : ${zr.default.vErrors}.concat(${t})`).assign(zr.default.errors,(0,Le._)`${zr.default.vErrors}.length`),(0,y0.extendErrors)(e)},()=>e.error())}function x0({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}function Iv(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,Le.stringify)(r)})}function k0(e,t,r=!1){return!t.length||t.some(n=>n==="array"?Array.isArray(e):n==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==n||r&&typeof e>"u")}St.validSchemaType=k0;function w0({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(e,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}St.validateKeywordUsage=w0});var Tv=z(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.extendSubschemaMode=ir.extendSubschemaData=ir.getSubschema=void 0;var zt=W(),jv=re();function S0(e,{keyword:t,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:(0,zt._)`${e.schemaPath}${(0,zt.getProperty)(t)}${(0,zt.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,jv.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||i===void 0||a===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:a,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')}ir.getSubschema=S0;function z0(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,zt._)`${t.data}${(0,zt.getProperty)(r)}`,!0);c(f),e.errorPath=(0,zt.str)`${u}${(0,jv.getErrorPath)(r,n,d.jsPropertySyntax)}`,e.parentDataProperty=(0,zt._)`${r}`,e.dataPathArr=[...l,e.parentDataProperty]}if(o!==void 0){let u=o instanceof zt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(e.propertyName=a)}i&&(e.dataTypes=i);function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}ir.extendSubschemaData=z0;function I0(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(e.compositeRule=n),o!==void 0&&(e.createErrors=o),i!==void 0&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}ir.extendSubschemaMode=I0});var op=z((vA,Ev)=>{"use strict";Ev.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 Dv=z((yA,Ov)=>{"use strict";var ar=Ov.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(){};Ba(t,n,o,e,"",e)};ar.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};ar.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};ar.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};ar.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Ba(e,t,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){t(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in ar.arrayKeywords)for(var f=0;f<d.length;f++)Ba(e,t,r,d[f],o+"/"+l+"/"+f,i,o,l,n,f)}else if(l in ar.propsKeywords){if(d&&typeof d=="object")for(var p in d)Ba(e,t,r,d[p],o+"/"+l+"/"+P0(p),i,o,l,n,p)}else(l in ar.keywords||e.allKeys&&!(l in ar.skipKeywords))&&Ba(e,t,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function P0(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ho=z(He=>{"use strict";Object.defineProperty(He,"__esModule",{value:!0});He.getSchemaRefs=He.resolveUrl=He.normalizeId=He._getFullPath=He.getFullPath=He.inlineRef=void 0;var j0=re(),T0=op(),E0=Dv(),O0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function D0(e,t=!0){return typeof e=="boolean"?!0:t===!0?!ip(e):t?Nv(e)<=t:!1}He.inlineRef=D0;var N0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ip(e){for(let t in e){if(N0.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(ip)||typeof r=="object"&&ip(r))return!0}return!1}function Nv(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,!O0.has(r)&&(typeof e[r]=="object"&&(0,j0.eachItem)(e[r],n=>t+=Nv(n)),t===1/0))return 1/0}return t}function Rv(e,t="",r){r!==!1&&(t=fn(t));let n=e.parse(t);return Zv(e,n)}He.getFullPath=Rv;function Zv(e,t){return e.serialize(t).split("#")[0]+"#"}He._getFullPath=Zv;var R0=/#\/?$/;function fn(e){return e?e.replace(R0,""):""}He.normalizeId=fn;function Z0(e,t,r){return r=fn(r),e.resolve(t,r)}He.resolveUrl=Z0;var C0=/^[a-z_][-a-z0-9._]*$/i;function A0(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=fn(e[r]||t),i={"":o},a=Rv(n,o,!1),s={},c=new Set;return E0(e,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let g=a+f,y=i[m];typeof d[r]=="string"&&(y=_.call(this,d[r])),k.call(this,d.$anchor),k.call(this,d.$dynamicAnchor),i[f]=y;function _(x){let N=this.opts.uriResolver.resolve;if(x=fn(y?N(y,x):x),c.has(x))throw l(x);c.add(x);let D=this.refs[x];return typeof D=="string"&&(D=this.refs[D]),typeof D=="object"?u(d,D.schema,x):x!==fn(g)&&(x[0]==="#"?(u(d,s[x],x),s[x]=d):this.refs[x]=g),x}function k(x){if(typeof x=="string"){if(!C0.test(x))throw new Error(`invalid anchor "${x}"`);_.call(this,`#${x}`)}}}),s;function u(d,f,p){if(f!==void 0&&!T0(d,f))throw l(p)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}He.getSchemaRefs=A0});var Go=z(sr=>{"use strict";Object.defineProperty(sr,"__esModule",{value:!0});sr.getData=sr.KeywordCxt=sr.validateFunctionCode=void 0;var Fv=gv(),Cv=Ko(),sp=Xd(),Wa=Ko(),U0=kv(),Wo=Pv(),ap=Tv(),O=W(),q=Lt(),M0=Ho(),Vt=re(),Bo=Jo();function F0(e){if(Vv(e)&&(Jv(e),Lv(e))){V0(e);return}qv(e,()=>(0,Fv.topBoolOrEmptySchema)(e))}sr.validateFunctionCode=F0;function qv({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,(0,O._)`${q.default.data}, ${q.default.valCxt}`,n.$async,()=>{e.code((0,O._)`"use strict"; ${Av(r,o)}`),L0(e,o),e.code(i)}):e.func(t,(0,O._)`${q.default.data}, ${q0(o)}`,n.$async,()=>e.code(Av(r,o)).code(i))}function q0(e){return(0,O._)`{${q.default.instancePath}="", ${q.default.parentData}, ${q.default.parentDataProperty}, ${q.default.rootData}=${q.default.data}${e.dynamicRef?(0,O._)`, ${q.default.dynamicAnchors}={}`:O.nil}}={}`}function L0(e,t){e.if(q.default.valCxt,()=>{e.var(q.default.instancePath,(0,O._)`${q.default.valCxt}.${q.default.instancePath}`),e.var(q.default.parentData,(0,O._)`${q.default.valCxt}.${q.default.parentData}`),e.var(q.default.parentDataProperty,(0,O._)`${q.default.valCxt}.${q.default.parentDataProperty}`),e.var(q.default.rootData,(0,O._)`${q.default.valCxt}.${q.default.rootData}`),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,O._)`${q.default.valCxt}.${q.default.dynamicAnchors}`)},()=>{e.var(q.default.instancePath,(0,O._)`""`),e.var(q.default.parentData,(0,O._)`undefined`),e.var(q.default.parentDataProperty,(0,O._)`undefined`),e.var(q.default.rootData,q.default.data),t.dynamicRef&&e.var(q.default.dynamicAnchors,(0,O._)`{}`)})}function V0(e){let{schema:t,opts:r,gen:n}=e;qv(e,()=>{r.$comment&&t.$comment&&Hv(e),W0(e),n.let(q.default.vErrors,null),n.let(q.default.errors,0),r.unevaluated&&J0(e),Kv(e),Y0(e)})}function J0(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,O._)`${r}.evaluated`),t.if((0,O._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,O._)`${e.evaluated}.props`,(0,O._)`undefined`)),t.if((0,O._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,O._)`${e.evaluated}.items`,(0,O._)`undefined`))}function Av(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,O._)`/*# sourceURL=${r} */`:O.nil}function K0(e,t){if(Vv(e)&&(Jv(e),Lv(e))){H0(e,t);return}(0,Fv.boolOrEmptySchema)(e,t)}function Lv({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 Vv(e){return typeof e.schema!="boolean"}function H0(e,t){let{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&Hv(e),G0(e),X0(e);let i=n.const("_errs",q.default.errors);Kv(e,i),n.var(t,(0,O._)`${i} === ${q.default.errors}`)}function Jv(e){(0,Vt.checkUnknownRules)(e),B0(e)}function Kv(e,t){if(e.opts.jtd)return Uv(e,[],!1,t);let r=(0,Cv.getSchemaTypes)(e.schema),n=(0,Cv.coerceAndCheckDataType)(e,r);Uv(e,r,!n,t)}function B0(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 W0(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 G0(e){let t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,M0.resolveUrl)(e.opts.uriResolver,e.baseId,t))}function X0(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}function Hv({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)e.code((0,O._)`${q.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,O.str)`${n}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,O._)`${q.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function Y0(e){let{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if((0,O._)`${q.default.errors} === 0`,()=>t.return(q.default.data),()=>t.throw((0,O._)`new ${o}(${q.default.vErrors})`)):(t.assign((0,O._)`${n}.errors`,q.default.vErrors),i.unevaluated&&Q0(e),t.return((0,O._)`${q.default.errors} === 0`))}function Q0({gen:e,evaluated:t,props:r,items:n}){r instanceof O.Name&&e.assign((0,O._)`${t}.props`,r),n instanceof O.Name&&e.assign((0,O._)`${t}.items`,n)}function Uv(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(()=>Wv(e,"$ref",l.all.$ref.definition));return}c.jtd||ez(e,t),o.block(()=>{for(let f of l.rules)d(f);d(l.post)});function d(f){(0,sp.shouldUseGroup)(i,f)&&(f.type?(o.if((0,Wa.checkDataType)(f.type,a,c.strictNumbers)),Mv(e,f),t.length===1&&t[0]===f.type&&r&&(o.else(),(0,Wa.reportTypeError)(e)),o.endIf()):Mv(e,f),s||o.if((0,O._)`${q.default.errors} === ${n||0}`))}}function Mv(e,t){let{gen:r,schema:n,opts:{useDefaults:o}}=e;o&&(0,U0.assignDefaults)(e,t.type),r.block(()=>{for(let i of t.rules)(0,sp.shouldUseRule)(n,i)&&Wv(e,i.keyword,i.definition,t.type)})}function ez(e,t){e.schemaEnv.meta||!e.opts.strictTypes||(tz(e,t),e.opts.allowUnionTypes||rz(e,t),nz(e,e.dataTypes))}function tz(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(r=>{Bv(e.dataTypes,r)||cp(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),iz(e,t)}}function rz(e,t){t.length>1&&!(t.length===2&&t.includes("null"))&&cp(e,"use allowUnionTypes to allow union type keyword")}function nz(e,t){let r=e.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,sp.shouldUseRule)(e.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>oz(t,a))&&cp(e,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function oz(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function Bv(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function iz(e,t){let r=[];for(let n of e.dataTypes)Bv(t,n)?r.push(n):t.includes("integer")&&n==="number"&&r.push("integer");e.dataTypes=r}function cp(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,Vt.checkStrictMode)(e,t,e.opts.strictTypes)}var Ga=class{constructor(t,r,n){if((0,Wo.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",Gv(this.$data,t));else if(this.schemaCode=this.schemaValue,!(0,Wo.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,O.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,O.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,O._)`${r} !== undefined && (${(0,O.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?Bo.reportExtraError:Bo.reportError)(this,this.def.error,r)}$dataError(){(0,Bo.reportError)(this,this.def.$dataError||Bo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Bo.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=O.nil){this.gen.block(()=>{this.check$data(t,n),r()})}check$data(t=O.nil,r=O.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:i,def:a}=this;n.if((0,O.or)((0,O._)`${o} === undefined`,r)),t!==O.nil&&n.assign(t,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),t!==O.nil&&n.assign(t,!1)),n.else()}invalid$data(){let{gen:t,schemaCode:r,schemaType:n,def:o,it:i}=this;return(0,O.or)(a(),s());function a(){if(n.length){if(!(r instanceof O.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,O._)`${(0,Wa.checkDataTypes)(c,r,i.opts.strictNumbers,Wa.DataType.Wrong)}`}return O.nil}function s(){if(o.validateSchema){let c=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,O._)`!${c}(${r})`}return O.nil}}subschema(t,r){let n=(0,ap.getSubschema)(this.it,t);(0,ap.extendSubschemaData)(n,this.it,t),(0,ap.extendSubschemaMode)(n,t);let o={...this.it,...n,items:void 0,props:void 0};return K0(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,O.Name)),!0}};sr.KeywordCxt=Ga;function Wv(e,t,r,n){let o=new Ga(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Wo.funcKeywordCode)(o,r):"macro"in r?(0,Wo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Wo.funcKeywordCode)(o,r)}var az=/^\/(?:[^~]|~0|~1)*$/,sz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Gv(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(e==="")return q.default.rootData;if(e[0]==="/"){if(!az.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=q.default.rootData}else{let u=sz.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,O._)`${i}${(0,O.getProperty)((0,Vt.unescapeJsonPointer)(u))}`,a=(0,O._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${t}`}}sr.getData=Gv});var Xa=z(lp=>{"use strict";Object.defineProperty(lp,"__esModule",{value:!0});var up=class extends Error{constructor(t){super("validation failed"),this.errors=t,this.ajv=this.validation=!0}};lp.default=up});var Xo=z(fp=>{"use strict";Object.defineProperty(fp,"__esModule",{value:!0});var dp=Ho(),pp=class extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,dp.resolveUrl)(t,r,n),this.missingSchema=(0,dp.normalizeId)((0,dp.getFullPath)(t,this.missingRef))}};fp.default=pp});var Qa=z(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});ut.resolveSchema=ut.getCompilingSchema=ut.resolveRef=ut.compileSchema=ut.SchemaEnv=void 0;var yt=W(),cz=Xa(),Ir=Lt(),_t=Ho(),Xv=re(),uz=Go(),mn=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={}}};ut.SchemaEnv=mn;function hp(e){let t=Yv.call(this,e);if(t)return t;let r=(0,_t.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new yt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;e.$async&&(s=a.scopeValue("Error",{ref:cz.default,code:(0,yt._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:Ir.default.data,parentData:Ir.default.parentData,parentDataProperty:Ir.default.parentDataProperty,dataNames:[Ir.default.data],dataPathArr:[yt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,yt.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:yt.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,yt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(e),(0,uz.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(Ir.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,e));let p=new Function(`${Ir.default.self}`,`${Ir.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:g}=u;p.evaluated={props:m instanceof yt.Name?void 0:m,items:g instanceof yt.Name?void 0:g,dynamicProps:m instanceof yt.Name,dynamicItems:g instanceof yt.Name},p.source&&(p.source.evaluated=(0,yt.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)}}ut.compileSchema=hp;function lz(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=fz.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 mn({schema:a,schemaId:s,root:e,baseId:t}))}if(i!==void 0)return e.refs[r]=dz.call(this,i)}ut.resolveRef=lz;function dz(e){return(0,_t.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:hp.call(this,e)}function Yv(e){for(let t of this._compilations)if(pz(t,e))return t}ut.getCompilingSchema=Yv;function pz(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function fz(e,t){let r;for(;typeof(r=this.refs[t])=="string";)t=r;return r||this.schemas[t]||Ya.call(this,e,t)}function Ya(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 mp.call(this,r,e);let i=(0,_t.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Ya.call(this,e,a);return typeof s?.schema!="object"?void 0:mp.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||hp.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 mn({schema:s,schemaId:c,root:e,baseId:o})}return mp.call(this,r,a)}}ut.resolveSchema=Ya;var mz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function mp(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,Xv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!mz.has(s)&&u&&(t=(0,_t.resolveUrl)(this.opts.uriResolver,t,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Xv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,_t.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=Ya.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new mn({schema:r,schemaId:a,root:n,baseId:t}),i.schema!==i.root.schema)return i}});var Qv=z((wA,hz)=>{hz.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 xp=z((SA,iy)=>{"use strict";var gz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),vp=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),vz=RegExp.prototype.test.bind(/^\d*$/u),Pr=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),yp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),ty=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u),_p=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u),yz=RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);function _z(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 $z=RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/),bz=RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/),xz=RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/),kz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),wz=RegExp.prototype.test.bind(/[^\d!"$&'()*+,\-.;=_`a-z{}~]/u),Sz=RegExp.prototype.test.bind(/(?:^|\.)\d+$/u);function zz(e){return wz(e)||Sz(e)}function Iz(e){if(e.length===0)return!1;for(let t=0;t<e.length;t++)if(!xz(e[t])){if(e[t]==="%"&&t+2<e.length&&Pr(e.slice(t+1,t+3))){t+=2;continue}return!1}return!0}function ey(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 Pz(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||!vp(c))return;i+=2;continue}if(!$z(c))return;o[s]=parseInt(c,16).toString(16),i++}if(t===-1)return i!==8?void 0:ey(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 ey(a)}function gp(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&&bz(n))return n=n.toLowerCase(),{host:`[${n}]`,escapedHost:n,isIPV6:!1,isIPVFuture:!0};if(jz(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),!Iz(o))return{host:e,isIPV6:!1,error:!0};n=n.slice(0,i)}let a=Pz(n);return a===void 0?{host:e,isIPV6:!1,error:!0}:{host:a+(o?"%"+o:""),escapedHost:a+(o?"%25"+o:""),isIPV6:!0}}function jz(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}function Tz(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 Ez={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},Oz=/[@/?#:]/g,Dz=/[@/?#]/g;function ry(e,t){let r=t?Dz:Oz;return r.lastIndex=0,e.replace(r,n=>Ez[n])}function ny(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let n=0;n<e.length;n++){if(e[n]==="%"&&n+2<e.length){let o=e.slice(n+1,n+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));t&&yp(a)?r+=a:r+="%"+i,n+=2;continue}}r+=e[n]}return r}var Ze=new Array(256);{let e="0123456789ABCDEF";for(let t=0;t<256;t++)Ze[t]="%"+e[t>>4]+e[t&15]}function $p(e){return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===42||e===43||e===45||e===46||e===47||e===64||e===95}function _e(e){return e<2048?Ze[192|e>>6]+Ze[128|e&63]:e<65536?Ze[224|e>>12]+Ze[128|e>>6&63]+Ze[128|e&63]:Ze[240|e>>18]+Ze[128|e>>12&63]+Ze[128|e>>6&63]+Ze[128|e&63]}function Nz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));a!=="."&&yp(a)?t+=a:t+="%"+i,r+=2;continue}}if(ty(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=$p(o)?n:Ze[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 Rz(e,t=!1){let r="",n=t&&e[0]!=="/";for(let o=0;o<e.length;o++){let i=e[o];if(i==="%"&&o+2<e.length){let a=e.slice(o+1,o+3);if(Pr(a)){r+="%"+a.toUpperCase(),o+=2;continue}}if(i==="/"&&(n=!1),ty(i)&&(i!==":"||!n))r+=i;else{let a=e.charCodeAt(o);if(a<128)r+=Ze[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 Zz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if(Pr(o)){let i=o.toUpperCase(),a=String.fromCharCode(parseInt(i,16));yp(a)?t+=a:t+="%"+i,r+=2;continue}}if(_p(n))t+=n;else{let o=e.charCodeAt(r);if(o<128)t+=$p(o)?n:Ze[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 bp(e,t){let r="";for(let n=0;n<e.length;n++){let o=e[n];if(o==="%"&&n+2<e.length){let i=e.slice(n+1,n+3);if(Pr(i)){r+="%"+i.toUpperCase(),n+=2;continue}}if(t(o))r+=o;else{let i=e.charCodeAt(n);if(i<128)r+=Ze[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 oy(e){return bp(e,yz)}function Cz(e){return bp(e,_p)}function Az(e){return bp(e,_p)}function Uz(e){let t="";for(let r=0;r<e.length;r++){let n=e[r];if(n==="%"&&r+2<e.length){let i=e.slice(r+1,r+3);if(Pr(i)){t+="%"+i.toUpperCase(),r+=2;continue}}let o=e.charCodeAt(r);if(o<128)t+=$p(o)?n:Ze[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 Mz(e){let t=[];if(e.userinfo!==void 0&&(t.push(oy(e.userinfo)),t.push("@")),e.host!==void 0){let r=e.host;if(!vp(r)){let n=gp(r);n.isIPV6!==!0&&n.isIPVFuture!==!0&&(r=ny(r,!0),n=gp(r)),n.isIPV6===!0||n.isIPVFuture===!0?r=`[${n.escapedHost}]`:r=ry(r,!1)}t.push(r)}if(typeof e.port=="number"||typeof e.port=="string"){let r=String(e.port);if(!vz(r))throw new TypeError("URI port is malformed.");t.push(":"),t.push(r)}return t.length?t.join(""):void 0}iy.exports={BYTE_HEX:Ze,percentEncodeNonAscii:_e,nonSimpleDomain:kz,nonSimpleMailtoDomain:zz,recomposeAuthority:Mz,reescapeHostDelimiters:ry,normalizePercentEncoding:ny,normalizePathEncoding:Nz,serializePathEncoding:Rz,normalizeQueryFragmentEncoding:Zz,encodeUserinfo:oy,encodeQuery:Cz,encodeFragment:Az,escapePreservingEscapes:Uz,removeDotSegments:Tz,isIPv4:vp,isUUID:gz,normalizeIPv6:gp,stringArrayToHexStripped:_z}});var hy=z((zA,my)=>{"use strict";var{isUUID:Fz,BYTE_HEX:qz,percentEncodeNonAscii:kp,nonSimpleMailtoDomain:Lz}=xp(),Vz=/^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu,Jz=["http","https","ws","wss","urn","urn:uuid","mailto"];function Kz(e){return Jz.indexOf(e)!==-1}function Sp(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 uy(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function ly(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 Hz(e){return e.secure=Sp(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function Bz(e){if((e.port===(Sp(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 Wz(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(Vz);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=zp(o);e.path=void 0,i&&(e=i.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e}function Gz(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=zp(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 Xz(e,t){let r=e;return r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!Fz(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Yz(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var dy={scheme:"http",domainHost:!0,parse:uy,serialize:ly},Qz={scheme:"https",domainHost:dy.domainHost,parse:uy,serialize:ly},es={scheme:"ws",domainHost:!0,parse:Hz,serialize:Bz},eI={scheme:"wss",domainHost:es.domainHost,parse:es.parse,serialize:es.serialize},tI={scheme:"urn",parse:Wz,serialize:Gz,skipNormalize:!0},rI={scheme:"urn:uuid",parse:Xz,serialize:Yz,skipNormalize:!0},nI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+=",oI="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+,;:@",py="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~!$'()*+;:";function rs(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 iI=rs(nI),ay=rs(oI),aI=rs(py),sI=rs(py,!0),cI=/^[\da-f]{2}$/iu,uI=/^\[[\x21-\x5A\x5E-\x7E]*\]$/u,wp="URI mailto has an invalid recipient domain.",sy=/[\uD800-\uDFFF]/u;function cr(e){if(typeof e!="string"||e.indexOf("%")===-1)return e;try{return decodeURIComponent(e)}catch{return e}}function cy(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 Yo(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&&cI.test(e.slice(o+1,o+3))?(n+="%"+e.slice(o+1,o+3).toUpperCase(),o+=2):n+=qz[i];continue}if(i<55296||i>57343){n+=t.allowNonAscii?e[o]:kp(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]:kp(65536+(i-55296<<10)+(a-56320)),o++;continue}}n+=t.allowNonAscii?"\uFFFD":kp(65533)}return n}function fy(e,t,r){let n=String(e).toLowerCase();if(uI.test(n)||n!==""&&!Lz(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(wp);return t&&t.unicodeSupport?n:o.hostname}catch{return r&&(r.error=r.error||wp),n}}function lI(e,t){let r=t&&t.unicodeSupport?sI:aI;return e.length>1&&e[0]==="["&&e[e.length-1]==="]"?"["+Yo(e.slice(1,-1),r)+"]":Yo(e,r)}function dI(e,t){let r=e,n=r.path,o=r.query;n&&sy.test(n)&&(n=cy(n)),o&&sy.test(o)&&(o=cy(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=cr(f);continue}if(d==="body"){r.body=cr(f);continue}a===null&&(a=Object.create(null)),a[cr(d)]=cr(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||wp,i[a]=cr(s);continue}let u=cr(s.slice(0,c)),l=fy(cr(s.slice(c+1)),t,r);i[a]=u+"@"+l}return i.length&&(r.to=i),r}function pI(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=Yo(l,iI),p=cr(d),m=fy(p,t);n[s]=f+"@"+lI(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+=Yo(s,ay)+"="+Yo(String(o[s]),ay);return a!==0?r.query=i:r.headers=void 0,r}var fI={scheme:"mailto",parse:dI,serialize:pI,domainHost:!1,unicodeSupport:!0,skipNormalize:!0,absolutePath:!0},ts={http:dy,https:Qz,ws:es,wss:eI,urn:tI,"urn:uuid":rI,mailto:fI};Object.setPrototypeOf(ts,null);function zp(e){return e&&(ts[e]||ts[e.toLowerCase()])||void 0}my.exports={wsIsSecure:Sp,SCHEMES:ts,isValidSchemeName:Kz,getSchemeHandler:zp}});var jy=z((IA,is)=>{"use strict";var{normalizeIPv6:$y,removeDotSegments:ei,recomposeAuthority:mI,normalizePercentEncoding:by,normalizePathEncoding:hI,serializePathEncoding:gy,normalizeQueryFragmentEncoding:vy,encodeQuery:gI,encodeFragment:vI,reescapeHostDelimiters:yI,isIPv4:xy,nonSimpleDomain:_I}=xp(),{SCHEMES:ky,getSchemeHandler:Ip}=hy(),wy=/^[A-Za-z][A-Za-z0-9+.-]*$/u,Sy="URI scheme is malformed.";function yy(e){let t=unescape(String(e));if(!wy.test(t))throw new TypeError(Sy);return t}function $I(e,t){return typeof e=="string"?e=PI(e,t):typeof e=="object"&&(e=os(jr(e,t),t)),e}function bI(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}=ns(e,n),{parsed:l,malformedAuthorityOrPort:d,malformedPercentEncoding:f,malformedSchemeSpecific:p,malformedHost:m,malformedScheme:g}=ns(t,n);if(i||d||a||f||s||p||c||m||u||g)throw new Error(o.error||l.error||"URI is malformed.");let y=zy(o,l,n,!0),_=Ip(r&&r.scheme||y.scheme),k=y.host,x=k!==void 0&&k!==""&&(xy(k)||$y(k).isIPV6);Iy(y,r||{},_,x);let N=k&&k.indexOf("%")!==-1&&!new RegExp("\\P{ASCII}","u").test(k);if(y.error&&!N)throw new Error(y.error);return n.skipEscape=!0,jr(y,n)}function zy(e,t,r,n){let o={};return n||(e=os(jr(e,r),r),t=os(jr(t,r),r)),r=r||{},!r.tolerant&&t.scheme?(o.scheme=t.scheme,o.userinfo=t.userinfo,o.host=t.host,o.port=t.port,o.path=ei(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=ei(t.path||""),o.query=t.query):(t.path?(t.path[0]==="/"?o.path=ei(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=ei(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 xI(e,t,r){let n=_y(e,r),o=_y(t,r);return n!==void 0&&o!==void 0&&n===o}function jr(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,to:e.to,subject:e.subject,body:e.body,headers:e.headers,error:""},n=Object.assign({},t),o=[];r.scheme&&(r.scheme=yy(r.scheme));let i=Ip(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=by(r.path):r.path=gy(r.path,s)),n.reference!=="suffix"&&r.scheme&&(r.scheme=yy(r.scheme),o.push(r.scheme,":"));let c=mI(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=ei(u)),s&&(u=gy(u,!0)),c===void 0&&u[0]==="/"&&u[1]==="/"&&(u="/%2F"+u.slice(2)),o.push(u)}return r.query!==void 0&&o.push("?",gI(r.query)),r.fragment!==void 0&&o.push("#",vI(r.fragment)),o.join("")}var kI=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,wI=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/,SI=/^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;function zI(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 Qo(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 Pp(e){return e[0]==="["&&e[e.length-1]==="]"}function II(e){let t=e[4];return Qo(e[3])||t!==void 0&&!Pp(t)&&Qo(t)||Qo(e[6])||Qo(e[7])||Qo(e[8])}function Iy(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&&!Pp(e.host)&&(t.domainHost||r&&r.domainHost)&&n===!1&&!o&&_I(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 ns(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(wI);d!==null&&d[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let f=e.match(SI);if(f!==null){let m=f[1],g=m.replace(/[\t\n\r]/g,"");g.length>=2&&(g.slice(0,2)!=="//"?(n.error=n.error||"URI authority must not contain a literal backslash.",o=!0):m.length!==g.length&&(n.error=n.error||"URI authority introducer must not contain whitespace.",o=!0))}let p=e.match(kI);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 y=unescape(n.scheme);wy.test(y)?n.scheme=y.toLowerCase():(n.error=n.error||Sy,u=!0)}i=II(p),i&&(n.error=n.error||"URI contains malformed percent-encoding."),isNaN(n.port)&&(n.port=p[5]);let m=zI(n,p);if(m!==void 0&&(n.error=n.error||m,o=!0),n.host)if(xy(n.host)===!1){let _=Pp(n.host),k=n.host.indexOf("[")!==-1||n.host.indexOf("]")!==-1,x=$y(n.host);l=x.isIPV6||x.isIPVFuture===!0,c=k&&(!_||x.error===!0),n.host=l?x.host:x.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 g=Ip(r.scheme||n.scheme);if(c||(s=Iy(n,r,g,l)),!g||g&&!g.skipNormalize){if(e.indexOf("%")!==-1&&n.host!==void 0&&!c){let y=l?n.host:by(n.host,!0);n.host=yI(y,l)}n.path&&(n.path=hI(n.path)),n.query&&(n.query=vy(n.query)),n.fragment&&(n.fragment=vy(n.fragment))}g&&g.parse&&(g.parse(n,r),g===ky.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 os(e,t){return ns(e,t).parsed}function PI(e,t){return Py(e,t).normalized}function Py(e,t){let{parsed:r,malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}=ns(e,t);return{normalized:n||o||i||a||s?e:jr(r,t),malformedAuthorityOrPort:n,malformedPercentEncoding:o,malformedSchemeSpecific:i,malformedHost:a,malformedScheme:s}}function _y(e,t){if(typeof e!="string"&&typeof e!="object")return;let r;try{r=typeof e=="string"?e:jr(e,t)}catch{return}let{normalized:n,malformedAuthorityOrPort:o,malformedPercentEncoding:i,malformedSchemeSpecific:a,malformedHost:s,malformedScheme:c}=Py(r,t);return o||i||a||s||c?void 0:n}var jp={SCHEMES:ky,normalize:$I,resolve:bI,resolveComponent:zy,equal:xI,serialize:jr,parse:os};is.exports=jp;is.exports.default=jp;is.exports.fastUri=jp});var Ey=z(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});var Ty=jy();Ty.code='require("ajv/dist/runtime/uri").default';Tp.default=Ty});var Uy=z(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});Ie.CodeGen=Ie.Name=Ie.nil=Ie.stringify=Ie.str=Ie._=Ie.KeywordCxt=void 0;var jI=Go();Object.defineProperty(Ie,"KeywordCxt",{enumerable:!0,get:function(){return jI.KeywordCxt}});var hn=W();Object.defineProperty(Ie,"_",{enumerable:!0,get:function(){return hn._}});Object.defineProperty(Ie,"str",{enumerable:!0,get:function(){return hn.str}});Object.defineProperty(Ie,"stringify",{enumerable:!0,get:function(){return hn.stringify}});Object.defineProperty(Ie,"nil",{enumerable:!0,get:function(){return hn.nil}});Object.defineProperty(Ie,"Name",{enumerable:!0,get:function(){return hn.Name}});Object.defineProperty(Ie,"CodeGen",{enumerable:!0,get:function(){return hn.CodeGen}});var TI=Xa(),Zy=Xo(),EI=Gd(),ti=Qa(),OI=W(),ri=Ho(),as=Ko(),Op=re(),Oy=Qv(),DI=Ey(),Cy=(e,t)=>new RegExp(e,t);Cy.code="new RegExp";var NI=["removeAdditional","useDefaults","coerceTypes"],RI=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),ZI={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."},CI={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Dy=200;function AI(e){var t,r,n,o,i,a,s,c,u,l,d,f,p,m,g,y,_,k,x,N,D,dt,pt,Ps,js;let zn=e.strict,Ts=(t=e.code)===null||t===void 0?void 0:t.optimize,Nf=Ts===!0||Ts===void 0?1:Ts||0,Rf=(n=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Cy,h$=(o=e.uriResolver)!==null&&o!==void 0?o:DI.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:zn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:zn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=e.strictTypes)!==null&&u!==void 0?u:zn)!==null&&l!==void 0?l:"log",strictTuples:(f=(d=e.strictTuples)!==null&&d!==void 0?d:zn)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=e.strictRequired)!==null&&p!==void 0?p:zn)!==null&&m!==void 0?m:!1,code:e.code?{...e.code,optimize:Nf,regExp:Rf}:{optimize:Nf,regExp:Rf},loopRequired:(g=e.loopRequired)!==null&&g!==void 0?g:Dy,loopEnum:(y=e.loopEnum)!==null&&y!==void 0?y:Dy,meta:(_=e.meta)!==null&&_!==void 0?_:!0,messages:(k=e.messages)!==null&&k!==void 0?k:!0,inlineRefs:(x=e.inlineRefs)!==null&&x!==void 0?x:!0,schemaId:(N=e.schemaId)!==null&&N!==void 0?N:"$id",addUsedSchema:(D=e.addUsedSchema)!==null&&D!==void 0?D:!0,validateSchema:(dt=e.validateSchema)!==null&&dt!==void 0?dt:!0,validateFormats:(pt=e.validateFormats)!==null&&pt!==void 0?pt:!0,unicodeRegExp:(Ps=e.unicodeRegExp)!==null&&Ps!==void 0?Ps:!0,int32range:(js=e.int32range)!==null&&js!==void 0?js:!0,uriResolver:h$}}var ni=class{constructor(t={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,t=this.opts={...t,...AI(t)};let{es5:r,lines:n}=this.opts.code;this.scope=new OI.ValueScope({scope:{},prefixes:RI,es5:r,lines:n}),this.logger=VI(t.logger);let o=t.validateFormats;t.validateFormats=!1,this.RULES=(0,EI.getRules)(),Ny.call(this,ZI,t,"NOT SUPPORTED"),Ny.call(this,CI,t,"DEPRECATED","warn"),this._metaOpts=qI.call(this),t.formats&&MI.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),t.keywords&&FI.call(this,t.keywords),typeof t.meta=="object"&&this.addMetaSchema(t.meta),UI.call(this),t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:t,meta:r,schemaId:n}=this.opts,o=Oy;n==="id"&&(o={...Oy},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 Zy.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,ri.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=Ry.call(this,t))=="string";)t=r;if(r===void 0){let{schemaId:n}=this.opts,o=new ti.SchemaEnv({schema:{},schemaId:n});if(r=ti.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=Ry.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,ri.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(KI.call(this,n,r),!r)return(0,Op.eachItem)(n,i=>Ep.call(this,i)),this;BI.call(this,r);let o={...r,type:(0,as.getJSONTypes)(r.type),schemaType:(0,as.getJSONTypes)(r.schemaType)};return(0,Op.eachItem)(n,o.type.length===0?i=>Ep.call(this,i,o):i=>o.type.forEach(a=>Ep.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]=Ay(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,ri.normalizeId)(a||n);let u=ri.getSchemaRefs.call(this,t,n);return c=new ti.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):ti.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{ti.compileSchema.call(this,t)}finally{this.opts=r}}};ni.ValidationError=TI.default;ni.MissingRefError=Zy.default;Ie.default=ni;function Ny(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 Ry(e){return e=(0,ri.normalizeId)(e),this.schemas[e]||this.refs[e]}function UI(){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 MI(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function FI(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 qI(){let e={...this.opts};for(let t of NI)delete e[t];return e}var LI={log(){},warn(){},error(){}};function VI(e){if(e===!1)return LI;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 JI=/^[a-z_$][a-z0-9_$:-]*$/i;function KI(e,t){let{RULES:r}=this;if((0,Op.eachItem)(e,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!JI.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 Ep(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,as.getJSONTypes)(t.type),schemaType:(0,as.getJSONTypes)(t.schemaType)}};t.before?HI.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 HI(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 BI(e){let{metaSchema:t}=e;t!==void 0&&(e.$data&&this.opts.$data&&(t=Ay(t)),e.validateSchema=this.compile(t,!0))}var WI={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ay(e){return{anyOf:[e,WI]}}});var My=z(Dp=>{"use strict";Object.defineProperty(Dp,"__esModule",{value:!0});var GI={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Dp.default=GI});var Vy=z(Tr=>{"use strict";Object.defineProperty(Tr,"__esModule",{value:!0});Tr.callRef=Tr.getValidate=void 0;var XI=Xo(),Fy=ct(),Be=W(),gn=Lt(),qy=Qa(),ss=re(),YI={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=qy.resolveRef.call(c,u,o,r);if(l===void 0)throw new XI.default(n.opts.uriResolver,o,r);if(l instanceof qy.SchemaEnv)return f(l);return p(l);function d(){if(i===u)return cs(e,a,i,i.$async);let m=t.scopeValue("root",{ref:u});return cs(e,(0,Be._)`${m}.validate`,u,u.$async)}function f(m){let g=Ly(e,m);cs(e,g,m,m.$async)}function p(m){let g=t.scopeValue("schema",s.code.source===!0?{ref:m,code:(0,Be.stringify)(m)}:{ref:m}),y=t.name("valid"),_=e.subschema({schema:m,dataTypes:[],schemaPath:Be.nil,topSchemaRef:g,errSchemaPath:r},y);e.mergeEvaluated(_),e.ok(y)}}};function Ly(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,Be._)`${r.scopeValue("wrapper",{ref:t})}.validate`}Tr.getValidate=Ly;function cs(e,t,r,n){let{gen:o,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?gn.default.this:Be.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,Be._)`await ${(0,Fy.callValidateCode)(e,t,u)}`),p(t),a||o.assign(m,!0)},g=>{o.if((0,Be._)`!(${g} instanceof ${i.ValidationError})`,()=>o.throw(g)),f(g),a||o.assign(m,!1)}),e.ok(m)}function d(){e.result((0,Fy.callValidateCode)(e,t,u),()=>p(t),()=>f(t))}function f(m){let g=(0,Be._)`${m}.errors`;o.assign(gn.default.vErrors,(0,Be._)`${gn.default.vErrors} === null ? ${g} : ${gn.default.vErrors}.concat(${g})`),o.assign(gn.default.errors,(0,Be._)`${gn.default.vErrors}.length`)}function p(m){var g;if(!i.opts.unevaluated)return;let y=(g=r?.validate)===null||g===void 0?void 0:g.evaluated;if(i.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(i.props=ss.mergeEvaluated.props(o,y.props,i.props));else{let _=o.var("props",(0,Be._)`${m}.evaluated.props`);i.props=ss.mergeEvaluated.props(o,_,i.props,Be.Name)}if(i.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(i.items=ss.mergeEvaluated.items(o,y.items,i.items));else{let _=o.var("items",(0,Be._)`${m}.evaluated.items`);i.items=ss.mergeEvaluated.items(o,_,i.items,Be.Name)}}}Tr.callRef=cs;Tr.default=YI});var Jy=z(Np=>{"use strict";Object.defineProperty(Np,"__esModule",{value:!0});var QI=My(),eP=Vy(),tP=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",QI.default,eP.default];Np.default=tP});var Ky=z(Rp=>{"use strict";Object.defineProperty(Rp,"__esModule",{value:!0});var us=W(),ur=us.operators,ls={maximum:{okStr:"<=",ok:ur.LTE,fail:ur.GT},minimum:{okStr:">=",ok:ur.GTE,fail:ur.LT},exclusiveMaximum:{okStr:"<",ok:ur.LT,fail:ur.GTE},exclusiveMinimum:{okStr:">",ok:ur.GT,fail:ur.LTE}},rP={message:({keyword:e,schemaCode:t})=>(0,us.str)`must be ${ls[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,us._)`{comparison: ${ls[e].okStr}, limit: ${t}}`},nP={keyword:Object.keys(ls),type:"number",schemaType:"number",$data:!0,error:rP,code(e){let{keyword:t,data:r,schemaCode:n}=e;e.fail$data((0,us._)`${r} ${ls[t].fail} ${n} || isNaN(${r})`)}};Rp.default=nP});var Hy=z(Zp=>{"use strict";Object.defineProperty(Zp,"__esModule",{value:!0});var oi=W(),oP={message:({schemaCode:e})=>(0,oi.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,oi._)`{multipleOf: ${e}}`},iP={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:oP,code(e){let{gen:t,data:r,schemaCode:n,it:o}=e,i=o.opts.multipleOfPrecision,a=t.let("res"),s=i?(0,oi._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,oi._)`${a} !== parseInt(${a})`;e.fail$data((0,oi._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};Zp.default=iP});var Wy=z(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});function By(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}Cp.default=By;By.code='require("ajv/dist/runtime/ucs2length").default'});var Gy=z(Ap=>{"use strict";Object.defineProperty(Ap,"__esModule",{value:!0});var Er=W(),aP=re(),sP=Wy(),cP={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return(0,Er.str)`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>(0,Er._)`{limit: ${e}}`},uP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:cP,code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,i=t==="maxLength"?Er.operators.GT:Er.operators.LT,a=o.opts.unicode===!1?(0,Er._)`${r}.length`:(0,Er._)`${(0,aP.useFunc)(e.gen,sP.default)}(${r})`;e.fail$data((0,Er._)`${a} ${i} ${n}`)}};Ap.default=uP});var Xy=z(Up=>{"use strict";Object.defineProperty(Up,"__esModule",{value:!0});var lP=ct(),dP=re(),vn=W(),pP={message:({schemaCode:e})=>(0,vn.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,vn._)`{pattern: ${e}}`},fP={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:pP,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,vn._)`new RegExp`:(0,dP.useFunc)(t,c),l=t.let("valid");t.try(()=>t.assign(l,(0,vn._)`${u}(${i}, ${s}).test(${r})`),()=>t.assign(l,!1)),e.fail$data((0,vn._)`!${l}`)}else{let c=(0,lP.usePattern)(e,o);e.fail$data((0,vn._)`!${c}.test(${r})`)}}};Up.default=fP});var Yy=z(Mp=>{"use strict";Object.defineProperty(Mp,"__esModule",{value:!0});var ii=W(),mP={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return(0,ii.str)`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>(0,ii._)`{limit: ${e}}`},hP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:mP,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxProperties"?ii.operators.GT:ii.operators.LT;e.fail$data((0,ii._)`Object.keys(${r}).length ${o} ${n}`)}};Mp.default=hP});var Qy=z(Fp=>{"use strict";Object.defineProperty(Fp,"__esModule",{value:!0});var ai=ct(),si=W(),gP=re(),vP={message:({params:{missingProperty:e}})=>(0,si.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,si._)`{missingProperty: ${e}}`},yP={keyword:"required",type:"object",schemaType:"array",$data:!0,error:vP,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 g of r)if(p?.[g]===void 0&&!m.has(g)){let y=a.schemaEnv.baseId+a.errSchemaPath,_=`required property "${g}" is not defined at "${y}" (strictRequired)`;(0,gP.checkStrictMode)(a,_,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(si.nil,d);else for(let p of r)(0,ai.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,ai.checkMissingProp)(e,r,p)),(0,ai.reportMissingProp)(e,p),t.else()}function d(){t.forOf("prop",n,p=>{e.setParams({missingProperty:p}),t.if((0,ai.noPropertyInData)(t,o,p,s.ownProperties),()=>e.error())})}function f(p,m){e.setParams({missingProperty:p}),t.forOf(p,n,()=>{t.assign(m,(0,ai.propertyInData)(t,o,p,s.ownProperties)),t.if((0,si.not)(m),()=>{e.error(),t.break()})},si.nil)}}};Fp.default=yP});var e_=z(qp=>{"use strict";Object.defineProperty(qp,"__esModule",{value:!0});var ci=W(),_P={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return(0,ci.str)`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>(0,ci._)`{limit: ${e}}`},$P={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:_P,code(e){let{keyword:t,data:r,schemaCode:n}=e,o=t==="maxItems"?ci.operators.GT:ci.operators.LT;e.fail$data((0,ci._)`${r}.length ${o} ${n}`)}};qp.default=$P});var ds=z(Lp=>{"use strict";Object.defineProperty(Lp,"__esModule",{value:!0});var t_=op();t_.code='require("ajv/dist/runtime/equal").default';Lp.default=t_});var r_=z(Jp=>{"use strict";Object.defineProperty(Jp,"__esModule",{value:!0});var Vp=Ko(),Pe=W(),bP=re(),xP=ds(),kP={message:({params:{i:e,j:t}})=>(0,Pe.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,Pe._)`{i: ${e}, j: ${t}}`},wP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:kP,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,Vp.getSchemaTypes)(i.items):[];e.block$data(c,l,(0,Pe._)`${a} === false`),e.ok(c);function l(){let m=t.let("i",(0,Pe._)`${r}.length`),g=t.let("j");e.setParams({i:m,j:g}),t.assign(c,!0),t.if((0,Pe._)`${m} > 1`,()=>(d()?f:p)(m,g))}function d(){return u.length>0&&!u.some(m=>m==="object"||m==="array")}function f(m,g){let y=t.name("item"),_=(0,Vp.checkDataTypes)(u,y,s.opts.strictNumbers,Vp.DataType.Wrong),k=t.const("indices",(0,Pe._)`{}`);t.for((0,Pe._)`;${m}--;`,()=>{t.let(y,(0,Pe._)`${r}[${m}]`),t.if(_,(0,Pe._)`continue`),u.length>1&&t.if((0,Pe._)`typeof ${y} == "string"`,(0,Pe._)`${y} += "_"`),t.if((0,Pe._)`typeof ${k}[${y}] == "number"`,()=>{t.assign(g,(0,Pe._)`${k}[${y}]`),e.error(),t.assign(c,!1).break()}).code((0,Pe._)`${k}[${y}] = ${m}`)})}function p(m,g){let y=(0,bP.useFunc)(t,xP.default),_=t.name("outer");t.label(_).for((0,Pe._)`;${m}--;`,()=>t.for((0,Pe._)`${g} = ${m}; ${g}--;`,()=>t.if((0,Pe._)`${y}(${r}[${m}], ${r}[${g}])`,()=>{e.error(),t.assign(c,!1).break(_)})))}}};Jp.default=wP});var n_=z(Hp=>{"use strict";Object.defineProperty(Hp,"__esModule",{value:!0});var Kp=W(),SP=re(),zP=ds(),IP={message:"must be equal to constant",params:({schemaCode:e})=>(0,Kp._)`{allowedValue: ${e}}`},PP={keyword:"const",$data:!0,error:IP,code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:i}=e;n||i&&typeof i=="object"?e.fail$data((0,Kp._)`!${(0,SP.useFunc)(t,zP.default)}(${r}, ${o})`):e.fail((0,Kp._)`${i} !== ${r}`)}};Hp.default=PP});var o_=z(Bp=>{"use strict";Object.defineProperty(Bp,"__esModule",{value:!0});var ui=W(),jP=re(),TP=ds(),EP={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,ui._)`{allowedValues: ${e}}`},OP={keyword:"enum",schemaType:"array",$data:!0,error:EP,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,jP.useFunc)(t,TP.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,ui.or)(...o.map((m,g)=>f(p,g)))}e.pass(l);function d(){t.assign(l,!1),t.forOf("v",i,p=>t.if((0,ui._)`${u()}(${r}, ${p})`,()=>t.assign(l,!0).break()))}function f(p,m){let g=o[m];return typeof g=="object"&&g!==null?(0,ui._)`${u()}(${r}, ${p}[${m}])`:(0,ui._)`${r} === ${g}`}}};Bp.default=OP});var i_=z(Wp=>{"use strict";Object.defineProperty(Wp,"__esModule",{value:!0});var DP=Ky(),NP=Hy(),RP=Gy(),ZP=Xy(),CP=Yy(),AP=Qy(),UP=e_(),MP=r_(),FP=n_(),qP=o_(),LP=[DP.default,NP.default,RP.default,ZP.default,CP.default,AP.default,UP.default,MP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},FP.default,qP.default];Wp.default=LP});var Xp=z(li=>{"use strict";Object.defineProperty(li,"__esModule",{value:!0});li.validateAdditionalItems=void 0;var Or=W(),Gp=re(),VP={message:({params:{len:e}})=>(0,Or.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,Or._)`{limit: ${e}}`},JP={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:VP,code(e){let{parentSchema:t,it:r}=e,{items:n}=t;if(!Array.isArray(n)){(0,Gp.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}a_(e,n)}};function a_(e,t){let{gen:r,schema:n,data:o,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",(0,Or._)`${o}.length`);if(n===!1)e.setParams({len:t.length}),e.pass((0,Or._)`${s} <= ${t.length}`);else if(typeof n=="object"&&!(0,Gp.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,Or._)`${s} <= ${t.length}`);r.if((0,Or.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,l=>{e.subschema({keyword:i,dataProp:l,dataPropType:Gp.Type.Num},u),a.allErrors||r.if((0,Or.not)(u),()=>r.break())})}}li.validateAdditionalItems=a_;li.default=JP});var Yp=z(di=>{"use strict";Object.defineProperty(di,"__esModule",{value:!0});di.validateTuple=void 0;var s_=W(),ps=re(),KP=ct(),HP={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return c_(e,"additionalItems",t);r.items=!0,!(0,ps.alwaysValidSchema)(r,t)&&e.ok((0,KP.validateArray)(e))}};function c_(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=ps.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,s_._)`${i}.length`);r.forEach((d,f)=>{(0,ps.alwaysValidSchema)(s,d)||(n.if((0,s_._)`${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,g=m===d.minItems&&(m===d.maxItems||d[t]===!1);if(f.strictTuples&&!g){let y=`"${a}" is ${m}-tuple, but minItems or maxItems/${t} are not specified or different at path "${p}"`;(0,ps.checkStrictMode)(s,y,f.strictTuples)}}}di.validateTuple=c_;di.default=HP});var u_=z(Qp=>{"use strict";Object.defineProperty(Qp,"__esModule",{value:!0});var BP=Yp(),WP={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,BP.validateTuple)(e,"items")};Qp.default=WP});var d_=z(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});var l_=W(),GP=re(),XP=ct(),YP=Xp(),QP={message:({params:{len:e}})=>(0,l_.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,l_._)`{limit: ${e}}`},ej={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:QP,code(e){let{schema:t,parentSchema:r,it:n}=e,{prefixItems:o}=r;n.items=!0,!(0,GP.alwaysValidSchema)(n,t)&&(o?(0,YP.validateAdditionalItems)(e,o):e.ok((0,XP.validateArray)(e)))}};ef.default=ej});var p_=z(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});var lt=W(),fs=re(),tj={message:({params:{min:e,max:t}})=>t===void 0?(0,lt.str)`must contain at least ${e} valid item(s)`:(0,lt.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?(0,lt._)`{minContains: ${e}}`:(0,lt._)`{minContains: ${e}, maxContains: ${t}}`},rj={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:tj,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,lt._)`${o}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,fs.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,fs.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,fs.alwaysValidSchema)(i,r)){let g=(0,lt._)`${l} >= ${a}`;s!==void 0&&(g=(0,lt._)`${g} && ${l} <= ${s}`),e.pass(g);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,lt._)`${o}.length > 0`,f)):(t.let(d,!1),f()),e.result(d,()=>e.reset());function f(){let g=t.name("_valid"),y=t.let("count",0);p(g,()=>t.if(g,()=>m(y)))}function p(g,y){t.forRange("i",0,l,_=>{e.subschema({keyword:"contains",dataProp:_,dataPropType:fs.Type.Num,compositeRule:!0},g),y()})}function m(g){t.code((0,lt._)`${g}++`),s===void 0?t.if((0,lt._)`${g} >= ${a}`,()=>t.assign(d,!0).break()):(t.if((0,lt._)`${g} > ${s}`,()=>t.assign(d,!1).break()),a===1?t.assign(d,!0):t.if((0,lt._)`${g} >= ${a}`,()=>t.assign(d,!0)))}}};tf.default=rj});var h_=z(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.validateSchemaDeps=It.validatePropertyDeps=It.error=void 0;var rf=W(),nj=re(),pi=ct();It.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let n=t===1?"property":"properties";return(0,rf.str)`must have ${n} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:n}})=>(0,rf._)`{property: ${e},
7
7
  missingProperty: ${n},
8
8
  depsCount: ${t},
9
- deps: ${r}}`};var tj={keyword:"dependencies",type:"object",schemaType:"object",error:It.error,code(e){let[t,r]=rj(e);f_(e,t),m_(e,r)}};function rj({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 f_(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,di.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,di.checkReportMissingProp)(e,u)}):(r.if((0,rf._)`${c} && (${(0,di.checkMissingProp)(e,s,i)})`),(0,di.reportMissingProp)(e,i),r.else())}}It.validatePropertyDeps=f_;function m_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,ej.alwaysValidSchema)(i,t[s])||(r.if((0,di.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}It.validateSchemaDeps=m_;It.default=tj});var v_=z(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var g_=G(),nj=re(),oj={message:"property name must be valid",params:({params:e})=>(0,g_._)`{propertyName: ${e.propertyName}}`},ij={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:oj,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,nj.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,g_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};nf.default=ij});var af=z(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var fs=ct(),$t=G(),aj=Lt(),ms=re(),sj={message:"must NOT have additional properties",params:({params:e})=>(0,$t._)`{additionalProperty: ${e.additionalProperty}}`},cj={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,ms.alwaysValidSchema)(a,r))return;let u=(0,fs.allSchemaProperties)(n.properties),l=(0,fs.allSchemaProperties)(n.patternProperties);d(),e.ok((0,$t._)`${i} === ${aj.default.errors}`);function d(){t.forIn("key",o,y=>{!u.length&&!l.length?h(y):t.if(f(y),()=>h(y))})}function f(y){let $;if(u.length>8){let k=(0,ms.schemaRefOrVal)(a,n.properties,"properties");$=(0,fs.isOwnProperty)(t,k,y)}else u.length?$=(0,$t.or)(...u.map(k=>(0,$t._)`${y} === ${k}`)):$=$t.nil;return l.length&&($=(0,$t.or)($,...l.map(k=>(0,$t._)`${(0,fs.usePattern)(e,k)}.test(${y})`))),(0,$t.not)($)}function p(y){t.code((0,$t._)`delete ${o}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,ms.alwaysValidSchema)(a,r)){let $=t.name("valid");c.removeAdditional==="failing"?(g(y,$,!1),t.if((0,$t.not)($),()=>{e.reset(),p(y)})):(g(y,$),s||t.if((0,$t.not)($),()=>t.break()))}}function g(y,$,k){let x={keyword:"additionalProperties",dataProp:y,dataPropType:ms.Type.Str};k===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,$)}}};of.default=cj});var $_=z(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var uj=Go(),y_=ct(),sf=re(),__=af(),lj={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&&__.default.code(new uj.KeywordCxt(i,__.default,"additionalProperties"));let a=(0,y_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=sf.mergeEvaluated.props(t,(0,sf.toHash)(a),i.props));let s=a.filter(d=>!(0,sf.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,y_.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)}}};cf.default=lj});var w_=z(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var b_=ct(),hs=G(),x_=re(),k_=re(),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,b_.allSchemaProperties)(r),c=s.filter(g=>(0,x_.alwaysValidSchema)(i,r[g]));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 hs.Name)&&(i.props=(0,k_.evaluatedPropsToName)(t,i.props));let{props:d}=i;f();function f(){for(let g of s)u&&p(g),i.allErrors?h(g):(t.var(l,!0),h(g),t.if(l))}function p(g){for(let y in u)new RegExp(g).test(y)&&(0,x_.checkStrictMode)(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function h(g){t.forIn("key",n,y=>{t.if((0,hs._)`${(0,b_.usePattern)(e,g)}.test(${y})`,()=>{let $=c.includes(g);$||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:k_.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,hs._)`${d}[${y}]`,!0):!$&&!i.allErrors&&t.if((0,hs.not)(l),()=>t.break())})})}}};uf.default=dj});var S_=z(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var pj=re(),fj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,pj.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"}};lf.default=fj});var z_=z(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var mj=ct(),hj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:mj.validateUnion,error:{message:"must match a schema in anyOf"}};df.default=hj});var I_=z(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var gs=G(),gj=re(),vj={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,gs._)`{passingSchemas: ${e.passing}}`},yj={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:vj,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,gj.alwaysValidSchema)(o,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,gs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,gs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),f&&e.mergeEvaluated(f,gs.Name)})})}}};pf.default=yj});var P_=z(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});var _j=re(),$j={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,_j.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};ff.default=$j});var E_=z(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var vs=G(),T_=re(),bj={message:({params:e})=>(0,vs.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,vs._)`{failingKeyword: ${e.ifClause}}`},xj={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:bj,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,T_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=j_(n,"then"),i=j_(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,vs.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,vs._)`${l}`):e.setParams({ifClause:l})}}}};function j_(e,t){let r=e.schema[t];return r!==void 0&&!(0,T_.alwaysValidSchema)(e,r)}mf.default=xj});var O_=z(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var kj=re(),wj={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`)}};hf.default=wj});var D_=z(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var Sj=Xp(),zj=u_(),Ij=Yp(),Pj=d_(),jj=p_(),Tj=h_(),Ej=v_(),Oj=af(),Dj=$_(),Nj=w_(),Rj=S_(),Zj=z_(),Cj=I_(),Aj=P_(),Uj=E_(),Mj=O_();function Fj(e=!1){let t=[Rj.default,Zj.default,Cj.default,Aj.default,Uj.default,Mj.default,Ej.default,Oj.default,Tj.default,Dj.default,Nj.default];return e?t.push(zj.default,Pj.default):t.push(Sj.default,Ij.default),t.push(jj.default),t}gf.default=Fj});var N_=z(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var _e=G(),qj={message:({schemaCode:e})=>(0,_e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,_e._)`{format: ${e}}`},Lj={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:qj,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 h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),g=r.const("fDef",(0,_e._)`${h}[${a}]`),y=r.let("fType"),$=r.let("format");r.if((0,_e._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,_e._)`${g}.type || "string"`).assign($,(0,_e._)`${g}.validate`),()=>r.assign(y,(0,_e._)`"string"`).assign($,g)),e.fail$data((0,_e.or)(k(),x()));function k(){return c.strictSchema===!1?_e.nil:(0,_e._)`${a} && !${$}`}function x(){let D=l.$async?(0,_e._)`(${g}.async ? await ${$}(${n}) : ${$}(${n}))`:(0,_e._)`${$}(${n})`,O=(0,_e._)`(typeof ${$} == "function" ? ${D} : ${$}.test(${n}))`;return(0,_e._)`${$} && ${$} !== true && ${y} === ${t} && !${O}`}}function p(){let h=d.formats[i];if(!h){k();return}if(h===!0)return;let[g,y,$]=x(h);g===t&&e.pass(D());function k(){if(c.strictSchema===!1){d.logger.warn(O());return}throw new Error(O());function O(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(O){let dt=O instanceof RegExp?(0,_e.regexpCode)(O):c.code.formats?(0,_e._)`${c.code.formats}${(0,_e.getProperty)(i)}`:void 0,pt=r.scopeValue("formats",{key:i,ref:O,code:dt});return typeof O=="object"&&!(O instanceof RegExp)?[O.type||"string",O.validate,(0,_e._)`${pt}.validate`]:["string",O,pt]}function D(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return(0,_e._)`await ${$}(${n})`}return typeof y=="function"?(0,_e._)`${$}(${n})`:(0,_e._)`${$}.test(${n})`}}}};vf.default=Lj});var R_=z(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var Vj=N_(),Jj=[Vj.default];yf.default=Jj});var Z_=z(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.contentVocabulary=yn.metadataVocabulary=void 0;yn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];yn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var A_=z(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Kj=Jy(),Hj=i_(),Bj=D_(),Gj=R_(),C_=Z_(),Wj=[Kj.default,Hj.default,(0,Bj.default)(),Gj.default,C_.metadataVocabulary,C_.contentVocabulary];_f.default=Wj});var M_=z(ys=>{"use strict";Object.defineProperty(ys,"__esModule",{value:!0});ys.DiscrError=void 0;var U_;(function(e){e.Tag="tag",e.Mapping="mapping"})(U_||(ys.DiscrError=U_={}))});var q_=z(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var _n=G(),$f=M_(),F_=Ya(),Xj=Wo(),Yj=re(),Qj={message:({params:{discrError:e,tagName:t}})=>e===$f.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,_n._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},eT={keyword:"discriminator",type:"object",schemaType:"object",error:Qj,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,_n._)`${r}${(0,_n.getProperty)(s)}`);t.if((0,_n._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:$f.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function l(){let p=f();t.if(!1);for(let h in p)t.elseIf((0,_n._)`${u} === ${h}`),t.assign(c,d(p[h]));t.else(),e.error(!1,{discrError:$f.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let h=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:p},h);return e.mergeEvaluated(g,_n.Name),h}function f(){var p;let h={},g=$(o),y=!0;for(let D=0;D<a.length;D++){let O=a[D];if(O?.$ref&&!(0,Yj.schemaHasRulesButRef)(O,i.self.RULES)){let pt=O.$ref;if(O=F_.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,pt),O instanceof F_.SchemaEnv&&(O=O.schema),O===void 0)throw new Xj.default(i.opts.uriResolver,i.baseId,pt)}let dt=(p=O?.properties)===null||p===void 0?void 0:p[s];if(typeof dt!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(g||$(O)),k(dt,D)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return h;function $({required:D}){return Array.isArray(D)&&D.includes(s)}function k(D,O){if(D.const)x(D.const,O);else if(D.enum)for(let dt of D.enum)x(dt,O);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function x(D,O){if(typeof D!="string"||D in h)throw new Error(`discriminator: "${s}" values must be unique strings`);h[D]=O}}}};bf.default=eT});var L_=z((pU,tT)=>{tT.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 kf=z((ve,xf)=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.MissingRefError=ve.ValidationError=ve.CodeGen=ve.Name=ve.nil=ve.stringify=ve.str=ve._=ve.KeywordCxt=ve.Ajv=void 0;var rT=Uy(),nT=A_(),oT=q_(),V_=L_(),iT=["/properties"],_s="http://json-schema.org/draft-07/schema",$n=class extends rT.default{_addVocabularies(){super._addVocabularies(),nT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(oT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(V_,iT):V_;this.addMetaSchema(t,_s,!1),this.refs["http://json-schema.org/schema"]=_s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(_s)?_s:void 0)}};ve.Ajv=$n;xf.exports=ve=$n;xf.exports.Ajv=$n;Object.defineProperty(ve,"__esModule",{value:!0});ve.default=$n;var aT=Go();Object.defineProperty(ve,"KeywordCxt",{enumerable:!0,get:function(){return aT.KeywordCxt}});var bn=G();Object.defineProperty(ve,"_",{enumerable:!0,get:function(){return bn._}});Object.defineProperty(ve,"str",{enumerable:!0,get:function(){return bn.str}});Object.defineProperty(ve,"stringify",{enumerable:!0,get:function(){return bn.stringify}});Object.defineProperty(ve,"nil",{enumerable:!0,get:function(){return bn.nil}});Object.defineProperty(ve,"Name",{enumerable:!0,get:function(){return bn.Name}});Object.defineProperty(ve,"CodeGen",{enumerable:!0,get:function(){return bn.CodeGen}});var sT=Wa();Object.defineProperty(ve,"ValidationError",{enumerable:!0,get:function(){return sT.default}});var cT=Wo();Object.defineProperty(ve,"MissingRefError",{enumerable:!0,get:function(){return cT.default}})});var Y_=z(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.formatNames=jt.fastFormats=jt.fullFormats=void 0;function Pt(e,t){return{validate:e,compare:t}}jt.fullFormats={date:Pt(B_,If),time:Pt(Sf(!0),Pf),"date-time":Pt(J_(!0),W_),"iso-time":Pt(Sf(),G_),"iso-date-time":Pt(J_(),X_),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:mT,"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:bT,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:hT,int32:{type:"number",validate:yT},int64:{type:"number",validate:_T},float:{type:"number",validate:H_},double:{type:"number",validate:H_},password:!0,binary:!0};jt.fastFormats={...jt.fullFormats,date:Pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,If),time:Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Pf),"date-time":Pt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,W_),"iso-time":Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,G_),"iso-date-time":Pt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,X_),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};jt.formatNames=Object.keys(jt.fullFormats);function uT(e){return e%4===0&&(e%100!==0||e%400===0)}var lT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,dT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B_(e){let t=lT.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&&uT(r)?29:dT[n])}function If(e,t){if(e&&t)return e>t?1:e<t?-1:0}var wf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Sf(e){return function(r){let n=wf.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 Pf(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 G_(e,t){if(!(e&&t))return;let r=wf.exec(e),n=wf.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 zf=/t|\s/i;function J_(e){let t=Sf(e);return function(n){let o=n.split(zf);return o.length===2&&B_(o[0])&&t(o[1])}}function W_(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function X_(e,t){if(!(e&&t))return;let[r,n]=e.split(zf),[o,i]=t.split(zf),a=If(r,o);if(a!==void 0)return a||Pf(n,i)}var pT=/\/|:/,fT=/^(?:[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 mT(e){return pT.test(e)&&fT.test(e)}var K_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function hT(e){return K_.lastIndex=0,K_.test(e)}var gT=-(2**31),vT=2**31-1;function yT(e){return Number.isInteger(e)&&e<=vT&&e>=gT}function _T(e){return Number.isInteger(e)}function H_(){return!0}var $T=/[^\\]\\Z/;function bT(e){if($T.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Q_=z(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.formatLimitDefinition=void 0;var xT=kf(),bt=G(),lr=bt.operators,$s={formatMaximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},formatMinimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},formatExclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},formatExclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},kT={message:({keyword:e,schemaCode:t})=>(0,bt.str)`should be ${$s[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,bt._)`{comparison: ${$s[e].okStr}, limit: ${t}}`};xn.formatLimitDefinition={keyword:Object.keys($s),type:"string",schemaType:"string",$data:!0,error:kT,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 xT.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,bt._)`${f}[${c.schemaCode}]`);e.fail$data((0,bt.or)((0,bt._)`typeof ${p} != "object"`,(0,bt._)`${p} instanceof RegExp`,(0,bt._)`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 h=t.scopeValue("formats",{key:f,ref:p,code:a.code.formats?(0,bt._)`${a.code.formats}${(0,bt.getProperty)(f)}`:void 0});e.fail$data(d(h))}function d(f){return(0,bt._)`${f}.compare(${r}, ${n}) ${$s[o].fail} 0`}},dependencies:["format"]};var wT=e=>(e.addKeyword(xn.formatLimitDefinition),e);xn.default=wT});var n$=z((pi,r$)=>{"use strict";Object.defineProperty(pi,"__esModule",{value:!0});var kn=Y_(),ST=Q_(),jf=G(),e$=new jf.Name("fullFormats"),zT=new jf.Name("fastFormats"),Tf=(e,t={keywords:!0})=>{if(Array.isArray(t))return t$(e,t,kn.fullFormats,e$),e;let[r,n]=t.mode==="fast"?[kn.fastFormats,zT]:[kn.fullFormats,e$],o=t.formats||kn.formatNames;return t$(e,o,r,n),t.keywords&&(0,ST.default)(e),e};Tf.get=(e,t="full")=>{let n=(t==="fast"?kn.fastFormats:kn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function t$(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,jf._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}r$.exports=pi=Tf;Object.defineProperty(pi,"__esModule",{value:!0});pi.default=Tf});var tt=ft(require("path")),d$=ft(require("fs"));var ee;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(ee||(ee={}));var Zf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Zf||(Zf={}));var I=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Et=e=>{switch(typeof e){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(e)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(e)?I.array:e===null?I.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?I.promise:typeof Map<"u"&&e instanceof Map?I.map:typeof Set<"u"&&e instanceof Set?I.set:typeof Date<"u"&&e instanceof Date?I.date:I.object;default:return I.unknown}};var _=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 Ge=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()}};Ge.create=e=>new Ge(e);var _$=(e,t)=>{let r;switch(e.code){case _.invalid_type:e.received===I.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case _.invalid_arguments:r="Invalid function arguments";break;case _.invalid_return_type:r="Invalid function return type";break;case _.invalid_date:r="Invalid date";break;case _.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 _.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 _.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 _.custom:r="Invalid input";break;case _.invalid_intersection_types:r="Intersection results could not be merged";break;case _.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},Jt=_$;var $$=Jt;function In(){return $$}var hi=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 w(e,t){let r=In(),n=hi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Jt?void 0:Jt].filter(o=>!!o)});e.common.issues.push(n)}var Te=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return U;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 U;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}}},U=Object.freeze({status:"aborted"}),Dr=e=>({status:"dirty",value:e}),Ce=e=>({status:"valid",value:e}),Os=e=>e.status==="aborted",Ds=e=>e.status==="dirty",pr=e=>e.status==="valid",Pn=e=>typeof Promise<"u"&&e instanceof Promise;var j;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(j||(j={}));var rt=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}},Cf=(e,t)=>{if(pr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ge(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 W=class{get description(){return this._def.description}_getType(t){return Et(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Te,ctx:{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(Pn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Cf(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return pr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>pr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(Pn(o)?o:Promise.resolve(o));return Cf(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:_.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new ht({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return mt.create(this,this._def)}nullable(){return Nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ht.create(this)}promise(){return fr.create(this,this._def)}or(t){return Ar.create([this,t],this._def)}and(t){return Ur.create(this,t,this._def)}transform(t){return new ht({...J(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Vr({...J(this._def),innerType:this,defaultValue:r,typeName:R.ZodDefault})}brand(){return new gi({typeName:R.ZodBranded,type:this,...J(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Jr({...J(this._def),innerType:this,catchValue:r,typeName:R.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return vi.create(this,t)}readonly(){return Kr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},b$=/^c[^\s-]{8,}$/i,x$=/^[0-9a-z]+$/,k$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,w$=/^[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,S$=/^[a-z0-9_-]{21}$/i,z$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,I$=/^[-+]?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)?)??$/,P$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,j$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ns,T$=/^(?:(?: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])$/,E$=/^(?:(?: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])$/,O$=/^(([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]))$/,D$=/^(([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])$/,N$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,R$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Af="((\\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])))",Z$=new RegExp(`^${Af}$`);function Uf(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 C$(e){return new RegExp(`^${Uf(e)}$`)}function A$(e){let t=`${Af}T${Uf(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 U$(e,t){return!!((t==="v4"||!t)&&T$.test(e)||(t==="v6"||!t)&&O$.test(e))}function M$(e,t){if(!z$.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 F$(e,t){return!!((t==="v4"||!t)&&E$.test(e)||(t==="v6"||!t)&&D$.test(e))}var Rr=class e extends W{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==I.string){let i=this._getOrReturnCtx(t);return w(i,{code:_.invalid_type,expected:I.string,received:i.parsedType}),U}let n=new Te,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:_.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),w(o,{code:_.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?w(o,{code:_.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&w(o,{code:_.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")P$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"email",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ns||(Ns=new RegExp(j$,"u")),Ns.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"emoji",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")w$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"uuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")S$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"nanoid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")b$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")x$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid2",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")k$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ulid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),w(o,{validation:"url",code:_.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),w(o,{validation:"regex",code:_.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),w(o,{code:_.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),w(o,{code:_.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?A$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Z$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?C$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:_.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?I$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"duration",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?U$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ip",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?M$(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"jwt",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?F$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cidr",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?N$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?R$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64url",code:_.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:_.invalid_string,...j.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...j.errToObj(t)})}url(t){return this._addCheck({kind:"url",...j.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...j.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...j.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...j.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...j.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...j.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...j.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...j.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...j.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...j.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...j.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...j.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,...j.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,...j.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...j.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...j.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...j.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...j.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...j.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...j.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...j.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...j.errToObj(r)})}nonempty(t){return this.min(1,j.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}};Rr.create=e=>new Rr({checks:[],typeName:R.ZodString,coerce:e?.coerce??!1,...J(e)});function q$(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 jn=class e extends W{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)!==I.number){let i=this._getOrReturnCtx(t);return w(i,{code:_.invalid_type,expected:I.number,received:i.parsedType}),U}let n,o=new Te;for(let i of this._def.checks)i.kind==="int"?ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),w(n,{code:_.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),w(n,{code:_.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),w(n,{code:_.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?q$(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),w(n,{code:_.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),w(n,{code:_.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,j.toString(r))}gt(t,r){return this.setLimit("min",t,!1,j.toString(r))}lte(t,r){return this.setLimit("max",t,!0,j.toString(r))}lt(t,r){return this.setLimit("max",t,!1,j.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:j.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:j.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:j.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:j.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j.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)}};jn.create=e=>new jn({checks:[],typeName:R.ZodNumber,coerce:e?.coerce||!1,...J(e)});var Tn=class e extends W{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)!==I.bigint)return this._getInvalidInput(t);let n,o=new Te;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:_.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),w(n,{code:_.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),w(n,{code:_.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 w(r,{code:_.invalid_type,expected:I.bigint,received:r.parsedType}),U}gte(t,r){return this.setLimit("min",t,!0,j.toString(r))}gt(t,r){return this.setLimit("min",t,!1,j.toString(r))}lte(t,r){return this.setLimit("max",t,!0,j.toString(r))}lt(t,r){return this.setLimit("max",t,!1,j.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:j.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:j.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:j.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}};Tn.create=e=>new Tn({checks:[],typeName:R.ZodBigInt,coerce:e?.coerce??!1,...J(e)});var En=class extends W{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==I.boolean){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.boolean,received:n.parsedType}),U}return Ce(t.data)}};En.create=e=>new En({typeName:R.ZodBoolean,coerce:e?.coerce||!1,...J(e)});var On=class e extends W{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==I.date){let i=this._getOrReturnCtx(t);return w(i,{code:_.invalid_type,expected:I.date,received:i.parsedType}),U}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return w(i,{code:_.invalid_date}),U}let n=new Te,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:_.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),w(o,{code:_.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:j.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:j.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}};On.create=e=>new On({checks:[],coerce:e?.coerce||!1,typeName:R.ZodDate,...J(e)});var Dn=class extends W{_parse(t){if(this._getType(t)!==I.symbol){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.symbol,received:n.parsedType}),U}return Ce(t.data)}};Dn.create=e=>new Dn({typeName:R.ZodSymbol,...J(e)});var Zr=class extends W{_parse(t){if(this._getType(t)!==I.undefined){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.undefined,received:n.parsedType}),U}return Ce(t.data)}};Zr.create=e=>new Zr({typeName:R.ZodUndefined,...J(e)});var Cr=class extends W{_parse(t){if(this._getType(t)!==I.null){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.null,received:n.parsedType}),U}return Ce(t.data)}};Cr.create=e=>new Cr({typeName:R.ZodNull,...J(e)});var Nn=class extends W{constructor(){super(...arguments),this._any=!0}_parse(t){return Ce(t.data)}};Nn.create=e=>new Nn({typeName:R.ZodAny,...J(e)});var Kt=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ce(t.data)}};Kt.create=e=>new Kt({typeName:R.ZodUnknown,...J(e)});var xt=class extends W{_parse(t){let r=this._getOrReturnCtx(t);return w(r,{code:_.invalid_type,expected:I.never,received:r.parsedType}),U}};xt.create=e=>new xt({typeName:R.ZodNever,...J(e)});var Rn=class extends W{_parse(t){if(this._getType(t)!==I.undefined){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.void,received:n.parsedType}),U}return Ce(t.data)}};Rn.create=e=>new Rn({typeName:R.ZodVoid,...J(e)});var Ht=class e extends W{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==I.array)return w(r,{code:_.invalid_type,expected:I.array,received:r.parsedType}),U;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(w(r,{code:a?_.too_big:_.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&&(w(r,{code:_.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&&(w(r,{code:_.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 rt(r,a,r.path,s)))).then(a=>Te.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new rt(r,a,r.path,s)));return Te.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:j.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:j.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:j.toString(r)}})}nonempty(t){return this.min(1,t)}};Ht.create=(e,t)=>new Ht({type:e,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...J(t)});function Nr(e){if(e instanceof We){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=mt.create(Nr(n))}return new We({...e._def,shape:()=>t})}else return e instanceof Ht?new Ht({...e._def,type:Nr(e.element)}):e instanceof mt?mt.create(Nr(e.unwrap())):e instanceof Nt?Nt.create(Nr(e.unwrap())):e instanceof Dt?Dt.create(e.items.map(t=>Nr(t))):e}var We=class e extends W{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)!==I.object){let u=this._getOrReturnCtx(t);return w(u,{code:_.invalid_type,expected:I.object,received:u.parsedType}),U}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new rt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof xt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(w(o,{code:_.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 rt(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=>Te.mergeObjectSync(n,u)):Te.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return j.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:j.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:R.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 Nr(this)}partial(t){let r={};for(let n of ee.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ee.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof mt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Mf(ee.objectKeys(this.shape))}};We.create=(e,t)=>new We({shape:()=>e,unknownKeys:"strip",catchall:xt.create(),typeName:R.ZodObject,...J(t)});We.strictCreate=(e,t)=>new We({shape:()=>e,unknownKeys:"strict",catchall:xt.create(),typeName:R.ZodObject,...J(t)});We.lazycreate=(e,t)=>new We({shape:e,unknownKeys:"strip",catchall:xt.create(),typeName:R.ZodObject,...J(t)});var Ar=class extends W{_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 Ge(s.ctx.common.issues));return w(r,{code:_.invalid_union,unionErrors:a}),U}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 Ge(c));return w(r,{code:_.invalid_union,unionErrors:s}),U}}get options(){return this._def.options}};Ar.create=(e,t)=>new Ar({options:e,typeName:R.ZodUnion,...J(t)});var Ot=e=>e instanceof Mr?Ot(e.schema):e instanceof ht?Ot(e.innerType()):e instanceof Fr?[e.value]:e instanceof qr?e.options:e instanceof Lr?ee.objectValues(e.enum):e instanceof Vr?Ot(e._def.innerType):e instanceof Zr?[void 0]:e instanceof Cr?[null]:e instanceof mt?[void 0,...Ot(e.unwrap())]:e instanceof Nt?[null,...Ot(e.unwrap())]:e instanceof gi||e instanceof Kr?Ot(e.unwrap()):e instanceof Jr?Ot(e._def.innerType):[],Rs=class e extends W{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.object)return w(r,{code:_.invalid_type,expected:I.object,received:r.parsedType}),U;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}):(w(r,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),U)}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:R.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...J(n)})}};function Zs(e,t){let r=Et(e),n=Et(t);if(e===t)return{valid:!0,data:e};if(r===I.object&&n===I.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=Zs(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===I.array&&n===I.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=Zs(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===I.date&&n===I.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ur=class extends W{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Os(i)||Os(a))return U;let s=Zs(i.value,a.value);return s.valid?((Ds(i)||Ds(a))&&r.dirty(),{status:r.value,value:s.data}):(w(n,{code:_.invalid_intersection_types}),U)};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}))}};Ur.create=(e,t,r)=>new Ur({left:e,right:t,typeName:R.ZodIntersection,...J(r)});var Dt=class e extends W{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.array)return w(n,{code:_.invalid_type,expected:I.array,received:n.parsedType}),U;if(n.data.length<this._def.items.length)return w(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&n.data.length>this._def.items.length&&(w(n,{code:_.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 rt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Te.mergeArray(r,a)):Te.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Dt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:e,typeName:R.ZodTuple,rest:null,...J(t)})};var Cs=class e extends W{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!==I.object)return w(n,{code:_.invalid_type,expected:I.object,received:n.parsedType}),U;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new rt(n,s,n.path,s)),value:a._parse(new rt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Te.mergeObjectAsync(r,o):Te.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof W?new e({keyType:t,valueType:r,typeName:R.ZodRecord,...J(n)}):new e({keyType:Rr.create(),valueType:t,typeName:R.ZodRecord,...J(r)})}},Zn=class extends W{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!==I.map)return w(n,{code:_.invalid_type,expected:I.map,received:n.parsedType}),U;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new rt(n,s,n.path,[u,"key"])),value:i._parse(new rt(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 U;(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 U;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Zn.create=(e,t,r)=>new Zn({valueType:t,keyType:e,typeName:R.ZodMap,...J(r)});var Cn=class e extends W{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.set)return w(n,{code:_.invalid_type,expected:I.set,received:n.parsedType}),U;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(w(n,{code:_.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&&(w(n,{code:_.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 U;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 rt(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:j.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:j.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Cn.create=(e,t)=>new Cn({valueType:e,minSize:null,maxSize:null,typeName:R.ZodSet,...J(t)});var As=class e extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.function)return w(r,{code:_.invalid_type,expected:I.function,received:r.parsedType}),U;function n(s,c){return hi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,In(),Jt].filter(u=>!!u),issueData:{code:_.invalid_arguments,argumentsError:c}})}function o(s,c){return hi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,In(),Jt].filter(u=>!!u),issueData:{code:_.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof fr){let s=this;return Ce(async function(...c){let u=new Ge([]),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 Ce(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Ge([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Ge([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Dt.create(t).rest(Kt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Dt.create([]).rest(Kt.create()),returns:r||Kt.create(),typeName:R.ZodFunction,...J(n)})}},Mr=class extends W{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})}};Mr.create=(e,t)=>new Mr({getter:e,typeName:R.ZodLazy,...J(t)});var Fr=class extends W{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return w(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:t.data}}get value(){return this._def.value}};Fr.create=(e,t)=>new Fr({value:e,typeName:R.ZodLiteral,...J(t)});function Mf(e,t){return new qr({values:e,typeName:R.ZodEnum,...J(t)})}var qr=class e extends W{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return w(r,{expected:ee.joinValues(n),received:r.parsedType,code:_.invalid_type}),U}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 w(r,{received:r.data,code:_.invalid_enum_value,options:n}),U}return Ce(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})}};qr.create=Mf;var Lr=class extends W{_parse(t){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==I.string&&n.parsedType!==I.number){let o=ee.objectValues(r);return w(n,{expected:ee.joinValues(o),received:n.parsedType,code:_.invalid_type}),U}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=ee.objectValues(r);return w(n,{received:n.data,code:_.invalid_enum_value,options:o}),U}return Ce(t.data)}get enum(){return this._def.values}};Lr.create=(e,t)=>new Lr({values:e,typeName:R.ZodNativeEnum,...J(t)});var fr=class extends W{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.promise&&r.common.async===!1)return w(r,{code:_.invalid_type,expected:I.promise,received:r.parsedType}),U;let n=r.parsedType===I.promise?r.data:Promise.resolve(r.data);return Ce(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fr.create=(e,t)=>new fr({type:e,typeName:R.ZodPromise,...J(t)});var ht=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.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=>{w(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 U;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?U:c.status==="dirty"?Dr(c.value):r.value==="dirty"?Dr(c.value):c});{if(r.value==="aborted")return U;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?U:s.status==="dirty"?Dr(s.value):r.value==="dirty"?Dr(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"?U:(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"?U:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!pr(a))return U;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>pr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):U);ee.assertNever(o)}};ht.create=(e,t,r)=>new ht({schema:e,typeName:R.ZodEffects,effect:t,...J(r)});ht.createWithPreprocess=(e,t,r)=>new ht({schema:t,effect:{type:"preprocess",transform:e},typeName:R.ZodEffects,...J(r)});var mt=class extends W{_parse(t){return this._getType(t)===I.undefined?Ce(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:R.ZodOptional,...J(t)});var Nt=class extends W{_parse(t){return this._getType(t)===I.null?Ce(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:R.ZodNullable,...J(t)});var Vr=class extends W{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===I.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Vr.create=(e,t)=>new Vr({innerType:e,typeName:R.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});var Jr=class extends W{_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 Pn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ge(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ge(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:R.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});var An=class extends W{_parse(t){if(this._getType(t)!==I.nan){let n=this._getOrReturnCtx(t);return w(n,{code:_.invalid_type,expected:I.nan,received:n.parsedType}),U}return{status:"valid",value:t.data}}};An.create=e=>new An({typeName:R.ZodNaN,...J(e)});var gi=class extends W{_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}},vi=class e extends W{_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"?U:i.status==="dirty"?(r.dirty(),Dr(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"?U: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:R.ZodPipeline})}},Kr=class extends W{_parse(t){let r=this._def.innerType._parse(t),n=o=>(pr(o)&&(o.value=Object.freeze(o.value)),o);return Pn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Kr.create=(e,t)=>new Kr({innerType:e,typeName:R.ZodReadonly,...J(t)});var tE={object:We.lazycreate},R;(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"})(R||(R={}));var rE=Rr.create,nE=jn.create,oE=An.create,iE=Tn.create,aE=En.create,sE=On.create,cE=Dn.create,uE=Zr.create,lE=Cr.create,dE=Nn.create,pE=Kt.create,fE=xt.create,mE=Rn.create,hE=Ht.create,L$=We.create,gE=We.strictCreate,vE=Ar.create,yE=Rs.create,_E=Ur.create,$E=Dt.create,bE=Cs.create,xE=Zn.create,kE=Cn.create,wE=As.create,SE=Mr.create,zE=Fr.create,IE=qr.create,PE=Lr.create,jE=fr.create,TE=ht.create,EE=mt.create,OE=Nt.create,DE=ht.createWithPreprocess,NE=vi.create;var Ff=Object.freeze({status:"aborted"});function m(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 kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},mr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},yi={};function xe(e){return e&&Object.assign(yi,e),yi}var b={};zn(b,{BIGINT_FORMAT_RANGES:()=>Bs,Class:()=>Ms,NUMBER_FORMAT_RANGES:()=>Hs,aborted:()=>Xt,allowsEval:()=>Ls,assert:()=>W$,assertEqual:()=>K$,assertIs:()=>B$,assertNever:()=>G$,assertNotEqual:()=>H$,assignProp:()=>Gt,base64ToUint8Array:()=>Gf,base64urlToUint8Array:()=>sb,cached:()=>Br,captureStackTrace:()=>$i,cleanEnum:()=>ab,cleanRegex:()=>Fn,clone:()=>Ae,cloneDef:()=>Y$,createTransparentProxy:()=>ob,defineLazy:()=>K,esc:()=>_i,escapeRegex:()=>nt,extend:()=>Jf,finalizeIssue:()=>Ve,floatSafeRemainder:()=>Fs,getElementAtPath:()=>Q$,getEnumValues:()=>Mn,getLengthableOrigin:()=>Vn,getParsedType:()=>nb,getSizableOrigin:()=>Ln,hexToUint8Array:()=>ub,isObject:()=>hr,isPlainObject:()=>Wt,issue:()=>Gr,joinValues:()=>C,jsonStringifyReplacer:()=>Hr,merge:()=>ib,mergeDefs:()=>Rt,normalizeParams:()=>S,nullish:()=>Bt,numKeys:()=>rb,objectClone:()=>X$,omit:()=>Vf,optionalKeys:()=>Ks,parsedType:()=>M,partial:()=>Hf,pick:()=>Lf,prefixIssues:()=>Xe,primitiveTypes:()=>Js,promiseAllObject:()=>eb,propertyKeyTypes:()=>qn,randomString:()=>tb,required:()=>Bf,safeExtend:()=>Kf,shallowClone:()=>Vs,slugify:()=>qs,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>Wf,uint8ArrayToBase64url:()=>cb,uint8ArrayToHex:()=>lb,unwrapMessage:()=>Un});function K$(e){return e}function H$(e){return e}function B$(e){}function G$(e){throw new Error("Unexpected value in exhaustive check")}function W$(e){}function Mn(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 C(e,t="|"){return e.map(r=>A(r)).join(t)}function Hr(e,t){return typeof t=="bigint"?t.toString():t}function Br(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Bt(e){return e==null}function Fn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fs(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 X$(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 Y$(e){return Rt(e._zod.def)}function Q$(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function eb(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 tb(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function _i(e){return JSON.stringify(e)}function qs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var $i="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ls=Br(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Wt(e){if(hr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(hr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Vs(e){return Wt(e)?{...e}:Array.isArray(e)?[...e]:e}function rb(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var nb=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}`)}},qn=new Set(["string","number","symbol"]),Js=new Set(["string","number","bigint","boolean","symbol","undefined"]);function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function S(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 ob(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function A(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ks(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Hs={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]},Bs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Lf(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 Ae(e,i)}function Vf(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 Ae(e,i)}function Jf(e,t){if(!Wt(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 Ae(e,o)}function Kf(e,t){if(!Wt(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 Ae(e,r)}function ib(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 Ae(e,r)}function Hf(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 Ae(t,a)}function Bf(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 Ae(t,n)}function Xt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Xe(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Un(e){return typeof e=="string"?e:e?.message}function Ve(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Un(e.inst?._zod.def?.error?.(e))??Un(t?.error?.(e))??Un(r.customError?.(e))??Un(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Ln(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Vn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function M(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 Gr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function ab(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Gf(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 Wf(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 Gf(t+r)}function cb(e){return Wf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ub(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 lb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ms=class{constructor(...t){}};var Xf=(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,Hr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},bi=m("$ZodError",Xf),Jn=m("$ZodError",Xf,{Parent:Error});function xi(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 ki(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 Kn=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new kt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Ve(c,i,xe())));throw $i(s,o?.callee),s}return a.value},Hn=Kn(Jn),Bn=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=>Ve(c,i,xe())));throw $i(s,o?.callee),s}return a.value},Gn=Bn(Jn),Wn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new kt;return i.issues.length?{success:!1,error:new(e??bi)(i.issues.map(a=>Ve(a,o,xe())))}:{success:!0,data:i.value}},Wr=Wn(Jn),Xn=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=>Ve(a,o,xe())))}:{success:!0,data:i.value}},Yn=Xn(Jn),Yf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Kn(e)(t,r,o)};var Qf=e=>(t,r,n)=>Kn(e)(t,r,n);var em=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Bn(e)(t,r,o)};var tm=e=>async(t,r,n)=>Bn(e)(t,r,n);var rm=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Wn(e)(t,r,o)};var nm=e=>(t,r,n)=>Wn(e)(t,r,n);var om=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,o)};var im=e=>async(t,r,n)=>Xn(e)(t,r,n);var ot={};zn(ot,{base64:()=>lc,base64url:()=>wi,bigint:()=>gc,boolean:()=>yc,browserEmail:()=>_b,cidrv4:()=>cc,cidrv6:()=>uc,cuid:()=>Gs,cuid2:()=>Ws,date:()=>pc,datetime:()=>mc,domain:()=>xb,duration:()=>tc,e164:()=>dc,email:()=>nc,emoji:()=>oc,extendedDuration:()=>pb,guid:()=>rc,hex:()=>kb,hostname:()=>bb,html5Email:()=>gb,idnEmail:()=>yb,integer:()=>vc,ipv4:()=>ic,ipv6:()=>ac,ksuid:()=>Qs,lowercase:()=>bc,mac:()=>sc,md5_base64:()=>Sb,md5_base64url:()=>zb,md5_hex:()=>wb,nanoid:()=>ec,null:()=>_c,number:()=>Si,rfc5322Email:()=>vb,sha1_base64:()=>Pb,sha1_base64url:()=>jb,sha1_hex:()=>Ib,sha256_base64:()=>Eb,sha256_base64url:()=>Ob,sha256_hex:()=>Tb,sha384_base64:()=>Nb,sha384_base64url:()=>Rb,sha384_hex:()=>Db,sha512_base64:()=>Cb,sha512_base64url:()=>Ab,sha512_hex:()=>Zb,string:()=>hc,time:()=>fc,ulid:()=>Xs,undefined:()=>$c,unicodeEmail:()=>am,uppercase:()=>xc,uuid:()=>gr,uuid4:()=>fb,uuid6:()=>mb,uuid7:()=>hb,xid:()=>Ys});var Gs=/^[cC][^\s-]{8,}$/,Ws=/^[0-9a-z]+$/,Xs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ys=/^[0-9a-vA-V]{20}$/,Qs=/^[A-Za-z0-9]{27}$/,ec=/^[a-zA-Z0-9_-]{21}$/,tc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pb=/^[-+]?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)?)??$/,rc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,fb=gr(4),mb=gr(6),hb=gr(7),nc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gb=/^[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])?)*$/,vb=/^(([^<>()\[\]\\.,;:\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,}))$/,am=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,yb=am,_b=/^[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])?)*$/,$b="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function oc(){return new RegExp($b,"u")}var ic=/^(?:(?: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])$/,ac=/^(([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}|:))$/,sc=e=>{let t=nt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},cc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,uc=/^(([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])$/,lc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wi=/^[A-Za-z0-9_-]*$/,bb=/^(?=.{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])?)*\.?$/,xb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,dc=/^\+[1-9]\d{6,14}$/,sm="(?:(?:\\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])))",pc=new RegExp(`^${sm}$`);function cm(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 fc(e){return new RegExp(`^${cm(e)}$`)}function mc(e){let t=cm({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(`^${sm}T(?:${n})$`)}var hc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},gc=/^-?\d+n?$/,vc=/^-?\d+$/,Si=/^-?\d+(?:\.\d+)?$/,yc=/^(?:true|false)$/i,_c=/^null$/i;var $c=/^undefined$/i;var bc=/^[^A-Z]*$/,xc=/^[^a-z]*$/,kb=/^[0-9a-fA-F]*$/;function Qn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function eo(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var wb=/^[0-9a-fA-F]{32}$/,Sb=Qn(22,"=="),zb=eo(22),Ib=/^[0-9a-fA-F]{40}$/,Pb=Qn(27,"="),jb=eo(27),Tb=/^[0-9a-fA-F]{64}$/,Eb=Qn(43,"="),Ob=eo(43),Db=/^[0-9a-fA-F]{96}$/,Nb=Qn(64,""),Rb=eo(64),Zb=/^[0-9a-fA-F]{128}$/,Cb=Qn(86,"=="),Ab=eo(86);var ue=m("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),lm={number:"number",bigint:"bigint",object:"date"},kc=m("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let r=lm[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})}}),wc=m("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=lm[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})}}),dm=m("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Fs(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})}}),pm=m("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Hs[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=vc)}),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})}}),fm=m("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[r,n]=Bs[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})}}),mm=m("$ZodCheckMaxSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Ln(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hm=m("$ZodCheckMinSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Ln(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gm=m("$ZodCheckSizeEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Ln(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})}}),vm=m("$ZodCheckMaxLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let a=Vn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ym=m("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Vn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_m=m("$ZodCheckLengthEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Vn(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})}}),to=m("$ZodCheckStringFormat",(e,t)=>{var r,n;ue.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),$m=m("$ZodCheckRegex",(e,t)=>{to.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})}}),bm=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=bc),to.init(e,t)}),xm=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=xc),to.init(e,t)}),km=m("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let r=nt(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})}}),wm=m("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`^${nt(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})}}),Sm=m("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`.*${nt(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 um(e,t,r){e.issues.length&&t.issues.push(...Xe(r,e.issues))}var zm=m("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>um(o,r,t.property));um(n,r,t.property)}}),Im=m("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Pm=m("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var zi=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 oj={keyword:"dependencies",type:"object",schemaType:"object",error:It.error,code(e){let[t,r]=ij(e);f_(e,t),m_(e,r)}};function ij({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 f_(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,pi.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,pi.checkReportMissingProp)(e,u)}):(r.if((0,rf._)`${c} && (${(0,pi.checkMissingProp)(e,s,i)})`),(0,pi.reportMissingProp)(e,i),r.else())}}It.validatePropertyDeps=f_;function m_(e,t=e.schema){let{gen:r,data:n,keyword:o,it:i}=e,a=r.name("valid");for(let s in t)(0,nj.alwaysValidSchema)(i,t[s])||(r.if((0,pi.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:o,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a))}It.validateSchemaDeps=m_;It.default=oj});var v_=z(nf=>{"use strict";Object.defineProperty(nf,"__esModule",{value:!0});var g_=W(),aj=re(),sj={message:"property name must be valid",params:({params:e})=>(0,g_._)`{propertyName: ${e.propertyName}}`},cj={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:sj,code(e){let{gen:t,schema:r,data:n,it:o}=e;if((0,aj.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,g_.not)(i),()=>{e.error(!0),o.allErrors||t.break()})}),e.ok(i)}};nf.default=cj});var af=z(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var ms=ct(),$t=W(),uj=Lt(),hs=re(),lj={message:"must NOT have additional properties",params:({params:e})=>(0,$t._)`{additionalProperty: ${e.additionalProperty}}`},dj={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:lj,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,hs.alwaysValidSchema)(a,r))return;let u=(0,ms.allSchemaProperties)(n.properties),l=(0,ms.allSchemaProperties)(n.patternProperties);d(),e.ok((0,$t._)`${i} === ${uj.default.errors}`);function d(){t.forIn("key",o,y=>{!u.length&&!l.length?m(y):t.if(f(y),()=>m(y))})}function f(y){let _;if(u.length>8){let k=(0,hs.schemaRefOrVal)(a,n.properties,"properties");_=(0,ms.isOwnProperty)(t,k,y)}else u.length?_=(0,$t.or)(...u.map(k=>(0,$t._)`${y} === ${k}`)):_=$t.nil;return l.length&&(_=(0,$t.or)(_,...l.map(k=>(0,$t._)`${(0,ms.usePattern)(e,k)}.test(${y})`))),(0,$t.not)(_)}function p(y){t.code((0,$t._)`delete ${o}[${y}]`)}function m(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(y);return}if(r===!1){e.setParams({additionalProperty:y}),e.error(),s||t.break();return}if(typeof r=="object"&&!(0,hs.alwaysValidSchema)(a,r)){let _=t.name("valid");c.removeAdditional==="failing"?(g(y,_,!1),t.if((0,$t.not)(_),()=>{e.reset(),p(y)})):(g(y,_),s||t.if((0,$t.not)(_),()=>t.break()))}}function g(y,_,k){let x={keyword:"additionalProperties",dataProp:y,dataPropType:hs.Type.Str};k===!1&&Object.assign(x,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(x,_)}}};of.default=dj});var $_=z(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var pj=Go(),y_=ct(),sf=re(),__=af(),fj={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&&__.default.code(new pj.KeywordCxt(i,__.default,"additionalProperties"));let a=(0,y_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=sf.mergeEvaluated.props(t,(0,sf.toHash)(a),i.props));let s=a.filter(d=>!(0,sf.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,y_.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)}}};cf.default=fj});var w_=z(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var b_=ct(),gs=W(),x_=re(),k_=re(),mj={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,b_.allSchemaProperties)(r),c=s.filter(g=>(0,x_.alwaysValidSchema)(i,r[g]));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 gs.Name)&&(i.props=(0,k_.evaluatedPropsToName)(t,i.props));let{props:d}=i;f();function f(){for(let g of s)u&&p(g),i.allErrors?m(g):(t.var(l,!0),m(g),t.if(l))}function p(g){for(let y in u)new RegExp(g).test(y)&&(0,x_.checkStrictMode)(i,`property ${y} matches pattern ${g} (use allowMatchingProperties)`)}function m(g){t.forIn("key",n,y=>{t.if((0,gs._)`${(0,b_.usePattern)(e,g)}.test(${y})`,()=>{let _=c.includes(g);_||e.subschema({keyword:"patternProperties",schemaProp:g,dataProp:y,dataPropType:k_.Type.Str},l),i.opts.unevaluated&&d!==!0?t.assign((0,gs._)`${d}[${y}]`,!0):!_&&!i.allErrors&&t.if((0,gs.not)(l),()=>t.break())})})}}};uf.default=mj});var S_=z(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var hj=re(),gj={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if((0,hj.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"}};lf.default=gj});var z_=z(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var vj=ct(),yj={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:vj.validateUnion,error:{message:"must match a schema in anyOf"}};df.default=yj});var I_=z(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var vs=W(),_j=re(),$j={message:"must match exactly one schema in oneOf",params:({params:e})=>(0,vs._)`{passingSchemas: ${e.passing}}`},bj={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:$j,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,_j.alwaysValidSchema)(o,l)?t.var(c,!0):f=e.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&t.if((0,vs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,vs._)`[${s}, ${d}]`).else(),t.if(c,()=>{t.assign(a,!0),t.assign(s,d),f&&e.mergeEvaluated(f,vs.Name)})})}}};pf.default=bj});var P_=z(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});var xj=re(),kj={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,xj.alwaysValidSchema)(n,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},o);e.ok(o),e.mergeEvaluated(s)})}};ff.default=kj});var E_=z(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var ys=W(),T_=re(),wj={message:({params:e})=>(0,ys.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,ys._)`{failingKeyword: ${e.ifClause}}`},Sj={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:wj,code(e){let{gen:t,parentSchema:r,it:n}=e;r.then===void 0&&r.else===void 0&&(0,T_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=j_(n,"then"),i=j_(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,ys.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,ys._)`${l}`):e.setParams({ifClause:l})}}}};function j_(e,t){let r=e.schema[t];return r!==void 0&&!(0,T_.alwaysValidSchema)(e,r)}mf.default=Sj});var O_=z(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var zj=re(),Ij={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){t.if===void 0&&(0,zj.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};hf.default=Ij});var D_=z(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var Pj=Xp(),jj=u_(),Tj=Yp(),Ej=d_(),Oj=p_(),Dj=h_(),Nj=v_(),Rj=af(),Zj=$_(),Cj=w_(),Aj=S_(),Uj=z_(),Mj=I_(),Fj=P_(),qj=E_(),Lj=O_();function Vj(e=!1){let t=[Aj.default,Uj.default,Mj.default,Fj.default,qj.default,Lj.default,Nj.default,Rj.default,Dj.default,Zj.default,Cj.default];return e?t.push(jj.default,Ej.default):t.push(Pj.default,Tj.default),t.push(Oj.default),t}gf.default=Vj});var N_=z(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var $e=W(),Jj={message:({schemaCode:e})=>(0,$e.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,$e._)`{format: ${e}}`},Kj={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Jj,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}),g=r.const("fDef",(0,$e._)`${m}[${a}]`),y=r.let("fType"),_=r.let("format");r.if((0,$e._)`typeof ${g} == "object" && !(${g} instanceof RegExp)`,()=>r.assign(y,(0,$e._)`${g}.type || "string"`).assign(_,(0,$e._)`${g}.validate`),()=>r.assign(y,(0,$e._)`"string"`).assign(_,g)),e.fail$data((0,$e.or)(k(),x()));function k(){return c.strictSchema===!1?$e.nil:(0,$e._)`${a} && !${_}`}function x(){let N=l.$async?(0,$e._)`(${g}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,$e._)`${_}(${n})`,D=(0,$e._)`(typeof ${_} == "function" ? ${N} : ${_}.test(${n}))`;return(0,$e._)`${_} && ${_} !== true && ${y} === ${t} && !${D}`}}function p(){let m=d.formats[i];if(!m){k();return}if(m===!0)return;let[g,y,_]=x(m);g===t&&e.pass(N());function k(){if(c.strictSchema===!1){d.logger.warn(D());return}throw new Error(D());function D(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function x(D){let dt=D instanceof RegExp?(0,$e.regexpCode)(D):c.code.formats?(0,$e._)`${c.code.formats}${(0,$e.getProperty)(i)}`:void 0,pt=r.scopeValue("formats",{key:i,ref:D,code:dt});return typeof D=="object"&&!(D instanceof RegExp)?[D.type||"string",D.validate,(0,$e._)`${pt}.validate`]:["string",D,pt]}function N(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!l.$async)throw new Error("async format in sync schema");return(0,$e._)`await ${_}(${n})`}return typeof y=="function"?(0,$e._)`${_}(${n})`:(0,$e._)`${_}.test(${n})`}}}};vf.default=Kj});var R_=z(yf=>{"use strict";Object.defineProperty(yf,"__esModule",{value:!0});var Hj=N_(),Bj=[Hj.default];yf.default=Bj});var Z_=z(yn=>{"use strict";Object.defineProperty(yn,"__esModule",{value:!0});yn.contentVocabulary=yn.metadataVocabulary=void 0;yn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];yn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var A_=z(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var Wj=Jy(),Gj=i_(),Xj=D_(),Yj=R_(),C_=Z_(),Qj=[Wj.default,Gj.default,(0,Xj.default)(),Yj.default,C_.metadataVocabulary,C_.contentVocabulary];_f.default=Qj});var M_=z(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});_s.DiscrError=void 0;var U_;(function(e){e.Tag="tag",e.Mapping="mapping"})(U_||(_s.DiscrError=U_={}))});var q_=z(bf=>{"use strict";Object.defineProperty(bf,"__esModule",{value:!0});var _n=W(),$f=M_(),F_=Qa(),eT=Xo(),tT=re(),rT={message:({params:{discrError:e,tagName:t}})=>e===$f.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,_n._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},nT={keyword:"discriminator",type:"object",schemaType:"object",error:rT,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,_n._)`${r}${(0,_n.getProperty)(s)}`);t.if((0,_n._)`typeof ${u} == "string"`,()=>l(),()=>e.error(!1,{discrError:$f.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,_n._)`${u} === ${m}`),t.assign(c,d(p[m]));t.else(),e.error(!1,{discrError:$f.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function d(p){let m=t.name("valid"),g=e.subschema({keyword:"oneOf",schemaProp:p},m);return e.mergeEvaluated(g,_n.Name),m}function f(){var p;let m={},g=_(o),y=!0;for(let N=0;N<a.length;N++){let D=a[N];if(D?.$ref&&!(0,tT.schemaHasRulesButRef)(D,i.self.RULES)){let pt=D.$ref;if(D=F_.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,pt),D instanceof F_.SchemaEnv&&(D=D.schema),D===void 0)throw new eT.default(i.opts.uriResolver,i.baseId,pt)}let dt=(p=D?.properties)===null||p===void 0?void 0:p[s];if(typeof dt!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);y=y&&(g||_(D)),k(dt,N)}if(!y)throw new Error(`discriminator: "${s}" must be required`);return m;function _({required:N}){return Array.isArray(N)&&N.includes(s)}function k(N,D){if(N.const)x(N.const,D);else if(N.enum)for(let dt of N.enum)x(dt,D);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function x(N,D){if(typeof N!="string"||N in m)throw new Error(`discriminator: "${s}" values must be unique strings`);m[N]=D}}}};bf.default=nT});var L_=z((hU,oT)=>{oT.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 kf=z((ye,xf)=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.MissingRefError=ye.ValidationError=ye.CodeGen=ye.Name=ye.nil=ye.stringify=ye.str=ye._=ye.KeywordCxt=ye.Ajv=void 0;var iT=Uy(),aT=A_(),sT=q_(),V_=L_(),cT=["/properties"],$s="http://json-schema.org/draft-07/schema",$n=class extends iT.default{_addVocabularies(){super._addVocabularies(),aT.default.forEach(t=>this.addVocabulary(t)),this.opts.discriminator&&this.addKeyword(sT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let t=this.opts.$data?this.$dataMetaSchema(V_,cT):V_;this.addMetaSchema(t,$s,!1),this.refs["http://json-schema.org/schema"]=$s}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema($s)?$s:void 0)}};ye.Ajv=$n;xf.exports=ye=$n;xf.exports.Ajv=$n;Object.defineProperty(ye,"__esModule",{value:!0});ye.default=$n;var uT=Go();Object.defineProperty(ye,"KeywordCxt",{enumerable:!0,get:function(){return uT.KeywordCxt}});var bn=W();Object.defineProperty(ye,"_",{enumerable:!0,get:function(){return bn._}});Object.defineProperty(ye,"str",{enumerable:!0,get:function(){return bn.str}});Object.defineProperty(ye,"stringify",{enumerable:!0,get:function(){return bn.stringify}});Object.defineProperty(ye,"nil",{enumerable:!0,get:function(){return bn.nil}});Object.defineProperty(ye,"Name",{enumerable:!0,get:function(){return bn.Name}});Object.defineProperty(ye,"CodeGen",{enumerable:!0,get:function(){return bn.CodeGen}});var lT=Xa();Object.defineProperty(ye,"ValidationError",{enumerable:!0,get:function(){return lT.default}});var dT=Xo();Object.defineProperty(ye,"MissingRefError",{enumerable:!0,get:function(){return dT.default}})});var Y_=z(jt=>{"use strict";Object.defineProperty(jt,"__esModule",{value:!0});jt.formatNames=jt.fastFormats=jt.fullFormats=void 0;function Pt(e,t){return{validate:e,compare:t}}jt.fullFormats={date:Pt(B_,If),time:Pt(Sf(!0),Pf),"date-time":Pt(J_(!0),G_),"iso-time":Pt(Sf(),W_),"iso-date-time":Pt(J_(),X_),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:vT,"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:wT,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:yT,int32:{type:"number",validate:bT},int64:{type:"number",validate:xT},float:{type:"number",validate:H_},double:{type:"number",validate:H_},password:!0,binary:!0};jt.fastFormats={...jt.fullFormats,date:Pt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,If),time:Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Pf),"date-time":Pt(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,G_),"iso-time":Pt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,W_),"iso-date-time":Pt(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,X_),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};jt.formatNames=Object.keys(jt.fullFormats);function pT(e){return e%4===0&&(e%100!==0||e%400===0)}var fT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,mT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function B_(e){let t=fT.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&&pT(r)?29:mT[n])}function If(e,t){if(e&&t)return e>t?1:e<t?-1:0}var wf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Sf(e){return function(r){let n=wf.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 Pf(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 W_(e,t){if(!(e&&t))return;let r=wf.exec(e),n=wf.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 zf=/t|\s/i;function J_(e){let t=Sf(e);return function(n){let o=n.split(zf);return o.length===2&&B_(o[0])&&t(o[1])}}function G_(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),n=new Date(t).valueOf();if(r&&n)return r-n}function X_(e,t){if(!(e&&t))return;let[r,n]=e.split(zf),[o,i]=t.split(zf),a=If(r,o);if(a!==void 0)return a||Pf(n,i)}var hT=/\/|:/,gT=/^(?:[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 vT(e){return hT.test(e)&&gT.test(e)}var K_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function yT(e){return K_.lastIndex=0,K_.test(e)}var _T=-(2**31),$T=2**31-1;function bT(e){return Number.isInteger(e)&&e<=$T&&e>=_T}function xT(e){return Number.isInteger(e)}function H_(){return!0}var kT=/[^\\]\\Z/;function wT(e){if(kT.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}});var Q_=z(xn=>{"use strict";Object.defineProperty(xn,"__esModule",{value:!0});xn.formatLimitDefinition=void 0;var ST=kf(),bt=W(),lr=bt.operators,bs={formatMaximum:{okStr:"<=",ok:lr.LTE,fail:lr.GT},formatMinimum:{okStr:">=",ok:lr.GTE,fail:lr.LT},formatExclusiveMaximum:{okStr:"<",ok:lr.LT,fail:lr.GTE},formatExclusiveMinimum:{okStr:">",ok:lr.GT,fail:lr.LTE}},zT={message:({keyword:e,schemaCode:t})=>(0,bt.str)`should be ${bs[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,bt._)`{comparison: ${bs[e].okStr}, limit: ${t}}`};xn.formatLimitDefinition={keyword:Object.keys(bs),type:"string",schemaType:"string",$data:!0,error:zT,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 ST.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,bt._)`${f}[${c.schemaCode}]`);e.fail$data((0,bt.or)((0,bt._)`typeof ${p} != "object"`,(0,bt._)`${p} instanceof RegExp`,(0,bt._)`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,bt._)`${a.code.formats}${(0,bt.getProperty)(f)}`:void 0});e.fail$data(d(m))}function d(f){return(0,bt._)`${f}.compare(${r}, ${n}) ${bs[o].fail} 0`}},dependencies:["format"]};var IT=e=>(e.addKeyword(xn.formatLimitDefinition),e);xn.default=IT});var n$=z((fi,r$)=>{"use strict";Object.defineProperty(fi,"__esModule",{value:!0});var kn=Y_(),PT=Q_(),jf=W(),e$=new jf.Name("fullFormats"),jT=new jf.Name("fastFormats"),Tf=(e,t={keywords:!0})=>{if(Array.isArray(t))return t$(e,t,kn.fullFormats,e$),e;let[r,n]=t.mode==="fast"?[kn.fastFormats,jT]:[kn.fullFormats,e$],o=t.formats||kn.formatNames;return t$(e,o,r,n),t.keywords&&(0,PT.default)(e),e};Tf.get=(e,t="full")=>{let n=(t==="fast"?kn.fastFormats:kn.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n};function t$(e,t,r,n){var o,i;(o=(i=e.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,jf._)`require("ajv-formats/dist/formats").${n}`);for(let a of t)e.addFormat(a,r[a])}r$.exports=fi=Tf;Object.defineProperty(fi,"__esModule",{value:!0});fi.default=Tf});var We=ft(require("path")),m$=ft(require("fs"));var ee;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return e.objectValues(a)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},e.find=(o,i)=>{for(let a of o)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(ee||(ee={}));var Zf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Zf||(Zf={}));var I=ee.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Et=e=>{switch(typeof e){case"undefined":return I.undefined;case"string":return I.string;case"number":return Number.isNaN(e)?I.nan:I.number;case"boolean":return I.boolean;case"function":return I.function;case"bigint":return I.bigint;case"symbol":return I.symbol;case"object":return Array.isArray(e)?I.array:e===null?I.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?I.promise:typeof Map<"u"&&e instanceof Map?I.map:typeof Set<"u"&&e instanceof Set?I.set:typeof Date<"u"&&e instanceof Date?I.date:I.object;default:return I.unknown}};var $=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 Ge=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()}};Ge.create=e=>new Ge(e);var x$=(e,t)=>{let r;switch(e.code){case $.invalid_type:e.received===I.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case $.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ee.jsonStringifyReplacer)}`;break;case $.unrecognized_keys:r=`Unrecognized key(s) in object: ${ee.joinValues(e.keys,", ")}`;break;case $.invalid_union:r="Invalid input";break;case $.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ee.joinValues(e.options)}`;break;case $.invalid_enum_value:r=`Invalid enum value. Expected ${ee.joinValues(e.options)}, received '${e.received}'`;break;case $.invalid_arguments:r="Invalid function arguments";break;case $.invalid_return_type:r="Invalid function return type";break;case $.invalid_date:r="Invalid date";break;case $.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 $.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 $.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 $.custom:r="Invalid input";break;case $.invalid_intersection_types:r="Intersection results could not be merged";break;case $.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case $.not_finite:r="Number must be finite";break;default:r=t.defaultError,ee.assertNever(e)}return{message:r}},Jt=x$;var k$=Jt;function Pn(){return k$}var gi=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 w(e,t){let r=Pn(),n=gi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Jt?void 0:Jt].filter(o=>!!o)});e.common.issues.push(n)}var Te=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return U;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 U;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}}},U=Object.freeze({status:"aborted"}),Dr=e=>({status:"dirty",value:e}),Ce=e=>({status:"valid",value:e}),Os=e=>e.status==="aborted",Ds=e=>e.status==="dirty",pr=e=>e.status==="valid",jn=e=>typeof Promise<"u"&&e instanceof Promise;var T;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(T||(T={}));var rt=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}},Cf=(e,t)=>{if(pr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ge(e.common.issues);return this._error=r,this._error}}};function J(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(a,s)=>{let{message:c}=e;return a.code==="invalid_enum_value"?{message:c??s.defaultError}:typeof s.data>"u"?{message:c??n??s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:c??r??s.defaultError}},description:o}}var G=class{get description(){return this._def.description}_getType(t){return Et(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Te,ctx:{common:t.parent.common,data:t.data,parsedType:Et(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(jn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},o=this._parseSync({data:t,path:n.path,parent:n});return Cf(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return pr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>pr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Et(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(jn(o)?o:Promise.resolve(o));return Cf(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:$.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new ht({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return mt.create(this,this._def)}nullable(){return Nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ht.create(this)}promise(){return fr.create(this,this._def)}or(t){return Ar.create([this,t],this._def)}and(t){return Ur.create(this,t,this._def)}transform(t){return new ht({...J(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new Vr({...J(this._def),innerType:this,defaultValue:r,typeName:R.ZodDefault})}brand(){return new vi({typeName:R.ZodBranded,type:this,...J(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new Jr({...J(this._def),innerType:this,catchValue:r,typeName:R.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return yi.create(this,t)}readonly(){return Kr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},w$=/^c[^\s-]{8,}$/i,S$=/^[0-9a-z]+$/,z$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,I$=/^[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,P$=/^[a-z0-9_-]{21}$/i,j$=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,T$=/^[-+]?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)?)??$/,E$=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,O$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ns,D$=/^(?:(?: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])$/,N$=/^(?:(?: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])$/,R$=/^(([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]))$/,Z$=/^(([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])$/,C$=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,A$=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Af="((\\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])))",U$=new RegExp(`^${Af}$`);function Uf(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 M$(e){return new RegExp(`^${Uf(e)}$`)}function F$(e){let t=`${Af}T${Uf(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 q$(e,t){return!!((t==="v4"||!t)&&D$.test(e)||(t==="v6"||!t)&&R$.test(e))}function L$(e,t){if(!j$.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 V$(e,t){return!!((t==="v4"||!t)&&N$.test(e)||(t==="v6"||!t)&&Z$.test(e))}var Rr=class e extends G{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==I.string){let i=this._getOrReturnCtx(t);return w(i,{code:$.invalid_type,expected:I.string,received:i.parsedType}),U}let n=new Te,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:$.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),w(o,{code:$.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?w(o,{code:$.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&w(o,{code:$.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")E$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"email",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")Ns||(Ns=new RegExp(O$,"u")),Ns.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"emoji",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")I$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"uuid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")P$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"nanoid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")w$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")S$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cuid2",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")z$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ulid",code:$.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),w(o,{validation:"url",code:$.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),w(o,{validation:"regex",code:$.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),w(o,{code:$.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),w(o,{code:$.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?F$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?U$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?M$(i).test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{code:$.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?T$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"duration",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?q$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"ip",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?L$(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"jwt",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?V$(t.data,i.version)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"cidr",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?C$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64",code:$.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?A$.test(t.data)||(o=this._getOrReturnCtx(t,o),w(o,{validation:"base64url",code:$.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:$.invalid_string,...T.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...T.errToObj(t)})}url(t){return this._addCheck({kind:"url",...T.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...T.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...T.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...T.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...T.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...T.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...T.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...T.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...T.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...T.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...T.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...T.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,...T.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,...T.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...T.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...T.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...T.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...T.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...T.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...T.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...T.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...T.errToObj(r)})}nonempty(t){return this.min(1,T.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}};Rr.create=e=>new Rr({checks:[],typeName:R.ZodString,coerce:e?.coerce??!1,...J(e)});function J$(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 Tn=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)!==I.number){let i=this._getOrReturnCtx(t);return w(i,{code:$.invalid_type,expected:I.number,received:i.parsedType}),U}let n,o=new Te;for(let i of this._def.checks)i.kind==="int"?ee.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),w(n,{code:$.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),w(n,{code:$.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),w(n,{code:$.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?J$(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),w(n,{code:$.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),w(n,{code:$.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,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:T.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:T.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.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)}};Tn.create=e=>new Tn({checks:[],typeName:R.ZodNumber,coerce:e?.coerce||!1,...J(e)});var En=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)!==I.bigint)return this._getInvalidInput(t);let n,o=new Te;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),w(n,{code:$.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),w(n,{code:$.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),w(n,{code:$.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 w(r,{code:$.invalid_type,expected:I.bigint,received:r.parsedType}),U}gte(t,r){return this.setLimit("min",t,!0,T.toString(r))}gt(t,r){return this.setLimit("min",t,!1,T.toString(r))}lte(t,r){return this.setLimit("max",t,!0,T.toString(r))}lt(t,r){return this.setLimit("max",t,!1,T.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:T.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:T.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:T.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}};En.create=e=>new En({checks:[],typeName:R.ZodBigInt,coerce:e?.coerce??!1,...J(e)});var On=class extends G{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==I.boolean){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:I.boolean,received:n.parsedType}),U}return Ce(t.data)}};On.create=e=>new On({typeName:R.ZodBoolean,coerce:e?.coerce||!1,...J(e)});var Dn=class e extends G{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==I.date){let i=this._getOrReturnCtx(t);return w(i,{code:$.invalid_type,expected:I.date,received:i.parsedType}),U}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return w(i,{code:$.invalid_date}),U}let n=new Te,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),w(o,{code:$.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),w(o,{code:$.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:T.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:T.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}};Dn.create=e=>new Dn({checks:[],coerce:e?.coerce||!1,typeName:R.ZodDate,...J(e)});var Nn=class extends G{_parse(t){if(this._getType(t)!==I.symbol){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:I.symbol,received:n.parsedType}),U}return Ce(t.data)}};Nn.create=e=>new Nn({typeName:R.ZodSymbol,...J(e)});var Zr=class extends G{_parse(t){if(this._getType(t)!==I.undefined){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:I.undefined,received:n.parsedType}),U}return Ce(t.data)}};Zr.create=e=>new Zr({typeName:R.ZodUndefined,...J(e)});var Cr=class extends G{_parse(t){if(this._getType(t)!==I.null){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:I.null,received:n.parsedType}),U}return Ce(t.data)}};Cr.create=e=>new Cr({typeName:R.ZodNull,...J(e)});var Rn=class extends G{constructor(){super(...arguments),this._any=!0}_parse(t){return Ce(t.data)}};Rn.create=e=>new Rn({typeName:R.ZodAny,...J(e)});var Kt=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Ce(t.data)}};Kt.create=e=>new Kt({typeName:R.ZodUnknown,...J(e)});var xt=class extends G{_parse(t){let r=this._getOrReturnCtx(t);return w(r,{code:$.invalid_type,expected:I.never,received:r.parsedType}),U}};xt.create=e=>new xt({typeName:R.ZodNever,...J(e)});var Zn=class extends G{_parse(t){if(this._getType(t)!==I.undefined){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:I.void,received:n.parsedType}),U}return Ce(t.data)}};Zn.create=e=>new Zn({typeName:R.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!==I.array)return w(r,{code:$.invalid_type,expected:I.array,received:r.parsedType}),U;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(w(r,{code:a?$.too_big:$.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&&(w(r,{code:$.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&&(w(r,{code:$.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 rt(r,a,r.path,s)))).then(a=>Te.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new rt(r,a,r.path,s)));return Te.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:T.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:T.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:T.toString(r)}})}nonempty(t){return this.min(1,t)}};Ht.create=(e,t)=>new Ht({type:e,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...J(t)});function Nr(e){if(e instanceof Xe){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=mt.create(Nr(n))}return new Xe({...e._def,shape:()=>t})}else return e instanceof Ht?new Ht({...e._def,type:Nr(e.element)}):e instanceof mt?mt.create(Nr(e.unwrap())):e instanceof Nt?Nt.create(Nr(e.unwrap())):e instanceof Dt?Dt.create(e.items.map(t=>Nr(t))):e}var Xe=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)!==I.object){let u=this._getOrReturnCtx(t);return w(u,{code:$.invalid_type,expected:I.object,received:u.parsedType}),U}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof xt&&this._def.unknownKeys==="strip"))for(let u in o.data)a.includes(u)||s.push(u);let c=[];for(let u of a){let l=i[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new rt(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof xt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of s)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")s.length>0&&(w(o,{code:$.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 rt(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=>Te.mergeObjectSync(n,u)):Te.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return T.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:T.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:R.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 Nr(this)}partial(t){let r={};for(let n of ee.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of ee.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof mt;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return Mf(ee.objectKeys(this.shape))}};Xe.create=(e,t)=>new Xe({shape:()=>e,unknownKeys:"strip",catchall:xt.create(),typeName:R.ZodObject,...J(t)});Xe.strictCreate=(e,t)=>new Xe({shape:()=>e,unknownKeys:"strict",catchall:xt.create(),typeName:R.ZodObject,...J(t)});Xe.lazycreate=(e,t)=>new Xe({shape:e,unknownKeys:"strip",catchall:xt.create(),typeName:R.ZodObject,...J(t)});var Ar=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 Ge(s.ctx.common.issues));return w(r,{code:$.invalid_union,unionErrors:a}),U}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 Ge(c));return w(r,{code:$.invalid_union,unionErrors:s}),U}}get options(){return this._def.options}};Ar.create=(e,t)=>new Ar({options:e,typeName:R.ZodUnion,...J(t)});var Ot=e=>e instanceof Mr?Ot(e.schema):e instanceof ht?Ot(e.innerType()):e instanceof Fr?[e.value]:e instanceof qr?e.options:e instanceof Lr?ee.objectValues(e.enum):e instanceof Vr?Ot(e._def.innerType):e instanceof Zr?[void 0]:e instanceof Cr?[null]:e instanceof mt?[void 0,...Ot(e.unwrap())]:e instanceof Nt?[null,...Ot(e.unwrap())]:e instanceof vi||e instanceof Kr?Ot(e.unwrap()):e instanceof Jr?Ot(e._def.innerType):[],Rs=class e extends G{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.object)return w(r,{code:$.invalid_type,expected:I.object,received:r.parsedType}),U;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}):(w(r,{code:$.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),U)}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:R.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...J(n)})}};function Zs(e,t){let r=Et(e),n=Et(t);if(e===t)return{valid:!0,data:e};if(r===I.object&&n===I.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=Zs(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===I.array&&n===I.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=Zs(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===I.date&&n===I.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Ur=class extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,a)=>{if(Os(i)||Os(a))return U;let s=Zs(i.value,a.value);return s.valid?((Ds(i)||Ds(a))&&r.dirty(),{status:r.value,value:s.data}):(w(n,{code:$.invalid_intersection_types}),U)};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}))}};Ur.create=(e,t,r)=>new Ur({left:e,right:t,typeName:R.ZodIntersection,...J(r)});var Dt=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.array)return w(n,{code:$.invalid_type,expected:I.array,received:n.parsedType}),U;if(n.data.length<this._def.items.length)return w(n,{code:$.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),U;!this._def.rest&&n.data.length>this._def.items.length&&(w(n,{code:$.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 rt(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>Te.mergeArray(r,a)):Te.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Dt.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Dt({items:e,typeName:R.ZodTuple,rest:null,...J(t)})};var Cs=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!==I.object)return w(n,{code:$.invalid_type,expected:I.object,received:n.parsedType}),U;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new rt(n,s,n.path,s)),value:a._parse(new rt(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?Te.mergeObjectAsync(r,o):Te.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof G?new e({keyType:t,valueType:r,typeName:R.ZodRecord,...J(n)}):new e({keyType:Rr.create(),valueType:t,typeName:R.ZodRecord,...J(r)})}},Cn=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!==I.map)return w(n,{code:$.invalid_type,expected:I.map,received:n.parsedType}),U;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new rt(n,s,n.path,[u,"key"])),value:i._parse(new rt(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 U;(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 U;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};Cn.create=(e,t,r)=>new Cn({valueType:t,keyType:e,typeName:R.ZodMap,...J(r)});var An=class e extends G{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==I.set)return w(n,{code:$.invalid_type,expected:I.set,received:n.parsedType}),U;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(w(n,{code:$.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&&(w(n,{code:$.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 U;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 rt(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:T.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:T.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};An.create=(e,t)=>new An({valueType:e,minSize:null,maxSize:null,typeName:R.ZodSet,...J(t)});var As=class e extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.function)return w(r,{code:$.invalid_type,expected:I.function,received:r.parsedType}),U;function n(s,c){return gi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Pn(),Jt].filter(u=>!!u),issueData:{code:$.invalid_arguments,argumentsError:c}})}function o(s,c){return gi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Pn(),Jt].filter(u=>!!u),issueData:{code:$.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof fr){let s=this;return Ce(async function(...c){let u=new Ge([]),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 Ce(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Ge([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Ge([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Dt.create(t).rest(Kt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||Dt.create([]).rest(Kt.create()),returns:r||Kt.create(),typeName:R.ZodFunction,...J(n)})}},Mr=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})}};Mr.create=(e,t)=>new Mr({getter:e,typeName:R.ZodLazy,...J(t)});var Fr=class extends G{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return w(r,{received:r.data,code:$.invalid_literal,expected:this._def.value}),U}return{status:"valid",value:t.data}}get value(){return this._def.value}};Fr.create=(e,t)=>new Fr({value:e,typeName:R.ZodLiteral,...J(t)});function Mf(e,t){return new qr({values:e,typeName:R.ZodEnum,...J(t)})}var qr=class e extends G{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return w(r,{expected:ee.joinValues(n),received:r.parsedType,code:$.invalid_type}),U}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 w(r,{received:r.data,code:$.invalid_enum_value,options:n}),U}return Ce(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})}};qr.create=Mf;var Lr=class extends G{_parse(t){let r=ee.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==I.string&&n.parsedType!==I.number){let o=ee.objectValues(r);return w(n,{expected:ee.joinValues(o),received:n.parsedType,code:$.invalid_type}),U}if(this._cache||(this._cache=new Set(ee.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=ee.objectValues(r);return w(n,{received:n.data,code:$.invalid_enum_value,options:o}),U}return Ce(t.data)}get enum(){return this._def.values}};Lr.create=(e,t)=>new Lr({values:e,typeName:R.ZodNativeEnum,...J(t)});var fr=class extends G{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==I.promise&&r.common.async===!1)return w(r,{code:$.invalid_type,expected:I.promise,received:r.parsedType}),U;let n=r.parsedType===I.promise?r.data:Promise.resolve(r.data);return Ce(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fr.create=(e,t)=>new fr({type:e,typeName:R.ZodPromise,...J(t)});var ht=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.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=>{w(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 U;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?U:c.status==="dirty"?Dr(c.value):r.value==="dirty"?Dr(c.value):c});{if(r.value==="aborted")return U;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?U:s.status==="dirty"?Dr(s.value):r.value==="dirty"?Dr(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"?U:(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"?U:(s.status==="dirty"&&r.dirty(),a(s.value).then(()=>({status:r.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!pr(a))return U;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>pr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):U);ee.assertNever(o)}};ht.create=(e,t,r)=>new ht({schema:e,typeName:R.ZodEffects,effect:t,...J(r)});ht.createWithPreprocess=(e,t,r)=>new ht({schema:t,effect:{type:"preprocess",transform:e},typeName:R.ZodEffects,...J(r)});var mt=class extends G{_parse(t){return this._getType(t)===I.undefined?Ce(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};mt.create=(e,t)=>new mt({innerType:e,typeName:R.ZodOptional,...J(t)});var Nt=class extends G{_parse(t){return this._getType(t)===I.null?Ce(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Nt.create=(e,t)=>new Nt({innerType:e,typeName:R.ZodNullable,...J(t)});var Vr=class extends G{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===I.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Vr.create=(e,t)=>new Vr({innerType:e,typeName:R.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...J(t)});var Jr=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 jn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ge(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ge(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:R.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...J(t)});var Un=class extends G{_parse(t){if(this._getType(t)!==I.nan){let n=this._getOrReturnCtx(t);return w(n,{code:$.invalid_type,expected:I.nan,received:n.parsedType}),U}return{status:"valid",value:t.data}}};Un.create=e=>new Un({typeName:R.ZodNaN,...J(e)});var vi=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}},yi=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"?U:i.status==="dirty"?(r.dirty(),Dr(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"?U: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:R.ZodPipeline})}},Kr=class extends G{_parse(t){let r=this._def.innerType._parse(t),n=o=>(pr(o)&&(o.value=Object.freeze(o.value)),o);return jn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Kr.create=(e,t)=>new Kr({innerType:e,typeName:R.ZodReadonly,...J(t)});var oE={object:Xe.lazycreate},R;(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"})(R||(R={}));var iE=Rr.create,aE=Tn.create,sE=Un.create,cE=En.create,uE=On.create,lE=Dn.create,dE=Nn.create,pE=Zr.create,fE=Cr.create,mE=Rn.create,hE=Kt.create,gE=xt.create,vE=Zn.create,yE=Ht.create,K$=Xe.create,_E=Xe.strictCreate,$E=Ar.create,bE=Rs.create,xE=Ur.create,kE=Dt.create,wE=Cs.create,SE=Cn.create,zE=An.create,IE=As.create,PE=Mr.create,jE=Fr.create,TE=qr.create,EE=Lr.create,OE=fr.create,DE=ht.create,NE=mt.create,RE=Nt.create,ZE=ht.createWithPreprocess,CE=yi.create;var Ff=Object.freeze({status:"aborted"});function h(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 kt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},mr=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},_i={};function xe(e){return e&&Object.assign(_i,e),_i}var b={};In(b,{BIGINT_FORMAT_RANGES:()=>Bs,Class:()=>Ms,NUMBER_FORMAT_RANGES:()=>Hs,aborted:()=>Xt,allowsEval:()=>Ls,assert:()=>Q$,assertEqual:()=>W$,assertIs:()=>X$,assertNever:()=>Y$,assertNotEqual:()=>G$,assignProp:()=>Wt,base64ToUint8Array:()=>Wf,base64urlToUint8Array:()=>lb,cached:()=>Br,captureStackTrace:()=>bi,cleanEnum:()=>ub,cleanRegex:()=>qn,clone:()=>Ae,cloneDef:()=>tb,createTransparentProxy:()=>sb,defineLazy:()=>K,esc:()=>$i,escapeRegex:()=>nt,extend:()=>Jf,finalizeIssue:()=>Ve,floatSafeRemainder:()=>Fs,getElementAtPath:()=>rb,getEnumValues:()=>Fn,getLengthableOrigin:()=>Jn,getParsedType:()=>ab,getSizableOrigin:()=>Vn,hexToUint8Array:()=>pb,isObject:()=>hr,isPlainObject:()=>Gt,issue:()=>Wr,joinValues:()=>C,jsonStringifyReplacer:()=>Hr,merge:()=>cb,mergeDefs:()=>Rt,normalizeParams:()=>S,nullish:()=>Bt,numKeys:()=>ib,objectClone:()=>eb,omit:()=>Vf,optionalKeys:()=>Ks,parsedType:()=>M,partial:()=>Hf,pick:()=>Lf,prefixIssues:()=>Ye,primitiveTypes:()=>Js,promiseAllObject:()=>nb,propertyKeyTypes:()=>Ln,randomString:()=>ob,required:()=>Bf,safeExtend:()=>Kf,shallowClone:()=>Vs,slugify:()=>qs,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>Gf,uint8ArrayToBase64url:()=>db,uint8ArrayToHex:()=>fb,unwrapMessage:()=>Mn});function W$(e){return e}function G$(e){return e}function X$(e){}function Y$(e){throw new Error("Unexpected value in exhaustive check")}function Q$(e){}function Fn(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 C(e,t="|"){return e.map(r=>A(r)).join(t)}function Hr(e,t){return typeof t=="bigint"?t.toString():t}function Br(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Bt(e){return e==null}function qn(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fs(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 eb(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Wt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Rt(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function tb(e){return Rt(e._zod.def)}function rb(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function nb(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 ob(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function $i(e){return JSON.stringify(e)}function qs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var bi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ls=Br(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Gt(e){if(hr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(hr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Vs(e){return Gt(e)?{...e}:Array.isArray(e)?[...e]:e}function ib(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var ab=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}`)}},Ln=new Set(["string","number","symbol"]),Js=new Set(["string","number","bigint","boolean","symbol","undefined"]);function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ae(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function S(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 sb(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function A(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ks(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Hs={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]},Bs={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Lf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Rt(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(a[s]=r.shape[s])}return Wt(this,"shape",a),a},checks:[]});return Ae(e,i)}function Vf(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Rt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete a[s]}return Wt(this,"shape",a),a},checks:[]});return Ae(e,i)}function Jf(e,t){if(!Gt(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=Rt(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return Wt(this,"shape",i),i}});return Ae(e,o)}function Kf(e,t){if(!Gt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Wt(this,"shape",n),n}});return Ae(e,r)}function cb(e,t){let r=Rt(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Wt(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return Ae(e,r)}function Hf(e,t,r){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=Rt(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(c[u]=e?new e({type:"optional",innerType:s[u]}):s[u])}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return Wt(this,"shape",c),c},checks:[]});return Ae(t,a)}function Bf(e,t,r){let n=Rt(t._zod.def,{get shape(){let o=t._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return Wt(this,"shape",i),i}});return Ae(t,n)}function Xt(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ye(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Mn(e){return typeof e=="string"?e:e?.message}function Ve(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let o=Mn(e.inst?._zod.def?.error?.(e))??Mn(t?.error?.(e))??Mn(r.customError?.(e))??Mn(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Vn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Jn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function M(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 Wr(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function ub(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Wf(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 Gf(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function lb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Wf(t+r)}function db(e){return Gf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function pb(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 fb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Ms=class{constructor(...t){}};var Xf=(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,Hr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xi=h("$ZodError",Xf),Kn=h("$ZodError",Xf,{Parent:Error});function ki(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 wi(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 Hn=e=>(t,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new kt;if(a.issues.length){let s=new(o?.Err??e)(a.issues.map(c=>Ve(c,i,xe())));throw bi(s,o?.callee),s}return a.value},Bn=Hn(Kn),Wn=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=>Ve(c,i,xe())));throw bi(s,o?.callee),s}return a.value},Gn=Wn(Kn),Xn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new kt;return i.issues.length?{success:!1,error:new(e??xi)(i.issues.map(a=>Ve(a,o,xe())))}:{success:!0,data:i.value}},Gr=Xn(Kn),Yn=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=>Ve(a,o,xe())))}:{success:!0,data:i.value}},Qn=Yn(Kn),Yf=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Hn(e)(t,r,o)};var Qf=e=>(t,r,n)=>Hn(e)(t,r,n);var em=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Wn(e)(t,r,o)};var tm=e=>async(t,r,n)=>Wn(e)(t,r,n);var rm=e=>(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Xn(e)(t,r,o)};var nm=e=>(t,r,n)=>Xn(e)(t,r,n);var om=e=>async(t,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Yn(e)(t,r,o)};var im=e=>async(t,r,n)=>Yn(e)(t,r,n);var ot={};In(ot,{base64:()=>lc,base64url:()=>Si,bigint:()=>gc,boolean:()=>yc,browserEmail:()=>xb,cidrv4:()=>cc,cidrv6:()=>uc,cuid:()=>Ws,cuid2:()=>Gs,date:()=>pc,datetime:()=>mc,domain:()=>Sb,duration:()=>tc,e164:()=>dc,email:()=>nc,emoji:()=>oc,extendedDuration:()=>hb,guid:()=>rc,hex:()=>zb,hostname:()=>wb,html5Email:()=>_b,idnEmail:()=>bb,integer:()=>vc,ipv4:()=>ic,ipv6:()=>ac,ksuid:()=>Qs,lowercase:()=>bc,mac:()=>sc,md5_base64:()=>Pb,md5_base64url:()=>jb,md5_hex:()=>Ib,nanoid:()=>ec,null:()=>_c,number:()=>zi,rfc5322Email:()=>$b,sha1_base64:()=>Eb,sha1_base64url:()=>Ob,sha1_hex:()=>Tb,sha256_base64:()=>Nb,sha256_base64url:()=>Rb,sha256_hex:()=>Db,sha384_base64:()=>Cb,sha384_base64url:()=>Ab,sha384_hex:()=>Zb,sha512_base64:()=>Mb,sha512_base64url:()=>Fb,sha512_hex:()=>Ub,string:()=>hc,time:()=>fc,ulid:()=>Xs,undefined:()=>$c,unicodeEmail:()=>am,uppercase:()=>xc,uuid:()=>gr,uuid4:()=>gb,uuid6:()=>vb,uuid7:()=>yb,xid:()=>Ys});var Ws=/^[cC][^\s-]{8,}$/,Gs=/^[0-9a-z]+$/,Xs=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ys=/^[0-9a-vA-V]{20}$/,Qs=/^[A-Za-z0-9]{27}$/,ec=/^[a-zA-Z0-9_-]{21}$/,tc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hb=/^[-+]?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)?)??$/,rc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,gr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,gb=gr(4),vb=gr(6),yb=gr(7),nc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_b=/^[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])?)*$/,$b=/^(([^<>()\[\]\\.,;:\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,}))$/,am=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,bb=am,xb=/^[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])?)*$/,kb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function oc(){return new RegExp(kb,"u")}var ic=/^(?:(?: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])$/,ac=/^(([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}|:))$/,sc=e=>{let t=nt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},cc=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,uc=/^(([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])$/,lc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Si=/^[A-Za-z0-9_-]*$/,wb=/^(?=.{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])?)*\.?$/,Sb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,dc=/^\+[1-9]\d{6,14}$/,sm="(?:(?:\\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])))",pc=new RegExp(`^${sm}$`);function cm(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 fc(e){return new RegExp(`^${cm(e)}$`)}function mc(e){let t=cm({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(`^${sm}T(?:${n})$`)}var hc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},gc=/^-?\d+n?$/,vc=/^-?\d+$/,zi=/^-?\d+(?:\.\d+)?$/,yc=/^(?:true|false)$/i,_c=/^null$/i;var $c=/^undefined$/i;var bc=/^[^A-Z]*$/,xc=/^[^a-z]*$/,zb=/^[0-9a-fA-F]*$/;function eo(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function to(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ib=/^[0-9a-fA-F]{32}$/,Pb=eo(22,"=="),jb=to(22),Tb=/^[0-9a-fA-F]{40}$/,Eb=eo(27,"="),Ob=to(27),Db=/^[0-9a-fA-F]{64}$/,Nb=eo(43,"="),Rb=to(43),Zb=/^[0-9a-fA-F]{96}$/,Cb=eo(64,""),Ab=to(64),Ub=/^[0-9a-fA-F]{128}$/,Mb=eo(86,"=="),Fb=to(86);var ue=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),lm={number:"number",bigint:"bigint",object:"date"},kc=h("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let r=lm[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})}}),wc=h("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let r=lm[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})}}),dm=h("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Fs(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})}}),pm=h("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Hs[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=vc)}),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})}}),fm=h("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[r,n]=Bs[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})}}),mm=h("$ZodCheckMaxSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Vn(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hm=h("$ZodCheckMinSize",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Vn(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gm=h("$ZodCheckSizeEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.size!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.size,o.maximum=t.size,o.size=t.size}),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Vn(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})}}),vm=h("$ZodCheckMaxLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let o=n.value;if(o.length<=t.maximum)return;let a=Jn(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ym=h("$ZodCheckMinLength",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let o=n.value;if(o.length>=t.minimum)return;let a=Jn(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_m=h("$ZodCheckLengthEquals",(e,t)=>{var r;ue.init(e,t),(r=e._zod.def).when??(r.when=n=>{let o=n.value;return!Bt(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{let o=n.value,i=o.length;if(i===t.length)return;let a=Jn(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})}}),ro=h("$ZodCheckStringFormat",(e,t)=>{var r,n;ue.init(e,t),e._zod.onattach.push(o=>{let i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),$m=h("$ZodCheckRegex",(e,t)=>{ro.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})}}),bm=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=bc),ro.init(e,t)}),xm=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=xc),ro.init(e,t)}),km=h("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let r=nt(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})}}),wm=h("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`^${nt(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})}}),Sm=h("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let r=new RegExp(`.*${nt(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 um(e,t,r){e.issues.length&&t.issues.push(...Ye(r,e.issues))}var zm=h("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>um(o,r,t.property));um(n,r,t.property)}}),Im=h("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),Pm=h("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ii=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 Tm={major:4,minor:3,patch:6};var L=m("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=Xt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new kt;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=Xt(a,f)))});else{if(a.issues.length===f)continue;u||(u=Xt(a,f))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Xt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new kt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new kt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}K(e,"~standard",()=>({validate:o=>{try{let i=Wr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Yn(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),vr=m("$ZodString",(e,t)=>{L.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ae=m("$ZodStringFormat",(e,t)=>{to.init(e,t),vr.init(e,t)}),zc=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=rc),ae.init(e,t)}),Ic=m("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gr(n))}else t.pattern??(t.pattern=gr());ae.init(e,t)}),Pc=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=nc),ae.init(e,t)}),jc=m("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Tc=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=oc()),ae.init(e,t)}),Ec=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ec),ae.init(e,t)}),Oc=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Gs),ae.init(e,t)}),Dc=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ws),ae.init(e,t)}),Nc=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Xs),ae.init(e,t)}),Rc=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ys),ae.init(e,t)}),Zc=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Qs),ae.init(e,t)}),Cc=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mc(t)),ae.init(e,t)}),Ac=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=pc),ae.init(e,t)}),Uc=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=fc(t)),ae.init(e,t)}),Mc=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tc),ae.init(e,t)}),Fc=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ic),ae.init(e,t),e._zod.bag.format="ipv4"}),qc=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ac),ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Lc=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=sc(t.delimiter)),ae.init(e,t),e._zod.bag.format="mac"}),Vc=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=cc),ae.init(e,t)}),Jc=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=uc),ae.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function qm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Kc=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=lc),ae.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 Ub(e){if(!wi.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return qm(r)}var Hc=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=wi),ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Ub(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Bc=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=dc),ae.init(e,t)});function Mb(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 Gc=m("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=r=>{Mb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Wc=m("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Oi=m("$ZodNumber",(e,t)=>{L.init(e,t),e._zod.pattern=e._zod.bag.pattern??Si,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}}),Xc=m("$ZodNumberFormat",(e,t)=>{pm.init(e,t),Oi.init(e,t)}),ro=m("$ZodBoolean",(e,t)=>{L.init(e,t),e._zod.pattern=yc,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}}),Di=m("$ZodBigInt",(e,t)=>{L.init(e,t),e._zod.pattern=gc,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}}),Yc=m("$ZodBigIntFormat",(e,t)=>{fm.init(e,t),Di.init(e,t)}),Qc=m("$ZodSymbol",(e,t)=>{L.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}}),eu=m("$ZodUndefined",(e,t)=>{L.init(e,t),e._zod.pattern=$c,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}}),tu=m("$ZodNull",(e,t)=>{L.init(e,t),e._zod.pattern=_c,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}}),ru=m("$ZodAny",(e,t)=>{L.init(e,t),e._zod.parse=r=>r}),nu=m("$ZodUnknown",(e,t)=>{L.init(e,t),e._zod.parse=r=>r}),ou=m("$ZodNever",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),iu=m("$ZodVoid",(e,t)=>{L.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}}),au=m("$ZodDate",(e,t)=>{L.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 Em(e,t,r){e.issues.length&&t.issues.push(...Xe(r,e.issues)),t.value[r]=e.value}var su=m("$ZodArray",(e,t)=>{L.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=>Em(u,r,a))):Em(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Ei(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Xe(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Lm(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=Ks(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Vm(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=>Ei(p,r,d,t,l))):Ei(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 Jm=m("$ZodObject",(e,t)=>{if(L.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=Br(()=>Lm(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=hr,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let f of a.keys){let p=d[f],h=p._zod.optout==="optional",g=p._zod.run({value:u[f],issues:[]},c);g instanceof Promise?l.push(g.then(y=>Ei(y,s,f,u,h))):Ei(g,s,f,u,h)}return i?Vm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Km=m("$ZodObjectJIT",(e,t)=>{Jm.init(e,t);let r=e._zod.parse,n=Br(()=>Lm(t)),o=f=>{let p=new zi(["shape","payload","ctx"]),h=n.value,g=x=>{let D=_i(x);return`shape[${D}]._zod.run({ value: input[${D}], issues: [] }, ctx)`};p.write("const input = payload.value;");let y=Object.create(null),$=0;for(let x of h.keys)y[x]=`key_${$++}`;p.write("const newResult = {};");for(let x of h.keys){let D=y[x],O=_i(x),pt=f[x]?._zod?.optout==="optional";p.write(`const ${D} = ${g(x)};`),pt?p.write(`
12
- if (${D}.issues.length) {
13
- if (${O} in input) {
14
- payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
11
+ `))}};var Tm={major:4,minor:3,patch:6};var L=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tm;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let o of n)for(let i of o._zod.onattach)i(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(a,s,c)=>{let u=Xt(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let f=a.issues.length,p=d._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new kt;if(l||p instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await p,a.issues.length!==f&&(u||(u=Xt(a,f)))});else{if(a.issues.length===f)continue;u||(u=Xt(a,f))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Xt(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new kt;return u.then(l=>e._zod.parse(l,c))}return e._zod.parse(u,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return u instanceof Promise?u.then(l=>i(l,a,s)):i(u,a,s)}let c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new kt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}K(e,"~standard",()=>({validate:o=>{try{let i=Gr(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Qn(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),vr=h("$ZodString",(e,t)=>{L.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hc(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),ae=h("$ZodStringFormat",(e,t)=>{ro.init(e,t),vr.init(e,t)}),zc=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=rc),ae.init(e,t)}),Ic=h("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=gr(n))}else t.pattern??(t.pattern=gr());ae.init(e,t)}),Pc=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=nc),ae.init(e,t)}),jc=h("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Tc=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=oc()),ae.init(e,t)}),Ec=h("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ec),ae.init(e,t)}),Oc=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ws),ae.init(e,t)}),Dc=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Gs),ae.init(e,t)}),Nc=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Xs),ae.init(e,t)}),Rc=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ys),ae.init(e,t)}),Zc=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Qs),ae.init(e,t)}),Cc=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=mc(t)),ae.init(e,t)}),Ac=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=pc),ae.init(e,t)}),Uc=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=fc(t)),ae.init(e,t)}),Mc=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=tc),ae.init(e,t)}),Fc=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ic),ae.init(e,t),e._zod.bag.format="ipv4"}),qc=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ac),ae.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Lc=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=sc(t.delimiter)),ae.init(e,t),e._zod.bag.format="mac"}),Vc=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=cc),ae.init(e,t)}),Jc=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=uc),ae.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function qm(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Kc=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=lc),ae.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 qb(e){if(!Si.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return qm(r)}var Hc=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Si),ae.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{qb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Bc=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=dc),ae.init(e,t)});function Lb(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 Wc=h("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=r=>{Lb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Gc=h("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Di=h("$ZodNumber",(e,t)=>{L.init(e,t),e._zod.pattern=e._zod.bag.pattern??zi,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}}),Xc=h("$ZodNumberFormat",(e,t)=>{pm.init(e,t),Di.init(e,t)}),no=h("$ZodBoolean",(e,t)=>{L.init(e,t),e._zod.pattern=yc,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}}),Ni=h("$ZodBigInt",(e,t)=>{L.init(e,t),e._zod.pattern=gc,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}}),Yc=h("$ZodBigIntFormat",(e,t)=>{fm.init(e,t),Ni.init(e,t)}),Qc=h("$ZodSymbol",(e,t)=>{L.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}}),eu=h("$ZodUndefined",(e,t)=>{L.init(e,t),e._zod.pattern=$c,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}}),tu=h("$ZodNull",(e,t)=>{L.init(e,t),e._zod.pattern=_c,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}}),ru=h("$ZodAny",(e,t)=>{L.init(e,t),e._zod.parse=r=>r}),nu=h("$ZodUnknown",(e,t)=>{L.init(e,t),e._zod.parse=r=>r}),ou=h("$ZodNever",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),iu=h("$ZodVoid",(e,t)=>{L.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}}),au=h("$ZodDate",(e,t)=>{L.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 Em(e,t,r){e.issues.length&&t.issues.push(...Ye(r,e.issues)),t.value[r]=e.value}var su=h("$ZodArray",(e,t)=>{L.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=>Em(u,r,a))):Em(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Oi(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...Ye(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Lm(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=Ks(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Vm(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=>Oi(p,r,d,t,l))):Oi(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 Jm=h("$ZodObject",(e,t)=>{if(L.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=Br(()=>Lm(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=hr,i=t.catchall,a;e._zod.parse=(s,c)=>{a??(a=n.value);let u=s.value;if(!o(u))return s.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),s;s.value={};let l=[],d=a.shape;for(let f of a.keys){let p=d[f],m=p._zod.optout==="optional",g=p._zod.run({value:u[f],issues:[]},c);g instanceof Promise?l.push(g.then(y=>Oi(y,s,f,u,m))):Oi(g,s,f,u,m)}return i?Vm(l,u,s,c,n.value,e):l.length?Promise.all(l).then(()=>s):s}}),Km=h("$ZodObjectJIT",(e,t)=>{Jm.init(e,t);let r=e._zod.parse,n=Br(()=>Lm(t)),o=f=>{let p=new Ii(["shape","payload","ctx"]),m=n.value,g=x=>{let N=$i(x);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};p.write("const input = payload.value;");let y=Object.create(null),_=0;for(let x of m.keys)y[x]=`key_${_++}`;p.write("const newResult = {};");for(let x of m.keys){let N=y[x],D=$i(x),pt=f[x]?._zod?.optout==="optional";p.write(`const ${N} = ${g(x)};`),pt?p.write(`
12
+ if (${N}.issues.length) {
13
+ if (${D} in input) {
14
+ payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
15
15
  ...iss,
16
- path: iss.path ? [${O}, ...iss.path] : [${O}]
16
+ path: iss.path ? [${D}, ...iss.path] : [${D}]
17
17
  })));
18
18
  }
19
19
  }
20
20
 
21
- if (${D}.value === undefined) {
22
- if (${O} in input) {
23
- newResult[${O}] = undefined;
21
+ if (${N}.value === undefined) {
22
+ if (${D} in input) {
23
+ newResult[${D}] = undefined;
24
24
  }
25
25
  } else {
26
- newResult[${O}] = ${D}.value;
26
+ newResult[${D}] = ${N}.value;
27
27
  }
28
28
 
29
29
  `):p.write(`
30
- if (${D}.issues.length) {
31
- payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
30
+ if (${N}.issues.length) {
31
+ payload.issues = payload.issues.concat(${N}.issues.map(iss => ({
32
32
  ...iss,
33
- path: iss.path ? [${O}, ...iss.path] : [${O}]
33
+ path: iss.path ? [${D}, ...iss.path] : [${D}]
34
34
  })));
35
35
  }
36
36
 
37
- if (${D}.value === undefined) {
38
- if (${O} in input) {
39
- newResult[${O}] = undefined;
37
+ if (${N}.value === undefined) {
38
+ if (${D} in input) {
39
+ newResult[${D}] = undefined;
40
40
  }
41
41
  } else {
42
- newResult[${O}] = ${D}.value;
42
+ newResult[${D}] = ${N}.value;
43
43
  }
44
44
 
45
- `)}p.write("payload.value = newResult;"),p.write("return payload;");let k=p.compile();return(x,D)=>k(f,x,D)},i,a=hr,s=!yi.jitless,u=s&&Ls.value,l=t.catchall,d;e._zod.parse=(f,p)=>{d??(d=n.value);let h=f.value;return a(h)?s&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(t.shape)),f=i(f,p),l?Vm([],h,f,p,d,e):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f)}});function Om(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Xt(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>Ve(a,n,xe())))}),t)}var no=m("$ZodUnion",(e,t)=>{L.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=>Fn(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=>Om(c,o,e,i)):Om(s,o,e,i)}});function Dm(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=>Ve(a,n,xe())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var cu=m("$ZodXor",(e,t)=>{no.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=>Dm(c,o,e,i)):Dm(s,o,e,i)}}),uu=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,no.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=Br(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!hr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),lu=m("$ZodIntersection",(e,t)=>{L.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])=>Nm(r,c,u)):Nm(r,i,a)}});function Sc(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(Wt(e)&&Wt(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=Sc(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=Sc(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 Nm(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),Xt(e))return e;let a=Sc(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 Ni=m("$ZodTuple",(e,t)=>{L.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=>Ii(f,n,u))):Ii(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=>Ii(p,n,u))):Ii(f,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Ii(e,t,r){e.issues.length&&t.issues.push(...Xe(r,e.issues)),t.value[r]=e.value}var du=m("$ZodRecord",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Wt(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(...Xe(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Xe(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"&&Si.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=>Ve(d,n,xe())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Xe(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Xe(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),pu=m("$ZodMap",(e,t)=>{L.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])=>{Rm(l,d,r,a,o,e,n)})):Rm(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function Rm(e,t,r,n,o,i,a){e.issues.length&&(qn.has(typeof n)?r.issues.push(...Xe(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>Ve(s,a,xe()))})),t.issues.length&&(qn.has(typeof n)?r.issues.push(...Xe(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>Ve(s,a,xe()))})),r.value.set(e.value,t.value)}var fu=m("$ZodSet",(e,t)=>{L.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=>Zm(c,r))):Zm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Zm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var mu=m("$ZodEnum",(e,t)=>{L.init(e,t);let r=Mn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>qn.has(typeof o)).map(o=>typeof o=="string"?nt(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}}),hu=m("$ZodLiteral",(e,t)=>{if(L.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"?nt(n):n?nt(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}}),gu=m("$ZodFile",(e,t)=>{L.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}}),vu=m("$ZodTransform",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new kt;return r.value=o,r}});function Cm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ri=m("$ZodOptional",(e,t)=>{L.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(`^(${Fn(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=>Cm(i,r.value)):Cm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),yu=m("$ZodExactOptional",(e,t)=>{Ri.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)}),_u=m("$ZodNullable",(e,t)=>{L.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(`^(${Fn(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)}),$u=m("$ZodDefault",(e,t)=>{L.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=>Am(i,t)):Am(o,t)}});function Am(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var bu=m("$ZodPrefault",(e,t)=>{L.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))}),xu=m("$ZodNonOptional",(e,t)=>{L.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=>Um(i,e)):Um(o,e)}});function Um(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 ku=m("$ZodSuccess",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),wu=m("$ZodCatch",(e,t)=>{L.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=>Ve(a,n,xe()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Ve(i,n,xe()))},input:r.value}),r.issues=[]),r)}}),Su=m("$ZodNaN",(e,t)=>{L.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)}),zu=m("$ZodPipe",(e,t)=>{L.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=>Pi(a,t.in,n)):Pi(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Pi(i,t.out,n)):Pi(o,t.out,n)}});function Pi(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var oo=m("$ZodCodec",(e,t)=>{L.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=>ji(a,t,n)):ji(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>ji(a,t,n)):ji(i,t,n)}}});function ji(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=>Ti(e,i,t.out,r)):Ti(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Ti(e,i,t.in,r)):Ti(e,o,t.in,r)}}function Ti(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Iu=m("$ZodReadonly",(e,t)=>{L.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(Mm):Mm(o)}});function Mm(e){return e.value=Object.freeze(e.value),e}var Pu=m("$ZodTemplateLiteral",(e,t)=>{L.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||Js.has(typeof n))r.push(nt(`${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)}),ju=m("$ZodFunction",(e,t)=>(L.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?Hn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Hn(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 Gn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Gn(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 Ni({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)),Tu=m("$ZodPromise",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),Eu=m("$ZodLazy",(e,t)=>{L.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)}),Ou=m("$ZodCustom",(e,t)=>{ue.init(e,t),L.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=>Fm(i,r,n,e));Fm(o,r,n,e)}});function Fm(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(Gr(o))}}var qb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(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=M(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${A(o.values[0])}`:`Invalid option: expected one of ${C(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":""}: ${C(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 Du(){return{localeError:qb()}}var Hm;var Ru=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 Zu(){return new Ru}(Hm=globalThis).__zod_globalRegistry??(Hm.__zod_globalRegistry=Zu());var Ue=globalThis.__zod_globalRegistry;function Cu(e,t){return new e({type:"string",...S(t)})}function Zi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...S(t)})}function io(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...S(t)})}function Ci(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...S(t)})}function Ai(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(t)})}function Ui(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(t)})}function Mi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(t)})}function ao(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...S(t)})}function Fi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...S(t)})}function qi(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(t)})}function Li(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...S(t)})}function Vi(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(t)})}function Ji(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...S(t)})}function Ki(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...S(t)})}function Hi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(t)})}function Bi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(t)})}function Gi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(t)})}function Au(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...S(t)})}function Wi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(t)})}function Xi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(t)})}function Yi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...S(t)})}function Qi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...S(t)})}function ea(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...S(t)})}function ta(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...S(t)})}function Uu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(t)})}function Mu(e,t){return new e({type:"string",format:"date",check:"string_format",...S(t)})}function Fu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...S(t)})}function qu(e,t){return new e({type:"string",format:"duration",check:"string_format",...S(t)})}function Lu(e,t){return new e({type:"number",checks:[],...S(t)})}function Vu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...S(t)})}function Ju(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...S(t)})}function Ku(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...S(t)})}function Hu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...S(t)})}function Bu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...S(t)})}function Gu(e,t){return new e({type:"boolean",...S(t)})}function Wu(e,t){return new e({type:"bigint",...S(t)})}function Xu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...S(t)})}function Yu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...S(t)})}function Qu(e,t){return new e({type:"symbol",...S(t)})}function el(e,t){return new e({type:"undefined",...S(t)})}function tl(e,t){return new e({type:"null",...S(t)})}function rl(e){return new e({type:"any"})}function nl(e){return new e({type:"unknown"})}function ol(e,t){return new e({type:"never",...S(t)})}function il(e,t){return new e({type:"void",...S(t)})}function al(e,t){return new e({type:"date",...S(t)})}function sl(e,t){return new e({type:"nan",...S(t)})}function Zt(e,t){return new kc({check:"less_than",...S(t),value:e,inclusive:!1})}function Ye(e,t){return new kc({check:"less_than",...S(t),value:e,inclusive:!0})}function Ct(e,t){return new wc({check:"greater_than",...S(t),value:e,inclusive:!1})}function Me(e,t){return new wc({check:"greater_than",...S(t),value:e,inclusive:!0})}function cl(e){return Ct(0,e)}function ul(e){return Zt(0,e)}function ll(e){return Ye(0,e)}function dl(e){return Me(0,e)}function yr(e,t){return new dm({check:"multiple_of",...S(t),value:e})}function _r(e,t){return new mm({check:"max_size",...S(t),maximum:e})}function At(e,t){return new hm({check:"min_size",...S(t),minimum:e})}function Xr(e,t){return new gm({check:"size_equals",...S(t),size:e})}function Yr(e,t){return new vm({check:"max_length",...S(t),maximum:e})}function Yt(e,t){return new ym({check:"min_length",...S(t),minimum:e})}function Qr(e,t){return new _m({check:"length_equals",...S(t),length:e})}function so(e,t){return new $m({check:"string_format",format:"regex",...S(t),pattern:e})}function co(e){return new bm({check:"string_format",format:"lowercase",...S(e)})}function uo(e){return new xm({check:"string_format",format:"uppercase",...S(e)})}function lo(e,t){return new km({check:"string_format",format:"includes",...S(t),includes:e})}function po(e,t){return new wm({check:"string_format",format:"starts_with",...S(t),prefix:e})}function fo(e,t){return new Sm({check:"string_format",format:"ends_with",...S(t),suffix:e})}function pl(e,t,r){return new zm({check:"property",property:e,schema:t,...S(r)})}function mo(e,t){return new Im({check:"mime_type",mime:e,...S(t)})}function wt(e){return new Pm({check:"overwrite",tx:e})}function ho(e){return wt(t=>t.normalize(e))}function go(){return wt(e=>e.trim())}function vo(){return wt(e=>e.toLowerCase())}function yo(){return wt(e=>e.toUpperCase())}function ra(){return wt(e=>qs(e))}function Bm(e,t,r){return new e({type:"array",element:t,...S(r)})}function fl(e,t){return new e({type:"file",...S(t)})}function ml(e,t,r){let n=S(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function hl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...S(r)})}function gl(e){let t=Kb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Gr(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(Gr(o))}},e(r.value,r)));return t}function Kb(e,t){let r=new ue({check:"custom",...S(t)});return r._zod.check=e,r}function vl(e){let t=new ue({check:"describe"});return t._zod.onattach=[r=>{let n=Ue.get(r)??{};Ue.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function yl(e){let t=new ue({check:"meta"});return t._zod.onattach=[r=>{let n=Ue.get(r)??{};Ue.add(r,{...n,...e})}],t._zod.check=()=>{},t}function _l(e,t){let r=S(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??oo,c=e.Boolean??ro,u=e.String??vr,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,h)=>{let g=p;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:f,continue:!1}),{})}),reverseTransform:((p,h)=>p===!0?n[0]||"true":o[0]||"false"),error:r.error});return f}function en(e,t,r,n={}){let o=S(n),i={...S(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 na(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??Ue,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function fe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let 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),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Fe(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 oa(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??(h=>h);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 ia(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 g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(p.$ref&&f.def)for(let g in c)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(c[g])===JSON.stringify(f.def[g])&&delete c[g]}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:_o(t,"input",e.processors),output:_o(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Fe(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 Fe(n.element,r);if(n.type==="set")return Fe(n.valueType,r);if(n.type==="lazy")return Fe(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 Fe(n.innerType,r);if(n.type==="intersection")return Fe(n.left,r)||Fe(n.right,r);if(n.type==="record"||n.type==="map")return Fe(n.keyType,r)||Fe(n.valueType,r);if(n.type==="pipe")return Fe(n.in,r)||Fe(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Fe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Fe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Fe(o,r))return!0;return!!(n.rest&&Fe(n.rest,r))}return!1}var Gm=(e,t={})=>r=>{let n=na({...r,processors:t});return fe(e,n),oa(n,e),ia(n,e)},_o=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=na({...o??{},target:i,io:t,processors:r});return fe(e,a),oa(a,e),ia(a,e)};var Hb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Wm=(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=Hb[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}))])}},Xm=(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)},Ym=(e,t,r,n)=>{r.type="boolean"},Qm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},eh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},th=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},rh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},nh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},oh=(e,t,r,n)=>{r.not={}},ih=(e,t,r,n)=>{},ah=(e,t,r,n)=>{},sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ch=(e,t,r,n)=>{let o=e._zod.def,i=Mn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},uh=(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},lh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},dh=(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},ph=(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)},fh=(e,t,r,n)=>{r.type="boolean"},mh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},hh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},gh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},vh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},yh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},_h=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,t,{...n,path:[...n.path,"items"]})},$h=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},$l=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},bh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},xh=(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)=>fe(f,t,{...n,path:[...n.path,a,p]})),u=i.rest?fe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},kh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=fe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},wh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Sh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},zh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Ih=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ph=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},jh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,t,n);let a=t.seen.get(e);a.ref=i},Th=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Eh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},bl=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Oh=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o};function tn(e){return!!e._zod}function Qt(e,t){return tn(e)?Wr(e,t):e.safeParse(t)}function aa(e){if(!e)return;let t;if(tn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Zh(e){if(tn(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 $o={};zn($o,{ZodAny:()=>eg,ZodArray:()=>og,ZodBase64:()=>Jl,ZodBase64URL:()=>Kl,ZodBigInt:()=>ha,ZodBigIntFormat:()=>Gl,ZodBoolean:()=>ma,ZodCIDRv4:()=>Ll,ZodCIDRv6:()=>Vl,ZodCUID:()=>Zl,ZodCUID2:()=>Cl,ZodCatch:()=>wg,ZodCodec:()=>rd,ZodCustom:()=>$a,ZodCustomStringFormat:()=>xo,ZodDate:()=>Xl,ZodDefault:()=>yg,ZodDiscriminatedUnion:()=>ag,ZodE164:()=>Hl,ZodEmail:()=>Dl,ZodEmoji:()=>Nl,ZodEnum:()=>bo,ZodExactOptional:()=>hg,ZodFile:()=>fg,ZodFunction:()=>Dg,ZodGUID:()=>ca,ZodIPv4:()=>Fl,ZodIPv6:()=>ql,ZodIntersection:()=>sg,ZodJWT:()=>Bl,ZodKSUID:()=>Ml,ZodLazy:()=>Tg,ZodLiteral:()=>pg,ZodMAC:()=>Wh,ZodMap:()=>lg,ZodNaN:()=>zg,ZodNanoID:()=>Rl,ZodNever:()=>rg,ZodNonOptional:()=>ed,ZodNull:()=>Qh,ZodNullable:()=>vg,ZodNumber:()=>fa,ZodNumberFormat:()=>rn,ZodObject:()=>ga,ZodOptional:()=>Ql,ZodPipe:()=>td,ZodPrefault:()=>$g,ZodPromise:()=>Og,ZodReadonly:()=>Ig,ZodRecord:()=>_a,ZodSet:()=>dg,ZodString:()=>da,ZodStringFormat:()=>le,ZodSuccess:()=>kg,ZodSymbol:()=>Xh,ZodTemplateLiteral:()=>jg,ZodTransform:()=>mg,ZodTuple:()=>cg,ZodType:()=>H,ZodULID:()=>Al,ZodURL:()=>pa,ZodUUID:()=>Ut,ZodUndefined:()=>Yh,ZodUnion:()=>va,ZodUnknown:()=>tg,ZodVoid:()=>ng,ZodXID:()=>Ul,ZodXor:()=>ig,_ZodString:()=>Ol,_default:()=>_g,_function:()=>dk,any:()=>Hx,array:()=>Y,base64:()=>Tx,base64url:()=>Ex,bigint:()=>qx,boolean:()=>$e,catch:()=>Sg,check:()=>pk,cidrv4:()=>Px,cidrv6:()=>jx,codec:()=>ck,cuid:()=>$x,cuid2:()=>bx,custom:()=>nd,date:()=>Gx,describe:()=>fk,discriminatedUnion:()=>ya,e164:()=>Ox,email:()=>lx,emoji:()=>yx,enum:()=>Oe,exactOptional:()=>gg,file:()=>ok,float32:()=>Ax,float64:()=>Ux,function:()=>dk,guid:()=>dx,hash:()=>Cx,hex:()=>Zx,hostname:()=>Rx,httpUrl:()=>vx,instanceof:()=>hk,int:()=>El,int32:()=>Mx,int64:()=>Lx,intersection:()=>wo,ipv4:()=>Sx,ipv6:()=>Ix,json:()=>vk,jwt:()=>Dx,keyof:()=>Wx,ksuid:()=>wx,lazy:()=>Eg,literal:()=>T,looseObject:()=>Ee,looseRecord:()=>ek,mac:()=>zx,map:()=>tk,meta:()=>mk,nan:()=>sk,nanoid:()=>_x,nativeEnum:()=>nk,never:()=>Wl,nonoptional:()=>xg,null:()=>ko,nullable:()=>ua,nullish:()=>ik,number:()=>ie,object:()=>P,optional:()=>he,partialRecord:()=>Qx,pipe:()=>la,prefault:()=>bg,preprocess:()=>ba,promise:()=>lk,readonly:()=>Pg,record:()=>me,refine:()=>Ng,set:()=>rk,strictObject:()=>Xx,string:()=>v,stringFormat:()=>Nx,stringbool:()=>gk,success:()=>ak,superRefine:()=>Rg,symbol:()=>Jx,templateLiteral:()=>uk,transform:()=>Yl,tuple:()=>ug,uint32:()=>Fx,uint64:()=>Vx,ulid:()=>xx,undefined:()=>Kx,union:()=>se,unknown:()=>de,url:()=>gx,uuid:()=>px,uuidv4:()=>fx,uuidv6:()=>mx,uuidv7:()=>hx,void:()=>Bx,xid:()=>kx,xor:()=>Yx});var sa={};zn(sa,{endsWith:()=>fo,gt:()=>Ct,gte:()=>Me,includes:()=>lo,length:()=>Qr,lowercase:()=>co,lt:()=>Zt,lte:()=>Ye,maxLength:()=>Yr,maxSize:()=>_r,mime:()=>mo,minLength:()=>Yt,minSize:()=>At,multipleOf:()=>yr,negative:()=>ul,nonnegative:()=>dl,nonpositive:()=>ll,normalize:()=>ho,overwrite:()=>wt,positive:()=>cl,property:()=>pl,regex:()=>so,size:()=>Xr,slugify:()=>ra,startsWith:()=>po,toLowerCase:()=>vo,toUpperCase:()=>yo,trim:()=>go,uppercase:()=>uo});var $r={};zn($r,{ZodISODate:()=>Sl,ZodISODateTime:()=>kl,ZodISODuration:()=>jl,ZodISOTime:()=>Il,date:()=>zl,datetime:()=>wl,duration:()=>Tl,time:()=>Pl});var kl=m("ZodISODateTime",(e,t)=>{Cc.init(e,t),le.init(e,t)});function wl(e){return Uu(kl,e)}var Sl=m("ZodISODate",(e,t)=>{Ac.init(e,t),le.init(e,t)});function zl(e){return Mu(Sl,e)}var Il=m("ZodISOTime",(e,t)=>{Uc.init(e,t),le.init(e,t)});function Pl(e){return Fu(Il,e)}var jl=m("ZodISODuration",(e,t)=>{Mc.init(e,t),le.init(e,t)});function Tl(e){return qu(jl,e)}var Ch=(e,t)=>{bi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>ki(e,r)},flatten:{value:r=>xi(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Hr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Hr,2)}},isEmpty:{get(){return e.issues.length===0}}})},ZN=m("ZodError",Ch),Qe=m("ZodError",Ch,{Parent:Error});var Ah=Kn(Qe),Uh=Bn(Qe),Mh=Wn(Qe),Fh=Xn(Qe),qh=Yf(Qe),Lh=Qf(Qe),Vh=em(Qe),Jh=tm(Qe),Kh=rm(Qe),Hh=nm(Qe),Bh=om(Qe),Gh=im(Qe);var H=m("ZodType",(e,t)=>(L.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:_o(e,"input"),output:_o(e,"output")}}),e.toJSONSchema=Gm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(b.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)=>Ae(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Ah(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Mh(e,r,n),e.parseAsync=async(r,n)=>Uh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Fh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>qh(e,r,n),e.decode=(r,n)=>Lh(e,r,n),e.encodeAsync=async(r,n)=>Vh(e,r,n),e.decodeAsync=async(r,n)=>Jh(e,r,n),e.safeEncode=(r,n)=>Kh(e,r,n),e.safeDecode=(r,n)=>Hh(e,r,n),e.safeEncodeAsync=async(r,n)=>Bh(e,r,n),e.safeDecodeAsync=async(r,n)=>Gh(e,r,n),e.refine=(r,n)=>e.check(Ng(r,n)),e.superRefine=r=>e.check(Rg(r)),e.overwrite=r=>e.check(wt(r)),e.optional=()=>he(e),e.exactOptional=()=>gg(e),e.nullable=()=>ua(e),e.nullish=()=>he(ua(e)),e.nonoptional=r=>xg(e,r),e.array=()=>Y(e),e.or=r=>se([e,r]),e.and=r=>wo(e,r),e.transform=r=>la(e,Yl(r)),e.default=r=>_g(e,r),e.prefault=r=>bg(e,r),e.catch=r=>Sg(e,r),e.pipe=r=>la(e,r),e.readonly=()=>Pg(e),e.describe=r=>{let n=e.clone();return Ue.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ue.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ue.get(e);let n=e.clone();return Ue.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Ol=m("_ZodString",(e,t)=>{vr.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Wm(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(so(...n)),e.includes=(...n)=>e.check(lo(...n)),e.startsWith=(...n)=>e.check(po(...n)),e.endsWith=(...n)=>e.check(fo(...n)),e.min=(...n)=>e.check(Yt(...n)),e.max=(...n)=>e.check(Yr(...n)),e.length=(...n)=>e.check(Qr(...n)),e.nonempty=(...n)=>e.check(Yt(1,...n)),e.lowercase=n=>e.check(co(n)),e.uppercase=n=>e.check(uo(n)),e.trim=()=>e.check(go()),e.normalize=(...n)=>e.check(ho(...n)),e.toLowerCase=()=>e.check(vo()),e.toUpperCase=()=>e.check(yo()),e.slugify=()=>e.check(ra())}),da=m("ZodString",(e,t)=>{vr.init(e,t),Ol.init(e,t),e.email=r=>e.check(Zi(Dl,r)),e.url=r=>e.check(ao(pa,r)),e.jwt=r=>e.check(ta(Bl,r)),e.emoji=r=>e.check(Fi(Nl,r)),e.guid=r=>e.check(io(ca,r)),e.uuid=r=>e.check(Ci(Ut,r)),e.uuidv4=r=>e.check(Ai(Ut,r)),e.uuidv6=r=>e.check(Ui(Ut,r)),e.uuidv7=r=>e.check(Mi(Ut,r)),e.nanoid=r=>e.check(qi(Rl,r)),e.guid=r=>e.check(io(ca,r)),e.cuid=r=>e.check(Li(Zl,r)),e.cuid2=r=>e.check(Vi(Cl,r)),e.ulid=r=>e.check(Ji(Al,r)),e.base64=r=>e.check(Yi(Jl,r)),e.base64url=r=>e.check(Qi(Kl,r)),e.xid=r=>e.check(Ki(Ul,r)),e.ksuid=r=>e.check(Hi(Ml,r)),e.ipv4=r=>e.check(Bi(Fl,r)),e.ipv6=r=>e.check(Gi(ql,r)),e.cidrv4=r=>e.check(Wi(Ll,r)),e.cidrv6=r=>e.check(Xi(Vl,r)),e.e164=r=>e.check(ea(Hl,r)),e.datetime=r=>e.check(wl(r)),e.date=r=>e.check(zl(r)),e.time=r=>e.check(Pl(r)),e.duration=r=>e.check(Tl(r))});function v(e){return Cu(da,e)}var le=m("ZodStringFormat",(e,t)=>{ae.init(e,t),Ol.init(e,t)}),Dl=m("ZodEmail",(e,t)=>{Pc.init(e,t),le.init(e,t)});function lx(e){return Zi(Dl,e)}var ca=m("ZodGUID",(e,t)=>{zc.init(e,t),le.init(e,t)});function dx(e){return io(ca,e)}var Ut=m("ZodUUID",(e,t)=>{Ic.init(e,t),le.init(e,t)});function px(e){return Ci(Ut,e)}function fx(e){return Ai(Ut,e)}function mx(e){return Ui(Ut,e)}function hx(e){return Mi(Ut,e)}var pa=m("ZodURL",(e,t)=>{jc.init(e,t),le.init(e,t)});function gx(e){return ao(pa,e)}function vx(e){return ao(pa,{protocol:/^https?$/,hostname:ot.domain,...b.normalizeParams(e)})}var Nl=m("ZodEmoji",(e,t)=>{Tc.init(e,t),le.init(e,t)});function yx(e){return Fi(Nl,e)}var Rl=m("ZodNanoID",(e,t)=>{Ec.init(e,t),le.init(e,t)});function _x(e){return qi(Rl,e)}var Zl=m("ZodCUID",(e,t)=>{Oc.init(e,t),le.init(e,t)});function $x(e){return Li(Zl,e)}var Cl=m("ZodCUID2",(e,t)=>{Dc.init(e,t),le.init(e,t)});function bx(e){return Vi(Cl,e)}var Al=m("ZodULID",(e,t)=>{Nc.init(e,t),le.init(e,t)});function xx(e){return Ji(Al,e)}var Ul=m("ZodXID",(e,t)=>{Rc.init(e,t),le.init(e,t)});function kx(e){return Ki(Ul,e)}var Ml=m("ZodKSUID",(e,t)=>{Zc.init(e,t),le.init(e,t)});function wx(e){return Hi(Ml,e)}var Fl=m("ZodIPv4",(e,t)=>{Fc.init(e,t),le.init(e,t)});function Sx(e){return Bi(Fl,e)}var Wh=m("ZodMAC",(e,t)=>{Lc.init(e,t),le.init(e,t)});function zx(e){return Au(Wh,e)}var ql=m("ZodIPv6",(e,t)=>{qc.init(e,t),le.init(e,t)});function Ix(e){return Gi(ql,e)}var Ll=m("ZodCIDRv4",(e,t)=>{Vc.init(e,t),le.init(e,t)});function Px(e){return Wi(Ll,e)}var Vl=m("ZodCIDRv6",(e,t)=>{Jc.init(e,t),le.init(e,t)});function jx(e){return Xi(Vl,e)}var Jl=m("ZodBase64",(e,t)=>{Kc.init(e,t),le.init(e,t)});function Tx(e){return Yi(Jl,e)}var Kl=m("ZodBase64URL",(e,t)=>{Hc.init(e,t),le.init(e,t)});function Ex(e){return Qi(Kl,e)}var Hl=m("ZodE164",(e,t)=>{Bc.init(e,t),le.init(e,t)});function Ox(e){return ea(Hl,e)}var Bl=m("ZodJWT",(e,t)=>{Gc.init(e,t),le.init(e,t)});function Dx(e){return ta(Bl,e)}var xo=m("ZodCustomStringFormat",(e,t)=>{Wc.init(e,t),le.init(e,t)});function Nx(e,t,r={}){return en(xo,e,t,r)}function Rx(e){return en(xo,"hostname",ot.hostname,e)}function Zx(e){return en(xo,"hex",ot.hex,e)}function Cx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=ot[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return en(xo,n,o,t)}var fa=m("ZodNumber",(e,t)=>{Oi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Xm(e,n,o,i),e.gt=(n,o)=>e.check(Ct(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Zt(n,o)),e.lte=(n,o)=>e.check(Ye(n,o)),e.max=(n,o)=>e.check(Ye(n,o)),e.int=n=>e.check(El(n)),e.safe=n=>e.check(El(n)),e.positive=n=>e.check(Ct(0,n)),e.nonnegative=n=>e.check(Me(0,n)),e.negative=n=>e.check(Zt(0,n)),e.nonpositive=n=>e.check(Ye(0,n)),e.multipleOf=(n,o)=>e.check(yr(n,o)),e.step=(n,o)=>e.check(yr(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ie(e){return Lu(fa,e)}var rn=m("ZodNumberFormat",(e,t)=>{Xc.init(e,t),fa.init(e,t)});function El(e){return Vu(rn,e)}function Ax(e){return Ju(rn,e)}function Ux(e){return Ku(rn,e)}function Mx(e){return Hu(rn,e)}function Fx(e){return Bu(rn,e)}var ma=m("ZodBoolean",(e,t)=>{ro.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o)});function $e(e){return Gu(ma,e)}var ha=m("ZodBigInt",(e,t)=>{Di.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Qm(e,n,o,i),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.gt=(n,o)=>e.check(Ct(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Zt(n,o)),e.lte=(n,o)=>e.check(Ye(n,o)),e.max=(n,o)=>e.check(Ye(n,o)),e.positive=n=>e.check(Ct(BigInt(0),n)),e.negative=n=>e.check(Zt(BigInt(0),n)),e.nonpositive=n=>e.check(Ye(BigInt(0),n)),e.nonnegative=n=>e.check(Me(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(yr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function qx(e){return Wu(ha,e)}var Gl=m("ZodBigIntFormat",(e,t)=>{Yc.init(e,t),ha.init(e,t)});function Lx(e){return Xu(Gl,e)}function Vx(e){return Yu(Gl,e)}var Xh=m("ZodSymbol",(e,t)=>{Qc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eh(e,r,n,o)});function Jx(e){return Qu(Xh,e)}var Yh=m("ZodUndefined",(e,t)=>{eu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o)});function Kx(e){return el(Yh,e)}var Qh=m("ZodNull",(e,t)=>{tu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>th(e,r,n,o)});function ko(e){return tl(Qh,e)}var eg=m("ZodAny",(e,t)=>{ru.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o)});function Hx(){return rl(eg)}var tg=m("ZodUnknown",(e,t)=>{nu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o)});function de(){return nl(tg)}var rg=m("ZodNever",(e,t)=>{ou.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o)});function Wl(e){return ol(rg,e)}var ng=m("ZodVoid",(e,t)=>{iu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nh(e,r,n,o)});function Bx(e){return il(ng,e)}var Xl=m("ZodDate",(e,t)=>{au.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>sh(e,n,o,i),e.min=(n,o)=>e.check(Me(n,o)),e.max=(n,o)=>e.check(Ye(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 Gx(e){return al(Xl,e)}var og=m("ZodArray",(e,t)=>{su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Yt(r,n)),e.nonempty=r=>e.check(Yt(1,r)),e.max=(r,n)=>e.check(Yr(r,n)),e.length=(r,n)=>e.check(Qr(r,n)),e.unwrap=()=>e.element});function Y(e,t){return Bm(og,e,t)}function Wx(e){let t=e._zod.def.shape;return Oe(Object.keys(t))}var ga=m("ZodObject",(e,t)=>{Km.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o),b.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Oe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:de()}),e.loose=()=>e.clone({...e._zod.def,catchall:de()}),e.strict=()=>e.clone({...e._zod.def,catchall:Wl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>b.extend(e,r),e.safeExtend=r=>b.safeExtend(e,r),e.merge=r=>b.merge(e,r),e.pick=r=>b.pick(e,r),e.omit=r=>b.omit(e,r),e.partial=(...r)=>b.partial(Ql,e,r[0]),e.required=(...r)=>b.required(ed,e,r[0])});function P(e,t){let r={type:"object",shape:e??{},...b.normalizeParams(t)};return new ga(r)}function Xx(e,t){return new ga({type:"object",shape:e,catchall:Wl(),...b.normalizeParams(t)})}function Ee(e,t){return new ga({type:"object",shape:e,catchall:de(),...b.normalizeParams(t)})}var va=m("ZodUnion",(e,t)=>{no.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$l(e,r,n,o),e.options=t.options});function se(e,t){return new va({type:"union",options:e,...b.normalizeParams(t)})}var ig=m("ZodXor",(e,t)=>{va.init(e,t),cu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$l(e,r,n,o),e.options=t.options});function Yx(e,t){return new ig({type:"union",options:e,inclusive:!1,...b.normalizeParams(t)})}var ag=m("ZodDiscriminatedUnion",(e,t)=>{va.init(e,t),uu.init(e,t)});function ya(e,t,r){return new ag({type:"union",options:t,discriminator:e,...b.normalizeParams(r)})}var sg=m("ZodIntersection",(e,t)=>{lu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o)});function wo(e,t){return new sg({type:"intersection",left:e,right:t})}var cg=m("ZodTuple",(e,t)=>{Ni.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function ug(e,t,r){let n=t instanceof L,o=n?r:t,i=n?t:null;return new cg({type:"tuple",items:e,rest:i,...b.normalizeParams(o)})}var _a=m("ZodRecord",(e,t)=>{du.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function me(e,t,r){return new _a({type:"record",keyType:e,valueType:t,...b.normalizeParams(r)})}function Qx(e,t,r){let n=Ae(e);return n._zod.values=void 0,new _a({type:"record",keyType:n,valueType:t,...b.normalizeParams(r)})}function ek(e,t,r){return new _a({type:"record",keyType:e,valueType:t,mode:"loose",...b.normalizeParams(r)})}var lg=m("ZodMap",(e,t)=>{pu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(Xr(...r))});function tk(e,t,r){return new lg({type:"map",keyType:e,valueType:t,...b.normalizeParams(r)})}var dg=m("ZodSet",(e,t)=>{fu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o),e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(Xr(...r))});function rk(e,t){return new dg({type:"set",valueType:e,...b.normalizeParams(t)})}var bo=m("ZodEnum",(e,t)=>{mu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ch(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 bo({...t,checks:[],...b.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 bo({...t,checks:[],...b.normalizeParams(o),entries:i})}});function Oe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new bo({type:"enum",entries:r,...b.normalizeParams(t)})}function nk(e,t){return new bo({type:"enum",entries:e,...b.normalizeParams(t)})}var pg=m("ZodLiteral",(e,t)=>{hu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(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 T(e,t){return new pg({type:"literal",values:Array.isArray(e)?e:[e],...b.normalizeParams(t)})}var fg=m("ZodFile",(e,t)=>{gu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ph(e,r,n,o),e.min=(r,n)=>e.check(At(r,n)),e.max=(r,n)=>e.check(_r(r,n)),e.mime=(r,n)=>e.check(mo(Array.isArray(r)?r:[r],n))});function ok(e){return fl(fg,e)}var mg=m("ZodTransform",(e,t)=>{vu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(b.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(b.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 Yl(e){return new mg({type:"transform",transform:e})}var Ql=m("ZodOptional",(e,t)=>{Ri.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function he(e){return new Ql({type:"optional",innerType:e})}var hg=m("ZodExactOptional",(e,t)=>{yu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gg(e){return new hg({type:"optional",innerType:e})}var vg=m("ZodNullable",(e,t)=>{_u.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 ua(e){return new vg({type:"nullable",innerType:e})}function ik(e){return he(ua(e))}var yg=m("ZodDefault",(e,t)=>{$u.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 _g(e,t){return new yg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var $g=m("ZodPrefault",(e,t)=>{bu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bg(e,t){return new $g({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var ed=m("ZodNonOptional",(e,t)=>{xu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xg(e,t){return new ed({type:"nonoptional",innerType:e,...b.normalizeParams(t)})}var kg=m("ZodSuccess",(e,t)=>{ku.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 ak(e){return new kg({type:"success",innerType:e})}var wg=m("ZodCatch",(e,t)=>{wu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ph(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Sg(e,t){return new wg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var zg=m("ZodNaN",(e,t)=>{Su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o)});function sk(e){return sl(zg,e)}var td=m("ZodPipe",(e,t)=>{zu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jh(e,r,n,o),e.in=t.in,e.out=t.out});function la(e,t){return new td({type:"pipe",in:e,out:t})}var rd=m("ZodCodec",(e,t)=>{td.init(e,t),oo.init(e,t)});function ck(e,t,r){return new rd({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Ig=m("ZodReadonly",(e,t)=>{Iu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Pg(e){return new Ig({type:"readonly",innerType:e})}var jg=m("ZodTemplateLiteral",(e,t)=>{Pu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dh(e,r,n,o)});function uk(e,t){return new jg({type:"template_literal",parts:e,...b.normalizeParams(t)})}var Tg=m("ZodLazy",(e,t)=>{Eu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oh(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Eg(e){return new Tg({type:"lazy",getter:e})}var Og=m("ZodPromise",(e,t)=>{Tu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function lk(e){return new Og({type:"promise",innerType:e})}var Dg=m("ZodFunction",(e,t)=>{ju.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o)});function dk(e){return new Dg({type:"function",input:Array.isArray(e?.input)?ug(e?.input):e?.input??Y(de()),output:e?.output??de()})}var $a=m("ZodCustom",(e,t)=>{Ou.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o)});function pk(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function nd(e,t){return ml($a,e??(()=>!0),t)}function Ng(e,t={}){return hl($a,e,t)}function Rg(e){return gl(e)}var fk=vl,mk=yl;function hk(e,t={}){let r=new $a({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...b.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 gk=(...e)=>_l({Codec:rd,Boolean:ma,String:da},...e);function vk(e){let t=Eg(()=>se([v(e),ie(),$e(),ko(),Y(t),me(v(),t)]));return t}function ba(e,t){return la(Yl(e),t)}var Zg;Zg||(Zg={});var VN={...$o,...sa,iso:$r};xe(Du());var id="2025-11-25";var Cg=[id,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],er="io.modelcontextprotocol/related-task",ka="2.0",ke=nd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Ag=se([v(),ie().int()]),Ug=v(),u4=Ee({ttl:se([ie(),ko()]).optional(),pollInterval:ie().optional()}),bk=P({ttl:ie().optional()}),xk=P({taskId:v()}),ad=Ee({progressToken:Ag.optional(),[er]:xk.optional()}),et=P({_meta:ad.optional()}),So=et.extend({task:bk.optional()}),Mg=e=>So.safeParse(e).success,we=P({method:v(),params:et.loose().optional()}),it=P({_meta:ad.optional()}),at=P({method:v(),params:it.loose().optional()}),Se=Ee({_meta:ad.optional()}),wa=se([v(),ie().int()]),Fg=P({jsonrpc:T(ka),id:wa,...we.shape}).strict(),sd=e=>Fg.safeParse(e).success,qg=P({jsonrpc:T(ka),...at.shape}).strict(),Lg=e=>qg.safeParse(e).success,cd=P({jsonrpc:T(ka),id:wa,result:Se}).strict(),zo=e=>cd.safeParse(e).success;var F;(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"})(F||(F={}));var ud=P({jsonrpc:T(ka),id:wa.optional(),error:P({code:ie().int(),message:v(),data:de().optional()})}).strict();var Vg=e=>ud.safeParse(e).success;var Jg=se([Fg,qg,cd,ud]),l4=se([cd,ud]),Sa=Se.strict(),kk=it.extend({requestId:wa.optional(),reason:v().optional()}),za=at.extend({method:T("notifications/cancelled"),params:kk}),wk=P({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Oe(["light","dark"]).optional()}),Io=P({icons:Y(wk).optional()}),nn=P({name:v(),title:v().optional()}),Kg=nn.extend({...nn.shape,...Io.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Sk=wo(P({applyDefaults:$e().optional()}),me(v(),de())),zk=ba(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,wo(P({form:Sk.optional(),url:ke.optional()}),me(v(),de()).optional())),Ik=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({sampling:Ee({createMessage:ke.optional()}).optional(),elicitation:Ee({create:ke.optional()}).optional()}).optional()}),Pk=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({tools:Ee({call:ke.optional()}).optional()}).optional()}),jk=P({experimental:me(v(),ke).optional(),sampling:P({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:zk.optional(),roots:P({listChanged:$e().optional()}).optional(),tasks:Ik.optional()}),Tk=et.extend({protocolVersion:v(),capabilities:jk,clientInfo:Kg}),ld=we.extend({method:T("initialize"),params:Tk});var Ek=P({experimental:me(v(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:P({listChanged:$e().optional()}).optional(),resources:P({subscribe:$e().optional(),listChanged:$e().optional()}).optional(),tools:P({listChanged:$e().optional()}).optional(),tasks:Pk.optional()}),Ok=Se.extend({protocolVersion:v(),capabilities:Ek,serverInfo:Kg,instructions:v().optional()}),dd=at.extend({method:T("notifications/initialized"),params:it.optional()});var Ia=we.extend({method:T("ping"),params:et.optional()}),Dk=P({progress:ie(),total:he(ie()),message:he(v())}),Nk=P({...it.shape,...Dk.shape,progressToken:Ag}),Pa=at.extend({method:T("notifications/progress"),params:Nk}),Rk=et.extend({cursor:Ug.optional()}),Po=we.extend({params:Rk.optional()}),jo=Se.extend({nextCursor:Ug.optional()}),Zk=Oe(["working","input_required","completed","failed","cancelled"]),To=P({taskId:v(),status:Zk,ttl:se([ie(),ko()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:he(ie()),statusMessage:he(v())}),on=Se.extend({task:To}),Ck=it.merge(To),Eo=at.extend({method:T("notifications/tasks/status"),params:Ck}),ja=we.extend({method:T("tasks/get"),params:et.extend({taskId:v()})}),Ta=Se.merge(To),Ea=we.extend({method:T("tasks/result"),params:et.extend({taskId:v()})}),d4=Se.loose(),Oa=Po.extend({method:T("tasks/list")}),Da=jo.extend({tasks:Y(To)}),Na=we.extend({method:T("tasks/cancel"),params:et.extend({taskId:v()})}),Hg=Se.merge(To),Bg=P({uri:v(),mimeType:he(v()),_meta:me(v(),de()).optional()}),Gg=Bg.extend({text:v()}),pd=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Wg=Bg.extend({blob:pd}),Oo=Oe(["user","assistant"]),an=P({audience:Y(Oo).optional(),priority:ie().min(0).max(1).optional(),lastModified:$r.datetime({offset:!0}).optional()}),Xg=P({...nn.shape,...Io.shape,uri:v(),description:he(v()),mimeType:he(v()),annotations:an.optional(),_meta:he(Ee({}))}),Ak=P({...nn.shape,...Io.shape,uriTemplate:v(),description:he(v()),mimeType:he(v()),annotations:an.optional(),_meta:he(Ee({}))}),fd=Po.extend({method:T("resources/list")}),Uk=jo.extend({resources:Y(Xg)}),Mk=Po.extend({method:T("resources/templates/list")}),Fk=jo.extend({resourceTemplates:Y(Ak)}),md=et.extend({uri:v()}),qk=md,hd=we.extend({method:T("resources/read"),params:qk}),Lk=Se.extend({contents:Y(se([Gg,Wg]))}),Vk=at.extend({method:T("notifications/resources/list_changed"),params:it.optional()}),Jk=md,Kk=we.extend({method:T("resources/subscribe"),params:Jk}),Hk=md,Bk=we.extend({method:T("resources/unsubscribe"),params:Hk}),Gk=it.extend({uri:v()}),Wk=at.extend({method:T("notifications/resources/updated"),params:Gk}),Xk=P({name:v(),description:he(v()),required:he($e())}),Yk=P({...nn.shape,...Io.shape,description:he(v()),arguments:he(Y(Xk)),_meta:he(Ee({}))}),gd=Po.extend({method:T("prompts/list")}),Qk=jo.extend({prompts:Y(Yk)}),ew=et.extend({name:v(),arguments:me(v(),v()).optional()}),vd=we.extend({method:T("prompts/get"),params:ew}),yd=P({type:T("text"),text:v(),annotations:an.optional(),_meta:me(v(),de()).optional()}),_d=P({type:T("image"),data:pd,mimeType:v(),annotations:an.optional(),_meta:me(v(),de()).optional()}),$d=P({type:T("audio"),data:pd,mimeType:v(),annotations:an.optional(),_meta:me(v(),de()).optional()}),tw=P({type:T("tool_use"),name:v(),id:v(),input:me(v(),de()),_meta:me(v(),de()).optional()}),rw=P({type:T("resource"),resource:se([Gg,Wg]),annotations:an.optional(),_meta:me(v(),de()).optional()}),nw=Xg.extend({type:T("resource_link")}),bd=se([yd,_d,$d,nw,rw]),ow=P({role:Oo,content:bd}),iw=Se.extend({description:v().optional(),messages:Y(ow)}),aw=at.extend({method:T("notifications/prompts/list_changed"),params:it.optional()}),sw=P({title:v().optional(),readOnlyHint:$e().optional(),destructiveHint:$e().optional(),idempotentHint:$e().optional(),openWorldHint:$e().optional()}),cw=P({taskSupport:Oe(["required","optional","forbidden"]).optional()}),Yg=P({...nn.shape,...Io.shape,description:v().optional(),inputSchema:P({type:T("object"),properties:me(v(),ke).optional(),required:Y(v()).optional()}).catchall(de()),outputSchema:P({type:T("object"),properties:me(v(),ke).optional(),required:Y(v()).optional()}).catchall(de()).optional(),annotations:sw.optional(),execution:cw.optional(),_meta:me(v(),de()).optional()}),xd=Po.extend({method:T("tools/list")}),uw=jo.extend({tools:Y(Yg)}),Ra=Se.extend({content:Y(bd).default([]),structuredContent:me(v(),de()).optional(),isError:$e().optional()}),p4=Ra.or(Se.extend({toolResult:de()})),lw=So.extend({name:v(),arguments:me(v(),de()).optional()}),Do=we.extend({method:T("tools/call"),params:lw}),dw=at.extend({method:T("notifications/tools/list_changed"),params:it.optional()}),f4=P({autoRefresh:$e().default(!0),debounceMs:ie().int().nonnegative().default(300)}),No=Oe(["debug","info","notice","warning","error","critical","alert","emergency"]),pw=et.extend({level:No}),kd=we.extend({method:T("logging/setLevel"),params:pw}),fw=it.extend({level:No,logger:v().optional(),data:de()}),mw=at.extend({method:T("notifications/message"),params:fw}),hw=P({name:v().optional()}),gw=P({hints:Y(hw).optional(),costPriority:ie().min(0).max(1).optional(),speedPriority:ie().min(0).max(1).optional(),intelligencePriority:ie().min(0).max(1).optional()}),vw=P({mode:Oe(["auto","required","none"]).optional()}),yw=P({type:T("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:Y(bd).default([]),structuredContent:P({}).loose().optional(),isError:$e().optional(),_meta:me(v(),de()).optional()}),_w=ya("type",[yd,_d,$d]),xa=ya("type",[yd,_d,$d,tw,yw]),$w=P({role:Oo,content:se([xa,Y(xa)]),_meta:me(v(),de()).optional()}),bw=So.extend({messages:Y($w),modelPreferences:gw.optional(),systemPrompt:v().optional(),includeContext:Oe(["none","thisServer","allServers"]).optional(),temperature:ie().optional(),maxTokens:ie().int(),stopSequences:Y(v()).optional(),metadata:ke.optional(),tools:Y(Yg).optional(),toolChoice:vw.optional()}),xw=we.extend({method:T("sampling/createMessage"),params:bw}),wd=Se.extend({model:v(),stopReason:he(Oe(["endTurn","stopSequence","maxTokens"]).or(v())),role:Oo,content:_w}),Sd=Se.extend({model:v(),stopReason:he(Oe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:Oo,content:se([xa,Y(xa)])}),kw=P({type:T("boolean"),title:v().optional(),description:v().optional(),default:$e().optional()}),ww=P({type:T("string"),title:v().optional(),description:v().optional(),minLength:ie().optional(),maxLength:ie().optional(),format:Oe(["email","uri","date","date-time"]).optional(),default:v().optional()}),Sw=P({type:Oe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ie().optional(),maximum:ie().optional(),default:ie().optional()}),zw=P({type:T("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),Iw=P({type:T("string"),title:v().optional(),description:v().optional(),oneOf:Y(P({const:v(),title:v()})),default:v().optional()}),Pw=P({type:T("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),jw=se([zw,Iw]),Tw=P({type:T("array"),title:v().optional(),description:v().optional(),minItems:ie().optional(),maxItems:ie().optional(),items:P({type:T("string"),enum:Y(v())}),default:Y(v()).optional()}),Ew=P({type:T("array"),title:v().optional(),description:v().optional(),minItems:ie().optional(),maxItems:ie().optional(),items:P({anyOf:Y(P({const:v(),title:v()}))}),default:Y(v()).optional()}),Ow=se([Tw,Ew]),Dw=se([Pw,jw,Ow]),Nw=se([Dw,kw,ww,Sw]),Rw=So.extend({mode:T("form").optional(),message:v(),requestedSchema:P({type:T("object"),properties:me(v(),Nw),required:Y(v()).optional()})}),Zw=So.extend({mode:T("url"),message:v(),elicitationId:v(),url:v().url()}),Cw=se([Rw,Zw]),Aw=we.extend({method:T("elicitation/create"),params:Cw}),Uw=it.extend({elicitationId:v()}),Mw=at.extend({method:T("notifications/elicitation/complete"),params:Uw}),Za=Se.extend({action:Oe(["accept","decline","cancel"]),content:ba(e=>e===null?void 0:e,me(v(),se([v(),ie(),$e(),Y(v())])).optional())}),Fw=P({type:T("ref/resource"),uri:v()});var qw=P({type:T("ref/prompt"),name:v()}),Lw=et.extend({ref:se([qw,Fw]),argument:P({name:v(),value:v()}),context:P({arguments:me(v(),v()).optional()}).optional()}),Vw=we.extend({method:T("completion/complete"),params:Lw});var Jw=Se.extend({completion:Ee({values:Y(v()).max(100),total:he(ie().int()),hasMore:he($e())})}),Kw=P({uri:v().startsWith("file://"),name:v().optional(),_meta:me(v(),de()).optional()}),Hw=we.extend({method:T("roots/list"),params:et.optional()}),zd=Se.extend({roots:Y(Kw)}),Bw=at.extend({method:T("notifications/roots/list_changed"),params:it.optional()}),m4=se([Ia,ld,Vw,kd,vd,gd,fd,Mk,hd,Kk,Bk,Do,xd,ja,Ea,Oa,Na]),h4=se([za,Pa,dd,Bw,Eo]),g4=se([Sa,wd,Sd,Za,zd,Ta,Da,on]),v4=se([Ia,xw,Aw,Hw,ja,Ea,Oa,Na]),y4=se([za,Pa,mw,Wk,Vk,dw,aw,Eo,Mw]),_4=se([Sa,Ok,Jw,iw,Qk,Uk,Fk,Lk,Ra,uw,Ta,Da,on]),Z=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===F.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new od(o.elicitations,r)}return new e(t,r,n)}},od=class extends Z{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(F.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function tr(e){return e==="completed"||e==="failed"||e==="cancelled"}var Q4=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Id(e){let r=aa(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Zh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Pd(e,t){let r=Qt(e,t);if(!r.success)throw r.error;return r.data}var eS=6e4,Ca=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(za,r=>{this._oncancel(r)}),this.setNotificationHandler(Pa,r=>{this._onprogress(r)}),this.setRequestHandler(Ia,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ja,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(F.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Ea,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 Z(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 Z(F.InvalidParams,`Task not found: ${i}`);if(!tr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(tr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[er]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Oa,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 Z(F.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Na,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(F.InvalidParams,`Task not found: ${r.params.taskId}`);if(tr(o.status))throw new Z(F.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Z(F.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof Z?o:new Z(F.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),Z.fromError(F.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(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),zo(i)||Vg(i)?this._onresponse(i):sd(i)?this._onrequest(i,a):Lg(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=Z.fromError(F.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[er]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:F.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=Mg(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 Z(F.ConnectionClosed,"Request was cancelled");let p={...f,relatedRequestId:t.id};i&&!p.relatedTask&&(p.relatedTask={taskId:i});let h=p.relatedTask?.taskId??i;return h&&c&&await c.updateTaskStatus(h,"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:F.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),zo(t))n(t);else{let a=new Z(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(zo(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),zo(t))o(t);else{let a=Z.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 Z?a:new Z(F.InternalError,String(a))}}return}let i;try{let a=await this.request(t,on,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new Z(F.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},tr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new Z(F.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new Z(F.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let 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 Z?a:new Z(F.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=k=>{l(k)};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(k){d(k);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||{},[er]:c}});let h=k=>{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(k)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(D=>this._onerror(new Error(`Failed to send cancellation: ${D}`)));let x=k instanceof Z?k:new Z(F.RequestTimeout,String(k));l(x)};this._responseHandlers.set(f,k=>{if(!n?.signal?.aborted){if(k instanceof Error)return l(k);try{let x=Qt(r,k.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason)});let g=n?.timeout??eS,y=()=>h(Z.fromError(F.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(f,g,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let $=c?.taskId;if($){let k=x=>{let D=this._responseHandlers.get(f);D?D(x):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,k),this._enqueueTaskMessage($,{type:"request",message:p,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(f),l(x)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(k=>{this._cleanupTimeout(f),l(k)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ta,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},Da,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Hg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[er]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[er]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[er]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Id(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Pd(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=Id(t);this._notificationHandlers.set(n,o=>{let i=Pd(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"&&sd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new Z(F.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 Z(F.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new Z(F.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 Z(F.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Eo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),tr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new Z(F.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(tr(s.status))throw new Z(F.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Eo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),tr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Qg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ev(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];Qg(a)&&Qg(i)?r[o]={...a,...i}:r[o]=i}return r}var o$=ft(kf(),1),i$=ft(n$(),1);function IT(){let e=new o$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,i$.default)(e),e}var bs=class{constructor(t){this._ajv=t??IT()}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 xs=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 a$(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 s$(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 ks=class extends Ca{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(No.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 bs,this.setRequestHandler(ld,n=>this._oninitialize(n)),this.setNotificationHandler(dd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(kd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=No.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new xs(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ev(this._capabilities,t)}setRequestHandler(t,r){let o=aa(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(tn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=Qt(Do,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new Z(F.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let h=Qt(on,f);if(!h.success){let g=h.error instanceof Error?h.error.message:String(h.error);throw new Z(F.InvalidParams,`Invalid task creation result: ${g}`)}return h.data}let p=Qt(Ra,f);if(!p.success){let h=p.error instanceof Error?p.error.message:String(p.error);throw new Z(F.InvalidParams,`Invalid tools/call result: ${h}`)}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){s$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&a$(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:Cg.includes(r)?r:id,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"},Sa)}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},Sd,r):this.request({method:"sampling/createMessage",params:t},wd,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},Za,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},Za,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new Z(F.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof Z?a:new Z(F.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},zd,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 Ef=ft(require("node:process"),1);var ws=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),PT(r)}clear(){this._buffer=void 0}};function PT(e){return Jg.parse(JSON.parse(e))}function c$(e){return JSON.stringify(e)+`
49
- `}var Ss=class{constructor(t=Ef.default.stdin,r=Ef.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new ws,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=c$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var je=ft(require("fs/promises")),be=ft(require("path")),wn=10*1024*1024,zs=class{skillsPath;cachedSkills=null;loadingPromise=null;skillMap=new Map;contentCache=new Map;constructor(t){this.skillsPath=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:""};let n=r.split(/\r?\n/),o=[],i=!1;for(let u=1;u<n.length;u++){if(n[u].trim()==="---"){i=!0;break}o.push(n[u])}if(!i)return{name:"",description:""};let a="",s="",c=!1;for(let u of o){let l=u.match(/^name:\s*(.*?)\s*$/);if(l){a=this.stripQuotes(l[1]),c=!1;continue}let d=u.match(/^description:\s*(.*?)\s*$/);if(d){s=this.stripQuotes(d[1]),c=!0;continue}c&&/^\s+/.test(u)?s+=" "+u.trim():c=!1}return{name:a,description:s}}async exists(t){try{return await je.access(t),!0}catch{return!1}}async listSkills(t=!1){if(this.cachedSkills&&!t)return this.cachedSkills;if(this.loadingPromise&&!t)return this.loadingPromise;t&&this.contentCache.clear();let r=this.internalListSkills();this.loadingPromise=r;try{return await r}finally{this.loadingPromise===r&&(this.loadingPromise=null)}}async internalListSkills(){if(!await this.exists(this.skillsPath))return this.cachedSkills??[];let t=[],r=new Map,n=!1;try{let o=await je.readdir(this.skillsPath,{withFileTypes:!0});for(let i of o){if(!i.isDirectory()&&!i.isSymbolicLink())continue;let a=be.join(this.skillsPath,i.name),s=be.join(a,"SKILL.md");if(await this.exists(s))try{let c=await this.readFileNoFollow(s,this.skillsPath),{name:u,description:l}=this.parseFrontmatter(c),f={name:u||i.name,description:l,skillPath:s};t.push(f),r.set(f.name.toLowerCase(),f);let p=be.basename(be.dirname(f.skillPath)).toLowerCase();r.set(p,f)}catch{process.stderr.write(`Warning: Failed to read skill file in directory "${i.name}"
50
- `)}}n=!0}catch(o){process.stderr.write(`Error reading skills directory: ${String(o)}
51
- `)}return n&&(this.skillMap=r,this.cachedSkills=t.sort((o,i)=>o.name.localeCompare(i.name))),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){let n=be.resolve(t),o=be.resolve(r),i=async()=>{let l=await je.realpath(n),d=await je.realpath(o);if(!(await je.stat(d)).isDirectory())throw new Error("Skills directory must be a directory");let p=be.relative(d,l);if(p===".."||p.startsWith(`..${be.sep}`)||be.isAbsolute(p))throw new Error("File is outside skills directory");let h=await je.stat(l);if(!h.isFile()||h.nlink<1)throw new Error("Skill path is not a regular file");if(h.size>wn)throw new Error("Skill file exceeds size limit");return{realFilePath:l,stat:h}},a=await i(),s=await i();if(a.realFilePath!==s.realFilePath||a.stat.dev!==s.stat.dev||a.stat.ino!==s.stat.ino)throw new Error("File changed while validating its path");let c=process.platform==="win32"?0:je.constants.O_NOFOLLOW,u=await je.open(s.realFilePath,je.constants.O_RDONLY|c);try{let l=await u.stat();if(!l.isFile()||l.nlink<1||l.dev!==s.stat.dev||l.ino!==s.stat.ino||l.size>wn)throw new Error("File changed while opening");let d=[],f=64*1024,p=0;for(;p<=wn;){let g=Buffer.allocUnsafe(Math.min(f,wn+1-p)),{bytesRead:y}=await u.read(g,0,g.length,null);if(y===0)break;if(p+=y,d.push(g.subarray(0,y)),p>wn)throw new Error("Skill file exceeds size limit")}let h=await u.stat();if(h.size>wn||h.dev!==s.stat.dev||h.ino!==s.stat.ino)throw new Error("File changed while reading");return Buffer.concat(d,p).toString("utf-8")}finally{await u.close()}}async readSkillContent(t,r=!1){let n=be.resolve(t),o=be.resolve(this.skillsPath),i=n,a=o;try{i=await je.realpath(n),a=await je.realpath(o)}catch{}let s=be.relative(a,i);if(s.startsWith("..")||be.isAbsolute(s))throw new Error(`Access denied: path "${t}" is outside skills directory`);if(this.contentCache.has(i)&&!r)return this.contentCache.get(i);try{let c=await this.readFileNoFollow(t,this.skillsPath);c.charCodeAt(0)===65279&&(c=c.slice(1));let u=c.replace(/^---\s*\r?\n[\s\S]*?\r?\n---\s*\r?\n?/,"").trim();return this.contentCache.set(i,u),u}catch(c){throw new Error(`Failed to read skill content: ${c instanceof Error?c.message:String(c)}`)}}clearCache(){this.cachedSkills=null,this.loadingPromise=null,this.skillMap.clear(),this.contentCache.clear()}};var V=ft(require("fs")),N=ft(require("path")),Is=ft(require("os")),u$=ft(require("crypto")),fi={copilot:{name:"GitHub Copilot (VS Code)",aliases:["vscode","code","copilot"],getConfigPath:(e,t,r,n)=>e==="win32"?N.join(r||N.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?N.join(t,"Library","Application Support","Code","User","mcp.json"):N.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"?N.join(r||N.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?N.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):N.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)=>N.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||N.join(t,"AppData","Local");return N.join(o,"hermes","config.yaml")}return N.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)=>N.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"?N.join(r||N.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?N.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):N.join(t,".config","Claude","claude_desktop_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},devin:{name:"Devin Desktop (formerly Windsurf)",aliases:["devin","devin-desktop","windsurf","codeium"],getConfigPath:(e,t)=>{let r=N.join(t,".config","devin","mcp_config.json");return V.existsSync(r)?r:N.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)=>N.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=N.join(r||N.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(V.existsSync(i))return i;let a=N.join(t,".pi","agent","mcp.json");if(V.existsSync(a))return a;let s=N.join(t,".pi","mcp.json");return V.existsSync(s)?s:a}let n=N.join(t,".pi","agent","mcp.json");if(V.existsSync(n))return n;let o=N.join(t,".pi","mcp.json");return V.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=N.join(t,".qwenpaw","config.json");if(V.existsSync(r))return r;let n=N.join(t,".copaw","config.json");return V.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=N.join(r||N.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?n=N.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):n=N.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),V.existsSync(n))return n;let o=N.join(t,".cline","data","settings","cline_mcp_settings.json");return V.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=N.join(t,".config","kilo","kilo.jsonc");if(V.existsSync(r))return r;let n=N.join(t,".config","kilo","kilo.json");return V.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)=>N.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)=>N.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=N.join(r||N.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(V.existsSync(n))return n;let o=N.join(r||N.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return V.existsSync(o)?o:n}else if(e==="darwin"){let n=N.join(t,"Library","Application Support","Trae","User","mcp.json");if(V.existsSync(n))return n;let o=N.join(t,"Library","Application Support","Trae CN","User","mcp.json");return V.existsSync(o)?o:n}else{let n=N.join(t,".config","Trae","User","mcp.json");if(V.existsSync(n))return n;let o=N.join(t,".config","Trae CN","User","mcp.json");return V.existsSync(o)?o:n}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}};function Of(e){return Object.prototype.toString.call(e)==="[object Object]"}function jT(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/(^|[^:])\/\/.*$/gm,"$1").replace(/,\s*([\]}])/g,"$1")}function TT(e,t,r,n=!1){let o=e?e.split(/\r?\n/):[];if(n){let d=[],f=!1,p=0,h=!1,g=0;for(let y=0;y<o.length;y++){let $=o[y],k=$.match(/^(\s*)mcp_servers:\s*$/);if(k){f=!0,p=k[1].length,d.push($);continue}if(f){let x=$.match(/^(\s*)/)?.[1].length||0;if($.trim()!==""&&x<=p)f=!1,h=!1;else{let D=$.match(/^(\s*)superpowers:\s*$/);if(D&&D[1].length>p){h=!0,g=D[1].length;continue}if(h){if(x>g||$.trim()==="")continue;h=!1}}}d.push($)}return d.join(`
45
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");let k=p.compile();return(x,N)=>k(f,x,N)},i,a=hr,s=!_i.jitless,u=s&&Ls.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?Vm([],m,f,p,d,e):f):r(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function Om(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Xt(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>Ve(a,n,xe())))}),t)}var oo=h("$ZodUnion",(e,t)=>{L.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=>qn(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=>Om(c,o,e,i)):Om(s,o,e,i)}});function Dm(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=>Ve(a,n,xe())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var cu=h("$ZodXor",(e,t)=>{oo.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=>Dm(c,o,e,i)):Dm(s,o,e,i)}}),uu=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,oo.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=Br(()=>{let o=t.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!hr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let s=n.value.get(a?.[t.discriminator]);return s?s._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),lu=h("$ZodIntersection",(e,t)=>{L.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])=>Nm(r,c,u)):Nm(r,i,a)}});function Sc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Gt(e)&&Gt(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Sc(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=Sc(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 Nm(e,t,r){let n=new Map,o;for(let s of t.issues)if(s.code==="unrecognized_keys"){o??(o=s);for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).l=!0}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys)n.has(c)||n.set(c,{}),n.get(c).r=!0;else e.issues.push(s);let i=[...n].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&o&&e.issues.push({...o,keys:i}),Xt(e))return e;let a=Sc(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 Ri=h("$ZodTuple",(e,t)=>{L.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=>Pi(f,n,u))):Pi(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=>Pi(p,n,u))):Pi(f,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function Pi(e,t,r){e.issues.length&&t.issues.push(...Ye(r,e.issues)),t.value[r]=e.value}var du=h("$ZodRecord",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!Gt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=t.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Ye(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Ye(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"&&zi.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=>Ve(d,n,xe())),input:s,path:[s],inst:e});continue}let l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Ye(s,d.issues)),r.value[c.value]=d.value})):(l.issues.length&&r.issues.push(...Ye(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),pu=h("$ZodMap",(e,t)=>{L.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])=>{Rm(l,d,r,a,o,e,n)})):Rm(c,u,r,a,o,e,n)}return i.length?Promise.all(i).then(()=>r):r}});function Rm(e,t,r,n,o,i,a){e.issues.length&&(Ln.has(typeof n)?r.issues.push(...Ye(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(s=>Ve(s,a,xe()))})),t.issues.length&&(Ln.has(typeof n)?r.issues.push(...Ye(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(s=>Ve(s,a,xe()))})),r.value.set(e.value,t.value)}var fu=h("$ZodSet",(e,t)=>{L.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=>Zm(c,r))):Zm(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Zm(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var mu=h("$ZodEnum",(e,t)=>{L.init(e,t);let r=Fn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Ln.has(typeof o)).map(o=>typeof o=="string"?nt(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}}),hu=h("$ZodLiteral",(e,t)=>{if(L.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"?nt(n):n?nt(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}}),gu=h("$ZodFile",(e,t)=>{L.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}}),vu=h("$ZodTransform",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new kt;return r.value=o,r}});function Cm(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Zi=h("$ZodOptional",(e,t)=>{L.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(`^(${qn(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=>Cm(i,r.value)):Cm(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),yu=h("$ZodExactOptional",(e,t)=>{Zi.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)}),_u=h("$ZodNullable",(e,t)=>{L.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(`^(${qn(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)}),$u=h("$ZodDefault",(e,t)=>{L.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=>Am(i,t)):Am(o,t)}});function Am(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var bu=h("$ZodPrefault",(e,t)=>{L.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))}),xu=h("$ZodNonOptional",(e,t)=>{L.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=>Um(i,e)):Um(o,e)}});function Um(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 ku=h("$ZodSuccess",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),wu=h("$ZodCatch",(e,t)=>{L.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=>Ve(a,n,xe()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>Ve(i,n,xe()))},input:r.value}),r.issues=[]),r)}}),Su=h("$ZodNaN",(e,t)=>{L.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)}),zu=h("$ZodPipe",(e,t)=>{L.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=>ji(a,t.in,n)):ji(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ji(i,t.out,n)):ji(o,t.out,n)}});function ji(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var io=h("$ZodCodec",(e,t)=>{L.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=>Ti(a,t,n)):Ti(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Ti(a,t,n)):Ti(i,t,n)}}});function Ti(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=>Ei(e,i,t.out,r)):Ei(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Ei(e,i,t.in,r)):Ei(e,o,t.in,r)}}function Ei(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var Iu=h("$ZodReadonly",(e,t)=>{L.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(Mm):Mm(o)}});function Mm(e){return e.value=Object.freeze(e.value),e}var Pu=h("$ZodTemplateLiteral",(e,t)=>{L.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||Js.has(typeof n))r.push(nt(`${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)}),ju=h("$ZodFunction",(e,t)=>(L.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?Bn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Bn(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 Gn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await Gn(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 Ri({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)),Tu=h("$ZodPromise",(e,t)=>{L.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),Eu=h("$ZodLazy",(e,t)=>{L.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)}),Ou=h("$ZodCustom",(e,t)=>{ue.init(e,t),L.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=>Fm(i,r,n,e));Fm(o,r,n,e)}});function Fm(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(Wr(o))}}var Jb=()=>{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=M(o.input),s=n[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${A(o.values[0])}`:`Invalid option: expected one of ${C(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":""}: ${C(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 Du(){return{localeError:Jb()}}var Hm;var Ru=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 Zu(){return new Ru}(Hm=globalThis).__zod_globalRegistry??(Hm.__zod_globalRegistry=Zu());var Ue=globalThis.__zod_globalRegistry;function Cu(e,t){return new e({type:"string",...S(t)})}function Ci(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...S(t)})}function ao(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...S(t)})}function Ai(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...S(t)})}function Ui(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...S(t)})}function Mi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...S(t)})}function Fi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...S(t)})}function so(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...S(t)})}function qi(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...S(t)})}function Li(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...S(t)})}function Vi(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...S(t)})}function Ji(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...S(t)})}function Ki(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...S(t)})}function Hi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...S(t)})}function Bi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...S(t)})}function Wi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...S(t)})}function Gi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...S(t)})}function Au(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...S(t)})}function Xi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...S(t)})}function Yi(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...S(t)})}function Qi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...S(t)})}function ea(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...S(t)})}function ta(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...S(t)})}function ra(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...S(t)})}function Uu(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...S(t)})}function Mu(e,t){return new e({type:"string",format:"date",check:"string_format",...S(t)})}function Fu(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...S(t)})}function qu(e,t){return new e({type:"string",format:"duration",check:"string_format",...S(t)})}function Lu(e,t){return new e({type:"number",checks:[],...S(t)})}function Vu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...S(t)})}function Ju(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...S(t)})}function Ku(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...S(t)})}function Hu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...S(t)})}function Bu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...S(t)})}function Wu(e,t){return new e({type:"boolean",...S(t)})}function Gu(e,t){return new e({type:"bigint",...S(t)})}function Xu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...S(t)})}function Yu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...S(t)})}function Qu(e,t){return new e({type:"symbol",...S(t)})}function el(e,t){return new e({type:"undefined",...S(t)})}function tl(e,t){return new e({type:"null",...S(t)})}function rl(e){return new e({type:"any"})}function nl(e){return new e({type:"unknown"})}function ol(e,t){return new e({type:"never",...S(t)})}function il(e,t){return new e({type:"void",...S(t)})}function al(e,t){return new e({type:"date",...S(t)})}function sl(e,t){return new e({type:"nan",...S(t)})}function Zt(e,t){return new kc({check:"less_than",...S(t),value:e,inclusive:!1})}function Qe(e,t){return new kc({check:"less_than",...S(t),value:e,inclusive:!0})}function Ct(e,t){return new wc({check:"greater_than",...S(t),value:e,inclusive:!1})}function Me(e,t){return new wc({check:"greater_than",...S(t),value:e,inclusive:!0})}function cl(e){return Ct(0,e)}function ul(e){return Zt(0,e)}function ll(e){return Qe(0,e)}function dl(e){return Me(0,e)}function yr(e,t){return new dm({check:"multiple_of",...S(t),value:e})}function _r(e,t){return new mm({check:"max_size",...S(t),maximum:e})}function At(e,t){return new hm({check:"min_size",...S(t),minimum:e})}function Xr(e,t){return new gm({check:"size_equals",...S(t),size:e})}function Yr(e,t){return new vm({check:"max_length",...S(t),maximum:e})}function Yt(e,t){return new ym({check:"min_length",...S(t),minimum:e})}function Qr(e,t){return new _m({check:"length_equals",...S(t),length:e})}function co(e,t){return new $m({check:"string_format",format:"regex",...S(t),pattern:e})}function uo(e){return new bm({check:"string_format",format:"lowercase",...S(e)})}function lo(e){return new xm({check:"string_format",format:"uppercase",...S(e)})}function po(e,t){return new km({check:"string_format",format:"includes",...S(t),includes:e})}function fo(e,t){return new wm({check:"string_format",format:"starts_with",...S(t),prefix:e})}function mo(e,t){return new Sm({check:"string_format",format:"ends_with",...S(t),suffix:e})}function pl(e,t,r){return new zm({check:"property",property:e,schema:t,...S(r)})}function ho(e,t){return new Im({check:"mime_type",mime:e,...S(t)})}function wt(e){return new Pm({check:"overwrite",tx:e})}function go(e){return wt(t=>t.normalize(e))}function vo(){return wt(e=>e.trim())}function yo(){return wt(e=>e.toLowerCase())}function _o(){return wt(e=>e.toUpperCase())}function na(){return wt(e=>qs(e))}function Bm(e,t,r){return new e({type:"array",element:t,...S(r)})}function fl(e,t){return new e({type:"file",...S(t)})}function ml(e,t,r){let n=S(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function hl(e,t,r){return new e({type:"custom",check:"custom",fn:t,...S(r)})}function gl(e){let t=Wb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Wr(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(Wr(o))}},e(r.value,r)));return t}function Wb(e,t){let r=new ue({check:"custom",...S(t)});return r._zod.check=e,r}function vl(e){let t=new ue({check:"describe"});return t._zod.onattach=[r=>{let n=Ue.get(r)??{};Ue.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function yl(e){let t=new ue({check:"meta"});return t._zod.onattach=[r=>{let n=Ue.get(r)??{};Ue.add(r,{...n,...e})}],t._zod.check=()=>{},t}function _l(e,t){let r=S(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??io,c=e.Boolean??no,u=e.String??vr,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 g=p;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!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 en(e,t,r,n={}){let o=S(n),i={...S(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 oa(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??Ue,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function fe(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,l);else{let 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),fe(d,t,l),t.seen.get(d).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&Fe(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 ia(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 aa(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 g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(p.$ref&&f.def)for(let g in c)g==="$ref"||g==="allOf"||g in f.def&&JSON.stringify(c[g])===JSON.stringify(f.def[g])&&delete c[g]}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:$o(t,"input",e.processors),output:$o(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Fe(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 Fe(n.element,r);if(n.type==="set")return Fe(n.valueType,r);if(n.type==="lazy")return Fe(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 Fe(n.innerType,r);if(n.type==="intersection")return Fe(n.left,r)||Fe(n.right,r);if(n.type==="record"||n.type==="map")return Fe(n.keyType,r)||Fe(n.valueType,r);if(n.type==="pipe")return Fe(n.in,r)||Fe(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Fe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Fe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Fe(o,r))return!0;return!!(n.rest&&Fe(n.rest,r))}return!1}var Wm=(e,t={})=>r=>{let n=oa({...r,processors:t});return fe(e,n),ia(n,e),aa(n,e)},$o=(e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},a=oa({...o??{},target:i,io:t,processors:r});return fe(e,a),ia(a,e),aa(a,e)};var Gb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gm=(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=Gb[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}))])}},Xm=(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)},Ym=(e,t,r,n)=>{r.type="boolean"},Qm=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},eh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},th=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},rh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},nh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},oh=(e,t,r,n)=>{r.not={}},ih=(e,t,r,n)=>{},ah=(e,t,r,n)=>{},sh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},ch=(e,t,r,n)=>{let o=e._zod.def,i=Fn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},uh=(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},lh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},dh=(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},ph=(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)},fh=(e,t,r,n)=>{r.type="boolean"},mh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},hh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},gh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},vh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},yh=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},_h=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=fe(i.element,t,{...n,path:[...n.path,"items"]})},$h=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=fe(a[u],t,{...n,path:[...n.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter(u=>{let l=i.shape[u]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=fe(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},$l=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>fe(s,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},bh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=fe(o.right,t,{...n,path:[...n.path,"allOf",1]}),s=u=>"allOf"in u&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},xh=(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)=>fe(f,t,{...n,path:[...n.path,a,p]})),u=i.rest?fe(i.rest,t,{...n,path:[...n.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),o.minItems=c.length,u||(o.maxItems=c.length)):(o.items=c,u&&(o.additionalItems=u));let{minimum:l,maximum:d}=e._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},kh=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let l=fe(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let d of c)o.patternProperties[d.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=fe(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=fe(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let u=a._zod.values;if(u){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(o.required=l)}},wh=(e,t,r,n)=>{let o=e._zod.def,i=fe(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},Sh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},zh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Ih=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ph=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},jh=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;fe(i,t,n);let a=t.seen.get(e);a.ref=i},Th=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Eh=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},bl=(e,t,r,n)=>{let o=e._zod.def;fe(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Oh=(e,t,r,n)=>{let o=e._zod.innerType;fe(o,t,n);let i=t.seen.get(e);i.ref=o};function tn(e){return!!e._zod}function Qt(e,t){return tn(e)?Gr(e,t):e.safeParse(t)}function sa(e){if(!e)return;let t;if(tn(e)?t=e._zod?.def?.shape:t=e.shape,!!t){if(typeof t=="function")try{return t()}catch{return}return t}}function Zh(e){if(tn(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 bo={};In(bo,{ZodAny:()=>eg,ZodArray:()=>og,ZodBase64:()=>Jl,ZodBase64URL:()=>Kl,ZodBigInt:()=>ga,ZodBigIntFormat:()=>Wl,ZodBoolean:()=>ha,ZodCIDRv4:()=>Ll,ZodCIDRv6:()=>Vl,ZodCUID:()=>Zl,ZodCUID2:()=>Cl,ZodCatch:()=>wg,ZodCodec:()=>rd,ZodCustom:()=>ba,ZodCustomStringFormat:()=>ko,ZodDate:()=>Xl,ZodDefault:()=>yg,ZodDiscriminatedUnion:()=>ag,ZodE164:()=>Hl,ZodEmail:()=>Dl,ZodEmoji:()=>Nl,ZodEnum:()=>xo,ZodExactOptional:()=>hg,ZodFile:()=>fg,ZodFunction:()=>Dg,ZodGUID:()=>ua,ZodIPv4:()=>Fl,ZodIPv6:()=>ql,ZodIntersection:()=>sg,ZodJWT:()=>Bl,ZodKSUID:()=>Ml,ZodLazy:()=>Tg,ZodLiteral:()=>pg,ZodMAC:()=>Gh,ZodMap:()=>lg,ZodNaN:()=>zg,ZodNanoID:()=>Rl,ZodNever:()=>rg,ZodNonOptional:()=>ed,ZodNull:()=>Qh,ZodNullable:()=>vg,ZodNumber:()=>ma,ZodNumberFormat:()=>rn,ZodObject:()=>va,ZodOptional:()=>Ql,ZodPipe:()=>td,ZodPrefault:()=>$g,ZodPromise:()=>Og,ZodReadonly:()=>Ig,ZodRecord:()=>$a,ZodSet:()=>dg,ZodString:()=>pa,ZodStringFormat:()=>le,ZodSuccess:()=>kg,ZodSymbol:()=>Xh,ZodTemplateLiteral:()=>jg,ZodTransform:()=>mg,ZodTuple:()=>cg,ZodType:()=>H,ZodULID:()=>Al,ZodURL:()=>fa,ZodUUID:()=>Ut,ZodUndefined:()=>Yh,ZodUnion:()=>ya,ZodUnknown:()=>tg,ZodVoid:()=>ng,ZodXID:()=>Ul,ZodXor:()=>ig,_ZodString:()=>Ol,_default:()=>_g,_function:()=>mk,any:()=>Gx,array:()=>Y,base64:()=>Dx,base64url:()=>Nx,bigint:()=>Jx,boolean:()=>be,catch:()=>Sg,check:()=>hk,cidrv4:()=>Ex,cidrv6:()=>Ox,codec:()=>dk,cuid:()=>kx,cuid2:()=>wx,custom:()=>nd,date:()=>Yx,describe:()=>gk,discriminatedUnion:()=>_a,e164:()=>Rx,email:()=>fx,emoji:()=>bx,enum:()=>Oe,exactOptional:()=>gg,file:()=>sk,float32:()=>Fx,float64:()=>qx,function:()=>mk,guid:()=>mx,hash:()=>Mx,hex:()=>Ux,hostname:()=>Ax,httpUrl:()=>$x,instanceof:()=>yk,int:()=>El,int32:()=>Lx,int64:()=>Kx,intersection:()=>So,ipv4:()=>Px,ipv6:()=>Tx,json:()=>$k,jwt:()=>Zx,keyof:()=>Qx,ksuid:()=>Ix,lazy:()=>Eg,literal:()=>E,looseObject:()=>Ee,looseRecord:()=>nk,mac:()=>jx,map:()=>ok,meta:()=>vk,nan:()=>lk,nanoid:()=>xx,nativeEnum:()=>ak,never:()=>Gl,nonoptional:()=>xg,null:()=>wo,nullable:()=>la,nullish:()=>ck,number:()=>ie,object:()=>P,optional:()=>ge,partialRecord:()=>rk,pipe:()=>da,prefault:()=>bg,preprocess:()=>xa,promise:()=>fk,readonly:()=>Pg,record:()=>me,refine:()=>Ng,set:()=>ik,strictObject:()=>ek,string:()=>v,stringFormat:()=>Cx,stringbool:()=>_k,success:()=>uk,superRefine:()=>Rg,symbol:()=>Bx,templateLiteral:()=>pk,transform:()=>Yl,tuple:()=>ug,uint32:()=>Vx,uint64:()=>Hx,ulid:()=>Sx,undefined:()=>Wx,union:()=>se,unknown:()=>de,url:()=>_x,uuid:()=>hx,uuidv4:()=>gx,uuidv6:()=>vx,uuidv7:()=>yx,void:()=>Xx,xid:()=>zx,xor:()=>tk});var ca={};In(ca,{endsWith:()=>mo,gt:()=>Ct,gte:()=>Me,includes:()=>po,length:()=>Qr,lowercase:()=>uo,lt:()=>Zt,lte:()=>Qe,maxLength:()=>Yr,maxSize:()=>_r,mime:()=>ho,minLength:()=>Yt,minSize:()=>At,multipleOf:()=>yr,negative:()=>ul,nonnegative:()=>dl,nonpositive:()=>ll,normalize:()=>go,overwrite:()=>wt,positive:()=>cl,property:()=>pl,regex:()=>co,size:()=>Xr,slugify:()=>na,startsWith:()=>fo,toLowerCase:()=>yo,toUpperCase:()=>_o,trim:()=>vo,uppercase:()=>lo});var $r={};In($r,{ZodISODate:()=>Sl,ZodISODateTime:()=>kl,ZodISODuration:()=>jl,ZodISOTime:()=>Il,date:()=>zl,datetime:()=>wl,duration:()=>Tl,time:()=>Pl});var kl=h("ZodISODateTime",(e,t)=>{Cc.init(e,t),le.init(e,t)});function wl(e){return Uu(kl,e)}var Sl=h("ZodISODate",(e,t)=>{Ac.init(e,t),le.init(e,t)});function zl(e){return Mu(Sl,e)}var Il=h("ZodISOTime",(e,t)=>{Uc.init(e,t),le.init(e,t)});function Pl(e){return Fu(Il,e)}var jl=h("ZodISODuration",(e,t)=>{Mc.init(e,t),le.init(e,t)});function Tl(e){return qu(jl,e)}var Ch=(e,t)=>{xi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>wi(e,r)},flatten:{value:r=>ki(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Hr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Hr,2)}},isEmpty:{get(){return e.issues.length===0}}})},UN=h("ZodError",Ch),et=h("ZodError",Ch,{Parent:Error});var Ah=Hn(et),Uh=Wn(et),Mh=Xn(et),Fh=Yn(et),qh=Yf(et),Lh=Qf(et),Vh=em(et),Jh=tm(et),Kh=rm(et),Hh=nm(et),Bh=om(et),Wh=im(et);var H=h("ZodType",(e,t)=>(L.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:$o(e,"input"),output:$o(e,"output")}}),e.toJSONSchema=Wm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(b.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)=>Ae(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Ah(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Mh(e,r,n),e.parseAsync=async(r,n)=>Uh(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Fh(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>qh(e,r,n),e.decode=(r,n)=>Lh(e,r,n),e.encodeAsync=async(r,n)=>Vh(e,r,n),e.decodeAsync=async(r,n)=>Jh(e,r,n),e.safeEncode=(r,n)=>Kh(e,r,n),e.safeDecode=(r,n)=>Hh(e,r,n),e.safeEncodeAsync=async(r,n)=>Bh(e,r,n),e.safeDecodeAsync=async(r,n)=>Wh(e,r,n),e.refine=(r,n)=>e.check(Ng(r,n)),e.superRefine=r=>e.check(Rg(r)),e.overwrite=r=>e.check(wt(r)),e.optional=()=>ge(e),e.exactOptional=()=>gg(e),e.nullable=()=>la(e),e.nullish=()=>ge(la(e)),e.nonoptional=r=>xg(e,r),e.array=()=>Y(e),e.or=r=>se([e,r]),e.and=r=>So(e,r),e.transform=r=>da(e,Yl(r)),e.default=r=>_g(e,r),e.prefault=r=>bg(e,r),e.catch=r=>Sg(e,r),e.pipe=r=>da(e,r),e.readonly=()=>Pg(e),e.describe=r=>{let n=e.clone();return Ue.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ue.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ue.get(e);let n=e.clone();return Ue.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Ol=h("_ZodString",(e,t)=>{vr.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Gm(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(co(...n)),e.includes=(...n)=>e.check(po(...n)),e.startsWith=(...n)=>e.check(fo(...n)),e.endsWith=(...n)=>e.check(mo(...n)),e.min=(...n)=>e.check(Yt(...n)),e.max=(...n)=>e.check(Yr(...n)),e.length=(...n)=>e.check(Qr(...n)),e.nonempty=(...n)=>e.check(Yt(1,...n)),e.lowercase=n=>e.check(uo(n)),e.uppercase=n=>e.check(lo(n)),e.trim=()=>e.check(vo()),e.normalize=(...n)=>e.check(go(...n)),e.toLowerCase=()=>e.check(yo()),e.toUpperCase=()=>e.check(_o()),e.slugify=()=>e.check(na())}),pa=h("ZodString",(e,t)=>{vr.init(e,t),Ol.init(e,t),e.email=r=>e.check(Ci(Dl,r)),e.url=r=>e.check(so(fa,r)),e.jwt=r=>e.check(ra(Bl,r)),e.emoji=r=>e.check(qi(Nl,r)),e.guid=r=>e.check(ao(ua,r)),e.uuid=r=>e.check(Ai(Ut,r)),e.uuidv4=r=>e.check(Ui(Ut,r)),e.uuidv6=r=>e.check(Mi(Ut,r)),e.uuidv7=r=>e.check(Fi(Ut,r)),e.nanoid=r=>e.check(Li(Rl,r)),e.guid=r=>e.check(ao(ua,r)),e.cuid=r=>e.check(Vi(Zl,r)),e.cuid2=r=>e.check(Ji(Cl,r)),e.ulid=r=>e.check(Ki(Al,r)),e.base64=r=>e.check(Qi(Jl,r)),e.base64url=r=>e.check(ea(Kl,r)),e.xid=r=>e.check(Hi(Ul,r)),e.ksuid=r=>e.check(Bi(Ml,r)),e.ipv4=r=>e.check(Wi(Fl,r)),e.ipv6=r=>e.check(Gi(ql,r)),e.cidrv4=r=>e.check(Xi(Ll,r)),e.cidrv6=r=>e.check(Yi(Vl,r)),e.e164=r=>e.check(ta(Hl,r)),e.datetime=r=>e.check(wl(r)),e.date=r=>e.check(zl(r)),e.time=r=>e.check(Pl(r)),e.duration=r=>e.check(Tl(r))});function v(e){return Cu(pa,e)}var le=h("ZodStringFormat",(e,t)=>{ae.init(e,t),Ol.init(e,t)}),Dl=h("ZodEmail",(e,t)=>{Pc.init(e,t),le.init(e,t)});function fx(e){return Ci(Dl,e)}var ua=h("ZodGUID",(e,t)=>{zc.init(e,t),le.init(e,t)});function mx(e){return ao(ua,e)}var Ut=h("ZodUUID",(e,t)=>{Ic.init(e,t),le.init(e,t)});function hx(e){return Ai(Ut,e)}function gx(e){return Ui(Ut,e)}function vx(e){return Mi(Ut,e)}function yx(e){return Fi(Ut,e)}var fa=h("ZodURL",(e,t)=>{jc.init(e,t),le.init(e,t)});function _x(e){return so(fa,e)}function $x(e){return so(fa,{protocol:/^https?$/,hostname:ot.domain,...b.normalizeParams(e)})}var Nl=h("ZodEmoji",(e,t)=>{Tc.init(e,t),le.init(e,t)});function bx(e){return qi(Nl,e)}var Rl=h("ZodNanoID",(e,t)=>{Ec.init(e,t),le.init(e,t)});function xx(e){return Li(Rl,e)}var Zl=h("ZodCUID",(e,t)=>{Oc.init(e,t),le.init(e,t)});function kx(e){return Vi(Zl,e)}var Cl=h("ZodCUID2",(e,t)=>{Dc.init(e,t),le.init(e,t)});function wx(e){return Ji(Cl,e)}var Al=h("ZodULID",(e,t)=>{Nc.init(e,t),le.init(e,t)});function Sx(e){return Ki(Al,e)}var Ul=h("ZodXID",(e,t)=>{Rc.init(e,t),le.init(e,t)});function zx(e){return Hi(Ul,e)}var Ml=h("ZodKSUID",(e,t)=>{Zc.init(e,t),le.init(e,t)});function Ix(e){return Bi(Ml,e)}var Fl=h("ZodIPv4",(e,t)=>{Fc.init(e,t),le.init(e,t)});function Px(e){return Wi(Fl,e)}var Gh=h("ZodMAC",(e,t)=>{Lc.init(e,t),le.init(e,t)});function jx(e){return Au(Gh,e)}var ql=h("ZodIPv6",(e,t)=>{qc.init(e,t),le.init(e,t)});function Tx(e){return Gi(ql,e)}var Ll=h("ZodCIDRv4",(e,t)=>{Vc.init(e,t),le.init(e,t)});function Ex(e){return Xi(Ll,e)}var Vl=h("ZodCIDRv6",(e,t)=>{Jc.init(e,t),le.init(e,t)});function Ox(e){return Yi(Vl,e)}var Jl=h("ZodBase64",(e,t)=>{Kc.init(e,t),le.init(e,t)});function Dx(e){return Qi(Jl,e)}var Kl=h("ZodBase64URL",(e,t)=>{Hc.init(e,t),le.init(e,t)});function Nx(e){return ea(Kl,e)}var Hl=h("ZodE164",(e,t)=>{Bc.init(e,t),le.init(e,t)});function Rx(e){return ta(Hl,e)}var Bl=h("ZodJWT",(e,t)=>{Wc.init(e,t),le.init(e,t)});function Zx(e){return ra(Bl,e)}var ko=h("ZodCustomStringFormat",(e,t)=>{Gc.init(e,t),le.init(e,t)});function Cx(e,t,r={}){return en(ko,e,t,r)}function Ax(e){return en(ko,"hostname",ot.hostname,e)}function Ux(e){return en(ko,"hex",ot.hex,e)}function Mx(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=ot[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return en(ko,n,o,t)}var ma=h("ZodNumber",(e,t)=>{Di.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Xm(e,n,o,i),e.gt=(n,o)=>e.check(Ct(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Zt(n,o)),e.lte=(n,o)=>e.check(Qe(n,o)),e.max=(n,o)=>e.check(Qe(n,o)),e.int=n=>e.check(El(n)),e.safe=n=>e.check(El(n)),e.positive=n=>e.check(Ct(0,n)),e.nonnegative=n=>e.check(Me(0,n)),e.negative=n=>e.check(Zt(0,n)),e.nonpositive=n=>e.check(Qe(0,n)),e.multipleOf=(n,o)=>e.check(yr(n,o)),e.step=(n,o)=>e.check(yr(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function ie(e){return Lu(ma,e)}var rn=h("ZodNumberFormat",(e,t)=>{Xc.init(e,t),ma.init(e,t)});function El(e){return Vu(rn,e)}function Fx(e){return Ju(rn,e)}function qx(e){return Ku(rn,e)}function Lx(e){return Hu(rn,e)}function Vx(e){return Bu(rn,e)}var ha=h("ZodBoolean",(e,t)=>{no.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ym(e,r,n,o)});function be(e){return Wu(ha,e)}var ga=h("ZodBigInt",(e,t)=>{Ni.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Qm(e,n,o,i),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.gt=(n,o)=>e.check(Ct(n,o)),e.gte=(n,o)=>e.check(Me(n,o)),e.min=(n,o)=>e.check(Me(n,o)),e.lt=(n,o)=>e.check(Zt(n,o)),e.lte=(n,o)=>e.check(Qe(n,o)),e.max=(n,o)=>e.check(Qe(n,o)),e.positive=n=>e.check(Ct(BigInt(0),n)),e.negative=n=>e.check(Zt(BigInt(0),n)),e.nonpositive=n=>e.check(Qe(BigInt(0),n)),e.nonnegative=n=>e.check(Me(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(yr(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Jx(e){return Gu(ga,e)}var Wl=h("ZodBigIntFormat",(e,t)=>{Yc.init(e,t),ga.init(e,t)});function Kx(e){return Xu(Wl,e)}function Hx(e){return Yu(Wl,e)}var Xh=h("ZodSymbol",(e,t)=>{Qc.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>eh(e,r,n,o)});function Bx(e){return Qu(Xh,e)}var Yh=h("ZodUndefined",(e,t)=>{eu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rh(e,r,n,o)});function Wx(e){return el(Yh,e)}var Qh=h("ZodNull",(e,t)=>{tu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>th(e,r,n,o)});function wo(e){return tl(Qh,e)}var eg=h("ZodAny",(e,t)=>{ru.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ih(e,r,n,o)});function Gx(){return rl(eg)}var tg=h("ZodUnknown",(e,t)=>{nu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ah(e,r,n,o)});function de(){return nl(tg)}var rg=h("ZodNever",(e,t)=>{ou.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oh(e,r,n,o)});function Gl(e){return ol(rg,e)}var ng=h("ZodVoid",(e,t)=>{iu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nh(e,r,n,o)});function Xx(e){return il(ng,e)}var Xl=h("ZodDate",(e,t)=>{au.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>sh(e,n,o,i),e.min=(n,o)=>e.check(Me(n,o)),e.max=(n,o)=>e.check(Qe(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 Yx(e){return al(Xl,e)}var og=h("ZodArray",(e,t)=>{su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_h(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Yt(r,n)),e.nonempty=r=>e.check(Yt(1,r)),e.max=(r,n)=>e.check(Yr(r,n)),e.length=(r,n)=>e.check(Qr(r,n)),e.unwrap=()=>e.element});function Y(e,t){return Bm(og,e,t)}function Qx(e){let t=e._zod.def.shape;return Oe(Object.keys(t))}var va=h("ZodObject",(e,t)=>{Km.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$h(e,r,n,o),b.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>Oe(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:de()}),e.loose=()=>e.clone({...e._zod.def,catchall:de()}),e.strict=()=>e.clone({...e._zod.def,catchall:Gl()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>b.extend(e,r),e.safeExtend=r=>b.safeExtend(e,r),e.merge=r=>b.merge(e,r),e.pick=r=>b.pick(e,r),e.omit=r=>b.omit(e,r),e.partial=(...r)=>b.partial(Ql,e,r[0]),e.required=(...r)=>b.required(ed,e,r[0])});function P(e,t){let r={type:"object",shape:e??{},...b.normalizeParams(t)};return new va(r)}function ek(e,t){return new va({type:"object",shape:e,catchall:Gl(),...b.normalizeParams(t)})}function Ee(e,t){return new va({type:"object",shape:e,catchall:de(),...b.normalizeParams(t)})}var ya=h("ZodUnion",(e,t)=>{oo.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$l(e,r,n,o),e.options=t.options});function se(e,t){return new ya({type:"union",options:e,...b.normalizeParams(t)})}var ig=h("ZodXor",(e,t)=>{ya.init(e,t),cu.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$l(e,r,n,o),e.options=t.options});function tk(e,t){return new ig({type:"union",options:e,inclusive:!1,...b.normalizeParams(t)})}var ag=h("ZodDiscriminatedUnion",(e,t)=>{ya.init(e,t),uu.init(e,t)});function _a(e,t,r){return new ag({type:"union",options:t,discriminator:e,...b.normalizeParams(r)})}var sg=h("ZodIntersection",(e,t)=>{lu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bh(e,r,n,o)});function So(e,t){return new sg({type:"intersection",left:e,right:t})}var cg=h("ZodTuple",(e,t)=>{Ri.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xh(e,r,n,o),e.rest=r=>e.clone({...e._zod.def,rest:r})});function ug(e,t,r){let n=t instanceof L,o=n?r:t,i=n?t:null;return new cg({type:"tuple",items:e,rest:i,...b.normalizeParams(o)})}var $a=h("ZodRecord",(e,t)=>{du.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function me(e,t,r){return new $a({type:"record",keyType:e,valueType:t,...b.normalizeParams(r)})}function rk(e,t,r){let n=Ae(e);return n._zod.values=void 0,new $a({type:"record",keyType:n,valueType:t,...b.normalizeParams(r)})}function nk(e,t,r){return new $a({type:"record",keyType:e,valueType:t,mode:"loose",...b.normalizeParams(r)})}var lg=h("ZodMap",(e,t)=>{pu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vh(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(Xr(...r))});function ok(e,t,r){return new lg({type:"map",keyType:e,valueType:t,...b.normalizeParams(r)})}var dg=h("ZodSet",(e,t)=>{fu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yh(e,r,n,o),e.min=(...r)=>e.check(At(...r)),e.nonempty=r=>e.check(At(1,r)),e.max=(...r)=>e.check(_r(...r)),e.size=(...r)=>e.check(Xr(...r))});function ik(e,t){return new dg({type:"set",valueType:e,...b.normalizeParams(t)})}var xo=h("ZodEnum",(e,t)=>{mu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ch(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 xo({...t,checks:[],...b.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 xo({...t,checks:[],...b.normalizeParams(o),entries:i})}});function Oe(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new xo({type:"enum",entries:r,...b.normalizeParams(t)})}function ak(e,t){return new xo({type:"enum",entries:e,...b.normalizeParams(t)})}var pg=h("ZodLiteral",(e,t)=>{hu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>uh(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 E(e,t){return new pg({type:"literal",values:Array.isArray(e)?e:[e],...b.normalizeParams(t)})}var fg=h("ZodFile",(e,t)=>{gu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ph(e,r,n,o),e.min=(r,n)=>e.check(At(r,n)),e.max=(r,n)=>e.check(_r(r,n)),e.mime=(r,n)=>e.check(ho(Array.isArray(r)?r:[r],n))});function sk(e){return fl(fg,e)}var mg=h("ZodTransform",(e,t)=>{vu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gh(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new mr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(b.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(b.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 Yl(e){return new mg({type:"transform",transform:e})}var Ql=h("ZodOptional",(e,t)=>{Zi.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ge(e){return new Ql({type:"optional",innerType:e})}var hg=h("ZodExactOptional",(e,t)=>{yu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bl(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gg(e){return new hg({type:"optional",innerType:e})}var vg=h("ZodNullable",(e,t)=>{_u.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 la(e){return new vg({type:"nullable",innerType:e})}function ck(e){return ge(la(e))}var yg=h("ZodDefault",(e,t)=>{$u.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 _g(e,t){return new yg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var $g=h("ZodPrefault",(e,t)=>{bu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ih(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bg(e,t){return new $g({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():b.shallowClone(t)}})}var ed=h("ZodNonOptional",(e,t)=>{xu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function xg(e,t){return new ed({type:"nonoptional",innerType:e,...b.normalizeParams(t)})}var kg=h("ZodSuccess",(e,t)=>{ku.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 uk(e){return new kg({type:"success",innerType:e})}var wg=h("ZodCatch",(e,t)=>{wu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ph(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Sg(e,t){return new wg({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var zg=h("ZodNaN",(e,t)=>{Su.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lh(e,r,n,o)});function lk(e){return sl(zg,e)}var td=h("ZodPipe",(e,t)=>{zu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jh(e,r,n,o),e.in=t.in,e.out=t.out});function da(e,t){return new td({type:"pipe",in:e,out:t})}var rd=h("ZodCodec",(e,t)=>{td.init(e,t),io.init(e,t)});function dk(e,t,r){return new rd({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var Ig=h("ZodReadonly",(e,t)=>{Iu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Th(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Pg(e){return new Ig({type:"readonly",innerType:e})}var jg=h("ZodTemplateLiteral",(e,t)=>{Pu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dh(e,r,n,o)});function pk(e,t){return new jg({type:"template_literal",parts:e,...b.normalizeParams(t)})}var Tg=h("ZodLazy",(e,t)=>{Eu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oh(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Eg(e){return new Tg({type:"lazy",getter:e})}var Og=h("ZodPromise",(e,t)=>{Tu.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eh(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fk(e){return new Og({type:"promise",innerType:e})}var Dg=h("ZodFunction",(e,t)=>{ju.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hh(e,r,n,o)});function mk(e){return new Dg({type:"function",input:Array.isArray(e?.input)?ug(e?.input):e?.input??Y(de()),output:e?.output??de()})}var ba=h("ZodCustom",(e,t)=>{Ou.init(e,t),H.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mh(e,r,n,o)});function hk(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function nd(e,t){return ml(ba,e??(()=>!0),t)}function Ng(e,t={}){return hl(ba,e,t)}function Rg(e){return gl(e)}var gk=vl,vk=yl;function yk(e,t={}){let r=new ba({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...b.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 _k=(...e)=>_l({Codec:rd,Boolean:ha,String:pa},...e);function $k(e){let t=Eg(()=>se([v(e),ie(),be(),wo(),Y(t),me(v(),t)]));return t}function xa(e,t){return da(Yl(e),t)}var Zg;Zg||(Zg={});var HN={...bo,...ca,iso:$r};xe(Du());var id="2025-11-25";var Cg=[id,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],er="io.modelcontextprotocol/related-task",wa="2.0",ke=nd(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Ag=se([v(),ie().int()]),Ug=v(),p4=Ee({ttl:se([ie(),wo()]).optional(),pollInterval:ie().optional()}),wk=P({ttl:ie().optional()}),Sk=P({taskId:v()}),ad=Ee({progressToken:Ag.optional(),[er]:Sk.optional()}),tt=P({_meta:ad.optional()}),zo=tt.extend({task:wk.optional()}),Mg=e=>zo.safeParse(e).success,we=P({method:v(),params:tt.loose().optional()}),it=P({_meta:ad.optional()}),at=P({method:v(),params:it.loose().optional()}),Se=Ee({_meta:ad.optional()}),Sa=se([v(),ie().int()]),Fg=P({jsonrpc:E(wa),id:Sa,...we.shape}).strict(),sd=e=>Fg.safeParse(e).success,qg=P({jsonrpc:E(wa),...at.shape}).strict(),Lg=e=>qg.safeParse(e).success,cd=P({jsonrpc:E(wa),id:Sa,result:Se}).strict(),Io=e=>cd.safeParse(e).success;var F;(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"})(F||(F={}));var ud=P({jsonrpc:E(wa),id:Sa.optional(),error:P({code:ie().int(),message:v(),data:de().optional()})}).strict();var Vg=e=>ud.safeParse(e).success;var Jg=se([Fg,qg,cd,ud]),f4=se([cd,ud]),za=Se.strict(),zk=it.extend({requestId:Sa.optional(),reason:v().optional()}),Ia=at.extend({method:E("notifications/cancelled"),params:zk}),Ik=P({src:v(),mimeType:v().optional(),sizes:Y(v()).optional(),theme:Oe(["light","dark"]).optional()}),Po=P({icons:Y(Ik).optional()}),nn=P({name:v(),title:v().optional()}),Kg=nn.extend({...nn.shape,...Po.shape,version:v(),websiteUrl:v().optional(),description:v().optional()}),Pk=So(P({applyDefaults:be().optional()}),me(v(),de())),jk=xa(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,So(P({form:Pk.optional(),url:ke.optional()}),me(v(),de()).optional())),Tk=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({sampling:Ee({createMessage:ke.optional()}).optional(),elicitation:Ee({create:ke.optional()}).optional()}).optional()}),Ek=Ee({list:ke.optional(),cancel:ke.optional(),requests:Ee({tools:Ee({call:ke.optional()}).optional()}).optional()}),Ok=P({experimental:me(v(),ke).optional(),sampling:P({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:jk.optional(),roots:P({listChanged:be().optional()}).optional(),tasks:Tk.optional()}),Dk=tt.extend({protocolVersion:v(),capabilities:Ok,clientInfo:Kg}),ld=we.extend({method:E("initialize"),params:Dk});var Nk=P({experimental:me(v(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:P({listChanged:be().optional()}).optional(),resources:P({subscribe:be().optional(),listChanged:be().optional()}).optional(),tools:P({listChanged:be().optional()}).optional(),tasks:Ek.optional()}),Rk=Se.extend({protocolVersion:v(),capabilities:Nk,serverInfo:Kg,instructions:v().optional()}),dd=at.extend({method:E("notifications/initialized"),params:it.optional()});var Pa=we.extend({method:E("ping"),params:tt.optional()}),Zk=P({progress:ie(),total:ge(ie()),message:ge(v())}),Ck=P({...it.shape,...Zk.shape,progressToken:Ag}),ja=at.extend({method:E("notifications/progress"),params:Ck}),Ak=tt.extend({cursor:Ug.optional()}),jo=we.extend({params:Ak.optional()}),To=Se.extend({nextCursor:Ug.optional()}),Uk=Oe(["working","input_required","completed","failed","cancelled"]),Eo=P({taskId:v(),status:Uk,ttl:se([ie(),wo()]),createdAt:v(),lastUpdatedAt:v(),pollInterval:ge(ie()),statusMessage:ge(v())}),on=Se.extend({task:Eo}),Mk=it.merge(Eo),Oo=at.extend({method:E("notifications/tasks/status"),params:Mk}),Ta=we.extend({method:E("tasks/get"),params:tt.extend({taskId:v()})}),Ea=Se.merge(Eo),Oa=we.extend({method:E("tasks/result"),params:tt.extend({taskId:v()})}),m4=Se.loose(),Da=jo.extend({method:E("tasks/list")}),Na=To.extend({tasks:Y(Eo)}),Ra=we.extend({method:E("tasks/cancel"),params:tt.extend({taskId:v()})}),Hg=Se.merge(Eo),Bg=P({uri:v(),mimeType:ge(v()),_meta:me(v(),de()).optional()}),Wg=Bg.extend({text:v()}),pd=v().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Gg=Bg.extend({blob:pd}),Do=Oe(["user","assistant"]),an=P({audience:Y(Do).optional(),priority:ie().min(0).max(1).optional(),lastModified:$r.datetime({offset:!0}).optional()}),Xg=P({...nn.shape,...Po.shape,uri:v(),description:ge(v()),mimeType:ge(v()),annotations:an.optional(),_meta:ge(Ee({}))}),Fk=P({...nn.shape,...Po.shape,uriTemplate:v(),description:ge(v()),mimeType:ge(v()),annotations:an.optional(),_meta:ge(Ee({}))}),fd=jo.extend({method:E("resources/list")}),qk=To.extend({resources:Y(Xg)}),Lk=jo.extend({method:E("resources/templates/list")}),Vk=To.extend({resourceTemplates:Y(Fk)}),md=tt.extend({uri:v()}),Jk=md,hd=we.extend({method:E("resources/read"),params:Jk}),Kk=Se.extend({contents:Y(se([Wg,Gg]))}),Hk=at.extend({method:E("notifications/resources/list_changed"),params:it.optional()}),Bk=md,Wk=we.extend({method:E("resources/subscribe"),params:Bk}),Gk=md,Xk=we.extend({method:E("resources/unsubscribe"),params:Gk}),Yk=it.extend({uri:v()}),Qk=at.extend({method:E("notifications/resources/updated"),params:Yk}),ew=P({name:v(),description:ge(v()),required:ge(be())}),tw=P({...nn.shape,...Po.shape,description:ge(v()),arguments:ge(Y(ew)),_meta:ge(Ee({}))}),gd=jo.extend({method:E("prompts/list")}),rw=To.extend({prompts:Y(tw)}),nw=tt.extend({name:v(),arguments:me(v(),v()).optional()}),vd=we.extend({method:E("prompts/get"),params:nw}),yd=P({type:E("text"),text:v(),annotations:an.optional(),_meta:me(v(),de()).optional()}),_d=P({type:E("image"),data:pd,mimeType:v(),annotations:an.optional(),_meta:me(v(),de()).optional()}),$d=P({type:E("audio"),data:pd,mimeType:v(),annotations:an.optional(),_meta:me(v(),de()).optional()}),ow=P({type:E("tool_use"),name:v(),id:v(),input:me(v(),de()),_meta:me(v(),de()).optional()}),iw=P({type:E("resource"),resource:se([Wg,Gg]),annotations:an.optional(),_meta:me(v(),de()).optional()}),aw=Xg.extend({type:E("resource_link")}),bd=se([yd,_d,$d,aw,iw]),sw=P({role:Do,content:bd}),cw=Se.extend({description:v().optional(),messages:Y(sw)}),uw=at.extend({method:E("notifications/prompts/list_changed"),params:it.optional()}),lw=P({title:v().optional(),readOnlyHint:be().optional(),destructiveHint:be().optional(),idempotentHint:be().optional(),openWorldHint:be().optional()}),dw=P({taskSupport:Oe(["required","optional","forbidden"]).optional()}),Yg=P({...nn.shape,...Po.shape,description:v().optional(),inputSchema:P({type:E("object"),properties:me(v(),ke).optional(),required:Y(v()).optional()}).catchall(de()),outputSchema:P({type:E("object"),properties:me(v(),ke).optional(),required:Y(v()).optional()}).catchall(de()).optional(),annotations:lw.optional(),execution:dw.optional(),_meta:me(v(),de()).optional()}),xd=jo.extend({method:E("tools/list")}),pw=To.extend({tools:Y(Yg)}),Za=Se.extend({content:Y(bd).default([]),structuredContent:me(v(),de()).optional(),isError:be().optional()}),h4=Za.or(Se.extend({toolResult:de()})),fw=zo.extend({name:v(),arguments:me(v(),de()).optional()}),No=we.extend({method:E("tools/call"),params:fw}),mw=at.extend({method:E("notifications/tools/list_changed"),params:it.optional()}),g4=P({autoRefresh:be().default(!0),debounceMs:ie().int().nonnegative().default(300)}),Ro=Oe(["debug","info","notice","warning","error","critical","alert","emergency"]),hw=tt.extend({level:Ro}),kd=we.extend({method:E("logging/setLevel"),params:hw}),gw=it.extend({level:Ro,logger:v().optional(),data:de()}),vw=at.extend({method:E("notifications/message"),params:gw}),yw=P({name:v().optional()}),_w=P({hints:Y(yw).optional(),costPriority:ie().min(0).max(1).optional(),speedPriority:ie().min(0).max(1).optional(),intelligencePriority:ie().min(0).max(1).optional()}),$w=P({mode:Oe(["auto","required","none"]).optional()}),bw=P({type:E("tool_result"),toolUseId:v().describe("The unique identifier for the corresponding tool call."),content:Y(bd).default([]),structuredContent:P({}).loose().optional(),isError:be().optional(),_meta:me(v(),de()).optional()}),xw=_a("type",[yd,_d,$d]),ka=_a("type",[yd,_d,$d,ow,bw]),kw=P({role:Do,content:se([ka,Y(ka)]),_meta:me(v(),de()).optional()}),ww=zo.extend({messages:Y(kw),modelPreferences:_w.optional(),systemPrompt:v().optional(),includeContext:Oe(["none","thisServer","allServers"]).optional(),temperature:ie().optional(),maxTokens:ie().int(),stopSequences:Y(v()).optional(),metadata:ke.optional(),tools:Y(Yg).optional(),toolChoice:$w.optional()}),Sw=we.extend({method:E("sampling/createMessage"),params:ww}),wd=Se.extend({model:v(),stopReason:ge(Oe(["endTurn","stopSequence","maxTokens"]).or(v())),role:Do,content:xw}),Sd=Se.extend({model:v(),stopReason:ge(Oe(["endTurn","stopSequence","maxTokens","toolUse"]).or(v())),role:Do,content:se([ka,Y(ka)])}),zw=P({type:E("boolean"),title:v().optional(),description:v().optional(),default:be().optional()}),Iw=P({type:E("string"),title:v().optional(),description:v().optional(),minLength:ie().optional(),maxLength:ie().optional(),format:Oe(["email","uri","date","date-time"]).optional(),default:v().optional()}),Pw=P({type:Oe(["number","integer"]),title:v().optional(),description:v().optional(),minimum:ie().optional(),maximum:ie().optional(),default:ie().optional()}),jw=P({type:E("string"),title:v().optional(),description:v().optional(),enum:Y(v()),default:v().optional()}),Tw=P({type:E("string"),title:v().optional(),description:v().optional(),oneOf:Y(P({const:v(),title:v()})),default:v().optional()}),Ew=P({type:E("string"),title:v().optional(),description:v().optional(),enum:Y(v()),enumNames:Y(v()).optional(),default:v().optional()}),Ow=se([jw,Tw]),Dw=P({type:E("array"),title:v().optional(),description:v().optional(),minItems:ie().optional(),maxItems:ie().optional(),items:P({type:E("string"),enum:Y(v())}),default:Y(v()).optional()}),Nw=P({type:E("array"),title:v().optional(),description:v().optional(),minItems:ie().optional(),maxItems:ie().optional(),items:P({anyOf:Y(P({const:v(),title:v()}))}),default:Y(v()).optional()}),Rw=se([Dw,Nw]),Zw=se([Ew,Ow,Rw]),Cw=se([Zw,zw,Iw,Pw]),Aw=zo.extend({mode:E("form").optional(),message:v(),requestedSchema:P({type:E("object"),properties:me(v(),Cw),required:Y(v()).optional()})}),Uw=zo.extend({mode:E("url"),message:v(),elicitationId:v(),url:v().url()}),Mw=se([Aw,Uw]),Fw=we.extend({method:E("elicitation/create"),params:Mw}),qw=it.extend({elicitationId:v()}),Lw=at.extend({method:E("notifications/elicitation/complete"),params:qw}),Ca=Se.extend({action:Oe(["accept","decline","cancel"]),content:xa(e=>e===null?void 0:e,me(v(),se([v(),ie(),be(),Y(v())])).optional())}),Vw=P({type:E("ref/resource"),uri:v()});var Jw=P({type:E("ref/prompt"),name:v()}),Kw=tt.extend({ref:se([Jw,Vw]),argument:P({name:v(),value:v()}),context:P({arguments:me(v(),v()).optional()}).optional()}),Hw=we.extend({method:E("completion/complete"),params:Kw});var Bw=Se.extend({completion:Ee({values:Y(v()).max(100),total:ge(ie().int()),hasMore:ge(be())})}),Ww=P({uri:v().startsWith("file://"),name:v().optional(),_meta:me(v(),de()).optional()}),Gw=we.extend({method:E("roots/list"),params:tt.optional()}),zd=Se.extend({roots:Y(Ww)}),Xw=at.extend({method:E("notifications/roots/list_changed"),params:it.optional()}),v4=se([Pa,ld,Hw,kd,vd,gd,fd,Lk,hd,Wk,Xk,No,xd,Ta,Oa,Da,Ra]),y4=se([Ia,ja,dd,Xw,Oo]),_4=se([za,wd,Sd,Ca,zd,Ea,Na,on]),$4=se([Pa,Sw,Fw,Gw,Ta,Oa,Da,Ra]),b4=se([Ia,ja,vw,Qk,Hk,mw,uw,Oo,Lw]),x4=se([za,Rk,Bw,cw,rw,qk,Vk,Kk,Za,pw,Ea,Na,on]),Z=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===F.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new od(o.elicitations,r)}return new e(t,r,n)}},od=class extends Z{constructor(t,r=`URL elicitation${t.length>1?"s":""} required`){super(F.UrlElicitationRequired,r,{elicitations:t})}get elicitations(){return this.data?.elicitations??[]}};function tr(e){return e==="completed"||e==="failed"||e==="cancelled"}var rR=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Id(e){let r=sa(e)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=Zh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Pd(e,t){let r=Qt(e,t);if(!r.success)throw r.error;return r.data}var nS=6e4,Aa=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(Ia,r=>{this._oncancel(r)}),this.setNotificationHandler(ja,r=>{this._onprogress(r)}),this.setRequestHandler(Pa,r=>({})),this._taskStore=t?.taskStore,this._taskMessageQueue=t?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ta,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(F.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Oa,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 Z(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 Z(F.InvalidParams,`Task not found: ${i}`);if(!tr(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(tr(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[er]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(Da,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 Z(F.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Ra,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new Z(F.InvalidParams,`Task not found: ${r.params.taskId}`);if(tr(o.status))throw new Z(F.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let i=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!i)throw new Z(F.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof Z?o:new Z(F.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),Z.fromError(F.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(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),Io(i)||Vg(i)?this._onresponse(i):sd(i)?this._onrequest(i,a):Lg(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=Z.fromError(F.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of t.values())n(r)}_onerror(t){this.onerror?.(t)}_onnotification(t){let r=this._notificationHandlers.get(t.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(t)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(t,r){let n=this._requestHandlers.get(t.method)??this.fallbackRequestHandler,o=this._transport,i=t.params?._meta?.[er]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:t.id,error:{code:F.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=Mg(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 Z(F.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:F.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),Io(t))n(t);else{let a=new Z(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(Io(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),Io(t))o(t);else{let a=Z.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 Z?a:new Z(F.InternalError,String(a))}}return}let i;try{let a=await this.request(t,on,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new Z(F.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},tr(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new Z(F.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new Z(F.InternalError,`Task ${i} was cancelled`)});return}if(s.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)};return}let 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 Z?a:new Z(F.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=k=>{l(k)};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(k){d(k);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||{},[er]:c}});let m=k=>{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(k)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(N=>this._onerror(new Error(`Failed to send cancellation: ${N}`)));let x=k instanceof Z?k:new Z(F.RequestTimeout,String(k));l(x)};this._responseHandlers.set(f,k=>{if(!n?.signal?.aborted){if(k instanceof Error)return l(k);try{let x=Qt(r,k.result);x.success?u(x.data):l(x.error)}catch(x){l(x)}}}),n?.signal?.addEventListener("abort",()=>{m(n?.signal?.reason)});let g=n?.timeout??nS,y=()=>m(Z.fromError(F.RequestTimeout,"Request timed out",{timeout:g}));this._setupTimeout(f,g,n?.maxTotalTimeout,y,n?.resetTimeoutOnProgress??!1);let _=c?.taskId;if(_){let k=x=>{let N=this._responseHandlers.get(f);N?N(x):this._onerror(new Error(`Response handler missing for side-channeled request ${f}`))};this._requestResolvers.set(f,k),this._enqueueTaskMessage(_,{type:"request",message:p,timestamp:Date.now()}).catch(x=>{this._cleanupTimeout(f),l(x)})}else this._transport.send(p,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(k=>{this._cleanupTimeout(f),l(k)})})}async getTask(t,r){return this.request({method:"tasks/get",params:t},Ea,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},Na,r)}async cancelTask(t,r){return this.request({method:"tasks/cancel",params:t},Hg,r)}async notification(t,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(t.method);let n=r?.relatedTask?.taskId;if(n){let s={...t,jsonrpc:"2.0",params:{...t.params,_meta:{...t.params?._meta||{},[er]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;let s={...t,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[er]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...t,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[er]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(t,r){let n=Id(t);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=Pd(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=Id(t);this._notificationHandlers.set(n,o=>{let i=Pd(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"&&sd(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new Z(F.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 Z(F.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new Z(F.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 Z(F.InvalidParams,"Failed to retrieve task: Task not found");return i},storeTaskResult:async(o,i,a)=>{await n.storeTaskResult(o,i,a,r);let s=await n.getTask(o,r);if(s){let c=Oo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),tr(s.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,i,a)=>{let s=await n.getTask(o,r);if(!s)throw new Z(F.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(tr(s.status))throw new Z(F.InvalidParams,`Cannot update task "${o}" from terminal status "${s.status}" to "${i}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,i,a,r);let c=await n.getTask(o,r);if(c){let u=Oo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),tr(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Qg(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ev(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];Qg(a)&&Qg(i)?r[o]={...a,...i}:r[o]=i}return r}var o$=ft(kf(),1),i$=ft(n$(),1);function TT(){let e=new o$.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,i$.default)(e),e}var xs=class{constructor(t){this._ajv=t??TT()}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 ks=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 a$(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 s$(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 ws=class extends Aa{constructor(t,r){super(r),this._serverInfo=t,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Ro.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 xs,this.setRequestHandler(ld,n=>this._oninitialize(n)),this.setNotificationHandler(dd,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(kd,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=Ro.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ks(this)}),this._experimental}registerCapabilities(t){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=ev(this._capabilities,t)}setRequestHandler(t,r){let o=sa(t)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(tn(o)){let s=o;i=s._zod?.def?.value??s.value}else{let s=o;i=s._def?.value??s.value}if(typeof i!="string")throw new Error("Schema method literal must be a string");if(i==="tools/call"){let s=async(c,u)=>{let l=Qt(No,c);if(!l.success){let m=l.error instanceof Error?l.error.message:String(l.error);throw new Z(F.InvalidParams,`Invalid tools/call request: ${m}`)}let{params:d}=l.data,f=await Promise.resolve(r(c,u));if(d.task){let m=Qt(on,f);if(!m.success){let g=m.error instanceof Error?m.error.message:String(m.error);throw new Z(F.InvalidParams,`Invalid task creation result: ${g}`)}return m.data}let p=Qt(Za,f);if(!p.success){let m=p.error instanceof Error?p.error.message:String(p.error);throw new Z(F.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){s$(this._clientCapabilities?.tasks?.requests,t,"Client")}assertTaskHandlerCapability(t){this._capabilities&&a$(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:Cg.includes(r)?r:id,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"},za)}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},Sd,r):this.request({method:"sampling/createMessage",params:t},wd,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},Ca,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},Ca,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new Z(F.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof Z?a:new Z(F.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},zd,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 Ef=ft(require("node:process"),1);var Ss=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),ET(r)}clear(){this._buffer=void 0}};function ET(e){return Jg.parse(JSON.parse(e))}function c$(e){return JSON.stringify(e)+`
49
+ `}var zs=class{constructor(t=Ef.default.stdin,r=Ef.default.stdout){this._stdin=t,this._stdout=r,this._readBuffer=new Ss,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=c$(t);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var je=ft(require("fs/promises")),he=ft(require("path")),wn=10*1024*1024,Is=class{skillsPath;cachedSkills=null;loadingPromise=null;skillMap=new Map;contentCache=new Map;canonicalPathMap=new Map;scanEpoch=0;constructor(t){this.skillsPath=he.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(this.cachedSkills&&!t)return this.cachedSkills;if(this.loadingPromise&&!t)return this.loadingPromise;t&&(this.contentCache.clear(),this.canonicalPathMap.clear());let r=++this.scanEpoch,n=this.internalListSkills(r);this.loadingPromise=n;try{return await n}finally{this.loadingPromise===n&&(this.loadingPromise=null)}}async internalListSkills(t=this.scanEpoch){let r;try{let c=he.resolve(this.skillsPath),u=await je.realpath(c),l=await je.stat(u);if(!l.isDirectory())return this.cachedSkills??[];r={realRootPath:u,rootStat:l}}catch{return this.cachedSkills??[]}let n=[],o=new Map,i=new Map,a=new Map,s=!1;try{let u=(await je.readdir(this.skillsPath,{withFileTypes:!0})).filter(l=>l.isDirectory()||l.isSymbolicLink());await Promise.all(u.map(async l=>{let d=he.join(this.skillsPath,l.name),f=he.join(d,"SKILL.md");try{let{content:p,realFilePath:m}=await this.readFileNoFollow(f,this.skillsPath,r),{name:g,description:y,body:_}=this.parseFrontmatter(p),x={name:g||l.name,description:y,skillPath:f};n.push(x),o.set(x.name.toLowerCase(),x);let N=he.basename(he.dirname(x.skillPath)).toLowerCase();o.set(N,x);let D=he.resolve(f);i.set(m,_),a.set(D,m),a.set(m,m)}catch(p){p&&typeof p=="object"&&"code"in p&&p.code==="ENOENT"||process.stderr.write(`Warning: Failed to read skill file in directory "${l.name}"
50
+ `)}})),s=!0}catch(c){process.stderr.write(`Error reading skills directory: ${String(c)}
51
+ `)}if(s&&t===this.scanEpoch){this.skillMap=o,this.cachedSkills=n.sort((c,u)=>c.name.localeCompare(u.name));for(let[c,u]of i.entries())this.contentCache.set(c,u);for(let[c,u]of a.entries())this.canonicalPathMap.set(c,u)}return 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=he.resolve(t),i=he.resolve(r),a=async()=>{let d=await je.realpath(o),f=n?n.realRootPath:await je.realpath(i);if(!(n?n.rootStat:await je.stat(f)).isDirectory())throw new Error("Skills directory must be a directory");let m=he.relative(f,d);if(m===".."||m.startsWith(`..${he.sep}`)||he.isAbsolute(m))throw new Error("File is outside skills directory");let g=await je.stat(d);if(!g.isFile()||g.nlink<1)throw new Error("Skill path is not a regular file");if(g.size>wn)throw new Error("Skill file exceeds size limit");return{realFilePath:d,stat:g}},s=await a(),c=await a();if(s.realFilePath!==c.realFilePath||s.stat.dev!==c.stat.dev||s.stat.ino!==c.stat.ino)throw new Error("File changed while validating its path");let u=process.platform==="win32"?0:je.constants.O_NOFOLLOW,l=await je.open(c.realFilePath,je.constants.O_RDONLY|u);try{let d=await l.stat();if(!d.isFile()||d.nlink<1||d.dev!==c.stat.dev||d.ino!==c.stat.ino||d.size>wn)throw new Error("File changed while opening");let f=d.size,p;if(f<=64*1024){p=Buffer.allocUnsafe(f);let g=0;for(;g<f;){let{bytesRead:y}=await l.read(p,g,f-g,null);if(y===0)break;g+=y}g<f&&(p=p.subarray(0,g))}else{let g=[],_=0;for(;_<=wn;){let k=Buffer.allocUnsafe(Math.min(65536,wn+1-_)),{bytesRead:x}=await l.read(k,0,k.length,null);if(x===0)break;if(_+=x,g.push(k.subarray(0,x)),_>wn)throw new Error("Skill file exceeds size limit")}p=Buffer.concat(g,_)}let m=await l.stat();if(m.size>wn||m.dev!==c.stat.dev||m.ino!==c.stat.ino)throw new Error("File changed while reading");return{content:p.toString("utf-8"),realFilePath:c.realFilePath}}finally{await l.close()}}async readSkillContent(t,r=!1){let n=he.isAbsolute(t)?he.resolve(t):he.resolve(this.skillsPath,t),o=this.canonicalPathMap.get(n);if(!r&&o&&this.contentCache.has(o))return this.contentCache.get(o);let i=he.resolve(this.skillsPath),a=n,s=i;try{a=await je.realpath(n),s=await je.realpath(i)}catch{}let c=he.relative(s,a);if(c===".."||c.startsWith(`..${he.sep}`)||he.isAbsolute(c))throw new Error(`Access denied: path "${t}" is outside skills directory`);if(!r&&this.contentCache.has(a)){let u=this.contentCache.get(a);return this.canonicalPathMap.set(n,a),u}try{let{content:u,realFilePath:l}=await this.readFileNoFollow(t,this.skillsPath),{body:d}=this.parseFrontmatter(u);return this.contentCache.set(l,d),this.canonicalPathMap.set(n,l),this.canonicalPathMap.set(l,l),d}catch(u){throw new Error(`Failed to read skill content: ${u instanceof Error?u.message:String(u)}`)}}clearCache(){this.cachedSkills=null,this.loadingPromise=null,this.skillMap.clear(),this.contentCache.clear(),this.canonicalPathMap.clear()}};var V=ft(require("fs")),j=ft(require("path")),Sn=ft(require("os")),u$=ft(require("crypto")),mi={copilot:{name:"GitHub Copilot (VS Code)",aliases:["vscode","code","copilot"],getConfigPath:(e,t,r,n)=>e==="win32"?j.join(r||j.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?j.join(t,"Library","Application Support","Code","User","mcp.json"):j.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"?j.join(r||j.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?j.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):j.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)=>j.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||j.join(t,"AppData","Local");return j.join(o,"hermes","config.yaml")}return j.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)=>j.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"?j.join(r||j.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?j.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):j.join(t,".config","Claude","claude_desktop_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},devin:{name:"Devin Desktop (formerly Windsurf)",aliases:["devin","devin-desktop","windsurf","codeium"],getConfigPath:(e,t)=>{let r=j.join(t,".config","devin","mcp_config.json");return V.existsSync(r)?r:j.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)=>j.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=j.join(r||j.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(V.existsSync(i))return i;let a=j.join(t,".pi","agent","mcp.json");if(V.existsSync(a))return a;let s=j.join(t,".pi","mcp.json");return V.existsSync(s)?s:a}let n=j.join(t,".pi","agent","mcp.json");if(V.existsSync(n))return n;let o=j.join(t,".pi","mcp.json");return V.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=j.join(t,".qwenpaw","config.json");if(V.existsSync(r))return r;let n=j.join(t,".copaw","config.json");return V.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=j.join(r||j.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?n=j.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):n=j.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),V.existsSync(n))return n;let o=j.join(t,".cline","data","settings","cline_mcp_settings.json");return V.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=j.join(t,".config","kilo","kilo.jsonc");if(V.existsSync(r))return r;let n=j.join(t,".config","kilo","kilo.json");return V.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)=>j.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)=>j.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=j.join(r||j.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(V.existsSync(n))return n;let o=j.join(r||j.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return V.existsSync(o)?o:n}else if(e==="darwin"){let n=j.join(t,"Library","Application Support","Trae","User","mcp.json");if(V.existsSync(n))return n;let o=j.join(t,"Library","Application Support","Trae CN","User","mcp.json");return V.existsSync(o)?o:n}else{let n=j.join(t,".config","Trae","User","mcp.json");if(V.existsSync(n))return n;let o=j.join(t,".config","Trae CN","User","mcp.json");return V.existsSync(o)?o:n}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}};function Of(e){return Object.prototype.toString.call(e)==="[object Object]"}function OT(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===`
52
+ `||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!==`
53
+ `&&l!=="\r"&&(c=-1),n.push(l)}return n.join("")}function DT(e,t,r,n=!1){let o=e?e.split(/\r?\n/):[];if(n){let d=[],f=!1,p=0,m=!1,g=0;for(let y=0;y<o.length;y++){let _=o[y],k=_.match(/^(\s*)mcp_servers:\s*$/);if(k){f=!0,p=k[1].length,d.push(_);continue}if(f){let x=_.match(/^(\s*)/)?.[1].length||0;if(_.trim()!==""&&x<=p)f=!1,m=!1;else{let N=_.match(/^(\s*)superpowers:\s*$/);if(N&&N[1].length>p){m=!0,g=N[1].length;continue}if(m){if(x>g||_.trim()==="")continue;m=!1}}}d.push(_)}return d.join(`
52
54
  `)}let i=" ";for(let d of o){let f=d.match(/^(\s+)[a-zA-Z0-9_-]+:/);if(f&&f[1].length>0){i=f[1];break}}let a=JSON.stringify(t),s=JSON.stringify(r),c=[`${i}superpowers:`,`${i}${i}command: ${a}`,`${i}${i}args: ${s}`];if(!e||e.trim()==="")return`mcp_servers:
53
55
  ${c.join(`
54
56
  `)}
@@ -59,19 +61,19 @@ ${c.join(`
59
61
  `)}
60
62
  `;let l=-1;for(let d=u+1;d<o.length;d++){let f=o[d];if(/^[^\s#]/.test(f))break;if(/^\s+superpowers:\s*$/.test(f)){l=d;break}}if(l!==-1){let d=o[l].match(/^(\s*)/)?.[1].length||2,f=l+1;for(;f<o.length;){let p=o[f];if((p.match(/^(\s*)/)?.[1].length||0)>d||p.trim()==="")f++;else break}return o.splice(l,f-l,...c),o.join(`
61
63
  `)}else return o.splice(u+1,0,...c),o.join(`
62
- `)}function ET(e,t,r,n,o=!1,i){let a={};if(e&&e.trim()!=="")try{let u=JSON.parse(e);Of(u)?a=u:a={}}catch{try{let l=jT(e),d=JSON.parse(l);Of(d)?a=d:a={}}catch(l){let d=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse existing JSON: ${d}`)}}let s="mcpServers";t==="json-servers"?s="servers":t==="json-mcp"&&(s="mcp"),Of(a[s])||(a[s]={});let c=a[s];return o?delete c.superpowers:i?c.superpowers=i:t==="json-servers"?c.superpowers={command:r,args:n,type:"stdio"}:t==="json-mcp"?c.superpowers={type:"local",command:[r,...n],enabled:!0}:c.superpowers={command:r,args:n},JSON.stringify(a,null,2)+`
63
- `}function OT(e,t,r=!1){let n=e;try{let c=V.lstatSync(e,{throwIfNoEntry:!1});if(c&&c.isSymbolicLink())try{n=V.realpathSync(e)}catch{let l=V.readlinkSync(e);n=N.resolve(N.dirname(e),l)}}catch{}let o=N.dirname(n);V.existsSync(o)||V.mkdirSync(o,{recursive:!0,mode:448});let i=384;if(V.existsSync(n)){try{i=V.statSync(n).mode}catch{}if(r){let c=V.readFileSync(n,"utf8"),u=`${n}.${Date.now()}.bak`;try{V.writeFileSync(u,c,{encoding:"utf8",mode:i})}catch(l){let d=l instanceof Error?l.message:String(l);throw new Error(`Failed to create safe backup before write: ${d}`)}}}let a=u$.randomBytes(8).toString("hex"),s=N.join(o,`.tmp.${N.basename(n)}.${process.pid}.${a}`);try{V.writeFileSync(s,t,{encoding:"utf8",mode:i,flag:"wx"}),V.renameSync(s,n)}catch(c){try{V.existsSync(s)&&V.unlinkSync(s)}catch{}throw c}}async function DT(e={}){let t=e.platform||Is.platform(),r=e.homeDir||Is.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(fi).join("|")}>.`);let f=Object.keys(fi).find(h=>h===c||fi[h].aliases.includes(c));if(!f)throw new Error(`Unknown harness target: "${c}". Supported targets: ${Object.keys(fi).join(", ")}`);let p=[f];for(let h of p){let g=fi[h],y=g.getConfigPath(t,r,n,o),$=V.existsSync(y);if(a&&!$){d.push({target:h,name:g.name,path:y,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let k="";$&&(k=V.readFileSync(y,"utf8"));let x="";if(g.type==="yaml")x=TT(k,u,l,a);else{let D=typeof g.defaultConfig=="function"?g.defaultConfig(u,l):void 0;x=ET(k,g.type,u,l,a,D)}if(k.trim()===x.trim()&&$){d.push({target:h,name:g.name,path:y,status:"up-to-date",message:a?"Already not configured":"Already configured and up-to-date"});continue}i||OT(y,x,!!e.backup),d.push({target:h,name:g.name,path:y,status:a?"removed":$?"updated":"created",message:i?`[Dry Run] Would ${a?"remove from":$?"update":"create"} ${y}`:`Successfully ${a?"removed from":$?"updated":"configured"}!`})}catch(k){let x=k instanceof Error?k.message:String(k);d.push({target:h,name:g.name,path:y,status:"error",message:x})}}return d}async function l$(e=process.argv.slice(2)){let t={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let r=0;r<e.length;r++){let n=e[r];if(!(n==="setup"||n==="--setup"))if(n==="--dry-run")t.dryRun=!0;else if(n==="--remove"||n==="--uninstall")t.remove=!0;else if(n==="--bun")t.bun=!0;else if(n==="--backup")t.backup=!0;else if(n==="--target"||n==="-t"){let o=e[r+1];(!o||o.startsWith("-"))&&(console.error(`\u274C Error: Missing value for --target flag.
64
+ `)}function NT(e,t,r,n,o=!1,i){let a={};if(e&&e.trim()!=="")try{let u=JSON.parse(e);Of(u)?a=u:a={}}catch{try{let l=OT(e,!0),d=JSON.parse(l);Of(d)?a=d:a={}}catch(l){let d=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse existing JSON: ${d}`)}}let s="mcpServers";t==="json-servers"?s="servers":t==="json-mcp"&&(s="mcp"),Of(a[s])||(a[s]={});let c=a[s];return o?delete c.superpowers:i?c.superpowers=i:t==="json-servers"?c.superpowers={command:r,args:n,type:"stdio"}:t==="json-mcp"?c.superpowers={type:"local",command:[r,...n],enabled:!0}:c.superpowers={command:r,args:n},JSON.stringify(a,null,2)+`
65
+ `}function RT(e,t,r=!1){let n=e;try{let c=V.lstatSync(e,{throwIfNoEntry:!1});if(c&&c.isSymbolicLink()){try{n=V.realpathSync(e)}catch{let m=V.readlinkSync(e);n=j.resolve(j.dirname(e),m)}let u=j.normalize(j.resolve(n)).toLowerCase(),l=j.normalize(j.resolve(Sn.tmpdir())).toLowerCase();if(!(u===l||u.startsWith(l+j.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(p=>u===p||u.startsWith(p+j.sep))||u==="/var"||u.startsWith("/var"+j.sep)&&!u.startsWith("/var/folders"+j.sep)||u==="/private/var"||u.startsWith("/private/var"+j.sep)&&!u.startsWith("/private/var/folders"+j.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${n}`)}}catch(c){if(c instanceof Error&&c.message.includes("Refusing to write to unsafe symlink target"))throw c}let o=j.dirname(n);V.existsSync(o)||V.mkdirSync(o,{recursive:!0,mode:448});let i=384;if(V.existsSync(n)){try{i=V.statSync(n).mode}catch{}if(r){let c=V.readFileSync(n,"utf8"),u=`${n}.${Date.now()}.bak`;try{V.writeFileSync(u,c,{encoding:"utf8",mode:i})}catch(l){let d=l instanceof Error?l.message:String(l);throw new Error(`Failed to create safe backup before write: ${d}`)}}}let a=u$.randomBytes(8).toString("hex"),s=j.join(o,`.tmp.${j.basename(n)}.${process.pid}.${a}`);try{V.writeFileSync(s,t,{encoding:"utf8",mode:i,flag:"wx"}),V.renameSync(s,n)}catch(c){try{V.existsSync(s)&&V.unlinkSync(s)}catch{}throw c}}async function ZT(e={}){let t=e.platform||Sn.platform(),r=e.homeDir||Sn.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(mi).join("|")}>.`);let f=Object.keys(mi).find(m=>m===c||mi[m].aliases.includes(c));if(!f)throw new Error(`Unknown harness target: "${c}". Supported targets: ${Object.keys(mi).join(", ")}`);let p=[f];for(let m of p){let g=mi[m],y=g.getConfigPath(t,r,n,o),_=V.existsSync(y);if(a&&!_){d.push({target:m,name:g.name,path:y,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let k="";_&&(k=V.readFileSync(y,"utf8"));let x="";if(g.type==="yaml")x=DT(k,u,l,a);else{let N=typeof g.defaultConfig=="function"?g.defaultConfig(u,l):void 0;x=NT(k,g.type,u,l,a,N)}if(k.trim()===x.trim()&&_){d.push({target:m,name:g.name,path:y,status:"up-to-date",message:a?"Already not configured":"Already configured and up-to-date"});continue}i||RT(y,x,!!e.backup),d.push({target:m,name:g.name,path:y,status:a?"removed":_?"updated":"created",message:i?`[Dry Run] Would ${a?"remove from":_?"update":"create"} ${y}`:`Successfully ${a?"removed from":_?"updated":"configured"}!`})}catch(k){let x=k instanceof Error?k.message:String(k);d.push({target:m,name:g.name,path:y,status:"error",message:x})}}return d}async function l$(e=process.argv.slice(2)){let t={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let r=0;r<e.length;r++){let n=e[r];if(!(n==="setup"||n==="--setup"))if(n==="--dry-run")t.dryRun=!0;else if(n==="--remove"||n==="--uninstall")t.remove=!0;else if(n==="--bun")t.bun=!0;else if(n==="--backup")t.backup=!0;else if(n==="--target"||n==="-t"){let o=e[r+1];(!o||o.startsWith("-"))&&(console.error(`\u274C Error: Missing value for --target flag.
64
66
  `),process.exit(1)),t.target=e[++r]}else if(n.startsWith("--target=")){let o=n.split("=")[1];o||(console.error(`\u274C Error: Missing value for --target flag.
65
- `),process.exit(1)),t.target=o}else if(n==="--help"||n==="-h"){NT();return}else!n.startsWith("-")&&!t.target&&n!=="setup"?t.target=n:n.startsWith("-")&&(console.error(`\u274C Error: Unknown option "${n}". Use --help for usage.
67
+ `),process.exit(1)),t.target=o}else if(n==="--help"||n==="-h"){CT();return}else!n.startsWith("-")&&!t.target&&n!=="setup"?t.target=n:n.startsWith("-")&&(console.error(`\u274C Error: Unknown option "${n}". Use --help for usage.
66
68
  `),process.exit(1))}if(console.log(`
67
69
  ========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
68
70
  `),!t.target){console.log(`Please select which AI Agent client you would like to configure:
69
71
  `),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)
70
72
  `),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.
71
73
  `),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.
72
- `);return}try{let r=await DT(t),n=0,o=0,i=0;for(let a of r){let s=a.status==="created"||a.status==="updated"||a.status==="removed"?"\u2705":a.status==="up-to-date"?"\u2728":a.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${s} [${a.name}] (${a.status})`),console.log(` Path: ${a.path}`),console.log(` Info: ${a.message}
74
+ `);return}try{let r=await ZT(t),n=0,o=0,i=0;for(let a of r){let s=a.status==="created"||a.status==="updated"||a.status==="removed"?"\u2705":a.status==="up-to-date"?"\u2728":a.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${s} [${a.name}] (${a.status})`),console.log(` Path: ${a.path}`),console.log(` Info: ${a.message}
73
75
  `),a.status==="created"||a.status==="updated"||a.status==="up-to-date"||a.status==="removed"?n++:a.status==="skipped"?o++:a.status==="error"&&i++}console.log("--------------------------------------------------------"),i>0&&(console.error(`\u26A0\uFE0F Setup finished with errors: ${i} failure(s), ${n} succeeded.`),process.exit(1)),console.log(`\u{1F389} Setup complete! ${n} environment(s) ready.`)}catch(r){let n=r instanceof Error?r.message:String(r);console.error(`\u274C Setup failed: ${n}
74
- `),process.exit(1)}}function NT(){console.log(`
76
+ `),process.exit(1)}}function CT(){console.log(`
75
77
  Superpowers MCP - Targeted Global Setup
76
78
 
77
79
  Usage:
@@ -114,8 +116,8 @@ Any Directory:
114
116
  Privacy & Safety:
115
117
  Superpowers MCP only touches the client you explicitly choose.
116
118
  It never bulk-modifies your environment without your consent.
117
- `)}function RT(){let e=process.env.SKILLS_PATH;if(e){let r=tt.resolve(e),n=tt.normalize(r).toLowerCase(),o=tt.parse(r).root.toLowerCase();if(n===o||["/etc","/var","/bin","/sbin","/usr","/root","/sys","/proc","/dev","c:\\windows","c:\\program files","c:\\program files (x86)"].some(s=>n===s||n.startsWith(s+tt.sep)))process.stderr.write(`Warning: Potentially unsafe SKILLS_PATH: "${e}". Fallback to default.
118
- `);else return r}let t=tt.join(__dirname,"..","skills");return d$.existsSync(t)?t:tt.join(__dirname,"skills")}var Df=RT(),Tt=new zs(Df),dr=new ks({name:"superpowers-mcp",version:"6.3.4"},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});dr.setRequestHandler(fd,async()=>({resources:(await Tt.listSkills()).map(t=>({uri:`skill://superpowers/${encodeURIComponent(t.name)}`,name:t.name,description:t.description,mimeType:"text/markdown"}))}));dr.setRequestHandler(hd,async e=>{let t=e.params.uri,r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new Z(F.InvalidRequest,`Invalid skill URI: ${t}`);let n;try{n=decodeURIComponent(r[1])}catch{throw new Z(F.InvalidRequest,`Invalid skill URI: ${t}`)}let o=await Tt.findSkill(n);if(!o)throw new Z(F.InvalidRequest,`Skill not found: ${n}`);try{let i=await Tt.readSkillContent(o.skillPath);return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}}catch{throw new Z(F.InternalError,"Failed to read skill content safely.")}});function mi(e,t){let r=Object.keys(t).filter(i=>{let a=t[i];return a!==void 0&&a!==""});if(r.length===0)return e;let n=r.sort((i,a)=>a.length-i.length).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),o=new RegExp(n,"g");return e.replace(o,i=>{let a=t[i];return a!==void 0&&a!==""?String(a):i})}dr.setRequestHandler(gd,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:"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:"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:"feature-pipeline",description:"Feature Development Pipeline Prompt. Chains brainstorming, writing-plans, git-worktrees, SDD/TDD, verification, code review, and branch finishing into a structured workflow.",arguments:[{name:"feature_name",description:"Name or title of the feature to develop",required:!1},{name:"requirements",description:"Initial feature requirements, constraints, or description",required:!1}]},{name:"structured-debug",description:"Structured Troubleshooting Pipeline Prompt. Chains systematic debugging, worktree isolation, parallel agent investigation, TDD fix, full verification, and review.",arguments:[{name:"issue_description",description:"Description of the bug, error logs, or symptoms",required:!1},{name:"failing_tests",description:"Names or paths of failing tests",required:!1}]},{name:"skill-composition",description:"Skill Composition & Workflow Guide Prompt. Recommends multi-skill compositions for feature development, debugging, refactoring, or legacy safety net.",arguments:[{name:"scenario",description:"Development scenario (feature, debug, refactor, legacy-safety)",required:!1}]}]}));dr.setRequestHandler(vd,async e=>{let t=e.params.name,r=e.params.arguments||{},n=32*1024,o=(a,s=n)=>{let c=Object.prototype.hasOwnProperty.call(r,a)?r[a]:void 0,u="";return typeof c=="string"?u=c.trim():c!=null&&(u=String(c).trim()),u.length>s?u.slice(0,s):u},i=async a=>{let s=tt.join(Df,a);try{return await Tt.readSkillContent(s)}catch{return""}};if(t==="session-start"){let a="";try{let c=await Tt.findSkill("using-superpowers"),u=c?c.skillPath:tt.join(Df,"using-superpowers","SKILL.md");a=await Tt.readSkillContent(u)}catch{a=`# Superpowers
119
+ `)}function AT(){let e=process.env.SKILLS_PATH;if(e){let r=We.resolve(e),n=We.normalize(r).toLowerCase(),o=We.parse(r).root.toLowerCase();if(n===o||["/etc","/var","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","/private/var","c:\\windows","c:\\program files","c:\\program files (x86)"].some(s=>n===s||n.startsWith(s+We.sep)))process.stderr.write(`Warning: Potentially unsafe SKILLS_PATH: "${e}". Fallback to default.
120
+ `);else return r}let t=We.join(__dirname,"..","skills");return m$.existsSync(t)?t:We.join(__dirname,"skills")}var Df=AT(),Tt=new Is(Df),dr=new ws({name:"superpowers-mcp",version:"6.3.7"},{capabilities:{resources:{subscribe:!1},prompts:{},tools:{}}});dr.setRequestHandler(fd,async()=>({resources:(await Tt.listSkills()).map(t=>({uri:`skill://superpowers/${encodeURIComponent(t.name)}`,name:t.name,description:t.description,mimeType:"text/markdown"}))}));dr.setRequestHandler(hd,async e=>{let t=e.params.uri,r=t.match(/^skill:\/\/superpowers\/(.+)$/);if(!r)throw new Z(F.InvalidRequest,`Invalid skill URI: ${t}`);let n;try{n=decodeURIComponent(r[1])}catch{throw new Z(F.InvalidRequest,`Invalid skill URI: ${t}`)}let o=await Tt.findSkill(n);if(!o)throw new Z(F.InvalidRequest,`Skill not found: ${n}`);try{let i=await Tt.readSkillContent(o.skillPath);return{contents:[{uri:t,mimeType:"text/markdown",text:i}]}}catch{throw new Z(F.InternalError,"Failed to read skill content safely.")}});function d$(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=We.resolve(n);return process.platform==="darwin"||process.platform==="win32"?o.toLowerCase():o};return r(e)===r(t)}function f$(e,t,r){if(e&&!p$(e,t)&&!p$(e,r))return e;let n=d$(t,"-report.md")||d$(r,"-brief.md");return n||(t?`${t.replace(/(\.[^./\\]*)?$/,"")}-review.md`:"")}function hi(e,t){let r=Object.keys(t).filter(i=>{let a=t[i];return a!==void 0&&a!==""});if(r.length===0)return e;let n=r.sort((i,a)=>a.length-i.length).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),o=new RegExp(n,"g");return e.replace(o,i=>{let a=t[i];return a!==void 0&&a!==""?String(a):i})}dr.setRequestHandler(gd,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:"feature-pipeline",description:"Feature Development Pipeline Prompt. Chains brainstorming, writing-plans, git-worktrees, SDD/TDD, verification, code review, and branch finishing into a structured workflow.",arguments:[{name:"feature_name",description:"Name or title of the feature to develop",required:!1},{name:"requirements",description:"Initial feature requirements, constraints, or description",required:!1}]},{name:"structured-debug",description:"Structured Troubleshooting Pipeline Prompt. Chains systematic debugging, worktree isolation, parallel agent investigation, TDD fix, full verification, and review.",arguments:[{name:"issue_description",description:"Description of the bug, error logs, or symptoms",required:!1},{name:"failing_tests",description:"Names or paths of failing tests",required:!1}]},{name:"skill-composition",description:"Skill Composition & Workflow Guide Prompt. Recommends multi-skill compositions for feature development, debugging, refactoring, or legacy safety net.",arguments:[{name:"scenario",description:"Development scenario (feature, debug, refactor, legacy-safety)",required:!1}]}]}));dr.setRequestHandler(vd,async e=>{let t=e.params.name,r=e.params.arguments||{},n=32*1024,o=(a,s=n)=>{let c=Object.prototype.hasOwnProperty.call(r,a)?r[a]:void 0,u="";return typeof c=="string"?u=c.trim():c!=null&&(u=String(c).trim()),u.length>s?u.slice(0,s):u},i=async a=>{let s=We.join(Df,a);try{return await Tt.readSkillContent(s)}catch{return""}};if(t==="session-start"){let a="";try{let c=await Tt.findSkill("using-superpowers"),u=c?c.skillPath:We.join(Df,"using-superpowers","SKILL.md");a=await Tt.readSkillContent(u)}catch{a=`# Superpowers
119
121
 
120
122
  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>
121
123
  You have superpowers.
@@ -123,28 +125,28 @@ You have superpowers.
123
125
  **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:**
124
126
 
125
127
  ${a}
126
- </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"),h=mi(a,{"[BRIEF_FILE]":s,"[task name]":c,"[REPORT_FILE]":u,"[directory]":l,"[MODEL]":d}),g=[f&&!h.includes(f)?`
128
+ </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=hi(a,{"[BRIEF_FILE]":s,"[task name]":c,"[REPORT_FILE]":u,"[directory]":l,"[MODEL]":d}),g=[f&&!m.includes(f)?`
127
129
 
128
130
  ### Target Task:
129
- ${f}`:"",p&&!h.includes(p)?`
131
+ ${f}`:"",p&&!m.includes(p)?`
130
132
 
131
133
  ### Plan / Brief File:
132
- ${p}`:""].join("");return{description:"Subagent-Driven Development Implementer Prompt",messages:[{role:"user",content:{type:"text",text:`${h}${g}`}}]}}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=o("base_sha"),d=o("head_sha"),f=o("global_constraints"),p=o("model"),h=o("task_description"),g=o("review_target"),y=mi(a,{"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[BASE_SHA]":l,"[HEAD_SHA]":d,"[GLOBAL_CONSTRAINTS]":f,"[MODEL]":p}),$=[h&&!y.includes(h)?`
134
+ ${p}`:""].join("");return{description:"Subagent-Driven Development Implementer Prompt",messages:[{role:"user",content:{type:"text",text:`${m}${g}`}}]}}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=f$(o("review_file"),c,s),d=o("base_sha"),f=o("head_sha"),p=o("global_constraints"),m=o("model"),g=o("task_description"),y=o("review_target"),_=hi(a,{"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[BASE_SHA]":d,"[HEAD_SHA]":f,"[GLOBAL_CONSTRAINTS]":p,"[REVIEW_FILE]":l,"[MODEL]":m}),k=[g&&!_.includes(g)?`
133
135
 
134
136
  ### Reviewed Task:
135
- ${h}`:"",g&&!y.includes(g)?`
137
+ ${g}`:"",y&&!_.includes(y)?`
136
138
 
137
139
  ### Review Target:
138
- ${g}`:""].join("");return{description:"Subagent-Driven Development Task Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${y}${$}`}}]}}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=o("previous_findings"),d=o("base_sha")||o("fix_base_sha"),f=o("head_sha"),p=o("model"),h=o("fix_summary"),g=mi(a,{"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[FINDINGS]":l,"[BASE_SHA]":d,"[HEAD_SHA]":f,"[MODEL]":p}),y=[l&&!g.includes(l)?`
140
+ ${y}`:""].join("");return{description:"Subagent-Driven Development Task Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${_}${k}`}}]}}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=f$(o("review_file"),c,s),d=o("previous_findings"),f=o("base_sha")||o("fix_base_sha"),p=o("head_sha"),m=o("model"),g=o("fix_summary"),y=hi(a,{"[BRIEF_FILE]":s,"[REPORT_FILE]":c,"[DIFF_FILE]":u,"[REVIEW_FILE]":l,"[FINDINGS]":d,"[BASE_SHA]":f,"[FIX_BASE_SHA]":f,"[HEAD_SHA]":p,"[MODEL]":m}),_=[d&&!y.includes(d)?`
139
141
 
140
142
  ### Previous Findings:
141
- ${l}`:"",h?`
143
+ ${d}`:"",g?`
142
144
 
143
145
  ### Fix Summary:
144
- ${h}`:""].join("");return{description:"SDD Scoped Re-Review Prompt",messages:[{role:"user",content:{type:"text",text:`${g}${y}`}}]}}if(t==="spec-reviewer"){let a=await i("brainstorming/spec-document-reviewer-prompt.md"),s=o("spec_file"),c=mi(a,{"[SPEC_FILE_PATH]":s}),u=s&&!c.includes(s)?`
146
+ ${g}`:""].join("");return{description:"SDD Scoped Re-Review Prompt",messages:[{role:"user",content:{type:"text",text:`${y}${_}`}}]}}if(t==="spec-reviewer"){let a=await i("brainstorming/spec-document-reviewer-prompt.md"),s=o("spec_file"),c=hi(a,{"[SPEC_FILE_PATH]":s}),u=s&&!c.includes(s)?`
145
147
 
146
148
  ### Target Specification:
147
- ${s}`:"";return{description:"Brainstorming Spec Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${c}${u}`}}]}}if(t==="plan-reviewer"){let a=await i("writing-plans/plan-document-reviewer-prompt.md"),s=o("plan_file"),c=o("spec_file"),u=mi(a,{"[PLAN_FILE_PATH]":s,"[SPEC_FILE_PATH]":c}),l=s&&!u.includes(s)?`
149
+ ${s}`:"";return{description:"Brainstorming Spec Document Reviewer Prompt",messages:[{role:"user",content:{type:"text",text:`${c}${u}`}}]}}if(t==="plan-reviewer"){let a=await i("writing-plans/plan-document-reviewer-prompt.md"),s=o("plan_file"),c=o("spec_file"),u=hi(a,{"[PLAN_FILE_PATH]":s,"[SPEC_FILE_PATH]":c}),l=s&&!u.includes(s)?`
148
150
 
149
151
  ### Target Implementation Plan:
150
152
  ${s}`:"",d=c&&!u.includes(c)?`
@@ -263,7 +265,7 @@ ${s}${c}
263
265
  4. **Legacy Codebase Safety Net:**
264
266
  \`brainstorming\` \u2794 \`writing-plans\` \u2794 \`test-driven-development\` (characterization tests) \u2794 \`systematic-debugging\` \u2794 \`verification-before-completion\`
265
267
 
266
- Use \`read_skill(skill_name)\` to inspect any skill before starting.`}}]}}throw new Z(F.InvalidRequest,`Unknown prompt: ${t}`)});dr.setRequestHandler(xd,async()=>({tools:[{name:"list_skills",description:"List all available Superpowers skills with their names and descriptions. Use this to discover which skills are available before loading one.",inputSchema:{type:"object",properties:{},required:[]}},{name:"read_skill",description:"Read the full content of a Superpowers skill by name. The skill content contains instructions, checklists, and patterns to follow. Read a skill before attempting the task it covers.",inputSchema:{type:"object",properties:{skill_name:{type:"string",description:'Name of the skill to read (e.g. "brainstorming", "test-driven-development", "systematic-debugging")'}},required:["skill_name"]}}]}));dr.setRequestHandler(Do,async e=>{let{name:t,arguments:r}=e.params;if(t==="list_skills"){let n=await Tt.listSkills(),o=n.map(i=>`**${i.name}**
268
+ Use \`read_skill(skill_name)\` to inspect any skill before starting.`}}]}}throw new Z(F.InvalidRequest,`Unknown prompt: ${t}`)});dr.setRequestHandler(xd,async()=>({tools:[{name:"list_skills",description:"List all available Superpowers skills with their names and descriptions. Use this to discover which skills are available before loading one.",inputSchema:{type:"object",properties:{},required:[]}},{name:"read_skill",description:"Read the full content of a Superpowers skill by name. The skill content contains instructions, checklists, and patterns to follow. Read a skill before attempting the task it covers.",inputSchema:{type:"object",properties:{skill_name:{type:"string",description:'Name of the skill to read (e.g. "brainstorming", "test-driven-development", "systematic-debugging")'}},required:["skill_name"]}}]}));dr.setRequestHandler(No,async e=>{let{name:t,arguments:r}=e.params;if(t==="list_skills"){let n=await Tt.listSkills(),o=n.map(i=>`**${i.name}**
267
269
  ${i.description}`).join(`
268
270
 
269
271
  ---
@@ -276,5 +278,5 @@ Use \`read_skill\` with the skill name to load its full content.
276
278
 
277
279
  ${o}`}]}}if(t==="read_skill"){let n=r,o=typeof n?.skill_name=="string"?n.skill_name.trim():void 0;if(!o)throw new Z(F.InvalidParams,"skill_name is required");let i=await Tt.findSkill(o);if(!i){let s=(await Tt.listSkills()).map(c=>c.name).join(", ");throw new Z(F.InvalidRequest,`Skill "${o}" not found. Available skills: ${s}`)}try{let a=await Tt.readSkillContent(i.skillPath);return{content:[{type:"text",text:`# Skill: ${i.name}
278
280
 
279
- ${a}`}]}}catch{throw new Z(F.InternalError,`Failed to read skill "${o}" due to an internal error.`)}}throw new Z(F.MethodNotFound,`Unknown tool: ${t}`)});async function ZT(){let e=process.argv.slice(2),t=e[0];if(t==="setup"||t==="--setup"){try{await l$(e),process.exit(0)}catch(o){console.error("Setup failed:",o),process.exit(1)}return}let r=new Ss;await dr.connect(r);let n=async()=>{try{await dr.close()}catch{}process.exit(0)};process.on("SIGINT",n),process.on("SIGTERM",n)}ZT().catch(e=>{process.stderr.write(`MCP Server fatal error: ${String(e)}
281
+ ${a}`}]}}catch{throw new Z(F.InternalError,`Failed to read skill "${o}" due to an internal error.`)}}throw new Z(F.MethodNotFound,`Unknown tool: ${t}`)});async function UT(){let e=process.argv.slice(2),t=e[0];if(t==="setup"||t==="--setup"){try{await l$(e),process.exit(0)}catch(o){console.error("Setup failed:",o),process.exit(1)}return}let r=new zs;await dr.connect(r);let n=async()=>{try{await dr.close()}catch{}process.exit(0)};process.on("SIGINT",n),process.on("SIGTERM",n)}UT().catch(e=>{process.stderr.write(`MCP Server fatal error: ${String(e)}
280
282
  `),process.exit(1)});