Files
claude-mem/plugin/scripts/mcp-server.cjs
T
Jarad DeLorenzo 86d0d1a21a feat: add OpenRouter provider support and enhance context generation
Added support for OpenRouter as an alternative LLM provider with new settings for API key, model selection, and app metadata configuration.

Enhanced context generation with improved settings management and updated worker service APIs.

Includes UI updates for context settings and new observation type configurations.
2025-12-26 08:34:27 -05:00

40 lines
332 KiB
JavaScript
Executable File

#!/usr/bin/env node
"use strict";var Ey=Object.create;var _s=Object.defineProperty;var Oy=Object.getOwnPropertyDescriptor;var jy=Object.getOwnPropertyNames;var Ty=Object.getPrototypeOf,Ny=Object.prototype.hasOwnProperty;var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),hn=(t,e)=>{for(var r in e)_s(t,r,{get:e[r],enumerable:!0})},Ry=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of jy(e))!Ny.call(t,o)&&o!==r&&_s(t,o,{get:()=>e[o],enumerable:!(n=Oy(e,o))||n.enumerable});return t};var ni=(t,e,r)=>(r=t!=null?Ey(Ty(t)):{},Ry(e||!t||!t.__esModule?_s(r,"default",{value:t,enumerable:!0}):r,t));var Po=S(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.regexpCode=ee.getEsmExportName=ee.getProperty=ee.safeStringify=ee.stringify=ee.strConcat=ee.addCodeArg=ee.str=ee._=ee.nil=ee._Code=ee.Name=ee.IDENTIFIER=ee._CodeOrName=void 0;var zo=class{};ee._CodeOrName=zo;ee.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var fr=class extends zo{constructor(e){if(super(),!ee.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};ee.Name=fr;var et=class extends zo{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof fr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};ee._Code=et;ee.nil=new et("");function Pg(t,...e){let r=[t[0]],n=0;for(;n<e.length;)pd(r,e[n]),r.push(t[++n]);return new et(r)}ee._=Pg;var fd=new et("+");function Eg(t,...e){let r=[Io(t[0])],n=0;for(;n<e.length;)r.push(fd),pd(r,e[n]),r.push(fd,Io(t[++n]));return IS(r),new et(r)}ee.str=Eg;function pd(t,e){e instanceof et?t.push(...e._items):e instanceof fr?t.push(e):t.push(OS(e))}ee.addCodeArg=pd;function IS(t){let e=1;for(;e<t.length-1;){if(t[e]===fd){let r=PS(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function PS(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof fr||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof fr))return`"${t}${e.slice(1)}`}function ES(t,e){return e.emptyStr()?t:t.emptyStr()?e:Eg`${t}${e}`}ee.strConcat=ES;function OS(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:Io(Array.isArray(t)?t.join(","):t)}function jS(t){return new et(Io(t))}ee.stringify=jS;function Io(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ee.safeStringify=Io;function TS(t){return typeof t=="string"&&ee.IDENTIFIER.test(t)?new et(`.${t}`):Pg`[${t}]`}ee.getProperty=TS;function NS(t){if(typeof t=="string"&&ee.IDENTIFIER.test(t))return new et(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}ee.getEsmExportName=NS;function RS(t){return new et(t.toString())}ee.regexpCode=RS});var gd=S(Me=>{"use strict";Object.defineProperty(Me,"__esModule",{value:!0});Me.ValueScope=Me.ValueScopeName=Me.Scope=Me.varKinds=Me.UsedValueState=void 0;var Ce=Po(),md=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},wa;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(wa||(Me.UsedValueState=wa={}));Me.varKinds={const:new Ce.Name("const"),let:new Ce.Name("let"),var:new Ce.Name("var")};var za=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Ce.Name?e:this.name(e)}name(e){return new Ce.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Me.Scope=za;var Ia=class extends Ce.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Ce._)`.${new Ce.Name(r)}[${n}]`}};Me.ValueScopeName=Ia;var DS=(0,Ce._)`\n`,hd=class extends za{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?DS:Ce.nil}}get(){return this._scope}name(e){return new Ia(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:i}=o,a=(n=r.key)!==null&&n!==void 0?n:r.ref,s=this._values[i];if(s){let 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(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ce._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let i=Ce.nil;for(let a in e){let s=e[a];if(!s)continue;let c=n[a]=n[a]||new Map;s.forEach(u=>{if(c.has(u))return;c.set(u,wa.Started);let l=r(u);if(l){let d=this.opts.es5?Me.varKinds.var:Me.varKinds.const;i=(0,Ce._)`${i}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))i=(0,Ce._)`${i}${l}${this.opts._n}`;else throw new md(u);c.set(u,wa.Completed)})}return i}};Me.ValueScope=hd});var F=S(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.or=K.and=K.not=K.CodeGen=K.operators=K.varKinds=K.ValueScopeName=K.ValueScope=K.Scope=K.Name=K.regexpCode=K.stringify=K.getProperty=K.nil=K.strConcat=K.str=K._=void 0;var Y=Po(),st=gd(),Gt=Po();Object.defineProperty(K,"_",{enumerable:!0,get:function(){return Gt._}});Object.defineProperty(K,"str",{enumerable:!0,get:function(){return Gt.str}});Object.defineProperty(K,"strConcat",{enumerable:!0,get:function(){return Gt.strConcat}});Object.defineProperty(K,"nil",{enumerable:!0,get:function(){return Gt.nil}});Object.defineProperty(K,"getProperty",{enumerable:!0,get:function(){return Gt.getProperty}});Object.defineProperty(K,"stringify",{enumerable:!0,get:function(){return Gt.stringify}});Object.defineProperty(K,"regexpCode",{enumerable:!0,get:function(){return Gt.regexpCode}});Object.defineProperty(K,"Name",{enumerable:!0,get:function(){return Gt.Name}});var ja=gd();Object.defineProperty(K,"Scope",{enumerable:!0,get:function(){return ja.Scope}});Object.defineProperty(K,"ValueScope",{enumerable:!0,get:function(){return ja.ValueScope}});Object.defineProperty(K,"ValueScopeName",{enumerable:!0,get:function(){return ja.ValueScopeName}});Object.defineProperty(K,"varKinds",{enumerable:!0,get:function(){return ja.varKinds}});K.operators={GT:new Y._Code(">"),GTE:new Y._Code(">="),LT:new Y._Code("<"),LTE:new Y._Code("<="),EQ:new Y._Code("==="),NEQ:new Y._Code("!=="),NOT:new Y._Code("!"),OR:new Y._Code("||"),AND:new Y._Code("&&"),ADD:new Y._Code("+")};var jt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},vd=class extends jt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?st.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Br(this.rhs,e,r)),this}get names(){return this.rhs instanceof Y._CodeOrName?this.rhs.names:{}}},Pa=class extends jt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Y.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Br(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Y.Name?{}:{...this.lhs.names};return Oa(e,this.rhs)}},_d=class extends Pa{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},yd=class extends jt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},$d=class extends jt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},bd=class extends jt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},xd=class extends jt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Br(this.code,e,r),this}get names(){return this.code instanceof Y._CodeOrName?this.code.names:{}}},Eo=class extends jt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let i=n[o];i.optimizeNames(e,r)||(AS(e,i.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>hr(e,r.names),{})}},Tt=class extends Eo{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},kd=class extends Eo{},Gr=class extends Tt{};Gr.kind="else";var pr=class t extends Tt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Gr(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Og(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Br(this.condition,e,r),this}get names(){let e=super.names;return Oa(e,this.condition),this.else&&hr(e,this.else.names),e}};pr.kind="if";var mr=class extends Tt{};mr.kind="for";var Sd=class extends mr{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Br(this.iteration,e,r),this}get names(){return hr(super.names,this.iteration.names)}},wd=class extends mr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?st.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${r} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){let e=Oa(super.names,this.from);return Oa(e,this.to)}},Ea=class extends mr{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Br(this.iterable,e,r),this}get names(){return hr(super.names,this.iterable.names)}},Oo=class extends Tt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Oo.kind="func";var jo=class extends Eo{render(e){return"return "+super.render(e)}};jo.kind="return";var zd=class extends Tt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&hr(e,this.catch.names),this.finally&&hr(e,this.finally.names),e}},To=class extends Tt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};To.kind="catch";var No=class extends Tt{render(e){return"finally"+super.render(e)}};No.kind="finally";var Id=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
`:""},this._extScope=e,this._scope=new st.Scope({parent:e}),this._nodes=[new kd]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let i=this._scope.toName(r);return n!==void 0&&o&&(this._constants[i.str]=n),this._leafNode(new vd(e,i,n)),i}const(e,r,n){return this._def(st.varKinds.const,e,r,n)}let(e,r,n){return this._def(st.varKinds.let,e,r,n)}var(e,r,n){return this._def(st.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Pa(e,r,n))}add(e,r){return this._leafNode(new _d(e,K.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Y.nil&&this._leafNode(new xd(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,Y.addCodeArg)(r,o));return r.push("}"),new Y._Code(r)}if(e,r,n){if(this._blockNode(new pr(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new pr(e))}else(){return this._elseNode(new Gr)}endIf(){return this._endBlockNode(pr,Gr)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Sd(e),r)}forRange(e,r,n,o,i=this.opts.es5?st.varKinds.var:st.varKinds.let){let a=this._scope.toName(e);return this._for(new wd(i,a,r,n),()=>o(a))}forOf(e,r,n,o=st.varKinds.const){let i=this._scope.toName(e);if(this.opts.es5){let a=r instanceof Y.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Y._)`${a}.length`,s=>{this.var(i,(0,Y._)`${a}[${s}]`),n(i)})}return this._for(new Ea("of",o,i,r),()=>n(i))}forIn(e,r,n,o=this.opts.es5?st.varKinds.var:st.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Y._)`Object.keys(${r})`,n);let i=this._scope.toName(e);return this._for(new Ea("in",o,i,r),()=>n(i))}endFor(){return this._endBlockNode(mr)}label(e){return this._leafNode(new yd(e))}break(e){return this._leafNode(new $d(e))}return(e){let r=new jo;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(jo)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new zd;if(this._blockNode(o),this.code(e),r){let i=this.name("e");this._currNode=o.catch=new To(i),r(i)}return n&&(this._currNode=o.finally=new No,this.code(n)),this._endBlockNode(To,No)}throw(e){return this._leafNode(new bd(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Y.nil,n,o){return this._blockNode(new Oo(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Oo)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof pr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};K.CodeGen=Id;function hr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Oa(t,e){return e instanceof Y._CodeOrName?hr(t,e.names):t}function Br(t,e,r){if(t instanceof Y.Name)return n(t);if(!o(t))return t;return new Y._Code(t._items.reduce((i,a)=>(a instanceof Y.Name&&(a=n(a)),a instanceof Y._Code?i.push(...a._items):i.push(a),i),[]));function n(i){let a=r[i.str];return a===void 0||e[i.str]!==1?i:(delete e[i.str],a)}function o(i){return i instanceof Y._Code&&i._items.some(a=>a instanceof Y.Name&&e[a.str]===1&&r[a.str]!==void 0)}}function AS(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Og(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Y._)`!${Pd(t)}`}K.not=Og;var ZS=jg(K.operators.AND);function US(...t){return t.reduce(ZS)}K.and=US;var CS=jg(K.operators.OR);function MS(...t){return t.reduce(CS)}K.or=MS;function jg(t){return(e,r)=>e===Y.nil?r:r===Y.nil?e:(0,Y._)`${Pd(e)} ${t} ${Pd(r)}`}function Pd(t){return t instanceof Y.Name?t:(0,Y._)`(${t})`}});var te=S(H=>{"use strict";Object.defineProperty(H,"__esModule",{value:!0});H.checkStrictMode=H.getErrorPath=H.Type=H.useFunc=H.setEvaluated=H.evaluatedPropsToName=H.mergeEvaluated=H.eachItem=H.unescapeJsonPointer=H.escapeJsonPointer=H.escapeFragment=H.unescapeFragment=H.schemaRefOrVal=H.schemaHasRulesButRef=H.schemaHasRules=H.checkUnknownRules=H.alwaysValidSchema=H.toHash=void 0;var ue=F(),LS=Po();function qS(t){let e={};for(let r of t)e[r]=!0;return e}H.toHash=qS;function VS(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Rg(t,e),!Dg(e,t.self.RULES.all))}H.alwaysValidSchema=VS;function Rg(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let i in e)o[i]||Ug(t,`unknown keyword: "${i}"`)}H.checkUnknownRules=Rg;function Dg(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}H.schemaHasRules=Dg;function FS(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}H.schemaHasRulesButRef=FS;function JS({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ue._)`${r}`}return(0,ue._)`${t}${e}${(0,ue.getProperty)(n)}`}H.schemaRefOrVal=JS;function KS(t){return Ag(decodeURIComponent(t))}H.unescapeFragment=KS;function WS(t){return encodeURIComponent(Od(t))}H.escapeFragment=WS;function Od(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}H.escapeJsonPointer=Od;function Ag(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}H.unescapeJsonPointer=Ag;function HS(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}H.eachItem=HS;function Tg({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,i,a,s)=>{let c=a===void 0?i:a instanceof ue.Name?(i instanceof ue.Name?t(o,i,a):e(o,i,a),a):i instanceof ue.Name?(e(o,a,i),i):r(i,a);return s===ue.Name&&!(c instanceof ue.Name)?n(o,c):c}}H.mergeEvaluated={props:Tg({mergeNames:(t,e,r)=>t.if((0,ue._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ue._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ue._)`${r} || {}`).code((0,ue._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ue._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ue._)`${r} || {}`),jd(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Zg}),items:Tg({mergeNames:(t,e,r)=>t.if((0,ue._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ue._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ue._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ue._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Zg(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ue._)`{}`);return e!==void 0&&jd(t,r,e),r}H.evaluatedPropsToName=Zg;function jd(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ue._)`${e}${(0,ue.getProperty)(n)}`,!0))}H.setEvaluated=jd;var Ng={};function GS(t,e){return t.scopeValue("func",{ref:e,code:Ng[e.code]||(Ng[e.code]=new LS._Code(e.code))})}H.useFunc=GS;var Ed;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ed||(H.Type=Ed={}));function BS(t,e,r){if(t instanceof ue.Name){let n=e===Ed.Num;return r?n?(0,ue._)`"[" + ${t} + "]"`:(0,ue._)`"['" + ${t} + "']"`:n?(0,ue._)`"/" + ${t}`:(0,ue._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ue.getProperty)(t).toString():"/"+Od(t)}H.getErrorPath=BS;function Ug(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}H.checkStrictMode=Ug});var Nt=S(Td=>{"use strict";Object.defineProperty(Td,"__esModule",{value:!0});var Pe=F(),XS={data:new Pe.Name("data"),valCxt:new Pe.Name("valCxt"),instancePath:new Pe.Name("instancePath"),parentData:new Pe.Name("parentData"),parentDataProperty:new Pe.Name("parentDataProperty"),rootData:new Pe.Name("rootData"),dynamicAnchors:new Pe.Name("dynamicAnchors"),vErrors:new Pe.Name("vErrors"),errors:new Pe.Name("errors"),this:new Pe.Name("this"),self:new Pe.Name("self"),scope:new Pe.Name("scope"),json:new Pe.Name("json"),jsonPos:new Pe.Name("jsonPos"),jsonLen:new Pe.Name("jsonLen"),jsonPart:new Pe.Name("jsonPart")};Td.default=XS});var Ro=S(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.extendErrors=Ee.resetErrorsCount=Ee.reportExtraError=Ee.reportError=Ee.keyword$DataError=Ee.keywordError=void 0;var Q=F(),Ta=te(),De=Nt();Ee.keywordError={message:({keyword:t})=>(0,Q.str)`must pass "${t}" keyword validation`};Ee.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Q.str)`"${t}" keyword must be ${e} ($data)`:(0,Q.str)`"${t}" keyword is invalid ($data)`};function YS(t,e=Ee.keywordError,r,n){let{it:o}=t,{gen:i,compositeRule:a,allErrors:s}=o,c=Lg(t,e,r);n??(a||s)?Cg(i,c):Mg(o,(0,Q._)`[${c}]`)}Ee.reportError=YS;function QS(t,e=Ee.keywordError,r){let{it:n}=t,{gen:o,compositeRule:i,allErrors:a}=n,s=Lg(t,e,r);Cg(o,s),i||a||Mg(n,De.default.vErrors)}Ee.reportExtraError=QS;function ew(t,e){t.assign(De.default.errors,e),t.if((0,Q._)`${De.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Q._)`${De.default.vErrors}.length`,e),()=>t.assign(De.default.vErrors,null)))}Ee.resetErrorsCount=ew;function tw({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:i}){if(o===void 0)throw new Error("ajv implementation error");let a=t.name("err");t.forRange("i",o,De.default.errors,s=>{t.const(a,(0,Q._)`${De.default.vErrors}[${s}]`),t.if((0,Q._)`${a}.instancePath === undefined`,()=>t.assign((0,Q._)`${a}.instancePath`,(0,Q.strConcat)(De.default.instancePath,i.errorPath))),t.assign((0,Q._)`${a}.schemaPath`,(0,Q.str)`${i.errSchemaPath}/${e}`),i.opts.verbose&&(t.assign((0,Q._)`${a}.schema`,r),t.assign((0,Q._)`${a}.data`,n))})}Ee.extendErrors=tw;function Cg(t,e){let r=t.const("err",e);t.if((0,Q._)`${De.default.vErrors} === null`,()=>t.assign(De.default.vErrors,(0,Q._)`[${r}]`),(0,Q._)`${De.default.vErrors}.push(${r})`),t.code((0,Q._)`${De.default.errors}++`)}function Mg(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Q._)`new ${t.ValidationError}(${e})`):(r.assign((0,Q._)`${n}.errors`,e),r.return(!1))}var gr={keyword:new Q.Name("keyword"),schemaPath:new Q.Name("schemaPath"),params:new Q.Name("params"),propertyName:new Q.Name("propertyName"),message:new Q.Name("message"),schema:new Q.Name("schema"),parentSchema:new Q.Name("parentSchema")};function Lg(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Q._)`{}`:rw(t,e,r)}function rw(t,e,r={}){let{gen:n,it:o}=t,i=[nw(o,r),ow(t,r)];return iw(t,e,i),n.object(...i)}function nw({errorPath:t},{instancePath:e}){let r=e?(0,Q.str)`${t}${(0,Ta.getErrorPath)(e,Ta.Type.Str)}`:t;return[De.default.instancePath,(0,Q.strConcat)(De.default.instancePath,r)]}function ow({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Q.str)`${e}/${t}`;return r&&(o=(0,Q.str)`${o}${(0,Ta.getErrorPath)(r,Ta.Type.Str)}`),[gr.schemaPath,o]}function iw(t,{params:e,message:r},n){let{keyword:o,data:i,schemaValue:a,it:s}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=s;n.push([gr.keyword,o],[gr.params,typeof e=="function"?e(t):e||(0,Q._)`{}`]),c.messages&&n.push([gr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([gr.schema,a],[gr.parentSchema,(0,Q._)`${l}${d}`],[De.default.data,i]),u&&n.push([gr.propertyName,u])}});var Vg=S(Xr=>{"use strict";Object.defineProperty(Xr,"__esModule",{value:!0});Xr.boolOrEmptySchema=Xr.topBoolOrEmptySchema=void 0;var aw=Ro(),sw=F(),cw=Nt(),uw={message:"boolean schema is false"};function lw(t){let{gen:e,schema:r,validateName:n}=t;r===!1?qg(t,!1):typeof r=="object"&&r.$async===!0?e.return(cw.default.data):(e.assign((0,sw._)`${n}.errors`,null),e.return(!0))}Xr.topBoolOrEmptySchema=lw;function dw(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),qg(t)):r.var(e,!0)}Xr.boolOrEmptySchema=dw;function qg(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,aw.reportError)(o,uw,void 0,e)}});var Nd=S(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.getRules=Yr.isJSONType=void 0;var fw=["string","number","integer","boolean","null","object","array"],pw=new Set(fw);function mw(t){return typeof t=="string"&&pw.has(t)}Yr.isJSONType=mw;function hw(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Yr.getRules=hw});var Rd=S(Bt=>{"use strict";Object.defineProperty(Bt,"__esModule",{value:!0});Bt.shouldUseRule=Bt.shouldUseGroup=Bt.schemaHasRulesForType=void 0;function gw({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Fg(t,n)}Bt.schemaHasRulesForType=gw;function Fg(t,e){return e.rules.some(r=>Jg(t,r))}Bt.shouldUseGroup=Fg;function Jg(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Bt.shouldUseRule=Jg});var Do=S(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.reportTypeError=Oe.checkDataTypes=Oe.checkDataType=Oe.coerceAndCheckDataType=Oe.getJSONTypes=Oe.getSchemaTypes=Oe.DataType=void 0;var vw=Nd(),_w=Rd(),yw=Ro(),L=F(),Kg=te(),Qr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Qr||(Oe.DataType=Qr={}));function $w(t){let e=Wg(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Oe.getSchemaTypes=$w;function Wg(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(vw.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Oe.getJSONTypes=Wg;function bw(t,e){let{gen:r,data:n,opts:o}=t,i=xw(e,o.coerceTypes),a=e.length>0&&!(i.length===0&&e.length===1&&(0,_w.schemaHasRulesForType)(t,e[0]));if(a){let s=Ad(e,n,o.strictNumbers,Qr.Wrong);r.if(s,()=>{i.length?kw(t,e,i):Zd(t)})}return a}Oe.coerceAndCheckDataType=bw;var Hg=new Set(["string","number","integer","boolean","null"]);function xw(t,e){return e?t.filter(r=>Hg.has(r)||e==="array"&&r==="array"):[]}function kw(t,e,r){let{gen:n,data:o,opts:i}=t,a=n.let("dataType",(0,L._)`typeof ${o}`),s=n.let("coerced",(0,L._)`undefined`);i.coerceTypes==="array"&&n.if((0,L._)`${a} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,L._)`${o}[0]`).assign(a,(0,L._)`typeof ${o}`).if(Ad(e,o,i.strictNumbers),()=>n.assign(s,o))),n.if((0,L._)`${s} !== undefined`);for(let u of r)(Hg.has(u)||u==="array"&&i.coerceTypes==="array")&&c(u);n.else(),Zd(t),n.endIf(),n.if((0,L._)`${s} !== undefined`,()=>{n.assign(o,s),Sw(t,s)});function c(u){switch(u){case"string":n.elseIf((0,L._)`${a} == "number" || ${a} == "boolean"`).assign(s,(0,L._)`"" + ${o}`).elseIf((0,L._)`${o} === null`).assign(s,(0,L._)`""`);return;case"number":n.elseIf((0,L._)`${a} == "boolean" || ${o} === null
|| (${a} == "string" && ${o} && ${o} == +${o})`).assign(s,(0,L._)`+${o}`);return;case"integer":n.elseIf((0,L._)`${a} === "boolean" || ${o} === null
|| (${a} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(s,(0,L._)`+${o}`);return;case"boolean":n.elseIf((0,L._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(s,!1).elseIf((0,L._)`${o} === "true" || ${o} === 1`).assign(s,!0);return;case"null":n.elseIf((0,L._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(s,null);return;case"array":n.elseIf((0,L._)`${a} === "string" || ${a} === "number"
|| ${a} === "boolean" || ${o} === null`).assign(s,(0,L._)`[${o}]`)}}}function Sw({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,L._)`${e} !== undefined`,()=>t.assign((0,L._)`${e}[${r}]`,n))}function Dd(t,e,r,n=Qr.Correct){let o=n===Qr.Correct?L.operators.EQ:L.operators.NEQ,i;switch(t){case"null":return(0,L._)`${e} ${o} null`;case"array":i=(0,L._)`Array.isArray(${e})`;break;case"object":i=(0,L._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":i=a((0,L._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":i=a();break;default:return(0,L._)`typeof ${e} ${o} ${t}`}return n===Qr.Correct?i:(0,L.not)(i);function a(s=L.nil){return(0,L.and)((0,L._)`typeof ${e} == "number"`,s,r?(0,L._)`isFinite(${e})`:L.nil)}}Oe.checkDataType=Dd;function Ad(t,e,r,n){if(t.length===1)return Dd(t[0],e,r,n);let o,i=(0,Kg.toHash)(t);if(i.array&&i.object){let a=(0,L._)`typeof ${e} != "object"`;o=i.null?a:(0,L._)`!${e} || ${a}`,delete i.null,delete i.array,delete i.object}else o=L.nil;i.number&&delete i.integer;for(let a in i)o=(0,L.and)(o,Dd(a,e,r,n));return o}Oe.checkDataTypes=Ad;var ww={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,L._)`{type: ${t}}`:(0,L._)`{type: ${e}}`};function Zd(t){let e=zw(t);(0,yw.reportError)(e,ww)}Oe.reportTypeError=Zd;function zw(t){let{gen:e,data:r,schema:n}=t,o=(0,Kg.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var Bg=S(Na=>{"use strict";Object.defineProperty(Na,"__esModule",{value:!0});Na.assignDefaults=void 0;var en=F(),Iw=te();function Pw(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)Gg(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,i)=>Gg(t,i,o.default))}Na.assignDefaults=Pw;function Gg(t,e,r){let{gen:n,compositeRule:o,data:i,opts:a}=t;if(r===void 0)return;let s=(0,en._)`${i}${(0,en.getProperty)(e)}`;if(o){(0,Iw.checkStrictMode)(t,`default is ignored for: ${s}`);return}let c=(0,en._)`${s} === undefined`;a.useDefaults==="empty"&&(c=(0,en._)`${c} || ${s} === null || ${s} === ""`),n.if(c,(0,en._)`${s} = ${(0,en.stringify)(r)}`)}});var tt=S(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.validateUnion=ie.validateArray=ie.usePattern=ie.callValidateCode=ie.schemaProperties=ie.allSchemaProperties=ie.noPropertyInData=ie.propertyInData=ie.isOwnProperty=ie.hasPropFunc=ie.reportMissingProp=ie.checkMissingProp=ie.checkReportMissingProp=void 0;var pe=F(),Ud=te(),Xt=Nt(),Ew=te();function Ow(t,e){let{gen:r,data:n,it:o}=t;r.if(Md(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,pe._)`${e}`},!0),t.error()})}ie.checkReportMissingProp=Ow;function jw({gen:t,data:e,it:{opts:r}},n,o){return(0,pe.or)(...n.map(i=>(0,pe.and)(Md(t,e,i,r.ownProperties),(0,pe._)`${o} = ${i}`)))}ie.checkMissingProp=jw;function Tw(t,e){t.setParams({missingProperty:e},!0),t.error()}ie.reportMissingProp=Tw;function Xg(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,pe._)`Object.prototype.hasOwnProperty`})}ie.hasPropFunc=Xg;function Cd(t,e,r){return(0,pe._)`${Xg(t)}.call(${e}, ${r})`}ie.isOwnProperty=Cd;function Nw(t,e,r,n){let o=(0,pe._)`${e}${(0,pe.getProperty)(r)} !== undefined`;return n?(0,pe._)`${o} && ${Cd(t,e,r)}`:o}ie.propertyInData=Nw;function Md(t,e,r,n){let o=(0,pe._)`${e}${(0,pe.getProperty)(r)} === undefined`;return n?(0,pe.or)(o,(0,pe.not)(Cd(t,e,r))):o}ie.noPropertyInData=Md;function Yg(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ie.allSchemaProperties=Yg;function Rw(t,e){return Yg(e).filter(r=>!(0,Ud.alwaysValidSchema)(t,e[r]))}ie.schemaProperties=Rw;function Dw({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:i},it:a},s,c,u){let l=u?(0,pe._)`${t}, ${e}, ${n}${o}`:e,d=[[Xt.default.instancePath,(0,pe.strConcat)(Xt.default.instancePath,i)],[Xt.default.parentData,a.parentData],[Xt.default.parentDataProperty,a.parentDataProperty],[Xt.default.rootData,Xt.default.rootData]];a.opts.dynamicRef&&d.push([Xt.default.dynamicAnchors,Xt.default.dynamicAnchors]);let p=(0,pe._)`${l}, ${r.object(...d)}`;return c!==pe.nil?(0,pe._)`${s}.call(${c}, ${p})`:(0,pe._)`${s}(${p})`}ie.callValidateCode=Dw;var Aw=(0,pe._)`new RegExp`;function Zw({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,i=o(r,n);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:(0,pe._)`${o.code==="new RegExp"?Aw:(0,Ew.useFunc)(t,o)}(${r}, ${n})`})}ie.usePattern=Zw;function Uw(t){let{gen:e,data:r,keyword:n,it:o}=t,i=e.name("valid");if(o.allErrors){let s=e.let("valid",!0);return a(()=>e.assign(s,!1)),s}return e.var(i,!0),a(()=>e.break()),i;function a(s){let c=e.const("len",(0,pe._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:Ud.Type.Num},i),e.if((0,pe.not)(i),s)})}}ie.validateArray=Uw;function Cw(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Ud.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let a=e.let("valid",!1),s=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},s);e.assign(a,(0,pe._)`${a} || ${s}`),t.mergeValidEvaluated(l,s)||e.if((0,pe.not)(a))})),t.result(a,()=>t.reset(),()=>t.error(!0))}ie.validateUnion=Cw});var tv=S(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.validateKeywordUsage=gt.validSchemaType=gt.funcKeywordCode=gt.macroKeywordCode=void 0;var Ae=F(),vr=Nt(),Mw=tt(),Lw=Ro();function qw(t,e){let{gen:r,keyword:n,schema:o,parentSchema:i,it:a}=t,s=e.macro.call(a.self,o,i,a),c=ev(r,n,s);a.opts.validateSchema!==!1&&a.self.validateSchema(s,!0);let u=r.name("valid");t.subschema({schema:s,schemaPath:Ae.nil,errSchemaPath:`${a.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}gt.macroKeywordCode=qw;function Vw(t,e){var r;let{gen:n,keyword:o,schema:i,parentSchema:a,$data:s,it:c}=t;Jw(c,e);let u=!s&&e.compile?e.compile.call(c.self,i,a,c):e.validate,l=ev(n,o,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===!1)v(),e.modifying&&Qg(t),$(()=>t.error());else{let x=e.async?m():g();e.modifying&&Qg(t),$(()=>Fw(t,x))}}function m(){let x=n.let("ruleErrs",null);return n.try(()=>v((0,Ae._)`await `),j=>n.assign(d,!1).if((0,Ae._)`${j} instanceof ${c.ValidationError}`,()=>n.assign(x,(0,Ae._)`${j}.errors`),()=>n.throw(j))),x}function g(){let x=(0,Ae._)`${l}.errors`;return n.assign(x,null),v(Ae.nil),x}function v(x=e.async?(0,Ae._)`await `:Ae.nil){let j=c.opts.passContext?vr.default.this:vr.default.self,P=!("compile"in e&&!s||e.schema===!1);n.assign(d,(0,Ae._)`${x}${(0,Mw.callValidateCode)(t,l,j,P)}`,e.modifying)}function $(x){var j;n.if((0,Ae.not)((j=e.valid)!==null&&j!==void 0?j:d),x)}}gt.funcKeywordCode=Vw;function Qg(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Ae._)`${n.parentData}[${n.parentDataProperty}]`))}function Fw(t,e){let{gen:r}=t;r.if((0,Ae._)`Array.isArray(${e})`,()=>{r.assign(vr.default.vErrors,(0,Ae._)`${vr.default.vErrors} === null ? ${e} : ${vr.default.vErrors}.concat(${e})`).assign(vr.default.errors,(0,Ae._)`${vr.default.vErrors}.length`),(0,Lw.extendErrors)(t)},()=>t.error())}function Jw({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function ev(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ae.stringify)(r)})}function Kw(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}gt.validSchemaType=Kw;function Ww({schema:t,opts:e,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");let a=o.dependencies;if(a?.some(s=>!Object.prototype.hasOwnProperty.call(t,s)))throw new Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[i])){let c=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}gt.validateKeywordUsage=Ww});var nv=S(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.extendSubschemaMode=Yt.extendSubschemaData=Yt.getSubschema=void 0;var vt=F(),rv=te();function Hw(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:i,topSchemaRef:a}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let s=t.schema[e];return r===void 0?{schema:s,schemaPath:(0,vt._)`${t.schemaPath}${(0,vt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:s[r],schemaPath:(0,vt._)`${t.schemaPath}${(0,vt.getProperty)(e)}${(0,vt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,rv.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')}Yt.getSubschema=Hw;function Gw(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:i,propertyName:a}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=s.let("data",(0,vt._)`${e.data}${(0,vt.getProperty)(r)}`,!0);c(p),t.errorPath=(0,vt.str)`${u}${(0,rv.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,vt._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof vt.Name?o:s.let("data",o,!0);c(u),a!==void 0&&(t.propertyName=a)}i&&(t.dataTypes=i);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}Yt.extendSubschemaData=Gw;function Bw(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),i!==void 0&&(t.allErrors=i),t.jtdDiscriminator=e,t.jtdMetadata=r}Yt.extendSubschemaMode=Bw});var Ld=S((BA,ov)=>{"use strict";ov.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,i;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;o--!==0;){var a=i[o];if(!t(e[a],r[a]))return!1}return!0}return e!==e&&r!==r}});var av=S((XA,iv)=>{"use strict";var Qt=iv.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};Ra(e,n,o,t,"",t)};Qt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Qt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Qt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Qt.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 Ra(t,e,r,n,o,i,a,s,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,i,a,s,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in Qt.arrayKeywords)for(var p=0;p<d.length;p++)Ra(t,e,r,d[p],o+"/"+l+"/"+p,i,o,l,n,p)}else if(l in Qt.propsKeywords){if(d&&typeof d=="object")for(var m in d)Ra(t,e,r,d[m],o+"/"+l+"/"+Xw(m),i,o,l,n,m)}else(l in Qt.keywords||t.allKeys&&!(l in Qt.skipKeywords))&&Ra(t,e,r,d,o+"/"+l,i,o,l,n)}r(n,o,i,a,s,c,u)}}function Xw(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ao=S(Le=>{"use strict";Object.defineProperty(Le,"__esModule",{value:!0});Le.getSchemaRefs=Le.resolveUrl=Le.normalizeId=Le._getFullPath=Le.getFullPath=Le.inlineRef=void 0;var Yw=te(),Qw=Ld(),e0=av(),t0=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function r0(t,e=!0){return typeof t=="boolean"?!0:e===!0?!qd(t):e?sv(t)<=e:!1}Le.inlineRef=r0;var n0=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function qd(t){for(let e in t){if(n0.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(qd)||typeof r=="object"&&qd(r))return!0}return!1}function sv(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!t0.has(r)&&(typeof t[r]=="object"&&(0,Yw.eachItem)(t[r],n=>e+=sv(n)),e===1/0))return 1/0}return e}function cv(t,e="",r){r!==!1&&(e=tn(e));let n=t.parse(e);return uv(t,n)}Le.getFullPath=cv;function uv(t,e){return t.serialize(e).split("#")[0]+"#"}Le._getFullPath=uv;var o0=/#\/?$/;function tn(t){return t?t.replace(o0,""):""}Le.normalizeId=tn;function i0(t,e,r){return r=tn(r),t.resolve(e,r)}Le.resolveUrl=i0;var a0=/^[a-z_][-a-z0-9._]*$/i;function s0(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=tn(t[r]||e),i={"":o},a=cv(n,o,!1),s={},c=new Set;return e0(t,{allKeys:!0},(d,p,m,g)=>{if(g===void 0)return;let v=a+p,$=i[g];typeof d[r]=="string"&&($=x.call(this,d[r])),j.call(this,d.$anchor),j.call(this,d.$dynamicAnchor),i[p]=$;function x(P){let C=this.opts.uriResolver.resolve;if(P=tn($?C($,P):P),c.has(P))throw l(P);c.add(P);let N=this.refs[P];return typeof N=="string"&&(N=this.refs[N]),typeof N=="object"?u(d,N.schema,P):P!==tn(v)&&(P[0]==="#"?(u(d,s[P],P),s[P]=d):this.refs[P]=v),P}function j(P){if(typeof P=="string"){if(!a0.test(P))throw new Error(`invalid anchor "${P}"`);x.call(this,`#${P}`)}}}),s;function u(d,p,m){if(p!==void 0&&!Qw(d,p))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Le.getSchemaRefs=s0});var Co=S(er=>{"use strict";Object.defineProperty(er,"__esModule",{value:!0});er.getData=er.KeywordCxt=er.validateFunctionCode=void 0;var mv=Vg(),lv=Do(),Fd=Rd(),Da=Do(),c0=Bg(),Uo=tv(),Vd=nv(),O=F(),Z=Nt(),u0=Ao(),Rt=te(),Zo=Ro();function l0(t){if(vv(t)&&(_v(t),gv(t))){p0(t);return}hv(t,()=>(0,mv.topBoolOrEmptySchema)(t))}er.validateFunctionCode=l0;function hv({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},i){o.code.es5?t.func(e,(0,O._)`${Z.default.data}, ${Z.default.valCxt}`,n.$async,()=>{t.code((0,O._)`"use strict"; ${dv(r,o)}`),f0(t,o),t.code(i)}):t.func(e,(0,O._)`${Z.default.data}, ${d0(o)}`,n.$async,()=>t.code(dv(r,o)).code(i))}function d0(t){return(0,O._)`{${Z.default.instancePath}="", ${Z.default.parentData}, ${Z.default.parentDataProperty}, ${Z.default.rootData}=${Z.default.data}${t.dynamicRef?(0,O._)`, ${Z.default.dynamicAnchors}={}`:O.nil}}={}`}function f0(t,e){t.if(Z.default.valCxt,()=>{t.var(Z.default.instancePath,(0,O._)`${Z.default.valCxt}.${Z.default.instancePath}`),t.var(Z.default.parentData,(0,O._)`${Z.default.valCxt}.${Z.default.parentData}`),t.var(Z.default.parentDataProperty,(0,O._)`${Z.default.valCxt}.${Z.default.parentDataProperty}`),t.var(Z.default.rootData,(0,O._)`${Z.default.valCxt}.${Z.default.rootData}`),e.dynamicRef&&t.var(Z.default.dynamicAnchors,(0,O._)`${Z.default.valCxt}.${Z.default.dynamicAnchors}`)},()=>{t.var(Z.default.instancePath,(0,O._)`""`),t.var(Z.default.parentData,(0,O._)`undefined`),t.var(Z.default.parentDataProperty,(0,O._)`undefined`),t.var(Z.default.rootData,Z.default.data),e.dynamicRef&&t.var(Z.default.dynamicAnchors,(0,O._)`{}`)})}function p0(t){let{schema:e,opts:r,gen:n}=t;hv(t,()=>{r.$comment&&e.$comment&&$v(t),_0(t),n.let(Z.default.vErrors,null),n.let(Z.default.errors,0),r.unevaluated&&m0(t),yv(t),b0(t)})}function m0(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,O._)`${r}.evaluated`),e.if((0,O._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,O._)`${t.evaluated}.props`,(0,O._)`undefined`)),e.if((0,O._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,O._)`${t.evaluated}.items`,(0,O._)`undefined`))}function dv(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,O._)`/*# sourceURL=${r} */`:O.nil}function h0(t,e){if(vv(t)&&(_v(t),gv(t))){g0(t,e);return}(0,mv.boolOrEmptySchema)(t,e)}function gv({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function vv(t){return typeof t.schema!="boolean"}function g0(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&$v(t),y0(t),$0(t);let i=n.const("_errs",Z.default.errors);yv(t,i),n.var(e,(0,O._)`${i} === ${Z.default.errors}`)}function _v(t){(0,Rt.checkUnknownRules)(t),v0(t)}function yv(t,e){if(t.opts.jtd)return fv(t,[],!1,e);let r=(0,lv.getSchemaTypes)(t.schema),n=(0,lv.coerceAndCheckDataType)(t,r);fv(t,r,!n,e)}function v0(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Rt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function _0(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Rt.checkStrictMode)(t,"default is ignored in the schema root")}function y0(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,u0.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function $0(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function $v({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let i=r.$comment;if(o.$comment===!0)t.code((0,O._)`${Z.default.self}.logger.log(${i})`);else if(typeof o.$comment=="function"){let a=(0,O.str)`${n}/$comment`,s=t.scopeValue("root",{ref:e.root});t.code((0,O._)`${Z.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function b0(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=t;r.$async?e.if((0,O._)`${Z.default.errors} === 0`,()=>e.return(Z.default.data),()=>e.throw((0,O._)`new ${o}(${Z.default.vErrors})`)):(e.assign((0,O._)`${n}.errors`,Z.default.vErrors),i.unevaluated&&x0(t),e.return((0,O._)`${Z.default.errors} === 0`))}function x0({gen:t,evaluated:e,props:r,items:n}){r instanceof O.Name&&t.assign((0,O._)`${e}.props`,r),n instanceof O.Name&&t.assign((0,O._)`${e}.items`,n)}function fv(t,e,r,n){let{gen:o,schema:i,data:a,allErrors:s,opts:c,self:u}=t,{RULES:l}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,Rt.schemaHasRulesButRef)(i,l))){o.block(()=>xv(t,"$ref",l.all.$ref.definition));return}c.jtd||k0(t,e),o.block(()=>{for(let p of l.rules)d(p);d(l.post)});function d(p){(0,Fd.shouldUseGroup)(i,p)&&(p.type?(o.if((0,Da.checkDataType)(p.type,a,c.strictNumbers)),pv(t,p),e.length===1&&e[0]===p.type&&r&&(o.else(),(0,Da.reportTypeError)(t)),o.endIf()):pv(t,p),s||o.if((0,O._)`${Z.default.errors} === ${n||0}`))}}function pv(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,c0.assignDefaults)(t,e.type),r.block(()=>{for(let i of e.rules)(0,Fd.shouldUseRule)(n,i)&&xv(t,i.keyword,i.definition,e.type)})}function k0(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(S0(t,e),t.opts.allowUnionTypes||w0(t,e),z0(t,t.dataTypes))}function S0(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{bv(t.dataTypes,r)||Jd(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),P0(t,e)}}function w0(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Jd(t,"use allowUnionTypes to allow union type keyword")}function z0(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Fd.shouldUseRule)(t.schema,o)){let{type:i}=o.definition;i.length&&!i.some(a=>I0(e,a))&&Jd(t,`missing type "${i.join(",")}" for keyword "${n}"`)}}}function I0(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function bv(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function P0(t,e){let r=[];for(let n of t.dataTypes)bv(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Jd(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Rt.checkStrictMode)(t,e,t.opts.strictTypes)}var Aa=class{constructor(e,r,n){if((0,Uo.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Rt.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",kv(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Uo.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",Z.default.errors))}result(e,r,n){this.failResult((0,O.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,O.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,O._)`${r} !== undefined && (${(0,O.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?Zo.reportExtraError:Zo.reportError)(this,this.def.error,r)}$dataError(){(0,Zo.reportError)(this,this.def.$dataError||Zo.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Zo.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=O.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=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)),e!==O.nil&&n.assign(e,!0),(i.length||a.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==O.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,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,Da.checkDataTypes)(c,r,i.opts.strictNumbers,Da.DataType.Wrong)}`}return O.nil}function s(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,O._)`!${c}(${r})`}return O.nil}}subschema(e,r){let n=(0,Vd.getSubschema)(this.it,e);(0,Vd.extendSubschemaData)(n,this.it,e),(0,Vd.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return h0(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Rt.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Rt.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,O.Name)),!0}};er.KeywordCxt=Aa;function xv(t,e,r,n){let o=new Aa(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Uo.funcKeywordCode)(o,r):"macro"in r?(0,Uo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Uo.funcKeywordCode)(o,r)}var E0=/^\/(?:[^~]|~0|~1)*$/,O0=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function kv(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,i;if(t==="")return Z.default.rootData;if(t[0]==="/"){if(!E0.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,i=Z.default.rootData}else{let u=O0.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(i=r[e-l],!o)return i}let a=i,s=o.split("/");for(let u of s)u&&(i=(0,O._)`${i}${(0,O.getProperty)((0,Rt.unescapeJsonPointer)(u))}`,a=(0,O._)`${a} && ${i}`);return a;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}er.getData=kv});var Za=S(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});var Kd=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Wd.default=Kd});var Mo=S(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});var Hd=Ao(),Gd=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Hd.resolveUrl)(e,r,n),this.missingSchema=(0,Hd.normalizeId)((0,Hd.getFullPath)(e,this.missingRef))}};Bd.default=Gd});var Ca=S(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.resolveSchema=rt.getCompilingSchema=rt.resolveRef=rt.compileSchema=rt.SchemaEnv=void 0;var ct=F(),j0=Za(),_r=Nt(),ut=Ao(),Sv=te(),T0=Co(),rn=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,ut.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};rt.SchemaEnv=rn;function Yd(t){let e=wv.call(this,t);if(e)return e;let r=(0,ut.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:i}=this.opts,a=new ct.CodeGen(this.scope,{es5:n,lines:o,ownProperties:i}),s;t.$async&&(s=a.scopeValue("Error",{ref:j0.default,code:(0,ct._)`require("ajv/dist/runtime/validation_error").default`}));let c=a.scopeName("validate");t.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:_r.default.data,parentData:_r.default.parentData,parentDataProperty:_r.default.parentDataProperty,dataNames:[_r.default.data],dataPathArr:[ct.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ct.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:s,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ct.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ct._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,T0.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let d=a.toString();l=`${a.scopeRefs(_r.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let m=new Function(`${_r.default.self}`,`${_r.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:m}),m.errors=null,m.schema=t.schema,m.schemaEnv=t,t.$async&&(m.$async=!0),this.opts.code.source===!0&&(m.source={validateName:c,validateCode:d,scopeValues:a._values}),this.opts.unevaluated){let{props:g,items:v}=u;m.evaluated={props:g instanceof ct.Name?void 0:g,items:v instanceof ct.Name?void 0:v,dynamicProps:g instanceof ct.Name,dynamicItems:v instanceof ct.Name},m.source&&(m.source.evaluated=(0,ct.stringify)(m.evaluated))}return t.validate=m,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}rt.compileSchema=Yd;function N0(t,e,r){var n;r=(0,ut.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let i=A0.call(this,t,r);if(i===void 0){let a=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:s}=this.opts;a&&(i=new rn({schema:a,schemaId:s,root:t,baseId:e}))}if(i!==void 0)return t.refs[r]=R0.call(this,i)}rt.resolveRef=N0;function R0(t){return(0,ut.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Yd.call(this,t)}function wv(t){for(let e of this._compilations)if(D0(e,t))return e}rt.getCompilingSchema=wv;function D0(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function A0(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||Ua.call(this,t,e)}function Ua(t,e){let r=this.opts.uriResolver.parse(e),n=(0,ut._getFullPath)(this.opts.uriResolver,r),o=(0,ut.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return Xd.call(this,r,t);let i=(0,ut.normalizeId)(n),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=Ua.call(this,t,a);return typeof s?.schema!="object"?void 0:Xd.call(this,r,s)}if(typeof a?.schema=="object"){if(a.validate||Yd.call(this,a),i===(0,ut.normalizeId)(e)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];return u&&(o=(0,ut.resolveUrl)(this.opts.uriResolver,o,u)),new rn({schema:s,schemaId:c,root:t,baseId:o})}return Xd.call(this,r,a)}}rt.resolveSchema=Ua;var Z0=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xd(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let s of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Sv.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Z0.has(s)&&u&&(e=(0,ut.resolveUrl)(this.opts.uriResolver,e,u))}let i;if(typeof r!="boolean"&&r.$ref&&!(0,Sv.schemaHasRulesButRef)(r,this.RULES)){let s=(0,ut.resolveUrl)(this.opts.uriResolver,e,r.$ref);i=Ua.call(this,n,s)}let{schemaId:a}=this.opts;if(i=i||new rn({schema:r,schemaId:a,root:n,baseId:e}),i.schema!==i.root.schema)return i}});var zv=S((nZ,U0)=>{U0.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 ef=S((oZ,Ov)=>{"use strict";var C0=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),Pv=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function Qd(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var M0=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Iv(t){return t.length=0,!0}function L0(t,e,r){if(t.length){let n=Qd(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function q0(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],i=!1,a=!1,s=L0;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(i===!0&&(a=!0),!s(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(i=!0),n.push(":");continue}else if(u==="%"){if(!s(o,n,r))break;s=Iv}else{o.push(u);continue}}return o.length&&(s===Iv?r.zone=o.join(""):a?n.push(o.join("")):n.push(Qd(o))),r.address=n.join(""),r}function Ev(t){if(V0(t,":")<2)return{host:t,isIPV6:!1};let e=q0(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function V0(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function F0(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}function J0(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function K0(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!Pv(r)){let n=Ev(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Ov.exports={nonSimpleDomain:M0,recomposeAuthority:K0,normalizeComponentEncoding:J0,removeDotSegments:F0,isIPv4:Pv,isUUID:C0,normalizeIPv6:Ev,stringArrayToHexStripped:Qd}});var Dv=S((iZ,Rv)=>{"use strict";var{isUUID:W0}=ef(),H0=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,G0=["http","https","ws","wss","urn","urn:uuid"];function B0(t){return G0.indexOf(t)!==-1}function tf(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function jv(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Tv(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function X0(t){return t.secure=tf(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function Y0(t){if((t.port===(tf(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function Q0(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(H0);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,i=rf(o);t.path=void 0,i&&(t=i.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function ez(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,i=rf(o);i&&(t=i.serialize(t,e));let a=t,s=t.nss;return a.path=`${n||e.nid}:${s}`,e.skipEscape=!0,a}function tz(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!W0(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function rz(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Nv={scheme:"http",domainHost:!0,parse:jv,serialize:Tv},nz={scheme:"https",domainHost:Nv.domainHost,parse:jv,serialize:Tv},Ma={scheme:"ws",domainHost:!0,parse:X0,serialize:Y0},oz={scheme:"wss",domainHost:Ma.domainHost,parse:Ma.parse,serialize:Ma.serialize},iz={scheme:"urn",parse:Q0,serialize:ez,skipNormalize:!0},az={scheme:"urn:uuid",parse:tz,serialize:rz,skipNormalize:!0},La={http:Nv,https:nz,ws:Ma,wss:oz,urn:iz,"urn:uuid":az};Object.setPrototypeOf(La,null);function rf(t){return t&&(La[t]||La[t.toLowerCase()])||void 0}Rv.exports={wsIsSecure:tf,SCHEMES:La,isValidSchemeName:B0,getSchemeHandler:rf}});var Uv=S((aZ,Va)=>{"use strict";var{normalizeIPv6:sz,removeDotSegments:Lo,recomposeAuthority:cz,normalizeComponentEncoding:qa,isIPv4:uz,nonSimpleDomain:lz}=ef(),{SCHEMES:dz,getSchemeHandler:Av}=Dv();function fz(t,e){return typeof t=="string"?t=_t(Dt(t,e),e):typeof t=="object"&&(t=Dt(_t(t,e),e)),t}function pz(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Zv(Dt(t,n),Dt(e,n),n,!0);return n.skipEscape=!0,_t(o,n)}function Zv(t,e,r,n){let o={};return n||(t=Dt(_t(t,r),r),e=Dt(_t(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Lo(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Lo(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Lo(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Lo(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function mz(t,e,r){return typeof t=="string"?(t=unescape(t),t=_t(qa(Dt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=_t(qa(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=_t(qa(Dt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=_t(qa(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function _t(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],i=Av(n.scheme||r.scheme);i&&i.serialize&&i.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let a=cz(r);if(a!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(a),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let s=r.path;!n.absolutePath&&(!i||!i.absolutePath)&&(s=Lo(s)),a===void 0&&s[0]==="/"&&s[1]==="/"&&(s="/%2F"+s.slice(2)),o.push(s)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var hz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Dt(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(hz);if(i){if(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||"",n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5]),n.host)if(uz(n.host)===!1){let c=sz(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6}else o=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=Av(r.scheme||n.scheme);if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&o===!1&&lz(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(s){n.error=n.error||"Host's domain name can not be converted to ASCII: "+s}(!a||a&&!a.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var nf={SCHEMES:dz,normalize:fz,resolve:pz,resolveComponent:Zv,equal:mz,serialize:_t,parse:Dt};Va.exports=nf;Va.exports.default=nf;Va.exports.fastUri=nf});var Mv=S(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});var Cv=Uv();Cv.code='require("ajv/dist/runtime/uri").default';of.default=Cv});var Hv=S(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.CodeGen=ke.Name=ke.nil=ke.stringify=ke.str=ke._=ke.KeywordCxt=void 0;var gz=Co();Object.defineProperty(ke,"KeywordCxt",{enumerable:!0,get:function(){return gz.KeywordCxt}});var nn=F();Object.defineProperty(ke,"_",{enumerable:!0,get:function(){return nn._}});Object.defineProperty(ke,"str",{enumerable:!0,get:function(){return nn.str}});Object.defineProperty(ke,"stringify",{enumerable:!0,get:function(){return nn.stringify}});Object.defineProperty(ke,"nil",{enumerable:!0,get:function(){return nn.nil}});Object.defineProperty(ke,"Name",{enumerable:!0,get:function(){return nn.Name}});Object.defineProperty(ke,"CodeGen",{enumerable:!0,get:function(){return nn.CodeGen}});var vz=Za(),Jv=Mo(),_z=Nd(),qo=Ca(),yz=F(),Vo=Ao(),Fa=Do(),sf=te(),Lv=zv(),$z=Mv(),Kv=(t,e)=>new RegExp(t,e);Kv.code="new RegExp";var bz=["removeAdditional","useDefaults","coerceTypes"],xz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),kz={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."},Sz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},qv=200;function wz(t){var e,r,n,o,i,a,s,c,u,l,d,p,m,g,v,$,x,j,P,C,N,ft,xt,hs,gs;let mn=t.strict,vs=(e=t.code)===null||e===void 0?void 0:e.optimize,fp=vs===!0||vs===void 0?1:vs||0,pp=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Kv,Py=(o=t.uriResolver)!==null&&o!==void 0?o:$z.default;return{strictSchema:(a=(i=t.strictSchema)!==null&&i!==void 0?i:mn)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=t.strictNumbers)!==null&&s!==void 0?s:mn)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:mn)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:mn)!==null&&p!==void 0?p:"log",strictRequired:(g=(m=t.strictRequired)!==null&&m!==void 0?m:mn)!==null&&g!==void 0?g:!1,code:t.code?{...t.code,optimize:fp,regExp:pp}:{optimize:fp,regExp:pp},loopRequired:(v=t.loopRequired)!==null&&v!==void 0?v:qv,loopEnum:($=t.loopEnum)!==null&&$!==void 0?$:qv,meta:(x=t.meta)!==null&&x!==void 0?x:!0,messages:(j=t.messages)!==null&&j!==void 0?j:!0,inlineRefs:(P=t.inlineRefs)!==null&&P!==void 0?P:!0,schemaId:(C=t.schemaId)!==null&&C!==void 0?C:"$id",addUsedSchema:(N=t.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(ft=t.validateSchema)!==null&&ft!==void 0?ft:!0,validateFormats:(xt=t.validateFormats)!==null&&xt!==void 0?xt:!0,unicodeRegExp:(hs=t.unicodeRegExp)!==null&&hs!==void 0?hs:!0,int32range:(gs=t.int32range)!==null&&gs!==void 0?gs:!0,uriResolver:Py}}var Fo=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...wz(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new yz.ValueScope({scope:{},prefixes:xz,es5:r,lines:n}),this.logger=jz(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,_z.getRules)(),Vv.call(this,kz,e,"NOT SUPPORTED"),Vv.call(this,Sz,e,"DEPRECATED","warn"),this._metaOpts=Ez.call(this),e.formats&&Iz.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&Pz.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),zz.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=Lv;n==="id"&&(o={...Lv},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await i.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||a.call(this,p)}async function i(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function a(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof Jv.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(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let a of e)this.addSchema(a,void 0,n,o);return this}let i;if(typeof e=="object"){let{schemaId:a}=this.opts;if(i=e[a],i!==void 0&&typeof i!="string")throw new Error(`schema ${a} must be string`)}return r=(0,Vo.normalizeId)(r||i),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let i="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(i);else throw new Error(i)}return o}getSchema(e){let r;for(;typeof(r=Fv.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new qo.SchemaEnv({schema:{},schemaId:n});if(r=qo.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Fv.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Vo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Nz.call(this,n,r),!r)return(0,sf.eachItem)(n,i=>af.call(this,i)),this;Dz.call(this,r);let o={...r,type:(0,Fa.getJSONTypes)(r.type),schemaType:(0,Fa.getJSONTypes)(r.schemaType)};return(0,sf.eachItem)(n,o.type.length===0?i=>af.call(this,i,o):i=>o.type.forEach(a=>af.call(this,i,o,a))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(i=>i.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,i)=>o+r+i)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let i=o.split("/").slice(1),a=e;for(let s of i)a=a[s];for(let s in n){let c=n[s];if(typeof c!="object")continue;let{$data:u}=c.definition,l=a[s];u&&l&&(a[s]=Wv(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,i=this.opts.addUsedSchema){let a,{schemaId:s}=this.opts;if(typeof e=="object")a=e[s];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Vo.normalizeId)(a||n);let u=Vo.getSchemaRefs.call(this,e,n);return c=new qo.SchemaEnv({schema:e,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(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):qo.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{qo.compileSchema.call(this,e)}finally{this.opts=r}}};Fo.ValidationError=vz.default;Fo.MissingRefError=Jv.default;ke.default=Fo;function Vv(t,e,r,n="error"){for(let o in t){let i=o;i in e&&this.logger[n](`${r}: option ${o}. ${t[i]}`)}}function Fv(t){return t=(0,Vo.normalizeId)(t),this.schemas[t]||this.refs[t]}function zz(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Iz(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function Pz(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function Ez(){let t={...this.opts};for(let e of bz)delete t[e];return t}var Oz={log(){},warn(){},error(){}};function jz(t){if(t===!1)return Oz;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Tz=/^[a-z_$][a-z0-9_$:-]*$/i;function Nz(t,e){let{RULES:r}=this;if((0,sf.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Tz.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function af(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=o?i.post:i.rules.find(({type:c})=>c===r);if(a||(a={type:r,rules:[]},i.rules.push(a)),i.keywords[t]=!0,!e)return;let s={keyword:t,definition:{...e,type:(0,Fa.getJSONTypes)(e.type),schemaType:(0,Fa.getJSONTypes)(e.schemaType)}};e.before?Rz.call(this,a,s,e.before):a.rules.push(s),i.all[t]=s,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Rz(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function Dz(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Wv(e)),t.validateSchema=this.compile(e,!0))}var Az={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Wv(t){return{anyOf:[t,Az]}}});var Gv=S(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});var Zz={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};cf.default=Zz});var Qv=S(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0});yr.callRef=yr.getValidate=void 0;var Uz=Mo(),Bv=tt(),qe=F(),on=Nt(),Xv=Ca(),Ja=te(),Cz={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:i,validateName:a,opts:s,self:c}=n,{root:u}=i;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Xv.resolveRef.call(c,u,o,r);if(l===void 0)throw new Uz.default(n.opts.uriResolver,o,r);if(l instanceof Xv.SchemaEnv)return p(l);return m(l);function d(){if(i===u)return Ka(t,a,i,i.$async);let g=e.scopeValue("root",{ref:u});return Ka(t,(0,qe._)`${g}.validate`,u,u.$async)}function p(g){let v=Yv(t,g);Ka(t,v,g,g.$async)}function m(g){let v=e.scopeValue("schema",s.code.source===!0?{ref:g,code:(0,qe.stringify)(g)}:{ref:g}),$=e.name("valid"),x=t.subschema({schema:g,dataTypes:[],schemaPath:qe.nil,topSchemaRef:v,errSchemaPath:r},$);t.mergeEvaluated(x),t.ok($)}}};function Yv(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,qe._)`${r.scopeValue("wrapper",{ref:e})}.validate`}yr.getValidate=Yv;function Ka(t,e,r,n){let{gen:o,it:i}=t,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?on.default.this:qe.nil;n?l():d();function l(){if(!s.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,qe._)`await ${(0,Bv.callValidateCode)(t,e,u)}`),m(e),a||o.assign(g,!0)},v=>{o.if((0,qe._)`!(${v} instanceof ${i.ValidationError})`,()=>o.throw(v)),p(v),a||o.assign(g,!1)}),t.ok(g)}function d(){t.result((0,Bv.callValidateCode)(t,e,u),()=>m(e),()=>p(e))}function p(g){let v=(0,qe._)`${g}.errors`;o.assign(on.default.vErrors,(0,qe._)`${on.default.vErrors} === null ? ${v} : ${on.default.vErrors}.concat(${v})`),o.assign(on.default.errors,(0,qe._)`${on.default.vErrors}.length`)}function m(g){var v;if(!i.opts.unevaluated)return;let $=(v=r?.validate)===null||v===void 0?void 0:v.evaluated;if(i.props!==!0)if($&&!$.dynamicProps)$.props!==void 0&&(i.props=Ja.mergeEvaluated.props(o,$.props,i.props));else{let x=o.var("props",(0,qe._)`${g}.evaluated.props`);i.props=Ja.mergeEvaluated.props(o,x,i.props,qe.Name)}if(i.items!==!0)if($&&!$.dynamicItems)$.items!==void 0&&(i.items=Ja.mergeEvaluated.items(o,$.items,i.items));else{let x=o.var("items",(0,qe._)`${g}.evaluated.items`);i.items=Ja.mergeEvaluated.items(o,x,i.items,qe.Name)}}}yr.callRef=Ka;yr.default=Cz});var e_=S(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});var Mz=Gv(),Lz=Qv(),qz=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Mz.default,Lz.default];uf.default=qz});var t_=S(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});var Wa=F(),tr=Wa.operators,Ha={maximum:{okStr:"<=",ok:tr.LTE,fail:tr.GT},minimum:{okStr:">=",ok:tr.GTE,fail:tr.LT},exclusiveMaximum:{okStr:"<",ok:tr.LT,fail:tr.GTE},exclusiveMinimum:{okStr:">",ok:tr.GT,fail:tr.LTE}},Vz={message:({keyword:t,schemaCode:e})=>(0,Wa.str)`must be ${Ha[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Wa._)`{comparison: ${Ha[t].okStr}, limit: ${e}}`},Fz={keyword:Object.keys(Ha),type:"number",schemaType:"number",$data:!0,error:Vz,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Wa._)`${r} ${Ha[e].fail} ${n} || isNaN(${r})`)}};lf.default=Fz});var r_=S(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});var Jo=F(),Jz={message:({schemaCode:t})=>(0,Jo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Jo._)`{multipleOf: ${t}}`},Kz={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Jz,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,i=o.opts.multipleOfPrecision,a=e.let("res"),s=i?(0,Jo._)`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:(0,Jo._)`${a} !== parseInt(${a})`;t.fail$data((0,Jo._)`(${n} === 0 || (${a} = ${r}/${n}, ${s}))`)}};df.default=Kz});var o_=S(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});function n_(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}ff.default=n_;n_.code='require("ajv/dist/runtime/ucs2length").default'});var i_=S(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});var $r=F(),Wz=te(),Hz=o_(),Gz={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,$r.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,$r._)`{limit: ${t}}`},Bz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Gz,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,i=e==="maxLength"?$r.operators.GT:$r.operators.LT,a=o.opts.unicode===!1?(0,$r._)`${r}.length`:(0,$r._)`${(0,Wz.useFunc)(t.gen,Hz.default)}(${r})`;t.fail$data((0,$r._)`${a} ${i} ${n}`)}};pf.default=Bz});var a_=S(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});var Xz=tt(),Ga=F(),Yz={message:({schemaCode:t})=>(0,Ga.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Ga._)`{pattern: ${t}}`},Qz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Yz,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:i}=t,a=i.opts.unicodeRegExp?"u":"",s=r?(0,Ga._)`(new RegExp(${o}, ${a}))`:(0,Xz.usePattern)(t,n);t.fail$data((0,Ga._)`!${s}.test(${e})`)}};mf.default=Qz});var s_=S(hf=>{"use strict";Object.defineProperty(hf,"__esModule",{value:!0});var Ko=F(),eI={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Ko.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Ko._)`{limit: ${t}}`},tI={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:eI,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Ko.operators.GT:Ko.operators.LT;t.fail$data((0,Ko._)`Object.keys(${r}).length ${o} ${n}`)}};hf.default=tI});var c_=S(gf=>{"use strict";Object.defineProperty(gf,"__esModule",{value:!0});var Wo=tt(),Ho=F(),rI=te(),nI={message:({params:{missingProperty:t}})=>(0,Ho.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Ho._)`{missingProperty: ${t}}`},oI={keyword:"required",type:"object",schemaType:"array",$data:!0,error:nI,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:i,it:a}=t,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors?u():l(),s.strictRequired){let m=t.parentSchema.properties,{definedProperties:g}=t.it;for(let v of r)if(m?.[v]===void 0&&!g.has(v)){let $=a.schemaEnv.baseId+a.errSchemaPath,x=`required property "${v}" is not defined at "${$}" (strictRequired)`;(0,rI.checkStrictMode)(a,x,a.opts.strictRequired)}}function u(){if(c||i)t.block$data(Ho.nil,d);else for(let m of r)(0,Wo.checkReportMissingProp)(t,m)}function l(){let m=e.let("missing");if(c||i){let g=e.let("valid",!0);t.block$data(g,()=>p(m,g)),t.ok(g)}else e.if((0,Wo.checkMissingProp)(t,r,m)),(0,Wo.reportMissingProp)(t,m),e.else()}function d(){e.forOf("prop",n,m=>{t.setParams({missingProperty:m}),e.if((0,Wo.noPropertyInData)(e,o,m,s.ownProperties),()=>t.error())})}function p(m,g){t.setParams({missingProperty:m}),e.forOf(m,n,()=>{e.assign(g,(0,Wo.propertyInData)(e,o,m,s.ownProperties)),e.if((0,Ho.not)(g),()=>{t.error(),e.break()})},Ho.nil)}}};gf.default=oI});var u_=S(vf=>{"use strict";Object.defineProperty(vf,"__esModule",{value:!0});var Go=F(),iI={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Go.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Go._)`{limit: ${t}}`},aI={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:iI,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Go.operators.GT:Go.operators.LT;t.fail$data((0,Go._)`${r}.length ${o} ${n}`)}};vf.default=aI});var Ba=S(_f=>{"use strict";Object.defineProperty(_f,"__esModule",{value:!0});var l_=Ld();l_.code='require("ajv/dist/runtime/equal").default';_f.default=l_});var d_=S($f=>{"use strict";Object.defineProperty($f,"__esModule",{value:!0});var yf=Do(),Se=F(),sI=te(),cI=Ba(),uI={message:({params:{i:t,j:e}})=>(0,Se.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Se._)`{i: ${t}, j: ${e}}`},lI={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:uI,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:i,schemaCode:a,it:s}=t;if(!n&&!o)return;let c=e.let("valid"),u=i.items?(0,yf.getSchemaTypes)(i.items):[];t.block$data(c,l,(0,Se._)`${a} === false`),t.ok(c);function l(){let g=e.let("i",(0,Se._)`${r}.length`),v=e.let("j");t.setParams({i:g,j:v}),e.assign(c,!0),e.if((0,Se._)`${g} > 1`,()=>(d()?p:m)(g,v))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function p(g,v){let $=e.name("item"),x=(0,yf.checkDataTypes)(u,$,s.opts.strictNumbers,yf.DataType.Wrong),j=e.const("indices",(0,Se._)`{}`);e.for((0,Se._)`;${g}--;`,()=>{e.let($,(0,Se._)`${r}[${g}]`),e.if(x,(0,Se._)`continue`),u.length>1&&e.if((0,Se._)`typeof ${$} == "string"`,(0,Se._)`${$} += "_"`),e.if((0,Se._)`typeof ${j}[${$}] == "number"`,()=>{e.assign(v,(0,Se._)`${j}[${$}]`),t.error(),e.assign(c,!1).break()}).code((0,Se._)`${j}[${$}] = ${g}`)})}function m(g,v){let $=(0,sI.useFunc)(e,cI.default),x=e.name("outer");e.label(x).for((0,Se._)`;${g}--;`,()=>e.for((0,Se._)`${v} = ${g}; ${v}--;`,()=>e.if((0,Se._)`${$}(${r}[${g}], ${r}[${v}])`,()=>{t.error(),e.assign(c,!1).break(x)})))}}};$f.default=lI});var f_=S(xf=>{"use strict";Object.defineProperty(xf,"__esModule",{value:!0});var bf=F(),dI=te(),fI=Ba(),pI={message:"must be equal to constant",params:({schemaCode:t})=>(0,bf._)`{allowedValue: ${t}}`},mI={keyword:"const",$data:!0,error:pI,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:i}=t;n||i&&typeof i=="object"?t.fail$data((0,bf._)`!${(0,dI.useFunc)(e,fI.default)}(${r}, ${o})`):t.fail((0,bf._)`${i} !== ${r}`)}};xf.default=mI});var p_=S(kf=>{"use strict";Object.defineProperty(kf,"__esModule",{value:!0});var Bo=F(),hI=te(),gI=Ba(),vI={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Bo._)`{allowedValues: ${t}}`},_I={keyword:"enum",schemaType:"array",$data:!0,error:vI,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:i,it:a}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let s=o.length>=a.opts.loopEnum,c,u=()=>c??(c=(0,hI.useFunc)(e,gI.default)),l;if(s||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let m=e.const("vSchema",i);l=(0,Bo.or)(...o.map((g,v)=>p(m,v)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",i,m=>e.if((0,Bo._)`${u()}(${r}, ${m})`,()=>e.assign(l,!0).break()))}function p(m,g){let v=o[g];return typeof v=="object"&&v!==null?(0,Bo._)`${u()}(${r}, ${m}[${g}])`:(0,Bo._)`${r} === ${v}`}}};kf.default=_I});var m_=S(Sf=>{"use strict";Object.defineProperty(Sf,"__esModule",{value:!0});var yI=t_(),$I=r_(),bI=i_(),xI=a_(),kI=s_(),SI=c_(),wI=u_(),zI=d_(),II=f_(),PI=p_(),EI=[yI.default,$I.default,bI.default,xI.default,kI.default,SI.default,wI.default,zI.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},II.default,PI.default];Sf.default=EI});var zf=S(Xo=>{"use strict";Object.defineProperty(Xo,"__esModule",{value:!0});Xo.validateAdditionalItems=void 0;var br=F(),wf=te(),OI={message:({params:{len:t}})=>(0,br.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,br._)`{limit: ${t}}`},jI={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:OI,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,wf.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}h_(t,n)}};function h_(t,e){let{gen:r,schema:n,data:o,keyword:i,it:a}=t;a.items=!0;let s=r.const("len",(0,br._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,br._)`${s} <= ${e.length}`);else if(typeof n=="object"&&!(0,wf.alwaysValidSchema)(a,n)){let u=r.var("valid",(0,br._)`${s} <= ${e.length}`);r.if((0,br.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,s,l=>{t.subschema({keyword:i,dataProp:l,dataPropType:wf.Type.Num},u),a.allErrors||r.if((0,br.not)(u),()=>r.break())})}}Xo.validateAdditionalItems=h_;Xo.default=jI});var If=S(Yo=>{"use strict";Object.defineProperty(Yo,"__esModule",{value:!0});Yo.validateTuple=void 0;var g_=F(),Xa=te(),TI=tt(),NI={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return v_(t,"additionalItems",e);r.items=!0,!(0,Xa.alwaysValidSchema)(r,e)&&t.ok((0,TI.validateArray)(t))}};function v_(t,e,r=t.schema){let{gen:n,parentSchema:o,data:i,keyword:a,it:s}=t;l(o),s.opts.unevaluated&&r.length&&s.items!==!0&&(s.items=Xa.mergeEvaluated.items(n,r.length,s.items));let c=n.name("valid"),u=n.const("len",(0,g_._)`${i}.length`);r.forEach((d,p)=>{(0,Xa.alwaysValidSchema)(s,d)||(n.if((0,g_._)`${u} > ${p}`,()=>t.subschema({keyword:a,schemaProp:p,dataProp:p},c)),t.ok(c))});function l(d){let{opts:p,errSchemaPath:m}=s,g=r.length,v=g===d.minItems&&(g===d.maxItems||d[e]===!1);if(p.strictTuples&&!v){let $=`"${a}" is ${g}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,Xa.checkStrictMode)(s,$,p.strictTuples)}}}Yo.validateTuple=v_;Yo.default=NI});var __=S(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});var RI=If(),DI={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,RI.validateTuple)(t,"items")};Pf.default=DI});var $_=S(Ef=>{"use strict";Object.defineProperty(Ef,"__esModule",{value:!0});var y_=F(),AI=te(),ZI=tt(),UI=zf(),CI={message:({params:{len:t}})=>(0,y_.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,y_._)`{limit: ${t}}`},MI={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:CI,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,AI.alwaysValidSchema)(n,e)&&(o?(0,UI.validateAdditionalItems)(t,o):t.ok((0,ZI.validateArray)(t)))}};Ef.default=MI});var b_=S(Of=>{"use strict";Object.defineProperty(Of,"__esModule",{value:!0});var nt=F(),Ya=te(),LI={message:({params:{min:t,max:e}})=>e===void 0?(0,nt.str)`must contain at least ${t} valid item(s)`:(0,nt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,nt._)`{minContains: ${t}}`:(0,nt._)`{minContains: ${t}, maxContains: ${e}}`},qI={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:LI,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t,a,s,{minContains:c,maxContains:u}=n;i.opts.next?(a=c===void 0?1:c,s=u):a=1;let l=e.const("len",(0,nt._)`${o}.length`);if(t.setParams({min:a,max:s}),s===void 0&&a===0){(0,Ya.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,Ya.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Ya.alwaysValidSchema)(i,r)){let v=(0,nt._)`${l} >= ${a}`;s!==void 0&&(v=(0,nt._)`${v} && ${l} <= ${s}`),t.pass(v);return}i.items=!0;let d=e.name("valid");s===void 0&&a===1?m(d,()=>e.if(d,()=>e.break())):a===0?(e.let(d,!0),s!==void 0&&e.if((0,nt._)`${o}.length > 0`,p)):(e.let(d,!1),p()),t.result(d,()=>t.reset());function p(){let v=e.name("_valid"),$=e.let("count",0);m(v,()=>e.if(v,()=>g($)))}function m(v,$){e.forRange("i",0,l,x=>{t.subschema({keyword:"contains",dataProp:x,dataPropType:Ya.Type.Num,compositeRule:!0},v),$()})}function g(v){e.code((0,nt._)`${v}++`),s===void 0?e.if((0,nt._)`${v} >= ${a}`,()=>e.assign(d,!0).break()):(e.if((0,nt._)`${v} > ${s}`,()=>e.assign(d,!1).break()),a===1?e.assign(d,!0):e.if((0,nt._)`${v} >= ${a}`,()=>e.assign(d,!0)))}}};Of.default=qI});var S_=S(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.validateSchemaDeps=yt.validatePropertyDeps=yt.error=void 0;var jf=F(),VI=te(),Qo=tt();yt.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,jf.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,jf._)`{property: ${t},
missingProperty: ${n},
depsCount: ${e},
deps: ${r}}`};var FI={keyword:"dependencies",type:"object",schemaType:"object",error:yt.error,code(t){let[e,r]=JI(t);x_(t,e),k_(t,r)}};function JI({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function x_(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let a in e){let s=e[a];if(s.length===0)continue;let c=(0,Qo.propertyInData)(r,n,a,o.opts.ownProperties);t.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of s)(0,Qo.checkReportMissingProp)(t,u)}):(r.if((0,jf._)`${c} && (${(0,Qo.checkMissingProp)(t,s,i)})`),(0,Qo.reportMissingProp)(t,i),r.else())}}yt.validatePropertyDeps=x_;function k_(t,e=t.schema){let{gen:r,data:n,keyword:o,it:i}=t,a=r.name("valid");for(let s in e)(0,VI.alwaysValidSchema)(i,e[s])||(r.if((0,Qo.propertyInData)(r,n,s,i.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:s},a);t.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),t.ok(a))}yt.validateSchemaDeps=k_;yt.default=FI});var z_=S(Tf=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});var w_=F(),KI=te(),WI={message:"property name must be valid",params:({params:t})=>(0,w_._)`{propertyName: ${t.propertyName}}`},HI={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:WI,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,KI.alwaysValidSchema)(o,r))return;let i=e.name("valid");e.forIn("key",n,a=>{t.setParams({propertyName:a}),t.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),e.if((0,w_.not)(i),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(i)}};Tf.default=HI});var Rf=S(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});var Qa=tt(),lt=F(),GI=Nt(),es=te(),BI={message:"must NOT have additional properties",params:({params:t})=>(0,lt._)`{additionalProperty: ${t.additionalProperty}}`},XI={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:BI,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:i,it:a}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,es.alwaysValidSchema)(a,r))return;let u=(0,Qa.allSchemaProperties)(n.properties),l=(0,Qa.allSchemaProperties)(n.patternProperties);d(),t.ok((0,lt._)`${i} === ${GI.default.errors}`);function d(){e.forIn("key",o,$=>{!u.length&&!l.length?g($):e.if(p($),()=>g($))})}function p($){let x;if(u.length>8){let j=(0,es.schemaRefOrVal)(a,n.properties,"properties");x=(0,Qa.isOwnProperty)(e,j,$)}else u.length?x=(0,lt.or)(...u.map(j=>(0,lt._)`${$} === ${j}`)):x=lt.nil;return l.length&&(x=(0,lt.or)(x,...l.map(j=>(0,lt._)`${(0,Qa.usePattern)(t,j)}.test(${$})`))),(0,lt.not)(x)}function m($){e.code((0,lt._)`delete ${o}[${$}]`)}function g($){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m($);return}if(r===!1){t.setParams({additionalProperty:$}),t.error(),s||e.break();return}if(typeof r=="object"&&!(0,es.alwaysValidSchema)(a,r)){let x=e.name("valid");c.removeAdditional==="failing"?(v($,x,!1),e.if((0,lt.not)(x),()=>{t.reset(),m($)})):(v($,x),s||e.if((0,lt.not)(x),()=>e.break()))}}function v($,x,j){let P={keyword:"additionalProperties",dataProp:$,dataPropType:es.Type.Str};j===!1&&Object.assign(P,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(P,x)}}};Nf.default=XI});var E_=S(Af=>{"use strict";Object.defineProperty(Af,"__esModule",{value:!0});var YI=Co(),I_=tt(),Df=te(),P_=Rf(),QI={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:i}=t;i.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&P_.default.code(new YI.KeywordCxt(i,P_.default,"additionalProperties"));let a=(0,I_.allSchemaProperties)(r);for(let d of a)i.definedProperties.add(d);i.opts.unevaluated&&a.length&&i.props!==!0&&(i.props=Df.mergeEvaluated.props(e,(0,Df.toHash)(a),i.props));let s=a.filter(d=>!(0,Df.alwaysValidSchema)(i,r[d]));if(s.length===0)return;let c=e.name("valid");for(let d of s)u(d)?l(d):(e.if((0,I_.propertyInData)(e,o,d,i.opts.ownProperties)),l(d),i.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return i.opts.useDefaults&&!i.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};Af.default=QI});var N_=S(Zf=>{"use strict";Object.defineProperty(Zf,"__esModule",{value:!0});var O_=tt(),ts=F(),j_=te(),T_=te(),eP={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:i}=t,{opts:a}=i,s=(0,O_.allSchemaProperties)(r),c=s.filter(v=>(0,j_.alwaysValidSchema)(i,r[v]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&o.properties,l=e.name("valid");i.props!==!0&&!(i.props instanceof ts.Name)&&(i.props=(0,T_.evaluatedPropsToName)(e,i.props));let{props:d}=i;p();function p(){for(let v of s)u&&m(v),i.allErrors?g(v):(e.var(l,!0),g(v),e.if(l))}function m(v){for(let $ in u)new RegExp(v).test($)&&(0,j_.checkStrictMode)(i,`property ${$} matches pattern ${v} (use allowMatchingProperties)`)}function g(v){e.forIn("key",n,$=>{e.if((0,ts._)`${(0,O_.usePattern)(t,v)}.test(${$})`,()=>{let x=c.includes(v);x||t.subschema({keyword:"patternProperties",schemaProp:v,dataProp:$,dataPropType:T_.Type.Str},l),i.opts.unevaluated&&d!==!0?e.assign((0,ts._)`${d}[${$}]`,!0):!x&&!i.allErrors&&e.if((0,ts.not)(l),()=>e.break())})})}}};Zf.default=eP});var R_=S(Uf=>{"use strict";Object.defineProperty(Uf,"__esModule",{value:!0});var tP=te(),rP={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,tP.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Uf.default=rP});var D_=S(Cf=>{"use strict";Object.defineProperty(Cf,"__esModule",{value:!0});var nP=tt(),oP={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:nP.validateUnion,error:{message:"must match a schema in anyOf"}};Cf.default=oP});var A_=S(Mf=>{"use strict";Object.defineProperty(Mf,"__esModule",{value:!0});var rs=F(),iP=te(),aP={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,rs._)`{passingSchemas: ${t.passing}}`},sP={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:aP,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let i=r,a=e.let("valid",!1),s=e.let("passing",null),c=e.name("_valid");t.setParams({passing:s}),e.block(u),t.result(a,()=>t.reset(),()=>t.error(!0));function u(){i.forEach((l,d)=>{let p;(0,iP.alwaysValidSchema)(o,l)?e.var(c,!0):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,rs._)`${c} && ${a}`).assign(a,!1).assign(s,(0,rs._)`[${s}, ${d}]`).else(),e.if(c,()=>{e.assign(a,!0),e.assign(s,d),p&&t.mergeEvaluated(p,rs.Name)})})}}};Mf.default=sP});var Z_=S(Lf=>{"use strict";Object.defineProperty(Lf,"__esModule",{value:!0});var cP=te(),uP={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((i,a)=>{if((0,cP.alwaysValidSchema)(n,i))return;let s=t.subschema({keyword:"allOf",schemaProp:a},o);t.ok(o),t.mergeEvaluated(s)})}};Lf.default=uP});var M_=S(qf=>{"use strict";Object.defineProperty(qf,"__esModule",{value:!0});var ns=F(),C_=te(),lP={message:({params:t})=>(0,ns.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,ns._)`{failingKeyword: ${t.ifClause}}`},dP={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:lP,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,C_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=U_(n,"then"),i=U_(n,"else");if(!o&&!i)return;let a=e.let("valid",!0),s=e.name("_valid");if(c(),t.reset(),o&&i){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(s,u("then",l),u("else",l))}else o?e.if(s,u("then")):e.if((0,ns.not)(s),u("else"));t.pass(a,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);t.mergeEvaluated(l)}function u(l,d){return()=>{let p=t.subschema({keyword:l},s);e.assign(a,s),t.mergeValidEvaluated(p,a),d?e.assign(d,(0,ns._)`${l}`):t.setParams({ifClause:l})}}}};function U_(t,e){let r=t.schema[e];return r!==void 0&&!(0,C_.alwaysValidSchema)(t,r)}qf.default=dP});var L_=S(Vf=>{"use strict";Object.defineProperty(Vf,"__esModule",{value:!0});var fP=te(),pP={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,fP.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Vf.default=pP});var q_=S(Ff=>{"use strict";Object.defineProperty(Ff,"__esModule",{value:!0});var mP=zf(),hP=__(),gP=If(),vP=$_(),_P=b_(),yP=S_(),$P=z_(),bP=Rf(),xP=E_(),kP=N_(),SP=R_(),wP=D_(),zP=A_(),IP=Z_(),PP=M_(),EP=L_();function OP(t=!1){let e=[SP.default,wP.default,zP.default,IP.default,PP.default,EP.default,$P.default,bP.default,yP.default,xP.default,kP.default];return t?e.push(hP.default,vP.default):e.push(mP.default,gP.default),e.push(_P.default),e}Ff.default=OP});var V_=S(Jf=>{"use strict";Object.defineProperty(Jf,"__esModule",{value:!0});var ge=F(),jP={message:({schemaCode:t})=>(0,ge.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ge._)`{format: ${t}}`},TP={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:jP,code(t,e){let{gen:r,data:n,$data:o,schema:i,schemaCode:a,it:s}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=s;if(!c.validateFormats)return;o?p():m();function p(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),v=r.const("fDef",(0,ge._)`${g}[${a}]`),$=r.let("fType"),x=r.let("format");r.if((0,ge._)`typeof ${v} == "object" && !(${v} instanceof RegExp)`,()=>r.assign($,(0,ge._)`${v}.type || "string"`).assign(x,(0,ge._)`${v}.validate`),()=>r.assign($,(0,ge._)`"string"`).assign(x,v)),t.fail$data((0,ge.or)(j(),P()));function j(){return c.strictSchema===!1?ge.nil:(0,ge._)`${a} && !${x}`}function P(){let C=l.$async?(0,ge._)`(${v}.async ? await ${x}(${n}) : ${x}(${n}))`:(0,ge._)`${x}(${n})`,N=(0,ge._)`(typeof ${x} == "function" ? ${C} : ${x}.test(${n}))`;return(0,ge._)`${x} && ${x} !== true && ${$} === ${e} && !${N}`}}function m(){let g=d.formats[i];if(!g){j();return}if(g===!0)return;let[v,$,x]=P(g);v===e&&t.pass(C());function j(){if(c.strictSchema===!1){d.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function P(N){let ft=N instanceof RegExp?(0,ge.regexpCode)(N):c.code.formats?(0,ge._)`${c.code.formats}${(0,ge.getProperty)(i)}`:void 0,xt=r.scopeValue("formats",{key:i,ref:N,code:ft});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,ge._)`${xt}.validate`]:["string",N,xt]}function C(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ge._)`await ${x}(${n})`}return typeof $=="function"?(0,ge._)`${x}(${n})`:(0,ge._)`${x}.test(${n})`}}}};Jf.default=TP});var F_=S(Kf=>{"use strict";Object.defineProperty(Kf,"__esModule",{value:!0});var NP=V_(),RP=[NP.default];Kf.default=RP});var J_=S(an=>{"use strict";Object.defineProperty(an,"__esModule",{value:!0});an.contentVocabulary=an.metadataVocabulary=void 0;an.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];an.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var W_=S(Wf=>{"use strict";Object.defineProperty(Wf,"__esModule",{value:!0});var DP=e_(),AP=m_(),ZP=q_(),UP=F_(),K_=J_(),CP=[DP.default,AP.default,(0,ZP.default)(),UP.default,K_.metadataVocabulary,K_.contentVocabulary];Wf.default=CP});var G_=S(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.DiscrError=void 0;var H_;(function(t){t.Tag="tag",t.Mapping="mapping"})(H_||(os.DiscrError=H_={}))});var X_=S(Gf=>{"use strict";Object.defineProperty(Gf,"__esModule",{value:!0});var sn=F(),Hf=G_(),B_=Ca(),MP=Mo(),LP=te(),qP={message:({params:{discrError:t,tagName:e}})=>t===Hf.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,sn._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},VP={keyword:"discriminator",type:"object",schemaType:"object",error:qP,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:i}=t,{oneOf:a}=o;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let s=n.propertyName;if(typeof s!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!a)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,sn._)`${r}${(0,sn.getProperty)(s)}`);e.if((0,sn._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Hf.DiscrError.Tag,tag:u,tagName:s})),t.ok(c);function l(){let m=p();e.if(!1);for(let g in m)e.elseIf((0,sn._)`${u} === ${g}`),e.assign(c,d(m[g]));e.else(),t.error(!1,{discrError:Hf.DiscrError.Mapping,tag:u,tagName:s}),e.endIf()}function d(m){let g=e.name("valid"),v=t.subschema({keyword:"oneOf",schemaProp:m},g);return t.mergeEvaluated(v,sn.Name),g}function p(){var m;let g={},v=x(o),$=!0;for(let C=0;C<a.length;C++){let N=a[C];if(N?.$ref&&!(0,LP.schemaHasRulesButRef)(N,i.self.RULES)){let xt=N.$ref;if(N=B_.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,xt),N instanceof B_.SchemaEnv&&(N=N.schema),N===void 0)throw new MP.default(i.opts.uriResolver,i.baseId,xt)}let ft=(m=N?.properties)===null||m===void 0?void 0:m[s];if(typeof ft!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);$=$&&(v||x(N)),j(ft,C)}if(!$)throw new Error(`discriminator: "${s}" must be required`);return g;function x({required:C}){return Array.isArray(C)&&C.includes(s)}function j(C,N){if(C.const)P(C.const,N);else if(C.enum)for(let ft of C.enum)P(ft,N);else throw new Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function P(C,N){if(typeof C!="string"||C in g)throw new Error(`discriminator: "${s}" values must be unique strings`);g[C]=N}}}};Gf.default=VP});var Y_=S((HZ,FP)=>{FP.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 Xf=S((me,Bf)=>{"use strict";Object.defineProperty(me,"__esModule",{value:!0});me.MissingRefError=me.ValidationError=me.CodeGen=me.Name=me.nil=me.stringify=me.str=me._=me.KeywordCxt=me.Ajv=void 0;var JP=Hv(),KP=W_(),WP=X_(),Q_=Y_(),HP=["/properties"],is="http://json-schema.org/draft-07/schema",cn=class extends JP.default{_addVocabularies(){super._addVocabularies(),KP.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(WP.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Q_,HP):Q_;this.addMetaSchema(e,is,!1),this.refs["http://json-schema.org/schema"]=is}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(is)?is:void 0)}};me.Ajv=cn;Bf.exports=me=cn;Bf.exports.Ajv=cn;Object.defineProperty(me,"__esModule",{value:!0});me.default=cn;var GP=Co();Object.defineProperty(me,"KeywordCxt",{enumerable:!0,get:function(){return GP.KeywordCxt}});var un=F();Object.defineProperty(me,"_",{enumerable:!0,get:function(){return un._}});Object.defineProperty(me,"str",{enumerable:!0,get:function(){return un.str}});Object.defineProperty(me,"stringify",{enumerable:!0,get:function(){return un.stringify}});Object.defineProperty(me,"nil",{enumerable:!0,get:function(){return un.nil}});Object.defineProperty(me,"Name",{enumerable:!0,get:function(){return un.Name}});Object.defineProperty(me,"CodeGen",{enumerable:!0,get:function(){return un.CodeGen}});var BP=Za();Object.defineProperty(me,"ValidationError",{enumerable:!0,get:function(){return BP.default}});var XP=Mo();Object.defineProperty(me,"MissingRefError",{enumerable:!0,get:function(){return XP.default}})});var sy=S(bt=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.formatNames=bt.fastFormats=bt.fullFormats=void 0;function $t(t,e){return{validate:t,compare:e}}bt.fullFormats={date:$t(ny,tp),time:$t(Qf(!0),rp),"date-time":$t(ey(!0),iy),"iso-time":$t(Qf(),oy),"iso-date-time":$t(ey(),ay),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:nE,"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:lE,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:oE,int32:{type:"number",validate:sE},int64:{type:"number",validate:cE},float:{type:"number",validate:ry},double:{type:"number",validate:ry},password:!0,binary:!0};bt.fastFormats={...bt.fullFormats,date:$t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,tp),time:$t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,rp),"date-time":$t(/^\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,iy),"iso-time":$t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,oy),"iso-date-time":$t(/^\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,ay),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};bt.formatNames=Object.keys(bt.fullFormats);function YP(t){return t%4===0&&(t%100!==0||t%400===0)}var QP=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,eE=[0,31,28,31,30,31,30,31,31,30,31,30,31];function ny(t){let e=QP.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&YP(r)?29:eE[n])}function tp(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Yf=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Qf(t){return function(r){let n=Yf.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||t&&!s)return!1;if(o<=23&&i<=59&&a<60)return!0;let d=i-l*c,p=o-u*c-(d<0?1:0);return(p===23||p===-1)&&(d===59||d===-1)&&a<61}}function rp(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function oy(t,e){if(!(t&&e))return;let r=Yf.exec(t),n=Yf.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var ep=/t|\s/i;function ey(t){let e=Qf(t);return function(n){let o=n.split(ep);return o.length===2&&ny(o[0])&&e(o[1])}}function iy(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function ay(t,e){if(!(t&&e))return;let[r,n]=t.split(ep),[o,i]=e.split(ep),a=tp(r,o);if(a!==void 0)return a||rp(n,i)}var tE=/\/|:/,rE=/^(?:[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 nE(t){return tE.test(t)&&rE.test(t)}var ty=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function oE(t){return ty.lastIndex=0,ty.test(t)}var iE=-(2**31),aE=2**31-1;function sE(t){return Number.isInteger(t)&&t<=aE&&t>=iE}function cE(t){return Number.isInteger(t)}function ry(){return!0}var uE=/[^\\]\\Z/;function lE(t){if(uE.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var cy=S(ln=>{"use strict";Object.defineProperty(ln,"__esModule",{value:!0});ln.formatLimitDefinition=void 0;var dE=Xf(),dt=F(),rr=dt.operators,as={formatMaximum:{okStr:"<=",ok:rr.LTE,fail:rr.GT},formatMinimum:{okStr:">=",ok:rr.GTE,fail:rr.LT},formatExclusiveMaximum:{okStr:"<",ok:rr.LT,fail:rr.GTE},formatExclusiveMinimum:{okStr:">",ok:rr.GT,fail:rr.LTE}},fE={message:({keyword:t,schemaCode:e})=>(0,dt.str)`should be ${as[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,dt._)`{comparison: ${as[t].okStr}, limit: ${e}}`};ln.formatLimitDefinition={keyword:Object.keys(as),type:"string",schemaType:"string",$data:!0,error:fE,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:i}=t,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new dE.KeywordCxt(i,s.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:s.formats,code:a.code.formats}),m=e.const("fmt",(0,dt._)`${p}[${c.schemaCode}]`);t.fail$data((0,dt.or)((0,dt._)`typeof ${m} != "object"`,(0,dt._)`${m} instanceof RegExp`,(0,dt._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let p=c.schema,m=s.formats[p];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let g=e.scopeValue("formats",{key:p,ref:m,code:a.code.formats?(0,dt._)`${a.code.formats}${(0,dt.getProperty)(p)}`:void 0});t.fail$data(d(g))}function d(p){return(0,dt._)`${p}.compare(${r}, ${n}) ${as[o].fail} 0`}},dependencies:["format"]};var pE=t=>(t.addKeyword(ln.formatLimitDefinition),t);ln.default=pE});var fy=S((ei,dy)=>{"use strict";Object.defineProperty(ei,"__esModule",{value:!0});var dn=sy(),mE=cy(),np=F(),uy=new np.Name("fullFormats"),hE=new np.Name("fastFormats"),op=(t,e={keywords:!0})=>{if(Array.isArray(e))return ly(t,e,dn.fullFormats,uy),t;let[r,n]=e.mode==="fast"?[dn.fastFormats,hE]:[dn.fullFormats,uy],o=e.formats||dn.formatNames;return ly(t,o,r,n),e.keywords&&(0,mE.default)(t),t};op.get=(t,e="full")=>{let n=(e==="fast"?dn.fastFormats:dn.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function ly(t,e,r,n){var o,i;(o=(i=t.opts.code).formats)!==null&&o!==void 0||(i.formats=(0,np._)`require("ajv-formats/dist/formats").${n}`);for(let a of e)t.addFormat(a,r[a])}dy.exports=ei=op;Object.defineProperty(ei,"__esModule",{value:!0});ei.default=op});var B;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},t.getValidEnumValues=o=>{let i=t.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return t.objectValues(a)},t.objectValues=o=>t.objectKeys(o).map(function(i){return o[i]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},t.find=(o,i)=>{for(let a of o)if(i(a))return a},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(B||(B={}));var mp;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(mp||(mp={}));var w=B.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),kt=t=>{switch(typeof t){case"undefined":return w.undefined;case"string":return w.string;case"number":return Number.isNaN(t)?w.nan:w.number;case"boolean":return w.boolean;case"function":return w.function;case"bigint":return w.bigint;case"symbol":return w.symbol;case"object":return Array.isArray(t)?w.array:t===null?w.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?w.promise:typeof Map<"u"&&t instanceof Map?w.map:typeof Set<"u"&&t instanceof Set?w.set:typeof Date<"u"&&t instanceof Date?w.date:w.object;default:return w.unknown}};var _=B.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 Ve=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let s=n,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(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,B.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r=Object.create(null),n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ve.create=t=>new Ve(t);var Dy=(t,e)=>{let r;switch(t.code){case _.invalid_type:t.received===w.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,B.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${B.joinValues(t.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${B.joinValues(t.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${B.joinValues(t.options)}, received '${t.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 t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:B.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case _.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case _.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case _.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 ${t.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;default:r=e.defaultError,B.assertNever(t)}return{message:r}},Zt=Dy;var Ay=Zt;function gn(){return Ay}var oi=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,i=[...r,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)s=u(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}};function b(t,e){let r=gn(),n=oi({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Zt?void 0:Zt].filter(o=>!!o)});t.common.issues.push(n)}var we=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return R;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return R;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},R=Object.freeze({status:"aborted"}),xr=t=>({status:"dirty",value:t}),je=t=>({status:"valid",value:t}),ys=t=>t.status==="aborted",$s=t=>t.status==="dirty",nr=t=>t.status==="valid",vn=t=>typeof Promise<"u"&&t instanceof Promise;var I;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(I||(I={}));var Ge=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},hp=(t,e)=>{if(nr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ve(t.common.issues);return this._error=r,this._error}}};function M(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{let{message:c}=t;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 J=class{get description(){return this._def.description}_getType(e){return kt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:kt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new we,ctx:{common:e.parent.common,data:e.data,parsedType:kt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(vn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kt(e)},o=this._parseSync({data:e,path:n.path,parent:n});return hp(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return nr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>nr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:kt(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(vn(o)?o:Promise.resolve(o));return hp(n,i)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:_.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(e){return new it({schema:this,typeName:T.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return ot.create(this,this._def)}nullable(){return zt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ct.create(this)}promise(){return or.create(this,this._def)}or(e){return Ir.create([this,e],this._def)}and(e){return Pr.create(this,e,this._def)}transform(e){return new it({...M(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Nr({...M(this._def),innerType:this,defaultValue:r,typeName:T.ZodDefault})}brand(){return new ii({typeName:T.ZodBranded,type:this,...M(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Rr({...M(this._def),innerType:this,catchValue:r,typeName:T.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ai.create(this,e)}readonly(){return Dr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Zy=/^c[^\s-]{8,}$/i,Uy=/^[0-9a-z]+$/,Cy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,My=/^[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,Ly=/^[a-z0-9_-]{21}$/i,qy=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Vy=/^[-+]?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)?)??$/,Fy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Jy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",bs,Ky=/^(?:(?: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])$/,Wy=/^(?:(?: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])$/,Hy=/^(([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]))$/,Gy=/^(([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])$/,By=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,gp="((\\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])))",Yy=new RegExp(`^${gp}$`);function vp(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Qy(t){return new RegExp(`^${vp(t)}$`)}function e$(t){let e=`${gp}T${vp(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function t$(t,e){return!!((e==="v4"||!e)&&Ky.test(t)||(e==="v6"||!e)&&Hy.test(t))}function r$(t,e){if(!qy.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return!1}}function n$(t,e){return!!((e==="v4"||!e)&&Wy.test(t)||(e==="v6"||!e)&&Gy.test(t))}var Sr=class t extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==w.string){let i=this._getOrReturnCtx(e);return b(i,{code:_.invalid_type,expected:w.string,received:i.parsedType}),R}let n=new we,o;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(o=this._getOrReturnCtx(e,o),b(o,{code:_.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(o=this._getOrReturnCtx(e,o),b(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=e.data.length>i.value,s=e.data.length<i.value;(a||s)&&(o=this._getOrReturnCtx(e,o),a?b(o,{code:_.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&b(o,{code:_.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")Fy.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"email",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")bs||(bs=new RegExp(Jy,"u")),bs.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"emoji",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")My.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"uuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Ly.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"nanoid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Zy.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"cuid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Uy.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"cuid2",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Cy.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"ulid",code:_.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),b(o,{validation:"url",code:_.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"regex",code:_.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(e,o),b(o,{code:_.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(o=this._getOrReturnCtx(e,o),b(o,{code:_.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(o=this._getOrReturnCtx(e,o),b(o,{code:_.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?e$(i).test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{code:_.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Yy.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{code:_.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?Qy(i).test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{code:_.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Vy.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"duration",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?t$(e.data,i.version)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"ip",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?r$(e.data,i.alg)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"jwt",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?n$(e.data,i.version)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"cidr",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?By.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"base64",code:_.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Xy.test(e.data)||(o=this._getOrReturnCtx(e,o),b(o,{validation:"base64url",code:_.invalid_string,message:i.message}),n.dirty()):B.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:_.invalid_string,...I.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...I.errToObj(e)})}url(e){return this._addCheck({kind:"url",...I.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...I.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...I.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...I.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...I.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...I.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...I.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...I.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...I.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...I.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...I.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...I.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...I.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...I.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...I.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...I.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...I.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...I.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...I.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...I.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...I.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...I.errToObj(r)})}nonempty(e){return this.min(1,I.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Sr.create=t=>new Sr({checks:[],typeName:T.ZodString,coerce:t?.coerce??!1,...M(t)});function o$(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(t.toFixed(o).replace(".","")),a=Number.parseInt(e.toFixed(o).replace(".",""));return i%a/10**o}var _n=class t extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==w.number){let i=this._getOrReturnCtx(e);return b(i,{code:_.invalid_type,expected:w.number,received:i.parsedType}),R}let n,o=new we;for(let i of this._def.checks)i.kind==="int"?B.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:_.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:_.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:_.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?o$(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),b(n,{code:_.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),b(n,{code:_.not_finite,message:i.message}),o.dirty()):B.assertNever(i);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,I.toString(r))}gt(e,r){return this.setLimit("min",e,!1,I.toString(r))}lte(e,r){return this.setLimit("max",e,!0,I.toString(r))}lt(e,r){return this.setLimit("max",e,!1,I.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:I.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:I.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:I.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:I.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:I.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:I.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&B.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};_n.create=t=>new _n({checks:[],typeName:T.ZodNumber,coerce:t?.coerce||!1,...M(t)});var yn=class t extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==w.bigint)return this._getInvalidInput(e);let n,o=new we;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:_.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),b(n,{code:_.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),b(n,{code:_.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):B.assertNever(i);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return b(r,{code:_.invalid_type,expected:w.bigint,received:r.parsedType}),R}gte(e,r){return this.setLimit("min",e,!0,I.toString(r))}gt(e,r){return this.setLimit("min",e,!1,I.toString(r))}lte(e,r){return this.setLimit("max",e,!0,I.toString(r))}lt(e,r){return this.setLimit("max",e,!1,I.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:I.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:I.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:I.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:I.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:I.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:I.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};yn.create=t=>new yn({checks:[],typeName:T.ZodBigInt,coerce:t?.coerce??!1,...M(t)});var $n=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==w.boolean){let n=this._getOrReturnCtx(e);return b(n,{code:_.invalid_type,expected:w.boolean,received:n.parsedType}),R}return je(e.data)}};$n.create=t=>new $n({typeName:T.ZodBoolean,coerce:t?.coerce||!1,...M(t)});var bn=class t extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==w.date){let i=this._getOrReturnCtx(e);return b(i,{code:_.invalid_type,expected:w.date,received:i.parsedType}),R}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return b(i,{code:_.invalid_date}),R}let n=new we,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(o=this._getOrReturnCtx(e,o),b(o,{code:_.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(o=this._getOrReturnCtx(e,o),b(o,{code:_.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):B.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:I.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:I.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};bn.create=t=>new bn({checks:[],coerce:t?.coerce||!1,typeName:T.ZodDate,...M(t)});var xn=class extends J{_parse(e){if(this._getType(e)!==w.symbol){let n=this._getOrReturnCtx(e);return b(n,{code:_.invalid_type,expected:w.symbol,received:n.parsedType}),R}return je(e.data)}};xn.create=t=>new xn({typeName:T.ZodSymbol,...M(t)});var wr=class extends J{_parse(e){if(this._getType(e)!==w.undefined){let n=this._getOrReturnCtx(e);return b(n,{code:_.invalid_type,expected:w.undefined,received:n.parsedType}),R}return je(e.data)}};wr.create=t=>new wr({typeName:T.ZodUndefined,...M(t)});var zr=class extends J{_parse(e){if(this._getType(e)!==w.null){let n=this._getOrReturnCtx(e);return b(n,{code:_.invalid_type,expected:w.null,received:n.parsedType}),R}return je(e.data)}};zr.create=t=>new zr({typeName:T.ZodNull,...M(t)});var kn=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return je(e.data)}};kn.create=t=>new kn({typeName:T.ZodAny,...M(t)});var Ut=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return je(e.data)}};Ut.create=t=>new Ut({typeName:T.ZodUnknown,...M(t)});var pt=class extends J{_parse(e){let r=this._getOrReturnCtx(e);return b(r,{code:_.invalid_type,expected:w.never,received:r.parsedType}),R}};pt.create=t=>new pt({typeName:T.ZodNever,...M(t)});var Sn=class extends J{_parse(e){if(this._getType(e)!==w.undefined){let n=this._getOrReturnCtx(e);return b(n,{code:_.invalid_type,expected:w.void,received:n.parsedType}),R}return je(e.data)}};Sn.create=t=>new Sn({typeName:T.ZodVoid,...M(t)});var Ct=class t extends J{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==w.array)return b(r,{code:_.invalid_type,expected:w.array,received:r.parsedType}),R;if(o.exactLength!==null){let a=r.data.length>o.exactLength.value,s=r.data.length<o.exactLength.value;(a||s)&&(b(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&&(b(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&&(b(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 Ge(r,a,r.path,s)))).then(a=>we.mergeArray(n,a));let i=[...r.data].map((a,s)=>o.type._parseSync(new Ge(r,a,r.path,s)));return we.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:I.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:I.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:I.toString(r)}})}nonempty(e){return this.min(1,e)}};Ct.create=(t,e)=>new Ct({type:t,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...M(e)});function kr(t){if(t instanceof Fe){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=ot.create(kr(n))}return new Fe({...t._def,shape:()=>e})}else return t instanceof Ct?new Ct({...t._def,type:kr(t.element)}):t instanceof ot?ot.create(kr(t.unwrap())):t instanceof zt?zt.create(kr(t.unwrap())):t instanceof wt?wt.create(t.items.map(e=>kr(e))):t}var Fe=class t extends J{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=B.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==w.object){let u=this._getOrReturnCtx(e);return b(u,{code:_.invalid_type,expected:w.object,received:u.parsedType}),R}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof pt&&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 Ge(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof pt){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&&(b(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 Ge(o,d,o.path,l)),alwaysSet:l in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet})}return u}).then(u=>we.mergeObjectSync(n,u)):we.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return I.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:I.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of B.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of B.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return kr(this)}partial(e){let r={};for(let n of B.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of B.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ot;)i=i._def.innerType;r[n]=i}return new t({...this._def,shape:()=>r})}keyof(){return _p(B.objectKeys(this.shape))}};Fe.create=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strip",catchall:pt.create(),typeName:T.ZodObject,...M(e)});Fe.strictCreate=(t,e)=>new Fe({shape:()=>t,unknownKeys:"strict",catchall:pt.create(),typeName:T.ZodObject,...M(e)});Fe.lazycreate=(t,e)=>new Fe({shape:t,unknownKeys:"strip",catchall:pt.create(),typeName:T.ZodObject,...M(e)});var Ir=class extends J{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new Ve(s.ctx.common.issues));return b(r,{code:_.invalid_union,unionErrors:a}),R}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 Ve(c));return b(r,{code:_.invalid_union,unionErrors:s}),R}}get options(){return this._def.options}};Ir.create=(t,e)=>new Ir({options:t,typeName:T.ZodUnion,...M(e)});var St=t=>t instanceof Er?St(t.schema):t instanceof it?St(t.innerType()):t instanceof Or?[t.value]:t instanceof jr?t.options:t instanceof Tr?B.objectValues(t.enum):t instanceof Nr?St(t._def.innerType):t instanceof wr?[void 0]:t instanceof zr?[null]:t instanceof ot?[void 0,...St(t.unwrap())]:t instanceof zt?[null,...St(t.unwrap())]:t instanceof ii||t instanceof Dr?St(t.unwrap()):t instanceof Rr?St(t._def.innerType):[],xs=class t extends J{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==w.object)return b(r,{code:_.invalid_type,expected:w.object,received:r.parsedType}),R;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}):(b(r,{code:_.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),R)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let i of r){let a=St(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new t({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...M(n)})}};function ks(t,e){let r=kt(t),n=kt(e);if(t===e)return{valid:!0,data:t};if(r===w.object&&n===w.object){let o=B.objectKeys(e),i=B.objectKeys(t).filter(s=>o.indexOf(s)!==-1),a={...t,...e};for(let s of i){let c=ks(t[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===w.array&&n===w.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let i=0;i<t.length;i++){let a=t[i],s=e[i],c=ks(a,s);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===w.date&&n===w.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Pr=class extends J{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(i,a)=>{if(ys(i)||ys(a))return R;let s=ks(i.value,a.value);return s.valid?(($s(i)||$s(a))&&r.dirty(),{status:r.value,value:s.data}):(b(n,{code:_.invalid_intersection_types}),R)};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}))}};Pr.create=(t,e,r)=>new Pr({left:t,right:e,typeName:T.ZodIntersection,...M(r)});var wt=class t extends J{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.array)return b(n,{code:_.invalid_type,expected:w.array,received:n.parsedType}),R;if(n.data.length<this._def.items.length)return b(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),R;!this._def.rest&&n.data.length>this._def.items.length&&(b(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 Ge(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>we.mergeArray(r,a)):we.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};wt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new wt({items:t,typeName:T.ZodTuple,rest:null,...M(e)})};var Ss=class t extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.object)return b(n,{code:_.invalid_type,expected:w.object,received:n.parsedType}),R;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new Ge(n,s,n.path,s)),value:a._parse(new Ge(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?we.mergeObjectAsync(r,o):we.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof J?new t({keyType:e,valueType:r,typeName:T.ZodRecord,...M(n)}):new t({keyType:Sr.create(),valueType:e,typeName:T.ZodRecord,...M(r)})}},wn=class extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.map)return b(n,{code:_.invalid_type,expected:w.map,received:n.parsedType}),R;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],u)=>({key:o._parse(new Ge(n,s,n.path,[u,"key"])),value:i._parse(new Ge(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 R;(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 R;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),s.set(u.value,l.value)}return{status:r.value,value:s}}}};wn.create=(t,e,r)=>new wn({valueType:e,keyType:t,typeName:T.ZodMap,...M(r)});var zn=class t extends J{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==w.set)return b(n,{code:_.invalid_type,expected:w.set,received:n.parsedType}),R;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(b(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&&(b(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 R;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 Ge(n,c,n.path,u)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:I.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:I.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};zn.create=(t,e)=>new zn({valueType:t,minSize:null,maxSize:null,typeName:T.ZodSet,...M(e)});var ws=class t extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==w.function)return b(r,{code:_.invalid_type,expected:w.function,received:r.parsedType}),R;function n(s,c){return oi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,gn(),Zt].filter(u=>!!u),issueData:{code:_.invalid_arguments,argumentsError:c}})}function o(s,c){return oi({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,gn(),Zt].filter(u=>!!u),issueData:{code:_.invalid_return_type,returnTypeError:c}})}let i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof or){let s=this;return je(async function(...c){let u=new Ve([]),l=await s._def.args.parseAsync(c,i).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(a,this,l);return await s._def.returns._def.type.parseAsync(d,i).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let s=this;return je(function(...c){let u=s._def.args.safeParse(c,i);if(!u.success)throw new Ve([n(c,u.error)]);let l=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(l,i);if(!d.success)throw new Ve([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:wt.create(e).rest(Ut.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||wt.create([]).rest(Ut.create()),returns:r||Ut.create(),typeName:T.ZodFunction,...M(n)})}},Er=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Er.create=(t,e)=>new Er({getter:t,typeName:T.ZodLazy,...M(e)});var Or=class extends J{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return b(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),R}return{status:"valid",value:e.data}}get value(){return this._def.value}};Or.create=(t,e)=>new Or({value:t,typeName:T.ZodLiteral,...M(e)});function _p(t,e){return new jr({values:t,typeName:T.ZodEnum,...M(e)})}var jr=class t extends J{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return b(r,{expected:B.joinValues(n),received:r.parsedType,code:_.invalid_type}),R}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return b(r,{received:r.data,code:_.invalid_enum_value,options:n}),R}return je(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};jr.create=_p;var Tr=class extends J{_parse(e){let r=B.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==w.string&&n.parsedType!==w.number){let o=B.objectValues(r);return b(n,{expected:B.joinValues(o),received:n.parsedType,code:_.invalid_type}),R}if(this._cache||(this._cache=new Set(B.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=B.objectValues(r);return b(n,{received:n.data,code:_.invalid_enum_value,options:o}),R}return je(e.data)}get enum(){return this._def.values}};Tr.create=(t,e)=>new Tr({values:t,typeName:T.ZodNativeEnum,...M(e)});var or=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==w.promise&&r.common.async===!1)return b(r,{code:_.invalid_type,expected:w.promise,received:r.parsedType}),R;let n=r.parsedType===w.promise?r.data:Promise.resolve(r.data);return je(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};or.create=(t,e)=>new or({type:t,typeName:T.ZodPromise,...M(e)});var it=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{b(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 R;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?R:c.status==="dirty"?xr(c.value):r.value==="dirty"?xr(c.value):c});{if(r.value==="aborted")return R;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?R:s.status==="dirty"?xr(s.value):r.value==="dirty"?xr(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"?R:(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"?R:(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(!nr(a))return R;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=>nr(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:r.value,value:s})):R);B.assertNever(o)}};it.create=(t,e,r)=>new it({schema:t,typeName:T.ZodEffects,effect:e,...M(r)});it.createWithPreprocess=(t,e,r)=>new it({schema:e,effect:{type:"preprocess",transform:t},typeName:T.ZodEffects,...M(r)});var ot=class extends J{_parse(e){return this._getType(e)===w.undefined?je(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ot.create=(t,e)=>new ot({innerType:t,typeName:T.ZodOptional,...M(e)});var zt=class extends J{_parse(e){return this._getType(e)===w.null?je(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};zt.create=(t,e)=>new zt({innerType:t,typeName:T.ZodNullable,...M(e)});var Nr=class extends J{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===w.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Nr.create=(t,e)=>new Nr({innerType:t,typeName:T.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...M(e)});var Rr=class extends J{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return vn(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Ve(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ve(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Rr.create=(t,e)=>new Rr({innerType:t,typeName:T.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...M(e)});var In=class extends J{_parse(e){if(this._getType(e)!==w.nan){let n=this._getOrReturnCtx(e);return b(n,{code:_.invalid_type,expected:w.nan,received:n.parsedType}),R}return{status:"valid",value:e.data}}};In.create=t=>new In({typeName:T.ZodNaN,...M(t)});var LE=Symbol("zod_brand"),ii=class extends J{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},ai=class t extends J{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?R:i.status==="dirty"?(r.dirty(),xr(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"?R:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:T.ZodPipeline})}},Dr=class extends J{_parse(e){let r=this._def.innerType._parse(e),n=o=>(nr(o)&&(o.value=Object.freeze(o.value)),o);return vn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Dr.create=(t,e)=>new Dr({innerType:t,typeName:T.ZodReadonly,...M(e)});var qE={object:Fe.lazycreate},T;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(T||(T={}));var VE=Sr.create,FE=_n.create,JE=In.create,KE=yn.create,WE=$n.create,HE=bn.create,GE=xn.create,BE=wr.create,XE=zr.create,YE=kn.create,QE=Ut.create,eO=pt.create,tO=Sn.create,rO=Ct.create,i$=Fe.create,nO=Fe.strictCreate,oO=Ir.create,iO=xs.create,aO=Pr.create,sO=wt.create,cO=Ss.create,uO=wn.create,lO=zn.create,dO=ws.create,fO=Er.create,pO=Or.create,mO=jr.create,hO=Tr.create,gO=or.create,vO=it.create,_O=ot.create,yO=zt.create,$O=it.createWithPreprocess,bO=ai.create;var yp=Object.freeze({status:"aborted"});function f(t,e,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(t))return;s._zod.traits.add(t),e(s,c);let u=a.prototype,l=Object.keys(u);for(let d=0;d<l.length;d++){let p=l[d];p in s||(s[p]=u[p].bind(s))}}let o=r?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:t});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(t)}),Object.defineProperty(a,"name",{value:t}),a}var zs=Symbol("zod_brand"),mt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ir=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},si={};function _e(t){return t&&Object.assign(si,t),si}var y={};hn(y,{BIGINT_FORMAT_RANGES:()=>Ds,Class:()=>Ps,NUMBER_FORMAT_RANGES:()=>Rs,aborted:()=>Ft,allowsEval:()=>js,assert:()=>f$,assertEqual:()=>c$,assertIs:()=>l$,assertNever:()=>d$,assertNotEqual:()=>u$,assignProp:()=>Lt,base64ToUint8Array:()=>xp,base64urlToUint8Array:()=>E$,cached:()=>Zr,captureStackTrace:()=>ui,cleanEnum:()=>P$,cleanRegex:()=>On,clone:()=>Te,cloneDef:()=>m$,createTransparentProxy:()=>$$,defineLazy:()=>G,esc:()=>ci,escapeRegex:()=>Be,extend:()=>k$,finalizeIssue:()=>Ze,floatSafeRemainder:()=>Es,getElementAtPath:()=>h$,getEnumValues:()=>En,getLengthableOrigin:()=>Nn,getParsedType:()=>y$,getSizableOrigin:()=>Tn,hexToUint8Array:()=>j$,isObject:()=>ar,isPlainObject:()=>Vt,issue:()=>Ur,joinValues:()=>D,jsonStringifyReplacer:()=>Ar,merge:()=>w$,mergeDefs:()=>qt,normalizeParams:()=>k,nullish:()=>Mt,numKeys:()=>_$,objectClone:()=>p$,omit:()=>x$,optionalKeys:()=>Ns,partial:()=>z$,pick:()=>b$,prefixIssues:()=>Je,primitiveTypes:()=>Ts,promiseAllObject:()=>g$,propertyKeyTypes:()=>jn,randomString:()=>v$,required:()=>I$,safeExtend:()=>S$,shallowClone:()=>bp,slugify:()=>Os,stringifyPrimitive:()=>A,uint8ArrayToBase64:()=>kp,uint8ArrayToBase64url:()=>O$,uint8ArrayToHex:()=>T$,unwrapMessage:()=>Pn});function c$(t){return t}function u$(t){return t}function l$(t){}function d$(t){throw new Error("Unexpected value in exhaustive check")}function f$(t){}function En(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function D(t,e="|"){return t.map(r=>A(r)).join(e)}function Ar(t,e){return typeof e=="bigint"?e.toString():e}function Zr(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Mt(t){return t==null}function On(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function Es(t,e){let r=(t.toString().split(".")[1]||"").length,n=e.toString(),o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){let c=n.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}let i=r>o?r:o,a=Number.parseInt(t.toFixed(i).replace(".","")),s=Number.parseInt(e.toFixed(i).replace(".",""));return a%s/10**i}var $p=Symbol("evaluating");function G(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==$p)return n===void 0&&(n=$p,n=r()),n},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function p$(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Lt(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function qt(...t){let e={};for(let r of t){let n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function m$(t){return qt(t._zod.def)}function h$(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function g$(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<e.length;i++)o[e[i]]=n[i];return o})}function v$(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function ci(t){return JSON.stringify(t)}function Os(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ui="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function ar(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var js=Zr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Vt(t){if(ar(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(ar(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function bp(t){return Vt(t)?{...t}:Array.isArray(t)?[...t]:t}function _$(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var y$=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},jn=new Set(["string","number","symbol"]),Ts=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Be(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Te(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function k(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function $$(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,i){return e??(e=t()),Reflect.set(e,n,o,i)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function A(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Ns(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var Rs={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]},Ds={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function b$(t,e){let r=t._zod.def,n=qt(t._zod.def,{get shape(){let o={};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&(o[i]=r.shape[i])}return Lt(this,"shape",o),o},checks:[]});return Te(t,n)}function x$(t,e){let r=t._zod.def,n=qt(t._zod.def,{get shape(){let o={...t._zod.def.shape};for(let i in e){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);e[i]&&delete o[i]}return Lt(this,"shape",o),o},checks:[]});return Te(t,n)}function k$(t,e){if(!Vt(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let o=qt(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Lt(this,"shape",i),i},checks:[]});return Te(t,o)}function S$(t,e){if(!Vt(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return Lt(this,"shape",n),n},checks:t._zod.def.checks};return Te(t,r)}function w$(t,e){let r=qt(t._zod.def,{get shape(){let n={...t._zod.def.shape,...e._zod.def.shape};return Lt(this,"shape",n),n},get catchall(){return e._zod.def.catchall},checks:[]});return Te(t,r)}function z$(t,e,r){let n=qt(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=t?new t({type:"optional",innerType:o[a]}):o[a])}else for(let a in o)i[a]=t?new t({type:"optional",innerType:o[a]}):o[a];return Lt(this,"shape",i),i},checks:[]});return Te(e,n)}function I$(t,e,r){let n=qt(e._zod.def,{get shape(){let o=e._zod.def.shape,i={...o};if(r)for(let a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(let a in o)i[a]=new t({type:"nonoptional",innerType:o[a]});return Lt(this,"shape",i),i},checks:[]});return Te(e,n)}function Ft(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function Je(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Pn(t){return typeof t=="string"?t:t?.message}function Ze(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Pn(t.inst?._zod.def?.error?.(t))??Pn(e?.error?.(t))??Pn(r.customError?.(t))??Pn(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function Tn(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Nn(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Ur(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function P$(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function xp(t){let e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r}function kp(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function E$(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return xp(e+r)}function O$(t){return kp(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function j$(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)r[n/2]=Number.parseInt(e.slice(n,n+2),16);return r}function T$(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var Ps=class{constructor(...e){}};var Sp=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Ar,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},li=f("$ZodError",Sp),Rn=f("$ZodError",Sp,{Parent:Error});function di(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:r}}function fi(t,e=r=>r.message){let r={_errors:[]},n=o=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>n({issues:a}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let a=r,s=0;for(;s<i.path.length;){let c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(e(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return n(t),r}var Dn=t=>(e,r,n,o)=>{let i=n?Object.assign(n,{async:!1}):{async:!1},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new mt;if(a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>Ze(c,i,_e())));throw ui(s,o?.callee),s}return a.value},An=Dn(Rn),Zn=t=>async(e,r,n,o)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},a=e._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){let s=new(o?.Err??t)(a.issues.map(c=>Ze(c,i,_e())));throw ui(s,o?.callee),s}return a.value},Un=Zn(Rn),Cn=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=e._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new mt;return i.issues.length?{success:!1,error:new(t??li)(i.issues.map(a=>Ze(a,o,_e())))}:{success:!0,data:i.value}},Cr=Cn(Rn),Mn=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new t(i.issues.map(a=>Ze(a,o,_e())))}:{success:!0,data:i.value}},Ln=Mn(Rn),wp=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Dn(t)(e,r,o)};var zp=t=>(e,r,n)=>Dn(t)(e,r,n);var Ip=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Zn(t)(e,r,o)};var Pp=t=>async(e,r,n)=>Zn(t)(e,r,n);var Ep=t=>(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Cn(t)(e,r,o)};var Op=t=>(e,r,n)=>Cn(t)(e,r,n);var jp=t=>async(e,r,n)=>{let o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Mn(t)(e,r,o)};var Tp=t=>async(e,r,n)=>Mn(t)(e,r,n);var Xe={};hn(Xe,{base64:()=>Xs,base64url:()=>pi,bigint:()=>nc,boolean:()=>ac,browserEmail:()=>L$,cidrv4:()=>Gs,cidrv6:()=>Bs,cuid:()=>As,cuid2:()=>Zs,date:()=>Qs,datetime:()=>tc,domain:()=>F$,duration:()=>qs,e164:()=>Ys,email:()=>Fs,emoji:()=>Js,extendedDuration:()=>R$,guid:()=>Vs,hex:()=>J$,hostname:()=>V$,html5Email:()=>U$,idnEmail:()=>M$,integer:()=>oc,ipv4:()=>Ks,ipv6:()=>Ws,ksuid:()=>Ms,lowercase:()=>uc,mac:()=>Hs,md5_base64:()=>W$,md5_base64url:()=>H$,md5_hex:()=>K$,nanoid:()=>Ls,null:()=>sc,number:()=>ic,rfc5322Email:()=>C$,sha1_base64:()=>B$,sha1_base64url:()=>X$,sha1_hex:()=>G$,sha256_base64:()=>Q$,sha256_base64url:()=>eb,sha256_hex:()=>Y$,sha384_base64:()=>rb,sha384_base64url:()=>nb,sha384_hex:()=>tb,sha512_base64:()=>ib,sha512_base64url:()=>ab,sha512_hex:()=>ob,string:()=>rc,time:()=>ec,ulid:()=>Us,undefined:()=>cc,unicodeEmail:()=>Np,uppercase:()=>lc,uuid:()=>sr,uuid4:()=>D$,uuid6:()=>A$,uuid7:()=>Z$,xid:()=>Cs});var As=/^[cC][^\s-]{8,}$/,Zs=/^[0-9a-z]+$/,Us=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Cs=/^[0-9a-vA-V]{20}$/,Ms=/^[A-Za-z0-9]{27}$/,Ls=/^[a-zA-Z0-9_-]{21}$/,qs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,R$=/^[-+]?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)?)??$/,Vs=/^([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})$/,sr=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,D$=sr(4),A$=sr(6),Z$=sr(7),Fs=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,U$=/^[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])?)*$/,C$=/^(([^<>()\[\]\\.,;:\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,}))$/,Np=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,M$=Np,L$=/^[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])?)*$/,q$="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Js(){return new RegExp(q$,"u")}var Ks=/^(?:(?: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])$/,Ws=/^(([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}|:))$/,Hs=t=>{let e=Be(t??":");return new RegExp(`^(?:[0-9A-F]{2}${e}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${e}){5}[0-9a-f]{2}$`)},Gs=/^((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])$/,Bs=/^(([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])$/,Xs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pi=/^[A-Za-z0-9_-]*$/,V$=/^(?=.{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])?)*\.?$/,F$=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ys=/^\+(?:[0-9]){6,14}[0-9]$/,Rp="(?:(?:\\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])))",Qs=new RegExp(`^${Rp}$`);function Dp(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ec(t){return new RegExp(`^${Dp(t)}$`)}function tc(t){let e=Dp({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Rp}T(?:${n})$`)}var rc=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},nc=/^-?\d+n?$/,oc=/^-?\d+$/,ic=/^-?\d+(?:\.\d+)?/,ac=/^(?:true|false)$/i,sc=/^null$/i;var cc=/^undefined$/i;var uc=/^[^A-Z]*$/,lc=/^[^a-z]*$/,J$=/^[0-9a-fA-F]*$/;function qn(t,e){return new RegExp(`^[A-Za-z0-9+/]{${t}}${e}$`)}function Vn(t){return new RegExp(`^[A-Za-z0-9_-]{${t}}$`)}var K$=/^[0-9a-fA-F]{32}$/,W$=qn(22,"=="),H$=Vn(22),G$=/^[0-9a-fA-F]{40}$/,B$=qn(27,"="),X$=Vn(27),Y$=/^[0-9a-fA-F]{64}$/,Q$=qn(43,"="),eb=Vn(43),tb=/^[0-9a-fA-F]{96}$/,rb=qn(64,""),nb=Vn(64),ob=/^[0-9a-fA-F]{128}$/,ib=qn(86,"=="),ab=Vn(86);var ae=f("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Zp={number:"number",bigint:"bigint",object:"date"},dc=f("$ZodCheckLessThan",(t,e)=>{ae.init(t,e);let r=Zp[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<i&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),fc=f("$ZodCheckGreaterThan",(t,e)=>{ae.init(t,e);let r=Zp[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,i=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>i&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Up=f("$ZodCheckMultipleOf",(t,e)=>{ae.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):Es(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),Cp=f("$ZodCheckNumberFormat",(t,e)=>{ae.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,i]=Rs[e.format];t._zod.onattach.push(a=>{let s=a._zod.bag;s.format=e.format,s.minimum=o,s.maximum=i,r&&(s.pattern=oc)}),t._zod.check=a=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:s,inst:t});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}s<o&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inst:t})}}),Mp=f("$ZodCheckBigIntFormat",(t,e)=>{ae.init(t,e);let[r,n]=Ds[e.format];t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,i.minimum=r,i.maximum=n}),t._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:t,continue:!e.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inst:t})}}),Lp=f("$ZodCheckMaxSize",(t,e)=>{var r;ae.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Mt(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;o.size<=e.maximum||n.issues.push({origin:Tn(o),code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),qp=f("$ZodCheckMinSize",(t,e)=>{var r;ae.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Mt(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;o.size>=e.minimum||n.issues.push({origin:Tn(o),code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Vp=f("$ZodCheckSizeEquals",(t,e)=>{var r;ae.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Mt(o)&&o.size!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.size,o.maximum=e.size,o.size=e.size}),t._zod.check=n=>{let o=n.value,i=o.size;if(i===e.size)return;let a=i>e.size;n.issues.push({origin:Tn(o),...a?{code:"too_big",maximum:e.size}:{code:"too_small",minimum:e.size},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Fp=f("$ZodCheckMaxLength",(t,e)=>{var r;ae.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Mt(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let a=Nn(o);n.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Jp=f("$ZodCheckMinLength",(t,e)=>{var r;ae.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Mt(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let a=Nn(o);n.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Kp=f("$ZodCheckLengthEquals",(t,e)=>{var r;ae.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Mt(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=n=>{let o=n.value,i=o.length;if(i===e.length)return;let a=Nn(o),s=i>e.length;n.issues.push({origin:a,...s?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Fn=f("$ZodCheckStringFormat",(t,e)=>{var r,n;ae.init(t,e),t._zod.onattach.push(o=>{let i=o._zod.bag;i.format=e.format,e.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),Wp=f("$ZodCheckRegex",(t,e)=>{Fn.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Hp=f("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=uc),Fn.init(t,e)}),Gp=f("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=lc),Fn.init(t,e)}),Bp=f("$ZodCheckIncludes",(t,e)=>{ae.init(t,e);let r=Be(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(n)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),Xp=f("$ZodCheckStartsWith",(t,e)=>{ae.init(t,e);let r=new RegExp(`^${Be(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),Yp=f("$ZodCheckEndsWith",(t,e)=>{ae.init(t,e);let r=new RegExp(`.*${Be(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}});function Ap(t,e,r){t.issues.length&&e.issues.push(...Je(r,t.issues))}var Qp=f("$ZodCheckProperty",(t,e)=>{ae.init(t,e),t._zod.check=r=>{let n=e.schema._zod.run({value:r.value[e.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>Ap(o,r,e.property));Ap(n,r,e.property)}}),em=f("$ZodCheckMimeType",(t,e)=>{ae.init(t,e);let r=new Set(e.mime);t._zod.onattach.push(n=>{n._zod.bag.mime=e.mime}),t._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:e.mime,input:n.value.type,inst:t,continue:!e.abort})}}),tm=f("$ZodCheckOverwrite",(t,e)=>{ae.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var mi=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
`).filter(a=>a),o=Math.min(...n.map(a=>a.length-a.trimStart().length)),i=n.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(let a of i)this.content.push(a)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new e(...r,o.join(`
`))}};var nm={major:4,minor:2,patch:1};var U=f("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=nm;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let i of o._zod.onattach)i(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(a,s,c)=>{let u=Ft(a),l;for(let d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(u)continue;let p=a.issues.length,m=d._zod.check(a);if(m instanceof Promise&&c?.async===!1)throw new mt;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await m,a.issues.length!==p&&(u||(u=Ft(a,p)))});else{if(a.issues.length===p)continue;u||(u=Ft(a,p))}}return l?l.then(()=>a):a},i=(a,s,c)=>{if(Ft(a))return a.aborted=!0,a;let u=o(s,n,c);if(u instanceof Promise){if(c.async===!1)throw new mt;return u.then(l=>t._zod.parse(l,c))}return t._zod.parse(u,c)};t._zod.run=(a,s)=>{if(s.skipChecks)return t._zod.parse(a,s);if(s.direction==="backward"){let u=t._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=t._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new mt;return c.then(u=>o(u,n,s))}return o(c,n,s)}}t["~standard"]={validate:o=>{try{let i=Cr(t,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Ln(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),cr=f("$ZodString",(t,e)=>{U.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??rc(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r}}),ne=f("$ZodStringFormat",(t,e)=>{Fn.init(t,e),cr.init(t,e)}),mc=f("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Vs),ne.init(t,e)}),hc=f("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=sr(n))}else e.pattern??(e.pattern=sr());ne.init(t,e)}),gc=f("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Fs),ne.init(t,e)}),vc=f("$ZodURL",(t,e)=>{ne.init(t,e),t._zod.check=r=>{try{let n=r.value.trim(),o=new URL(n);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),_c=f("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Js()),ne.init(t,e)}),yc=f("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Ls),ne.init(t,e)}),$c=f("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=As),ne.init(t,e)}),bc=f("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Zs),ne.init(t,e)}),xc=f("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Us),ne.init(t,e)}),kc=f("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Cs),ne.init(t,e)}),Sc=f("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Ms),ne.init(t,e)}),wc=f("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=tc(e)),ne.init(t,e)}),zc=f("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Qs),ne.init(t,e)}),Ic=f("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=ec(e)),ne.init(t,e)}),Pc=f("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=qs),ne.init(t,e)}),Ec=f("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Ks),ne.init(t,e),t._zod.bag.format="ipv4"}),Oc=f("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Ws),ne.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),jc=f("$ZodMAC",(t,e)=>{e.pattern??(e.pattern=Hs(e.delimiter)),ne.init(t,e),t._zod.bag.format="mac"}),Tc=f("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Gs),ne.init(t,e)}),Nc=f("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Bs),ne.init(t,e),t._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[o,i]=n;if(!i)throw new Error;let a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function hm(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Rc=f("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Xs),ne.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{hm(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function sb(t){if(!pi.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return hm(r)}var Dc=f("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=pi),ne.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{sb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Ac=f("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Ys),ne.init(t,e)});function cb(t,e=null){try{let r=t.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var Zc=f("$ZodJWT",(t,e)=>{ne.init(t,e),t._zod.check=r=>{cb(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),Uc=f("$ZodCustomStringFormat",(t,e)=>{ne.init(t,e),t._zod.check=r=>{e.fn(r.value)||r.issues.push({code:"invalid_format",format:e.format,input:r.value,inst:t,continue:!e.abort})}}),$i=f("$ZodNumber",(t,e)=>{U.init(t,e),t._zod.pattern=t._zod.bag.pattern??ic,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...i?{received:i}:{}}),r}}),Cc=f("$ZodNumberFormat",(t,e)=>{Cp.init(t,e),$i.init(t,e)}),Jn=f("$ZodBoolean",(t,e)=>{U.init(t,e),t._zod.pattern=ac,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r}}),bi=f("$ZodBigInt",(t,e)=>{U.init(t,e),t._zod.pattern=nc,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:t}),r}}),Mc=f("$ZodBigIntFormat",(t,e)=>{Mp.init(t,e),bi.init(t,e)}),Lc=f("$ZodSymbol",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:t}),r}}),qc=f("$ZodUndefined",(t,e)=>{U.init(t,e),t._zod.pattern=cc,t._zod.values=new Set([void 0]),t._zod.optin="optional",t._zod.optout="optional",t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:t}),r}}),Vc=f("$ZodNull",(t,e)=>{U.init(t,e),t._zod.pattern=sc,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r}}),Fc=f("$ZodAny",(t,e)=>{U.init(t,e),t._zod.parse=r=>r}),Jc=f("$ZodUnknown",(t,e)=>{U.init(t,e),t._zod.parse=r=>r}),Kc=f("$ZodNever",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)}),Wc=f("$ZodVoid",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:t}),r}}),Hc=f("$ZodDate",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:t}),r}});function om(t,e,r){t.issues.length&&e.issues.push(...Je(r,t.issues)),e.value[r]=t.value}var Gc=f("$ZodArray",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let i=[];for(let a=0;a<o.length;a++){let s=o[a],c=e.element._zod.run({value:s,issues:[]},n);c instanceof Promise?i.push(c.then(u=>om(u,r,a))):om(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function yi(t,e,r,n){t.issues.length&&e.issues.push(...Je(r,t.issues)),t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}function gm(t){let e=Object.keys(t.shape);for(let n of e)if(!t.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Ns(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function vm(t,e,r,n,o,i){let a=[],s=o.keySet,c=o.catchall._zod,u=c.def.type;for(let l in e){if(s.has(l))continue;if(u==="never"){a.push(l);continue}let d=c.run({value:e[l],issues:[]},n);d instanceof Promise?t.push(d.then(p=>yi(p,r,l,e))):yi(d,r,l,e)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:i}),t.length?Promise.all(t).then(()=>r):r}var _m=f("$ZodObject",(t,e)=>{if(U.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let s=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...s};return Object.defineProperty(e,"shape",{value:c}),c}})}let n=Zr(()=>gm(e));G(t._zod,"propValues",()=>{let s=e.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=ar,i=e.catchall,a;t._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:t}),s;s.value={};let l=[],d=a.shape;for(let p of a.keys){let g=d[p]._zod.run({value:u[p],issues:[]},c);g instanceof Promise?l.push(g.then(v=>yi(v,s,p,u))):yi(g,s,p,u)}return i?vm(l,u,s,c,n.value,t):l.length?Promise.all(l).then(()=>s):s}}),ym=f("$ZodObjectJIT",(t,e)=>{_m.init(t,e);let r=t._zod.parse,n=Zr(()=>gm(e)),o=p=>{let m=new mi(["shape","payload","ctx"]),g=n.value,v=P=>{let C=ci(P);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};m.write("const input = payload.value;");let $=Object.create(null),x=0;for(let P of g.keys)$[P]=`key_${x++}`;m.write("const newResult = {};");for(let P of g.keys){let C=$[P],N=ci(P);m.write(`const ${C} = ${v(P)};`),m.write(`
if (${C}.issues.length) {
payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
...iss,
path: iss.path ? [${N}, ...iss.path] : [${N}]
})));
}
if (${C}.value === undefined) {
if (${N} in input) {
newResult[${N}] = undefined;
}
} else {
newResult[${N}] = ${C}.value;
}
`)}m.write("payload.value = newResult;"),m.write("return payload;");let j=m.compile();return(P,C)=>j(p,P,C)},i,a=ar,s=!si.jitless,u=s&&js.value,l=e.catchall,d;t._zod.parse=(p,m)=>{d??(d=n.value);let g=p.value;return a(g)?s&&u&&m?.async===!1&&m.jitless!==!0?(i||(i=o(e.shape)),p=i(p,m),l?vm([],g,p,m,d,t):p):r(p,m):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:t}),p)}});function im(t,e,r,n){for(let i of t)if(i.issues.length===0)return e.value=i.value,e;let o=t.filter(i=>!Ft(i));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>Ze(a,n,_e())))}),e)}var Kn=f("$ZodUnion",(t,e)=>{U.init(t,e),G(t._zod,"optin",()=>e.options.some(o=>o._zod.optin==="optional")?"optional":void 0),G(t._zod,"optout",()=>e.options.some(o=>o._zod.optout==="optional")?"optional":void 0),G(t._zod,"values",()=>{if(e.options.every(o=>o._zod.values))return new Set(e.options.flatMap(o=>Array.from(o._zod.values)))}),G(t._zod,"pattern",()=>{if(e.options.every(o=>o._zod.pattern)){let o=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>On(i.source)).join("|")})$`)}});let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.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=>im(c,o,t,i)):im(s,o,t,i)}});function am(t,e,r,n){let o=t.filter(i=>i.issues.length===0);return o.length===1?(e.value=o[0].value,e):(o.length===0?e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(i=>i.issues.map(a=>Ze(a,n,_e())))}):e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:[],inclusive:!1}),e)}var Bc=f("$ZodXor",(t,e)=>{Kn.init(t,e),e.inclusive=!1;let r=e.options.length===1,n=e.options[0]._zod.run;t._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,s=[];for(let c of e.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=>am(c,o,t,i)):am(s,o,t,i)}}),Xc=f("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Kn.init(t,e);let r=t._zod.parse;G(t._zod,"propValues",()=>{let o={};for(let i of e.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){o[s]||(o[s]=new Set);for(let u of c)o[s].add(u)}}return o});let n=Zr(()=>{let o=e.options,i=new Map;for(let a of o){let s=a._zod.propValues?.[e.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});t._zod.parse=(o,i)=>{let a=o.value;if(!ar(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;let s=n.value.get(a?.[e.discriminator]);return s?s._zod.run(o,i):e.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,input:a,path:[e.discriminator],inst:t}),o)}}),Yc=f("$ZodIntersection",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,i=e.left._zod.run({value:o,issues:[]},n),a=e.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>sm(r,c,u)):sm(r,i,a)}});function pc(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Vt(t)&&Vt(e)){let r=Object.keys(e),n=Object.keys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let a=pc(t[i],e[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],a=pc(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function sm(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Ft(t))return t;let n=pc(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}var xi=f("$ZodTuple",(t,e)=>{U.init(t,e);let r=e.items;t._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({input:i,inst:t,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],s=[...r].reverse().findIndex(l=>l._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!e.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}:{code:"too_small",minimum:r.length},input:i,inst:t,origin:"array"}),n}let u=-1;for(let l of r){if(u++,u>=i.length&&u>=c)continue;let d=l._zod.run({value:i[u],issues:[]},o);d instanceof Promise?a.push(d.then(p=>hi(p,n,u))):hi(d,n,u)}if(e.rest){let l=i.slice(r.length);for(let d of l){u++;let p=e.rest._zod.run({value:d,issues:[]},o);p instanceof Promise?a.push(p.then(m=>hi(m,n,u))):hi(p,n,u)}}return a.length?Promise.all(a).then(()=>n):n}});function hi(t,e,r){t.issues.length&&e.issues.push(...Je(r,t.issues)),e.value[r]=t.value}var Qc=f("$ZodRecord",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Vt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let i=[],a=e.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){s.add(typeof u=="number"?u.toString():u);let l=e.valueType._zod.run({value:o[u],issues:[]},n);l instanceof Promise?i.push(l.then(d=>{d.issues.length&&r.issues.push(...Je(u,d.issues)),r.value[u]=d.value})):(l.issues.length&&r.issues.push(...Je(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:t,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(o)){if(s==="__proto__")continue;let c=e.keyType._zod.run({value:s,issues:[]},n);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){e.mode==="loose"?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>Ze(l,n,_e())),input:s,path:[s],inst:t});continue}let u=e.valueType._zod.run({value:o[s],issues:[]},n);u instanceof Promise?i.push(u.then(l=>{l.issues.length&&r.issues.push(...Je(s,l.issues)),r.value[c.value]=l.value})):(u.issues.length&&r.issues.push(...Je(s,u.issues)),r.value[c.value]=u.value)}}return i.length?Promise.all(i).then(()=>r):r}}),eu=f("$ZodMap",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:o,inst:t}),r;let i=[];r.value=new Map;for(let[a,s]of o){let c=e.keyType._zod.run({value:a,issues:[]},n),u=e.valueType._zod.run({value:s,issues:[]},n);c instanceof Promise||u instanceof Promise?i.push(Promise.all([c,u]).then(([l,d])=>{cm(l,d,r,a,o,t,n)})):cm(c,u,r,a,o,t,n)}return i.length?Promise.all(i).then(()=>r):r}});function cm(t,e,r,n,o,i,a){t.issues.length&&(jn.has(typeof n)?r.issues.push(...Je(n,t.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:t.issues.map(s=>Ze(s,a,_e()))})),e.issues.length&&(jn.has(typeof n)?r.issues.push(...Je(n,e.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:e.issues.map(s=>Ze(s,a,_e()))})),r.value.set(t.value,e.value)}var tu=f("$ZodSet",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!(o instanceof Set))return r.issues.push({input:o,inst:t,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of o){let s=e.valueType._zod.run({value:a,issues:[]},n);s instanceof Promise?i.push(s.then(c=>um(c,r))):um(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function um(t,e){t.issues.length&&e.issues.push(...t.issues),e.value.add(t.value)}var ru=f("$ZodEnum",(t,e)=>{U.init(t,e);let r=En(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(o=>jn.has(typeof o)).map(o=>typeof o=="string"?Be(o):o.toString()).join("|")})$`),t._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:t}),o}}),nu=f("$ZodLiteral",(t,e)=>{if(U.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?Be(n):n?Be(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:e.values,input:i,inst:t}),n}}),ou=f("$ZodFile",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:t}),r}}),iu=f("$ZodTransform",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ir(t.constructor.name);let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new mt;return r.value=o,r}});function lm(t,e){return t.issues.length&&e===void 0?{issues:[],value:void 0}:t}var au=f("$ZodOptional",(t,e)=>{U.init(t,e),t._zod.optin="optional",t._zod.optout="optional",G(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),G(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${On(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>lm(i,r.value)):lm(o,r.value)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),su=f("$ZodNullable",(t,e)=>{U.init(t,e),G(t._zod,"optin",()=>e.innerType._zod.optin),G(t._zod,"optout",()=>e.innerType._zod.optout),G(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${On(r.source)}|null)$`):void 0}),G(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),cu=f("$ZodDefault",(t,e)=>{U.init(t,e),t._zod.optin="optional",G(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>dm(i,e)):dm(o,e)}});function dm(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var uu=f("$ZodPrefault",(t,e)=>{U.init(t,e),t._zod.optin="optional",G(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),lu=f("$ZodNonOptional",(t,e)=>{U.init(t,e),G(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>fm(i,t)):fm(o,t)}});function fm(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var du=f("$ZodSuccess",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ir("ZodSuccess");let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}}),fu=f("$ZodCatch",(t,e)=>{U.init(t,e),G(t._zod,"optin",()=>e.innerType._zod.optin),G(t._zod,"optout",()=>e.innerType._zod.optout),G(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(a=>Ze(a,n,_e()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(i=>Ze(i,n,_e()))},input:r.value}),r.issues=[]),r)}}),pu=f("$ZodNaN",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:t,expected:"nan",code:"invalid_type"}),r)}),mu=f("$ZodPipe",(t,e)=>{U.init(t,e),G(t._zod,"values",()=>e.in._zod.values),G(t._zod,"optin",()=>e.in._zod.optin),G(t._zod,"optout",()=>e.out._zod.optout),G(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>gi(a,e.in,n)):gi(i,e.in,n)}let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(i=>gi(i,e.out,n)):gi(o,e.out,n)}});function gi(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues},r)}var Wn=f("$ZodCodec",(t,e)=>{U.init(t,e),G(t._zod,"values",()=>e.in._zod.values),G(t._zod,"optin",()=>e.in._zod.optin),G(t._zod,"optout",()=>e.out._zod.optout),G(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=e.in._zod.run(r,n);return i instanceof Promise?i.then(a=>vi(a,e,n)):vi(i,e,n)}else{let i=e.out._zod.run(r,n);return i instanceof Promise?i.then(a=>vi(a,e,n)):vi(i,e,n)}}});function vi(t,e,r){if(t.issues.length)return t.aborted=!0,t;if((r.direction||"forward")==="forward"){let o=e.transform(t.value,t);return o instanceof Promise?o.then(i=>_i(t,i,e.out,r)):_i(t,o,e.out,r)}else{let o=e.reverseTransform(t.value,t);return o instanceof Promise?o.then(i=>_i(t,i,e.in,r)):_i(t,o,e.in,r)}}function _i(t,e,r,n){return t.issues.length?(t.aborted=!0,t):r._zod.run({value:e,issues:t.issues},n)}var hu=f("$ZodReadonly",(t,e)=>{U.init(t,e),G(t._zod,"propValues",()=>e.innerType._zod.propValues),G(t._zod,"values",()=>e.innerType._zod.values),G(t._zod,"optin",()=>e.innerType?._zod?.optin),G(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(pm):pm(o)}});function pm(t){return t.value=Object.freeze(t.value),t}var gu=f("$ZodTemplateLiteral",(t,e)=>{U.init(t,e);let r=[];for(let n of e.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let o=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!o)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let i=o.startsWith("^")?1:0,a=o.endsWith("$")?o.length-1:o.length;r.push(o.slice(i,a))}else if(n===null||Ts.has(typeof n))r.push(Be(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);t._zod.pattern=new RegExp(`^${r.join("")}$`),t._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:t,expected:"template_literal",code:"invalid_type"}),n):(t._zod.pattern.lastIndex=0,t._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:t,code:"invalid_format",format:e.format??"template_literal",pattern:t._zod.pattern.source}),n)}),vu=f("$ZodFunction",(t,e)=>(U.init(t,e),t._def=e,t._zod.def=e,t.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let o=t._def.input?An(t._def.input,n):n,i=Reflect.apply(r,this,o);return t._def.output?An(t._def.output,i):i}},t.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let o=t._def.input?await Un(t._def.input,n):n,i=await Reflect.apply(r,this,o);return t._def.output?await Un(t._def.output,i):i}},t._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:t}),r):(t._def.output&&t._def.output._zod.def.type==="promise"?r.value=t.implementAsync(r.value):r.value=t.implement(r.value),r),t.input=(...r)=>{let n=t.constructor;return Array.isArray(r[0])?new n({type:"function",input:new xi({type:"tuple",items:r[0],rest:r[1]}),output:t._def.output}):new n({type:"function",input:r[0],output:t._def.output})},t.output=r=>{let n=t.constructor;return new n({type:"function",input:t._def.input,output:r})},t)),_u=f("$ZodPromise",(t,e)=>{U.init(t,e),t._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>e.innerType._zod.run({value:o,issues:[]},n))}),yu=f("$ZodLazy",(t,e)=>{U.init(t,e),G(t._zod,"innerType",()=>e.getter()),G(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),G(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),G(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),G(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(r,n)=>t._zod.innerType._zod.run(r,n)}),$u=f("$ZodCustom",(t,e)=>{ae.init(t,e),U.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(i=>mm(i,r,n,t));mm(o,r,n,t)}});function mm(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Ur(o))}}var lb=t=>{let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"NaN":"number";case"object":{if(Array.isArray(t))return"array";if(t===null)return"null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},db=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${lb(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${A(n.values[0])}`:`Invalid option: expected one of ${D(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=e(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=e(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${D(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function bu(){return{localeError:db()}}var $m,bm=Symbol("ZodOutput"),xm=Symbol("ZodInput"),ku=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Su(){return new ku}($m=globalThis).__zod_globalRegistry??($m.__zod_globalRegistry=Su());var Ue=globalThis.__zod_globalRegistry;function wu(t,e){return new t({type:"string",...k(e)})}function ki(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...k(e)})}function Hn(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...k(e)})}function Si(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...k(e)})}function wi(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...k(e)})}function zi(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...k(e)})}function Ii(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...k(e)})}function Gn(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...k(e)})}function Pi(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...k(e)})}function Ei(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...k(e)})}function Oi(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...k(e)})}function ji(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...k(e)})}function Ti(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...k(e)})}function Ni(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...k(e)})}function Ri(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...k(e)})}function Di(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...k(e)})}function Ai(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...k(e)})}function zu(t,e){return new t({type:"string",format:"mac",check:"string_format",abort:!1,...k(e)})}function Zi(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...k(e)})}function Ui(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...k(e)})}function Ci(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...k(e)})}function Mi(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...k(e)})}function Li(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...k(e)})}function qi(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...k(e)})}function Iu(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...k(e)})}function Pu(t,e){return new t({type:"string",format:"date",check:"string_format",...k(e)})}function Eu(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...k(e)})}function Ou(t,e){return new t({type:"string",format:"duration",check:"string_format",...k(e)})}function ju(t,e){return new t({type:"number",checks:[],...k(e)})}function Tu(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...k(e)})}function Nu(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float32",...k(e)})}function Ru(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"float64",...k(e)})}function Du(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"int32",...k(e)})}function Au(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"uint32",...k(e)})}function Zu(t,e){return new t({type:"boolean",...k(e)})}function Uu(t,e){return new t({type:"bigint",...k(e)})}function Cu(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...k(e)})}function Mu(t,e){return new t({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...k(e)})}function Lu(t,e){return new t({type:"symbol",...k(e)})}function qu(t,e){return new t({type:"undefined",...k(e)})}function Vu(t,e){return new t({type:"null",...k(e)})}function Fu(t){return new t({type:"any"})}function Ju(t){return new t({type:"unknown"})}function Ku(t,e){return new t({type:"never",...k(e)})}function Wu(t,e){return new t({type:"void",...k(e)})}function Hu(t,e){return new t({type:"date",...k(e)})}function Gu(t,e){return new t({type:"nan",...k(e)})}function It(t,e){return new dc({check:"less_than",...k(e),value:t,inclusive:!1})}function Ke(t,e){return new dc({check:"less_than",...k(e),value:t,inclusive:!0})}function Pt(t,e){return new fc({check:"greater_than",...k(e),value:t,inclusive:!1})}function Ne(t,e){return new fc({check:"greater_than",...k(e),value:t,inclusive:!0})}function Bu(t){return Pt(0,t)}function Xu(t){return It(0,t)}function Yu(t){return Ke(0,t)}function Qu(t){return Ne(0,t)}function ur(t,e){return new Up({check:"multiple_of",...k(e),value:t})}function Mr(t,e){return new Lp({check:"max_size",...k(e),maximum:t})}function lr(t,e){return new qp({check:"min_size",...k(e),minimum:t})}function Bn(t,e){return new Vp({check:"size_equals",...k(e),size:t})}function Lr(t,e){return new Fp({check:"max_length",...k(e),maximum:t})}function Jt(t,e){return new Jp({check:"min_length",...k(e),minimum:t})}function qr(t,e){return new Kp({check:"length_equals",...k(e),length:t})}function Xn(t,e){return new Wp({check:"string_format",format:"regex",...k(e),pattern:t})}function Yn(t){return new Hp({check:"string_format",format:"lowercase",...k(t)})}function Qn(t){return new Gp({check:"string_format",format:"uppercase",...k(t)})}function eo(t,e){return new Bp({check:"string_format",format:"includes",...k(e),includes:t})}function to(t,e){return new Xp({check:"string_format",format:"starts_with",...k(e),prefix:t})}function ro(t,e){return new Yp({check:"string_format",format:"ends_with",...k(e),suffix:t})}function el(t,e,r){return new Qp({check:"property",property:t,schema:e,...k(r)})}function no(t,e){return new em({check:"mime_type",mime:t,...k(e)})}function ht(t){return new tm({check:"overwrite",tx:t})}function oo(t){return ht(e=>e.normalize(t))}function io(){return ht(t=>t.trim())}function ao(){return ht(t=>t.toLowerCase())}function so(){return ht(t=>t.toUpperCase())}function Vi(){return ht(t=>Os(t))}function km(t,e,r){return new t({type:"array",element:e,...k(r)})}function tl(t,e){return new t({type:"file",...k(e)})}function rl(t,e,r){let n=k(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function nl(t,e,r){return new t({type:"custom",check:"custom",fn:e,...k(r)})}function ol(t){let e=hb(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ur(n,r.value,e._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(Ur(o))}},t(r.value,r)));return e}function hb(t,e){let r=new ae({check:"custom",...k(e)});return r._zod.check=t,r}function il(t){let e=new ae({check:"describe"});return e._zod.onattach=[r=>{let n=Ue.get(r)??{};Ue.add(r,{...n,description:t})}],e._zod.check=()=>{},e}function al(t){let e=new ae({check:"meta"});return e._zod.onattach=[r=>{let n=Ue.get(r)??{};Ue.add(r,{...n,...t})}],e._zod.check=()=>{},e}function sl(t,e){let r=k(e),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),a=new Set(o),s=t.Codec??Wn,c=t.Boolean??Jn,u=t.String??cr,l=new u({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),p=new s({type:"pipe",in:l,out:d,transform:((m,g)=>{let v=m;return r.case!=="sensitive"&&(v=v.toLowerCase()),i.has(v)?!0:a.has(v)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:p,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?n[0]||"true":o[0]||"false"),error:r.error});return p}function Vr(t,e,r,n={}){let o=k(n),i={...k(n),check:"string_format",type:"string",format:e,fn:typeof r=="function"?r:s=>r.test(s),...o};return r instanceof RegExp&&(i.pattern=r),new t(i)}function Fi(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??Ue,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function de(t,e,r={path:[],schemaPath:[]}){var n;let o=t._zod.def,i=e.seen.get(t);if(i)return i.count++,r.schemaPath.includes(t)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,a);let s=t._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...r,schemaPath:[...r.schemaPath,t],path:r.path},d=t._zod.parent;if(d)a.ref=d,de(d,e,l),e.seen.get(d).isParent=!0;else if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,l);else{let p=a.schema,m=e.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(t,e,p,l)}}let c=e.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),e.io==="input"&&Re(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function Ji(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=i=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let l=t.external.registry.get(i[0])?.id,d=t.external.uri??(m=>m);if(l)return{ref:d(l)};let p=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=p,{defId:p,ref:`${d("__shared")}#/${a}/${p}`}}if(i[1]===r)return{ref:"#"};let c=`#/${a}/`,u=i[1].schema.id??`__schema${t.counter++}`;return{defId:u,ref:c+u}},o=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:s,defId:c}=n(i);a.def={...a.schema},c&&(a.defId=c);let u=a.schema;for(let l in u)delete u[l];u.$ref=s};if(t.cycles==="throw")for(let i of t.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of t.seen.entries()){let a=i[1];if(e===i[0]){o(i);continue}if(t.external){let c=t.external.registry.get(i[0])?.id;if(e!==i[0]&&c){o(i);continue}}if(t.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&t.reused==="ref"){o(i);continue}}}function Ki(t,e){let r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let s=t.seen.get(a),c=s.def??s.schema,u={...c};if(s.ref===null)return;let l=s.ref;if(s.ref=null,l){n(l);let d=t.seen.get(l).schema;d.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(d)):(Object.assign(c,d),Object.assign(c,u))}s.isParent||t.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(let a of[...t.seen.entries()].reverse())n(a[0]);let o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(a)}Object.assign(o,r.def??r.schema);let i=t.external?.defs??{};for(let a of t.seen.entries()){let s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:co(e,"input"),output:co(e,"output")}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Re(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Re(n.element,r);if(n.type==="set")return Re(n.valueType,r);if(n.type==="lazy")return Re(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 Re(n.innerType,r);if(n.type==="intersection")return Re(n.left,r)||Re(n.right,r);if(n.type==="record"||n.type==="map")return Re(n.keyType,r)||Re(n.valueType,r);if(n.type==="pipe")return Re(n.in,r)||Re(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Re(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Re(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Re(o,r))return!0;return!!(n.rest&&Re(n.rest,r))}return!1}var Sm=(t,e={})=>r=>{let n=Fi({...r,processors:e});return de(t,n),Ji(n,t),Ki(n,t)},co=(t,e)=>r=>{let{libraryOptions:n,target:o}=r??{},i=Fi({...n??{},target:o,io:e,processors:{}});return de(t,i),Ji(i,t),Ki(i,t)};var gb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wm=(t,e,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=t._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),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=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},zm=(t,e,r,n)=>{let o=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:l}=t._zod.bag;typeof s=="string"&&s.includes("int")?o.type="integer":o.type="number",typeof l=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l),typeof i=="number"&&(o.minimum=i,typeof l=="number"&&e.target!=="draft-04"&&(l>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(e.target==="draft-04"||e.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&e.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Im=(t,e,r,n)=>{r.type="boolean"},Pm=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Em=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Om=(t,e,r,n)=>{e.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},jm=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Tm=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Nm=(t,e,r,n)=>{r.not={}},Rm=(t,e,r,n)=>{},Dm=(t,e,r,n)=>{},Am=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Zm=(t,e,r,n)=>{let o=t._zod.def,i=En(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},Um=(t,e,r,n)=>{let o=t._zod.def,i=[];for(let a of o.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Cm=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Mm=(t,e,r,n)=>{let o=r,i=t._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Lm=(t,e,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=t._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)):o.anyOf=c.map(u=>({...i,contentMediaType:u})):Object.assign(o,i)},qm=(t,e,r,n)=>{r.type="boolean"},Vm=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Fm=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Jm=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Km=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Wm=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Hm=(t,e,r,n)=>{let o=r,i=t._zod.def,{minimum:a,maximum:s}=t._zod.bag;typeof a=="number"&&(o.minItems=a),typeof s=="number"&&(o.maxItems=s),o.type="array",o.items=de(i.element,e,{...n,path:[...n.path,"items"]})},Gm=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object",o.properties={};let a=i.shape;for(let u in a)o.properties[u]=de(a[u],e,{...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 e.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=de(i.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},cl=(t,e,r,n)=>{let o=t._zod.def,i=o.inclusive===!1,a=o.options.map((s,c)=>de(s,e,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},Bm=(t,e,r,n)=>{let o=t._zod.def,i=de(o.left,e,{...n,path:[...n.path,"allOf",0]}),a=de(o.right,e,{...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},Xm=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="array";let a=e.target==="draft-2020-12"?"prefixItems":"items",s=e.target==="draft-2020-12"||e.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((p,m)=>de(p,e,{...n,path:[...n.path,a,m]})),u=i.rest?de(i.rest,e,{...n,path:[...n.path,s,...e.target==="openapi-3.0"?[i.items.length]:[]]}):null;e.target==="draft-2020-12"?(o.prefixItems=c,u&&(o.items=u)):e.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}=t._zod.bag;typeof l=="number"&&(o.minItems=l),typeof d=="number"&&(o.maxItems=d)},Ym=(t,e,r,n)=>{let o=r,i=t._zod.def;o.type="object",(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=de(i.keyType,e,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=de(i.valueType,e,{...n,path:[...n.path,"additionalProperties"]})},Qm=(t,e,r,n)=>{let o=t._zod.def,i=de(o.innerType,e,n),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},eh=(t,e,r,n)=>{let o=t._zod.def;de(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},th=(t,e,r,n)=>{let o=t._zod.def;de(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},rh=(t,e,r,n)=>{let o=t._zod.def;de(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},nh=(t,e,r,n)=>{let o=t._zod.def;de(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},oh=(t,e,r,n)=>{let o=t._zod.def,i=e.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;de(i,e,n);let a=e.seen.get(t);a.ref=i},ih=(t,e,r,n)=>{let o=t._zod.def;de(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType,r.readOnly=!0},ah=(t,e,r,n)=>{let o=t._zod.def;de(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},sh=(t,e,r,n)=>{let o=t._zod.def;de(o.innerType,e,n);let i=e.seen.get(t);i.ref=o.innerType},ch=(t,e,r,n)=>{let o=t._zod.innerType;de(o,e,n);let i=e.seen.get(t);i.ref=o};function Fr(t){return!!t._zod}function Kt(t,e){return Fr(t)?Cr(t,e):t.safeParse(e)}function Wi(t){if(!t)return;let e;if(Fr(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function dh(t){if(Fr(t)){let i=t._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var uo={};hn(uo,{ZodAny:()=>Eh,ZodArray:()=>Nh,ZodBase64:()=>Tl,ZodBase64URL:()=>Nl,ZodBigInt:()=>ra,ZodBigIntFormat:()=>Al,ZodBoolean:()=>ta,ZodCIDRv4:()=>Ol,ZodCIDRv6:()=>jl,ZodCUID:()=>kl,ZodCUID2:()=>Sl,ZodCatch:()=>Xh,ZodCodec:()=>Vl,ZodCustom:()=>sa,ZodCustomStringFormat:()=>fo,ZodDate:()=>Ul,ZodDefault:()=>Jh,ZodDiscriminatedUnion:()=>Dh,ZodE164:()=>Rl,ZodEmail:()=>$l,ZodEmoji:()=>bl,ZodEnum:()=>lo,ZodFile:()=>qh,ZodFunction:()=>ag,ZodGUID:()=>Gi,ZodIPv4:()=>Pl,ZodIPv6:()=>El,ZodIntersection:()=>Ah,ZodJWT:()=>Dl,ZodKSUID:()=>Il,ZodLazy:()=>ng,ZodLiteral:()=>Lh,ZodMAC:()=>wh,ZodMap:()=>Ch,ZodNaN:()=>Qh,ZodNanoID:()=>xl,ZodNever:()=>jh,ZodNonOptional:()=>Ll,ZodNull:()=>Ph,ZodNullable:()=>Fh,ZodNumber:()=>ea,ZodNumberFormat:()=>Jr,ZodObject:()=>na,ZodOptional:()=>Ml,ZodPipe:()=>ql,ZodPrefault:()=>Wh,ZodPromise:()=>ig,ZodReadonly:()=>eg,ZodRecord:()=>aa,ZodSet:()=>Mh,ZodString:()=>Yi,ZodStringFormat:()=>se,ZodSuccess:()=>Bh,ZodSymbol:()=>zh,ZodTemplateLiteral:()=>rg,ZodTransform:()=>Vh,ZodTuple:()=>Zh,ZodType:()=>q,ZodULID:()=>wl,ZodURL:()=>Qi,ZodUUID:()=>Et,ZodUndefined:()=>Ih,ZodUnion:()=>oa,ZodUnknown:()=>Oh,ZodVoid:()=>Th,ZodXID:()=>zl,ZodXor:()=>Rh,_ZodString:()=>yl,_default:()=>Kh,_function:()=>Tx,any:()=>mx,array:()=>W,base64:()=>Xb,base64url:()=>Yb,bigint:()=>ux,boolean:()=>ve,catch:()=>Yh,check:()=>Nx,cidrv4:()=>Gb,cidrv6:()=>Bb,codec:()=>Ex,cuid:()=>Lb,cuid2:()=>qb,custom:()=>Fl,date:()=>gx,describe:()=>Rx,discriminatedUnion:()=>ia,e164:()=>Qb,email:()=>jb,emoji:()=>Cb,enum:()=>Ie,file:()=>wx,float32:()=>ix,float64:()=>ax,function:()=>Tx,guid:()=>Tb,hash:()=>ox,hex:()=>nx,hostname:()=>rx,httpUrl:()=>Ub,instanceof:()=>Ax,int:()=>_l,int32:()=>sx,int64:()=>lx,intersection:()=>mo,ipv4:()=>Kb,ipv6:()=>Hb,json:()=>Ux,jwt:()=>ex,keyof:()=>vx,ksuid:()=>Jb,lazy:()=>og,literal:()=>E,looseObject:()=>ze,looseRecord:()=>bx,mac:()=>Wb,map:()=>xx,meta:()=>Dx,nan:()=>Px,nanoid:()=>Mb,nativeEnum:()=>Sx,never:()=>Zl,nonoptional:()=>Gh,null:()=>po,nullable:()=>Bi,nullish:()=>zx,number:()=>re,object:()=>z,optional:()=>fe,partialRecord:()=>$x,pipe:()=>Xi,prefault:()=>Hh,preprocess:()=>ca,promise:()=>jx,readonly:()=>tg,record:()=>le,refine:()=>sg,set:()=>kx,strictObject:()=>_x,string:()=>h,stringFormat:()=>tx,stringbool:()=>Zx,success:()=>Ix,superRefine:()=>cg,symbol:()=>fx,templateLiteral:()=>Ox,transform:()=>Cl,tuple:()=>Uh,uint32:()=>cx,uint64:()=>dx,ulid:()=>Vb,undefined:()=>px,union:()=>oe,unknown:()=>ce,url:()=>Zb,uuid:()=>Nb,uuidv4:()=>Rb,uuidv6:()=>Db,uuidv7:()=>Ab,void:()=>hx,xid:()=>Fb,xor:()=>yx});var Hi={};hn(Hi,{endsWith:()=>ro,gt:()=>Pt,gte:()=>Ne,includes:()=>eo,length:()=>qr,lowercase:()=>Yn,lt:()=>It,lte:()=>Ke,maxLength:()=>Lr,maxSize:()=>Mr,mime:()=>no,minLength:()=>Jt,minSize:()=>lr,multipleOf:()=>ur,negative:()=>Xu,nonnegative:()=>Qu,nonpositive:()=>Yu,normalize:()=>oo,overwrite:()=>ht,positive:()=>Bu,property:()=>el,regex:()=>Xn,size:()=>Bn,slugify:()=>Vi,startsWith:()=>to,toLowerCase:()=>ao,toUpperCase:()=>so,trim:()=>io,uppercase:()=>Qn});var dr={};hn(dr,{ZodISODate:()=>fl,ZodISODateTime:()=>ll,ZodISODuration:()=>gl,ZodISOTime:()=>ml,date:()=>pl,datetime:()=>dl,duration:()=>vl,time:()=>hl});var ll=f("ZodISODateTime",(t,e)=>{wc.init(t,e),se.init(t,e)});function dl(t){return Iu(ll,t)}var fl=f("ZodISODate",(t,e)=>{zc.init(t,e),se.init(t,e)});function pl(t){return Pu(fl,t)}var ml=f("ZodISOTime",(t,e)=>{Ic.init(t,e),se.init(t,e)});function hl(t){return Eu(ml,t)}var gl=f("ZodISODuration",(t,e)=>{Pc.init(t,e),se.init(t,e)});function vl(t){return Ou(gl,t)}var fh=(t,e)=>{li.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>fi(t,r)},flatten:{value:r=>di(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Ar,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Ar,2)}},isEmpty:{get(){return t.issues.length===0}}})},$4=f("ZodError",fh),We=f("ZodError",fh,{Parent:Error});var ph=Dn(We),mh=Zn(We),hh=Cn(We),gh=Mn(We),vh=wp(We),_h=zp(We),yh=Ip(We),$h=Pp(We),bh=Ep(We),xh=Op(We),kh=jp(We),Sh=Tp(We);var q=f("ZodType",(t,e)=>(U.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:co(t,"input"),output:co(t,"output")}}),t.toJSONSchema=Sm(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone(y.mergeDefs(e,{checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),t.clone=(r,n)=>Te(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>ph(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>hh(t,r,n),t.parseAsync=async(r,n)=>mh(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>gh(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>vh(t,r,n),t.decode=(r,n)=>_h(t,r,n),t.encodeAsync=async(r,n)=>yh(t,r,n),t.decodeAsync=async(r,n)=>$h(t,r,n),t.safeEncode=(r,n)=>bh(t,r,n),t.safeDecode=(r,n)=>xh(t,r,n),t.safeEncodeAsync=async(r,n)=>kh(t,r,n),t.safeDecodeAsync=async(r,n)=>Sh(t,r,n),t.refine=(r,n)=>t.check(sg(r,n)),t.superRefine=r=>t.check(cg(r)),t.overwrite=r=>t.check(ht(r)),t.optional=()=>fe(t),t.nullable=()=>Bi(t),t.nullish=()=>fe(Bi(t)),t.nonoptional=r=>Gh(t,r),t.array=()=>W(t),t.or=r=>oe([t,r]),t.and=r=>mo(t,r),t.transform=r=>Xi(t,Cl(r)),t.default=r=>Kh(t,r),t.prefault=r=>Hh(t,r),t.catch=r=>Yh(t,r),t.pipe=r=>Xi(t,r),t.readonly=()=>tg(t),t.describe=r=>{let n=t.clone();return Ue.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Ue.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Ue.get(t);let n=t.clone();return Ue.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),yl=f("_ZodString",(t,e)=>{cr.init(t,e),q.init(t,e),t._zod.processJSONSchema=(n,o,i)=>wm(t,n,o,i);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(Xn(...n)),t.includes=(...n)=>t.check(eo(...n)),t.startsWith=(...n)=>t.check(to(...n)),t.endsWith=(...n)=>t.check(ro(...n)),t.min=(...n)=>t.check(Jt(...n)),t.max=(...n)=>t.check(Lr(...n)),t.length=(...n)=>t.check(qr(...n)),t.nonempty=(...n)=>t.check(Jt(1,...n)),t.lowercase=n=>t.check(Yn(n)),t.uppercase=n=>t.check(Qn(n)),t.trim=()=>t.check(io()),t.normalize=(...n)=>t.check(oo(...n)),t.toLowerCase=()=>t.check(ao()),t.toUpperCase=()=>t.check(so()),t.slugify=()=>t.check(Vi())}),Yi=f("ZodString",(t,e)=>{cr.init(t,e),yl.init(t,e),t.email=r=>t.check(ki($l,r)),t.url=r=>t.check(Gn(Qi,r)),t.jwt=r=>t.check(qi(Dl,r)),t.emoji=r=>t.check(Pi(bl,r)),t.guid=r=>t.check(Hn(Gi,r)),t.uuid=r=>t.check(Si(Et,r)),t.uuidv4=r=>t.check(wi(Et,r)),t.uuidv6=r=>t.check(zi(Et,r)),t.uuidv7=r=>t.check(Ii(Et,r)),t.nanoid=r=>t.check(Ei(xl,r)),t.guid=r=>t.check(Hn(Gi,r)),t.cuid=r=>t.check(Oi(kl,r)),t.cuid2=r=>t.check(ji(Sl,r)),t.ulid=r=>t.check(Ti(wl,r)),t.base64=r=>t.check(Ci(Tl,r)),t.base64url=r=>t.check(Mi(Nl,r)),t.xid=r=>t.check(Ni(zl,r)),t.ksuid=r=>t.check(Ri(Il,r)),t.ipv4=r=>t.check(Di(Pl,r)),t.ipv6=r=>t.check(Ai(El,r)),t.cidrv4=r=>t.check(Zi(Ol,r)),t.cidrv6=r=>t.check(Ui(jl,r)),t.e164=r=>t.check(Li(Rl,r)),t.datetime=r=>t.check(dl(r)),t.date=r=>t.check(pl(r)),t.time=r=>t.check(hl(r)),t.duration=r=>t.check(vl(r))});function h(t){return wu(Yi,t)}var se=f("ZodStringFormat",(t,e)=>{ne.init(t,e),yl.init(t,e)}),$l=f("ZodEmail",(t,e)=>{gc.init(t,e),se.init(t,e)});function jb(t){return ki($l,t)}var Gi=f("ZodGUID",(t,e)=>{mc.init(t,e),se.init(t,e)});function Tb(t){return Hn(Gi,t)}var Et=f("ZodUUID",(t,e)=>{hc.init(t,e),se.init(t,e)});function Nb(t){return Si(Et,t)}function Rb(t){return wi(Et,t)}function Db(t){return zi(Et,t)}function Ab(t){return Ii(Et,t)}var Qi=f("ZodURL",(t,e)=>{vc.init(t,e),se.init(t,e)});function Zb(t){return Gn(Qi,t)}function Ub(t){return Gn(Qi,{protocol:/^https?$/,hostname:Xe.domain,...y.normalizeParams(t)})}var bl=f("ZodEmoji",(t,e)=>{_c.init(t,e),se.init(t,e)});function Cb(t){return Pi(bl,t)}var xl=f("ZodNanoID",(t,e)=>{yc.init(t,e),se.init(t,e)});function Mb(t){return Ei(xl,t)}var kl=f("ZodCUID",(t,e)=>{$c.init(t,e),se.init(t,e)});function Lb(t){return Oi(kl,t)}var Sl=f("ZodCUID2",(t,e)=>{bc.init(t,e),se.init(t,e)});function qb(t){return ji(Sl,t)}var wl=f("ZodULID",(t,e)=>{xc.init(t,e),se.init(t,e)});function Vb(t){return Ti(wl,t)}var zl=f("ZodXID",(t,e)=>{kc.init(t,e),se.init(t,e)});function Fb(t){return Ni(zl,t)}var Il=f("ZodKSUID",(t,e)=>{Sc.init(t,e),se.init(t,e)});function Jb(t){return Ri(Il,t)}var Pl=f("ZodIPv4",(t,e)=>{Ec.init(t,e),se.init(t,e)});function Kb(t){return Di(Pl,t)}var wh=f("ZodMAC",(t,e)=>{jc.init(t,e),se.init(t,e)});function Wb(t){return zu(wh,t)}var El=f("ZodIPv6",(t,e)=>{Oc.init(t,e),se.init(t,e)});function Hb(t){return Ai(El,t)}var Ol=f("ZodCIDRv4",(t,e)=>{Tc.init(t,e),se.init(t,e)});function Gb(t){return Zi(Ol,t)}var jl=f("ZodCIDRv6",(t,e)=>{Nc.init(t,e),se.init(t,e)});function Bb(t){return Ui(jl,t)}var Tl=f("ZodBase64",(t,e)=>{Rc.init(t,e),se.init(t,e)});function Xb(t){return Ci(Tl,t)}var Nl=f("ZodBase64URL",(t,e)=>{Dc.init(t,e),se.init(t,e)});function Yb(t){return Mi(Nl,t)}var Rl=f("ZodE164",(t,e)=>{Ac.init(t,e),se.init(t,e)});function Qb(t){return Li(Rl,t)}var Dl=f("ZodJWT",(t,e)=>{Zc.init(t,e),se.init(t,e)});function ex(t){return qi(Dl,t)}var fo=f("ZodCustomStringFormat",(t,e)=>{Uc.init(t,e),se.init(t,e)});function tx(t,e,r={}){return Vr(fo,t,e,r)}function rx(t){return Vr(fo,"hostname",Xe.hostname,t)}function nx(t){return Vr(fo,"hex",Xe.hex,t)}function ox(t,e){let r=e?.enc??"hex",n=`${t}_${r}`,o=Xe[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Vr(fo,n,o,e)}var ea=f("ZodNumber",(t,e)=>{$i.init(t,e),q.init(t,e),t._zod.processJSONSchema=(n,o,i)=>zm(t,n,o,i),t.gt=(n,o)=>t.check(Pt(n,o)),t.gte=(n,o)=>t.check(Ne(n,o)),t.min=(n,o)=>t.check(Ne(n,o)),t.lt=(n,o)=>t.check(It(n,o)),t.lte=(n,o)=>t.check(Ke(n,o)),t.max=(n,o)=>t.check(Ke(n,o)),t.int=n=>t.check(_l(n)),t.safe=n=>t.check(_l(n)),t.positive=n=>t.check(Pt(0,n)),t.nonnegative=n=>t.check(Ne(0,n)),t.negative=n=>t.check(It(0,n)),t.nonpositive=n=>t.check(Ke(0,n)),t.multipleOf=(n,o)=>t.check(ur(n,o)),t.step=(n,o)=>t.check(ur(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function re(t){return ju(ea,t)}var Jr=f("ZodNumberFormat",(t,e)=>{Cc.init(t,e),ea.init(t,e)});function _l(t){return Tu(Jr,t)}function ix(t){return Nu(Jr,t)}function ax(t){return Ru(Jr,t)}function sx(t){return Du(Jr,t)}function cx(t){return Au(Jr,t)}var ta=f("ZodBoolean",(t,e)=>{Jn.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Im(t,r,n,o)});function ve(t){return Zu(ta,t)}var ra=f("ZodBigInt",(t,e)=>{bi.init(t,e),q.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Pm(t,n,o,i),t.gte=(n,o)=>t.check(Ne(n,o)),t.min=(n,o)=>t.check(Ne(n,o)),t.gt=(n,o)=>t.check(Pt(n,o)),t.gte=(n,o)=>t.check(Ne(n,o)),t.min=(n,o)=>t.check(Ne(n,o)),t.lt=(n,o)=>t.check(It(n,o)),t.lte=(n,o)=>t.check(Ke(n,o)),t.max=(n,o)=>t.check(Ke(n,o)),t.positive=n=>t.check(Pt(BigInt(0),n)),t.negative=n=>t.check(It(BigInt(0),n)),t.nonpositive=n=>t.check(Ke(BigInt(0),n)),t.nonnegative=n=>t.check(Ne(BigInt(0),n)),t.multipleOf=(n,o)=>t.check(ur(n,o));let r=t._zod.bag;t.minValue=r.minimum??null,t.maxValue=r.maximum??null,t.format=r.format??null});function ux(t){return Uu(ra,t)}var Al=f("ZodBigIntFormat",(t,e)=>{Mc.init(t,e),ra.init(t,e)});function lx(t){return Cu(Al,t)}function dx(t){return Mu(Al,t)}var zh=f("ZodSymbol",(t,e)=>{Lc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Em(t,r,n,o)});function fx(t){return Lu(zh,t)}var Ih=f("ZodUndefined",(t,e)=>{qc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>jm(t,r,n,o)});function px(t){return qu(Ih,t)}var Ph=f("ZodNull",(t,e)=>{Vc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Om(t,r,n,o)});function po(t){return Vu(Ph,t)}var Eh=f("ZodAny",(t,e)=>{Fc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Rm(t,r,n,o)});function mx(){return Fu(Eh)}var Oh=f("ZodUnknown",(t,e)=>{Jc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Dm(t,r,n,o)});function ce(){return Ju(Oh)}var jh=f("ZodNever",(t,e)=>{Kc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Nm(t,r,n,o)});function Zl(t){return Ku(jh,t)}var Th=f("ZodVoid",(t,e)=>{Wc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Tm(t,r,n,o)});function hx(t){return Wu(Th,t)}var Ul=f("ZodDate",(t,e)=>{Hc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Am(t,n,o,i),t.min=(n,o)=>t.check(Ne(n,o)),t.max=(n,o)=>t.check(Ke(n,o));let r=t._zod.bag;t.minDate=r.minimum?new Date(r.minimum):null,t.maxDate=r.maximum?new Date(r.maximum):null});function gx(t){return Hu(Ul,t)}var Nh=f("ZodArray",(t,e)=>{Gc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Hm(t,r,n,o),t.element=e.element,t.min=(r,n)=>t.check(Jt(r,n)),t.nonempty=r=>t.check(Jt(1,r)),t.max=(r,n)=>t.check(Lr(r,n)),t.length=(r,n)=>t.check(qr(r,n)),t.unwrap=()=>t.element});function W(t,e){return km(Nh,t,e)}function vx(t){let e=t._zod.def.shape;return Ie(Object.keys(e))}var na=f("ZodObject",(t,e)=>{ym.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Gm(t,r,n,o),y.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Ie(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:ce()}),t.loose=()=>t.clone({...t._zod.def,catchall:ce()}),t.strict=()=>t.clone({...t._zod.def,catchall:Zl()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>y.extend(t,r),t.safeExtend=r=>y.safeExtend(t,r),t.merge=r=>y.merge(t,r),t.pick=r=>y.pick(t,r),t.omit=r=>y.omit(t,r),t.partial=(...r)=>y.partial(Ml,t,r[0]),t.required=(...r)=>y.required(Ll,t,r[0])});function z(t,e){let r={type:"object",shape:t??{},...y.normalizeParams(e)};return new na(r)}function _x(t,e){return new na({type:"object",shape:t,catchall:Zl(),...y.normalizeParams(e)})}function ze(t,e){return new na({type:"object",shape:t,catchall:ce(),...y.normalizeParams(e)})}var oa=f("ZodUnion",(t,e)=>{Kn.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>cl(t,r,n,o),t.options=e.options});function oe(t,e){return new oa({type:"union",options:t,...y.normalizeParams(e)})}var Rh=f("ZodXor",(t,e)=>{oa.init(t,e),Bc.init(t,e),t._zod.processJSONSchema=(r,n,o)=>cl(t,r,n,o),t.options=e.options});function yx(t,e){return new Rh({type:"union",options:t,inclusive:!1,...y.normalizeParams(e)})}var Dh=f("ZodDiscriminatedUnion",(t,e)=>{oa.init(t,e),Xc.init(t,e)});function ia(t,e,r){return new Dh({type:"union",options:e,discriminator:t,...y.normalizeParams(r)})}var Ah=f("ZodIntersection",(t,e)=>{Yc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Bm(t,r,n,o)});function mo(t,e){return new Ah({type:"intersection",left:t,right:e})}var Zh=f("ZodTuple",(t,e)=>{xi.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Xm(t,r,n,o),t.rest=r=>t.clone({...t._zod.def,rest:r})});function Uh(t,e,r){let n=e instanceof U,o=n?r:e,i=n?e:null;return new Zh({type:"tuple",items:t,rest:i,...y.normalizeParams(o)})}var aa=f("ZodRecord",(t,e)=>{Qc.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Ym(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function le(t,e,r){return new aa({type:"record",keyType:t,valueType:e,...y.normalizeParams(r)})}function $x(t,e,r){let n=Te(t);return n._zod.values=void 0,new aa({type:"record",keyType:n,valueType:e,...y.normalizeParams(r)})}function bx(t,e,r){return new aa({type:"record",keyType:t,valueType:e,mode:"loose",...y.normalizeParams(r)})}var Ch=f("ZodMap",(t,e)=>{eu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Km(t,r,n,o),t.keyType=e.keyType,t.valueType=e.valueType});function xx(t,e,r){return new Ch({type:"map",keyType:t,valueType:e,...y.normalizeParams(r)})}var Mh=f("ZodSet",(t,e)=>{tu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Wm(t,r,n,o),t.min=(...r)=>t.check(lr(...r)),t.nonempty=r=>t.check(lr(1,r)),t.max=(...r)=>t.check(Mr(...r)),t.size=(...r)=>t.check(Bn(...r))});function kx(t,e){return new Mh({type:"set",valueType:t,...y.normalizeParams(e)})}var lo=f("ZodEnum",(t,e)=>{ru.init(t,e),q.init(t,e),t._zod.processJSONSchema=(n,o,i)=>Zm(t,n,o,i),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new lo({...e,checks:[],...y.normalizeParams(o),entries:i})},t.exclude=(n,o)=>{let i={...e.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new lo({...e,checks:[],...y.normalizeParams(o),entries:i})}});function Ie(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new lo({type:"enum",entries:r,...y.normalizeParams(e)})}function Sx(t,e){return new lo({type:"enum",entries:t,...y.normalizeParams(e)})}var Lh=f("ZodLiteral",(t,e)=>{nu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Um(t,r,n,o),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function E(t,e){return new Lh({type:"literal",values:Array.isArray(t)?t:[t],...y.normalizeParams(e)})}var qh=f("ZodFile",(t,e)=>{ou.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Lm(t,r,n,o),t.min=(r,n)=>t.check(lr(r,n)),t.max=(r,n)=>t.check(Mr(r,n)),t.mime=(r,n)=>t.check(no(Array.isArray(r)?r:[r],n))});function wx(t){return tl(qh,t)}var Vh=f("ZodTransform",(t,e)=>{iu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Jm(t,r,n,o),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ir(t.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(y.issue(i,r.value,e));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=t),r.issues.push(y.issue(a))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Cl(t){return new Vh({type:"transform",transform:t})}var Ml=f("ZodOptional",(t,e)=>{au.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>sh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function fe(t){return new Ml({type:"optional",innerType:t})}var Fh=f("ZodNullable",(t,e)=>{su.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Qm(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Bi(t){return new Fh({type:"nullable",innerType:t})}function zx(t){return fe(Bi(t))}var Jh=f("ZodDefault",(t,e)=>{cu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>th(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Kh(t,e){return new Jh({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():y.shallowClone(e)}})}var Wh=f("ZodPrefault",(t,e)=>{uu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>rh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Hh(t,e){return new Wh({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():y.shallowClone(e)}})}var Ll=f("ZodNonOptional",(t,e)=>{lu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>eh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Gh(t,e){return new Ll({type:"nonoptional",innerType:t,...y.normalizeParams(e)})}var Bh=f("ZodSuccess",(t,e)=>{du.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>qm(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function Ix(t){return new Bh({type:"success",innerType:t})}var Xh=f("ZodCatch",(t,e)=>{fu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>nh(t,r,n,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Yh(t,e){return new Xh({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Qh=f("ZodNaN",(t,e)=>{pu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Cm(t,r,n,o)});function Px(t){return Gu(Qh,t)}var ql=f("ZodPipe",(t,e)=>{mu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>oh(t,r,n,o),t.in=e.in,t.out=e.out});function Xi(t,e){return new ql({type:"pipe",in:t,out:e})}var Vl=f("ZodCodec",(t,e)=>{ql.init(t,e),Wn.init(t,e)});function Ex(t,e,r){return new Vl({type:"pipe",in:t,out:e,transform:r.decode,reverseTransform:r.encode})}var eg=f("ZodReadonly",(t,e)=>{hu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ih(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function tg(t){return new eg({type:"readonly",innerType:t})}var rg=f("ZodTemplateLiteral",(t,e)=>{gu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Mm(t,r,n,o)});function Ox(t,e){return new rg({type:"template_literal",parts:t,...y.normalizeParams(e)})}var ng=f("ZodLazy",(t,e)=>{yu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ch(t,r,n,o),t.unwrap=()=>t._zod.def.getter()});function og(t){return new ng({type:"lazy",getter:t})}var ig=f("ZodPromise",(t,e)=>{_u.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>ah(t,r,n,o),t.unwrap=()=>t._zod.def.innerType});function jx(t){return new ig({type:"promise",innerType:t})}var ag=f("ZodFunction",(t,e)=>{vu.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Fm(t,r,n,o)});function Tx(t){return new ag({type:"function",input:Array.isArray(t?.input)?Uh(t?.input):t?.input??W(ce()),output:t?.output??ce()})}var sa=f("ZodCustom",(t,e)=>{$u.init(t,e),q.init(t,e),t._zod.processJSONSchema=(r,n,o)=>Vm(t,r,n,o)});function Nx(t){let e=new ae({check:"custom"});return e._zod.check=t,e}function Fl(t,e){return rl(sa,t??(()=>!0),e)}function sg(t,e={}){return nl(sa,t,e)}function cg(t){return ol(t)}var Rx=il,Dx=al;function Ax(t,e={error:`Input not instance of ${t.name}`}){let r=new sa({type:"custom",check:"custom",fn:n=>n instanceof t,abort:!0,...y.normalizeParams(e)});return r._zod.bag.Class=t,r}var Zx=(...t)=>sl({Codec:Vl,Boolean:ta,String:Yi},...t);function Ux(t){let e=og(()=>oe([h(t),re(),ve(),po(),W(e),le(h(),e)]));return e}function ca(t,e){return Xi(Cl(t),e)}var ug;ug||(ug={});var I4={...uo,...Hi,iso:dr};_e(bu());var Kl="2025-11-25";var lg=[Kl,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Wt="io.modelcontextprotocol/related-task",la="2.0",ye=Fl(t=>t!==null&&(typeof t=="object"||typeof t=="function")),dg=oe([h(),re().int()]),fg=h(),K4=ze({ttl:oe([re(),po()]).optional(),pollInterval:re().optional()}),qx=z({ttl:re().optional()}),Vx=z({taskId:h()}),Wl=ze({progressToken:dg.optional(),[Wt]:Vx.optional()}),He=z({_meta:Wl.optional()}),ho=He.extend({task:qx.optional()}),pg=t=>ho.safeParse(t).success,$e=z({method:h(),params:He.loose().optional()}),Ye=z({_meta:Wl.optional()}),Qe=z({method:h(),params:Ye.loose().optional()}),be=ze({_meta:Wl.optional()}),da=oe([h(),re().int()]),mg=z({jsonrpc:E(la),id:da,...$e.shape}).strict(),Hl=t=>mg.safeParse(t).success,hg=z({jsonrpc:E(la),...Qe.shape}).strict(),gg=t=>hg.safeParse(t).success,Gl=z({jsonrpc:E(la),id:da,result:be}).strict(),go=t=>Gl.safeParse(t).success;var X;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(X||(X={}));var Bl=z({jsonrpc:E(la),id:da.optional(),error:z({code:re().int(),message:h(),data:ce().optional()})}).strict();var vg=t=>Bl.safeParse(t).success;var _g=oe([mg,hg,Gl,Bl]),W4=oe([Gl,Bl]),fa=be.strict(),Fx=Ye.extend({requestId:da.optional(),reason:h().optional()}),pa=Qe.extend({method:E("notifications/cancelled"),params:Fx}),Jx=z({src:h(),mimeType:h().optional(),sizes:W(h()).optional(),theme:Ie(["light","dark"]).optional()}),vo=z({icons:W(Jx).optional()}),Kr=z({name:h(),title:h().optional()}),yg=Kr.extend({...Kr.shape,...vo.shape,version:h(),websiteUrl:h().optional(),description:h().optional()}),Kx=mo(z({applyDefaults:ve().optional()}),le(h(),ce())),Wx=ca(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,mo(z({form:Kx.optional(),url:ye.optional()}),le(h(),ce()).optional())),Hx=ze({list:ye.optional(),cancel:ye.optional(),requests:ze({sampling:ze({createMessage:ye.optional()}).optional(),elicitation:ze({create:ye.optional()}).optional()}).optional()}),Gx=ze({list:ye.optional(),cancel:ye.optional(),requests:ze({tools:ze({call:ye.optional()}).optional()}).optional()}),Bx=z({experimental:le(h(),ye).optional(),sampling:z({context:ye.optional(),tools:ye.optional()}).optional(),elicitation:Wx.optional(),roots:z({listChanged:ve().optional()}).optional(),tasks:Hx.optional()}),Xx=He.extend({protocolVersion:h(),capabilities:Bx,clientInfo:yg}),Xl=$e.extend({method:E("initialize"),params:Xx});var Yx=z({experimental:le(h(),ye).optional(),logging:ye.optional(),completions:ye.optional(),prompts:z({listChanged:ve().optional()}).optional(),resources:z({subscribe:ve().optional(),listChanged:ve().optional()}).optional(),tools:z({listChanged:ve().optional()}).optional(),tasks:Gx.optional()}),Qx=be.extend({protocolVersion:h(),capabilities:Yx,serverInfo:yg,instructions:h().optional()}),Yl=Qe.extend({method:E("notifications/initialized"),params:Ye.optional()});var ma=$e.extend({method:E("ping"),params:He.optional()}),ek=z({progress:re(),total:fe(re()),message:fe(h())}),tk=z({...Ye.shape,...ek.shape,progressToken:dg}),ha=Qe.extend({method:E("notifications/progress"),params:tk}),rk=He.extend({cursor:fg.optional()}),_o=$e.extend({params:rk.optional()}),yo=be.extend({nextCursor:fg.optional()}),nk=Ie(["working","input_required","completed","failed","cancelled"]),$o=z({taskId:h(),status:nk,ttl:oe([re(),po()]),createdAt:h(),lastUpdatedAt:h(),pollInterval:fe(re()),statusMessage:fe(h())}),Wr=be.extend({task:$o}),ok=Ye.merge($o),bo=Qe.extend({method:E("notifications/tasks/status"),params:ok}),ga=$e.extend({method:E("tasks/get"),params:He.extend({taskId:h()})}),va=be.merge($o),_a=$e.extend({method:E("tasks/result"),params:He.extend({taskId:h()})}),H4=be.loose(),ya=_o.extend({method:E("tasks/list")}),$a=yo.extend({tasks:W($o)}),ba=$e.extend({method:E("tasks/cancel"),params:He.extend({taskId:h()})}),$g=be.merge($o),bg=z({uri:h(),mimeType:fe(h()),_meta:le(h(),ce()).optional()}),xg=bg.extend({text:h()}),Ql=h().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),kg=bg.extend({blob:Ql}),xo=Ie(["user","assistant"]),Hr=z({audience:W(xo).optional(),priority:re().min(0).max(1).optional(),lastModified:dr.datetime({offset:!0}).optional()}),Sg=z({...Kr.shape,...vo.shape,uri:h(),description:fe(h()),mimeType:fe(h()),annotations:Hr.optional(),_meta:fe(ze({}))}),ik=z({...Kr.shape,...vo.shape,uriTemplate:h(),description:fe(h()),mimeType:fe(h()),annotations:Hr.optional(),_meta:fe(ze({}))}),ak=_o.extend({method:E("resources/list")}),sk=yo.extend({resources:W(Sg)}),ck=_o.extend({method:E("resources/templates/list")}),uk=yo.extend({resourceTemplates:W(ik)}),ed=He.extend({uri:h()}),lk=ed,dk=$e.extend({method:E("resources/read"),params:lk}),fk=be.extend({contents:W(oe([xg,kg]))}),pk=Qe.extend({method:E("notifications/resources/list_changed"),params:Ye.optional()}),mk=ed,hk=$e.extend({method:E("resources/subscribe"),params:mk}),gk=ed,vk=$e.extend({method:E("resources/unsubscribe"),params:gk}),_k=Ye.extend({uri:h()}),yk=Qe.extend({method:E("notifications/resources/updated"),params:_k}),$k=z({name:h(),description:fe(h()),required:fe(ve())}),bk=z({...Kr.shape,...vo.shape,description:fe(h()),arguments:fe(W($k)),_meta:fe(ze({}))}),xk=_o.extend({method:E("prompts/list")}),kk=yo.extend({prompts:W(bk)}),Sk=He.extend({name:h(),arguments:le(h(),h()).optional()}),wk=$e.extend({method:E("prompts/get"),params:Sk}),td=z({type:E("text"),text:h(),annotations:Hr.optional(),_meta:le(h(),ce()).optional()}),rd=z({type:E("image"),data:Ql,mimeType:h(),annotations:Hr.optional(),_meta:le(h(),ce()).optional()}),nd=z({type:E("audio"),data:Ql,mimeType:h(),annotations:Hr.optional(),_meta:le(h(),ce()).optional()}),zk=z({type:E("tool_use"),name:h(),id:h(),input:le(h(),ce()),_meta:le(h(),ce()).optional()}),Ik=z({type:E("resource"),resource:oe([xg,kg]),annotations:Hr.optional(),_meta:le(h(),ce()).optional()}),Pk=Sg.extend({type:E("resource_link")}),od=oe([td,rd,nd,Pk,Ik]),Ek=z({role:xo,content:od}),Ok=be.extend({description:h().optional(),messages:W(Ek)}),jk=Qe.extend({method:E("notifications/prompts/list_changed"),params:Ye.optional()}),Tk=z({title:h().optional(),readOnlyHint:ve().optional(),destructiveHint:ve().optional(),idempotentHint:ve().optional(),openWorldHint:ve().optional()}),Nk=z({taskSupport:Ie(["required","optional","forbidden"]).optional()}),wg=z({...Kr.shape,...vo.shape,description:h().optional(),inputSchema:z({type:E("object"),properties:le(h(),ye).optional(),required:W(h()).optional()}).catchall(ce()),outputSchema:z({type:E("object"),properties:le(h(),ye).optional(),required:W(h()).optional()}).catchall(ce()).optional(),annotations:Tk.optional(),execution:Nk.optional(),_meta:le(h(),ce()).optional()}),id=_o.extend({method:E("tools/list")}),Rk=yo.extend({tools:W(wg)}),xa=be.extend({content:W(od).default([]),structuredContent:le(h(),ce()).optional(),isError:ve().optional()}),G4=xa.or(be.extend({toolResult:ce()})),Dk=ho.extend({name:h(),arguments:le(h(),ce()).optional()}),ko=$e.extend({method:E("tools/call"),params:Dk}),Ak=Qe.extend({method:E("notifications/tools/list_changed"),params:Ye.optional()}),B4=z({autoRefresh:ve().default(!0),debounceMs:re().int().nonnegative().default(300)}),So=Ie(["debug","info","notice","warning","error","critical","alert","emergency"]),Zk=He.extend({level:So}),ad=$e.extend({method:E("logging/setLevel"),params:Zk}),Uk=Ye.extend({level:So,logger:h().optional(),data:ce()}),Ck=Qe.extend({method:E("notifications/message"),params:Uk}),Mk=z({name:h().optional()}),Lk=z({hints:W(Mk).optional(),costPriority:re().min(0).max(1).optional(),speedPriority:re().min(0).max(1).optional(),intelligencePriority:re().min(0).max(1).optional()}),qk=z({mode:Ie(["auto","required","none"]).optional()}),Vk=z({type:E("tool_result"),toolUseId:h().describe("The unique identifier for the corresponding tool call."),content:W(od).default([]),structuredContent:z({}).loose().optional(),isError:ve().optional(),_meta:le(h(),ce()).optional()}),Fk=ia("type",[td,rd,nd]),ua=ia("type",[td,rd,nd,zk,Vk]),Jk=z({role:xo,content:oe([ua,W(ua)]),_meta:le(h(),ce()).optional()}),Kk=ho.extend({messages:W(Jk),modelPreferences:Lk.optional(),systemPrompt:h().optional(),includeContext:Ie(["none","thisServer","allServers"]).optional(),temperature:re().optional(),maxTokens:re().int(),stopSequences:W(h()).optional(),metadata:ye.optional(),tools:W(wg).optional(),toolChoice:qk.optional()}),Wk=$e.extend({method:E("sampling/createMessage"),params:Kk}),sd=be.extend({model:h(),stopReason:fe(Ie(["endTurn","stopSequence","maxTokens"]).or(h())),role:xo,content:Fk}),cd=be.extend({model:h(),stopReason:fe(Ie(["endTurn","stopSequence","maxTokens","toolUse"]).or(h())),role:xo,content:oe([ua,W(ua)])}),Hk=z({type:E("boolean"),title:h().optional(),description:h().optional(),default:ve().optional()}),Gk=z({type:E("string"),title:h().optional(),description:h().optional(),minLength:re().optional(),maxLength:re().optional(),format:Ie(["email","uri","date","date-time"]).optional(),default:h().optional()}),Bk=z({type:Ie(["number","integer"]),title:h().optional(),description:h().optional(),minimum:re().optional(),maximum:re().optional(),default:re().optional()}),Xk=z({type:E("string"),title:h().optional(),description:h().optional(),enum:W(h()),default:h().optional()}),Yk=z({type:E("string"),title:h().optional(),description:h().optional(),oneOf:W(z({const:h(),title:h()})),default:h().optional()}),Qk=z({type:E("string"),title:h().optional(),description:h().optional(),enum:W(h()),enumNames:W(h()).optional(),default:h().optional()}),eS=oe([Xk,Yk]),tS=z({type:E("array"),title:h().optional(),description:h().optional(),minItems:re().optional(),maxItems:re().optional(),items:z({type:E("string"),enum:W(h())}),default:W(h()).optional()}),rS=z({type:E("array"),title:h().optional(),description:h().optional(),minItems:re().optional(),maxItems:re().optional(),items:z({anyOf:W(z({const:h(),title:h()}))}),default:W(h()).optional()}),nS=oe([tS,rS]),oS=oe([Qk,eS,nS]),iS=oe([oS,Hk,Gk,Bk]),aS=ho.extend({mode:E("form").optional(),message:h(),requestedSchema:z({type:E("object"),properties:le(h(),iS),required:W(h()).optional()})}),sS=ho.extend({mode:E("url"),message:h(),elicitationId:h(),url:h().url()}),cS=oe([aS,sS]),uS=$e.extend({method:E("elicitation/create"),params:cS}),lS=Ye.extend({elicitationId:h()}),dS=Qe.extend({method:E("notifications/elicitation/complete"),params:lS}),ka=be.extend({action:Ie(["accept","decline","cancel"]),content:ca(t=>t===null?void 0:t,le(h(),oe([h(),re(),ve(),W(h())])).optional())}),fS=z({type:E("ref/resource"),uri:h()});var pS=z({type:E("ref/prompt"),name:h()}),mS=He.extend({ref:oe([pS,fS]),argument:z({name:h(),value:h()}),context:z({arguments:le(h(),h()).optional()}).optional()}),hS=$e.extend({method:E("completion/complete"),params:mS});var gS=be.extend({completion:ze({values:W(h()).max(100),total:fe(re().int()),hasMore:fe(ve())})}),vS=z({uri:h().startsWith("file://"),name:h().optional(),_meta:le(h(),ce()).optional()}),_S=$e.extend({method:E("roots/list"),params:He.optional()}),ud=be.extend({roots:W(vS)}),yS=Qe.extend({method:E("notifications/roots/list_changed"),params:Ye.optional()}),X4=oe([ma,Xl,hS,ad,wk,xk,ak,ck,dk,hk,vk,ko,id,ga,_a,ya,ba]),Y4=oe([pa,ha,Yl,yS,bo]),Q4=oe([fa,sd,cd,ka,ud,va,$a,Wr]),e1=oe([ma,Wk,uS,_S,ga,_a,ya,ba]),t1=oe([pa,ha,Ck,yk,pk,Ak,jk,bo,dS]),r1=oe([fa,Qx,gS,Ok,kk,sk,uk,fk,xa,Rk,va,$a,Wr]),V=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError"}static fromError(e,r,n){if(e===X.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Jl(o.elicitations,r)}return new t(e,r,n)}},Jl=class extends V{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(X.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function Ht(t){return t==="completed"||t==="failed"||t==="cancelled"}var $S=Symbol("Let zodToJsonSchema decide on which parser to use");var A1=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ld(t){let r=Wi(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=dh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function dd(t,e){let r=Kt(t,e);if(!r.success)throw r.error;return r.data}var zS=6e4,Sa=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(pa,r=>{this._oncancel(r)}),this.setNotificationHandler(ha,r=>{this._onprogress(r)}),this.setRequestHandler(ma,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(ga,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new V(X.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(_a,async(r,n)=>{let o=async()=>{let i=r.params.taskId;if(this._taskMessageQueue){let s;for(;s=await this._taskMessageQueue.dequeue(i,n.sessionId);){if(s.type==="response"||s.type==="error"){let c=s.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),s.type==="response")l(c);else{let d=c,p=new V(d.error.code,d.error.message,d.error.data);l(p)}else{let d=s.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(s.message,{relatedRequestId:n.requestId})}}let a=await this._taskStore.getTask(i,n.sessionId);if(!a)throw new V(X.InvalidParams,`Task not found: ${i}`);if(!Ht(a.status))return await this._waitForTaskUpdate(i,n.signal),await o();if(Ht(a.status)){let s=await this._taskStore.getTaskResult(i,n.sessionId);return this._clearTaskQueue(i),{...s,_meta:{...s._meta,[Wt]:{taskId:i}}}}return await o()};return await o()}),this.setRequestHandler(ya,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 V(X.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ba,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new V(X.InvalidParams,`Task not found: ${r.params.taskId}`);if(Ht(o.status))throw new V(X.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 V(X.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...i}}catch(o){throw o instanceof V?o:new V(X.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,r,n,o,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:o})}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return!1;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),V.fromError(X.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),!0}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=i=>{n?.(i),this._onerror(i)};let o=this._transport?.onmessage;this._transport.onmessage=(i,a)=>{o?.(i,a),go(i)||vg(i)?this._onresponse(i):Hl(i)?this._onrequest(i,a):gg(i)?this._onnotification(i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(i)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=V.fromError(X.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r)}_onerror(e){this.onerror?.(e)}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)))}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,i=e.params?._meta?.[Wt]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:X.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(e.id,a);let s=pg(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:a.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{let d={relatedRequestId:e.id};i&&(d.relatedTask={taskId:i}),await this.notification(l,d)},sendRequest:async(l,d,p)=>{let m={...p,relatedRequestId:e.id};i&&!m.relatedTask&&(m.relatedTask={taskId:i});let g=m.relatedTask?.taskId??i;return g&&c&&await c.updateTaskStatus(g,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:i,taskStore:c,taskRequestedTtl:s?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{s&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(a.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.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:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:X.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(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),i=this._progressHandlers.get(o);if(!i){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(o),s=this._timeoutInfo.get(o);if(s&&a&&s.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),a(c);return}i(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),go(e))n(e);else{let a=new V(e.error.code,e.error.message,e.error.data);n(a)}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let i=!1;if(go(e)&&e.result&&typeof e.result=="object"){let a=e.result;if(a.task&&typeof a.task=="object"){let s=a.task;typeof s.taskId=="string"&&(i=!0,this._taskProgressTokens.set(s.taskId,r))}}if(i||this._progressHandlers.delete(r),go(e))o(e);else{let a=V.fromError(e.error.code,e.error.message,e.error.data);o(a)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield{type:"result",result:await this.request(e,r,n)}}catch(a){yield{type:"error",error:a instanceof V?a:new V(X.InternalError,String(a))}}return}let i;try{let a=await this.request(e,Wr,n);if(a.task)i=a.task.taskId,yield{type:"taskCreated",task:a.task};else throw new V(X.InternalError,"Task creation did not return a task");for(;;){let s=await this.getTask({taskId:i},n);if(yield{type:"taskStatus",task:s},Ht(s.status)){s.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:i},r,n)}:s.status==="failed"?yield{type:"error",error:new V(X.InternalError,`Task ${i} failed`)}:s.status==="cancelled"&&(yield{type:"error",error:new V(X.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 V?a:new V(X.InternalError,String(a))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,task:s,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=j=>{l(j)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),s&&this.assertTaskCapability(e.method)}catch(j){d(j);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),s&&(m.params={...m.params,task:s}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Wt]:c}});let g=j=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(j)}},{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(C=>this._onerror(new Error(`Failed to send cancellation: ${C}`)));let P=j instanceof V?j:new V(X.RequestTimeout,String(j));l(P)};this._responseHandlers.set(p,j=>{if(!n?.signal?.aborted){if(j instanceof Error)return l(j);try{let P=Kt(r,j.result);P.success?u(P.data):l(P.error)}catch(P){l(P)}}}),n?.signal?.addEventListener("abort",()=>{g(n?.signal?.reason)});let v=n?.timeout??zS,$=()=>g(V.fromError(X.RequestTimeout,"Request timed out",{timeout:v}));this._setupTimeout(p,v,n?.maxTotalTimeout,$,n?.resetTimeoutOnProgress??!1);let x=c?.taskId;if(x){let j=P=>{let C=this._responseHandlers.get(p);C?C(P):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,j),this._enqueueTaskMessage(x,{type:"request",message:m,timestamp:Date.now()}).catch(P=>{this._cleanupTimeout(p),l(P)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(j=>{this._cleanupTimeout(p),l(j)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},va,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},$a,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},$g,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let s={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Wt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:s,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let s={...e,jsonrpc:"2.0"};r?.relatedTask&&(s={...s,params:{...s.params,_meta:{...s.params?._meta||{},[Wt]:r.relatedTask}}}),this._transport?.send(s,r).catch(c=>this._onerror(c))});return}let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Wt]:r.relatedTask}}}),await this._transport.send(a,r)}setRequestHandler(e,r){let n=ld(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,i)=>{let a=dd(e,o);return Promise.resolve(r(a,i))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,r){let n=ld(e);this._notificationHandlers.set(n,o=>{let i=dd(e,o);return Promise.resolve(r(i))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o)}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&Hl(o.message)){let i=o.message.id,a=this._requestResolvers.get(i);a?(a(new V(X.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(i)):this._onerror(new Error(`Resolver missing for request ${i} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval)}catch{}return new Promise((o,i)=>{if(r.aborted){i(new V(X.InvalidRequest,"Request cancelled"));return}let a=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(a),i(new V(X.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return{createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let i=await n.getTask(o,r);if(!i)throw new V(X.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=bo.parse({method:"notifications/tasks/status",params:s});await this.notification(c),Ht(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 V(X.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(Ht(s.status))throw new V(X.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=bo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),Ht(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function zg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Ig(t,e){let r={...t};for(let n in e){let o=n,i=e[o];if(i===void 0)continue;let a=r[o];zg(a)&&zg(i)?r[o]={...a,...i}:r[o]=i}return r}var py=ni(Xf(),1),my=ni(fy(),1);function gE(){let t=new py.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,my.default)(t),t}var ss=class{constructor(e){this._ajv=e??gE()}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};var cs=class{constructor(e){this._server=e}requestStream(e,r,n){return this._server.requestStream(e,r,n)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};function hy(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;default:break}}function gy(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;default:break}}var us=class extends Sa{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(So.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 ss,this.setRequestHandler(Xl,n=>this._oninitialize(n)),this.setNotificationHandler(Yl,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(ad,async(n,o)=>{let i=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=n.params,s=So.safeParse(a);return s.success&&this._loggingLevels.set(i,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new cs(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ig(this._capabilities,e)}setRequestHandler(e,r){let o=Wi(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let i;if(Fr(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=Kt(ko,c);if(!l.success){let g=l.error instanceof Error?l.error.message:String(l.error);throw new V(X.InvalidParams,`Invalid tools/call request: ${g}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let g=Kt(Wr,p);if(!g.success){let v=g.error instanceof Error?g.error.message:String(g.error);throw new V(X.InvalidParams,`Invalid task creation result: ${v}`)}return g.data}let m=Kt(xa,p);if(!m.success){let g=m.error instanceof Error?m.error.message:String(m.error);throw new V(X.InvalidParams,`Invalid tools/call result: ${g}`)}return m.data};return super.setRequestHandler(e,s)}return super.setRequestHandler(e,r)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);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 ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);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 ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);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 ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){gy(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&hy(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:lg.includes(r)?r:Kl,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"},fa)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],i=o.some(u=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.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 e.tools?this.request({method:"sampling/createMessage",params:e},cd,r):this.request({method:"sampling/createMessage",params:e},sd,r)}async elicitInput(e,r){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},ka,r)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},i=await this.request({method:"elicitation/create",params:o},ka,r);if(i.action==="accept"&&i.content&&o.requestedSchema)try{let s=this._jsonSchemaValidator.getValidator(o.requestedSchema)(i.content);if(!s.valid)throw new V(X.InvalidParams,`Elicitation response content does not match requested schema: ${s.errorMessage}`)}catch(a){throw a instanceof V?a:new V(X.InternalError,`Error validating elicitation response: ${a instanceof Error?a.message:String(a)}`)}return i}}}createElicitationCompletionNotifier(e,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:e}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},ud,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}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 ip=ni(require("node:process"),1);var ls=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),vE(r)}clear(){this._buffer=void 0}};function vE(t){return _g.parse(JSON.parse(t))}function vy(t){return JSON.stringify(t)+`
`}var ds=class{constructor(e=ip.default.stdin,r=ip.default.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new ls,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 e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}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(e){return new Promise(r=>{let n=vy(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var fn=require("fs"),$y=require("path"),by=require("os");var _y="bugfix,feature,refactor,discovery,decision,change",yy="how-it-works,why-it-exists,what-changed,problem-solution,gotcha,pattern,trade-off";var At=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_PROVIDER:"claude",CLAUDE_MEM_GEMINI_API_KEY:"",CLAUDE_MEM_GEMINI_MODEL:"gemini-2.5-flash-lite",CLAUDE_MEM_GEMINI_RATE_LIMITING_ENABLED:"true",CLAUDE_MEM_OPENROUTER_API_KEY:"",CLAUDE_MEM_OPENROUTER_MODEL:"anthropic/claude-3.5-sonnet",CLAUDE_MEM_OPENROUTER_SITE_URL:"",CLAUDE_MEM_OPENROUTER_APP_NAME:"claude-mem",CLAUDE_MEM_DATA_DIR:(0,$y.join)((0,by.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_MODE:"code",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:_y,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:yy,CLAUDE_MEM_CONTEXT_FULL_COUNT:"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return this.DEFAULTS[e]}static getInt(e){let r=this.get(e);return parseInt(r,10)}static getBool(e){return this.get(e)==="true"}static loadFromFile(e){try{if(!(0,fn.existsSync)(e))return this.getAllDefaults();let r=(0,fn.readFileSync)(e,"utf-8"),n=JSON.parse(r),o=n;if(n.env&&typeof n.env=="object"){o=n.env;try{(0,fn.writeFileSync)(e,JSON.stringify(o,null,2),"utf-8"),he.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(a){he.warn("SETTINGS","Failed to auto-migrate settings file",{settingsPath:e},a)}}let i={...this.DEFAULTS};for(let a of Object.keys(this.DEFAULTS))o[a]!==void 0&&(i[a]=o[a]);return i}catch(r){return he.warn("SETTINGS","Failed to load settings, using defaults",{settingsPath:e},r),this.getAllDefaults()}}};var ap=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.SILENT=4]="SILENT",i))(ap||{}),sp=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=At.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=ap[e]??1}return this.level}correlationId(e,r){return`obs-${e}-${r}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message}
${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let r=Object.keys(e);return r.length===0?"{}":r.length<=3?JSON.stringify(e):`{${r.length} keys: ${r.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,r){if(!r)return e;let n=typeof r=="string"?JSON.parse(r):r;if(e==="Bash"&&n.command)return`${e}(${n.command})`;if(n.file_path)return`${e}(${n.file_path})`;if(n.notebook_path)return`${e}(${n.notebook_path})`;if(e==="Glob"&&n.pattern)return`${e}(${n.pattern})`;if(e==="Grep"&&n.pattern)return`${e}(${n.pattern})`;if(n.url)return`${e}(${n.url})`;if(n.query)return`${e}(${n.query})`;if(e==="Task"){if(n.subagent_type)return`${e}(${n.subagent_type})`;if(n.description)return`${e}(${n.description})`}return e==="Skill"&&n.skill?`${e}(${n.skill})`:e==="LSP"&&n.operation?`${e}(${n.operation})`:e}formatTimestamp(e){let r=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),s=String(e.getSeconds()).padStart(2,"0"),c=String(e.getMilliseconds()).padStart(3,"0");return`${r}-${n}-${o} ${i}:${a}:${s}.${c}`}log(e,r,n,o,i){if(e<this.getLevel())return;let a=this.formatTimestamp(new Date),s=ap[e].padEnd(5),c=r.padEnd(6),u="";o?.correlationId?u=`[${o.correlationId}] `:o?.sessionId&&(u=`[session-${o.sessionId}] `);let l="";i!=null&&(this.getLevel()===0&&typeof i=="object"?l=`
`+JSON.stringify(i,null,2):l=" "+this.formatData(i));let d="";if(o){let{sessionId:m,sdkSessionId:g,correlationId:v,...$}=o;Object.keys($).length>0&&(d=` {${Object.entries($).map(([j,P])=>`${j}=${P}`).join(", ")}}`)}let p=`[${a}] [${s}] [${c}] ${u}${n}${d}${l}`;e===3?console.error(p):console.log(p)}debug(e,r,n,o){this.log(0,e,r,n,o)}info(e,r,n,o){this.log(1,e,r,n,o)}warn(e,r,n,o){this.log(2,e,r,n,o)}error(e,r,n,o){this.log(3,e,r,n,o)}dataIn(e,r,n,o){this.info(e,`\u2192 ${r}`,n,o)}dataOut(e,r,n,o){this.info(e,`\u2190 ${r}`,n,o)}success(e,r,n,o){this.info(e,`\u2713 ${r}`,n,o)}failure(e,r,n,o){this.error(e,`\u2717 ${r}`,n,o)}timing(e,r,n,o){this.info(e,`\u23F1 ${r}`,o,{duration:`${n}ms`})}happyPathError(e,r,n,o,i=""){let u=((new Error().stack||"").split(`
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),l=u?`${u[1].split("/").pop()}:${u[2]}`:"unknown",d={...n,location:l};return this.warn(e,`[HAPPY-PATH] ${r}`,d,o),i}},he=new sp;var ms=ni(require("path"),1),ky=require("os");var cp={DEFAULT:12e4,HEALTH_CHECK:1e3,WORKER_STARTUP_WAIT:1e3,WORKER_STARTUP_RETRIES:15,PRE_RESTART_SETTLE_DELAY:2e3,WINDOWS_MULTIPLIER:1.5};function xy(t){return process.platform==="win32"?Math.round(t*cp.WINDOWS_MULTIPLIER):t}var SU=ms.default.join((0,ky.homedir)(),".claude","plugins","marketplaces","thedotmack"),wU=xy(cp.HEALTH_CHECK),fs=null,ps=null;function Sy(){if(fs!==null)return fs;let t=ms.default.join(At.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=At.loadFromFile(t);return fs=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),fs}function wy(){if(ps!==null)return ps;let t=ms.default.join(At.get("CLAUDE_MEM_DATA_DIR"),"settings.json");return ps=At.loadFromFile(t).CLAUDE_MEM_WORKER_HOST,ps}console.log=(...t)=>console.error(...t);var _E=Sy(),yE=wy(),pn=`http://${yE}:${_E}`,ti={search:"/api/search",timeline:"/api/timeline",get_recent_context:"/api/context/recent",get_context_timeline:"/api/context/timeline",help:"/api/instructions"},up={search:{query:{type:"string",description:"Full-text search query"},type:{type:"string",description:"Filter by type: tool_use, tool_result, prompt, summary"},obs_type:{type:"string",description:"Observation type filter"},concepts:{type:"string",description:"Comma-separated concept tags"},files:{type:"string",description:"Comma-separated file paths"},project:{type:"string",description:"Project name filter"},dateStart:{type:["string","number"],description:"Start date (ISO or timestamp)"},dateEnd:{type:["string","number"],description:"End date (ISO or timestamp)"},limit:{type:"number",description:"Max results (default: 10)"},offset:{type:"number",description:"Result offset for pagination"},orderBy:{type:"string",description:"Sort order: created_at, relevance"}},timeline:{query:{type:"string",description:"Search query to find anchor point"},anchor:{type:"number",description:"Observation ID as timeline center"},depth_before:{type:"number",description:"Observations before anchor (default: 5)"},depth_after:{type:"number",description:"Observations after anchor (default: 5)"},type:{type:"string",description:"Filter by type"},concepts:{type:"string",description:"Comma-separated concept tags"},files:{type:"string",description:"Comma-separated file paths"},project:{type:"string",description:"Project name filter"}},get_recent_context:{limit:{type:"number",description:"Max results (default: 20)"},type:{type:"string",description:"Filter by type"},concepts:{type:"string",description:"Comma-separated concept tags"},files:{type:"string",description:"Comma-separated file paths"},project:{type:"string",description:"Project name filter"},dateStart:{type:["string","number"],description:"Start date"},dateEnd:{type:["string","number"],description:"End date"}},get_context_timeline:{anchor:{type:"number",description:"Observation ID (required)",required:!0},depth_before:{type:"number",description:"Observations before anchor"},depth_after:{type:"number",description:"Observations after anchor"},type:{type:"string",description:"Filter by type"},concepts:{type:"string",description:"Comma-separated concept tags"},files:{type:"string",description:"Comma-separated file paths"},project:{type:"string",description:"Project name filter"}},get_observations:{ids:{type:"array",items:{type:"number"},description:"Array of observation IDs (required)",required:!0},orderBy:{type:"string",description:"Sort order"},limit:{type:"number",description:"Max results"},project:{type:"string",description:"Project filter"}},help:{operation:{type:"string",description:'Operation type: "observations", "timeline", "sessions", etc.'},topic:{type:"string",description:"Specific topic for help"}},get_observation:{id:{type:"number",description:"Observation ID (required)",required:!0}},get_session:{id:{type:"number",description:"Session ID (required)",required:!0}},get_prompt:{id:{type:"number",description:"Prompt ID (required)",required:!0}}};async function ri(t,e){he.debug("SYSTEM","\u2192 Worker API",void 0,{endpoint:t,params:e});try{let r=new URLSearchParams;for(let[a,s]of Object.entries(e))s!=null&&r.append(a,String(s));let n=`${pn}${t}?${r}`,o=await fetch(n);if(!o.ok){let a=await o.text();throw new Error(`Worker API error (${o.status}): ${a}`)}let i=await o.json();return he.debug("SYSTEM","\u2190 Worker API success",void 0,{endpoint:t}),i}catch(r){return he.error("SYSTEM","\u2190 Worker API error",void 0,{endpoint:t,error:r.message}),{content:[{type:"text",text:`Error calling Worker API: ${r.message}`}],isError:!0}}}async function lp(t,e){he.debug("HTTP","Worker API request (path)",void 0,{endpoint:t,id:e});try{let r=`${pn}${t}/${e}`,n=await fetch(r);if(!n.ok){let i=await n.text();throw new Error(`Worker API error (${n.status}): ${i}`)}let o=await n.json();return he.debug("HTTP","Worker API success (path)",void 0,{endpoint:t,id:e}),{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(r){return he.error("HTTP","Worker API error (path)",void 0,{endpoint:t,id:e,error:r.message}),{content:[{type:"text",text:`Error calling Worker API: ${r.message}`}],isError:!0}}}async function $E(t,e){he.debug("HTTP","Worker API request (POST)",void 0,{endpoint:t});try{let r=`${pn}${t}`,n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok){let i=await n.text();throw new Error(`Worker API error (${n.status}): ${i}`)}let o=await n.json();return he.debug("HTTP","Worker API success (POST)",void 0,{endpoint:t}),{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}catch(r){return he.error("HTTP","Worker API error (POST)",void 0,{endpoint:t,error:r.message}),{content:[{type:"text",text:`Error calling Worker API: ${r.message}`}],isError:!0}}}async function bE(){try{return(await fetch(`${pn}/api/health`)).ok}catch{return!1}}var zy=[{name:"get_schema",description:"Get parameter schema for a tool. Call get_schema(tool_name) for details",inputSchema:{type:"object",properties:{tool_name:{type:"string"}},required:["tool_name"]},handler:async t=>{let e=t.tool_name;if(typeof e!="string"||!Object.hasOwn(up,e))return{content:[{type:"text",text:`Unknown tool: ${e}
Available tools: ${Object.keys(up).join(", ")}`}],isError:!0};let r=up[e];return{content:[{type:"text",text:`# ${e} Parameters
${JSON.stringify(r,null,2)}`}]}}},{name:"search",description:'Search memory. All parameters optional - call get_schema("search") for details',inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async t=>{let e=ti.search;return await ri(e,t)}},{name:"timeline",description:'Timeline context. All parameters optional - call get_schema("timeline") for details',inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async t=>{let e=ti.timeline;return await ri(e,t)}},{name:"get_recent_context",description:'Recent context. All parameters optional - call get_schema("get_recent_context") for details',inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async t=>{let e=ti.get_recent_context;return await ri(e,t)}},{name:"get_context_timeline",description:"Timeline around observation ID",inputSchema:{type:"object",properties:{anchor:{type:"number",description:'Observation ID (required). Optional params: get_schema("get_context_timeline")'}},required:["anchor"],additionalProperties:!0},handler:async t=>{let e=ti.get_context_timeline;return await ri(e,t)}},{name:"help",description:'Get detailed docs. All parameters optional - call get_schema("help") for details',inputSchema:{type:"object",properties:{},additionalProperties:!0},handler:async t=>{let e=ti.help;return await ri(e,t)}},{name:"get_observation",description:"Fetch observation by ID",inputSchema:{type:"object",properties:{id:{type:"number",description:"Observation ID (required)"}},required:["id"]},handler:async t=>await lp("/api/observation",t.id)},{name:"get_observations",description:"Batch fetch observations",inputSchema:{type:"object",properties:{ids:{type:"array",items:{type:"number"},description:'Array of observation IDs (required). Optional params: get_schema("get_observations")'}},required:["ids"],additionalProperties:!0},handler:async t=>await $E("/api/observations/batch",t)},{name:"get_session",description:"Fetch session by ID",inputSchema:{type:"object",properties:{id:{type:"number",description:"Session ID (required)"}},required:["id"]},handler:async t=>await lp("/api/session",t.id)},{name:"get_prompt",description:"Fetch prompt by ID",inputSchema:{type:"object",properties:{id:{type:"number",description:"Prompt ID (required)"}},required:["id"]},handler:async t=>await lp("/api/prompt",t.id)}],dp=new us({name:"mem-search-server",version:"1.0.0"},{capabilities:{tools:{}}});dp.setRequestHandler(id,async()=>({tools:zy.map(t=>({name:t.name,description:t.description,inputSchema:t.inputSchema}))}));dp.setRequestHandler(ko,async t=>{let e=zy.find(r=>r.name===t.params.name);if(!e)throw new Error(`Unknown tool: ${t.params.name}`);try{return await e.handler(t.params.arguments||{})}catch(r){return{content:[{type:"text",text:`Tool execution failed: ${r.message}`}],isError:!0}}});async function Iy(){he.info("SYSTEM","MCP server shutting down"),process.exit(0)}process.on("SIGTERM",Iy);process.on("SIGINT",Iy);async function xE(){let t=new ds;await dp.connect(t),he.info("SYSTEM","Claude-mem search server started"),setTimeout(async()=>{await bE()?he.info("SYSTEM","Worker available",void 0,{workerUrl:pn}):(he.warn("SYSTEM","Worker not available",void 0,{workerUrl:pn}),he.warn("SYSTEM","Tools will fail until Worker is started"),he.warn("SYSTEM","Start Worker with: claude-mem restart"))},0)}xE().catch(t=>{he.error("SYSTEM","Fatal error",void 0,t),process.exit(1)});