mcp-feedback-enhanced 1.2.10 → 1.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{createRequire}from'module';const require=createRequire(import.meta.url);
|
|
3
|
-
var gv=Object.create;var sa=Object.defineProperty;var _v=Object.getOwnPropertyDescriptor;var yv=Object.getOwnPropertyNames;var vv=Object.getPrototypeOf,bv=Object.prototype.hasOwnProperty;var _e=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var k=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),uf=(t,e)=>{for(var r in e)sa(t,r,{get:e[r],enumerable:!0})},xv=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of yv(e))!bv.call(t,o)&&o!==r&&sa(t,o,{get:()=>e[o],enumerable:!(n=_v(e,o))||n.enumerable});return t};var mr=(t,e,r)=>(r=t!=null?gv(vv(t)):{},xv(e||!t||!t.__esModule?sa(r,"default",{value:t,enumerable:!0}):r,t));var _o=k(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.regexpCode=X.getEsmExportName=X.getProperty=X.safeStringify=X.stringify=X.strConcat=X.addCodeArg=X.str=X._=X.nil=X._Code=X.Name=X.IDENTIFIER=X._CodeOrName=void 0;var ho=class{};X._CodeOrName=ho;X.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var kr=class extends ho{constructor(e){if(super(),!X.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}}};X.Name=kr;var rt=class extends ho{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 kr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};X._Code=rt;X.nil=new rt("");function eh(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Hu(r,e[n]),r.push(t[++n]);return new rt(r)}X._=eh;var Bu=new rt("+");function th(t,...e){let r=[go(t[0])],n=0;for(;n<e.length;)r.push(Bu),Hu(r,e[n]),r.push(Bu,go(t[++n]));return Nw(r),new rt(r)}X.str=th;function Hu(t,e){e instanceof rt?t.push(...e._items):e instanceof kr?t.push(e):t.push(jw(e))}X.addCodeArg=Hu;function Nw(t){let e=1;for(;e<t.length-1;){if(t[e]===Bu){let r=Cw(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Cw(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof kr||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 kr))return`"${t}${e.slice(1)}`}function Zw(t,e){return e.emptyStr()?t:t.emptyStr()?e:th`${t}${e}`}X.strConcat=Zw;function jw(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:go(Array.isArray(t)?t.join(","):t)}function Mw(t){return new rt(go(t))}X.stringify=Mw;function go(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}X.safeStringify=go;function Aw(t){return typeof t=="string"&&X.IDENTIFIER.test(t)?new rt(`.${t}`):eh`[${t}]`}X.getProperty=Aw;function Dw(t){if(typeof t=="string"&&X.IDENTIFIER.test(t))return new rt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}X.getEsmExportName=Dw;function qw(t){return new rt(t.toString())}X.regexpCode=qw});var Ku=k(Ue=>{"use strict";Object.defineProperty(Ue,"__esModule",{value:!0});Ue.ValueScope=Ue.ValueScopeName=Ue.Scope=Ue.varKinds=Ue.UsedValueState=void 0;var Le=_o(),Wu=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qs;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qs||(Ue.UsedValueState=Qs={}));Ue.varKinds={const:new Le.Name("const"),let:new Le.Name("let"),var:new Le.Name("var")};var ei=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Le.Name?e:this.name(e)}name(e){return new Le.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}}};Ue.Scope=ei;var ti=class extends Le.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Le._)`.${new Le.Name(r)}[${n}]`}};Ue.ValueScopeName=ti;var Lw=(0,Le._)`\n`,Gu=class extends ei{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Lw:Le.nil}}get(){return this._scope}name(e){return new ti(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:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,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,Le._)`${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 s=Le.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qs.Started);let l=r(u);if(l){let d=this.opts.es5?Ue.varKinds.var:Ue.varKinds.const;s=(0,Le._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Le._)`${s}${l}${this.opts._n}`;else throw new Wu(u);c.set(u,Qs.Completed)})}return s}};Ue.ValueScope=Gu});var U=k(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.or=V.and=V.not=V.CodeGen=V.operators=V.varKinds=V.ValueScopeName=V.ValueScope=V.Scope=V.Name=V.regexpCode=V.stringify=V.getProperty=V.nil=V.strConcat=V.str=V._=void 0;var J=_o(),ft=Ku(),tr=_o();Object.defineProperty(V,"_",{enumerable:!0,get:function(){return tr._}});Object.defineProperty(V,"str",{enumerable:!0,get:function(){return tr.str}});Object.defineProperty(V,"strConcat",{enumerable:!0,get:function(){return tr.strConcat}});Object.defineProperty(V,"nil",{enumerable:!0,get:function(){return tr.nil}});Object.defineProperty(V,"getProperty",{enumerable:!0,get:function(){return tr.getProperty}});Object.defineProperty(V,"stringify",{enumerable:!0,get:function(){return tr.stringify}});Object.defineProperty(V,"regexpCode",{enumerable:!0,get:function(){return tr.regexpCode}});Object.defineProperty(V,"Name",{enumerable:!0,get:function(){return tr.Name}});var si=Ku();Object.defineProperty(V,"Scope",{enumerable:!0,get:function(){return si.Scope}});Object.defineProperty(V,"ValueScope",{enumerable:!0,get:function(){return si.ValueScope}});Object.defineProperty(V,"ValueScopeName",{enumerable:!0,get:function(){return si.ValueScopeName}});Object.defineProperty(V,"varKinds",{enumerable:!0,get:function(){return si.varKinds}});V.operators={GT:new J._Code(">"),GTE:new J._Code(">="),LT:new J._Code("<"),LTE:new J._Code("<="),EQ:new J._Code("==="),NEQ:new J._Code("!=="),NOT:new J._Code("!"),OR:new J._Code("||"),AND:new J._Code("&&"),ADD:new J._Code("+")};var Zt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Ju=class extends Zt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ft.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=ln(this.rhs,e,r)),this}get names(){return this.rhs instanceof J._CodeOrName?this.rhs.names:{}}},ri=class extends Zt{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 J.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ln(this.rhs,e,r),this}get names(){let e=this.lhs instanceof J.Name?{}:{...this.lhs.names};return oi(e,this.rhs)}},Yu=class extends ri{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Xu=class extends Zt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Qu=class extends Zt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},el=class extends Zt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},tl=class extends Zt{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=ln(this.code,e,r),this}get names(){return this.code instanceof J._CodeOrName?this.code.names:{}}},yo=class extends Zt{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 s=n[o];s.optimizeNames(e,r)||(Uw(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Er(e,r.names),{})}},jt=class extends yo{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},rl=class extends yo{},un=class extends jt{};un.kind="else";var Sr=class t extends jt{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 un(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(rh(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=ln(this.condition,e,r),this}get names(){let e=super.names;return oi(e,this.condition),this.else&&Er(e,this.else.names),e}};Sr.kind="if";var zr=class extends jt{};zr.kind="for";var nl=class extends zr{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=ln(this.iteration,e,r),this}get names(){return Er(super.names,this.iteration.names)}},ol=class extends zr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?ft.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=oi(super.names,this.from);return oi(e,this.to)}},ni=class extends zr{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=ln(this.iterable,e,r),this}get names(){return Er(super.names,this.iterable.names)}},vo=class extends jt{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)}};vo.kind="func";var bo=class extends yo{render(e){return"return "+super.render(e)}};bo.kind="return";var sl=class extends jt{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&&Er(e,this.catch.names),this.finally&&Er(e,this.finally.names),e}},xo=class extends jt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};xo.kind="catch";var wo=class extends jt{render(e){return"finally"+super.render(e)}};wo.kind="finally";var il=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
-
`:""},this._extScope=e,this._scope=new ft.Scope({parent:e}),this._nodes=[new rl]}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 s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Ju(e,s,n)),s}const(e,r,n){return this._def(ft.varKinds.const,e,r,n)}let(e,r,n){return this._def(ft.varKinds.let,e,r,n)}var(e,r,n){return this._def(ft.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new ri(e,r,n))}add(e,r){return this._leafNode(new Yu(e,V.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==J.nil&&this._leafNode(new tl(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,J.addCodeArg)(r,o));return r.push("}"),new J._Code(r)}if(e,r,n){if(this._blockNode(new Sr(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 Sr(e))}else(){return this._elseNode(new un)}endIf(){return this._endBlockNode(Sr,un)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new nl(e),r)}forRange(e,r,n,o,s=this.opts.es5?ft.varKinds.var:ft.varKinds.let){let i=this._scope.toName(e);return this._for(new ol(s,i,r,n),()=>o(i))}forOf(e,r,n,o=ft.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof J.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,J._)`${i}.length`,a=>{this.var(s,(0,J._)`${i}[${a}]`),n(s)})}return this._for(new ni("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?ft.varKinds.var:ft.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,J._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new ni("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(zr)}label(e){return this._leafNode(new Xu(e))}break(e){return this._leafNode(new Qu(e))}return(e){let r=new bo;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(bo)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new sl;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new xo(s),r(s)}return n&&(this._currNode=o.finally=new wo,this.code(n)),this._endBlockNode(xo,wo)}throw(e){return this._leafNode(new el(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=J.nil,n,o){return this._blockNode(new vo(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(vo)}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 Sr))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}};V.CodeGen=il;function Er(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function oi(t,e){return e instanceof J._CodeOrName?Er(t,e.names):t}function ln(t,e,r){if(t instanceof J.Name)return n(t);if(!o(t))return t;return new J._Code(t._items.reduce((s,i)=>(i instanceof J.Name&&(i=n(i)),i instanceof J._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof J._Code&&s._items.some(i=>i instanceof J.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Uw(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function rh(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,J._)`!${al(t)}`}V.not=rh;var Fw=nh(V.operators.AND);function Vw(...t){return t.reduce(Fw)}V.and=Vw;var Bw=nh(V.operators.OR);function Hw(...t){return t.reduce(Bw)}V.or=Hw;function nh(t){return(e,r)=>e===J.nil?r:r===J.nil?e:(0,J._)`${al(e)} ${t} ${al(r)}`}function al(t){return t instanceof J.Name?t:(0,J._)`(${t})`}});var Q=k(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;var ne=U(),Ww=_o();function Gw(t){let e={};for(let r of t)e[r]=!0;return e}B.toHash=Gw;function Kw(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(ih(t,e),!ah(e,t.self.RULES.all))}B.alwaysValidSchema=Kw;function ih(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||lh(t,`unknown keyword: "${s}"`)}B.checkUnknownRules=ih;function ah(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}B.schemaHasRules=ah;function Jw(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}B.schemaHasRulesButRef=Jw;function Yw({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ne._)`${r}`}return(0,ne._)`${t}${e}${(0,ne.getProperty)(n)}`}B.schemaRefOrVal=Yw;function Xw(t){return ch(decodeURIComponent(t))}B.unescapeFragment=Xw;function Qw(t){return encodeURIComponent(ul(t))}B.escapeFragment=Qw;function ul(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=ul;function ch(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=ch;function e$(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}B.eachItem=e$;function oh({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof ne.Name?(s instanceof ne.Name?t(o,s,i):e(o,s,i),i):s instanceof ne.Name?(e(o,i,s),s):r(s,i);return a===ne.Name&&!(c instanceof ne.Name)?n(o,c):c}}B.mergeEvaluated={props:oh({mergeNames:(t,e,r)=>t.if((0,ne._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ne._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ne._)`${r} || {}`).code((0,ne._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ne._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ne._)`${r} || {}`),ll(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:uh}),items:oh({mergeNames:(t,e,r)=>t.if((0,ne._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ne._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ne._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ne._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function uh(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ne._)`{}`);return e!==void 0&&ll(t,r,e),r}B.evaluatedPropsToName=uh;function ll(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ne._)`${e}${(0,ne.getProperty)(n)}`,!0))}B.setEvaluated=ll;var sh={};function t$(t,e){return t.scopeValue("func",{ref:e,code:sh[e.code]||(sh[e.code]=new Ww._Code(e.code))})}B.useFunc=t$;var cl;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(cl||(B.Type=cl={}));function r$(t,e,r){if(t instanceof ne.Name){let n=e===cl.Num;return r?n?(0,ne._)`"[" + ${t} + "]"`:(0,ne._)`"['" + ${t} + "']"`:n?(0,ne._)`"/" + ${t}`:(0,ne._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ne.getProperty)(t).toString():"/"+ul(t)}B.getErrorPath=r$;function lh(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}B.checkStrictMode=lh});var Mt=k(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});var Ie=U(),n$={data:new Ie.Name("data"),valCxt:new Ie.Name("valCxt"),instancePath:new Ie.Name("instancePath"),parentData:new Ie.Name("parentData"),parentDataProperty:new Ie.Name("parentDataProperty"),rootData:new Ie.Name("rootData"),dynamicAnchors:new Ie.Name("dynamicAnchors"),vErrors:new Ie.Name("vErrors"),errors:new Ie.Name("errors"),this:new Ie.Name("this"),self:new Ie.Name("self"),scope:new Ie.Name("scope"),json:new Ie.Name("json"),jsonPos:new Ie.Name("jsonPos"),jsonLen:new Ie.Name("jsonLen"),jsonPart:new Ie.Name("jsonPart")};dl.default=n$});var $o=k(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.extendErrors=Oe.resetErrorsCount=Oe.reportExtraError=Oe.reportError=Oe.keyword$DataError=Oe.keywordError=void 0;var Y=U(),ii=Q(),Me=Mt();Oe.keywordError={message:({keyword:t})=>(0,Y.str)`must pass "${t}" keyword validation`};Oe.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Y.str)`"${t}" keyword must be ${e} ($data)`:(0,Y.str)`"${t}" keyword is invalid ($data)`};function o$(t,e=Oe.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=ph(t,e,r);n??(i||a)?dh(s,c):fh(o,(0,Y._)`[${c}]`)}Oe.reportError=o$;function s$(t,e=Oe.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=ph(t,e,r);dh(o,a),s||i||fh(n,Me.default.vErrors)}Oe.reportExtraError=s$;function i$(t,e){t.assign(Me.default.errors,e),t.if((0,Y._)`${Me.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Y._)`${Me.default.vErrors}.length`,e),()=>t.assign(Me.default.vErrors,null)))}Oe.resetErrorsCount=i$;function a$({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,Me.default.errors,a=>{t.const(i,(0,Y._)`${Me.default.vErrors}[${a}]`),t.if((0,Y._)`${i}.instancePath === undefined`,()=>t.assign((0,Y._)`${i}.instancePath`,(0,Y.strConcat)(Me.default.instancePath,s.errorPath))),t.assign((0,Y._)`${i}.schemaPath`,(0,Y.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,Y._)`${i}.schema`,r),t.assign((0,Y._)`${i}.data`,n))})}Oe.extendErrors=a$;function dh(t,e){let r=t.const("err",e);t.if((0,Y._)`${Me.default.vErrors} === null`,()=>t.assign(Me.default.vErrors,(0,Y._)`[${r}]`),(0,Y._)`${Me.default.vErrors}.push(${r})`),t.code((0,Y._)`${Me.default.errors}++`)}function fh(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Y._)`new ${t.ValidationError}(${e})`):(r.assign((0,Y._)`${n}.errors`,e),r.return(!1))}var Tr={keyword:new Y.Name("keyword"),schemaPath:new Y.Name("schemaPath"),params:new Y.Name("params"),propertyName:new Y.Name("propertyName"),message:new Y.Name("message"),schema:new Y.Name("schema"),parentSchema:new Y.Name("parentSchema")};function ph(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Y._)`{}`:c$(t,e,r)}function c$(t,e,r={}){let{gen:n,it:o}=t,s=[u$(o,r),l$(t,r)];return d$(t,e,s),n.object(...s)}function u$({errorPath:t},{instancePath:e}){let r=e?(0,Y.str)`${t}${(0,ii.getErrorPath)(e,ii.Type.Str)}`:t;return[Me.default.instancePath,(0,Y.strConcat)(Me.default.instancePath,r)]}function l$({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Y.str)`${e}/${t}`;return r&&(o=(0,Y.str)`${o}${(0,ii.getErrorPath)(r,ii.Type.Str)}`),[Tr.schemaPath,o]}function d$(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Tr.keyword,o],[Tr.params,typeof e=="function"?e(t):e||(0,Y._)`{}`]),c.messages&&n.push([Tr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Tr.schema,i],[Tr.parentSchema,(0,Y._)`${l}${d}`],[Me.default.data,s]),u&&n.push([Tr.propertyName,u])}});var hh=k(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.boolOrEmptySchema=dn.topBoolOrEmptySchema=void 0;var f$=$o(),p$=U(),m$=Mt(),h$={message:"boolean schema is false"};function g$(t){let{gen:e,schema:r,validateName:n}=t;r===!1?mh(t,!1):typeof r=="object"&&r.$async===!0?e.return(m$.default.data):(e.assign((0,p$._)`${n}.errors`,null),e.return(!0))}dn.topBoolOrEmptySchema=g$;function _$(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),mh(t)):r.var(e,!0)}dn.boolOrEmptySchema=_$;function mh(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,f$.reportError)(o,h$,void 0,e)}});var fl=k(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.getRules=fn.isJSONType=void 0;var y$=["string","number","integer","boolean","null","object","array"],v$=new Set(y$);function b$(t){return typeof t=="string"&&v$.has(t)}fn.isJSONType=b$;function x$(){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:{}}}fn.getRules=x$});var pl=k(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.shouldUseRule=rr.shouldUseGroup=rr.schemaHasRulesForType=void 0;function w$({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&gh(t,n)}rr.schemaHasRulesForType=w$;function gh(t,e){return e.rules.some(r=>_h(t,r))}rr.shouldUseGroup=gh;function _h(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))}rr.shouldUseRule=_h});var ko=k(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.reportTypeError=Ne.checkDataTypes=Ne.checkDataType=Ne.coerceAndCheckDataType=Ne.getJSONTypes=Ne.getSchemaTypes=Ne.DataType=void 0;var $$=fl(),k$=pl(),S$=$o(),L=U(),yh=Q(),pn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(pn||(Ne.DataType=pn={}));function z$(t){let e=vh(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}Ne.getSchemaTypes=z$;function vh(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every($$.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ne.getJSONTypes=vh;function E$(t,e){let{gen:r,data:n,opts:o}=t,s=T$(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,k$.schemaHasRulesForType)(t,e[0]));if(i){let a=hl(e,n,o.strictNumbers,pn.Wrong);r.if(a,()=>{s.length?P$(t,e,s):gl(t)})}return i}Ne.coerceAndCheckDataType=E$;var bh=new Set(["string","number","integer","boolean","null"]);function T$(t,e){return e?t.filter(r=>bh.has(r)||e==="array"&&r==="array"):[]}function P$(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,L._)`typeof ${o}`),a=n.let("coerced",(0,L._)`undefined`);s.coerceTypes==="array"&&n.if((0,L._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,L._)`${o}[0]`).assign(i,(0,L._)`typeof ${o}`).if(hl(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,L._)`${a} !== undefined`);for(let u of r)(bh.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),gl(t),n.endIf(),n.if((0,L._)`${a} !== undefined`,()=>{n.assign(o,a),R$(t,a)});function c(u){switch(u){case"string":n.elseIf((0,L._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,L._)`"" + ${o}`).elseIf((0,L._)`${o} === null`).assign(a,(0,L._)`""`);return;case"number":n.elseIf((0,L._)`${i} == "boolean" || ${o} === null
|
|
3
|
+
var vv=Object.create;var sa=Object.defineProperty;var bv=Object.getOwnPropertyDescriptor;var xv=Object.getOwnPropertyNames;var wv=Object.getPrototypeOf,$v=Object.prototype.hasOwnProperty;var _e=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var k=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),df=(t,e)=>{for(var r in e)sa(t,r,{get:e[r],enumerable:!0})},kv=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of xv(e))!$v.call(t,o)&&o!==r&&sa(t,o,{get:()=>e[o],enumerable:!(n=bv(e,o))||n.enumerable});return t};var mr=(t,e,r)=>(r=t!=null?vv(wv(t)):{},kv(e||!t||!t.__esModule?sa(r,"default",{value:t,enumerable:!0}):r,t));var _o=k(X=>{"use strict";Object.defineProperty(X,"__esModule",{value:!0});X.regexpCode=X.getEsmExportName=X.getProperty=X.safeStringify=X.stringify=X.strConcat=X.addCodeArg=X.str=X._=X.nil=X._Code=X.Name=X.IDENTIFIER=X._CodeOrName=void 0;var ho=class{};X._CodeOrName=ho;X.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var kr=class extends ho{constructor(e){if(super(),!X.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}}};X.Name=kr;var nt=class extends ho{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 kr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};X._Code=nt;X.nil=new nt("");function rh(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Hu(r,e[n]),r.push(t[++n]);return new nt(r)}X._=rh;var Bu=new nt("+");function nh(t,...e){let r=[go(t[0])],n=0;for(;n<e.length;)r.push(Bu),Hu(r,e[n]),r.push(Bu,go(t[++n]));return jw(r),new nt(r)}X.str=nh;function Hu(t,e){e instanceof nt?t.push(...e._items):e instanceof kr?t.push(e):t.push(Dw(e))}X.addCodeArg=Hu;function jw(t){let e=1;for(;e<t.length-1;){if(t[e]===Bu){let r=Mw(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function Mw(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof kr||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 kr))return`"${t}${e.slice(1)}`}function Aw(t,e){return e.emptyStr()?t:t.emptyStr()?e:nh`${t}${e}`}X.strConcat=Aw;function Dw(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:go(Array.isArray(t)?t.join(","):t)}function qw(t){return new nt(go(t))}X.stringify=qw;function go(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}X.safeStringify=go;function Lw(t){return typeof t=="string"&&X.IDENTIFIER.test(t)?new nt(`.${t}`):rh`[${t}]`}X.getProperty=Lw;function Uw(t){if(typeof t=="string"&&X.IDENTIFIER.test(t))return new nt(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}X.getEsmExportName=Uw;function Fw(t){return new nt(t.toString())}X.regexpCode=Fw});var Ku=k(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.ValueScope=Fe.ValueScopeName=Fe.Scope=Fe.varKinds=Fe.UsedValueState=void 0;var Ue=_o(),Wu=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Qs;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Qs||(Fe.UsedValueState=Qs={}));Fe.varKinds={const:new Ue.Name("const"),let:new Ue.Name("let"),var:new Ue.Name("var")};var ei=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Ue.Name?e:this.name(e)}name(e){return new Ue.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}}};Fe.Scope=ei;var ti=class extends Ue.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Ue._)`.${new Ue.Name(r)}[${n}]`}};Fe.ValueScopeName=ti;var Vw=(0,Ue._)`\n`,Gu=class extends ei{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?Vw:Ue.nil}}get(){return this._scope}name(e){return new ti(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:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let d=a.get(i);if(d)return d}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,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,Ue._)`${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 s=Ue.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Qs.Started);let d=r(u);if(d){let l=this.opts.es5?Fe.varKinds.var:Fe.varKinds.const;s=(0,Ue._)`${s}${l} ${u} = ${d};${this.opts._n}`}else if(d=o?.(u))s=(0,Ue._)`${s}${d}${this.opts._n}`;else throw new Wu(u);c.set(u,Qs.Completed)})}return s}};Fe.ValueScope=Gu});var U=k(V=>{"use strict";Object.defineProperty(V,"__esModule",{value:!0});V.or=V.and=V.not=V.CodeGen=V.operators=V.varKinds=V.ValueScopeName=V.ValueScope=V.Scope=V.Name=V.regexpCode=V.stringify=V.getProperty=V.nil=V.strConcat=V.str=V._=void 0;var J=_o(),pt=Ku(),tr=_o();Object.defineProperty(V,"_",{enumerable:!0,get:function(){return tr._}});Object.defineProperty(V,"str",{enumerable:!0,get:function(){return tr.str}});Object.defineProperty(V,"strConcat",{enumerable:!0,get:function(){return tr.strConcat}});Object.defineProperty(V,"nil",{enumerable:!0,get:function(){return tr.nil}});Object.defineProperty(V,"getProperty",{enumerable:!0,get:function(){return tr.getProperty}});Object.defineProperty(V,"stringify",{enumerable:!0,get:function(){return tr.stringify}});Object.defineProperty(V,"regexpCode",{enumerable:!0,get:function(){return tr.regexpCode}});Object.defineProperty(V,"Name",{enumerable:!0,get:function(){return tr.Name}});var si=Ku();Object.defineProperty(V,"Scope",{enumerable:!0,get:function(){return si.Scope}});Object.defineProperty(V,"ValueScope",{enumerable:!0,get:function(){return si.ValueScope}});Object.defineProperty(V,"ValueScopeName",{enumerable:!0,get:function(){return si.ValueScopeName}});Object.defineProperty(V,"varKinds",{enumerable:!0,get:function(){return si.varKinds}});V.operators={GT:new J._Code(">"),GTE:new J._Code(">="),LT:new J._Code("<"),LTE:new J._Code("<="),EQ:new J._Code("==="),NEQ:new J._Code("!=="),NOT:new J._Code("!"),OR:new J._Code("||"),AND:new J._Code("&&"),ADD:new J._Code("+")};var jt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Ju=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?pt.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=ln(this.rhs,e,r)),this}get names(){return this.rhs instanceof J._CodeOrName?this.rhs.names:{}}},ri=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 J.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ln(this.rhs,e,r),this}get names(){let e=this.lhs instanceof J.Name?{}:{...this.lhs.names};return oi(e,this.rhs)}},Yu=class extends ri{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Xu=class extends jt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Qu=class extends jt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},el=class extends jt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},tl=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=ln(this.code,e,r),this}get names(){return this.code instanceof J._CodeOrName?this.code.names:{}}},yo=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 s=n[o];s.optimizeNames(e,r)||(Bw(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Er(e,r.names),{})}},Mt=class extends yo{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},rl=class extends yo{},un=class extends Mt{};un.kind="else";var Sr=class t extends Mt{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 un(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(oh(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=ln(this.condition,e,r),this}get names(){let e=super.names;return oi(e,this.condition),this.else&&Er(e,this.else.names),e}};Sr.kind="if";var zr=class extends Mt{};zr.kind="for";var nl=class extends zr{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=ln(this.iteration,e,r),this}get names(){return Er(super.names,this.iteration.names)}},ol=class extends zr{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?pt.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=oi(super.names,this.from);return oi(e,this.to)}},ni=class extends zr{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=ln(this.iterable,e,r),this}get names(){return Er(super.names,this.iterable.names)}},vo=class extends Mt{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)}};vo.kind="func";var bo=class extends yo{render(e){return"return "+super.render(e)}};bo.kind="return";var sl=class extends Mt{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&&Er(e,this.catch.names),this.finally&&Er(e,this.finally.names),e}},xo=class extends Mt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};xo.kind="catch";var wo=class extends Mt{render(e){return"finally"+super.render(e)}};wo.kind="finally";var il=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
+
`:""},this._extScope=e,this._scope=new pt.Scope({parent:e}),this._nodes=[new rl]}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 s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Ju(e,s,n)),s}const(e,r,n){return this._def(pt.varKinds.const,e,r,n)}let(e,r,n){return this._def(pt.varKinds.let,e,r,n)}var(e,r,n){return this._def(pt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new ri(e,r,n))}add(e,r){return this._leafNode(new Yu(e,V.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==J.nil&&this._leafNode(new tl(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,J.addCodeArg)(r,o));return r.push("}"),new J._Code(r)}if(e,r,n){if(this._blockNode(new Sr(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 Sr(e))}else(){return this._elseNode(new un)}endIf(){return this._endBlockNode(Sr,un)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new nl(e),r)}forRange(e,r,n,o,s=this.opts.es5?pt.varKinds.var:pt.varKinds.let){let i=this._scope.toName(e);return this._for(new ol(s,i,r,n),()=>o(i))}forOf(e,r,n,o=pt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof J.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,J._)`${i}.length`,a=>{this.var(s,(0,J._)`${i}[${a}]`),n(s)})}return this._for(new ni("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?pt.varKinds.var:pt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,J._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new ni("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(zr)}label(e){return this._leafNode(new Xu(e))}break(e){return this._leafNode(new Qu(e))}return(e){let r=new bo;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(bo)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new sl;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new xo(s),r(s)}return n&&(this._currNode=o.finally=new wo,this.code(n)),this._endBlockNode(xo,wo)}throw(e){return this._leafNode(new el(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=J.nil,n,o){return this._blockNode(new vo(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(vo)}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 Sr))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}};V.CodeGen=il;function Er(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function oi(t,e){return e instanceof J._CodeOrName?Er(t,e.names):t}function ln(t,e,r){if(t instanceof J.Name)return n(t);if(!o(t))return t;return new J._Code(t._items.reduce((s,i)=>(i instanceof J.Name&&(i=n(i)),i instanceof J._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof J._Code&&s._items.some(i=>i instanceof J.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function Bw(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function oh(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,J._)`!${al(t)}`}V.not=oh;var Hw=sh(V.operators.AND);function Ww(...t){return t.reduce(Hw)}V.and=Ww;var Gw=sh(V.operators.OR);function Kw(...t){return t.reduce(Gw)}V.or=Kw;function sh(t){return(e,r)=>e===J.nil?r:r===J.nil?e:(0,J._)`${al(e)} ${t} ${al(r)}`}function al(t){return t instanceof J.Name?t:(0,J._)`(${t})`}});var Q=k(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.checkStrictMode=B.getErrorPath=B.Type=B.useFunc=B.setEvaluated=B.evaluatedPropsToName=B.mergeEvaluated=B.eachItem=B.unescapeJsonPointer=B.escapeJsonPointer=B.escapeFragment=B.unescapeFragment=B.schemaRefOrVal=B.schemaHasRulesButRef=B.schemaHasRules=B.checkUnknownRules=B.alwaysValidSchema=B.toHash=void 0;var ne=U(),Jw=_o();function Yw(t){let e={};for(let r of t)e[r]=!0;return e}B.toHash=Yw;function Xw(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(ch(t,e),!uh(e,t.self.RULES.all))}B.alwaysValidSchema=Xw;function ch(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||fh(t,`unknown keyword: "${s}"`)}B.checkUnknownRules=ch;function uh(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}B.schemaHasRules=uh;function Qw(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}B.schemaHasRulesButRef=Qw;function e$({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ne._)`${r}`}return(0,ne._)`${t}${e}${(0,ne.getProperty)(n)}`}B.schemaRefOrVal=e$;function t$(t){return lh(decodeURIComponent(t))}B.unescapeFragment=t$;function r$(t){return encodeURIComponent(ul(t))}B.escapeFragment=r$;function ul(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}B.escapeJsonPointer=ul;function lh(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}B.unescapeJsonPointer=lh;function n$(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}B.eachItem=n$;function ih({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof ne.Name?(s instanceof ne.Name?t(o,s,i):e(o,s,i),i):s instanceof ne.Name?(e(o,i,s),s):r(s,i);return a===ne.Name&&!(c instanceof ne.Name)?n(o,c):c}}B.mergeEvaluated={props:ih({mergeNames:(t,e,r)=>t.if((0,ne._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ne._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ne._)`${r} || {}`).code((0,ne._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ne._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ne._)`${r} || {}`),ll(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:dh}),items:ih({mergeNames:(t,e,r)=>t.if((0,ne._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ne._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ne._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ne._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function dh(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ne._)`{}`);return e!==void 0&&ll(t,r,e),r}B.evaluatedPropsToName=dh;function ll(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ne._)`${e}${(0,ne.getProperty)(n)}`,!0))}B.setEvaluated=ll;var ah={};function o$(t,e){return t.scopeValue("func",{ref:e,code:ah[e.code]||(ah[e.code]=new Jw._Code(e.code))})}B.useFunc=o$;var cl;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(cl||(B.Type=cl={}));function s$(t,e,r){if(t instanceof ne.Name){let n=e===cl.Num;return r?n?(0,ne._)`"[" + ${t} + "]"`:(0,ne._)`"['" + ${t} + "']"`:n?(0,ne._)`"/" + ${t}`:(0,ne._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ne.getProperty)(t).toString():"/"+ul(t)}B.getErrorPath=s$;function fh(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}B.checkStrictMode=fh});var At=k(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});var Oe=U(),i$={data:new Oe.Name("data"),valCxt:new Oe.Name("valCxt"),instancePath:new Oe.Name("instancePath"),parentData:new Oe.Name("parentData"),parentDataProperty:new Oe.Name("parentDataProperty"),rootData:new Oe.Name("rootData"),dynamicAnchors:new Oe.Name("dynamicAnchors"),vErrors:new Oe.Name("vErrors"),errors:new Oe.Name("errors"),this:new Oe.Name("this"),self:new Oe.Name("self"),scope:new Oe.Name("scope"),json:new Oe.Name("json"),jsonPos:new Oe.Name("jsonPos"),jsonLen:new Oe.Name("jsonLen"),jsonPart:new Oe.Name("jsonPart")};dl.default=i$});var $o=k(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.extendErrors=Ne.resetErrorsCount=Ne.reportExtraError=Ne.reportError=Ne.keyword$DataError=Ne.keywordError=void 0;var Y=U(),ii=Q(),Ae=At();Ne.keywordError={message:({keyword:t})=>(0,Y.str)`must pass "${t}" keyword validation`};Ne.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,Y.str)`"${t}" keyword must be ${e} ($data)`:(0,Y.str)`"${t}" keyword is invalid ($data)`};function a$(t,e=Ne.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=hh(t,e,r);n??(i||a)?ph(s,c):mh(o,(0,Y._)`[${c}]`)}Ne.reportError=a$;function c$(t,e=Ne.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=hh(t,e,r);ph(o,a),s||i||mh(n,Ae.default.vErrors)}Ne.reportExtraError=c$;function u$(t,e){t.assign(Ae.default.errors,e),t.if((0,Y._)`${Ae.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,Y._)`${Ae.default.vErrors}.length`,e),()=>t.assign(Ae.default.vErrors,null)))}Ne.resetErrorsCount=u$;function l$({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,Ae.default.errors,a=>{t.const(i,(0,Y._)`${Ae.default.vErrors}[${a}]`),t.if((0,Y._)`${i}.instancePath === undefined`,()=>t.assign((0,Y._)`${i}.instancePath`,(0,Y.strConcat)(Ae.default.instancePath,s.errorPath))),t.assign((0,Y._)`${i}.schemaPath`,(0,Y.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,Y._)`${i}.schema`,r),t.assign((0,Y._)`${i}.data`,n))})}Ne.extendErrors=l$;function ph(t,e){let r=t.const("err",e);t.if((0,Y._)`${Ae.default.vErrors} === null`,()=>t.assign(Ae.default.vErrors,(0,Y._)`[${r}]`),(0,Y._)`${Ae.default.vErrors}.push(${r})`),t.code((0,Y._)`${Ae.default.errors}++`)}function mh(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,Y._)`new ${t.ValidationError}(${e})`):(r.assign((0,Y._)`${n}.errors`,e),r.return(!1))}var Tr={keyword:new Y.Name("keyword"),schemaPath:new Y.Name("schemaPath"),params:new Y.Name("params"),propertyName:new Y.Name("propertyName"),message:new Y.Name("message"),schema:new Y.Name("schema"),parentSchema:new Y.Name("parentSchema")};function hh(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,Y._)`{}`:d$(t,e,r)}function d$(t,e,r={}){let{gen:n,it:o}=t,s=[f$(o,r),p$(t,r)];return m$(t,e,s),n.object(...s)}function f$({errorPath:t},{instancePath:e}){let r=e?(0,Y.str)`${t}${(0,ii.getErrorPath)(e,ii.Type.Str)}`:t;return[Ae.default.instancePath,(0,Y.strConcat)(Ae.default.instancePath,r)]}function p$({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,Y.str)`${e}/${t}`;return r&&(o=(0,Y.str)`${o}${(0,ii.getErrorPath)(r,ii.Type.Str)}`),[Tr.schemaPath,o]}function m$(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:d,schemaPath:l}=a;n.push([Tr.keyword,o],[Tr.params,typeof e=="function"?e(t):e||(0,Y._)`{}`]),c.messages&&n.push([Tr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Tr.schema,i],[Tr.parentSchema,(0,Y._)`${d}${l}`],[Ae.default.data,s]),u&&n.push([Tr.propertyName,u])}});var _h=k(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.boolOrEmptySchema=dn.topBoolOrEmptySchema=void 0;var h$=$o(),g$=U(),_$=At(),y$={message:"boolean schema is false"};function v$(t){let{gen:e,schema:r,validateName:n}=t;r===!1?gh(t,!1):typeof r=="object"&&r.$async===!0?e.return(_$.default.data):(e.assign((0,g$._)`${n}.errors`,null),e.return(!0))}dn.topBoolOrEmptySchema=v$;function b$(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),gh(t)):r.var(e,!0)}dn.boolOrEmptySchema=b$;function gh(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,h$.reportError)(o,y$,void 0,e)}});var fl=k(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.getRules=fn.isJSONType=void 0;var x$=["string","number","integer","boolean","null","object","array"],w$=new Set(x$);function $$(t){return typeof t=="string"&&w$.has(t)}fn.isJSONType=$$;function k$(){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:{}}}fn.getRules=k$});var pl=k(rr=>{"use strict";Object.defineProperty(rr,"__esModule",{value:!0});rr.shouldUseRule=rr.shouldUseGroup=rr.schemaHasRulesForType=void 0;function S$({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&yh(t,n)}rr.schemaHasRulesForType=S$;function yh(t,e){return e.rules.some(r=>vh(t,r))}rr.shouldUseGroup=yh;function vh(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))}rr.shouldUseRule=vh});var ko=k(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce.reportTypeError=Ce.checkDataTypes=Ce.checkDataType=Ce.coerceAndCheckDataType=Ce.getJSONTypes=Ce.getSchemaTypes=Ce.DataType=void 0;var z$=fl(),E$=pl(),T$=$o(),L=U(),bh=Q(),pn;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(pn||(Ce.DataType=pn={}));function P$(t){let e=xh(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}Ce.getSchemaTypes=P$;function xh(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(z$.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ce.getJSONTypes=xh;function R$(t,e){let{gen:r,data:n,opts:o}=t,s=I$(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,E$.schemaHasRulesForType)(t,e[0]));if(i){let a=hl(e,n,o.strictNumbers,pn.Wrong);r.if(a,()=>{s.length?O$(t,e,s):gl(t)})}return i}Ce.coerceAndCheckDataType=R$;var wh=new Set(["string","number","integer","boolean","null"]);function I$(t,e){return e?t.filter(r=>wh.has(r)||e==="array"&&r==="array"):[]}function O$(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,L._)`typeof ${o}`),a=n.let("coerced",(0,L._)`undefined`);s.coerceTypes==="array"&&n.if((0,L._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,L._)`${o}[0]`).assign(i,(0,L._)`typeof ${o}`).if(hl(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,L._)`${a} !== undefined`);for(let u of r)(wh.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),gl(t),n.endIf(),n.if((0,L._)`${a} !== undefined`,()=>{n.assign(o,a),N$(t,a)});function c(u){switch(u){case"string":n.elseIf((0,L._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,L._)`"" + ${o}`).elseIf((0,L._)`${o} === null`).assign(a,(0,L._)`""`);return;case"number":n.elseIf((0,L._)`${i} == "boolean" || ${o} === null
|
|
5
5
|
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,L._)`+${o}`);return;case"integer":n.elseIf((0,L._)`${i} === "boolean" || ${o} === null
|
|
6
6
|
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,L._)`+${o}`);return;case"boolean":n.elseIf((0,L._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,L._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,L._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,L._)`${i} === "string" || ${i} === "number"
|
|
7
|
-
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,L._)`[${o}]`)}}}function R$({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,L._)`${e} !== undefined`,()=>t.assign((0,L._)`${e}[${r}]`,n))}function ml(t,e,r,n=pn.Correct){let o=n===pn.Correct?L.operators.EQ:L.operators.NEQ,s;switch(t){case"null":return(0,L._)`${e} ${o} null`;case"array":s=(0,L._)`Array.isArray(${e})`;break;case"object":s=(0,L._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,L._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,L._)`typeof ${e} ${o} ${t}`}return n===pn.Correct?s:(0,L.not)(s);function i(a=L.nil){return(0,L.and)((0,L._)`typeof ${e} == "number"`,a,r?(0,L._)`isFinite(${e})`:L.nil)}}Ne.checkDataType=ml;function hl(t,e,r,n){if(t.length===1)return ml(t[0],e,r,n);let o,s=(0,yh.toHash)(t);if(s.array&&s.object){let i=(0,L._)`typeof ${e} != "object"`;o=s.null?i:(0,L._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else o=L.nil;s.number&&delete s.integer;for(let i in s)o=(0,L.and)(o,ml(i,e,r,n));return o}Ne.checkDataTypes=hl;var I$={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,L._)`{type: ${t}}`:(0,L._)`{type: ${e}}`};function gl(t){let e=O$(t);(0,S$.reportError)(e,I$)}Ne.reportTypeError=gl;function O$(t){let{gen:e,data:r,schema:n}=t,o=(0,yh.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var wh=k(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.assignDefaults=void 0;var mn=U(),N$=Q();function C$(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)xh(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,s)=>xh(t,s,o.default))}ai.assignDefaults=C$;function xh(t,e,r){let{gen:n,compositeRule:o,data:s,opts:i}=t;if(r===void 0)return;let a=(0,mn._)`${s}${(0,mn.getProperty)(e)}`;if(o){(0,N$.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,mn._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,mn._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,mn._)`${a} = ${(0,mn.stringify)(r)}`)}});var nt=k(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.validateUnion=re.validateArray=re.usePattern=re.callValidateCode=re.schemaProperties=re.allSchemaProperties=re.noPropertyInData=re.propertyInData=re.isOwnProperty=re.hasPropFunc=re.reportMissingProp=re.checkMissingProp=re.checkReportMissingProp=void 0;var ae=U(),_l=Q(),nr=Mt(),Z$=Q();function j$(t,e){let{gen:r,data:n,it:o}=t;r.if(vl(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ae._)`${e}`},!0),t.error()})}re.checkReportMissingProp=j$;function M$({gen:t,data:e,it:{opts:r}},n,o){return(0,ae.or)(...n.map(s=>(0,ae.and)(vl(t,e,s,r.ownProperties),(0,ae._)`${o} = ${s}`)))}re.checkMissingProp=M$;function A$(t,e){t.setParams({missingProperty:e},!0),t.error()}re.reportMissingProp=A$;function $h(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ae._)`Object.prototype.hasOwnProperty`})}re.hasPropFunc=$h;function yl(t,e,r){return(0,ae._)`${$h(t)}.call(${e}, ${r})`}re.isOwnProperty=yl;function D$(t,e,r,n){let o=(0,ae._)`${e}${(0,ae.getProperty)(r)} !== undefined`;return n?(0,ae._)`${o} && ${yl(t,e,r)}`:o}re.propertyInData=D$;function vl(t,e,r,n){let o=(0,ae._)`${e}${(0,ae.getProperty)(r)} === undefined`;return n?(0,ae.or)(o,(0,ae.not)(yl(t,e,r))):o}re.noPropertyInData=vl;function kh(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}re.allSchemaProperties=kh;function q$(t,e){return kh(e).filter(r=>!(0,_l.alwaysValidSchema)(t,e[r]))}re.schemaProperties=q$;function L$({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,ae._)`${t}, ${e}, ${n}${o}`:e,d=[[nr.default.instancePath,(0,ae.strConcat)(nr.default.instancePath,s)],[nr.default.parentData,i.parentData],[nr.default.parentDataProperty,i.parentDataProperty],[nr.default.rootData,nr.default.rootData]];i.opts.dynamicRef&&d.push([nr.default.dynamicAnchors,nr.default.dynamicAnchors]);let h=(0,ae._)`${l}, ${r.object(...d)}`;return c!==ae.nil?(0,ae._)`${a}.call(${c}, ${h})`:(0,ae._)`${a}(${h})`}re.callValidateCode=L$;var U$=(0,ae._)`new RegExp`;function F$({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ae._)`${o.code==="new RegExp"?U$:(0,Z$.useFunc)(t,o)}(${r}, ${n})`})}re.usePattern=F$;function V$(t){let{gen:e,data:r,keyword:n,it:o}=t,s=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,ae._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:_l.Type.Num},s),e.if((0,ae.not)(s),a)})}}re.validateArray=V$;function B$(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,_l.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,ae._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,ae.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}re.validateUnion=B$});var Eh=k(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.validateKeywordUsage=xt.validSchemaType=xt.funcKeywordCode=xt.macroKeywordCode=void 0;var Ae=U(),Pr=Mt(),H$=nt(),W$=$o();function G$(t,e){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=t,a=e.macro.call(i.self,o,s,i),c=zh(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Ae.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}xt.macroKeywordCode=G$;function K$(t,e){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=t;Y$(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=zh(n,o,u),d=n.let("valid");t.block$data(d,h),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function h(){if(e.errors===!1)p(),e.modifying&&Sh(t),g(()=>t.error());else{let v=e.async?m():f();e.modifying&&Sh(t),g(()=>J$(t,v))}}function m(){let v=n.let("ruleErrs",null);return n.try(()=>p((0,Ae._)`await `),b=>n.assign(d,!1).if((0,Ae._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Ae._)`${b}.errors`),()=>n.throw(b))),v}function f(){let v=(0,Ae._)`${l}.errors`;return n.assign(v,null),p(Ae.nil),v}function p(v=e.async?(0,Ae._)`await `:Ae.nil){let b=c.opts.passContext?Pr.default.this:Pr.default.self,w=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Ae._)`${v}${(0,H$.callValidateCode)(t,l,b,w)}`,e.modifying)}function g(v){var b;n.if((0,Ae.not)((b=e.valid)!==null&&b!==void 0?b:d),v)}}xt.funcKeywordCode=K$;function Sh(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Ae._)`${n.parentData}[${n.parentDataProperty}]`))}function J$(t,e){let{gen:r}=t;r.if((0,Ae._)`Array.isArray(${e})`,()=>{r.assign(Pr.default.vErrors,(0,Ae._)`${Pr.default.vErrors} === null ? ${e} : ${Pr.default.vErrors}.concat(${e})`).assign(Pr.default.errors,(0,Ae._)`${Pr.default.vErrors}.length`),(0,W$.extendErrors)(t)},()=>t.error())}function Y$({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function zh(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 X$(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")}xt.validSchemaType=X$;function Q$({schema:t,opts:e,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}xt.validateKeywordUsage=Q$});var Ph=k(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.extendSubschemaMode=or.extendSubschemaData=or.getSubschema=void 0;var wt=U(),Th=Q();function ek(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,wt._)`${t.schemaPath}${(0,wt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,wt._)`${t.schemaPath}${(0,wt.getProperty)(e)}${(0,wt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Th.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}or.getSubschema=ek;function tk(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,h=a.let("data",(0,wt._)`${e.data}${(0,wt.getProperty)(r)}`,!0);c(h),t.errorPath=(0,wt.str)`${u}${(0,Th.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,wt._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof wt.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);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]}}or.extendSubschemaData=tk;function rk(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}or.extendSubschemaMode=rk});var bl=k((uZ,Rh)=>{"use strict";Rh.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,s;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(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Oh=k((lZ,Ih)=>{"use strict";var sr=Ih.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(){};ci(e,n,o,t,"",t)};sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};sr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};sr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ci(t,e,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in sr.arrayKeywords)for(var h=0;h<d.length;h++)ci(t,e,r,d[h],o+"/"+l+"/"+h,s,o,l,n,h)}else if(l in sr.propsKeywords){if(d&&typeof d=="object")for(var m in d)ci(t,e,r,d[m],o+"/"+l+"/"+nk(m),s,o,l,n,m)}else(l in sr.keywords||t.allKeys&&!(l in sr.skipKeywords))&&ci(t,e,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function nk(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var So=k(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe.getSchemaRefs=Fe.resolveUrl=Fe.normalizeId=Fe._getFullPath=Fe.getFullPath=Fe.inlineRef=void 0;var ok=Q(),sk=bl(),ik=Oh(),ak=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function ck(t,e=!0){return typeof t=="boolean"?!0:e===!0?!xl(t):e?Nh(t)<=e:!1}Fe.inlineRef=ck;var uk=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function xl(t){for(let e in t){if(uk.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(xl)||typeof r=="object"&&xl(r))return!0}return!1}function Nh(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!ak.has(r)&&(typeof t[r]=="object"&&(0,ok.eachItem)(t[r],n=>e+=Nh(n)),e===1/0))return 1/0}return e}function Ch(t,e="",r){r!==!1&&(e=hn(e));let n=t.parse(e);return Zh(t,n)}Fe.getFullPath=Ch;function Zh(t,e){return t.serialize(e).split("#")[0]+"#"}Fe._getFullPath=Zh;var lk=/#\/?$/;function hn(t){return t?t.replace(lk,""):""}Fe.normalizeId=hn;function dk(t,e,r){return r=hn(r),t.resolve(e,r)}Fe.resolveUrl=dk;var fk=/^[a-z_][-a-z0-9._]*$/i;function pk(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=hn(t[r]||e),s={"":o},i=Ch(n,o,!1),a={},c=new Set;return ik(t,{allKeys:!0},(d,h,m,f)=>{if(f===void 0)return;let p=i+h,g=s[f];typeof d[r]=="string"&&(g=v.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),s[h]=g;function v(w){let E=this.opts.uriResolver.resolve;if(w=hn(g?E(g,w):w),c.has(w))throw l(w);c.add(w);let N=this.refs[w];return typeof N=="string"&&(N=this.refs[N]),typeof N=="object"?u(d,N.schema,w):w!==hn(p)&&(w[0]==="#"?(u(d,a[w],w),a[w]=d):this.refs[w]=p),w}function b(w){if(typeof w=="string"){if(!fk.test(w))throw new Error(`invalid anchor "${w}"`);v.call(this,`#${w}`)}}}),a;function u(d,h,m){if(h!==void 0&&!sk(d,h))throw l(m)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Fe.getSchemaRefs=pk});var To=k(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.getData=ir.KeywordCxt=ir.validateFunctionCode=void 0;var qh=hh(),jh=ko(),$l=pl(),ui=ko(),mk=wh(),Eo=Eh(),wl=Ph(),O=U(),D=Mt(),hk=So(),At=Q(),zo=$o();function gk(t){if(Fh(t)&&(Vh(t),Uh(t))){vk(t);return}Lh(t,()=>(0,qh.topBoolOrEmptySchema)(t))}ir.validateFunctionCode=gk;function Lh({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,(0,O._)`${D.default.data}, ${D.default.valCxt}`,n.$async,()=>{t.code((0,O._)`"use strict"; ${Mh(r,o)}`),yk(t,o),t.code(s)}):t.func(e,(0,O._)`${D.default.data}, ${_k(o)}`,n.$async,()=>t.code(Mh(r,o)).code(s))}function _k(t){return(0,O._)`{${D.default.instancePath}="", ${D.default.parentData}, ${D.default.parentDataProperty}, ${D.default.rootData}=${D.default.data}${t.dynamicRef?(0,O._)`, ${D.default.dynamicAnchors}={}`:O.nil}}={}`}function yk(t,e){t.if(D.default.valCxt,()=>{t.var(D.default.instancePath,(0,O._)`${D.default.valCxt}.${D.default.instancePath}`),t.var(D.default.parentData,(0,O._)`${D.default.valCxt}.${D.default.parentData}`),t.var(D.default.parentDataProperty,(0,O._)`${D.default.valCxt}.${D.default.parentDataProperty}`),t.var(D.default.rootData,(0,O._)`${D.default.valCxt}.${D.default.rootData}`),e.dynamicRef&&t.var(D.default.dynamicAnchors,(0,O._)`${D.default.valCxt}.${D.default.dynamicAnchors}`)},()=>{t.var(D.default.instancePath,(0,O._)`""`),t.var(D.default.parentData,(0,O._)`undefined`),t.var(D.default.parentDataProperty,(0,O._)`undefined`),t.var(D.default.rootData,D.default.data),e.dynamicRef&&t.var(D.default.dynamicAnchors,(0,O._)`{}`)})}function vk(t){let{schema:e,opts:r,gen:n}=t;Lh(t,()=>{r.$comment&&e.$comment&&Hh(t),kk(t),n.let(D.default.vErrors,null),n.let(D.default.errors,0),r.unevaluated&&bk(t),Bh(t),Ek(t)})}function bk(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 Mh(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 xk(t,e){if(Fh(t)&&(Vh(t),Uh(t))){wk(t,e);return}(0,qh.boolOrEmptySchema)(t,e)}function Uh({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 Fh(t){return typeof t.schema!="boolean"}function wk(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&Hh(t),Sk(t),zk(t);let s=n.const("_errs",D.default.errors);Bh(t,s),n.var(e,(0,O._)`${s} === ${D.default.errors}`)}function Vh(t){(0,At.checkUnknownRules)(t),$k(t)}function Bh(t,e){if(t.opts.jtd)return Ah(t,[],!1,e);let r=(0,jh.getSchemaTypes)(t.schema),n=(0,jh.coerceAndCheckDataType)(t,r);Ah(t,r,!n,e)}function $k(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,At.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function kk(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,At.checkStrictMode)(t,"default is ignored in the schema root")}function Sk(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,hk.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function zk(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Hh({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)t.code((0,O._)`${D.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,O.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,O._)`${D.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Ek(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=t;r.$async?e.if((0,O._)`${D.default.errors} === 0`,()=>e.return(D.default.data),()=>e.throw((0,O._)`new ${o}(${D.default.vErrors})`)):(e.assign((0,O._)`${n}.errors`,D.default.vErrors),s.unevaluated&&Tk(t),e.return((0,O._)`${D.default.errors} === 0`))}function Tk({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 Ah(t,e,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,At.schemaHasRulesButRef)(s,l))){o.block(()=>Gh(t,"$ref",l.all.$ref.definition));return}c.jtd||Pk(t,e),o.block(()=>{for(let h of l.rules)d(h);d(l.post)});function d(h){(0,$l.shouldUseGroup)(s,h)&&(h.type?(o.if((0,ui.checkDataType)(h.type,i,c.strictNumbers)),Dh(t,h),e.length===1&&e[0]===h.type&&r&&(o.else(),(0,ui.reportTypeError)(t)),o.endIf()):Dh(t,h),a||o.if((0,O._)`${D.default.errors} === ${n||0}`))}}function Dh(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,mk.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,$l.shouldUseRule)(n,s)&&Gh(t,s.keyword,s.definition,e.type)})}function Pk(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Rk(t,e),t.opts.allowUnionTypes||Ik(t,e),Ok(t,t.dataTypes))}function Rk(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Wh(t.dataTypes,r)||kl(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Ck(t,e)}}function Ik(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&kl(t,"use allowUnionTypes to allow union type keyword")}function Ok(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,$l.shouldUseRule)(t.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>Nk(e,i))&&kl(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function Nk(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Wh(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Ck(t,e){let r=[];for(let n of t.dataTypes)Wh(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function kl(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,At.checkStrictMode)(t,e,t.opts.strictTypes)}var li=class{constructor(e,r,n){if((0,Eo.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,At.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",Kh(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Eo.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",D.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:s,def:i}=this;n.if((0,O.or)((0,O._)`${o} === undefined`,r)),e!==O.nil&&n.assign(e,!0),(s.length||i.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:s}=this;return(0,O.or)(i(),a());function i(){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,ui.checkDataTypes)(c,r,s.opts.strictNumbers,ui.DataType.Wrong)}`}return O.nil}function a(){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,wl.getSubschema)(this.it,e);(0,wl.extendSubschemaData)(n,this.it,e),(0,wl.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return xk(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=At.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=At.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}};ir.KeywordCxt=li;function Gh(t,e,r,n){let o=new li(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Eo.funcKeywordCode)(o,r):"macro"in r?(0,Eo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Eo.funcKeywordCode)(o,r)}var Zk=/^\/(?:[^~]|~0|~1)*$/,jk=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Kh(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,s;if(t==="")return D.default.rootData;if(t[0]==="/"){if(!Zk.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,s=D.default.rootData}else{let u=jk.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(s=r[e-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,O._)`${s}${(0,O.getProperty)((0,At.unescapeJsonPointer)(u))}`,i=(0,O._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}ir.getData=Kh});var di=k(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});var Sl=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};zl.default=Sl});var Po=k(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});var El=So(),Tl=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,El.resolveUrl)(e,r,n),this.missingSchema=(0,El.normalizeId)((0,El.getFullPath)(e,this.missingRef))}};Pl.default=Tl});var pi=k(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.resolveSchema=ot.getCompilingSchema=ot.resolveRef=ot.compileSchema=ot.SchemaEnv=void 0;var pt=U(),Mk=di(),Rr=Mt(),mt=So(),Jh=Q(),Ak=To(),gn=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,mt.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};ot.SchemaEnv=gn;function Il(t){let e=Yh.call(this,t);if(e)return e;let r=(0,mt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new pt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:Mk.default,code:(0,pt._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Rr.default.data,parentData:Rr.default.parentData,parentDataProperty:Rr.default.parentDataProperty,dataNames:[Rr.default.data],dataPathArr:[pt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,pt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:pt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,pt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,Ak.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Rr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let m=new Function(`${Rr.default.self}`,`${Rr.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:i._values}),this.opts.unevaluated){let{props:f,items:p}=u;m.evaluated={props:f instanceof pt.Name?void 0:f,items:p instanceof pt.Name?void 0:p,dynamicProps:f instanceof pt.Name,dynamicItems:p instanceof pt.Name},m.source&&(m.source.evaluated=(0,pt.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)}}ot.compileSchema=Il;function Dk(t,e,r){var n;r=(0,mt.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let s=Uk.call(this,t,r);if(s===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new gn({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=qk.call(this,s)}ot.resolveRef=Dk;function qk(t){return(0,mt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Il.call(this,t)}function Yh(t){for(let e of this._compilations)if(Lk(e,t))return e}ot.getCompilingSchema=Yh;function Lk(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Uk(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||fi.call(this,t,e)}function fi(t,e){let r=this.opts.uriResolver.parse(e),n=(0,mt._getFullPath)(this.opts.uriResolver,r),o=(0,mt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return Rl.call(this,r,t);let s=(0,mt.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=fi.call(this,t,i);return typeof a?.schema!="object"?void 0:Rl.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Il.call(this,i),s===(0,mt.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,mt.resolveUrl)(this.opts.uriResolver,o,u)),new gn({schema:a,schemaId:c,root:t,baseId:o})}return Rl.call(this,r,i)}}ot.resolveSchema=fi;var Fk=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Rl(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Jh.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Fk.has(a)&&u&&(e=(0,mt.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Jh.schemaHasRulesButRef)(r,this.RULES)){let a=(0,mt.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=fi.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new gn({schema:r,schemaId:i,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var Xh=k((gZ,Vk)=>{Vk.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 eg=k((_Z,Qh)=>{"use strict";var Bk={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Qh.exports={HEX:Bk}});var cg=k((yZ,ag)=>{"use strict";var{HEX:Hk}=eg();function og(t){if(ig(t,".")<3)return{host:t,isIPV4:!1};let e=t.match(/^(?:(?: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])$/u)||[],[r]=e;return r?{host:Gk(r,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function Ol(t,e=!1){let r="",n=!0;for(let o of t){if(Hk[o]===void 0)return;o!=="0"&&n===!0&&(n=!1),n||(r+=o)}return e&&r.length===0&&(r="0"),r}function Wk(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=!1;function c(){if(o.length){if(s===!1){let u=Ol(o);if(u!==void 0)n.push(u);else return r.error=!0,!1}o.length=0}return!0}for(let u=0;u<t.length;u++){let l=t[u];if(!(l==="["||l==="]"))if(l===":"){if(i===!0&&(a=!0),!c())break;if(e++,n.push(":"),e>7){r.error=!0;break}u-1>=0&&t[u-1]===":"&&(i=!0);continue}else if(l==="%"){if(!c())break;s=!0}else{o.push(l);continue}}return o.length&&(s?r.zone=o.join(""):a?n.push(o.join("")):n.push(Ol(o))),r.address=n.join(""),r}function sg(t,e={}){if(ig(t,":")<2)return{host:t,isIPV6:!1};let r=Wk(t);if(r.error)return{host:t,isIPV6:!1};{let n=r.address,o=r.address;return r.zone&&(n+="%"+r.zone,o+="%25"+r.zone),{host:n,escapedHost:o,isIPV6:!0}}}function Gk(t,e){let r="",n=!0,o=t.length;for(let s=0;s<o;s++){let i=t[s];i==="0"&&n?(s+1<=o&&t[s+1]===e||s+1===o)&&(r+=i,n=!1):(i===e?n=!0:n=!1,r+=i)}return r}function ig(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}var tg=/^\.\.?\//u,rg=/^\/\.(?:\/|$)/u,ng=/^\/\.\.(?:\/|$)/u,Kk=/^\/?(?:.|\n)*?(?=\/|$)/u;function Jk(t){let e=[];for(;t.length;)if(t.match(tg))t=t.replace(tg,"");else if(t.match(rg))t=t.replace(rg,"/");else if(t.match(ng))t=t.replace(ng,"/"),e.pop();else if(t==="."||t==="..")t="";else{let r=t.match(Kk);if(r){let n=r[0];t=t.slice(n.length),e.push(n)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function Yk(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 Xk(t,e){let r=[];if(t.userinfo!==void 0&&(r.push(t.userinfo),r.push("@")),t.host!==void 0){let n=unescape(t.host),o=og(n);if(o.isIPV4)n=o.host;else{let s=sg(o.host,{isIPV4:!1});s.isIPV6===!0?n=`[${s.escapedHost}]`:n=t.host}r.push(n)}return(typeof t.port=="number"||typeof t.port=="string")&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0}ag.exports={recomposeAuthority:Xk,normalizeComponentEncoding:Yk,removeDotSegments:Jk,normalizeIPv4:og,normalizeIPv6:sg,stringArrayToHexStripped:Ol}});var mg=k((vZ,pg)=>{"use strict";var Qk=/^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu,eS=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function ug(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function lg(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function dg(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 tS(t){return t.secure=ug(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function rS(t){if((t.port===(ug(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 nS(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(eS);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}`,s=Nl[o];t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function oS(t,e){let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,s=Nl[o];s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function sS(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!Qk.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function iS(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var fg={scheme:"http",domainHost:!0,parse:lg,serialize:dg},aS={scheme:"https",domainHost:fg.domainHost,parse:lg,serialize:dg},mi={scheme:"ws",domainHost:!0,parse:tS,serialize:rS},cS={scheme:"wss",domainHost:mi.domainHost,parse:mi.parse,serialize:mi.serialize},uS={scheme:"urn",parse:nS,serialize:oS,skipNormalize:!0},lS={scheme:"urn:uuid",parse:sS,serialize:iS,skipNormalize:!0},Nl={http:fg,https:aS,ws:mi,wss:cS,urn:uS,"urn:uuid":lS};pg.exports=Nl});var gg=k((bZ,gi)=>{"use strict";var{normalizeIPv6:dS,normalizeIPv4:fS,removeDotSegments:Ro,recomposeAuthority:pS,normalizeComponentEncoding:hi}=cg(),Cl=mg();function mS(t,e){return typeof t=="string"?t=$t(Dt(t,e),e):typeof t=="object"&&(t=Dt($t(t,e),e)),t}function hS(t,e,r){let n=Object.assign({scheme:"null"},r),o=hg(Dt(t,n),Dt(e,n),n,!0);return $t(o,{...n,skipEscape:!0})}function hg(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=Ro(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=Ro(e.path||""),o.query=e.query):(e.path?(e.path.charAt(0)==="/"?o.path=Ro(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=Ro(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 gS(t,e,r){return typeof t=="string"?(t=unescape(t),t=$t(hi(Dt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=$t(hi(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=$t(hi(Dt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=$t(hi(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=[],s=Cl[(n.scheme||r.scheme||"").toLowerCase()];s&&s.serialize&&s.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 i=pS(r,n);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path.charAt(0)!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=Ro(a)),i===void 0&&(a=a.replace(/^\/\//u,"/%2F")),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var _S=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function yS(t){let e=0;for(let r=0,n=t.length;r<n;++r)if(e=t.charCodeAt(r),e>126||_S[e])return!0;return!1}var vS=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\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=t.indexOf("%")!==-1,s=!1;r.reference==="suffix"&&(t=(r.scheme?r.scheme+":":"")+"//"+t);let i=t.match(vS);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){let c=fS(n.host);if(c.isIPV4===!1){let u=dS(c.host,{isIPV4:!1});n.host=u.host.toLowerCase(),s=u.isIPV6}else n.host=c.host,s=!0}n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&!n.path&&n.query===void 0?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=Cl[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===!1&&yS(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(o&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),o&&n.host!==void 0&&(n.host=unescape(n.host)),n.path!==void 0&&n.path.length&&(n.path=escape(unescape(n.path))),n.fragment!==void 0&&n.fragment.length&&(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 Zl={SCHEMES:Cl,normalize:mS,resolve:hS,resolveComponents:hg,equal:gS,serialize:$t,parse:Dt};gi.exports=Zl;gi.exports.default=Zl;gi.exports.fastUri=Zl});var yg=k(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});var _g=gg();_g.code='require("ajv/dist/runtime/uri").default';jl.default=_g});var zg=k(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.CodeGen=ze.Name=ze.nil=ze.stringify=ze.str=ze._=ze.KeywordCxt=void 0;var bS=To();Object.defineProperty(ze,"KeywordCxt",{enumerable:!0,get:function(){return bS.KeywordCxt}});var _n=U();Object.defineProperty(ze,"_",{enumerable:!0,get:function(){return _n._}});Object.defineProperty(ze,"str",{enumerable:!0,get:function(){return _n.str}});Object.defineProperty(ze,"stringify",{enumerable:!0,get:function(){return _n.stringify}});Object.defineProperty(ze,"nil",{enumerable:!0,get:function(){return _n.nil}});Object.defineProperty(ze,"Name",{enumerable:!0,get:function(){return _n.Name}});Object.defineProperty(ze,"CodeGen",{enumerable:!0,get:function(){return _n.CodeGen}});var xS=di(),$g=Po(),wS=fl(),Io=pi(),$S=U(),Oo=So(),_i=ko(),Al=Q(),vg=Xh(),kS=yg(),kg=(t,e)=>new RegExp(t,e);kg.code="new RegExp";var SS=["removeAdditional","useDefaults","coerceTypes"],zS=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),ES={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."},TS={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},bg=200;function PS(t){var e,r,n,o,s,i,a,c,u,l,d,h,m,f,p,g,v,b,w,E,N,ve,Pe,Pt,fr;let pr=t.strict,oa=(e=t.code)===null||e===void 0?void 0:e.optimize,af=oa===!0||oa===void 0?1:oa||0,cf=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:kg,hv=(o=t.uriResolver)!==null&&o!==void 0?o:kS.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:pr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:pr)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:pr)!==null&&l!==void 0?l:"log",strictTuples:(h=(d=t.strictTuples)!==null&&d!==void 0?d:pr)!==null&&h!==void 0?h:"log",strictRequired:(f=(m=t.strictRequired)!==null&&m!==void 0?m:pr)!==null&&f!==void 0?f:!1,code:t.code?{...t.code,optimize:af,regExp:cf}:{optimize:af,regExp:cf},loopRequired:(p=t.loopRequired)!==null&&p!==void 0?p:bg,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:bg,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(w=t.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(E=t.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(N=t.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(ve=t.validateSchema)!==null&&ve!==void 0?ve:!0,validateFormats:(Pe=t.validateFormats)!==null&&Pe!==void 0?Pe:!0,unicodeRegExp:(Pt=t.unicodeRegExp)!==null&&Pt!==void 0?Pt:!0,int32range:(fr=t.int32range)!==null&&fr!==void 0?fr:!0,uriResolver:hv}}var No=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...PS(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new $S.ValueScope({scope:{},prefixes:zS,es5:r,lines:n}),this.logger=ZS(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,wS.getRules)(),xg.call(this,ES,e,"NOT SUPPORTED"),xg.call(this,TS,e,"DEPRECATED","warn"),this._metaOpts=NS.call(this),e.formats&&IS.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&OS.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),RS.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=vg;n==="id"&&(o={...vg},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 s.call(this,l.$schema);let h=this._addSchema(l,d);return h.validate||i.call(this,h)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof $g.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({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 s.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 i of e)this.addSchema(i,void 0,n,o);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Oo.normalizeId)(r||s),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 s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(e){let r;for(;typeof(r=wg.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Io.SchemaEnv({schema:{},schemaId:n});if(r=Io.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=wg.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,Oo.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(MS.call(this,n,r),!r)return(0,Al.eachItem)(n,s=>Ml.call(this,s)),this;DS.call(this,r);let o={...r,type:(0,_i.getJSONTypes)(r.type),schemaType:(0,_i.getJSONTypes)(r.schemaType)};return(0,Al.eachItem)(n,o.type.length===0?s=>Ml.call(this,s,o):s=>o.type.forEach(i=>Ml.call(this,s,o,i))),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(s=>s.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,s)=>o+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let s=o.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Sg(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,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];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,Oo.normalizeId)(i||n);let u=Oo.getSchemaRefs.call(this,e,n);return c=new Io.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!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):Io.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{Io.compileSchema.call(this,e)}finally{this.opts=r}}};No.ValidationError=xS.default;No.MissingRefError=$g.default;ze.default=No;function xg(t,e,r,n="error"){for(let o in t){let s=o;s in e&&this.logger[n](`${r}: option ${o}. ${t[s]}`)}}function wg(t){return t=(0,Oo.normalizeId)(t),this.schemas[t]||this.refs[t]}function RS(){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 IS(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function OS(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 NS(){let t={...this.opts};for(let e of SS)delete t[e];return t}var CS={log(){},warn(){},error(){}};function ZS(t){if(t===!1)return CS;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 jS=/^[a-z_$][a-z0-9_$:-]*$/i;function MS(t,e){let{RULES:r}=this;if((0,Al.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!jS.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 Ml(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,_i.getJSONTypes)(e.type),schemaType:(0,_i.getJSONTypes)(e.schemaType)}};e.before?AS.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function AS(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 DS(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Sg(e)),t.validateSchema=this.compile(e,!0))}var qS={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Sg(t){return{anyOf:[t,qS]}}});var Eg=k(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});var LS={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Dl.default=LS});var Ig=k(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.callRef=Ir.getValidate=void 0;var US=Po(),Tg=nt(),Ve=U(),yn=Mt(),Pg=pi(),yi=Q(),FS={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Pg.resolveRef.call(c,u,o,r);if(l===void 0)throw new US.default(n.opts.uriResolver,o,r);if(l instanceof Pg.SchemaEnv)return h(l);return m(l);function d(){if(s===u)return vi(t,i,s,s.$async);let f=e.scopeValue("root",{ref:u});return vi(t,(0,Ve._)`${f}.validate`,u,u.$async)}function h(f){let p=Rg(t,f);vi(t,p,f,f.$async)}function m(f){let p=e.scopeValue("schema",a.code.source===!0?{ref:f,code:(0,Ve.stringify)(f)}:{ref:f}),g=e.name("valid"),v=t.subschema({schema:f,dataTypes:[],schemaPath:Ve.nil,topSchemaRef:p,errSchemaPath:r},g);t.mergeEvaluated(v),t.ok(g)}}};function Rg(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ve._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ir.getValidate=Rg;function vi(t,e,r,n){let{gen:o,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?yn.default.this:Ve.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let f=o.let("valid");o.try(()=>{o.code((0,Ve._)`await ${(0,Tg.callValidateCode)(t,e,u)}`),m(e),i||o.assign(f,!0)},p=>{o.if((0,Ve._)`!(${p} instanceof ${s.ValidationError})`,()=>o.throw(p)),h(p),i||o.assign(f,!1)}),t.ok(f)}function d(){t.result((0,Tg.callValidateCode)(t,e,u),()=>m(e),()=>h(e))}function h(f){let p=(0,Ve._)`${f}.errors`;o.assign(yn.default.vErrors,(0,Ve._)`${yn.default.vErrors} === null ? ${p} : ${yn.default.vErrors}.concat(${p})`),o.assign(yn.default.errors,(0,Ve._)`${yn.default.vErrors}.length`)}function m(f){var p;if(!s.opts.unevaluated)return;let g=(p=r?.validate)===null||p===void 0?void 0:p.evaluated;if(s.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(s.props=yi.mergeEvaluated.props(o,g.props,s.props));else{let v=o.var("props",(0,Ve._)`${f}.evaluated.props`);s.props=yi.mergeEvaluated.props(o,v,s.props,Ve.Name)}if(s.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(s.items=yi.mergeEvaluated.items(o,g.items,s.items));else{let v=o.var("items",(0,Ve._)`${f}.evaluated.items`);s.items=yi.mergeEvaluated.items(o,v,s.items,Ve.Name)}}}Ir.callRef=vi;Ir.default=FS});var Og=k(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});var VS=Eg(),BS=Ig(),HS=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",VS.default,BS.default];ql.default=HS});var Ng=k(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});var bi=U(),ar=bi.operators,xi={maximum:{okStr:"<=",ok:ar.LTE,fail:ar.GT},minimum:{okStr:">=",ok:ar.GTE,fail:ar.LT},exclusiveMaximum:{okStr:"<",ok:ar.LT,fail:ar.GTE},exclusiveMinimum:{okStr:">",ok:ar.GT,fail:ar.LTE}},WS={message:({keyword:t,schemaCode:e})=>(0,bi.str)`must be ${xi[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,bi._)`{comparison: ${xi[t].okStr}, limit: ${e}}`},GS={keyword:Object.keys(xi),type:"number",schemaType:"number",$data:!0,error:WS,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,bi._)`${r} ${xi[e].fail} ${n} || isNaN(${r})`)}};Ll.default=GS});var Cg=k(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});var Co=U(),KS={message:({schemaCode:t})=>(0,Co.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Co._)`{multipleOf: ${t}}`},JS={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:KS,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,Co._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Co._)`${i} !== parseInt(${i})`;t.fail$data((0,Co._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Ul.default=JS});var jg=k(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});function Zg(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}Fl.default=Zg;Zg.code='require("ajv/dist/runtime/ucs2length").default'});var Mg=k(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});var Or=U(),YS=Q(),XS=jg(),QS={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Or.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Or._)`{limit: ${t}}`},ez={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:QS,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,s=e==="maxLength"?Or.operators.GT:Or.operators.LT,i=o.opts.unicode===!1?(0,Or._)`${r}.length`:(0,Or._)`${(0,YS.useFunc)(t.gen,XS.default)}(${r})`;t.fail$data((0,Or._)`${i} ${s} ${n}`)}};Vl.default=ez});var Ag=k(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});var tz=nt(),wi=U(),rz={message:({schemaCode:t})=>(0,wi.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,wi._)`{pattern: ${t}}`},nz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:rz,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:s}=t,i=s.opts.unicodeRegExp?"u":"",a=r?(0,wi._)`(new RegExp(${o}, ${i}))`:(0,tz.usePattern)(t,n);t.fail$data((0,wi._)`!${a}.test(${e})`)}};Bl.default=nz});var Dg=k(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});var Zo=U(),oz={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Zo.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Zo._)`{limit: ${t}}`},sz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:oz,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Zo.operators.GT:Zo.operators.LT;t.fail$data((0,Zo._)`Object.keys(${r}).length ${o} ${n}`)}};Hl.default=sz});var qg=k(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});var jo=nt(),Mo=U(),iz=Q(),az={message:({params:{missingProperty:t}})=>(0,Mo.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Mo._)`{missingProperty: ${t}}`},cz={keyword:"required",type:"object",schemaType:"array",$data:!0,error:az,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:f}=t.it;for(let p of r)if(m?.[p]===void 0&&!f.has(p)){let g=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${p}" is not defined at "${g}" (strictRequired)`;(0,iz.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(Mo.nil,d);else for(let m of r)(0,jo.checkReportMissingProp)(t,m)}function l(){let m=e.let("missing");if(c||s){let f=e.let("valid",!0);t.block$data(f,()=>h(m,f)),t.ok(f)}else e.if((0,jo.checkMissingProp)(t,r,m)),(0,jo.reportMissingProp)(t,m),e.else()}function d(){e.forOf("prop",n,m=>{t.setParams({missingProperty:m}),e.if((0,jo.noPropertyInData)(e,o,m,a.ownProperties),()=>t.error())})}function h(m,f){t.setParams({missingProperty:m}),e.forOf(m,n,()=>{e.assign(f,(0,jo.propertyInData)(e,o,m,a.ownProperties)),e.if((0,Mo.not)(f),()=>{t.error(),e.break()})},Mo.nil)}}};Wl.default=cz});var Lg=k(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});var Ao=U(),uz={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Ao.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Ao._)`{limit: ${t}}`},lz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:uz,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Ao.operators.GT:Ao.operators.LT;t.fail$data((0,Ao._)`${r}.length ${o} ${n}`)}};Gl.default=lz});var $i=k(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});var Ug=bl();Ug.code='require("ajv/dist/runtime/equal").default';Kl.default=Ug});var Fg=k(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});var Jl=ko(),Ee=U(),dz=Q(),fz=$i(),pz={message:({params:{i:t,j:e}})=>(0,Ee.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Ee._)`{i: ${t}, j: ${e}}`},mz={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:pz,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=s.items?(0,Jl.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,Ee._)`${i} === false`),t.ok(c);function l(){let f=e.let("i",(0,Ee._)`${r}.length`),p=e.let("j");t.setParams({i:f,j:p}),e.assign(c,!0),e.if((0,Ee._)`${f} > 1`,()=>(d()?h:m)(f,p))}function d(){return u.length>0&&!u.some(f=>f==="object"||f==="array")}function h(f,p){let g=e.name("item"),v=(0,Jl.checkDataTypes)(u,g,a.opts.strictNumbers,Jl.DataType.Wrong),b=e.const("indices",(0,Ee._)`{}`);e.for((0,Ee._)`;${f}--;`,()=>{e.let(g,(0,Ee._)`${r}[${f}]`),e.if(v,(0,Ee._)`continue`),u.length>1&&e.if((0,Ee._)`typeof ${g} == "string"`,(0,Ee._)`${g} += "_"`),e.if((0,Ee._)`typeof ${b}[${g}] == "number"`,()=>{e.assign(p,(0,Ee._)`${b}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,Ee._)`${b}[${g}] = ${f}`)})}function m(f,p){let g=(0,dz.useFunc)(e,fz.default),v=e.name("outer");e.label(v).for((0,Ee._)`;${f}--;`,()=>e.for((0,Ee._)`${p} = ${f}; ${p}--;`,()=>e.if((0,Ee._)`${g}(${r}[${f}], ${r}[${p}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Yl.default=mz});var Vg=k(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});var Xl=U(),hz=Q(),gz=$i(),_z={message:"must be equal to constant",params:({schemaCode:t})=>(0,Xl._)`{allowedValue: ${t}}`},yz={keyword:"const",$data:!0,error:_z,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,Xl._)`!${(0,hz.useFunc)(e,gz.default)}(${r}, ${o})`):t.fail((0,Xl._)`${s} !== ${r}`)}};Ql.default=yz});var Bg=k(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});var Do=U(),vz=Q(),bz=$i(),xz={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Do._)`{allowedValues: ${t}}`},wz={keyword:"enum",schemaType:"array",$data:!0,error:xz,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,vz.useFunc)(e,bz.default)),l;if(a||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",s);l=(0,Do.or)(...o.map((f,p)=>h(m,p)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,m=>e.if((0,Do._)`${u()}(${r}, ${m})`,()=>e.assign(l,!0).break()))}function h(m,f){let p=o[f];return typeof p=="object"&&p!==null?(0,Do._)`${u()}(${r}, ${m}[${f}])`:(0,Do._)`${r} === ${p}`}}};ed.default=wz});var Hg=k(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});var $z=Ng(),kz=Cg(),Sz=Mg(),zz=Ag(),Ez=Dg(),Tz=qg(),Pz=Lg(),Rz=Fg(),Iz=Vg(),Oz=Bg(),Nz=[$z.default,kz.default,Sz.default,zz.default,Ez.default,Tz.default,Pz.default,Rz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Iz.default,Oz.default];td.default=Nz});var nd=k(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.validateAdditionalItems=void 0;var Nr=U(),rd=Q(),Cz={message:({params:{len:t}})=>(0,Nr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Nr._)`{limit: ${t}}`},Zz={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Cz,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,rd.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Wg(t,n)}};function Wg(t,e){let{gen:r,schema:n,data:o,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Nr._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Nr._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,rd.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Nr._)`${a} <= ${e.length}`);r.if((0,Nr.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:rd.Type.Num},u),i.allErrors||r.if((0,Nr.not)(u),()=>r.break())})}}qo.validateAdditionalItems=Wg;qo.default=Zz});var od=k(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.validateTuple=void 0;var Gg=U(),ki=Q(),jz=nt(),Mz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Kg(t,"additionalItems",e);r.items=!0,!(0,ki.alwaysValidSchema)(r,e)&&t.ok((0,jz.validateArray)(t))}};function Kg(t,e,r=t.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=ki.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,Gg._)`${s}.length`);r.forEach((d,h)=>{(0,ki.alwaysValidSchema)(a,d)||(n.if((0,Gg._)`${u} > ${h}`,()=>t.subschema({keyword:i,schemaProp:h,dataProp:h},c)),t.ok(c))});function l(d){let{opts:h,errSchemaPath:m}=a,f=r.length,p=f===d.minItems&&(f===d.maxItems||d[e]===!1);if(h.strictTuples&&!p){let g=`"${i}" is ${f}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,ki.checkStrictMode)(a,g,h.strictTuples)}}}Lo.validateTuple=Kg;Lo.default=Mz});var Jg=k(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});var Az=od(),Dz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Az.validateTuple)(t,"items")};sd.default=Dz});var Xg=k(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});var Yg=U(),qz=Q(),Lz=nt(),Uz=nd(),Fz={message:({params:{len:t}})=>(0,Yg.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Yg._)`{limit: ${t}}`},Vz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Fz,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,qz.alwaysValidSchema)(n,e)&&(o?(0,Uz.validateAdditionalItems)(t,o):t.ok((0,Lz.validateArray)(t)))}};id.default=Vz});var Qg=k(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});var st=U(),Si=Q(),Bz={message:({params:{min:t,max:e}})=>e===void 0?(0,st.str)`must contain at least ${t} valid item(s)`:(0,st.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,st._)`{minContains: ${t}}`:(0,st._)`{minContains: ${t}, maxContains: ${e}}`},Hz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Bz,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,st._)`${o}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Si.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Si.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Si.alwaysValidSchema)(s,r)){let p=(0,st._)`${l} >= ${i}`;a!==void 0&&(p=(0,st._)`${p} && ${l} <= ${a}`),t.pass(p);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?m(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,st._)`${o}.length > 0`,h)):(e.let(d,!1),h()),t.result(d,()=>t.reset());function h(){let p=e.name("_valid"),g=e.let("count",0);m(p,()=>e.if(p,()=>f(g)))}function m(p,g){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:Si.Type.Num,compositeRule:!0},p),g()})}function f(p){e.code((0,st._)`${p}++`),a===void 0?e.if((0,st._)`${p} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,st._)`${p} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,st._)`${p} >= ${i}`,()=>e.assign(d,!0)))}}};ad.default=Hz});var r_=k(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.validateSchemaDeps=kt.validatePropertyDeps=kt.error=void 0;var cd=U(),Wz=Q(),Uo=nt();kt.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,cd.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,cd._)`{property: ${t},
|
|
7
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,L._)`[${o}]`)}}}function N$({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,L._)`${e} !== undefined`,()=>t.assign((0,L._)`${e}[${r}]`,n))}function ml(t,e,r,n=pn.Correct){let o=n===pn.Correct?L.operators.EQ:L.operators.NEQ,s;switch(t){case"null":return(0,L._)`${e} ${o} null`;case"array":s=(0,L._)`Array.isArray(${e})`;break;case"object":s=(0,L._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,L._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,L._)`typeof ${e} ${o} ${t}`}return n===pn.Correct?s:(0,L.not)(s);function i(a=L.nil){return(0,L.and)((0,L._)`typeof ${e} == "number"`,a,r?(0,L._)`isFinite(${e})`:L.nil)}}Ce.checkDataType=ml;function hl(t,e,r,n){if(t.length===1)return ml(t[0],e,r,n);let o,s=(0,bh.toHash)(t);if(s.array&&s.object){let i=(0,L._)`typeof ${e} != "object"`;o=s.null?i:(0,L._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else o=L.nil;s.number&&delete s.integer;for(let i in s)o=(0,L.and)(o,ml(i,e,r,n));return o}Ce.checkDataTypes=hl;var C$={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,L._)`{type: ${t}}`:(0,L._)`{type: ${e}}`};function gl(t){let e=Z$(t);(0,T$.reportError)(e,C$)}Ce.reportTypeError=gl;function Z$(t){let{gen:e,data:r,schema:n}=t,o=(0,bh.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var kh=k(ai=>{"use strict";Object.defineProperty(ai,"__esModule",{value:!0});ai.assignDefaults=void 0;var mn=U(),j$=Q();function M$(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)$h(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,s)=>$h(t,s,o.default))}ai.assignDefaults=M$;function $h(t,e,r){let{gen:n,compositeRule:o,data:s,opts:i}=t;if(r===void 0)return;let a=(0,mn._)`${s}${(0,mn.getProperty)(e)}`;if(o){(0,j$.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,mn._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,mn._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,mn._)`${a} = ${(0,mn.stringify)(r)}`)}});var ot=k(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.validateUnion=re.validateArray=re.usePattern=re.callValidateCode=re.schemaProperties=re.allSchemaProperties=re.noPropertyInData=re.propertyInData=re.isOwnProperty=re.hasPropFunc=re.reportMissingProp=re.checkMissingProp=re.checkReportMissingProp=void 0;var ae=U(),_l=Q(),nr=At(),A$=Q();function D$(t,e){let{gen:r,data:n,it:o}=t;r.if(vl(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,ae._)`${e}`},!0),t.error()})}re.checkReportMissingProp=D$;function q$({gen:t,data:e,it:{opts:r}},n,o){return(0,ae.or)(...n.map(s=>(0,ae.and)(vl(t,e,s,r.ownProperties),(0,ae._)`${o} = ${s}`)))}re.checkMissingProp=q$;function L$(t,e){t.setParams({missingProperty:e},!0),t.error()}re.reportMissingProp=L$;function Sh(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,ae._)`Object.prototype.hasOwnProperty`})}re.hasPropFunc=Sh;function yl(t,e,r){return(0,ae._)`${Sh(t)}.call(${e}, ${r})`}re.isOwnProperty=yl;function U$(t,e,r,n){let o=(0,ae._)`${e}${(0,ae.getProperty)(r)} !== undefined`;return n?(0,ae._)`${o} && ${yl(t,e,r)}`:o}re.propertyInData=U$;function vl(t,e,r,n){let o=(0,ae._)`${e}${(0,ae.getProperty)(r)} === undefined`;return n?(0,ae.or)(o,(0,ae.not)(yl(t,e,r))):o}re.noPropertyInData=vl;function zh(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}re.allSchemaProperties=zh;function F$(t,e){return zh(e).filter(r=>!(0,_l.alwaysValidSchema)(t,e[r]))}re.schemaProperties=F$;function V$({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let d=u?(0,ae._)`${t}, ${e}, ${n}${o}`:e,l=[[nr.default.instancePath,(0,ae.strConcat)(nr.default.instancePath,s)],[nr.default.parentData,i.parentData],[nr.default.parentDataProperty,i.parentDataProperty],[nr.default.rootData,nr.default.rootData]];i.opts.dynamicRef&&l.push([nr.default.dynamicAnchors,nr.default.dynamicAnchors]);let h=(0,ae._)`${d}, ${r.object(...l)}`;return c!==ae.nil?(0,ae._)`${a}.call(${c}, ${h})`:(0,ae._)`${a}(${h})`}re.callValidateCode=V$;var B$=(0,ae._)`new RegExp`;function H$({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,ae._)`${o.code==="new RegExp"?B$:(0,A$.useFunc)(t,o)}(${r}, ${n})`})}re.usePattern=H$;function W$(t){let{gen:e,data:r,keyword:n,it:o}=t,s=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,ae._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:_l.Type.Num},s),e.if((0,ae.not)(s),a)})}}re.validateArray=W$;function G$(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,_l.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let d=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,ae._)`${i} || ${a}`),t.mergeValidEvaluated(d,a)||e.if((0,ae.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}re.validateUnion=G$});var Ph=k(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.validateKeywordUsage=wt.validSchemaType=wt.funcKeywordCode=wt.macroKeywordCode=void 0;var De=U(),Pr=At(),K$=ot(),J$=$o();function Y$(t,e){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=t,a=e.macro.call(i.self,o,s,i),c=Th(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:De.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}wt.macroKeywordCode=Y$;function X$(t,e){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=t;ek(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,d=Th(n,o,u),l=n.let("valid");t.block$data(l,h),t.ok((r=e.valid)!==null&&r!==void 0?r:l);function h(){if(e.errors===!1)p(),e.modifying&&Eh(t),g(()=>t.error());else{let v=e.async?m():f();e.modifying&&Eh(t),g(()=>Q$(t,v))}}function m(){let v=n.let("ruleErrs",null);return n.try(()=>p((0,De._)`await `),b=>n.assign(l,!1).if((0,De._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,De._)`${b}.errors`),()=>n.throw(b))),v}function f(){let v=(0,De._)`${d}.errors`;return n.assign(v,null),p(De.nil),v}function p(v=e.async?(0,De._)`await `:De.nil){let b=c.opts.passContext?Pr.default.this:Pr.default.self,w=!("compile"in e&&!a||e.schema===!1);n.assign(l,(0,De._)`${v}${(0,K$.callValidateCode)(t,d,b,w)}`,e.modifying)}function g(v){var b;n.if((0,De.not)((b=e.valid)!==null&&b!==void 0?b:l),v)}}wt.funcKeywordCode=X$;function Eh(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,De._)`${n.parentData}[${n.parentDataProperty}]`))}function Q$(t,e){let{gen:r}=t;r.if((0,De._)`Array.isArray(${e})`,()=>{r.assign(Pr.default.vErrors,(0,De._)`${Pr.default.vErrors} === null ? ${e} : ${Pr.default.vErrors}.concat(${e})`).assign(Pr.default.errors,(0,De._)`${Pr.default.vErrors}.length`),(0,J$.extendErrors)(t)},()=>t.error())}function ek({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Th(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,De.stringify)(r)})}function tk(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")}wt.validSchemaType=tk;function rk({schema:t,opts:e,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}wt.validateKeywordUsage=rk});var Ih=k(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});or.extendSubschemaMode=or.extendSubschemaData=or.getSubschema=void 0;var $t=U(),Rh=Q();function nk(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,$t._)`${t.schemaPath}${(0,$t.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,$t._)`${t.schemaPath}${(0,$t.getProperty)(e)}${(0,$t.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Rh.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}or.getSubschema=nk;function ok(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:d,opts:l}=e,h=a.let("data",(0,$t._)`${e.data}${(0,$t.getProperty)(r)}`,!0);c(h),t.errorPath=(0,$t.str)`${u}${(0,Rh.getErrorPath)(r,n,l.jsPropertySyntax)}`,t.parentDataProperty=(0,$t._)`${r}`,t.dataPathArr=[...d,t.parentDataProperty]}if(o!==void 0){let u=o instanceof $t.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);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]}}or.extendSubschemaData=ok;function sk(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}or.extendSubschemaMode=sk});var bl=k((fZ,Oh)=>{"use strict";Oh.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,s;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(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var Ch=k((pZ,Nh)=>{"use strict";var sr=Nh.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(){};ci(e,n,o,t,"",t)};sr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};sr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};sr.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};sr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ci(t,e,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,s,i,a,c,u);for(var d in n){var l=n[d];if(Array.isArray(l)){if(d in sr.arrayKeywords)for(var h=0;h<l.length;h++)ci(t,e,r,l[h],o+"/"+d+"/"+h,s,o,d,n,h)}else if(d in sr.propsKeywords){if(l&&typeof l=="object")for(var m in l)ci(t,e,r,l[m],o+"/"+d+"/"+ik(m),s,o,d,n,m)}else(d in sr.keywords||t.allKeys&&!(d in sr.skipKeywords))&&ci(t,e,r,l,o+"/"+d,s,o,d,n)}r(n,o,s,i,a,c,u)}}function ik(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var So=k(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.getSchemaRefs=Ve.resolveUrl=Ve.normalizeId=Ve._getFullPath=Ve.getFullPath=Ve.inlineRef=void 0;var ak=Q(),ck=bl(),uk=Ch(),lk=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function dk(t,e=!0){return typeof t=="boolean"?!0:e===!0?!xl(t):e?Zh(t)<=e:!1}Ve.inlineRef=dk;var fk=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function xl(t){for(let e in t){if(fk.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(xl)||typeof r=="object"&&xl(r))return!0}return!1}function Zh(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!lk.has(r)&&(typeof t[r]=="object"&&(0,ak.eachItem)(t[r],n=>e+=Zh(n)),e===1/0))return 1/0}return e}function jh(t,e="",r){r!==!1&&(e=hn(e));let n=t.parse(e);return Mh(t,n)}Ve.getFullPath=jh;function Mh(t,e){return t.serialize(e).split("#")[0]+"#"}Ve._getFullPath=Mh;var pk=/#\/?$/;function hn(t){return t?t.replace(pk,""):""}Ve.normalizeId=hn;function mk(t,e,r){return r=hn(r),t.resolve(e,r)}Ve.resolveUrl=mk;var hk=/^[a-z_][-a-z0-9._]*$/i;function gk(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=hn(t[r]||e),s={"":o},i=jh(n,o,!1),a={},c=new Set;return uk(t,{allKeys:!0},(l,h,m,f)=>{if(f===void 0)return;let p=i+h,g=s[f];typeof l[r]=="string"&&(g=v.call(this,l[r])),b.call(this,l.$anchor),b.call(this,l.$dynamicAnchor),s[h]=g;function v(w){let E=this.opts.uriResolver.resolve;if(w=hn(g?E(g,w):w),c.has(w))throw d(w);c.add(w);let N=this.refs[w];return typeof N=="string"&&(N=this.refs[N]),typeof N=="object"?u(l,N.schema,w):w!==hn(p)&&(w[0]==="#"?(u(l,a[w],w),a[w]=l):this.refs[w]=p),w}function b(w){if(typeof w=="string"){if(!hk.test(w))throw new Error(`invalid anchor "${w}"`);v.call(this,`#${w}`)}}}),a;function u(l,h,m){if(h!==void 0&&!ck(l,h))throw d(m)}function d(l){return new Error(`reference "${l}" resolves to more than one schema`)}}Ve.getSchemaRefs=gk});var To=k(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.getData=ir.KeywordCxt=ir.validateFunctionCode=void 0;var Uh=_h(),Ah=ko(),$l=pl(),ui=ko(),_k=kh(),Eo=Ph(),wl=Ih(),O=U(),D=At(),yk=So(),Dt=Q(),zo=$o();function vk(t){if(Bh(t)&&(Hh(t),Vh(t))){wk(t);return}Fh(t,()=>(0,Uh.topBoolOrEmptySchema)(t))}ir.validateFunctionCode=vk;function Fh({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,(0,O._)`${D.default.data}, ${D.default.valCxt}`,n.$async,()=>{t.code((0,O._)`"use strict"; ${Dh(r,o)}`),xk(t,o),t.code(s)}):t.func(e,(0,O._)`${D.default.data}, ${bk(o)}`,n.$async,()=>t.code(Dh(r,o)).code(s))}function bk(t){return(0,O._)`{${D.default.instancePath}="", ${D.default.parentData}, ${D.default.parentDataProperty}, ${D.default.rootData}=${D.default.data}${t.dynamicRef?(0,O._)`, ${D.default.dynamicAnchors}={}`:O.nil}}={}`}function xk(t,e){t.if(D.default.valCxt,()=>{t.var(D.default.instancePath,(0,O._)`${D.default.valCxt}.${D.default.instancePath}`),t.var(D.default.parentData,(0,O._)`${D.default.valCxt}.${D.default.parentData}`),t.var(D.default.parentDataProperty,(0,O._)`${D.default.valCxt}.${D.default.parentDataProperty}`),t.var(D.default.rootData,(0,O._)`${D.default.valCxt}.${D.default.rootData}`),e.dynamicRef&&t.var(D.default.dynamicAnchors,(0,O._)`${D.default.valCxt}.${D.default.dynamicAnchors}`)},()=>{t.var(D.default.instancePath,(0,O._)`""`),t.var(D.default.parentData,(0,O._)`undefined`),t.var(D.default.parentDataProperty,(0,O._)`undefined`),t.var(D.default.rootData,D.default.data),e.dynamicRef&&t.var(D.default.dynamicAnchors,(0,O._)`{}`)})}function wk(t){let{schema:e,opts:r,gen:n}=t;Fh(t,()=>{r.$comment&&e.$comment&&Gh(t),Ek(t),n.let(D.default.vErrors,null),n.let(D.default.errors,0),r.unevaluated&&$k(t),Wh(t),Rk(t)})}function $k(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 Dh(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 kk(t,e){if(Bh(t)&&(Hh(t),Vh(t))){Sk(t,e);return}(0,Uh.boolOrEmptySchema)(t,e)}function Vh({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 Bh(t){return typeof t.schema!="boolean"}function Sk(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&Gh(t),Tk(t),Pk(t);let s=n.const("_errs",D.default.errors);Wh(t,s),n.var(e,(0,O._)`${s} === ${D.default.errors}`)}function Hh(t){(0,Dt.checkUnknownRules)(t),zk(t)}function Wh(t,e){if(t.opts.jtd)return qh(t,[],!1,e);let r=(0,Ah.getSchemaTypes)(t.schema),n=(0,Ah.coerceAndCheckDataType)(t,r);qh(t,r,!n,e)}function zk(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Dt.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function Ek(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Dt.checkStrictMode)(t,"default is ignored in the schema root")}function Tk(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,yk.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function Pk(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Gh({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)t.code((0,O._)`${D.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,O.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,O._)`${D.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function Rk(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=t;r.$async?e.if((0,O._)`${D.default.errors} === 0`,()=>e.return(D.default.data),()=>e.throw((0,O._)`new ${o}(${D.default.vErrors})`)):(e.assign((0,O._)`${n}.errors`,D.default.vErrors),s.unevaluated&&Ik(t),e.return((0,O._)`${D.default.errors} === 0`))}function Ik({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 qh(t,e,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:d}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Dt.schemaHasRulesButRef)(s,d))){o.block(()=>Jh(t,"$ref",d.all.$ref.definition));return}c.jtd||Ok(t,e),o.block(()=>{for(let h of d.rules)l(h);l(d.post)});function l(h){(0,$l.shouldUseGroup)(s,h)&&(h.type?(o.if((0,ui.checkDataType)(h.type,i,c.strictNumbers)),Lh(t,h),e.length===1&&e[0]===h.type&&r&&(o.else(),(0,ui.reportTypeError)(t)),o.endIf()):Lh(t,h),a||o.if((0,O._)`${D.default.errors} === ${n||0}`))}}function Lh(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,_k.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,$l.shouldUseRule)(n,s)&&Jh(t,s.keyword,s.definition,e.type)})}function Ok(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(Nk(t,e),t.opts.allowUnionTypes||Ck(t,e),Zk(t,t.dataTypes))}function Nk(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Kh(t.dataTypes,r)||kl(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),Mk(t,e)}}function Ck(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&kl(t,"use allowUnionTypes to allow union type keyword")}function Zk(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,$l.shouldUseRule)(t.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>jk(e,i))&&kl(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function jk(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Kh(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function Mk(t,e){let r=[];for(let n of t.dataTypes)Kh(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function kl(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Dt.checkStrictMode)(t,e,t.opts.strictTypes)}var li=class{constructor(e,r,n){if((0,Eo.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,Dt.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",Yh(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Eo.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",D.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:s,def:i}=this;n.if((0,O.or)((0,O._)`${o} === undefined`,r)),e!==O.nil&&n.assign(e,!0),(s.length||i.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:s}=this;return(0,O.or)(i(),a());function i(){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,ui.checkDataTypes)(c,r,s.opts.strictNumbers,ui.DataType.Wrong)}`}return O.nil}function a(){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,wl.getSubschema)(this.it,e);(0,wl.extendSubschemaData)(n,this.it,e),(0,wl.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return kk(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Dt.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Dt.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}};ir.KeywordCxt=li;function Jh(t,e,r,n){let o=new li(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,Eo.funcKeywordCode)(o,r):"macro"in r?(0,Eo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,Eo.funcKeywordCode)(o,r)}var Ak=/^\/(?:[^~]|~0|~1)*$/,Dk=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Yh(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,s;if(t==="")return D.default.rootData;if(t[0]==="/"){if(!Ak.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,s=D.default.rootData}else{let u=Dk.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let d=+u[1];if(o=u[2],o==="#"){if(d>=e)throw new Error(c("property/index",d));return n[e-d]}if(d>e)throw new Error(c("data",d));if(s=r[e-d],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,O._)`${s}${(0,O.getProperty)((0,Dt.unescapeJsonPointer)(u))}`,i=(0,O._)`${i} && ${s}`);return i;function c(u,d){return`Cannot access ${u} ${d} levels up, current level is ${e}`}}ir.getData=Yh});var di=k(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});var Sl=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};zl.default=Sl});var Po=k(Pl=>{"use strict";Object.defineProperty(Pl,"__esModule",{value:!0});var El=So(),Tl=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,El.resolveUrl)(e,r,n),this.missingSchema=(0,El.normalizeId)((0,El.getFullPath)(e,this.missingRef))}};Pl.default=Tl});var pi=k(st=>{"use strict";Object.defineProperty(st,"__esModule",{value:!0});st.resolveSchema=st.getCompilingSchema=st.resolveRef=st.compileSchema=st.SchemaEnv=void 0;var mt=U(),qk=di(),Rr=At(),ht=So(),Xh=Q(),Lk=To(),gn=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,ht.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};st.SchemaEnv=gn;function Il(t){let e=Qh.call(this,t);if(e)return e;let r=(0,ht.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new mt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:qk.default,code:(0,mt._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Rr.default.data,parentData:Rr.default.parentData,parentDataProperty:Rr.default.parentDataProperty,dataNames:[Rr.default.data],dataPathArr:[mt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,mt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:mt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,mt._)`""`,opts:this.opts,self:this},d;try{this._compilations.add(t),(0,Lk.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let l=i.toString();d=`${i.scopeRefs(Rr.default.scope)}return ${l}`,this.opts.code.process&&(d=this.opts.code.process(d,t));let m=new Function(`${Rr.default.self}`,`${Rr.default.scope}`,d)(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:l,scopeValues:i._values}),this.opts.unevaluated){let{props:f,items:p}=u;m.evaluated={props:f instanceof mt.Name?void 0:f,items:p instanceof mt.Name?void 0:p,dynamicProps:f instanceof mt.Name,dynamicItems:p instanceof mt.Name},m.source&&(m.source.evaluated=(0,mt.stringify)(m.evaluated))}return t.validate=m,t}catch(l){throw delete t.validate,delete t.validateName,d&&this.logger.error("Error compiling schema, function code:",d),l}finally{this._compilations.delete(t)}}st.compileSchema=Il;function Uk(t,e,r){var n;r=(0,ht.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let s=Bk.call(this,t,r);if(s===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new gn({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=Fk.call(this,s)}st.resolveRef=Uk;function Fk(t){return(0,ht.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Il.call(this,t)}function Qh(t){for(let e of this._compilations)if(Vk(e,t))return e}st.getCompilingSchema=Qh;function Vk(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function Bk(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||fi.call(this,t,e)}function fi(t,e){let r=this.opts.uriResolver.parse(e),n=(0,ht._getFullPath)(this.opts.uriResolver,r),o=(0,ht.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return Rl.call(this,r,t);let s=(0,ht.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=fi.call(this,t,i);return typeof a?.schema!="object"?void 0:Rl.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Il.call(this,i),s===(0,ht.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,ht.resolveUrl)(this.opts.uriResolver,o,u)),new gn({schema:a,schemaId:c,root:t,baseId:o})}return Rl.call(this,r,i)}}st.resolveSchema=fi;var Hk=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Rl(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Xh.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!Hk.has(a)&&u&&(e=(0,ht.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Xh.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ht.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=fi.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new gn({schema:r,schemaId:i,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var eg=k((vZ,Wk)=>{Wk.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 rg=k((bZ,tg)=>{"use strict";var Gk={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};tg.exports={HEX:Gk}});var lg=k((xZ,ug)=>{"use strict";var{HEX:Kk}=rg();function ig(t){if(cg(t,".")<3)return{host:t,isIPV4:!1};let e=t.match(/^(?:(?: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])$/u)||[],[r]=e;return r?{host:Yk(r,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function Ol(t,e=!1){let r="",n=!0;for(let o of t){if(Kk[o]===void 0)return;o!=="0"&&n===!0&&(n=!1),n||(r+=o)}return e&&r.length===0&&(r="0"),r}function Jk(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=!1;function c(){if(o.length){if(s===!1){let u=Ol(o);if(u!==void 0)n.push(u);else return r.error=!0,!1}o.length=0}return!0}for(let u=0;u<t.length;u++){let d=t[u];if(!(d==="["||d==="]"))if(d===":"){if(i===!0&&(a=!0),!c())break;if(e++,n.push(":"),e>7){r.error=!0;break}u-1>=0&&t[u-1]===":"&&(i=!0);continue}else if(d==="%"){if(!c())break;s=!0}else{o.push(d);continue}}return o.length&&(s?r.zone=o.join(""):a?n.push(o.join("")):n.push(Ol(o))),r.address=n.join(""),r}function ag(t,e={}){if(cg(t,":")<2)return{host:t,isIPV6:!1};let r=Jk(t);if(r.error)return{host:t,isIPV6:!1};{let n=r.address,o=r.address;return r.zone&&(n+="%"+r.zone,o+="%25"+r.zone),{host:n,escapedHost:o,isIPV6:!0}}}function Yk(t,e){let r="",n=!0,o=t.length;for(let s=0;s<o;s++){let i=t[s];i==="0"&&n?(s+1<=o&&t[s+1]===e||s+1===o)&&(r+=i,n=!1):(i===e?n=!0:n=!1,r+=i)}return r}function cg(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}var ng=/^\.\.?\//u,og=/^\/\.(?:\/|$)/u,sg=/^\/\.\.(?:\/|$)/u,Xk=/^\/?(?:.|\n)*?(?=\/|$)/u;function Qk(t){let e=[];for(;t.length;)if(t.match(ng))t=t.replace(ng,"");else if(t.match(og))t=t.replace(og,"/");else if(t.match(sg))t=t.replace(sg,"/"),e.pop();else if(t==="."||t==="..")t="";else{let r=t.match(Xk);if(r){let n=r[0];t=t.slice(n.length),e.push(n)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function eS(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 tS(t,e){let r=[];if(t.userinfo!==void 0&&(r.push(t.userinfo),r.push("@")),t.host!==void 0){let n=unescape(t.host),o=ig(n);if(o.isIPV4)n=o.host;else{let s=ag(o.host,{isIPV4:!1});s.isIPV6===!0?n=`[${s.escapedHost}]`:n=t.host}r.push(n)}return(typeof t.port=="number"||typeof t.port=="string")&&(r.push(":"),r.push(String(t.port))),r.length?r.join(""):void 0}ug.exports={recomposeAuthority:tS,normalizeComponentEncoding:eS,removeDotSegments:Qk,normalizeIPv4:ig,normalizeIPv6:ag,stringArrayToHexStripped:Ol}});var gg=k((wZ,hg)=>{"use strict";var rS=/^[\da-f]{8}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{4}\b-[\da-f]{12}$/iu,nS=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function dg(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function fg(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function pg(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 oS(t){return t.secure=dg(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function sS(t){if((t.port===(dg(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 iS(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(nS);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}`,s=Nl[o];t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function aS(t,e){let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,s=Nl[o];s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function cS(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!rS.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function uS(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var mg={scheme:"http",domainHost:!0,parse:fg,serialize:pg},lS={scheme:"https",domainHost:mg.domainHost,parse:fg,serialize:pg},mi={scheme:"ws",domainHost:!0,parse:oS,serialize:sS},dS={scheme:"wss",domainHost:mi.domainHost,parse:mi.parse,serialize:mi.serialize},fS={scheme:"urn",parse:iS,serialize:aS,skipNormalize:!0},pS={scheme:"urn:uuid",parse:cS,serialize:uS,skipNormalize:!0},Nl={http:mg,https:lS,ws:mi,wss:dS,urn:fS,"urn:uuid":pS};hg.exports=Nl});var yg=k(($Z,gi)=>{"use strict";var{normalizeIPv6:mS,normalizeIPv4:hS,removeDotSegments:Ro,recomposeAuthority:gS,normalizeComponentEncoding:hi}=lg(),Cl=gg();function _S(t,e){return typeof t=="string"?t=kt(qt(t,e),e):typeof t=="object"&&(t=qt(kt(t,e),e)),t}function yS(t,e,r){let n=Object.assign({scheme:"null"},r),o=_g(qt(t,n),qt(e,n),n,!0);return kt(o,{...n,skipEscape:!0})}function _g(t,e,r,n){let o={};return n||(t=qt(kt(t,r),r),e=qt(kt(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=Ro(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=Ro(e.path||""),o.query=e.query):(e.path?(e.path.charAt(0)==="/"?o.path=Ro(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=Ro(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 vS(t,e,r){return typeof t=="string"?(t=unescape(t),t=kt(hi(qt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=kt(hi(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=kt(hi(qt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=kt(hi(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function kt(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=[],s=Cl[(n.scheme||r.scheme||"").toLowerCase()];s&&s.serialize&&s.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 i=gS(r,n);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path.charAt(0)!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=Ro(a)),i===void 0&&(a=a.replace(/^\/\//u,"/%2F")),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var bS=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function xS(t){let e=0;for(let r=0,n=t.length;r<n;++r)if(e=t.charCodeAt(r),e>126||bS[e])return!0;return!1}var wS=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function qt(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=t.indexOf("%")!==-1,s=!1;r.reference==="suffix"&&(t=(r.scheme?r.scheme+":":"")+"//"+t);let i=t.match(wS);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){let c=hS(n.host);if(c.isIPV4===!1){let u=mS(c.host,{isIPV4:!1});n.host=u.host.toLowerCase(),s=u.isIPV6}else n.host=c.host,s=!0}n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&!n.path&&n.query===void 0?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=Cl[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===!1&&xS(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(o&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),o&&n.host!==void 0&&(n.host=unescape(n.host)),n.path!==void 0&&n.path.length&&(n.path=escape(unescape(n.path))),n.fragment!==void 0&&n.fragment.length&&(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 Zl={SCHEMES:Cl,normalize:_S,resolve:yS,resolveComponents:_g,equal:vS,serialize:kt,parse:qt};gi.exports=Zl;gi.exports.default=Zl;gi.exports.fastUri=Zl});var bg=k(jl=>{"use strict";Object.defineProperty(jl,"__esModule",{value:!0});var vg=yg();vg.code='require("ajv/dist/runtime/uri").default';jl.default=vg});var Tg=k(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.CodeGen=Ee.Name=Ee.nil=Ee.stringify=Ee.str=Ee._=Ee.KeywordCxt=void 0;var $S=To();Object.defineProperty(Ee,"KeywordCxt",{enumerable:!0,get:function(){return $S.KeywordCxt}});var _n=U();Object.defineProperty(Ee,"_",{enumerable:!0,get:function(){return _n._}});Object.defineProperty(Ee,"str",{enumerable:!0,get:function(){return _n.str}});Object.defineProperty(Ee,"stringify",{enumerable:!0,get:function(){return _n.stringify}});Object.defineProperty(Ee,"nil",{enumerable:!0,get:function(){return _n.nil}});Object.defineProperty(Ee,"Name",{enumerable:!0,get:function(){return _n.Name}});Object.defineProperty(Ee,"CodeGen",{enumerable:!0,get:function(){return _n.CodeGen}});var kS=di(),Sg=Po(),SS=fl(),Io=pi(),zS=U(),Oo=So(),_i=ko(),Al=Q(),xg=eg(),ES=bg(),zg=(t,e)=>new RegExp(t,e);zg.code="new RegExp";var TS=["removeAdditional","useDefaults","coerceTypes"],PS=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),RS={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."},IS={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},wg=200;function OS(t){var e,r,n,o,s,i,a,c,u,d,l,h,m,f,p,g,v,b,w,E,N,ve,Re,Rt,fr;let pr=t.strict,oa=(e=t.code)===null||e===void 0?void 0:e.optimize,uf=oa===!0||oa===void 0?1:oa||0,lf=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:zg,yv=(o=t.uriResolver)!==null&&o!==void 0?o:ES.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:pr)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:pr)!==null&&c!==void 0?c:!0,strictTypes:(d=(u=t.strictTypes)!==null&&u!==void 0?u:pr)!==null&&d!==void 0?d:"log",strictTuples:(h=(l=t.strictTuples)!==null&&l!==void 0?l:pr)!==null&&h!==void 0?h:"log",strictRequired:(f=(m=t.strictRequired)!==null&&m!==void 0?m:pr)!==null&&f!==void 0?f:!1,code:t.code?{...t.code,optimize:uf,regExp:lf}:{optimize:uf,regExp:lf},loopRequired:(p=t.loopRequired)!==null&&p!==void 0?p:wg,loopEnum:(g=t.loopEnum)!==null&&g!==void 0?g:wg,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(w=t.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(E=t.schemaId)!==null&&E!==void 0?E:"$id",addUsedSchema:(N=t.addUsedSchema)!==null&&N!==void 0?N:!0,validateSchema:(ve=t.validateSchema)!==null&&ve!==void 0?ve:!0,validateFormats:(Re=t.validateFormats)!==null&&Re!==void 0?Re:!0,unicodeRegExp:(Rt=t.unicodeRegExp)!==null&&Rt!==void 0?Rt:!0,int32range:(fr=t.int32range)!==null&&fr!==void 0?fr:!0,uriResolver:yv}}var No=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...OS(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new zS.ValueScope({scope:{},prefixes:PS,es5:r,lines:n}),this.logger=AS(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,SS.getRules)(),$g.call(this,RS,e,"NOT SUPPORTED"),$g.call(this,IS,e,"DEPRECATED","warn"),this._metaOpts=jS.call(this),e.formats&&CS.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&ZS.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),NS.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=xg;n==="id"&&(o={...xg},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(d,l){await s.call(this,d.$schema);let h=this._addSchema(d,l);return h.validate||i.call(this,h)}async function s(d){d&&!this.getSchema(d)&&await o.call(this,{$ref:d},!0)}async function i(d){try{return this._compileSchemaEnv(d)}catch(l){if(!(l instanceof Sg.default))throw l;return a.call(this,l),await c.call(this,l.missingSchema),i.call(this,d)}}function a({missingSchema:d,missingRef:l}){if(this.refs[d])throw new Error(`AnySchema ${d} is loaded but ${l} cannot be resolved`)}async function c(d){let l=await u.call(this,d);this.refs[d]||await s.call(this,l.$schema),this.refs[d]||this.addSchema(l,d,r)}async function u(d){let l=this._loading[d];if(l)return l;try{return await(this._loading[d]=n(d))}finally{delete this._loading[d]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,o);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,Oo.normalizeId)(r||s),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 s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(e){let r;for(;typeof(r=kg.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Io.SchemaEnv({schema:{},schemaId:n});if(r=Io.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=kg.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,Oo.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(qS.call(this,n,r),!r)return(0,Al.eachItem)(n,s=>Ml.call(this,s)),this;US.call(this,r);let o={...r,type:(0,_i.getJSONTypes)(r.type),schemaType:(0,_i.getJSONTypes)(r.schemaType)};return(0,Al.eachItem)(n,o.type.length===0?s=>Ml.call(this,s,o):s=>o.type.forEach(i=>Ml.call(this,s,o,i))),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(s=>s.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,s)=>o+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let s=o.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,d=i[a];u&&d&&(i[a]=Eg(d))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];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,Oo.normalizeId)(i||n);let u=Oo.getSchemaRefs.call(this,e,n);return c=new Io.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!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):Io.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{Io.compileSchema.call(this,e)}finally{this.opts=r}}};No.ValidationError=kS.default;No.MissingRefError=Sg.default;Ee.default=No;function $g(t,e,r,n="error"){for(let o in t){let s=o;s in e&&this.logger[n](`${r}: option ${o}. ${t[s]}`)}}function kg(t){return t=(0,Oo.normalizeId)(t),this.schemas[t]||this.refs[t]}function NS(){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 CS(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function ZS(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 jS(){let t={...this.opts};for(let e of TS)delete t[e];return t}var MS={log(){},warn(){},error(){}};function AS(t){if(t===!1)return MS;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 DS=/^[a-z_$][a-z0-9_$:-]*$/i;function qS(t,e){let{RULES:r}=this;if((0,Al.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!DS.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 Ml(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,_i.getJSONTypes)(e.type),schemaType:(0,_i.getJSONTypes)(e.schemaType)}};e.before?LS.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function LS(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 US(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Eg(e)),t.validateSchema=this.compile(e,!0))}var FS={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Eg(t){return{anyOf:[t,FS]}}});var Pg=k(Dl=>{"use strict";Object.defineProperty(Dl,"__esModule",{value:!0});var VS={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Dl.default=VS});var Ng=k(Ir=>{"use strict";Object.defineProperty(Ir,"__esModule",{value:!0});Ir.callRef=Ir.getValidate=void 0;var BS=Po(),Rg=ot(),Be=U(),yn=At(),Ig=pi(),yi=Q(),HS={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return l();let d=Ig.resolveRef.call(c,u,o,r);if(d===void 0)throw new BS.default(n.opts.uriResolver,o,r);if(d instanceof Ig.SchemaEnv)return h(d);return m(d);function l(){if(s===u)return vi(t,i,s,s.$async);let f=e.scopeValue("root",{ref:u});return vi(t,(0,Be._)`${f}.validate`,u,u.$async)}function h(f){let p=Og(t,f);vi(t,p,f,f.$async)}function m(f){let p=e.scopeValue("schema",a.code.source===!0?{ref:f,code:(0,Be.stringify)(f)}:{ref:f}),g=e.name("valid"),v=t.subschema({schema:f,dataTypes:[],schemaPath:Be.nil,topSchemaRef:p,errSchemaPath:r},g);t.mergeEvaluated(v),t.ok(g)}}};function Og(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Be._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ir.getValidate=Og;function vi(t,e,r,n){let{gen:o,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?yn.default.this:Be.nil;n?d():l();function d(){if(!a.$async)throw new Error("async schema referenced by sync schema");let f=o.let("valid");o.try(()=>{o.code((0,Be._)`await ${(0,Rg.callValidateCode)(t,e,u)}`),m(e),i||o.assign(f,!0)},p=>{o.if((0,Be._)`!(${p} instanceof ${s.ValidationError})`,()=>o.throw(p)),h(p),i||o.assign(f,!1)}),t.ok(f)}function l(){t.result((0,Rg.callValidateCode)(t,e,u),()=>m(e),()=>h(e))}function h(f){let p=(0,Be._)`${f}.errors`;o.assign(yn.default.vErrors,(0,Be._)`${yn.default.vErrors} === null ? ${p} : ${yn.default.vErrors}.concat(${p})`),o.assign(yn.default.errors,(0,Be._)`${yn.default.vErrors}.length`)}function m(f){var p;if(!s.opts.unevaluated)return;let g=(p=r?.validate)===null||p===void 0?void 0:p.evaluated;if(s.props!==!0)if(g&&!g.dynamicProps)g.props!==void 0&&(s.props=yi.mergeEvaluated.props(o,g.props,s.props));else{let v=o.var("props",(0,Be._)`${f}.evaluated.props`);s.props=yi.mergeEvaluated.props(o,v,s.props,Be.Name)}if(s.items!==!0)if(g&&!g.dynamicItems)g.items!==void 0&&(s.items=yi.mergeEvaluated.items(o,g.items,s.items));else{let v=o.var("items",(0,Be._)`${f}.evaluated.items`);s.items=yi.mergeEvaluated.items(o,v,s.items,Be.Name)}}}Ir.callRef=vi;Ir.default=HS});var Cg=k(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});var WS=Pg(),GS=Ng(),KS=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",WS.default,GS.default];ql.default=KS});var Zg=k(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});var bi=U(),ar=bi.operators,xi={maximum:{okStr:"<=",ok:ar.LTE,fail:ar.GT},minimum:{okStr:">=",ok:ar.GTE,fail:ar.LT},exclusiveMaximum:{okStr:"<",ok:ar.LT,fail:ar.GTE},exclusiveMinimum:{okStr:">",ok:ar.GT,fail:ar.LTE}},JS={message:({keyword:t,schemaCode:e})=>(0,bi.str)`must be ${xi[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,bi._)`{comparison: ${xi[t].okStr}, limit: ${e}}`},YS={keyword:Object.keys(xi),type:"number",schemaType:"number",$data:!0,error:JS,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,bi._)`${r} ${xi[e].fail} ${n} || isNaN(${r})`)}};Ll.default=YS});var jg=k(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});var Co=U(),XS={message:({schemaCode:t})=>(0,Co.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Co._)`{multipleOf: ${t}}`},QS={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:XS,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,Co._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,Co._)`${i} !== parseInt(${i})`;t.fail$data((0,Co._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Ul.default=QS});var Ag=k(Fl=>{"use strict";Object.defineProperty(Fl,"__esModule",{value:!0});function Mg(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}Fl.default=Mg;Mg.code='require("ajv/dist/runtime/ucs2length").default'});var Dg=k(Vl=>{"use strict";Object.defineProperty(Vl,"__esModule",{value:!0});var Or=U(),ez=Q(),tz=Ag(),rz={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Or.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Or._)`{limit: ${t}}`},nz={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:rz,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,s=e==="maxLength"?Or.operators.GT:Or.operators.LT,i=o.opts.unicode===!1?(0,Or._)`${r}.length`:(0,Or._)`${(0,ez.useFunc)(t.gen,tz.default)}(${r})`;t.fail$data((0,Or._)`${i} ${s} ${n}`)}};Vl.default=nz});var qg=k(Bl=>{"use strict";Object.defineProperty(Bl,"__esModule",{value:!0});var oz=ot(),wi=U(),sz={message:({schemaCode:t})=>(0,wi.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,wi._)`{pattern: ${t}}`},iz={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:sz,code(t){let{data:e,$data:r,schema:n,schemaCode:o,it:s}=t,i=s.opts.unicodeRegExp?"u":"",a=r?(0,wi._)`(new RegExp(${o}, ${i}))`:(0,oz.usePattern)(t,n);t.fail$data((0,wi._)`!${a}.test(${e})`)}};Bl.default=iz});var Lg=k(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});var Zo=U(),az={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Zo.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Zo._)`{limit: ${t}}`},cz={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:az,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Zo.operators.GT:Zo.operators.LT;t.fail$data((0,Zo._)`Object.keys(${r}).length ${o} ${n}`)}};Hl.default=cz});var Ug=k(Wl=>{"use strict";Object.defineProperty(Wl,"__esModule",{value:!0});var jo=ot(),Mo=U(),uz=Q(),lz={message:({params:{missingProperty:t}})=>(0,Mo.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Mo._)`{missingProperty: ${t}}`},dz={keyword:"required",type:"object",schemaType:"array",$data:!0,error:lz,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():d(),a.strictRequired){let m=t.parentSchema.properties,{definedProperties:f}=t.it;for(let p of r)if(m?.[p]===void 0&&!f.has(p)){let g=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${p}" is not defined at "${g}" (strictRequired)`;(0,uz.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(Mo.nil,l);else for(let m of r)(0,jo.checkReportMissingProp)(t,m)}function d(){let m=e.let("missing");if(c||s){let f=e.let("valid",!0);t.block$data(f,()=>h(m,f)),t.ok(f)}else e.if((0,jo.checkMissingProp)(t,r,m)),(0,jo.reportMissingProp)(t,m),e.else()}function l(){e.forOf("prop",n,m=>{t.setParams({missingProperty:m}),e.if((0,jo.noPropertyInData)(e,o,m,a.ownProperties),()=>t.error())})}function h(m,f){t.setParams({missingProperty:m}),e.forOf(m,n,()=>{e.assign(f,(0,jo.propertyInData)(e,o,m,a.ownProperties)),e.if((0,Mo.not)(f),()=>{t.error(),e.break()})},Mo.nil)}}};Wl.default=dz});var Fg=k(Gl=>{"use strict";Object.defineProperty(Gl,"__esModule",{value:!0});var Ao=U(),fz={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Ao.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Ao._)`{limit: ${t}}`},pz={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:fz,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Ao.operators.GT:Ao.operators.LT;t.fail$data((0,Ao._)`${r}.length ${o} ${n}`)}};Gl.default=pz});var $i=k(Kl=>{"use strict";Object.defineProperty(Kl,"__esModule",{value:!0});var Vg=bl();Vg.code='require("ajv/dist/runtime/equal").default';Kl.default=Vg});var Bg=k(Yl=>{"use strict";Object.defineProperty(Yl,"__esModule",{value:!0});var Jl=ko(),Te=U(),mz=Q(),hz=$i(),gz={message:({params:{i:t,j:e}})=>(0,Te.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Te._)`{i: ${t}, j: ${e}}`},_z={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:gz,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=s.items?(0,Jl.getSchemaTypes)(s.items):[];t.block$data(c,d,(0,Te._)`${i} === false`),t.ok(c);function d(){let f=e.let("i",(0,Te._)`${r}.length`),p=e.let("j");t.setParams({i:f,j:p}),e.assign(c,!0),e.if((0,Te._)`${f} > 1`,()=>(l()?h:m)(f,p))}function l(){return u.length>0&&!u.some(f=>f==="object"||f==="array")}function h(f,p){let g=e.name("item"),v=(0,Jl.checkDataTypes)(u,g,a.opts.strictNumbers,Jl.DataType.Wrong),b=e.const("indices",(0,Te._)`{}`);e.for((0,Te._)`;${f}--;`,()=>{e.let(g,(0,Te._)`${r}[${f}]`),e.if(v,(0,Te._)`continue`),u.length>1&&e.if((0,Te._)`typeof ${g} == "string"`,(0,Te._)`${g} += "_"`),e.if((0,Te._)`typeof ${b}[${g}] == "number"`,()=>{e.assign(p,(0,Te._)`${b}[${g}]`),t.error(),e.assign(c,!1).break()}).code((0,Te._)`${b}[${g}] = ${f}`)})}function m(f,p){let g=(0,mz.useFunc)(e,hz.default),v=e.name("outer");e.label(v).for((0,Te._)`;${f}--;`,()=>e.for((0,Te._)`${p} = ${f}; ${p}--;`,()=>e.if((0,Te._)`${g}(${r}[${f}], ${r}[${p}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};Yl.default=_z});var Hg=k(Ql=>{"use strict";Object.defineProperty(Ql,"__esModule",{value:!0});var Xl=U(),yz=Q(),vz=$i(),bz={message:"must be equal to constant",params:({schemaCode:t})=>(0,Xl._)`{allowedValue: ${t}}`},xz={keyword:"const",$data:!0,error:bz,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,Xl._)`!${(0,yz.useFunc)(e,vz.default)}(${r}, ${o})`):t.fail((0,Xl._)`${s} !== ${r}`)}};Ql.default=xz});var Wg=k(ed=>{"use strict";Object.defineProperty(ed,"__esModule",{value:!0});var Do=U(),wz=Q(),$z=$i(),kz={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Do._)`{allowedValues: ${t}}`},Sz={keyword:"enum",schemaType:"array",$data:!0,error:kz,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,wz.useFunc)(e,$z.default)),d;if(a||n)d=e.let("valid"),t.block$data(d,l);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let m=e.const("vSchema",s);d=(0,Do.or)(...o.map((f,p)=>h(m,p)))}t.pass(d);function l(){e.assign(d,!1),e.forOf("v",s,m=>e.if((0,Do._)`${u()}(${r}, ${m})`,()=>e.assign(d,!0).break()))}function h(m,f){let p=o[f];return typeof p=="object"&&p!==null?(0,Do._)`${u()}(${r}, ${m}[${f}])`:(0,Do._)`${r} === ${p}`}}};ed.default=Sz});var Gg=k(td=>{"use strict";Object.defineProperty(td,"__esModule",{value:!0});var zz=Zg(),Ez=jg(),Tz=Dg(),Pz=qg(),Rz=Lg(),Iz=Ug(),Oz=Fg(),Nz=Bg(),Cz=Hg(),Zz=Wg(),jz=[zz.default,Ez.default,Tz.default,Pz.default,Rz.default,Iz.default,Oz.default,Nz.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},Cz.default,Zz.default];td.default=jz});var nd=k(qo=>{"use strict";Object.defineProperty(qo,"__esModule",{value:!0});qo.validateAdditionalItems=void 0;var Nr=U(),rd=Q(),Mz={message:({params:{len:t}})=>(0,Nr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Nr._)`{limit: ${t}}`},Az={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Mz,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,rd.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Kg(t,n)}};function Kg(t,e){let{gen:r,schema:n,data:o,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Nr._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Nr._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,rd.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Nr._)`${a} <= ${e.length}`);r.if((0,Nr.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,d=>{t.subschema({keyword:s,dataProp:d,dataPropType:rd.Type.Num},u),i.allErrors||r.if((0,Nr.not)(u),()=>r.break())})}}qo.validateAdditionalItems=Kg;qo.default=Az});var od=k(Lo=>{"use strict";Object.defineProperty(Lo,"__esModule",{value:!0});Lo.validateTuple=void 0;var Jg=U(),ki=Q(),Dz=ot(),qz={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Yg(t,"additionalItems",e);r.items=!0,!(0,ki.alwaysValidSchema)(r,e)&&t.ok((0,Dz.validateArray)(t))}};function Yg(t,e,r=t.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=t;d(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=ki.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,Jg._)`${s}.length`);r.forEach((l,h)=>{(0,ki.alwaysValidSchema)(a,l)||(n.if((0,Jg._)`${u} > ${h}`,()=>t.subschema({keyword:i,schemaProp:h,dataProp:h},c)),t.ok(c))});function d(l){let{opts:h,errSchemaPath:m}=a,f=r.length,p=f===l.minItems&&(f===l.maxItems||l[e]===!1);if(h.strictTuples&&!p){let g=`"${i}" is ${f}-tuple, but minItems or maxItems/${e} are not specified or different at path "${m}"`;(0,ki.checkStrictMode)(a,g,h.strictTuples)}}}Lo.validateTuple=Yg;Lo.default=qz});var Xg=k(sd=>{"use strict";Object.defineProperty(sd,"__esModule",{value:!0});var Lz=od(),Uz={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,Lz.validateTuple)(t,"items")};sd.default=Uz});var e_=k(id=>{"use strict";Object.defineProperty(id,"__esModule",{value:!0});var Qg=U(),Fz=Q(),Vz=ot(),Bz=nd(),Hz={message:({params:{len:t}})=>(0,Qg.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Qg._)`{limit: ${t}}`},Wz={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Hz,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,Fz.alwaysValidSchema)(n,e)&&(o?(0,Bz.validateAdditionalItems)(t,o):t.ok((0,Vz.validateArray)(t)))}};id.default=Wz});var t_=k(ad=>{"use strict";Object.defineProperty(ad,"__esModule",{value:!0});var it=U(),Si=Q(),Gz={message:({params:{min:t,max:e}})=>e===void 0?(0,it.str)`must contain at least ${t} valid item(s)`:(0,it.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,it._)`{minContains: ${t}}`:(0,it._)`{minContains: ${t}, maxContains: ${e}}`},Kz={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Gz,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let d=e.const("len",(0,it._)`${o}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,Si.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,Si.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Si.alwaysValidSchema)(s,r)){let p=(0,it._)`${d} >= ${i}`;a!==void 0&&(p=(0,it._)`${p} && ${d} <= ${a}`),t.pass(p);return}s.items=!0;let l=e.name("valid");a===void 0&&i===1?m(l,()=>e.if(l,()=>e.break())):i===0?(e.let(l,!0),a!==void 0&&e.if((0,it._)`${o}.length > 0`,h)):(e.let(l,!1),h()),t.result(l,()=>t.reset());function h(){let p=e.name("_valid"),g=e.let("count",0);m(p,()=>e.if(p,()=>f(g)))}function m(p,g){e.forRange("i",0,d,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:Si.Type.Num,compositeRule:!0},p),g()})}function f(p){e.code((0,it._)`${p}++`),a===void 0?e.if((0,it._)`${p} >= ${i}`,()=>e.assign(l,!0).break()):(e.if((0,it._)`${p} > ${a}`,()=>e.assign(l,!1).break()),i===1?e.assign(l,!0):e.if((0,it._)`${p} >= ${i}`,()=>e.assign(l,!0)))}}};ad.default=Kz});var o_=k(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.validateSchemaDeps=St.validatePropertyDeps=St.error=void 0;var cd=U(),Jz=Q(),Uo=ot();St.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,cd.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,cd._)`{property: ${t},
|
|
8
8
|
missingProperty: ${n},
|
|
9
9
|
depsCount: ${e},
|
|
10
|
-
deps: ${r}}`};var Gz={keyword:"dependencies",type:"object",schemaType:"object",error:kt.error,code(t){let[e,r]=Kz(t);e_(t,e),t_(t,r)}};function Kz({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 e_(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,Uo.propertyInData)(r,n,i,o.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,Uo.checkReportMissingProp)(t,u)}):(r.if((0,cd._)`${c} && (${(0,Uo.checkMissingProp)(t,a,s)})`),(0,Uo.reportMissingProp)(t,s),r.else())}}kt.validatePropertyDeps=e_;function t_(t,e=t.schema){let{gen:r,data:n,keyword:o,it:s}=t,i=r.name("valid");for(let a in e)(0,Wz.alwaysValidSchema)(s,e[a])||(r.if((0,Uo.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}kt.validateSchemaDeps=t_;kt.default=Gz});var o_=k(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});var n_=U(),Jz=Q(),Yz={message:"property name must be valid",params:({params:t})=>(0,n_._)`{propertyName: ${t.propertyName}}`},Xz={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Yz,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,Jz.alwaysValidSchema)(o,r))return;let s=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,n_.not)(s),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(s)}};ud.default=Xz});var dd=k(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});var zi=nt(),ht=U(),Qz=Mt(),Ei=Q(),eE={message:"must NOT have additional properties",params:({params:t})=>(0,ht._)`{additionalProperty: ${t.additionalProperty}}`},tE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:eE,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Ei.alwaysValidSchema)(i,r))return;let u=(0,zi.allSchemaProperties)(n.properties),l=(0,zi.allSchemaProperties)(n.patternProperties);d(),t.ok((0,ht._)`${s} === ${Qz.default.errors}`);function d(){e.forIn("key",o,g=>{!u.length&&!l.length?f(g):e.if(h(g),()=>f(g))})}function h(g){let v;if(u.length>8){let b=(0,Ei.schemaRefOrVal)(i,n.properties,"properties");v=(0,zi.isOwnProperty)(e,b,g)}else u.length?v=(0,ht.or)(...u.map(b=>(0,ht._)`${g} === ${b}`)):v=ht.nil;return l.length&&(v=(0,ht.or)(v,...l.map(b=>(0,ht._)`${(0,zi.usePattern)(t,b)}.test(${g})`))),(0,ht.not)(v)}function m(g){e.code((0,ht._)`delete ${o}[${g}]`)}function f(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(g);return}if(r===!1){t.setParams({additionalProperty:g}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Ei.alwaysValidSchema)(i,r)){let v=e.name("valid");c.removeAdditional==="failing"?(p(g,v,!1),e.if((0,ht.not)(v),()=>{t.reset(),m(g)})):(p(g,v),a||e.if((0,ht.not)(v),()=>e.break()))}}function p(g,v,b){let w={keyword:"additionalProperties",dataProp:g,dataPropType:Ei.Type.Str};b===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(w,v)}}};ld.default=tE});var a_=k(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});var rE=To(),s_=nt(),fd=Q(),i_=dd(),nE={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&i_.default.code(new rE.KeywordCxt(s,i_.default,"additionalProperties"));let i=(0,s_.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=fd.mergeEvaluated.props(e,(0,fd.toHash)(i),s.props));let a=i.filter(d=>!(0,fd.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,s_.propertyInData)(e,o,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};pd.default=nE});var d_=k(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});var c_=nt(),Ti=U(),u_=Q(),l_=Q(),oE={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:s}=t,{opts:i}=s,a=(0,c_.allSchemaProperties)(r),c=a.filter(p=>(0,u_.alwaysValidSchema)(s,r[p]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof Ti.Name)&&(s.props=(0,l_.evaluatedPropsToName)(e,s.props));let{props:d}=s;h();function h(){for(let p of a)u&&m(p),s.allErrors?f(p):(e.var(l,!0),f(p),e.if(l))}function m(p){for(let g in u)new RegExp(p).test(g)&&(0,u_.checkStrictMode)(s,`property ${g} matches pattern ${p} (use allowMatchingProperties)`)}function f(p){e.forIn("key",n,g=>{e.if((0,Ti._)`${(0,c_.usePattern)(t,p)}.test(${g})`,()=>{let v=c.includes(p);v||t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:g,dataPropType:l_.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,Ti._)`${d}[${g}]`,!0):!v&&!s.allErrors&&e.if((0,Ti.not)(l),()=>e.break())})})}}};md.default=oE});var f_=k(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});var sE=Q(),iE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,sE.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"}};hd.default=iE});var p_=k(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});var aE=nt(),cE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:aE.validateUnion,error:{message:"must match a schema in anyOf"}};gd.default=cE});var m_=k(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});var Pi=U(),uE=Q(),lE={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Pi._)`{passingSchemas: ${t.passing}}`},dE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:lE,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 s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let h;(0,uE.alwaysValidSchema)(o,l)?e.var(c,!0):h=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Pi._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Pi._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),h&&t.mergeEvaluated(h,Pi.Name)})})}}};_d.default=dE});var h_=k(yd=>{"use strict";Object.defineProperty(yd,"__esModule",{value:!0});var fE=Q(),pE={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((s,i)=>{if((0,fE.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(a)})}};yd.default=pE});var y_=k(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});var Ri=U(),__=Q(),mE={message:({params:t})=>(0,Ri.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ri._)`{failingKeyword: ${t.ifClause}}`},hE={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:mE,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,__.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=g_(n,"then"),s=g_(n,"else");if(!o&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,Ri.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let h=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(h,i),d?e.assign(d,(0,Ri._)`${l}`):t.setParams({ifClause:l})}}}};function g_(t,e){let r=t.schema[e];return r!==void 0&&!(0,__.alwaysValidSchema)(t,r)}vd.default=hE});var v_=k(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});var gE=Q(),_E={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,gE.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};bd.default=_E});var b_=k(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});var yE=nd(),vE=Jg(),bE=od(),xE=Xg(),wE=Qg(),$E=r_(),kE=o_(),SE=dd(),zE=a_(),EE=d_(),TE=f_(),PE=p_(),RE=m_(),IE=h_(),OE=y_(),NE=v_();function CE(t=!1){let e=[TE.default,PE.default,RE.default,IE.default,OE.default,NE.default,kE.default,SE.default,$E.default,zE.default,EE.default];return t?e.push(vE.default,xE.default):e.push(yE.default,bE.default),e.push(wE.default),e}xd.default=CE});var x_=k(wd=>{"use strict";Object.defineProperty(wd,"__esModule",{value:!0});var ge=U(),ZE={message:({schemaCode:t})=>(0,ge.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ge._)`{format: ${t}}`},jE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:ZE,code(t,e){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?h():m();function h(){let f=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),p=r.const("fDef",(0,ge._)`${f}[${i}]`),g=r.let("fType"),v=r.let("format");r.if((0,ge._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>r.assign(g,(0,ge._)`${p}.type || "string"`).assign(v,(0,ge._)`${p}.validate`),()=>r.assign(g,(0,ge._)`"string"`).assign(v,p)),t.fail$data((0,ge.or)(b(),w()));function b(){return c.strictSchema===!1?ge.nil:(0,ge._)`${i} && !${v}`}function w(){let E=l.$async?(0,ge._)`(${p}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,ge._)`${v}(${n})`,N=(0,ge._)`(typeof ${v} == "function" ? ${E} : ${v}.test(${n}))`;return(0,ge._)`${v} && ${v} !== true && ${g} === ${e} && !${N}`}}function m(){let f=d.formats[s];if(!f){b();return}if(f===!0)return;let[p,g,v]=w(f);p===e&&t.pass(E());function b(){if(c.strictSchema===!1){d.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function w(N){let ve=N instanceof RegExp?(0,ge.regexpCode)(N):c.code.formats?(0,ge._)`${c.code.formats}${(0,ge.getProperty)(s)}`:void 0,Pe=r.scopeValue("formats",{key:s,ref:N,code:ve});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,ge._)`${Pe}.validate`]:["string",N,Pe]}function E(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ge._)`await ${v}(${n})`}return typeof g=="function"?(0,ge._)`${v}(${n})`:(0,ge._)`${v}.test(${n})`}}}};wd.default=jE});var w_=k($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});var ME=x_(),AE=[ME.default];$d.default=AE});var $_=k(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.contentVocabulary=vn.metadataVocabulary=void 0;vn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];vn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var S_=k(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});var DE=Og(),qE=Hg(),LE=b_(),UE=w_(),k_=$_(),FE=[DE.default,qE.default,(0,LE.default)(),UE.default,k_.metadataVocabulary,k_.contentVocabulary];kd.default=FE});var E_=k(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.DiscrError=void 0;var z_;(function(t){t.Tag="tag",t.Mapping="mapping"})(z_||(Ii.DiscrError=z_={}))});var P_=k(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});var bn=U(),Sd=E_(),T_=pi(),VE=Po(),BE=Q(),HE={message:({params:{discrError:t,tagName:e}})=>t===Sd.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,bn._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},WE={keyword:"discriminator",type:"object",schemaType:"object",error:HE,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:s}=t,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,bn._)`${r}${(0,bn.getProperty)(a)}`);e.if((0,bn._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Sd.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let m=h();e.if(!1);for(let f in m)e.elseIf((0,bn._)`${u} === ${f}`),e.assign(c,d(m[f]));e.else(),t.error(!1,{discrError:Sd.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(m){let f=e.name("valid"),p=t.subschema({keyword:"oneOf",schemaProp:m},f);return t.mergeEvaluated(p,bn.Name),f}function h(){var m;let f={},p=v(o),g=!0;for(let E=0;E<i.length;E++){let N=i[E];if(N?.$ref&&!(0,BE.schemaHasRulesButRef)(N,s.self.RULES)){let Pe=N.$ref;if(N=T_.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Pe),N instanceof T_.SchemaEnv&&(N=N.schema),N===void 0)throw new VE.default(s.opts.uriResolver,s.baseId,Pe)}let ve=(m=N?.properties)===null||m===void 0?void 0:m[a];if(typeof ve!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(p||v(N)),b(ve,E)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return f;function v({required:E}){return Array.isArray(E)&&E.includes(a)}function b(E,N){if(E.const)w(E.const,N);else if(E.enum)for(let ve of E.enum)w(ve,N);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(E,N){if(typeof E!="string"||E in f)throw new Error(`discriminator: "${a}" values must be unique strings`);f[E]=N}}}};zd.default=WE});var R_=k((cj,GE)=>{GE.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 Td=k((ce,Ed)=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.MissingRefError=ce.ValidationError=ce.CodeGen=ce.Name=ce.nil=ce.stringify=ce.str=ce._=ce.KeywordCxt=ce.Ajv=void 0;var KE=zg(),JE=S_(),YE=P_(),I_=R_(),XE=["/properties"],Oi="http://json-schema.org/draft-07/schema",xn=class extends KE.default{_addVocabularies(){super._addVocabularies(),JE.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(YE.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(I_,XE):I_;this.addMetaSchema(e,Oi,!1),this.refs["http://json-schema.org/schema"]=Oi}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Oi)?Oi:void 0)}};ce.Ajv=xn;Ed.exports=ce=xn;Ed.exports.Ajv=xn;Object.defineProperty(ce,"__esModule",{value:!0});ce.default=xn;var QE=To();Object.defineProperty(ce,"KeywordCxt",{enumerable:!0,get:function(){return QE.KeywordCxt}});var wn=U();Object.defineProperty(ce,"_",{enumerable:!0,get:function(){return wn._}});Object.defineProperty(ce,"str",{enumerable:!0,get:function(){return wn.str}});Object.defineProperty(ce,"stringify",{enumerable:!0,get:function(){return wn.stringify}});Object.defineProperty(ce,"nil",{enumerable:!0,get:function(){return wn.nil}});Object.defineProperty(ce,"Name",{enumerable:!0,get:function(){return wn.Name}});Object.defineProperty(ce,"CodeGen",{enumerable:!0,get:function(){return wn.CodeGen}});var eT=di();Object.defineProperty(ce,"ValidationError",{enumerable:!0,get:function(){return eT.default}});var tT=Po();Object.defineProperty(ce,"MissingRefError",{enumerable:!0,get:function(){return tT.default}})});var D_=k(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.formatNames=zt.fastFormats=zt.fullFormats=void 0;function St(t,e){return{validate:t,compare:e}}zt.fullFormats={date:St(Z_,Od),time:St(Rd(!0),Nd),"date-time":St(O_(!0),M_),"iso-time":St(Rd(),j_),"iso-date-time":St(O_(),A_),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:aT,"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:mT,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:cT,int32:{type:"number",validate:dT},int64:{type:"number",validate:fT},float:{type:"number",validate:C_},double:{type:"number",validate:C_},password:!0,binary:!0};zt.fastFormats={...zt.fullFormats,date:St(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Od),time:St(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Nd),"date-time":St(/^\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,M_),"iso-time":St(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,j_),"iso-date-time":St(/^\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,A_),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};zt.formatNames=Object.keys(zt.fullFormats);function rT(t){return t%4===0&&(t%100!==0||t%400===0)}var nT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,oT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Z_(t){let e=nT.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&&rT(r)?29:oT[n])}function Od(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Pd=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Rd(t){return function(r){let n=Pd.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,h=o-u*c-(d<0?1:0);return(h===23||h===-1)&&(d===59||d===-1)&&i<61}}function Nd(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 j_(t,e){if(!(t&&e))return;let r=Pd.exec(t),n=Pd.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 Id=/t|\s/i;function O_(t){let e=Rd(t);return function(n){let o=n.split(Id);return o.length===2&&Z_(o[0])&&e(o[1])}}function M_(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function A_(t,e){if(!(t&&e))return;let[r,n]=t.split(Id),[o,s]=e.split(Id),i=Od(r,o);if(i!==void 0)return i||Nd(n,s)}var sT=/\/|:/,iT=/^(?:[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 aT(t){return sT.test(t)&&iT.test(t)}var N_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function cT(t){return N_.lastIndex=0,N_.test(t)}var uT=-(2**31),lT=2**31-1;function dT(t){return Number.isInteger(t)&&t<=lT&&t>=uT}function fT(t){return Number.isInteger(t)}function C_(){return!0}var pT=/[^\\]\\Z/;function mT(t){if(pT.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var q_=k($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.formatLimitDefinition=void 0;var hT=Td(),gt=U(),cr=gt.operators,Ni={formatMaximum:{okStr:"<=",ok:cr.LTE,fail:cr.GT},formatMinimum:{okStr:">=",ok:cr.GTE,fail:cr.LT},formatExclusiveMaximum:{okStr:"<",ok:cr.LT,fail:cr.GTE},formatExclusiveMinimum:{okStr:">",ok:cr.GT,fail:cr.LTE}},gT={message:({keyword:t,schemaCode:e})=>(0,gt.str)`should be ${Ni[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,gt._)`{comparison: ${Ni[t].okStr}, limit: ${e}}`};$n.formatLimitDefinition={keyword:Object.keys(Ni),type:"string",schemaType:"string",$data:!0,error:gT,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new hT.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let h=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=e.const("fmt",(0,gt._)`${h}[${c.schemaCode}]`);t.fail$data((0,gt.or)((0,gt._)`typeof ${m} != "object"`,(0,gt._)`${m} instanceof RegExp`,(0,gt._)`typeof ${m}.compare != "function"`,d(m)))}function l(){let h=c.schema,m=a.formats[h];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${o}": format "${h}" does not define "compare" function`);let f=e.scopeValue("formats",{key:h,ref:m,code:i.code.formats?(0,gt._)`${i.code.formats}${(0,gt.getProperty)(h)}`:void 0});t.fail$data(d(f))}function d(h){return(0,gt._)`${h}.compare(${r}, ${n}) ${Ni[o].fail} 0`}},dependencies:["format"]};var _T=t=>(t.addKeyword($n.formatLimitDefinition),t);$n.default=_T});var V_=k((Fo,F_)=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});var kn=D_(),yT=q_(),Cd=U(),L_=new Cd.Name("fullFormats"),vT=new Cd.Name("fastFormats"),Zd=(t,e={keywords:!0})=>{if(Array.isArray(e))return U_(t,e,kn.fullFormats,L_),t;let[r,n]=e.mode==="fast"?[kn.fastFormats,vT]:[kn.fullFormats,L_],o=e.formats||kn.formatNames;return U_(t,o,r,n),e.keywords&&(0,yT.default)(t),t};Zd.get=(t,e="full")=>{let n=(e==="fast"?kn.fastFormats:kn.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function U_(t,e,r,n){var o,s;(o=(s=t.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Cd._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}F_.exports=Fo=Zd;Object.defineProperty(Fo,"__esModule",{value:!0});Fo.default=Zd});var qt=k((Lj,sy)=>{"use strict";var ny=["nodebuffer","arraybuffer","fragments"],oy=typeof Blob<"u";oy&&ny.push("blob");sy.exports={BINARY_TYPES:ny,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:oy,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Bo=k((Uj,Li)=>{"use strict";var{EMPTY_BUFFER:TT}=qt(),Dd=Buffer[Symbol.species];function PT(t,e){if(t.length===0)return TT;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let o=0;o<t.length;o++){let s=t[o];r.set(s,n),n+=s.length}return n<e?new Dd(r.buffer,r.byteOffset,n):r}function iy(t,e,r,n,o){for(let s=0;s<o;s++)r[n+s]=t[s]^e[s&3]}function ay(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function RT(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function qd(t){if(qd.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Dd(t):ArrayBuffer.isView(t)?e=new Dd(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),qd.readOnly=!1),e}Li.exports={concat:PT,mask:iy,toArrayBuffer:RT,toBuffer:qd,unmask:ay};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=_e("bufferutil");Li.exports.mask=function(e,r,n,o,s){s<48?iy(e,r,n,o,s):t.mask(e,r,n,o,s)},Li.exports.unmask=function(e,r){e.length<32?ay(e,r):t.unmask(e,r)}}catch{}});var ly=k((Fj,uy)=>{"use strict";var cy=Symbol("kDone"),Ld=Symbol("kRun"),Ud=class{constructor(e){this[cy]=()=>{this.pending--,this[Ld]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Ld]()}[Ld](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[cy])}}};uy.exports=Ud});var Wo=k((Vj,my)=>{"use strict";var Ho=_e("zlib"),dy=Bo(),IT=ly(),{kStatusCode:fy}=qt(),OT=Buffer[Symbol.species],NT=Buffer.from([0,0,255,255]),Fi=Symbol("permessage-deflate"),Lt=Symbol("total-length"),Sn=Symbol("callback"),lr=Symbol("buffers"),zn=Symbol("error"),Ui,Fd=class{constructor(e,r,n){if(this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!Ui){let o=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Ui=new IT(o)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Sn];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,n=e.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=s}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),e}decompress(e,r,n){Ui.add(o=>{this._decompress(e,r,(s,i)=>{o(),n(s,i)})})}compress(e,r,n){Ui.add(o=>{this._compress(e,r,(s,i)=>{o(),n(s,i)})})}_decompress(e,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Ho.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Ho.createInflateRaw({...this._options.zlibInflateOptions,windowBits:i}),this._inflate[Fi]=this,this._inflate[Lt]=0,this._inflate[lr]=[],this._inflate.on("error",ZT),this._inflate.on("data",py)}this._inflate[Sn]=n,this._inflate.write(e),r&&this._inflate.write(NT),this._inflate.flush(()=>{let s=this._inflate[zn];if(s){this._inflate.close(),this._inflate=null,n(s);return}let i=dy.concat(this._inflate[lr],this._inflate[Lt]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Lt]=0,this._inflate[lr]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,i)})}_compress(e,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Ho.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Ho.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),this._deflate[Lt]=0,this._deflate[lr]=[],this._deflate.on("data",CT)}this._deflate[Sn]=n,this._deflate.write(e),this._deflate.flush(Ho.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=dy.concat(this._deflate[lr],this._deflate[Lt]);r&&(s=new OT(s.buffer,s.byteOffset,s.length-4)),this._deflate[Sn]=null,this._deflate[Lt]=0,this._deflate[lr]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,s)})}};my.exports=Fd;function CT(t){this[lr].push(t),this[Lt]+=t.length}function py(t){if(this[Lt]+=t.length,this[Fi]._maxPayload<1||this[Lt]<=this[Fi]._maxPayload){this[lr].push(t);return}this[zn]=new RangeError("Max payload size exceeded"),this[zn].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[zn][fy]=1009,this.removeListener("data",py),this.reset()}function ZT(t){if(this[Fi]._inflate=null,this[zn]){this[Sn](this[zn]);return}t[fy]=1007,this[Sn](t)}});var En=k((Bj,Vi)=>{"use strict";var{isUtf8:hy}=_e("buffer"),{hasBlob:jT}=qt(),MT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function AT(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Vd(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function DT(t){return jT&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}Vi.exports={isBlob:DT,isValidStatusCode:AT,isValidUTF8:Vd,tokenChars:MT};if(hy)Vi.exports.isValidUTF8=function(t){return t.length<24?Vd(t):hy(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=_e("utf-8-validate");Vi.exports.isValidUTF8=function(e){return e.length<32?Vd(e):t(e)}}catch{}});var Kd=k((Hj,wy)=>{"use strict";var{Writable:qT}=_e("stream"),gy=Wo(),{BINARY_TYPES:LT,EMPTY_BUFFER:_y,kStatusCode:UT,kWebSocket:FT}=qt(),{concat:Bd,toArrayBuffer:VT,unmask:BT}=Bo(),{isValidStatusCode:HT,isValidUTF8:yy}=En(),Bi=Buffer[Symbol.species],it=0,vy=1,by=2,xy=3,Hd=4,Wd=5,Hi=6,Gd=class extends qT{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||LT[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[FT]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=it}_write(e,r,n){if(this._opcode===8&&this._state==it)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new Bi(n.buffer,n.byteOffset+e,n.length-e),new Bi(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],o=r.length-e;e>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),o),this._buffers[0]=new Bi(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case it:this.getInfo(e);break;case vy:this.getPayloadLength16(e);break;case by:this.getPayloadLength64(e);break;case xy:this.getMask();break;case Hd:this.getData(e);break;case Wd:case Hi:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[gy.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(o);return}this._payloadLength===126?this._state=vy:this._payloadLength===127?this._state=by:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=xy:this._state=Hd}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Hd}getData(e){let r=_y;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&BT(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=Wd,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[gy.extensionName].decompress(e,this._fin,(o,s)=>{if(o)return r(o);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(i);return}this._fragments.push(s)}this.dataMessage(r),this._state===it&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=it;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=Bd(n,r):this._binaryType==="arraybuffer"?o=VT(Bd(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=it):(this._state=Hi,setImmediate(()=>{this.emit("message",o,!0),this._state=it,this.startLoop(e)}))}else{let o=Bd(n,r);if(!this._skipUTF8Validation&&!yy(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===Wd||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=it):(this._state=Hi,setImmediate(()=>{this.emit("message",o,!1),this._state=it,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,_y),this.end();else{let n=e.readUInt16BE(0);if(!HT(n)){let s=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let o=new Bi(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!yy(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=it;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=it):(this._state=Hi,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=it,this.startLoop(r)}))}createError(e,r,n,o,s){this._loop=!1,this._errored=!0;let i=new e(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(i,this.createError),i.code=s,i[UT]=o,i}};wy.exports=Gd});var Xd=k((Gj,Sy)=>{"use strict";var{Duplex:Wj}=_e("stream"),{randomFillSync:WT}=_e("crypto"),$y=Wo(),{EMPTY_BUFFER:GT,kWebSocket:KT,NOOP:JT}=qt(),{isBlob:Tn,isValidStatusCode:YT}=En(),{mask:ky,toBuffer:Cr}=Bo(),at=Symbol("kByteLength"),XT=Buffer.alloc(4),Wi=8*1024,Zr,Pn=Wi,_t=0,QT=1,eP=2,Jd=class t{constructor(e,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=_t,this.onerror=JT,this[KT]=void 0}static frame(e,r){let n,o=!1,s=2,i=!1;r.mask&&(n=r.maskBuffer||XT,r.generateMask?r.generateMask(n):(Pn===Wi&&(Zr===void 0&&(Zr=Buffer.alloc(Wi)),WT(Zr,0,Wi),Pn=0),n[0]=Zr[Pn++],n[1]=Zr[Pn++],n[2]=Zr[Pn++],n[3]=Zr[Pn++]),i=(n[0]|n[1]|n[2]|n[3])===0,s=6);let a;typeof e=="string"?(!r.mask||i)&&r[at]!==void 0?a=r[at]:(e=Buffer.from(e),a=e.length):(a=e.length,o=r.mask&&r.readOnly&&!i);let c=a;a>=65536?(s+=8,c=127):a>125&&(s+=2,c=126);let u=Buffer.allocUnsafe(o?a+s:s);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(a,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),r.mask?(u[1]|=128,u[s-4]=n[0],u[s-3]=n[1],u[s-2]=n[2],u[s-1]=n[3],i?[u,e]:o?(ky(e,n,u,s,a),[u]):(ky(e,n,e,0,a),[u,e])):[u,e]}close(e,r,n,o){let s;if(e===void 0)s=GT;else{if(typeof e!="number"||!YT(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let a=Buffer.byteLength(r);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+a),s.writeUInt16BE(e,0),typeof r=="string"?s.write(r,2):s.set(r,2)}}let i={[at]:s.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==_t?this.enqueue([this.dispatch,s,!1,i,o]):this.sendFrame(t.frame(s,i),o)}ping(e,r,n){let o,s;if(typeof e=="string"?(o=Buffer.byteLength(e),s=!1):Tn(e)?(o=e.size,s=!1):(e=Cr(e),o=e.length,s=Cr.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[at]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};Tn(e)?this._state!==_t?this.enqueue([this.getBlobData,e,!1,i,n]):this.getBlobData(e,!1,i,n):this._state!==_t?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e,i),n)}pong(e,r,n){let o,s;if(typeof e=="string"?(o=Buffer.byteLength(e),s=!1):Tn(e)?(o=e.size,s=!1):(e=Cr(e),o=e.length,s=Cr.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[at]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};Tn(e)?this._state!==_t?this.enqueue([this.getBlobData,e,!1,i,n]):this.getBlobData(e,!1,i,n):this._state!==_t?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e,i),n)}send(e,r,n){let o=this._extensions[$y.extensionName],s=r.binary?2:1,i=r.compress,a,c;typeof e=="string"?(a=Buffer.byteLength(e),c=!1):Tn(e)?(a=e.size,c=!1):(e=Cr(e),a=e.length,c=Cr.readOnly),this._firstFragment?(this._firstFragment=!1,i&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=a>=o._threshold),this._compress=i):(i=!1,s=0),r.fin&&(this._firstFragment=!0);let u={[at]:a,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:c,rsv1:i};Tn(e)?this._state!==_t?this.enqueue([this.getBlobData,e,this._compress,u,n]):this.getBlobData(e,this._compress,u,n):this._state!==_t?this.enqueue([this.dispatch,e,this._compress,u,n]):this.dispatch(e,this._compress,u,n)}getBlobData(e,r,n,o){this._bufferedBytes+=n[at],this._state=eP,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let a=new Error("The socket was closed while the blob was being read");process.nextTick(Yd,this,a,o);return}this._bufferedBytes-=n[at];let i=Cr(s);r?this.dispatch(i,r,n,o):(this._state=_t,this.sendFrame(t.frame(i,n),o),this.dequeue())}).catch(s=>{process.nextTick(tP,this,s,o)})}dispatch(e,r,n,o){if(!r){this.sendFrame(t.frame(e,n),o);return}let s=this._extensions[$y.extensionName];this._bufferedBytes+=n[at],this._state=QT,s.compress(e,n.fin,(i,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");Yd(this,c,o);return}this._bufferedBytes-=n[at],this._state=_t,n.readOnly=!1,this.sendFrame(t.frame(a,n),o),this.dequeue()})}dequeue(){for(;this._state===_t&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][at],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][at],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};Sy.exports=Jd;function Yd(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let o=t._queue[n],s=o[o.length-1];typeof s=="function"&&s(e)}}function tP(t,e,r){Yd(t,e,r),t.onerror(e)}});var Cy=k((Kj,Ny)=>{"use strict";var{kForOnEventAttribute:Go,kListener:Qd}=qt(),zy=Symbol("kCode"),Ey=Symbol("kData"),Ty=Symbol("kError"),Py=Symbol("kMessage"),Ry=Symbol("kReason"),Rn=Symbol("kTarget"),Iy=Symbol("kType"),Oy=Symbol("kWasClean"),Ut=class{constructor(e){this[Rn]=null,this[Iy]=e}get target(){return this[Rn]}get type(){return this[Iy]}};Object.defineProperty(Ut.prototype,"target",{enumerable:!0});Object.defineProperty(Ut.prototype,"type",{enumerable:!0});var jr=class extends Ut{constructor(e,r={}){super(e),this[zy]=r.code===void 0?0:r.code,this[Ry]=r.reason===void 0?"":r.reason,this[Oy]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[zy]}get reason(){return this[Ry]}get wasClean(){return this[Oy]}};Object.defineProperty(jr.prototype,"code",{enumerable:!0});Object.defineProperty(jr.prototype,"reason",{enumerable:!0});Object.defineProperty(jr.prototype,"wasClean",{enumerable:!0});var In=class extends Ut{constructor(e,r={}){super(e),this[Ty]=r.error===void 0?null:r.error,this[Py]=r.message===void 0?"":r.message}get error(){return this[Ty]}get message(){return this[Py]}};Object.defineProperty(In.prototype,"error",{enumerable:!0});Object.defineProperty(In.prototype,"message",{enumerable:!0});var Ko=class extends Ut{constructor(e,r={}){super(e),this[Ey]=r.data===void 0?null:r.data}get data(){return this[Ey]}};Object.defineProperty(Ko.prototype,"data",{enumerable:!0});var rP={addEventListener(t,e,r={}){for(let o of this.listeners(t))if(!r[Go]&&o[Qd]===e&&!o[Go])return;let n;if(t==="message")n=function(s,i){let a=new Ko("message",{data:i?s:s.toString()});a[Rn]=this,Gi(e,this,a)};else if(t==="close")n=function(s,i){let a=new jr("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[Rn]=this,Gi(e,this,a)};else if(t==="error")n=function(s){let i=new In("error",{error:s,message:s.message});i[Rn]=this,Gi(e,this,i)};else if(t==="open")n=function(){let s=new Ut("open");s[Rn]=this,Gi(e,this,s)};else return;n[Go]=!!r[Go],n[Qd]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[Qd]===e&&!r[Go]){this.removeListener(t,r);break}}};Ny.exports={CloseEvent:jr,ErrorEvent:In,Event:Ut,EventTarget:rP,MessageEvent:Ko};function Gi(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var ef=k((Jj,Zy)=>{"use strict";var{tokenChars:Jo}=En();function Et(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function nP(t){let e=Object.create(null),r=Object.create(null),n=!1,o=!1,s=!1,i,a,c=-1,u=-1,l=-1,d=0;for(;d<t.length;d++)if(u=t.charCodeAt(d),i===void 0)if(l===-1&&Jo[u]===1)c===-1&&(c=d);else if(d!==0&&(u===32||u===9))l===-1&&c!==-1&&(l=d);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d);let m=t.slice(c,l);u===44?(Et(e,m,r),r=Object.create(null)):i=m,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);else if(a===void 0)if(l===-1&&Jo[u]===1)c===-1&&(c=d);else if(u===32||u===9)l===-1&&c!==-1&&(l=d);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d),Et(r,t.slice(c,l),!0),u===44&&(Et(e,i,r),r=Object.create(null),i=void 0),c=l=-1}else if(u===61&&c!==-1&&l===-1)a=t.slice(c,d),c=l=-1;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(o){if(Jo[u]!==1)throw new SyntaxError(`Unexpected character at index ${d}`);c===-1?c=d:n||(n=!0),o=!1}else if(s)if(Jo[u]===1)c===-1&&(c=d);else if(u===34&&c!==-1)s=!1,l=d;else if(u===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(u===34&&t.charCodeAt(d-1)===61)s=!0;else if(l===-1&&Jo[u]===1)c===-1&&(c=d);else if(c!==-1&&(u===32||u===9))l===-1&&(l=d);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1&&(l=d);let m=t.slice(c,l);n&&(m=m.replace(/\\/g,""),n=!1),Et(r,a,m),u===44&&(Et(e,i,r),r=Object.create(null),i=void 0),a=void 0,c=l=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);if(c===-1||s||u===32||u===9)throw new SyntaxError("Unexpected end of input");l===-1&&(l=d);let h=t.slice(c,l);return i===void 0?Et(e,h,r):(a===void 0?Et(r,h,!0):n?Et(r,a,h.replace(/\\/g,"")):Et(r,a,h),Et(e,i,r)),e}function oP(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(o=>{let s=n[o];return Array.isArray(s)||(s=[s]),s.map(i=>i===!0?o:`${o}=${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Zy.exports={format:oP,parse:nP}});var Xi=k((Qj,Wy)=>{"use strict";var sP=_e("events"),iP=_e("https"),aP=_e("http"),Ay=_e("net"),cP=_e("tls"),{randomBytes:uP,createHash:lP}=_e("crypto"),{Duplex:Yj,Readable:Xj}=_e("stream"),{URL:tf}=_e("url"),dr=Wo(),dP=Kd(),fP=Xd(),{isBlob:pP}=En(),{BINARY_TYPES:jy,CLOSE_TIMEOUT:mP,EMPTY_BUFFER:Ki,GUID:hP,kForOnEventAttribute:rf,kListener:gP,kStatusCode:_P,kWebSocket:xe,NOOP:Dy}=qt(),{EventTarget:{addEventListener:yP,removeEventListener:vP}}=Cy(),{format:bP,parse:xP}=ef(),{toBuffer:wP}=Bo(),qy=Symbol("kAborted"),nf=[8,13],Ft=["CONNECTING","OPEN","CLOSING","CLOSED"],$P=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,pe=class t extends sP{constructor(e,r,n){super(),this._binaryType=jy[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Ki,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),Ly(this,e,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){jy.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let o=new dP({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),s=new fP(e,this._extensions,n.generateMask);this._receiver=o,this._sender=s,this._socket=e,o[xe]=this,s[xe]=this,e[xe]=this,o.on("conclude",zP),o.on("drain",EP),o.on("error",TP),o.on("message",PP),o.on("ping",RP),o.on("pong",IP),s.onerror=OP,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",Vy),e.on("data",Yi),e.on("end",By),e.on("error",Hy),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[dr.extensionName]&&this._extensions[dr.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){Ye(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Fy(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){of(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Ki,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){of(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||Ki,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){of(this,e,n);return}let o={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[dr.extensionName]||(o.compress=!1),this._sender.send(e||Ki,o,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){Ye(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(pe,"CONNECTING",{enumerable:!0,value:Ft.indexOf("CONNECTING")});Object.defineProperty(pe.prototype,"CONNECTING",{enumerable:!0,value:Ft.indexOf("CONNECTING")});Object.defineProperty(pe,"OPEN",{enumerable:!0,value:Ft.indexOf("OPEN")});Object.defineProperty(pe.prototype,"OPEN",{enumerable:!0,value:Ft.indexOf("OPEN")});Object.defineProperty(pe,"CLOSING",{enumerable:!0,value:Ft.indexOf("CLOSING")});Object.defineProperty(pe.prototype,"CLOSING",{enumerable:!0,value:Ft.indexOf("CLOSING")});Object.defineProperty(pe,"CLOSED",{enumerable:!0,value:Ft.indexOf("CLOSED")});Object.defineProperty(pe.prototype,"CLOSED",{enumerable:!0,value:Ft.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(pe.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(pe.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[rf])return e[gP];return null},set(e){for(let r of this.listeners(t))if(r[rf]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[rf]:!0})}})});pe.prototype.addEventListener=yP;pe.prototype.removeEventListener=vP;Wy.exports=pe;function Ly(t,e,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:mP,protocolVersion:nf[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=o.autoPong,t._closeTimeout=o.closeTimeout,!nf.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${nf.join(", ")})`);let s;if(e instanceof tf)s=e;else try{s=new tf(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),t._url=s.href;let i=s.protocol==="wss:",a=s.protocol==="ws+unix:",c;if(s.protocol!=="ws:"&&!i&&!a?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:a&&!s.pathname?c="The URL's pathname is empty":s.hash&&(c="The URL contains a fragment identifier"),c){let p=new SyntaxError(c);if(t._redirects===0)throw p;Ji(t,p);return}let u=i?443:80,l=uP(16).toString("base64"),d=i?iP.request:aP.request,h=new Set,m;if(o.createConnection=o.createConnection||(i?SP:kP),o.defaultPort=o.defaultPort||u,o.port=s.port||u,o.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":l,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(m=new dr(o.perMessageDeflate!==!0?o.perMessageDeflate:{},!1,o.maxPayload),o.headers["Sec-WebSocket-Extensions"]=bP({[dr.extensionName]:m.offer()})),r.length){for(let p of r){if(typeof p!="string"||!$P.test(p)||h.has(p))throw new SyntaxError("An invalid or duplicated subprotocol was specified");h.add(p)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),a){let p=o.path.split(":");o.socketPath=p[0],o.path=p[1]}let f;if(o.followRedirects){if(t._redirects===0){t._originalIpc=a,t._originalSecure=i,t._originalHostOrSocketPath=a?o.socketPath:s.host;let p=n&&n.headers;if(n={...n,headers:{}},p)for(let[g,v]of Object.entries(p))n.headers[g.toLowerCase()]=v}else if(t.listenerCount("redirect")===0){let p=a?t._originalIpc?o.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:s.host===t._originalHostOrSocketPath;(!p||t._originalSecure&&!i)&&(delete o.headers.authorization,delete o.headers.cookie,p||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),f=t._req=d(o),t._redirects&&t.emit("redirect",t.url,f)}else f=t._req=d(o);o.timeout&&f.on("timeout",()=>{Ye(t,f,"Opening handshake has timed out")}),f.on("error",p=>{f===null||f[qy]||(f=t._req=null,Ji(t,p))}),f.on("response",p=>{let g=p.headers.location,v=p.statusCode;if(g&&o.followRedirects&&v>=300&&v<400){if(++t._redirects>o.maxRedirects){Ye(t,f,"Maximum redirects exceeded");return}f.abort();let b;try{b=new tf(g,e)}catch{let E=new SyntaxError(`Invalid URL: ${g}`);Ji(t,E);return}Ly(t,b,r,n)}else t.emit("unexpected-response",f,p)||Ye(t,f,`Unexpected server response: ${p.statusCode}`)}),f.on("upgrade",(p,g,v)=>{if(t.emit("upgrade",p),t.readyState!==pe.CONNECTING)return;f=t._req=null;let b=p.headers.upgrade;if(b===void 0||b.toLowerCase()!=="websocket"){Ye(t,g,"Invalid Upgrade header");return}let w=lP("sha1").update(l+hP).digest("base64");if(p.headers["sec-websocket-accept"]!==w){Ye(t,g,"Invalid Sec-WebSocket-Accept header");return}let E=p.headers["sec-websocket-protocol"],N;if(E!==void 0?h.size?h.has(E)||(N="Server sent an invalid subprotocol"):N="Server sent a subprotocol but none was requested":h.size&&(N="Server sent no subprotocol"),N){Ye(t,g,N);return}E&&(t._protocol=E);let ve=p.headers["sec-websocket-extensions"];if(ve!==void 0){if(!m){Ye(t,g,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Pe;try{Pe=xP(ve)}catch{Ye(t,g,"Invalid Sec-WebSocket-Extensions header");return}let Pt=Object.keys(Pe);if(Pt.length!==1||Pt[0]!==dr.extensionName){Ye(t,g,"Server indicated an extension that was not requested");return}try{m.accept(Pe[dr.extensionName])}catch{Ye(t,g,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[dr.extensionName]=m}t.setSocket(g,v,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(f,t):f.end()}function Ji(t,e){t._readyState=pe.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function kP(t){return t.path=t.socketPath,Ay.connect(t)}function SP(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Ay.isIP(t.host)?"":t.host),cP.connect(t)}function Ye(t,e,r){t._readyState=pe.CLOSING;let n=new Error(r);Error.captureStackTrace(n,Ye),e.setHeader?(e[qy]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Ji,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function of(t,e,r){if(e){let n=pP(e)?e.size:wP(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${Ft[t.readyState]})`);process.nextTick(r,n)}}function zP(t,e){let r=this[xe];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[xe]!==void 0&&(r._socket.removeListener("data",Yi),process.nextTick(Uy,r._socket),t===1005?r.close():r.close(t,e))}function EP(){let t=this[xe];t.isPaused||t._socket.resume()}function TP(t){let e=this[xe];e._socket[xe]!==void 0&&(e._socket.removeListener("data",Yi),process.nextTick(Uy,e._socket),e.close(t[_P])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function My(){this[xe].emitClose()}function PP(t,e){this[xe].emit("message",t,e)}function RP(t){let e=this[xe];e._autoPong&&e.pong(t,!this._isServer,Dy),e.emit("ping",t)}function IP(t){this[xe].emit("pong",t)}function Uy(t){t.resume()}function OP(t){let e=this[xe];e.readyState!==pe.CLOSED&&(e.readyState===pe.OPEN&&(e._readyState=pe.CLOSING,Fy(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function Fy(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function Vy(){let t=this[xe];if(this.removeListener("close",Vy),this.removeListener("data",Yi),this.removeListener("end",By),t._readyState=pe.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[xe]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",My),t._receiver.on("finish",My))}function Yi(t){this[xe]._receiver.write(t)||this.pause()}function By(){let t=this[xe];t._readyState=pe.CLOSING,t._receiver.end(),this.end()}function Hy(){let t=this[xe];this.removeListener("error",Hy),this.on("error",Dy),t&&(t._readyState=pe.CLOSING,this.destroy())}});var Yy=k((tM,Jy)=>{"use strict";var eM=Xi(),{Duplex:NP}=_e("stream");function Gy(t){t.emit("close")}function CP(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Ky(t){this.removeListener("error",Ky),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function ZP(t,e){let r=!0,n=new NP({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",function(s,i){let a=!i&&n._readableState.objectMode?s.toString():s;n.push(a)||t.pause()}),t.once("error",function(s){n.destroyed||(r=!1,n.destroy(s))}),t.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(o,s){if(t.readyState===t.CLOSED){s(o),process.nextTick(Gy,n);return}let i=!1;t.once("error",function(c){i=!0,s(c)}),t.once("close",function(){i||s(o),process.nextTick(Gy,n)}),r&&t.terminate()},n._final=function(o){if(t.readyState===t.CONNECTING){t.once("open",function(){n._final(o)});return}t._socket!==null&&(t._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(t._socket.once("finish",function(){o()}),t.close()))},n._read=function(){t.isPaused&&t.resume()},n._write=function(o,s,i){if(t.readyState===t.CONNECTING){t.once("open",function(){n._write(o,s,i)});return}t.send(o,i)},n.on("end",CP),n.on("error",Ky),n}Jy.exports=ZP});var Qy=k((rM,Xy)=>{"use strict";var{tokenChars:jP}=En();function MP(t){let e=new Set,r=-1,n=-1,o=0;for(o;o<t.length;o++){let i=t.charCodeAt(o);if(n===-1&&jP[i]===1)r===-1&&(r=o);else if(o!==0&&(i===32||i===9))n===-1&&r!==-1&&(n=o);else if(i===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let a=t.slice(r,n);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let s=t.slice(r,o);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return e.add(s),e}Xy.exports={parse:MP}});var iv=k((oM,sv)=>{"use strict";var AP=_e("events"),Qi=_e("http"),{Duplex:nM}=_e("stream"),{createHash:DP}=_e("crypto"),ev=ef(),Mr=Wo(),qP=Qy(),LP=Xi(),{CLOSE_TIMEOUT:UP,GUID:FP,kWebSocket:VP}=qt(),BP=/^[+/0-9A-Za-z]{22}==$/,tv=0,rv=1,ov=2,sf=class extends AP{constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:UP,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:LP,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Qi.createServer((n,o)=>{let s=Qi.STATUS_CODES[426];o.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),o.end(s)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=HP(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,s,i)=>{this.handleUpgrade(o,s,i,n)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=tv}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===ov){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Yo,this);return}if(e&&this.once("close",e),this._state!==rv)if(this._state=rv,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Yo,this):process.nextTick(Yo,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Yo(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,o){r.on("error",nv);let s=e.headers["sec-websocket-key"],i=e.headers.upgrade,a=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Ar(this,e,r,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){Ar(this,e,r,400,"Invalid Upgrade header");return}if(s===void 0||!BP.test(s)){Ar(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(a!==13&&a!==8){Ar(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Xo(r,400);return}let c=e.headers["sec-websocket-protocol"],u=new Set;if(c!==void 0)try{u=qP.parse(c)}catch{Ar(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let l=e.headers["sec-websocket-extensions"],d={};if(this.options.perMessageDeflate&&l!==void 0){let h=new Mr(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let m=ev.parse(l);m[Mr.extensionName]&&(h.accept(m[Mr.extensionName]),d[Mr.extensionName]=h)}catch{Ar(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(m,f,p,g)=>{if(!m)return Xo(r,f||401,p,g);this.completeUpgrade(d,s,u,e,r,n,o)});return}if(!this.options.verifyClient(h))return Xo(r,401)}this.completeUpgrade(d,s,u,e,r,n,o)}completeUpgrade(e,r,n,o,s,i,a){if(!s.readable||!s.writable)return s.destroy();if(s[VP])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>tv)return Xo(s,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${DP("sha1").update(r+FP).digest("base64")}`],l=new this.options.WebSocket(null,void 0,this.options);if(n.size){let d=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;d&&(u.push(`Sec-WebSocket-Protocol: ${d}`),l._protocol=d)}if(e[Mr.extensionName]){let d=e[Mr.extensionName].params,h=ev.format({[Mr.extensionName]:[d]});u.push(`Sec-WebSocket-Extensions: ${h}`),l._extensions=e}this.emit("headers",u,o),s.write(u.concat(`\r
|
|
10
|
+
deps: ${r}}`};var Yz={keyword:"dependencies",type:"object",schemaType:"object",error:St.error,code(t){let[e,r]=Xz(t);r_(t,e),n_(t,r)}};function Xz({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 r_(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,Uo.propertyInData)(r,n,i,o.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,Uo.checkReportMissingProp)(t,u)}):(r.if((0,cd._)`${c} && (${(0,Uo.checkMissingProp)(t,a,s)})`),(0,Uo.reportMissingProp)(t,s),r.else())}}St.validatePropertyDeps=r_;function n_(t,e=t.schema){let{gen:r,data:n,keyword:o,it:s}=t,i=r.name("valid");for(let a in e)(0,Jz.alwaysValidSchema)(s,e[a])||(r.if((0,Uo.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}St.validateSchemaDeps=n_;St.default=Yz});var i_=k(ud=>{"use strict";Object.defineProperty(ud,"__esModule",{value:!0});var s_=U(),Qz=Q(),eE={message:"property name must be valid",params:({params:t})=>(0,s_._)`{propertyName: ${t.propertyName}}`},tE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:eE,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,Qz.alwaysValidSchema)(o,r))return;let s=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,s_.not)(s),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(s)}};ud.default=tE});var dd=k(ld=>{"use strict";Object.defineProperty(ld,"__esModule",{value:!0});var zi=ot(),gt=U(),rE=At(),Ei=Q(),nE={message:"must NOT have additional properties",params:({params:t})=>(0,gt._)`{additionalProperty: ${t.additionalProperty}}`},oE={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:nE,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,Ei.alwaysValidSchema)(i,r))return;let u=(0,zi.allSchemaProperties)(n.properties),d=(0,zi.allSchemaProperties)(n.patternProperties);l(),t.ok((0,gt._)`${s} === ${rE.default.errors}`);function l(){e.forIn("key",o,g=>{!u.length&&!d.length?f(g):e.if(h(g),()=>f(g))})}function h(g){let v;if(u.length>8){let b=(0,Ei.schemaRefOrVal)(i,n.properties,"properties");v=(0,zi.isOwnProperty)(e,b,g)}else u.length?v=(0,gt.or)(...u.map(b=>(0,gt._)`${g} === ${b}`)):v=gt.nil;return d.length&&(v=(0,gt.or)(v,...d.map(b=>(0,gt._)`${(0,zi.usePattern)(t,b)}.test(${g})`))),(0,gt.not)(v)}function m(g){e.code((0,gt._)`delete ${o}[${g}]`)}function f(g){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){m(g);return}if(r===!1){t.setParams({additionalProperty:g}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Ei.alwaysValidSchema)(i,r)){let v=e.name("valid");c.removeAdditional==="failing"?(p(g,v,!1),e.if((0,gt.not)(v),()=>{t.reset(),m(g)})):(p(g,v),a||e.if((0,gt.not)(v),()=>e.break()))}}function p(g,v,b){let w={keyword:"additionalProperties",dataProp:g,dataPropType:Ei.Type.Str};b===!1&&Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(w,v)}}};ld.default=oE});var u_=k(pd=>{"use strict";Object.defineProperty(pd,"__esModule",{value:!0});var sE=To(),a_=ot(),fd=Q(),c_=dd(),iE={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&c_.default.code(new sE.KeywordCxt(s,c_.default,"additionalProperties"));let i=(0,a_.allSchemaProperties)(r);for(let l of i)s.definedProperties.add(l);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=fd.mergeEvaluated.props(e,(0,fd.toHash)(i),s.props));let a=i.filter(l=>!(0,fd.alwaysValidSchema)(s,r[l]));if(a.length===0)return;let c=e.name("valid");for(let l of a)u(l)?d(l):(e.if((0,a_.propertyInData)(e,o,l,s.opts.ownProperties)),d(l),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(l),t.ok(c);function u(l){return s.opts.useDefaults&&!s.compositeRule&&r[l].default!==void 0}function d(l){t.subschema({keyword:"properties",schemaProp:l,dataProp:l},c)}}};pd.default=iE});var p_=k(md=>{"use strict";Object.defineProperty(md,"__esModule",{value:!0});var l_=ot(),Ti=U(),d_=Q(),f_=Q(),aE={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:s}=t,{opts:i}=s,a=(0,l_.allSchemaProperties)(r),c=a.filter(p=>(0,d_.alwaysValidSchema)(s,r[p]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,d=e.name("valid");s.props!==!0&&!(s.props instanceof Ti.Name)&&(s.props=(0,f_.evaluatedPropsToName)(e,s.props));let{props:l}=s;h();function h(){for(let p of a)u&&m(p),s.allErrors?f(p):(e.var(d,!0),f(p),e.if(d))}function m(p){for(let g in u)new RegExp(p).test(g)&&(0,d_.checkStrictMode)(s,`property ${g} matches pattern ${p} (use allowMatchingProperties)`)}function f(p){e.forIn("key",n,g=>{e.if((0,Ti._)`${(0,l_.usePattern)(t,p)}.test(${g})`,()=>{let v=c.includes(p);v||t.subschema({keyword:"patternProperties",schemaProp:p,dataProp:g,dataPropType:f_.Type.Str},d),s.opts.unevaluated&&l!==!0?e.assign((0,Ti._)`${l}[${g}]`,!0):!v&&!s.allErrors&&e.if((0,Ti.not)(d),()=>e.break())})})}}};md.default=aE});var m_=k(hd=>{"use strict";Object.defineProperty(hd,"__esModule",{value:!0});var cE=Q(),uE={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,cE.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"}};hd.default=uE});var h_=k(gd=>{"use strict";Object.defineProperty(gd,"__esModule",{value:!0});var lE=ot(),dE={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:lE.validateUnion,error:{message:"must match a schema in anyOf"}};gd.default=dE});var g_=k(_d=>{"use strict";Object.defineProperty(_d,"__esModule",{value:!0});var Pi=U(),fE=Q(),pE={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Pi._)`{passingSchemas: ${t.passing}}`},mE={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:pE,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 s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((d,l)=>{let h;(0,fE.alwaysValidSchema)(o,d)?e.var(c,!0):h=t.subschema({keyword:"oneOf",schemaProp:l,compositeRule:!0},c),l>0&&e.if((0,Pi._)`${c} && ${i}`).assign(i,!1).assign(a,(0,Pi._)`[${a}, ${l}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,l),h&&t.mergeEvaluated(h,Pi.Name)})})}}};_d.default=mE});var __=k(yd=>{"use strict";Object.defineProperty(yd,"__esModule",{value:!0});var hE=Q(),gE={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((s,i)=>{if((0,hE.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(a)})}};yd.default=gE});var b_=k(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});var Ri=U(),v_=Q(),_E={message:({params:t})=>(0,Ri.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ri._)`{failingKeyword: ${t.ifClause}}`},yE={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:_E,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,v_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=y_(n,"then"),s=y_(n,"else");if(!o&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&s){let d=e.let("ifClause");t.setParams({ifClause:d}),e.if(a,u("then",d),u("else",d))}else o?e.if(a,u("then")):e.if((0,Ri.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let d=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(d)}function u(d,l){return()=>{let h=t.subschema({keyword:d},a);e.assign(i,a),t.mergeValidEvaluated(h,i),l?e.assign(l,(0,Ri._)`${d}`):t.setParams({ifClause:d})}}}};function y_(t,e){let r=t.schema[e];return r!==void 0&&!(0,v_.alwaysValidSchema)(t,r)}vd.default=yE});var x_=k(bd=>{"use strict";Object.defineProperty(bd,"__esModule",{value:!0});var vE=Q(),bE={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,vE.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};bd.default=bE});var w_=k(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});var xE=nd(),wE=Xg(),$E=od(),kE=e_(),SE=t_(),zE=o_(),EE=i_(),TE=dd(),PE=u_(),RE=p_(),IE=m_(),OE=h_(),NE=g_(),CE=__(),ZE=b_(),jE=x_();function ME(t=!1){let e=[IE.default,OE.default,NE.default,CE.default,ZE.default,jE.default,EE.default,TE.default,zE.default,PE.default,RE.default];return t?e.push(wE.default,kE.default):e.push(xE.default,$E.default),e.push(SE.default),e}xd.default=ME});var $_=k(wd=>{"use strict";Object.defineProperty(wd,"__esModule",{value:!0});var ge=U(),AE={message:({schemaCode:t})=>(0,ge.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ge._)`{format: ${t}}`},DE={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:AE,code(t,e){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:d,self:l}=a;if(!c.validateFormats)return;o?h():m();function h(){let f=r.scopeValue("formats",{ref:l.formats,code:c.code.formats}),p=r.const("fDef",(0,ge._)`${f}[${i}]`),g=r.let("fType"),v=r.let("format");r.if((0,ge._)`typeof ${p} == "object" && !(${p} instanceof RegExp)`,()=>r.assign(g,(0,ge._)`${p}.type || "string"`).assign(v,(0,ge._)`${p}.validate`),()=>r.assign(g,(0,ge._)`"string"`).assign(v,p)),t.fail$data((0,ge.or)(b(),w()));function b(){return c.strictSchema===!1?ge.nil:(0,ge._)`${i} && !${v}`}function w(){let E=d.$async?(0,ge._)`(${p}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,ge._)`${v}(${n})`,N=(0,ge._)`(typeof ${v} == "function" ? ${E} : ${v}.test(${n}))`;return(0,ge._)`${v} && ${v} !== true && ${g} === ${e} && !${N}`}}function m(){let f=l.formats[s];if(!f){b();return}if(f===!0)return;let[p,g,v]=w(f);p===e&&t.pass(E());function b(){if(c.strictSchema===!1){l.logger.warn(N());return}throw new Error(N());function N(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function w(N){let ve=N instanceof RegExp?(0,ge.regexpCode)(N):c.code.formats?(0,ge._)`${c.code.formats}${(0,ge.getProperty)(s)}`:void 0,Re=r.scopeValue("formats",{key:s,ref:N,code:ve});return typeof N=="object"&&!(N instanceof RegExp)?[N.type||"string",N.validate,(0,ge._)`${Re}.validate`]:["string",N,Re]}function E(){if(typeof f=="object"&&!(f instanceof RegExp)&&f.async){if(!d.$async)throw new Error("async format in sync schema");return(0,ge._)`await ${v}(${n})`}return typeof g=="function"?(0,ge._)`${v}(${n})`:(0,ge._)`${v}.test(${n})`}}}};wd.default=DE});var k_=k($d=>{"use strict";Object.defineProperty($d,"__esModule",{value:!0});var qE=$_(),LE=[qE.default];$d.default=LE});var S_=k(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.contentVocabulary=vn.metadataVocabulary=void 0;vn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];vn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var E_=k(kd=>{"use strict";Object.defineProperty(kd,"__esModule",{value:!0});var UE=Cg(),FE=Gg(),VE=w_(),BE=k_(),z_=S_(),HE=[UE.default,FE.default,(0,VE.default)(),BE.default,z_.metadataVocabulary,z_.contentVocabulary];kd.default=HE});var P_=k(Ii=>{"use strict";Object.defineProperty(Ii,"__esModule",{value:!0});Ii.DiscrError=void 0;var T_;(function(t){t.Tag="tag",t.Mapping="mapping"})(T_||(Ii.DiscrError=T_={}))});var I_=k(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});var bn=U(),Sd=P_(),R_=pi(),WE=Po(),GE=Q(),KE={message:({params:{discrError:t,tagName:e}})=>t===Sd.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,bn._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},JE={keyword:"discriminator",type:"object",schemaType:"object",error:KE,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:s}=t,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,bn._)`${r}${(0,bn.getProperty)(a)}`);e.if((0,bn._)`typeof ${u} == "string"`,()=>d(),()=>t.error(!1,{discrError:Sd.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function d(){let m=h();e.if(!1);for(let f in m)e.elseIf((0,bn._)`${u} === ${f}`),e.assign(c,l(m[f]));e.else(),t.error(!1,{discrError:Sd.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function l(m){let f=e.name("valid"),p=t.subschema({keyword:"oneOf",schemaProp:m},f);return t.mergeEvaluated(p,bn.Name),f}function h(){var m;let f={},p=v(o),g=!0;for(let E=0;E<i.length;E++){let N=i[E];if(N?.$ref&&!(0,GE.schemaHasRulesButRef)(N,s.self.RULES)){let Re=N.$ref;if(N=R_.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,Re),N instanceof R_.SchemaEnv&&(N=N.schema),N===void 0)throw new WE.default(s.opts.uriResolver,s.baseId,Re)}let ve=(m=N?.properties)===null||m===void 0?void 0:m[a];if(typeof ve!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);g=g&&(p||v(N)),b(ve,E)}if(!g)throw new Error(`discriminator: "${a}" must be required`);return f;function v({required:E}){return Array.isArray(E)&&E.includes(a)}function b(E,N){if(E.const)w(E.const,N);else if(E.enum)for(let ve of E.enum)w(ve,N);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function w(E,N){if(typeof E!="string"||E in f)throw new Error(`discriminator: "${a}" values must be unique strings`);f[E]=N}}}};zd.default=JE});var O_=k((dj,YE)=>{YE.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 Td=k((ce,Ed)=>{"use strict";Object.defineProperty(ce,"__esModule",{value:!0});ce.MissingRefError=ce.ValidationError=ce.CodeGen=ce.Name=ce.nil=ce.stringify=ce.str=ce._=ce.KeywordCxt=ce.Ajv=void 0;var XE=Tg(),QE=E_(),eT=I_(),N_=O_(),tT=["/properties"],Oi="http://json-schema.org/draft-07/schema",xn=class extends XE.default{_addVocabularies(){super._addVocabularies(),QE.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(eT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(N_,tT):N_;this.addMetaSchema(e,Oi,!1),this.refs["http://json-schema.org/schema"]=Oi}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Oi)?Oi:void 0)}};ce.Ajv=xn;Ed.exports=ce=xn;Ed.exports.Ajv=xn;Object.defineProperty(ce,"__esModule",{value:!0});ce.default=xn;var rT=To();Object.defineProperty(ce,"KeywordCxt",{enumerable:!0,get:function(){return rT.KeywordCxt}});var wn=U();Object.defineProperty(ce,"_",{enumerable:!0,get:function(){return wn._}});Object.defineProperty(ce,"str",{enumerable:!0,get:function(){return wn.str}});Object.defineProperty(ce,"stringify",{enumerable:!0,get:function(){return wn.stringify}});Object.defineProperty(ce,"nil",{enumerable:!0,get:function(){return wn.nil}});Object.defineProperty(ce,"Name",{enumerable:!0,get:function(){return wn.Name}});Object.defineProperty(ce,"CodeGen",{enumerable:!0,get:function(){return wn.CodeGen}});var nT=di();Object.defineProperty(ce,"ValidationError",{enumerable:!0,get:function(){return nT.default}});var oT=Po();Object.defineProperty(ce,"MissingRefError",{enumerable:!0,get:function(){return oT.default}})});var L_=k(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.formatNames=Et.fastFormats=Et.fullFormats=void 0;function zt(t,e){return{validate:t,compare:e}}Et.fullFormats={date:zt(M_,Od),time:zt(Rd(!0),Nd),"date-time":zt(C_(!0),D_),"iso-time":zt(Rd(),A_),"iso-date-time":zt(C_(),q_),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:lT,"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:_T,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:dT,int32:{type:"number",validate:mT},int64:{type:"number",validate:hT},float:{type:"number",validate:j_},double:{type:"number",validate:j_},password:!0,binary:!0};Et.fastFormats={...Et.fullFormats,date:zt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Od),time:zt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Nd),"date-time":zt(/^\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,D_),"iso-time":zt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,A_),"iso-date-time":zt(/^\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,q_),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Et.formatNames=Object.keys(Et.fullFormats);function sT(t){return t%4===0&&(t%100!==0||t%400===0)}var iT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,aT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function M_(t){let e=iT.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&&sT(r)?29:aT[n])}function Od(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Pd=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Rd(t){return function(r){let n=Pd.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),d=+(n[7]||0);if(u>23||d>59||t&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let l=s-d*c,h=o-u*c-(l<0?1:0);return(h===23||h===-1)&&(l===59||l===-1)&&i<61}}function Nd(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 A_(t,e){if(!(t&&e))return;let r=Pd.exec(t),n=Pd.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 Id=/t|\s/i;function C_(t){let e=Rd(t);return function(n){let o=n.split(Id);return o.length===2&&M_(o[0])&&e(o[1])}}function D_(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function q_(t,e){if(!(t&&e))return;let[r,n]=t.split(Id),[o,s]=e.split(Id),i=Od(r,o);if(i!==void 0)return i||Nd(n,s)}var cT=/\/|:/,uT=/^(?:[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 lT(t){return cT.test(t)&&uT.test(t)}var Z_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function dT(t){return Z_.lastIndex=0,Z_.test(t)}var fT=-(2**31),pT=2**31-1;function mT(t){return Number.isInteger(t)&&t<=pT&&t>=fT}function hT(t){return Number.isInteger(t)}function j_(){return!0}var gT=/[^\\]\\Z/;function _T(t){if(gT.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var U_=k($n=>{"use strict";Object.defineProperty($n,"__esModule",{value:!0});$n.formatLimitDefinition=void 0;var yT=Td(),_t=U(),cr=_t.operators,Ni={formatMaximum:{okStr:"<=",ok:cr.LTE,fail:cr.GT},formatMinimum:{okStr:">=",ok:cr.GTE,fail:cr.LT},formatExclusiveMaximum:{okStr:"<",ok:cr.LT,fail:cr.GTE},formatExclusiveMinimum:{okStr:">",ok:cr.GT,fail:cr.LTE}},vT={message:({keyword:t,schemaCode:e})=>(0,_t.str)`should be ${Ni[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,_t._)`{comparison: ${Ni[t].okStr}, limit: ${e}}`};$n.formatLimitDefinition={keyword:Object.keys(Ni),type:"string",schemaType:"string",$data:!0,error:vT,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new yT.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():d();function u(){let h=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),m=e.const("fmt",(0,_t._)`${h}[${c.schemaCode}]`);t.fail$data((0,_t.or)((0,_t._)`typeof ${m} != "object"`,(0,_t._)`${m} instanceof RegExp`,(0,_t._)`typeof ${m}.compare != "function"`,l(m)))}function d(){let h=c.schema,m=a.formats[h];if(!m||m===!0)return;if(typeof m!="object"||m instanceof RegExp||typeof m.compare!="function")throw new Error(`"${o}": format "${h}" does not define "compare" function`);let f=e.scopeValue("formats",{key:h,ref:m,code:i.code.formats?(0,_t._)`${i.code.formats}${(0,_t.getProperty)(h)}`:void 0});t.fail$data(l(f))}function l(h){return(0,_t._)`${h}.compare(${r}, ${n}) ${Ni[o].fail} 0`}},dependencies:["format"]};var bT=t=>(t.addKeyword($n.formatLimitDefinition),t);$n.default=bT});var H_=k((Fo,B_)=>{"use strict";Object.defineProperty(Fo,"__esModule",{value:!0});var kn=L_(),xT=U_(),Cd=U(),F_=new Cd.Name("fullFormats"),wT=new Cd.Name("fastFormats"),Zd=(t,e={keywords:!0})=>{if(Array.isArray(e))return V_(t,e,kn.fullFormats,F_),t;let[r,n]=e.mode==="fast"?[kn.fastFormats,wT]:[kn.fullFormats,F_],o=e.formats||kn.formatNames;return V_(t,o,r,n),e.keywords&&(0,xT.default)(t),t};Zd.get=(t,e="full")=>{let n=(e==="fast"?kn.fastFormats:kn.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function V_(t,e,r,n){var o,s;(o=(s=t.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Cd._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}B_.exports=Fo=Zd;Object.defineProperty(Fo,"__esModule",{value:!0});Fo.default=Zd});var Lt=k((Vj,ay)=>{"use strict";var sy=["nodebuffer","arraybuffer","fragments"],iy=typeof Blob<"u";iy&&sy.push("blob");ay.exports={BINARY_TYPES:sy,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:iy,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Bo=k((Bj,Li)=>{"use strict";var{EMPTY_BUFFER:IT}=Lt(),Dd=Buffer[Symbol.species];function OT(t,e){if(t.length===0)return IT;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let o=0;o<t.length;o++){let s=t[o];r.set(s,n),n+=s.length}return n<e?new Dd(r.buffer,r.byteOffset,n):r}function cy(t,e,r,n,o){for(let s=0;s<o;s++)r[n+s]=t[s]^e[s&3]}function uy(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}function NT(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function qd(t){if(qd.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Dd(t):ArrayBuffer.isView(t)?e=new Dd(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),qd.readOnly=!1),e}Li.exports={concat:OT,mask:cy,toArrayBuffer:NT,toBuffer:qd,unmask:uy};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=_e("bufferutil");Li.exports.mask=function(e,r,n,o,s){s<48?cy(e,r,n,o,s):t.mask(e,r,n,o,s)},Li.exports.unmask=function(e,r){e.length<32?uy(e,r):t.unmask(e,r)}}catch{}});var fy=k((Hj,dy)=>{"use strict";var ly=Symbol("kDone"),Ld=Symbol("kRun"),Ud=class{constructor(e){this[ly]=()=>{this.pending--,this[Ld]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Ld]()}[Ld](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[ly])}}};dy.exports=Ud});var Wo=k((Wj,gy)=>{"use strict";var Ho=_e("zlib"),py=Bo(),CT=fy(),{kStatusCode:my}=Lt(),ZT=Buffer[Symbol.species],jT=Buffer.from([0,0,255,255]),Fi=Symbol("permessage-deflate"),Ut=Symbol("total-length"),Sn=Symbol("callback"),lr=Symbol("buffers"),zn=Symbol("error"),Ui,Fd=class{constructor(e,r,n){if(this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!Ui){let o=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Ui=new CT(o)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Sn];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,n=e.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let s=+o;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=s}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),e}decompress(e,r,n){Ui.add(o=>{this._decompress(e,r,(s,i)=>{o(),n(s,i)})})}compress(e,r,n){Ui.add(o=>{this._compress(e,r,(s,i)=>{o(),n(s,i)})})}_decompress(e,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Ho.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Ho.createInflateRaw({...this._options.zlibInflateOptions,windowBits:i}),this._inflate[Fi]=this,this._inflate[Ut]=0,this._inflate[lr]=[],this._inflate.on("error",AT),this._inflate.on("data",hy)}this._inflate[Sn]=n,this._inflate.write(e),r&&this._inflate.write(jT),this._inflate.flush(()=>{let s=this._inflate[zn];if(s){this._inflate.close(),this._inflate=null,n(s);return}let i=py.concat(this._inflate[lr],this._inflate[Ut]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ut]=0,this._inflate[lr]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,i)})}_compress(e,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let s=`${o}_max_window_bits`,i=typeof this.params[s]!="number"?Ho.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Ho.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:i}),this._deflate[Ut]=0,this._deflate[lr]=[],this._deflate.on("data",MT)}this._deflate[Sn]=n,this._deflate.write(e),this._deflate.flush(Ho.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=py.concat(this._deflate[lr],this._deflate[Ut]);r&&(s=new ZT(s.buffer,s.byteOffset,s.length-4)),this._deflate[Sn]=null,this._deflate[Ut]=0,this._deflate[lr]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,s)})}};gy.exports=Fd;function MT(t){this[lr].push(t),this[Ut]+=t.length}function hy(t){if(this[Ut]+=t.length,this[Fi]._maxPayload<1||this[Ut]<=this[Fi]._maxPayload){this[lr].push(t);return}this[zn]=new RangeError("Max payload size exceeded"),this[zn].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[zn][my]=1009,this.removeListener("data",hy),this.reset()}function AT(t){if(this[Fi]._inflate=null,this[zn]){this[Sn](this[zn]);return}t[my]=1007,this[Sn](t)}});var En=k((Gj,Vi)=>{"use strict";var{isUtf8:_y}=_e("buffer"),{hasBlob:DT}=Lt(),qT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function LT(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Vd(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}function UT(t){return DT&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}Vi.exports={isBlob:UT,isValidStatusCode:LT,isValidUTF8:Vd,tokenChars:qT};if(_y)Vi.exports.isValidUTF8=function(t){return t.length<24?Vd(t):_y(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=_e("utf-8-validate");Vi.exports.isValidUTF8=function(e){return e.length<32?Vd(e):t(e)}}catch{}});var Kd=k((Kj,ky)=>{"use strict";var{Writable:FT}=_e("stream"),yy=Wo(),{BINARY_TYPES:VT,EMPTY_BUFFER:vy,kStatusCode:BT,kWebSocket:HT}=Lt(),{concat:Bd,toArrayBuffer:WT,unmask:GT}=Bo(),{isValidStatusCode:KT,isValidUTF8:by}=En(),Bi=Buffer[Symbol.species],at=0,xy=1,wy=2,$y=3,Hd=4,Wd=5,Hi=6,Gd=class extends FT{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||VT[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[HT]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=at}_write(e,r,n){if(this._opcode===8&&this._state==at)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new Bi(n.buffer,n.byteOffset+e,n.length-e),new Bi(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],o=r.length-e;e>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),o),this._buffers[0]=new Bi(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case at:this.getInfo(e);break;case xy:this.getPayloadLength16(e);break;case wy:this.getPayloadLength64(e);break;case $y:this.getMask();break;case Hd:this.getData(e);break;case Wd:case Hi:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[yy.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(o);return}this._payloadLength===126?this._state=xy:this._payloadLength===127?this._state=wy:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=$y:this._state=Hd}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Hd}getData(e){let r=vy;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&>(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=Wd,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[yy.extensionName].decompress(e,this._fin,(o,s)=>{if(o)return r(o);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(i);return}this._fragments.push(s)}this.dataMessage(r),this._state===at&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=at;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=Bd(n,r):this._binaryType==="arraybuffer"?o=WT(Bd(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=at):(this._state=Hi,setImmediate(()=>{this.emit("message",o,!0),this._state=at,this.startLoop(e)}))}else{let o=Bd(n,r);if(!this._skipUTF8Validation&&!by(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===Wd||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=at):(this._state=Hi,setImmediate(()=>{this.emit("message",o,!1),this._state=at,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,vy),this.end();else{let n=e.readUInt16BE(0);if(!KT(n)){let s=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let o=new Bi(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!by(o)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=at;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=at):(this._state=Hi,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=at,this.startLoop(r)}))}createError(e,r,n,o,s){this._loop=!1,this._errored=!0;let i=new e(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(i,this.createError),i.code=s,i[BT]=o,i}};ky.exports=Gd});var Xd=k((Yj,Ey)=>{"use strict";var{Duplex:Jj}=_e("stream"),{randomFillSync:JT}=_e("crypto"),Sy=Wo(),{EMPTY_BUFFER:YT,kWebSocket:XT,NOOP:QT}=Lt(),{isBlob:Tn,isValidStatusCode:eP}=En(),{mask:zy,toBuffer:Cr}=Bo(),ct=Symbol("kByteLength"),tP=Buffer.alloc(4),Wi=8*1024,Zr,Pn=Wi,yt=0,rP=1,nP=2,Jd=class t{constructor(e,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=yt,this.onerror=QT,this[XT]=void 0}static frame(e,r){let n,o=!1,s=2,i=!1;r.mask&&(n=r.maskBuffer||tP,r.generateMask?r.generateMask(n):(Pn===Wi&&(Zr===void 0&&(Zr=Buffer.alloc(Wi)),JT(Zr,0,Wi),Pn=0),n[0]=Zr[Pn++],n[1]=Zr[Pn++],n[2]=Zr[Pn++],n[3]=Zr[Pn++]),i=(n[0]|n[1]|n[2]|n[3])===0,s=6);let a;typeof e=="string"?(!r.mask||i)&&r[ct]!==void 0?a=r[ct]:(e=Buffer.from(e),a=e.length):(a=e.length,o=r.mask&&r.readOnly&&!i);let c=a;a>=65536?(s+=8,c=127):a>125&&(s+=2,c=126);let u=Buffer.allocUnsafe(o?a+s:s);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(a,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),r.mask?(u[1]|=128,u[s-4]=n[0],u[s-3]=n[1],u[s-2]=n[2],u[s-1]=n[3],i?[u,e]:o?(zy(e,n,u,s,a),[u]):(zy(e,n,e,0,a),[u,e])):[u,e]}close(e,r,n,o){let s;if(e===void 0)s=YT;else{if(typeof e!="number"||!eP(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let a=Buffer.byteLength(r);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+a),s.writeUInt16BE(e,0),typeof r=="string"?s.write(r,2):s.set(r,2)}}let i={[ct]:s.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==yt?this.enqueue([this.dispatch,s,!1,i,o]):this.sendFrame(t.frame(s,i),o)}ping(e,r,n){let o,s;if(typeof e=="string"?(o=Buffer.byteLength(e),s=!1):Tn(e)?(o=e.size,s=!1):(e=Cr(e),o=e.length,s=Cr.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[ct]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};Tn(e)?this._state!==yt?this.enqueue([this.getBlobData,e,!1,i,n]):this.getBlobData(e,!1,i,n):this._state!==yt?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e,i),n)}pong(e,r,n){let o,s;if(typeof e=="string"?(o=Buffer.byteLength(e),s=!1):Tn(e)?(o=e.size,s=!1):(e=Cr(e),o=e.length,s=Cr.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let i={[ct]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};Tn(e)?this._state!==yt?this.enqueue([this.getBlobData,e,!1,i,n]):this.getBlobData(e,!1,i,n):this._state!==yt?this.enqueue([this.dispatch,e,!1,i,n]):this.sendFrame(t.frame(e,i),n)}send(e,r,n){let o=this._extensions[Sy.extensionName],s=r.binary?2:1,i=r.compress,a,c;typeof e=="string"?(a=Buffer.byteLength(e),c=!1):Tn(e)?(a=e.size,c=!1):(e=Cr(e),a=e.length,c=Cr.readOnly),this._firstFragment?(this._firstFragment=!1,i&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(i=a>=o._threshold),this._compress=i):(i=!1,s=0),r.fin&&(this._firstFragment=!0);let u={[ct]:a,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:c,rsv1:i};Tn(e)?this._state!==yt?this.enqueue([this.getBlobData,e,this._compress,u,n]):this.getBlobData(e,this._compress,u,n):this._state!==yt?this.enqueue([this.dispatch,e,this._compress,u,n]):this.dispatch(e,this._compress,u,n)}getBlobData(e,r,n,o){this._bufferedBytes+=n[ct],this._state=nP,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let a=new Error("The socket was closed while the blob was being read");process.nextTick(Yd,this,a,o);return}this._bufferedBytes-=n[ct];let i=Cr(s);r?this.dispatch(i,r,n,o):(this._state=yt,this.sendFrame(t.frame(i,n),o),this.dequeue())}).catch(s=>{process.nextTick(oP,this,s,o)})}dispatch(e,r,n,o){if(!r){this.sendFrame(t.frame(e,n),o);return}let s=this._extensions[Sy.extensionName];this._bufferedBytes+=n[ct],this._state=rP,s.compress(e,n.fin,(i,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");Yd(this,c,o);return}this._bufferedBytes-=n[ct],this._state=yt,n.readOnly=!1,this.sendFrame(t.frame(a,n),o),this.dequeue()})}dequeue(){for(;this._state===yt&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][ct],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][ct],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};Ey.exports=Jd;function Yd(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let o=t._queue[n],s=o[o.length-1];typeof s=="function"&&s(e)}}function oP(t,e,r){Yd(t,e,r),t.onerror(e)}});var jy=k((Xj,Zy)=>{"use strict";var{kForOnEventAttribute:Go,kListener:Qd}=Lt(),Ty=Symbol("kCode"),Py=Symbol("kData"),Ry=Symbol("kError"),Iy=Symbol("kMessage"),Oy=Symbol("kReason"),Rn=Symbol("kTarget"),Ny=Symbol("kType"),Cy=Symbol("kWasClean"),Ft=class{constructor(e){this[Rn]=null,this[Ny]=e}get target(){return this[Rn]}get type(){return this[Ny]}};Object.defineProperty(Ft.prototype,"target",{enumerable:!0});Object.defineProperty(Ft.prototype,"type",{enumerable:!0});var jr=class extends Ft{constructor(e,r={}){super(e),this[Ty]=r.code===void 0?0:r.code,this[Oy]=r.reason===void 0?"":r.reason,this[Cy]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Ty]}get reason(){return this[Oy]}get wasClean(){return this[Cy]}};Object.defineProperty(jr.prototype,"code",{enumerable:!0});Object.defineProperty(jr.prototype,"reason",{enumerable:!0});Object.defineProperty(jr.prototype,"wasClean",{enumerable:!0});var In=class extends Ft{constructor(e,r={}){super(e),this[Ry]=r.error===void 0?null:r.error,this[Iy]=r.message===void 0?"":r.message}get error(){return this[Ry]}get message(){return this[Iy]}};Object.defineProperty(In.prototype,"error",{enumerable:!0});Object.defineProperty(In.prototype,"message",{enumerable:!0});var Ko=class extends Ft{constructor(e,r={}){super(e),this[Py]=r.data===void 0?null:r.data}get data(){return this[Py]}};Object.defineProperty(Ko.prototype,"data",{enumerable:!0});var sP={addEventListener(t,e,r={}){for(let o of this.listeners(t))if(!r[Go]&&o[Qd]===e&&!o[Go])return;let n;if(t==="message")n=function(s,i){let a=new Ko("message",{data:i?s:s.toString()});a[Rn]=this,Gi(e,this,a)};else if(t==="close")n=function(s,i){let a=new jr("close",{code:s,reason:i.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[Rn]=this,Gi(e,this,a)};else if(t==="error")n=function(s){let i=new In("error",{error:s,message:s.message});i[Rn]=this,Gi(e,this,i)};else if(t==="open")n=function(){let s=new Ft("open");s[Rn]=this,Gi(e,this,s)};else return;n[Go]=!!r[Go],n[Qd]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[Qd]===e&&!r[Go]){this.removeListener(t,r);break}}};Zy.exports={CloseEvent:jr,ErrorEvent:In,Event:Ft,EventTarget:sP,MessageEvent:Ko};function Gi(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}});var ef=k((Qj,My)=>{"use strict";var{tokenChars:Jo}=En();function Tt(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}function iP(t){let e=Object.create(null),r=Object.create(null),n=!1,o=!1,s=!1,i,a,c=-1,u=-1,d=-1,l=0;for(;l<t.length;l++)if(u=t.charCodeAt(l),i===void 0)if(d===-1&&Jo[u]===1)c===-1&&(c=l);else if(l!==0&&(u===32||u===9))d===-1&&c!==-1&&(d=l);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${l}`);d===-1&&(d=l);let m=t.slice(c,d);u===44?(Tt(e,m,r),r=Object.create(null)):i=m,c=d=-1}else throw new SyntaxError(`Unexpected character at index ${l}`);else if(a===void 0)if(d===-1&&Jo[u]===1)c===-1&&(c=l);else if(u===32||u===9)d===-1&&c!==-1&&(d=l);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${l}`);d===-1&&(d=l),Tt(r,t.slice(c,d),!0),u===44&&(Tt(e,i,r),r=Object.create(null),i=void 0),c=d=-1}else if(u===61&&c!==-1&&d===-1)a=t.slice(c,l),c=d=-1;else throw new SyntaxError(`Unexpected character at index ${l}`);else if(o){if(Jo[u]!==1)throw new SyntaxError(`Unexpected character at index ${l}`);c===-1?c=l:n||(n=!0),o=!1}else if(s)if(Jo[u]===1)c===-1&&(c=l);else if(u===34&&c!==-1)s=!1,d=l;else if(u===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${l}`);else if(u===34&&t.charCodeAt(l-1)===61)s=!0;else if(d===-1&&Jo[u]===1)c===-1&&(c=l);else if(c!==-1&&(u===32||u===9))d===-1&&(d=l);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${l}`);d===-1&&(d=l);let m=t.slice(c,d);n&&(m=m.replace(/\\/g,""),n=!1),Tt(r,a,m),u===44&&(Tt(e,i,r),r=Object.create(null),i=void 0),a=void 0,c=d=-1}else throw new SyntaxError(`Unexpected character at index ${l}`);if(c===-1||s||u===32||u===9)throw new SyntaxError("Unexpected end of input");d===-1&&(d=l);let h=t.slice(c,d);return i===void 0?Tt(e,h,r):(a===void 0?Tt(r,h,!0):n?Tt(r,a,h.replace(/\\/g,"")):Tt(r,a,h),Tt(e,i,r)),e}function aP(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(o=>{let s=n[o];return Array.isArray(s)||(s=[s]),s.map(i=>i===!0?o:`${o}=${i}`).join("; ")})).join("; ")).join(", ")}).join(", ")}My.exports={format:aP,parse:iP}});var Xi=k((rM,Ky)=>{"use strict";var cP=_e("events"),uP=_e("https"),lP=_e("http"),qy=_e("net"),dP=_e("tls"),{randomBytes:fP,createHash:pP}=_e("crypto"),{Duplex:eM,Readable:tM}=_e("stream"),{URL:tf}=_e("url"),dr=Wo(),mP=Kd(),hP=Xd(),{isBlob:gP}=En(),{BINARY_TYPES:Ay,CLOSE_TIMEOUT:_P,EMPTY_BUFFER:Ki,GUID:yP,kForOnEventAttribute:rf,kListener:vP,kStatusCode:bP,kWebSocket:xe,NOOP:Ly}=Lt(),{EventTarget:{addEventListener:xP,removeEventListener:wP}}=jy(),{format:$P,parse:kP}=ef(),{toBuffer:SP}=Bo(),Uy=Symbol("kAborted"),nf=[8,13],Vt=["CONNECTING","OPEN","CLOSING","CLOSED"],zP=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,pe=class t extends cP{constructor(e,r,n){super(),this._binaryType=Ay[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Ki,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),Fy(this,e,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Ay.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let o=new mP({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),s=new hP(e,this._extensions,n.generateMask);this._receiver=o,this._sender=s,this._socket=e,o[xe]=this,s[xe]=this,e[xe]=this,o.on("conclude",PP),o.on("drain",RP),o.on("error",IP),o.on("message",OP),o.on("ping",NP),o.on("pong",CP),s.onerror=ZP,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",Hy),e.on("data",Yi),e.on("end",Wy),e.on("error",Gy),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[dr.extensionName]&&this._extensions[dr.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){Xe(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),By(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){of(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Ki,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){of(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||Ki,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){of(this,e,n);return}let o={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[dr.extensionName]||(o.compress=!1),this._sender.send(e||Ki,o,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){Xe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(pe,"CONNECTING",{enumerable:!0,value:Vt.indexOf("CONNECTING")});Object.defineProperty(pe.prototype,"CONNECTING",{enumerable:!0,value:Vt.indexOf("CONNECTING")});Object.defineProperty(pe,"OPEN",{enumerable:!0,value:Vt.indexOf("OPEN")});Object.defineProperty(pe.prototype,"OPEN",{enumerable:!0,value:Vt.indexOf("OPEN")});Object.defineProperty(pe,"CLOSING",{enumerable:!0,value:Vt.indexOf("CLOSING")});Object.defineProperty(pe.prototype,"CLOSING",{enumerable:!0,value:Vt.indexOf("CLOSING")});Object.defineProperty(pe,"CLOSED",{enumerable:!0,value:Vt.indexOf("CLOSED")});Object.defineProperty(pe.prototype,"CLOSED",{enumerable:!0,value:Vt.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(pe.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(pe.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[rf])return e[vP];return null},set(e){for(let r of this.listeners(t))if(r[rf]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[rf]:!0})}})});pe.prototype.addEventListener=xP;pe.prototype.removeEventListener=wP;Ky.exports=pe;function Fy(t,e,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_P,protocolVersion:nf[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=o.autoPong,t._closeTimeout=o.closeTimeout,!nf.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${nf.join(", ")})`);let s;if(e instanceof tf)s=e;else try{s=new tf(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),t._url=s.href;let i=s.protocol==="wss:",a=s.protocol==="ws+unix:",c;if(s.protocol!=="ws:"&&!i&&!a?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:a&&!s.pathname?c="The URL's pathname is empty":s.hash&&(c="The URL contains a fragment identifier"),c){let p=new SyntaxError(c);if(t._redirects===0)throw p;Ji(t,p);return}let u=i?443:80,d=fP(16).toString("base64"),l=i?uP.request:lP.request,h=new Set,m;if(o.createConnection=o.createConnection||(i?TP:EP),o.defaultPort=o.defaultPort||u,o.port=s.port||u,o.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":d,Connection:"Upgrade",Upgrade:"websocket"},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(m=new dr(o.perMessageDeflate!==!0?o.perMessageDeflate:{},!1,o.maxPayload),o.headers["Sec-WebSocket-Extensions"]=$P({[dr.extensionName]:m.offer()})),r.length){for(let p of r){if(typeof p!="string"||!zP.test(p)||h.has(p))throw new SyntaxError("An invalid or duplicated subprotocol was specified");h.add(p)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),a){let p=o.path.split(":");o.socketPath=p[0],o.path=p[1]}let f;if(o.followRedirects){if(t._redirects===0){t._originalIpc=a,t._originalSecure=i,t._originalHostOrSocketPath=a?o.socketPath:s.host;let p=n&&n.headers;if(n={...n,headers:{}},p)for(let[g,v]of Object.entries(p))n.headers[g.toLowerCase()]=v}else if(t.listenerCount("redirect")===0){let p=a?t._originalIpc?o.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:s.host===t._originalHostOrSocketPath;(!p||t._originalSecure&&!i)&&(delete o.headers.authorization,delete o.headers.cookie,p||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),f=t._req=l(o),t._redirects&&t.emit("redirect",t.url,f)}else f=t._req=l(o);o.timeout&&f.on("timeout",()=>{Xe(t,f,"Opening handshake has timed out")}),f.on("error",p=>{f===null||f[Uy]||(f=t._req=null,Ji(t,p))}),f.on("response",p=>{let g=p.headers.location,v=p.statusCode;if(g&&o.followRedirects&&v>=300&&v<400){if(++t._redirects>o.maxRedirects){Xe(t,f,"Maximum redirects exceeded");return}f.abort();let b;try{b=new tf(g,e)}catch{let E=new SyntaxError(`Invalid URL: ${g}`);Ji(t,E);return}Fy(t,b,r,n)}else t.emit("unexpected-response",f,p)||Xe(t,f,`Unexpected server response: ${p.statusCode}`)}),f.on("upgrade",(p,g,v)=>{if(t.emit("upgrade",p),t.readyState!==pe.CONNECTING)return;f=t._req=null;let b=p.headers.upgrade;if(b===void 0||b.toLowerCase()!=="websocket"){Xe(t,g,"Invalid Upgrade header");return}let w=pP("sha1").update(d+yP).digest("base64");if(p.headers["sec-websocket-accept"]!==w){Xe(t,g,"Invalid Sec-WebSocket-Accept header");return}let E=p.headers["sec-websocket-protocol"],N;if(E!==void 0?h.size?h.has(E)||(N="Server sent an invalid subprotocol"):N="Server sent a subprotocol but none was requested":h.size&&(N="Server sent no subprotocol"),N){Xe(t,g,N);return}E&&(t._protocol=E);let ve=p.headers["sec-websocket-extensions"];if(ve!==void 0){if(!m){Xe(t,g,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Re;try{Re=kP(ve)}catch{Xe(t,g,"Invalid Sec-WebSocket-Extensions header");return}let Rt=Object.keys(Re);if(Rt.length!==1||Rt[0]!==dr.extensionName){Xe(t,g,"Server indicated an extension that was not requested");return}try{m.accept(Re[dr.extensionName])}catch{Xe(t,g,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[dr.extensionName]=m}t.setSocket(g,v,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(f,t):f.end()}function Ji(t,e){t._readyState=pe.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function EP(t){return t.path=t.socketPath,qy.connect(t)}function TP(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=qy.isIP(t.host)?"":t.host),dP.connect(t)}function Xe(t,e,r){t._readyState=pe.CLOSING;let n=new Error(r);Error.captureStackTrace(n,Xe),e.setHeader?(e[Uy]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Ji,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function of(t,e,r){if(e){let n=gP(e)?e.size:SP(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${Vt[t.readyState]})`);process.nextTick(r,n)}}function PP(t,e){let r=this[xe];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[xe]!==void 0&&(r._socket.removeListener("data",Yi),process.nextTick(Vy,r._socket),t===1005?r.close():r.close(t,e))}function RP(){let t=this[xe];t.isPaused||t._socket.resume()}function IP(t){let e=this[xe];e._socket[xe]!==void 0&&(e._socket.removeListener("data",Yi),process.nextTick(Vy,e._socket),e.close(t[bP])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function Dy(){this[xe].emitClose()}function OP(t,e){this[xe].emit("message",t,e)}function NP(t){let e=this[xe];e._autoPong&&e.pong(t,!this._isServer,Ly),e.emit("ping",t)}function CP(t){this[xe].emit("pong",t)}function Vy(t){t.resume()}function ZP(t){let e=this[xe];e.readyState!==pe.CLOSED&&(e.readyState===pe.OPEN&&(e._readyState=pe.CLOSING,By(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function By(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout)}function Hy(){let t=this[xe];if(this.removeListener("close",Hy),this.removeListener("data",Yi),this.removeListener("end",Wy),t._readyState=pe.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);t._receiver.write(e)}t._receiver.end(),this[xe]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",Dy),t._receiver.on("finish",Dy))}function Yi(t){this[xe]._receiver.write(t)||this.pause()}function Wy(){let t=this[xe];t._readyState=pe.CLOSING,t._receiver.end(),this.end()}function Gy(){let t=this[xe];this.removeListener("error",Gy),this.on("error",Ly),t&&(t._readyState=pe.CLOSING,this.destroy())}});var Qy=k((oM,Xy)=>{"use strict";var nM=Xi(),{Duplex:jP}=_e("stream");function Jy(t){t.emit("close")}function MP(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Yy(t){this.removeListener("error",Yy),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function AP(t,e){let r=!0,n=new jP({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",function(s,i){let a=!i&&n._readableState.objectMode?s.toString():s;n.push(a)||t.pause()}),t.once("error",function(s){n.destroyed||(r=!1,n.destroy(s))}),t.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(o,s){if(t.readyState===t.CLOSED){s(o),process.nextTick(Jy,n);return}let i=!1;t.once("error",function(c){i=!0,s(c)}),t.once("close",function(){i||s(o),process.nextTick(Jy,n)}),r&&t.terminate()},n._final=function(o){if(t.readyState===t.CONNECTING){t.once("open",function(){n._final(o)});return}t._socket!==null&&(t._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(t._socket.once("finish",function(){o()}),t.close()))},n._read=function(){t.isPaused&&t.resume()},n._write=function(o,s,i){if(t.readyState===t.CONNECTING){t.once("open",function(){n._write(o,s,i)});return}t.send(o,i)},n.on("end",MP),n.on("error",Yy),n}Xy.exports=AP});var tv=k((sM,ev)=>{"use strict";var{tokenChars:DP}=En();function qP(t){let e=new Set,r=-1,n=-1,o=0;for(o;o<t.length;o++){let i=t.charCodeAt(o);if(n===-1&&DP[i]===1)r===-1&&(r=o);else if(o!==0&&(i===32||i===9))n===-1&&r!==-1&&(n=o);else if(i===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let a=t.slice(r,n);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let s=t.slice(r,o);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return e.add(s),e}ev.exports={parse:qP}});var cv=k((aM,av)=>{"use strict";var LP=_e("events"),Qi=_e("http"),{Duplex:iM}=_e("stream"),{createHash:UP}=_e("crypto"),rv=ef(),Mr=Wo(),FP=tv(),VP=Xi(),{CLOSE_TIMEOUT:BP,GUID:HP,kWebSocket:WP}=Lt(),GP=/^[+/0-9A-Za-z]{22}==$/,nv=0,ov=1,iv=2,sf=class extends LP{constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:BP,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:VP,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Qi.createServer((n,o)=>{let s=Qi.STATUS_CODES[426];o.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),o.end(s)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=KP(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(o,s,i)=>{this.handleUpgrade(o,s,i,n)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=nv}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===iv){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Yo,this);return}if(e&&this.once("close",e),this._state!==ov)if(this._state=ov,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Yo,this):process.nextTick(Yo,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Yo(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,o){r.on("error",sv);let s=e.headers["sec-websocket-key"],i=e.headers.upgrade,a=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Ar(this,e,r,405,"Invalid HTTP method");return}if(i===void 0||i.toLowerCase()!=="websocket"){Ar(this,e,r,400,"Invalid Upgrade header");return}if(s===void 0||!GP.test(s)){Ar(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(a!==13&&a!==8){Ar(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Xo(r,400);return}let c=e.headers["sec-websocket-protocol"],u=new Set;if(c!==void 0)try{u=FP.parse(c)}catch{Ar(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let d=e.headers["sec-websocket-extensions"],l={};if(this.options.perMessageDeflate&&d!==void 0){let h=new Mr(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let m=rv.parse(d);m[Mr.extensionName]&&(h.accept(m[Mr.extensionName]),l[Mr.extensionName]=h)}catch{Ar(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${a===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(m,f,p,g)=>{if(!m)return Xo(r,f||401,p,g);this.completeUpgrade(l,s,u,e,r,n,o)});return}if(!this.options.verifyClient(h))return Xo(r,401)}this.completeUpgrade(l,s,u,e,r,n,o)}completeUpgrade(e,r,n,o,s,i,a){if(!s.readable||!s.writable)return s.destroy();if(s[WP])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>nv)return Xo(s,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${UP("sha1").update(r+HP).digest("base64")}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let l=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;l&&(u.push(`Sec-WebSocket-Protocol: ${l}`),d._protocol=l)}if(e[Mr.extensionName]){let l=e[Mr.extensionName].params,h=rv.format({[Mr.extensionName]:[l]});u.push(`Sec-WebSocket-Extensions: ${h}`),d._extensions=e}this.emit("headers",u,o),s.write(u.concat(`\r
|
|
11
11
|
`).join(`\r
|
|
12
|
-
`)),s.removeListener("error",
|
|
12
|
+
`)),s.removeListener("error",sv),d.setSocket(s,i,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(d),d.on("close",()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Yo,this)})),a(d,o)}};av.exports=sf;function KP(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return function(){for(let n of Object.keys(e))t.removeListener(n,e[n])}}function Yo(t){t._state=iv,t.emit("close")}function sv(){this.destroy()}function Xo(t,e,r,n){r=r||Qi.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Qi.STATUS_CODES[e]}\r
|
|
13
13
|
`+Object.keys(n).map(o=>`${o}: ${n[o]}`).join(`\r
|
|
14
14
|
`)+`\r
|
|
15
15
|
\r
|
|
16
|
-
`+r)}function Ar(t,e,r,n,o,s){if(t.listenerCount("wsClientError")){let i=new Error(o);Error.captureStackTrace(i,Ar),t.emit("wsClientError",i,r,e)}else Xo(r,n,o,s)}});var H;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(H||(H={}));var lf;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(lf||(lf={}));var z=H.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Rt=t=>{switch(typeof t){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(t)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(t)?z.array:t===null?z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?z.promise:typeof Map<"u"&&t instanceof Map?z.map:typeof Set<"u"&&t instanceof Set?z.set:typeof Date<"u"&&t instanceof Date?z.date:z.object;default:return z.unknown}};var x=H.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 Be=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(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[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,H.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Be.create=t=>new Be(t);var wv=(t,e)=>{let r;switch(t.code){case x.invalid_type:t.received===z.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,H.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${H.joinValues(t.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${H.joinValues(t.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${H.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof 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}"`:H.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case x.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 x.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 x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=e.defaultError,H.assertNever(t)}return{message:r}},Ht=wv;var $v=Ht;function On(){return $v}var Qo=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}};function S(t,e){let r=On(),n=Qo({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ht?void 0:Ht].filter(o=>!!o)});t.common.issues.push(n)}var Re=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return M;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,i=await o.value;n.push({key:s,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return M;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},M=Object.freeze({status:"aborted"}),qr=t=>({status:"dirty",value:t}),Ce=t=>({status:"valid",value:t}),ia=t=>t.status==="aborted",aa=t=>t.status==="dirty",hr=t=>t.status==="valid",Nn=t=>typeof Promise<"u"&&t instanceof Promise;var P;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(P||(P={}));var Xe=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}},df=(t,e)=>{if(hr(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 Be(t.common.issues);return this._error=r,this._error}}};function q(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:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var F=class{get description(){return this._def.description}_getType(e){return Rt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Re,ctx:{common:e.parent.common,data:e.data,parsedType:Rt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Nn(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:Rt(e)},o=this._parseSync({data:e,path:n.path,parent:n});return df(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Rt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return hr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>hr(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:Rt(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(Nn(o)?o:Promise.resolve(o));return df(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:x.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!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 ct({schema:this,typeName:$.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 He.create(this,this._def)}nullable(){return Nt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Gt.create(this)}promise(){return gr.create(this,this._def)}or(e){return Br.create([this,e],this._def)}and(e){return Hr.create(this,e,this._def)}transform(e){return new ct({...q(this._def),schema:this,typeName:$.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Yr({...q(this._def),innerType:this,defaultValue:r,typeName:$.ZodDefault})}brand(){return new es({typeName:$.ZodBranded,type:this,...q(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Xr({...q(this._def),innerType:this,catchValue:r,typeName:$.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ts.create(this,e)}readonly(){return Qr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},kv=/^c[^\s-]{8,}$/i,Sv=/^[0-9a-z]+$/,zv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ev=/^[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,Tv=/^[a-z0-9_-]{21}$/i,Pv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Rv=/^[-+]?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)?)??$/,Iv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ov="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ca,Nv=/^(?:(?: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])$/,Cv=/^(?:(?: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])$/,Zv=/^(([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]))$/,jv=/^(([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])$/,Mv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Av=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ff="((\\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])))",Dv=new RegExp(`^${ff}$`);function pf(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 qv(t){return new RegExp(`^${pf(t)}$`)}function Lv(t){let e=`${ff}T${pf(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 Uv(t,e){return!!((e==="v4"||!e)&&Nv.test(t)||(e==="v6"||!e)&&Zv.test(t))}function Fv(t,e){if(!Pv.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 Vv(t,e){return!!((e==="v4"||!e)&&Cv.test(t)||(e==="v6"||!e)&&jv.test(t))}var Ur=class t extends F{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return S(s,{code:x.invalid_type,expected:z.string,received:s.parsedType}),M}let n=new Re,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?S(o,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&S(o,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Iv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"email",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")ca||(ca=new RegExp(Ov,"u")),ca.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"emoji",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Ev.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"uuid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Tv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"nanoid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")kv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"cuid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Sv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"cuid2",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")zv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"ulid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),S(o,{validation:"url",code:x.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"regex",code:x.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Lv(s).test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Dv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?qv(s).test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Rv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"duration",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Uv(e.data,s.version)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"ip",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Fv(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"jwt",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Vv(e.data,s.version)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"cidr",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Mv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"base64",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Av.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"base64url",code:x.invalid_string,message:s.message}),n.dirty()):H.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:x.invalid_string,...P.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...P.errToObj(e)})}url(e){return this._addCheck({kind:"url",...P.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...P.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...P.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...P.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...P.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...P.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...P.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...P.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...P.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...P.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...P.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...P.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,...P.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,...P.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...P.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...P.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...P.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...P.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...P.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...P.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...P.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...P.errToObj(r)})}nonempty(e){return this.min(1,P.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}};Ur.create=t=>new Ur({checks:[],typeName:$.ZodString,coerce:t?.coerce??!1,...q(t)});function Bv(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var Cn=class t extends F{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)!==z.number){let s=this._getOrReturnCtx(e);return S(s,{code:x.invalid_type,expected:z.number,received:s.parsedType}),M}let n,o=new Re;for(let s of this._def.checks)s.kind==="int"?H.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:x.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Bv(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:x.not_finite,message:s.message}),o.dirty()):H.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,P.toString(r))}gt(e,r){return this.setLimit("min",e,!1,P.toString(r))}lte(e,r){return this.setLimit("max",e,!0,P.toString(r))}lt(e,r){return this.setLimit("max",e,!1,P.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:P.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:P.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:P.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:P.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:P.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:P.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:P.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:P.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:P.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:P.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"&&H.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)}};Cn.create=t=>new Cn({checks:[],typeName:$.ZodNumber,coerce:t?.coerce||!1,...q(t)});var Zn=class t extends F{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)!==z.bigint)return this._getInvalidInput(e);let n,o=new Re;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):H.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return S(r,{code:x.invalid_type,expected:z.bigint,received:r.parsedType}),M}gte(e,r){return this.setLimit("min",e,!0,P.toString(r))}gt(e,r){return this.setLimit("min",e,!1,P.toString(r))}lte(e,r){return this.setLimit("max",e,!0,P.toString(r))}lt(e,r){return this.setLimit("max",e,!1,P.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:P.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:P.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:P.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:P.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:P.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:P.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}};Zn.create=t=>new Zn({checks:[],typeName:$.ZodBigInt,coerce:t?.coerce??!1,...q(t)});var jn=class extends F{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.boolean,received:n.parsedType}),M}return Ce(e.data)}};jn.create=t=>new jn({typeName:$.ZodBoolean,coerce:t?.coerce||!1,...q(t)});var Mn=class t extends F{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return S(s,{code:x.invalid_type,expected:z.date,received:s.parsedType}),M}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return S(s,{code:x.invalid_date}),M}let n=new Re,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:x.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:x.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):H.assertNever(s);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:P.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:P.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}};Mn.create=t=>new Mn({checks:[],coerce:t?.coerce||!1,typeName:$.ZodDate,...q(t)});var An=class extends F{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.symbol,received:n.parsedType}),M}return Ce(e.data)}};An.create=t=>new An({typeName:$.ZodSymbol,...q(t)});var Fr=class extends F{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.undefined,received:n.parsedType}),M}return Ce(e.data)}};Fr.create=t=>new Fr({typeName:$.ZodUndefined,...q(t)});var Vr=class extends F{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.null,received:n.parsedType}),M}return Ce(e.data)}};Vr.create=t=>new Vr({typeName:$.ZodNull,...q(t)});var Dn=class extends F{constructor(){super(...arguments),this._any=!0}_parse(e){return Ce(e.data)}};Dn.create=t=>new Dn({typeName:$.ZodAny,...q(t)});var Wt=class extends F{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ce(e.data)}};Wt.create=t=>new Wt({typeName:$.ZodUnknown,...q(t)});var vt=class extends F{_parse(e){let r=this._getOrReturnCtx(e);return S(r,{code:x.invalid_type,expected:z.never,received:r.parsedType}),M}};vt.create=t=>new vt({typeName:$.ZodNever,...q(t)});var qn=class extends F{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.void,received:n.parsedType}),M}return Ce(e.data)}};qn.create=t=>new qn({typeName:$.ZodVoid,...q(t)});var Gt=class t extends F{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==z.array)return S(r,{code:x.invalid_type,expected:z.array,received:r.parsedType}),M;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(i||a)&&(S(r,{code:i?x.too_big:x.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(S(r,{code:x.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(S(r,{code:x.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>o.type._parseAsync(new Xe(r,i,r.path,a)))).then(i=>Re.mergeArray(n,i));let s=[...r.data].map((i,a)=>o.type._parseSync(new Xe(r,i,r.path,a)));return Re.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:P.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:P.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:P.toString(r)}})}nonempty(e){return this.min(1,e)}};Gt.create=(t,e)=>new Gt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...q(e)});function Lr(t){if(t instanceof We){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=He.create(Lr(n))}return new We({...t._def,shape:()=>e})}else return t instanceof Gt?new Gt({...t._def,type:Lr(t.element)}):t instanceof He?He.create(Lr(t.unwrap())):t instanceof Nt?Nt.create(Lr(t.unwrap())):t instanceof Ot?Ot.create(t.items.map(e=>Lr(e))):t}var We=class t extends F{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=H.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==z.object){let u=this._getOrReturnCtx(e);return S(u,{code:x.invalid_type,expected:z.object,received:u.parsedType}),M}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof vt&&this._def.unknownKeys==="strip"))for(let u in o.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=s[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new Xe(o,d,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof vt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(S(o,{code:x.unrecognized_keys,keys:a}),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 a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new Xe(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,h=await l.value;u.push({key:d,value:h,alwaysSet:l.alwaysSet})}return u}).then(u=>Re.mergeObjectSync(n,u)):Re.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return P.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:P.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:$.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 H.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 H.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Lr(this)}partial(e){let r={};for(let n of H.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 H.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof He;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return mf(H.objectKeys(this.shape))}};We.create=(t,e)=>new We({shape:()=>t,unknownKeys:"strip",catchall:vt.create(),typeName:$.ZodObject,...q(e)});We.strictCreate=(t,e)=>new We({shape:()=>t,unknownKeys:"strict",catchall:vt.create(),typeName:$.ZodObject,...q(e)});We.lazycreate=(t,e)=>new We({shape:t,unknownKeys:"strip",catchall:vt.create(),typeName:$.ZodObject,...q(e)});var Br=class extends F{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Be(a.ctx.common.issues));return S(r,{code:x.invalid_union,unionErrors:i}),M}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let s,i=[];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"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new Be(c));return S(r,{code:x.invalid_union,unionErrors:a}),M}}get options(){return this._def.options}};Br.create=(t,e)=>new Br({options:t,typeName:$.ZodUnion,...q(e)});var It=t=>t instanceof Wr?It(t.schema):t instanceof ct?It(t.innerType()):t instanceof Gr?[t.value]:t instanceof Kr?t.options:t instanceof Jr?H.objectValues(t.enum):t instanceof Yr?It(t._def.innerType):t instanceof Fr?[void 0]:t instanceof Vr?[null]:t instanceof He?[void 0,...It(t.unwrap())]:t instanceof Nt?[null,...It(t.unwrap())]:t instanceof es||t instanceof Qr?It(t.unwrap()):t instanceof Xr?It(t._def.innerType):[],ua=class t extends F{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return S(r,{code:x.invalid_type,expected:z.object,received:r.parsedType}),M;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(S(r,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let i=It(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:$.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...q(n)})}};function la(t,e){let r=Rt(t),n=Rt(e);if(t===e)return{valid:!0,data:t};if(r===z.object&&n===z.object){let o=H.objectKeys(e),s=H.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=la(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===z.array&&n===z.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=la(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===z.date&&n===z.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Hr=class extends F{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,i)=>{if(ia(s)||ia(i))return M;let a=la(s.value,i.value);return a.valid?((aa(s)||aa(i))&&r.dirty(),{status:r.value,value:a.data}):(S(n,{code:x.invalid_intersection_types}),M)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>o(s,i)):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}))}};Hr.create=(t,e,r)=>new Hr({left:t,right:e,typeName:$.ZodIntersection,...q(r)});var Ot=class t extends F{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return S(n,{code:x.invalid_type,expected:z.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return S(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Xe(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Re.mergeArray(r,i)):Re.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Ot.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ot({items:t,typeName:$.ZodTuple,rest:null,...q(e)})};var da=class t extends F{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!==z.object)return S(n,{code:x.invalid_type,expected:z.object,received:n.parsedType}),M;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in n.data)o.push({key:s._parse(new Xe(n,a,n.path,a)),value:i._parse(new Xe(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Re.mergeObjectAsync(r,o):Re.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof F?new t({keyType:e,valueType:r,typeName:$.ZodRecord,...q(n)}):new t({keyType:Ur.create(),valueType:e,typeName:$.ZodRecord,...q(r)})}},Ln=class extends F{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!==z.map)return S(n,{code:x.invalid_type,expected:z.map,received:n.parsedType}),M;let o=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new Xe(n,a,n.path,[u,"key"])),value:s._parse(new Xe(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return M;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value)}return{status:r.value,value:a}}}};Ln.create=(t,e,r)=>new Ln({valueType:e,keyType:t,typeName:$.ZodMap,...q(r)});var Un=class t extends F{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return S(n,{code:x.invalid_type,expected:z.set,received:n.parsedType}),M;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(S(n,{code:x.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(S(n,{code:x.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return M;l.status==="dirty"&&r.dirty(),u.add(l.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>s._parse(new Xe(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:P.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:P.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Un.create=(t,e)=>new Un({valueType:t,minSize:null,maxSize:null,typeName:$.ZodSet,...q(e)});var fa=class t extends F{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.function)return S(r,{code:x.invalid_type,expected:z.function,received:r.parsedType}),M;function n(a,c){return Qo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Ht].filter(u=>!!u),issueData:{code:x.invalid_arguments,argumentsError:c}})}function o(a,c){return Qo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Ht].filter(u=>!!u),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof gr){let a=this;return Ce(async function(...c){let u=new Be([]),l=await a._def.args.parseAsync(c,s).catch(m=>{throw u.addIssue(n(c,m)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,s).catch(m=>{throw u.addIssue(o(d,m)),u})})}else{let a=this;return Ce(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new Be([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,s);if(!d.success)throw new Be([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:Ot.create(e).rest(Wt.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||Ot.create([]).rest(Wt.create()),returns:r||Wt.create(),typeName:$.ZodFunction,...q(n)})}},Wr=class extends F{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})}};Wr.create=(t,e)=>new Wr({getter:t,typeName:$.ZodLazy,...q(e)});var Gr=class extends F{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return S(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:e.data}}get value(){return this._def.value}};Gr.create=(t,e)=>new Gr({value:t,typeName:$.ZodLiteral,...q(e)});function mf(t,e){return new Kr({values:t,typeName:$.ZodEnum,...q(e)})}var Kr=class t extends F{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return S(r,{expected:H.joinValues(n),received:r.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return S(r,{received:r.data,code:x.invalid_enum_value,options:n}),M}return Ce(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})}};Kr.create=mf;var Jr=class extends F{_parse(e){let r=H.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let o=H.objectValues(r);return S(n,{expected:H.joinValues(o),received:n.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(H.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=H.objectValues(r);return S(n,{received:n.data,code:x.invalid_enum_value,options:o}),M}return Ce(e.data)}get enum(){return this._def.values}};Jr.create=(t,e)=>new Jr({values:t,typeName:$.ZodNativeEnum,...q(e)});var gr=class extends F{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.promise&&r.common.async===!1)return S(r,{code:x.invalid_type,expected:z.promise,received:r.parsedType}),M;let n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return Ce(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};gr.create=(t,e)=>new gr({type:t,typeName:$.ZodPromise,...q(e)});var ct=class extends F{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{S(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?qr(c.value):r.value==="dirty"?qr(c.value):c});{if(r.value==="aborted")return M;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?M:a.status==="dirty"?qr(a.value):r.value==="dirty"?qr(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);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 a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?M:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?M:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!hr(i))return M;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>hr(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:r.value,value:a})):M);H.assertNever(o)}};ct.create=(t,e,r)=>new ct({schema:t,typeName:$.ZodEffects,effect:e,...q(r)});ct.createWithPreprocess=(t,e,r)=>new ct({schema:e,effect:{type:"preprocess",transform:t},typeName:$.ZodEffects,...q(r)});var He=class extends F{_parse(e){return this._getType(e)===z.undefined?Ce(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};He.create=(t,e)=>new He({innerType:t,typeName:$.ZodOptional,...q(e)});var Nt=class extends F{_parse(e){return this._getType(e)===z.null?Ce(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Nt.create=(t,e)=>new Nt({innerType:t,typeName:$.ZodNullable,...q(e)});var Yr=class extends F{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Yr.create=(t,e)=>new Yr({innerType:t,typeName:$.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...q(e)});var Xr=class extends F{_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 Nn(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Be(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Xr.create=(t,e)=>new Xr({innerType:t,typeName:$.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...q(e)});var Fn=class extends F{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.nan,received:n.parsedType}),M}return{status:"valid",value:e.data}}};Fn.create=t=>new Fn({typeName:$.ZodNaN,...q(t)});var es=class extends F{_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}},ts=class t extends F{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?(r.dirty(),qr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?M:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:$.ZodPipeline})}},Qr=class extends F{_parse(e){let r=this._def.innerType._parse(e),n=o=>(hr(o)&&(o.value=Object.freeze(o.value)),o);return Nn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Qr.create=(t,e)=>new Qr({innerType:t,typeName:$.ZodReadonly,...q(e)});var M1={object:We.lazycreate},$;(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"})($||($={}));var rs=Ur.create,hf=Cn.create,A1=Fn.create,D1=Zn.create,q1=jn.create,L1=Mn.create,U1=An.create,F1=Fr.create,V1=Vr.create,B1=Dn.create,H1=Wt.create,W1=vt.create,G1=qn.create,K1=Gt.create,gf=We.create,J1=We.strictCreate,Y1=Br.create,X1=ua.create,Q1=Hr.create,eR=Ot.create,tR=da.create,rR=Ln.create,nR=Un.create,oR=fa.create,sR=Wr.create,iR=Gr.create,aR=Kr.create,cR=Jr.create,uR=gr.create,lR=ct.create,dR=He.create,fR=Nt.create,pR=ct.createWithPreprocess,mR=ts.create;var Hv=Object.freeze({status:"aborted"});function y(t,e,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(let l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var Ct=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ns={};function Ge(t){return t&&Object.assign(ns,t),ns}var W={};uf(W,{BIGINT_FORMAT_RANGES:()=>yf,Class:()=>ma,NUMBER_FORMAT_RANGES:()=>xa,aborted:()=>yr,allowsEval:()=>ya,assert:()=>Yv,assertEqual:()=>Wv,assertIs:()=>Kv,assertNever:()=>Jv,assertNotEqual:()=>Gv,assignProp:()=>_a,cached:()=>Hn,captureStackTrace:()=>ss,cleanEnum:()=>lb,cleanRegex:()=>Gn,clone:()=>Ke,createTransparentProxy:()=>nb,defineLazy:()=>oe,esc:()=>_r,escapeRegex:()=>Kt,extend:()=>ib,finalizeIssue:()=>ut,floatSafeRemainder:()=>ga,getElementAtPath:()=>Xv,getEnumValues:()=>Bn,getLengthableOrigin:()=>Kn,getParsedType:()=>rb,getSizableOrigin:()=>vf,isObject:()=>en,isPlainObject:()=>tn,issue:()=>wa,joinValues:()=>os,jsonStringifyReplacer:()=>ha,merge:()=>ab,normalizeParams:()=>Z,nullish:()=>Wn,numKeys:()=>tb,omit:()=>sb,optionalKeys:()=>ba,partial:()=>cb,pick:()=>ob,prefixIssues:()=>bt,primitiveTypes:()=>_f,promiseAllObject:()=>Qv,propertyKeyTypes:()=>va,randomString:()=>eb,required:()=>ub,stringifyPrimitive:()=>is,unwrapMessage:()=>Vn});function Wv(t){return t}function Gv(t){return t}function Kv(t){}function Jv(t){throw new Error}function Yv(t){}function Bn(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 os(t,e="|"){return t.map(r=>is(r)).join(e)}function ha(t,e){return typeof e=="bigint"?e.toString():e}function Hn(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Wn(t){return t==null}function Gn(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function ga(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}function oe(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function _a(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Xv(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Qv(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function eb(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function _r(t){return JSON.stringify(t)}var ss=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function en(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var ya=Hn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function tn(t){if(en(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(en(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function tb(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var rb=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}`)}},va=new Set(["string","number","symbol"]),_f=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Kt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ke(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function Z(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function nb(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},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 is(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function ba(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var xa={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]},yf={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ob(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return Ke(t,{...t._zod.def,shape:r,checks:[]})}function sb(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return Ke(t,{...t._zod.def,shape:r,checks:[]})}function ib(t,e){if(!tn(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return _a(this,"shape",n),n},checks:[]};return Ke(t,r)}function ab(t,e){return Ke(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return _a(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function cb(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)o[s]=t?new t({type:"optional",innerType:n[s]}):n[s];return Ke(e,{...e._zod.def,shape:o,checks:[]})}function ub(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return Ke(e,{...e._zod.def,shape:o,checks:[]})}function yr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function bt(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Vn(t){return typeof t=="string"?t:t?.message}function ut(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Vn(t.inst?._zod.def?.error?.(t))??Vn(e?.error?.(t))??Vn(r.customError?.(t))??Vn(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function vf(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Kn(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function wa(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function lb(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var ma=class{constructor(...e){}};var bf=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,ha,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},as=y("$ZodError",bf),Jn=y("$ZodError",bf,{Parent:Error});function $a(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 ka(t,e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(t),n}var Sa=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Ct;if(i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>ut(c,s,Ge())));throw ss(a,o?.callee),a}return i.value},za=Sa(Jn),Ea=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>ut(c,s,Ge())));throw ss(a,o?.callee),a}return i.value},Ta=Ea(Jn),Pa=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ct;return s.issues.length?{success:!1,error:new(t??as)(s.issues.map(i=>ut(i,o,Ge())))}:{success:!0,data:s.value}},vr=Pa(Jn),Ra=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>ut(i,o,Ge())))}:{success:!0,data:s.value}},br=Ra(Jn);var xf=/^[cC][^\s-]{8,}$/,wf=/^[0-9a-z]+$/,$f=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,kf=/^[0-9a-vA-V]{20}$/,Sf=/^[A-Za-z0-9]{27}$/,zf=/^[a-zA-Z0-9_-]{21}$/,Ef=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Tf=/^([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})$/,Ia=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)$/;var Pf=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var fb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rf(){return new RegExp(fb,"u")}var If=/^(?:(?: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])$/,Of=/^(([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})$/,Nf=/^((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])$/,Cf=/^(([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])$/,Zf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Oa=/^[A-Za-z0-9_-]*$/,jf=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Mf=/^\+(?:[0-9]){6,14}[0-9]$/,Af="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Df=new RegExp(`^${Af}$`);function qf(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 Lf(t){return new RegExp(`^${qf(t)}$`)}function Uf(t){let e=qf({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Af}T(?:${n})$`)}var Ff=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var Vf=/^\d+$/,Bf=/^-?\d+(?:\.\d+)?/i,Hf=/true|false/i,Wf=/null/i;var Gf=/^[^A-Z]*$/,Kf=/^[^a-z]*$/;var we=y("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Jf={number:"number",bigint:"bigint",object:"date"},Na=y("$ZodCheckLessThan",(t,e)=>{we.init(t,e);let r=Jf[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(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})}}),Ca=y("$ZodCheckGreaterThan",(t,e)=>{we.init(t,e);let r=Jf[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(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})}}),Yf=y("$ZodCheckMultipleOf",(t,e)=>{we.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):ga(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})}}),Xf=y("$ZodCheckNumberFormat",(t,e)=>{we.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=xa[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=o,a.maximum=s,r&&(a.pattern=Vf)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):i.issues.push({input:a,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}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:t})}});var Qf=y("$ZodCheckMaxLength",(t,e)=>{var r;we.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Wn(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 i=Kn(o);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),ep=y("$ZodCheckMinLength",(t,e)=>{var r;we.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Wn(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 i=Kn(o);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),tp=y("$ZodCheckLengthEquals",(t,e)=>{var r;we.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Wn(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,s=o.length;if(s===e.length)return;let i=Kn(o),a=s>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Yn=y("$ZodCheckStringFormat",(t,e)=>{var r,n;we.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.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=()=>{})}),rp=y("$ZodCheckRegex",(t,e)=>{Yn.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})}}),np=y("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Gf),Yn.init(t,e)}),op=y("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Kf),Yn.init(t,e)}),sp=y("$ZodCheckIncludes",(t,e)=>{we.init(t,e);let r=Kt(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),ip=y("$ZodCheckStartsWith",(t,e)=>{we.init(t,e);let r=new RegExp(`^${Kt(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})}}),ap=y("$ZodCheckEndsWith",(t,e)=>{we.init(t,e);let r=new RegExp(`.*${Kt(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})}});var cp=y("$ZodCheckOverwrite",(t,e)=>{we.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var us=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(`
|
|
16
|
+
`+r)}function Ar(t,e,r,n,o,s){if(t.listenerCount("wsClientError")){let i=new Error(o);Error.captureStackTrace(i,Ar),t.emit("wsClientError",i,r,e)}else Xo(r,n,o,s)}});var H;(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s})(H||(H={}));var ff;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ff||(ff={}));var z=H.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),It=t=>{switch(typeof t){case"undefined":return z.undefined;case"string":return z.string;case"number":return Number.isNaN(t)?z.nan:z.number;case"boolean":return z.boolean;case"function":return z.function;case"bigint":return z.bigint;case"symbol":return z.symbol;case"object":return Array.isArray(t)?z.array:t===null?z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?z.promise:typeof Map<"u"&&t instanceof Map?z.map:typeof Set<"u"&&t instanceof Set?z.set:typeof Date<"u"&&t instanceof Date?z.date:z.object;default:return z.unknown}};var x=H.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 He=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(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[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,H.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o))}else n.push(e(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};He.create=t=>new He(t);var Sv=(t,e)=>{let r;switch(t.code){case x.invalid_type:t.received===z.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case x.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,H.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:r=`Unrecognized key(s) in object: ${H.joinValues(t.keys,", ")}`;break;case x.invalid_union:r="Invalid input";break;case x.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${H.joinValues(t.options)}`;break;case x.invalid_enum_value:r=`Invalid enum value. Expected ${H.joinValues(t.options)}, received '${t.received}'`;break;case x.invalid_arguments:r="Invalid function arguments";break;case x.invalid_return_type:r="Invalid function return type";break;case x.invalid_date:r="Invalid date";break;case x.invalid_string:typeof 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}"`:H.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case x.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 x.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 x.custom:r="Invalid input";break;case x.invalid_intersection_types:r="Intersection results could not be merged";break;case x.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case x.not_finite:r="Number must be finite";break;default:r=e.defaultError,H.assertNever(t)}return{message:r}},Ht=Sv;var zv=Ht;function On(){return zv}var Qo=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return{...o,path:s,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return{...o,path:s,message:a}};function S(t,e){let r=On(),n=Qo({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ht?void 0:Ht].filter(o=>!!o)});t.common.issues.push(n)}var Ie=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return M;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,i=await o.value;n.push({key:s,value:i})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return M;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},M=Object.freeze({status:"aborted"}),qr=t=>({status:"dirty",value:t}),Ze=t=>({status:"valid",value:t}),ia=t=>t.status==="aborted",aa=t=>t.status==="dirty",hr=t=>t.status==="valid",Nn=t=>typeof Promise<"u"&&t instanceof Promise;var P;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(P||(P={}));var Qe=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}},pf=(t,e)=>{if(hr(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 He(t.common.issues);return this._error=r,this._error}}};function q(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:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}var F=class{get description(){return this._def.description}_getType(e){return It(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:It(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ie,ctx:{common:e.parent.common,data:e.data,parsedType:It(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Nn(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:It(e)},o=this._parseSync({data:e,path:n.path,parent:n});return pf(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:It(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return hr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>hr(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:It(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(Nn(o)?o:Promise.resolve(o));return pf(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:x.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(a(),!1)):i?!0:(a(),!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 ut({schema:this,typeName:$.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 We.create(this,this._def)}nullable(){return Ct.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Gt.create(this)}promise(){return gr.create(this,this._def)}or(e){return Br.create([this,e],this._def)}and(e){return Hr.create(this,e,this._def)}transform(e){return new ut({...q(this._def),schema:this,typeName:$.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Yr({...q(this._def),innerType:this,defaultValue:r,typeName:$.ZodDefault})}brand(){return new es({typeName:$.ZodBranded,type:this,...q(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Xr({...q(this._def),innerType:this,catchValue:r,typeName:$.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ts.create(this,e)}readonly(){return Qr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ev=/^c[^\s-]{8,}$/i,Tv=/^[0-9a-z]+$/,Pv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rv=/^[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,Iv=/^[a-z0-9_-]{21}$/i,Ov=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nv=/^[-+]?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)?)??$/,Cv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ca,jv=/^(?:(?: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])$/,Mv=/^(?:(?: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])$/,Av=/^(([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]))$/,Dv=/^(([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])$/,qv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Lv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mf="((\\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])))",Uv=new RegExp(`^${mf}$`);function hf(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 Fv(t){return new RegExp(`^${hf(t)}$`)}function Vv(t){let e=`${mf}T${hf(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 Bv(t,e){return!!((e==="v4"||!e)&&jv.test(t)||(e==="v6"||!e)&&Av.test(t))}function Hv(t,e){if(!Ov.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 Wv(t,e){return!!((e==="v4"||!e)&&Mv.test(t)||(e==="v6"||!e)&&Dv.test(t))}var Ur=class t extends F{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return S(s,{code:x.invalid_type,expected:z.string,received:s.parsedType}),M}let n=new Ie,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?S(o,{code:x.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&S(o,{code:x.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Cv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"email",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")ca||(ca=new RegExp(Zv,"u")),ca.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"emoji",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Rv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"uuid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Iv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"nanoid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Ev.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"cuid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Tv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"cuid2",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Pv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"ulid",code:x.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),S(o,{validation:"url",code:x.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"regex",code:x.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Vv(s).test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Uv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Fv(s).test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{code:x.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Nv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"duration",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Bv(e.data,s.version)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"ip",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Hv(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"jwt",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Wv(e.data,s.version)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"cidr",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?qv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"base64",code:x.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Lv.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"base64url",code:x.invalid_string,message:s.message}),n.dirty()):H.assertNever(s);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:x.invalid_string,...P.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...P.errToObj(e)})}url(e){return this._addCheck({kind:"url",...P.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...P.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...P.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...P.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...P.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...P.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...P.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...P.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...P.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...P.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...P.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...P.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,...P.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,...P.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...P.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...P.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...P.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...P.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...P.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...P.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...P.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...P.errToObj(r)})}nonempty(e){return this.min(1,P.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}};Ur.create=t=>new Ur({checks:[],typeName:$.ZodString,coerce:t?.coerce??!1,...q(t)});function Gv(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}var Cn=class t extends F{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)!==z.number){let s=this._getOrReturnCtx(e);return S(s,{code:x.invalid_type,expected:z.number,received:s.parsedType}),M}let n,o=new Ie;for(let s of this._def.checks)s.kind==="int"?H.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:x.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),o.dirty()):s.kind==="multipleOf"?Gv(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:x.not_finite,message:s.message}),o.dirty()):H.assertNever(s);return{status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,P.toString(r))}gt(e,r){return this.setLimit("min",e,!1,P.toString(r))}lte(e,r){return this.setLimit("max",e,!0,P.toString(r))}lt(e,r){return this.setLimit("max",e,!1,P.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:P.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:P.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:P.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:P.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:P.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:P.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:P.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:P.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:P.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:P.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"&&H.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)}};Cn.create=t=>new Cn({checks:[],typeName:$.ZodNumber,coerce:t?.coerce||!1,...q(t)});var Zn=class t extends F{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)!==z.bigint)return this._getInvalidInput(e);let n,o=new Ie;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),S(n,{code:x.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):H.assertNever(s);return{status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return S(r,{code:x.invalid_type,expected:z.bigint,received:r.parsedType}),M}gte(e,r){return this.setLimit("min",e,!0,P.toString(r))}gt(e,r){return this.setLimit("min",e,!1,P.toString(r))}lte(e,r){return this.setLimit("max",e,!0,P.toString(r))}lt(e,r){return this.setLimit("max",e,!1,P.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:P.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:P.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:P.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:P.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:P.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:P.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}};Zn.create=t=>new Zn({checks:[],typeName:$.ZodBigInt,coerce:t?.coerce??!1,...q(t)});var jn=class extends F{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.boolean,received:n.parsedType}),M}return Ze(e.data)}};jn.create=t=>new jn({typeName:$.ZodBoolean,coerce:t?.coerce||!1,...q(t)});var Mn=class t extends F{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return S(s,{code:x.invalid_type,expected:z.date,received:s.parsedType}),M}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return S(s,{code:x.invalid_date}),M}let n=new Ie,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:x.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:x.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):H.assertNever(s);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:P.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:P.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}};Mn.create=t=>new Mn({checks:[],coerce:t?.coerce||!1,typeName:$.ZodDate,...q(t)});var An=class extends F{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.symbol,received:n.parsedType}),M}return Ze(e.data)}};An.create=t=>new An({typeName:$.ZodSymbol,...q(t)});var Fr=class extends F{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.undefined,received:n.parsedType}),M}return Ze(e.data)}};Fr.create=t=>new Fr({typeName:$.ZodUndefined,...q(t)});var Vr=class extends F{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.null,received:n.parsedType}),M}return Ze(e.data)}};Vr.create=t=>new Vr({typeName:$.ZodNull,...q(t)});var Dn=class extends F{constructor(){super(...arguments),this._any=!0}_parse(e){return Ze(e.data)}};Dn.create=t=>new Dn({typeName:$.ZodAny,...q(t)});var Wt=class extends F{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ze(e.data)}};Wt.create=t=>new Wt({typeName:$.ZodUnknown,...q(t)});var bt=class extends F{_parse(e){let r=this._getOrReturnCtx(e);return S(r,{code:x.invalid_type,expected:z.never,received:r.parsedType}),M}};bt.create=t=>new bt({typeName:$.ZodNever,...q(t)});var qn=class extends F{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.void,received:n.parsedType}),M}return Ze(e.data)}};qn.create=t=>new qn({typeName:$.ZodVoid,...q(t)});var Gt=class t extends F{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==z.array)return S(r,{code:x.invalid_type,expected:z.array,received:r.parsedType}),M;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(i||a)&&(S(r,{code:i?x.too_big:x.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(S(r,{code:x.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(S(r,{code:x.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>o.type._parseAsync(new Qe(r,i,r.path,a)))).then(i=>Ie.mergeArray(n,i));let s=[...r.data].map((i,a)=>o.type._parseSync(new Qe(r,i,r.path,a)));return Ie.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:P.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:P.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:P.toString(r)}})}nonempty(e){return this.min(1,e)}};Gt.create=(t,e)=>new Gt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...q(e)});function Lr(t){if(t instanceof Ge){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=We.create(Lr(n))}return new Ge({...t._def,shape:()=>e})}else return t instanceof Gt?new Gt({...t._def,type:Lr(t.element)}):t instanceof We?We.create(Lr(t.unwrap())):t instanceof Ct?Ct.create(Lr(t.unwrap())):t instanceof Nt?Nt.create(t.items.map(e=>Lr(e))):t}var Ge=class t extends F{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=H.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==z.object){let u=this._getOrReturnCtx(e);return S(u,{code:x.invalid_type,expected:z.object,received:u.parsedType}),M}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof bt&&this._def.unknownKeys==="strip"))for(let u in o.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let d=s[u],l=o.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Qe(o,l,o.path,u)),alwaysSet:u in o.data})}if(this._def.catchall instanceof bt){let u=this._def.unknownKeys;if(u==="passthrough")for(let d of a)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(u==="strict")a.length>0&&(S(o,{code:x.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let d of a){let l=o.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Qe(o,l,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let d of c){let l=await d.key,h=await d.value;u.push({key:l,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>Ie.mergeObjectSync(n,u)):Ie.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return P.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:P.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:$.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 H.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 H.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return Lr(this)}partial(e){let r={};for(let n of H.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 H.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof We;)s=s._def.innerType;r[n]=s}return new t({...this._def,shape:()=>r})}keyof(){return gf(H.objectKeys(this.shape))}};Ge.create=(t,e)=>new Ge({shape:()=>t,unknownKeys:"strip",catchall:bt.create(),typeName:$.ZodObject,...q(e)});Ge.strictCreate=(t,e)=>new Ge({shape:()=>t,unknownKeys:"strict",catchall:bt.create(),typeName:$.ZodObject,...q(e)});Ge.lazycreate=(t,e)=>new Ge({shape:t,unknownKeys:"strip",catchall:bt.create(),typeName:$.ZodObject,...q(e)});var Br=class extends F{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new He(a.ctx.common.issues));return S(r,{code:x.invalid_union,unionErrors:i}),M}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},d=c._parseSync({data:r.data,path:r.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new He(c));return S(r,{code:x.invalid_union,unionErrors:a}),M}}get options(){return this._def.options}};Br.create=(t,e)=>new Br({options:t,typeName:$.ZodUnion,...q(e)});var Ot=t=>t instanceof Wr?Ot(t.schema):t instanceof ut?Ot(t.innerType()):t instanceof Gr?[t.value]:t instanceof Kr?t.options:t instanceof Jr?H.objectValues(t.enum):t instanceof Yr?Ot(t._def.innerType):t instanceof Fr?[void 0]:t instanceof Vr?[null]:t instanceof We?[void 0,...Ot(t.unwrap())]:t instanceof Ct?[null,...Ot(t.unwrap())]:t instanceof es||t instanceof Qr?Ot(t.unwrap()):t instanceof Xr?Ot(t._def.innerType):[],ua=class t extends F{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return S(r,{code:x.invalid_type,expected:z.object,received:r.parsedType}),M;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(S(r,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),M)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let i=Ot(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s)}}return new t({typeName:$.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...q(n)})}};function la(t,e){let r=It(t),n=It(e);if(t===e)return{valid:!0,data:t};if(r===z.object&&n===z.object){let o=H.objectKeys(e),s=H.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=la(t[a],e[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===z.array&&n===z.array){if(t.length!==e.length)return{valid:!1};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=la(i,a);if(!c.valid)return{valid:!1};o.push(c.data)}return{valid:!0,data:o}}else return r===z.date&&n===z.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Hr=class extends F{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,i)=>{if(ia(s)||ia(i))return M;let a=la(s.value,i.value);return a.valid?((aa(s)||aa(i))&&r.dirty(),{status:r.value,value:a.data}):(S(n,{code:x.invalid_intersection_types}),M)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>o(s,i)):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}))}};Hr.create=(t,e,r)=>new Hr({left:t,right:e,typeName:$.ZodIntersection,...q(r)});var Nt=class t extends F{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return S(n,{code:x.invalid_type,expected:z.array,received:n.parsedType}),M;if(n.data.length<this._def.items.length)return S(n,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),M;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new Qe(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Ie.mergeArray(r,i)):Ie.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Nt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Nt({items:t,typeName:$.ZodTuple,rest:null,...q(e)})};var da=class t extends F{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!==z.object)return S(n,{code:x.invalid_type,expected:z.object,received:n.parsedType}),M;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in n.data)o.push({key:s._parse(new Qe(n,a,n.path,a)),value:i._parse(new Qe(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Ie.mergeObjectAsync(r,o):Ie.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof F?new t({keyType:e,valueType:r,typeName:$.ZodRecord,...q(n)}):new t({keyType:Ur.create(),valueType:e,typeName:$.ZodRecord,...q(r)})}},Ln=class extends F{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!==z.map)return S(n,{code:x.invalid_type,expected:z.map,received:n.parsedType}),M;let o=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new Qe(n,a,n.path,[u,"key"])),value:s._parse(new Qe(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return M;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let c of i){let u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return M;(u.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(u.value,d.value)}return{status:r.value,value:a}}}};Ln.create=(t,e,r)=>new Ln({valueType:e,keyType:t,typeName:$.ZodMap,...q(r)});var Un=class t extends F{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return S(n,{code:x.invalid_type,expected:z.set,received:n.parsedType}),M;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(S(n,{code:x.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(S(n,{code:x.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let d of c){if(d.status==="aborted")return M;d.status==="dirty"&&r.dirty(),u.add(d.value)}return{status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>s._parse(new Qe(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:P.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:P.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Un.create=(t,e)=>new Un({valueType:t,minSize:null,maxSize:null,typeName:$.ZodSet,...q(e)});var fa=class t extends F{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.function)return S(r,{code:x.invalid_type,expected:z.function,received:r.parsedType}),M;function n(a,c){return Qo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Ht].filter(u=>!!u),issueData:{code:x.invalid_arguments,argumentsError:c}})}function o(a,c){return Qo({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,On(),Ht].filter(u=>!!u),issueData:{code:x.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof gr){let a=this;return Ze(async function(...c){let u=new He([]),d=await a._def.args.parseAsync(c,s).catch(m=>{throw u.addIssue(n(c,m)),u}),l=await Reflect.apply(i,this,d);return await a._def.returns._def.type.parseAsync(l,s).catch(m=>{throw u.addIssue(o(l,m)),u})})}else{let a=this;return Ze(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new He([n(c,u.error)]);let d=Reflect.apply(i,this,u.data),l=a._def.returns.safeParse(d,s);if(!l.success)throw new He([o(d,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Nt.create(e).rest(Wt.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||Nt.create([]).rest(Wt.create()),returns:r||Wt.create(),typeName:$.ZodFunction,...q(n)})}},Wr=class extends F{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})}};Wr.create=(t,e)=>new Wr({getter:t,typeName:$.ZodLazy,...q(e)});var Gr=class extends F{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return S(r,{received:r.data,code:x.invalid_literal,expected:this._def.value}),M}return{status:"valid",value:e.data}}get value(){return this._def.value}};Gr.create=(t,e)=>new Gr({value:t,typeName:$.ZodLiteral,...q(e)});function gf(t,e){return new Kr({values:t,typeName:$.ZodEnum,...q(e)})}var Kr=class t extends F{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return S(r,{expected:H.joinValues(n),received:r.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return S(r,{received:r.data,code:x.invalid_enum_value,options:n}),M}return Ze(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})}};Kr.create=gf;var Jr=class extends F{_parse(e){let r=H.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let o=H.objectValues(r);return S(n,{expected:H.joinValues(o),received:n.parsedType,code:x.invalid_type}),M}if(this._cache||(this._cache=new Set(H.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=H.objectValues(r);return S(n,{received:n.data,code:x.invalid_enum_value,options:o}),M}return Ze(e.data)}get enum(){return this._def.values}};Jr.create=(t,e)=>new Jr({values:t,typeName:$.ZodNativeEnum,...q(e)});var gr=class extends F{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.promise&&r.common.async===!1)return S(r,{code:x.invalid_type,expected:z.promise,received:r.parsedType}),M;let n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return Ze(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};gr.create=(t,e)=>new gr({type:t,typeName:$.ZodPromise,...q(e)});var ut=class extends F{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{S(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return M;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?M:c.status==="dirty"?qr(c.value):r.value==="dirty"?qr(c.value):c});{if(r.value==="aborted")return M;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?M:a.status==="dirty"?qr(a.value):r.value==="dirty"?qr(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);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 a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?M:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?M:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!hr(i))return M;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>hr(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:r.value,value:a})):M);H.assertNever(o)}};ut.create=(t,e,r)=>new ut({schema:t,typeName:$.ZodEffects,effect:e,...q(r)});ut.createWithPreprocess=(t,e,r)=>new ut({schema:e,effect:{type:"preprocess",transform:t},typeName:$.ZodEffects,...q(r)});var We=class extends F{_parse(e){return this._getType(e)===z.undefined?Ze(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};We.create=(t,e)=>new We({innerType:t,typeName:$.ZodOptional,...q(e)});var Ct=class extends F{_parse(e){return this._getType(e)===z.null?Ze(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ct.create=(t,e)=>new Ct({innerType:t,typeName:$.ZodNullable,...q(e)});var Yr=class extends F{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Yr.create=(t,e)=>new Yr({innerType:t,typeName:$.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...q(e)});var Xr=class extends F{_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 Nn(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new He(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new He(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Xr.create=(t,e)=>new Xr({innerType:t,typeName:$.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...q(e)});var Fn=class extends F{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return S(n,{code:x.invalid_type,expected:z.nan,received:n.parsedType}),M}return{status:"valid",value:e.data}}};Fn.create=t=>new Fn({typeName:$.ZodNaN,...q(t)});var es=class extends F{_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}},ts=class t extends F{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?M:s.status==="dirty"?(r.dirty(),qr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?M:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:$.ZodPipeline})}},Qr=class extends F{_parse(e){let r=this._def.innerType._parse(e),n=o=>(hr(o)&&(o.value=Object.freeze(o.value)),o);return Nn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Qr.create=(t,e)=>new Qr({innerType:t,typeName:$.ZodReadonly,...q(e)});var q1={object:Ge.lazycreate},$;(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"})($||($={}));var rs=Ur.create,_f=Cn.create,L1=Fn.create,U1=Zn.create,F1=jn.create,V1=Mn.create,B1=An.create,H1=Fr.create,W1=Vr.create,G1=Dn.create,K1=Wt.create,J1=bt.create,Y1=qn.create,X1=Gt.create,yf=Ge.create,Q1=Ge.strictCreate,eR=Br.create,tR=ua.create,rR=Hr.create,nR=Nt.create,oR=da.create,sR=Ln.create,iR=Un.create,aR=fa.create,cR=Wr.create,uR=Gr.create,lR=Kr.create,dR=Jr.create,fR=gr.create,pR=ut.create,mR=We.create,hR=Ct.create,gR=ut.createWithPreprocess,_R=ts.create;var Kv=Object.freeze({status:"aborted"});function y(t,e,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(let d in i.prototype)d in a||Object.defineProperty(a,d,{value:i.prototype[d].bind(a)});a._zod.constr=i,a._zod.def=c}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var Zt=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ns={};function Ke(t){return t&&Object.assign(ns,t),ns}var W={};df(W,{BIGINT_FORMAT_RANGES:()=>bf,Class:()=>ma,NUMBER_FORMAT_RANGES:()=>xa,aborted:()=>yr,allowsEval:()=>ya,assert:()=>eb,assertEqual:()=>Jv,assertIs:()=>Xv,assertNever:()=>Qv,assertNotEqual:()=>Yv,assignProp:()=>_a,cached:()=>Hn,captureStackTrace:()=>ss,cleanEnum:()=>pb,cleanRegex:()=>Gn,clone:()=>Je,createTransparentProxy:()=>ib,defineLazy:()=>oe,esc:()=>_r,escapeRegex:()=>Kt,extend:()=>ub,finalizeIssue:()=>lt,floatSafeRemainder:()=>ga,getElementAtPath:()=>tb,getEnumValues:()=>Bn,getLengthableOrigin:()=>Kn,getParsedType:()=>sb,getSizableOrigin:()=>xf,isObject:()=>en,isPlainObject:()=>tn,issue:()=>wa,joinValues:()=>os,jsonStringifyReplacer:()=>ha,merge:()=>lb,normalizeParams:()=>j,nullish:()=>Wn,numKeys:()=>ob,omit:()=>cb,optionalKeys:()=>ba,partial:()=>db,pick:()=>ab,prefixIssues:()=>xt,primitiveTypes:()=>vf,promiseAllObject:()=>rb,propertyKeyTypes:()=>va,randomString:()=>nb,required:()=>fb,stringifyPrimitive:()=>is,unwrapMessage:()=>Vn});function Jv(t){return t}function Yv(t){return t}function Xv(t){}function Qv(t){throw new Error}function eb(t){}function Bn(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 os(t,e="|"){return t.map(r=>is(r)).join(e)}function ha(t,e){return typeof e=="bigint"?e.toString():e}function Hn(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Wn(t){return t==null}function Gn(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function ga(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}function oe(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}throw new Error("cached value already set")},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function _a(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function tb(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function rb(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function nb(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function _r(t){return JSON.stringify(t)}var ss=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};function en(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var ya=Hn(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function tn(t){if(en(t)===!1)return!1;let e=t.constructor;if(e===void 0)return!0;let r=e.prototype;return!(en(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ob(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var sb=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}`)}},va=new Set(["string","number","symbol"]),vf=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Kt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Je(t,e,r){let n=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(n._zod.parent=t),n}function j(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 ib(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},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 is(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function ba(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var xa={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]},bf={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ab(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o])}return Je(t,{...t._zod.def,shape:r,checks:[]})}function cb(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o]}return Je(t,{...t._zod.def,shape:r,checks:[]})}function ub(t,e){if(!tn(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return _a(this,"shape",n),n},checks:[]};return Je(t,r)}function lb(t,e){return Je(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return _a(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function db(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:n[s]}):n[s])}else for(let s in n)o[s]=t?new t({type:"optional",innerType:n[s]}):n[s];return Je(e,{...e._zod.def,shape:o,checks:[]})}function fb(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return Je(e,{...e._zod.def,shape:o,checks:[]})}function yr(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function xt(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function Vn(t){return typeof t=="string"?t:t?.message}function lt(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=Vn(t.inst?._zod.def?.error?.(t))??Vn(e?.error?.(t))??Vn(r.customError?.(t))??Vn(r.localeError?.(t))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function xf(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Kn(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function wa(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function pb(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var ma=class{constructor(...e){}};var wf=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,ha,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},as=y("$ZodError",wf),Jn=y("$ZodError",wf,{Parent:Error});function $a(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 ka(t,e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else{let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++}}};return o(t),n}var Sa=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:!1}):{async:!1},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Zt;if(i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>lt(c,s,Ke())));throw ss(a,o?.callee),a}return i.value},za=Sa(Jn),Ea=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:!0}):{async:!0},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>lt(c,s,Ke())));throw ss(a,o?.callee),a}return i.value},Ta=Ea(Jn),Pa=t=>(e,r,n)=>{let o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Zt;return s.issues.length?{success:!1,error:new(t??as)(s.issues.map(i=>lt(i,o,Ke())))}:{success:!0,data:s.value}},vr=Pa(Jn),Ra=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>lt(i,o,Ke())))}:{success:!0,data:s.value}},br=Ra(Jn);var $f=/^[cC][^\s-]{8,}$/,kf=/^[0-9a-z]+$/,Sf=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,zf=/^[0-9a-vA-V]{20}$/,Ef=/^[A-Za-z0-9]{27}$/,Tf=/^[a-zA-Z0-9_-]{21}$/,Pf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Rf=/^([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})$/,Ia=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)$/;var If=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var hb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Of(){return new RegExp(hb,"u")}var Nf=/^(?:(?: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])$/,Cf=/^(([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})$/,Zf=/^((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])$/,jf=/^(([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])$/,Mf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Oa=/^[A-Za-z0-9_-]*$/,Af=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Df=/^\+(?:[0-9]){6,14}[0-9]$/,qf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Lf=new RegExp(`^${qf}$`);function Uf(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 Ff(t){return new RegExp(`^${Uf(t)}$`)}function Vf(t){let e=Uf({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${qf}T(?:${n})$`)}var Bf=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var Hf=/^\d+$/,Wf=/^-?\d+(?:\.\d+)?/i,Gf=/true|false/i,Kf=/null/i;var Jf=/^[^A-Z]*$/,Yf=/^[^a-z]*$/;var $e=y("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),Xf={number:"number",bigint:"bigint",object:"date"},Na=y("$ZodCheckLessThan",(t,e)=>{$e.init(t,e);let r=Xf[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(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})}}),Ca=y("$ZodCheckGreaterThan",(t,e)=>{$e.init(t,e);let r=Xf[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(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})}}),Qf=y("$ZodCheckMultipleOf",(t,e)=>{$e.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):ga(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})}}),ep=y("$ZodCheckNumberFormat",(t,e)=>{$e.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=xa[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=o,a.maximum=s,r&&(a.pattern=Hf)}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):i.issues.push({input:a,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}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:t})}});var tp=y("$ZodCheckMaxLength",(t,e)=>{var r;$e.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Wn(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 i=Kn(o);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),rp=y("$ZodCheckMinLength",(t,e)=>{var r;$e.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Wn(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 i=Kn(o);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),np=y("$ZodCheckLengthEquals",(t,e)=>{var r;$e.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return!Wn(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,s=o.length;if(s===e.length)return;let i=Kn(o),a=s>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),Yn=y("$ZodCheckStringFormat",(t,e)=>{var r,n;$e.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.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=()=>{})}),op=y("$ZodCheckRegex",(t,e)=>{Yn.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})}}),sp=y("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Jf),Yn.init(t,e)}),ip=y("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Yf),Yn.init(t,e)}),ap=y("$ZodCheckIncludes",(t,e)=>{$e.init(t,e);let r=Kt(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),cp=y("$ZodCheckStartsWith",(t,e)=>{$e.init(t,e);let r=new RegExp(`^${Kt(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})}}),up=y("$ZodCheckEndsWith",(t,e)=>{$e.init(t,e);let r=new RegExp(`.*${Kt(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})}});var lp=y("$ZodCheckOverwrite",(t,e)=>{$e.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});var us=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(`
|
|
17
17
|
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,o.join(`
|
|
18
|
-
`))}};var
|
|
18
|
+
`))}};var fp={major:4,minor:0,patch:0};var te=y("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=fp;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(s,i,a)=>{let c=yr(s),u;for(let d of i){if(d._zod.def.when){if(!d._zod.def.when(s))continue}else if(c)continue;let l=s.issues.length,h=d._zod.check(s);if(h instanceof Promise&&a?.async===!1)throw new Zt;if(u||h instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await h,s.issues.length!==l&&(c||(c=yr(s,l)))});else{if(s.issues.length===l)continue;c||(c=yr(s,l))}}return u?u.then(()=>s):s};t._zod.run=(s,i)=>{let a=t._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new Zt;return a.then(c=>o(c,n,i))}return o(a,n,i)}}t["~standard"]={validate:o=>{try{let s=vr(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return br(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Xn=y("$ZodString",(t,e)=>{te.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Bf(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}}),se=y("$ZodStringFormat",(t,e)=>{Yn.init(t,e),Xn.init(t,e)}),ja=y("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Rf),se.init(t,e)}),Ma=y("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Ia(n))}else e.pattern??(e.pattern=Ia());se.init(t,e)}),Aa=y("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=If),se.init(t,e)}),Da=y("$ZodURL",(t,e)=>{se.init(t,e),t._zod.check=r=>{try{let n=r.value,o=new URL(n),s=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Af.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})),!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),qa=y("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Of()),se.init(t,e)}),La=y("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Tf),se.init(t,e)}),Ua=y("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=$f),se.init(t,e)}),Fa=y("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=kf),se.init(t,e)}),Va=y("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Sf),se.init(t,e)}),Ba=y("$ZodXID",(t,e)=>{e.pattern??(e.pattern=zf),se.init(t,e)}),Ha=y("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Ef),se.init(t,e)}),wp=y("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Vf(e)),se.init(t,e)}),$p=y("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Lf),se.init(t,e)}),kp=y("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Ff(e)),se.init(t,e)}),Sp=y("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Pf),se.init(t,e)}),Wa=y("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Nf),se.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4"})}),Ga=y("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Cf),se.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.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})}}}),Ka=y("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Zf),se.init(t,e)}),Ja=y("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=jf),se.init(t,e),t._zod.check=r=>{let[n,o]=r.value.split("/");try{if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function zp(t){if(t==="")return!0;if(t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Ya=y("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Mf),se.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),t._zod.check=r=>{zp(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function gb(t){if(!Oa.test(t))return!1;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return zp(r)}var Xa=y("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Oa),se.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),t._zod.check=r=>{gb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Qa=y("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Df),se.init(t,e)});function _b(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 ec=y("$ZodJWT",(t,e)=>{se.init(t,e),t._zod.check=r=>{_b(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}});var ds=y("$ZodNumber",(t,e)=>{te.init(t,e),t._zod.pattern=t._zod.bag.pattern??Wf,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 s=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,...s?{received:s}:{}}),r}}),tc=y("$ZodNumber",(t,e)=>{ep.init(t,e),ds.init(t,e)}),rc=y("$ZodBoolean",(t,e)=>{te.init(t,e),t._zod.pattern=Gf,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}});var nc=y("$ZodNull",(t,e)=>{te.init(t,e),t._zod.pattern=Kf,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}});var oc=y("$ZodUnknown",(t,e)=>{te.init(t,e),t._zod.parse=r=>r}),sc=y("$ZodNever",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function pp(t,e,r){t.issues.length&&e.issues.push(...xt(r,t.issues)),e.value[r]=t.value}var ic=y("$ZodArray",(t,e)=>{te.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 s=[];for(let i=0;i<o.length;i++){let a=o[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>pp(u,r,i))):pp(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function ls(t,e,r){t.issues.length&&e.issues.push(...xt(r,t.issues)),e.value[r]=t.value}function mp(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...xt(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value}var fs=y("$ZodObject",(t,e)=>{te.init(t,e);let r=Hn(()=>{let l=Object.keys(e.shape);for(let m of l)if(!(e.shape[m]instanceof te))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);let h=ba(e.shape);return{shape:e.shape,keys:l,keySet:new Set(l),numKeys:l.length,optionalKeys:new Set(h)}});oe(t._zod,"propValues",()=>{let l=e.shape,h={};for(let m in l){let f=l[m]._zod;if(f.values){h[m]??(h[m]=new Set);for(let p of f.values)h[m].add(p)}}return h});let n=l=>{let h=new us(["shape","payload","ctx"]),m=r.value,f=b=>{let w=_r(b);return`shape[${w}]._zod.run({ value: input[${w}], issues: [] }, ctx)`};h.write("const input = payload.value;");let p=Object.create(null),g=0;for(let b of m.keys)p[b]=`key_${g++}`;h.write("const newResult = {}");for(let b of m.keys)if(m.optionalKeys.has(b)){let w=p[b];h.write(`const ${w} = ${f(b)};`);let E=_r(b);h.write(`
|
|
19
19
|
if (${w}.issues.length) {
|
|
20
20
|
if (input[${E}] === undefined) {
|
|
21
21
|
if (${E} in input) {
|
|
@@ -38,16 +38,16 @@ var gv=Object.create;var sa=Object.defineProperty;var _v=Object.getOwnPropertyDe
|
|
|
38
38
|
if (${w}.issues.length) payload.issues = payload.issues.concat(${w}.issues.map(iss => ({
|
|
39
39
|
...iss,
|
|
40
40
|
path: iss.path ? [${_r(b)}, ...iss.path] : [${_r(b)}]
|
|
41
|
-
})));`),h.write(`newResult[${_r(b)}] = ${w}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");let v=h.compile();return(b,w)=>v(d,b,w)},o,s=en,i=!ns.jitless,c=i&&ya.value,u=e.catchall,l;t._zod.parse=(d,h)=>{l??(l=r.value);let m=d.value;if(!s(m))return d.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),d;let f=[];if(i&&c&&h?.async===!1&&h.jitless!==!0)o||(o=n(e.shape)),d=o(d,h);else{d.value={};let w=l.shape;for(let E of l.keys){let N=w[E],ve=N._zod.run({value:m[E],issues:[]},h),Pe=N._zod.optin==="optional"&&N._zod.optout==="optional";ve instanceof Promise?f.push(ve.then(Pt=>Pe?fp(Pt,d,E,m):ls(Pt,d,E))):Pe?fp(ve,d,E,m):ls(ve,d,E)}}if(!u)return f.length?Promise.all(f).then(()=>d):d;let p=[],g=l.keySet,v=u._zod,b=v.def.type;for(let w of Object.keys(m)){if(g.has(w))continue;if(b==="never"){p.push(w);continue}let E=v.run({value:m[w],issues:[]},h);E instanceof Promise?f.push(E.then(N=>ls(N,d,w))):ls(E,d,w)}return p.length&&d.issues.push({code:"unrecognized_keys",keys:p,input:m,inst:t}),f.length?Promise.all(f).then(()=>d):d}});function pp(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>ut(s,n,Ge())))}),e}var ps=y("$ZodUnion",(t,e)=>{te.init(t,e),oe(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),oe(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),oe(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),oe(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Gn(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=!1,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>pp(i,r,t,n)):pp(s,r,t,n)}}),ac=y("$ZodDiscriminatedUnion",(t,e)=>{ps.init(t,e);let r=t._zod.parse;oe(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Hn(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!en(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),o)}}),cc=y("$ZodIntersection",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,s=e.left._zod.run({value:o,issues:[]},n),i=e.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>mp(r,c,u)):mp(r,s,i)}});function Za(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(tn(t)&&tn(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let i=Za(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.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],s=e[n],i=Za(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function mp(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),yr(t))return t;let n=Za(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 uc=y("$ZodRecord",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!tn(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...bt(c,l.issues)),r.value[c]=l.value})):(u.issues.length&&r.issues.push(...bt(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>ut(u,n,Ge())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...bt(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...bt(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var lc=y("$ZodEnum",(t,e)=>{te.init(t,e);let r=Bn(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>va.has(typeof n)).map(n=>typeof n=="string"?Kt(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return t._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),dc=y("$ZodLiteral",(t,e)=>{te.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Kt(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}});var fc=y("$ZodTransform",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Ct;return r.value=o,r}}),pc=y("$ZodOptional",(t,e)=>{te.init(t,e),t._zod.optin="optional",t._zod.optout="optional",oe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),oe(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Gn(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),mc=y("$ZodNullable",(t,e)=>{te.init(t,e),oe(t._zod,"optin",()=>e.innerType._zod.optin),oe(t._zod,"optout",()=>e.innerType._zod.optout),oe(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Gn(r.source)}|null)$`):void 0}),oe(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)}),hc=y("$ZodDefault",(t,e)=>{te.init(t,e),t._zod.optin="optional",oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(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(s=>hp(s,e)):hp(o,e)}});function hp(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var gc=y("$ZodPrefault",(t,e)=>{te.init(t,e),t._zod.optin="optional",oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),_c=y("$ZodNonOptional",(t,e)=>{te.init(t,e),oe(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(s=>gp(s,t)):gp(o,t)}});function gp(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 yc=y("$ZodCatch",(t,e)=>{te.init(t,e),t._zod.optin="optional",oe(t._zod,"optout",()=>e.innerType._zod.optout),oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>ut(i,n,Ge()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>ut(s,n,Ge()))},input:r.value}),r.issues=[]),r)}});var vc=y("$ZodPipe",(t,e)=>{te.init(t,e),oe(t._zod,"values",()=>e.in._zod.values),oe(t._zod,"optin",()=>e.in._zod.optin),oe(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>_p(s,e,n)):_p(o,e,n)}});function _p(t,e,r){return yr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var bc=y("$ZodReadonly",(t,e)=>{te.init(t,e),oe(t._zod,"propValues",()=>e.innerType._zod.propValues),oe(t._zod,"values",()=>e.innerType._zod.values),oe(t._zod,"optin",()=>e.innerType._zod.optin),oe(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(yp):yp(o)}});function yp(t){return t.value=Object.freeze(t.value),t}var xc=y("$ZodCustom",(t,e)=>{we.init(t,e),te.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(s=>vp(s,r,n,t));vp(o,r,n,t)}});function vp(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(wa(o))}}var hb=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},gb=()=>{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",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 ${hb(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${is(n.values[0])}`:`Invalid option: expected one of ${os(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${s.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":""}: ${os(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 Sp(){return{localeError:gb()}}var Qn=class{constructor(){this._map=new Map,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 Map,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)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function zp(){return new Qn}var Jt=zp();function wc(t,e){return new t({type:"string",...Z(e)})}function $c(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Z(e)})}function ms(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Z(e)})}function kc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(e)})}function Sc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(e)})}function zc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(e)})}function Ec(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(e)})}function Tc(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Z(e)})}function Pc(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(e)})}function Rc(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(e)})}function Ic(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(e)})}function Oc(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(e)})}function Nc(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(e)})}function Cc(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Z(e)})}function Zc(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(e)})}function jc(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(e)})}function Mc(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(e)})}function Ac(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(e)})}function Dc(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(e)})}function qc(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Z(e)})}function Lc(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(e)})}function Uc(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Z(e)})}function Fc(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(e)})}function Ep(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(e)})}function Tp(t,e){return new t({type:"string",format:"date",check:"string_format",...Z(e)})}function Pp(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Z(e)})}function Rp(t,e){return new t({type:"string",format:"duration",check:"string_format",...Z(e)})}function Vc(t,e){return new t({type:"number",checks:[],...Z(e)})}function Bc(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(e)})}function Hc(t,e){return new t({type:"boolean",...Z(e)})}function Wc(t,e){return new t({type:"null",...Z(e)})}function Gc(t){return new t({type:"unknown"})}function Kc(t,e){return new t({type:"never",...Z(e)})}function hs(t,e){return new Na({check:"less_than",...Z(e),value:t,inclusive:!1})}function eo(t,e){return new Na({check:"less_than",...Z(e),value:t,inclusive:!0})}function gs(t,e){return new Ca({check:"greater_than",...Z(e),value:t,inclusive:!1})}function to(t,e){return new Ca({check:"greater_than",...Z(e),value:t,inclusive:!0})}function _s(t,e){return new Yf({check:"multiple_of",...Z(e),value:t})}function ys(t,e){return new Qf({check:"max_length",...Z(e),maximum:t})}function rn(t,e){return new ep({check:"min_length",...Z(e),minimum:t})}function vs(t,e){return new tp({check:"length_equals",...Z(e),length:t})}function Jc(t,e){return new rp({check:"string_format",format:"regex",...Z(e),pattern:t})}function Yc(t){return new np({check:"string_format",format:"lowercase",...Z(t)})}function Xc(t){return new op({check:"string_format",format:"uppercase",...Z(t)})}function Qc(t,e){return new sp({check:"string_format",format:"includes",...Z(e),includes:t})}function eu(t,e){return new ip({check:"string_format",format:"starts_with",...Z(e),prefix:t})}function tu(t,e){return new ap({check:"string_format",format:"ends_with",...Z(e),suffix:t})}function xr(t){return new cp({check:"overwrite",tx:t})}function ru(t){return xr(e=>e.normalize(t))}function nu(){return xr(t=>t.trim())}function ou(){return xr(t=>t.toLowerCase())}function su(){return xr(t=>t.toUpperCase())}function Ip(t,e,r){return new t({type:"array",element:e,...Z(r)})}function iu(t,e,r){let n=Z(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function au(t,e,r){return new t({type:"custom",check:"custom",fn:e,...Z(r)})}var bs=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Jt,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path},h=e._zod.parent;if(h)a.ref=h,this.process(h,d),this.seen.get(h).isParent=!0;else{let m=a.schema;switch(o.type){case"string":{let f=m;f.type="string";let{minimum:p,maximum:g,format:v,patterns:b,contentEncoding:w}=e._zod.bag;if(typeof p=="number"&&(f.minLength=p),typeof g=="number"&&(f.maxLength=g),v&&(f.format=s[v]??v,f.format===""&&delete f.format),w&&(f.contentEncoding=w),b&&b.size>0){let E=[...b];E.length===1?f.pattern=E[0].source:E.length>1&&(a.schema.allOf=[...E.map(N=>({...this.target==="draft-7"?{type:"string"}:{},pattern:N.source}))])}break}case"number":{let f=m,{minimum:p,maximum:g,format:v,multipleOf:b,exclusiveMaximum:w,exclusiveMinimum:E}=e._zod.bag;typeof v=="string"&&v.includes("int")?f.type="integer":f.type="number",typeof E=="number"&&(f.exclusiveMinimum=E),typeof p=="number"&&(f.minimum=p,typeof E=="number"&&(E>=p?delete f.minimum:delete f.exclusiveMinimum)),typeof w=="number"&&(f.exclusiveMaximum=w),typeof g=="number"&&(f.maximum=g,typeof w=="number"&&(w<=g?delete f.maximum:delete f.exclusiveMaximum)),typeof b=="number"&&(f.multipleOf=b);break}case"boolean":{let f=m;f.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{m.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{m.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let f=m,{minimum:p,maximum:g}=e._zod.bag;typeof p=="number"&&(f.minItems=p),typeof g=="number"&&(f.maxItems=g),f.type="array",f.items=this.process(o.element,{...d,path:[...d.path,"items"]});break}case"object":{let f=m;f.type="object",f.properties={};let p=o.shape;for(let b in p)f.properties[b]=this.process(p[b],{...d,path:[...d.path,"properties",b]});let g=new Set(Object.keys(p)),v=new Set([...g].filter(b=>{let w=o.shape[b]._zod;return this.io==="input"?w.optin===void 0:w.optout===void 0}));v.size>0&&(f.required=Array.from(v)),o.catchall?._zod.def.type==="never"?f.additionalProperties=!1:o.catchall?o.catchall&&(f.additionalProperties=this.process(o.catchall,{...d,path:[...d.path,"additionalProperties"]})):this.io==="output"&&(f.additionalProperties=!1);break}case"union":{let f=m;f.anyOf=o.options.map((p,g)=>this.process(p,{...d,path:[...d.path,"anyOf",g]}));break}case"intersection":{let f=m,p=this.process(o.left,{...d,path:[...d.path,"allOf",0]}),g=this.process(o.right,{...d,path:[...d.path,"allOf",1]}),v=w=>"allOf"in w&&Object.keys(w).length===1,b=[...v(p)?p.allOf:[p],...v(g)?g.allOf:[g]];f.allOf=b;break}case"tuple":{let f=m;f.type="array";let p=o.items.map((b,w)=>this.process(b,{...d,path:[...d.path,"prefixItems",w]}));if(this.target==="draft-2020-12"?f.prefixItems=p:f.items=p,o.rest){let b=this.process(o.rest,{...d,path:[...d.path,"items"]});this.target==="draft-2020-12"?f.items=b:f.additionalItems=b}o.rest&&(f.items=this.process(o.rest,{...d,path:[...d.path,"items"]}));let{minimum:g,maximum:v}=e._zod.bag;typeof g=="number"&&(f.minItems=g),typeof v=="number"&&(f.maxItems=v);break}case"record":{let f=m;f.type="object",f.propertyNames=this.process(o.keyType,{...d,path:[...d.path,"propertyNames"]}),f.additionalProperties=this.process(o.valueType,{...d,path:[...d.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let f=m,p=Bn(o.entries);p.every(g=>typeof g=="number")&&(f.type="number"),p.every(g=>typeof g=="string")&&(f.type="string"),f.enum=p;break}case"literal":{let f=m,p=[];for(let g of o.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");p.push(Number(g))}else p.push(g);if(p.length!==0)if(p.length===1){let g=p[0];f.type=g===null?"null":typeof g,f.const=g}else p.every(g=>typeof g=="number")&&(f.type="number"),p.every(g=>typeof g=="string")&&(f.type="string"),p.every(g=>typeof g=="boolean")&&(f.type="string"),p.every(g=>g===null)&&(f.type="null"),f.enum=p;break}case"file":{let f=m,p={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:v,mime:b}=e._zod.bag;g!==void 0&&(p.minLength=g),v!==void 0&&(p.maxLength=v),b?b.length===1?(p.contentMediaType=b[0],Object.assign(f,p)):f.anyOf=b.map(w=>({...p,contentMediaType:w})):Object.assign(f,p);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let f=this.process(o.innerType,d);m.anyOf=[f,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"success":{let f=m;f.type="boolean";break}case"default":{this.process(o.innerType,d),a.ref=o.innerType,m.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,d),a.ref=o.innerType,this.io==="input"&&(m._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,d),a.ref=o.innerType;let f;try{f=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}m.default=f;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let f=m,p=e._zod.pattern;if(!p)throw new Error("Pattern not found in template literal");f.type="string",f.pattern=p.source;break}case"pipe":{let f=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(f,d),a.ref=f;break}case"readonly":{this.process(o.innerType,d),a.ref=o.innerType,m.readOnly=!0;break}case"promise":{this.process(o.innerType,d),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,d),a.ref=o.innerType;break}case"lazy":{let f=e._zod.innerType;this.process(f,d),a.ref=f;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&ye(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let s=l=>{let d=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let p=n.external.registry.get(l[0])?.id,g=n.external.uri??(b=>b);if(p)return{ref:g(p)};let v=l[1].defId??l[1].schema.id??`schema${this.counter++}`;return l[1].defId=v,{defId:v,ref:`${g("__shared")}#/${d}/${v}`}}if(l[1]===o)return{ref:"#"};let m=`#/${d}/`,f=l[1].schema.id??`__schema${this.counter++}`;return{defId:f,ref:m+f}},i=l=>{if(l[1].schema.$ref)return;let d=l[1],{ref:h,defId:m}=s(l);d.def={...d.schema},m&&(d.defId=m);let f=d.schema;for(let p in f)delete f[p];f.$ref=h};if(n.cycles==="throw")for(let l of this.seen.entries()){let d=l[1];if(d.cycle)throw new Error(`Cycle detected: #/${d.cycle?.join("/")}/<root>
|
|
41
|
+
})));`),h.write(`newResult[${_r(b)}] = ${w}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");let v=h.compile();return(b,w)=>v(l,b,w)},o,s=en,i=!ns.jitless,c=i&&ya.value,u=e.catchall,d;t._zod.parse=(l,h)=>{d??(d=r.value);let m=l.value;if(!s(m))return l.issues.push({expected:"object",code:"invalid_type",input:m,inst:t}),l;let f=[];if(i&&c&&h?.async===!1&&h.jitless!==!0)o||(o=n(e.shape)),l=o(l,h);else{l.value={};let w=d.shape;for(let E of d.keys){let N=w[E],ve=N._zod.run({value:m[E],issues:[]},h),Re=N._zod.optin==="optional"&&N._zod.optout==="optional";ve instanceof Promise?f.push(ve.then(Rt=>Re?mp(Rt,l,E,m):ls(Rt,l,E))):Re?mp(ve,l,E,m):ls(ve,l,E)}}if(!u)return f.length?Promise.all(f).then(()=>l):l;let p=[],g=d.keySet,v=u._zod,b=v.def.type;for(let w of Object.keys(m)){if(g.has(w))continue;if(b==="never"){p.push(w);continue}let E=v.run({value:m[w],issues:[]},h);E instanceof Promise?f.push(E.then(N=>ls(N,l,w))):ls(E,l,w)}return p.length&&l.issues.push({code:"unrecognized_keys",keys:p,input:m,inst:t}),f.length?Promise.all(f).then(()=>l):l}});function hp(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>lt(s,n,Ke())))}),e}var ps=y("$ZodUnion",(t,e)=>{te.init(t,e),oe(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),oe(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),oe(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),oe(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Gn(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=!1,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>hp(i,r,t,n)):hp(s,r,t,n)}}),ac=y("$ZodDiscriminatedUnion",(t,e)=>{ps.init(t,e);let r=t._zod.parse;oe(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let n=Hn(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!en(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),o)}}),cc=y("$ZodIntersection",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,s=e.left._zod.run({value:o,issues:[]},n),i=e.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>gp(r,c,u)):gp(r,s,i)}});function Za(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(tn(t)&&tn(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let i=Za(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.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],s=e[n],i=Za(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function gp(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),yr(t))return t;let n=Za(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 uc=y("$ZodRecord",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!tn(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(d=>{d.issues.length&&r.issues.push(...xt(c,d.issues)),r.value[c]=d.value})):(u.issues.length&&r.issues.push(...xt(c,u.issues)),r.value[c]=u.value)}let a;for(let c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:a})}else{r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>lt(u,n,Ke())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...xt(i,u.issues)),r.value[a.value]=u.value})):(c.issues.length&&r.issues.push(...xt(i,c.issues)),r.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}});var lc=y("$ZodEnum",(t,e)=>{te.init(t,e);let r=Bn(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>va.has(typeof n)).map(n=>typeof n=="string"?Kt(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return t._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n}}),dc=y("$ZodLiteral",(t,e)=>{te.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Kt(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r}});var fc=y("$ZodTransform",(t,e)=>{te.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Zt;return r.value=o,r}}),pc=y("$ZodOptional",(t,e)=>{te.init(t,e),t._zod.optin="optional",t._zod.optout="optional",oe(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),oe(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Gn(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n)}),mc=y("$ZodNullable",(t,e)=>{te.init(t,e),oe(t._zod,"optin",()=>e.innerType._zod.optin),oe(t._zod,"optout",()=>e.innerType._zod.optout),oe(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${Gn(r.source)}|null)$`):void 0}),oe(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)}),hc=y("$ZodDefault",(t,e)=>{te.init(t,e),t._zod.optin="optional",oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(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(s=>_p(s,e)):_p(o,e)}});function _p(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var gc=y("$ZodPrefault",(t,e)=>{te.init(t,e),t._zod.optin="optional",oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),_c=y("$ZodNonOptional",(t,e)=>{te.init(t,e),oe(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(s=>yp(s,t)):yp(o,t)}});function yp(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 yc=y("$ZodCatch",(t,e)=>{te.init(t,e),t._zod.optin="optional",oe(t._zod,"optout",()=>e.innerType._zod.optout),oe(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>lt(i,n,Ke()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>lt(s,n,Ke()))},input:r.value}),r.issues=[]),r)}});var vc=y("$ZodPipe",(t,e)=>{te.init(t,e),oe(t._zod,"values",()=>e.in._zod.values),oe(t._zod,"optin",()=>e.in._zod.optin),oe(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>vp(s,e,n)):vp(o,e,n)}});function vp(t,e,r){return yr(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}var bc=y("$ZodReadonly",(t,e)=>{te.init(t,e),oe(t._zod,"propValues",()=>e.innerType._zod.propValues),oe(t._zod,"values",()=>e.innerType._zod.values),oe(t._zod,"optin",()=>e.innerType._zod.optin),oe(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(bp):bp(o)}});function bp(t){return t.value=Object.freeze(t.value),t}var xc=y("$ZodCustom",(t,e)=>{$e.init(t,e),te.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(s=>xp(s,r,n,t));xp(o,r,n,t)}});function xp(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(wa(o))}}var yb=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},vb=()=>{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",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 ${yb(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${is(n.values[0])}`:`Invalid option: expected one of ${os(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${s.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":""}: ${os(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 Ep(){return{localeError:vb()}}var Qn=class{constructor(){this._map=new Map,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 Map,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)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function Tp(){return new Qn}var Jt=Tp();function wc(t,e){return new t({type:"string",...j(e)})}function $c(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...j(e)})}function ms(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...j(e)})}function kc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...j(e)})}function Sc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...j(e)})}function zc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...j(e)})}function Ec(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...j(e)})}function Tc(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...j(e)})}function Pc(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...j(e)})}function Rc(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...j(e)})}function Ic(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...j(e)})}function Oc(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...j(e)})}function Nc(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...j(e)})}function Cc(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...j(e)})}function Zc(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...j(e)})}function jc(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...j(e)})}function Mc(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...j(e)})}function Ac(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...j(e)})}function Dc(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...j(e)})}function qc(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...j(e)})}function Lc(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...j(e)})}function Uc(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...j(e)})}function Fc(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...j(e)})}function Pp(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...j(e)})}function Rp(t,e){return new t({type:"string",format:"date",check:"string_format",...j(e)})}function Ip(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...j(e)})}function Op(t,e){return new t({type:"string",format:"duration",check:"string_format",...j(e)})}function Vc(t,e){return new t({type:"number",checks:[],...j(e)})}function Bc(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...j(e)})}function Hc(t,e){return new t({type:"boolean",...j(e)})}function Wc(t,e){return new t({type:"null",...j(e)})}function Gc(t){return new t({type:"unknown"})}function Kc(t,e){return new t({type:"never",...j(e)})}function hs(t,e){return new Na({check:"less_than",...j(e),value:t,inclusive:!1})}function eo(t,e){return new Na({check:"less_than",...j(e),value:t,inclusive:!0})}function gs(t,e){return new Ca({check:"greater_than",...j(e),value:t,inclusive:!1})}function to(t,e){return new Ca({check:"greater_than",...j(e),value:t,inclusive:!0})}function _s(t,e){return new Qf({check:"multiple_of",...j(e),value:t})}function ys(t,e){return new tp({check:"max_length",...j(e),maximum:t})}function rn(t,e){return new rp({check:"min_length",...j(e),minimum:t})}function vs(t,e){return new np({check:"length_equals",...j(e),length:t})}function Jc(t,e){return new op({check:"string_format",format:"regex",...j(e),pattern:t})}function Yc(t){return new sp({check:"string_format",format:"lowercase",...j(t)})}function Xc(t){return new ip({check:"string_format",format:"uppercase",...j(t)})}function Qc(t,e){return new ap({check:"string_format",format:"includes",...j(e),includes:t})}function eu(t,e){return new cp({check:"string_format",format:"starts_with",...j(e),prefix:t})}function tu(t,e){return new up({check:"string_format",format:"ends_with",...j(e),suffix:t})}function xr(t){return new lp({check:"overwrite",tx:t})}function ru(t){return xr(e=>e.normalize(t))}function nu(){return xr(t=>t.trim())}function ou(){return xr(t=>t.toLowerCase())}function su(){return xr(t=>t.toUpperCase())}function Np(t,e,r){return new t({type:"array",element:e,...j(r)})}function iu(t,e,r){let n=j(r);return n.abort??(n.abort=!0),new t({type:"custom",check:"custom",fn:e,...n})}function au(t,e,r){return new t({type:"custom",check:"custom",fn:e,...j(r)})}var bs=class{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Jt,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,s={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};this.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path},h=e._zod.parent;if(h)a.ref=h,this.process(h,l),this.seen.get(h).isParent=!0;else{let m=a.schema;switch(o.type){case"string":{let f=m;f.type="string";let{minimum:p,maximum:g,format:v,patterns:b,contentEncoding:w}=e._zod.bag;if(typeof p=="number"&&(f.minLength=p),typeof g=="number"&&(f.maxLength=g),v&&(f.format=s[v]??v,f.format===""&&delete f.format),w&&(f.contentEncoding=w),b&&b.size>0){let E=[...b];E.length===1?f.pattern=E[0].source:E.length>1&&(a.schema.allOf=[...E.map(N=>({...this.target==="draft-7"?{type:"string"}:{},pattern:N.source}))])}break}case"number":{let f=m,{minimum:p,maximum:g,format:v,multipleOf:b,exclusiveMaximum:w,exclusiveMinimum:E}=e._zod.bag;typeof v=="string"&&v.includes("int")?f.type="integer":f.type="number",typeof E=="number"&&(f.exclusiveMinimum=E),typeof p=="number"&&(f.minimum=p,typeof E=="number"&&(E>=p?delete f.minimum:delete f.exclusiveMinimum)),typeof w=="number"&&(f.exclusiveMaximum=w),typeof g=="number"&&(f.maximum=g,typeof w=="number"&&(w<=g?delete f.maximum:delete f.exclusiveMaximum)),typeof b=="number"&&(f.multipleOf=b);break}case"boolean":{let f=m;f.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{m.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{m.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{let f=m,{minimum:p,maximum:g}=e._zod.bag;typeof p=="number"&&(f.minItems=p),typeof g=="number"&&(f.maxItems=g),f.type="array",f.items=this.process(o.element,{...l,path:[...l.path,"items"]});break}case"object":{let f=m;f.type="object",f.properties={};let p=o.shape;for(let b in p)f.properties[b]=this.process(p[b],{...l,path:[...l.path,"properties",b]});let g=new Set(Object.keys(p)),v=new Set([...g].filter(b=>{let w=o.shape[b]._zod;return this.io==="input"?w.optin===void 0:w.optout===void 0}));v.size>0&&(f.required=Array.from(v)),o.catchall?._zod.def.type==="never"?f.additionalProperties=!1:o.catchall?o.catchall&&(f.additionalProperties=this.process(o.catchall,{...l,path:[...l.path,"additionalProperties"]})):this.io==="output"&&(f.additionalProperties=!1);break}case"union":{let f=m;f.anyOf=o.options.map((p,g)=>this.process(p,{...l,path:[...l.path,"anyOf",g]}));break}case"intersection":{let f=m,p=this.process(o.left,{...l,path:[...l.path,"allOf",0]}),g=this.process(o.right,{...l,path:[...l.path,"allOf",1]}),v=w=>"allOf"in w&&Object.keys(w).length===1,b=[...v(p)?p.allOf:[p],...v(g)?g.allOf:[g]];f.allOf=b;break}case"tuple":{let f=m;f.type="array";let p=o.items.map((b,w)=>this.process(b,{...l,path:[...l.path,"prefixItems",w]}));if(this.target==="draft-2020-12"?f.prefixItems=p:f.items=p,o.rest){let b=this.process(o.rest,{...l,path:[...l.path,"items"]});this.target==="draft-2020-12"?f.items=b:f.additionalItems=b}o.rest&&(f.items=this.process(o.rest,{...l,path:[...l.path,"items"]}));let{minimum:g,maximum:v}=e._zod.bag;typeof g=="number"&&(f.minItems=g),typeof v=="number"&&(f.maxItems=v);break}case"record":{let f=m;f.type="object",f.propertyNames=this.process(o.keyType,{...l,path:[...l.path,"propertyNames"]}),f.additionalProperties=this.process(o.valueType,{...l,path:[...l.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{let f=m,p=Bn(o.entries);p.every(g=>typeof g=="number")&&(f.type="number"),p.every(g=>typeof g=="string")&&(f.type="string"),f.enum=p;break}case"literal":{let f=m,p=[];for(let g of o.values)if(g===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof g=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");p.push(Number(g))}else p.push(g);if(p.length!==0)if(p.length===1){let g=p[0];f.type=g===null?"null":typeof g,f.const=g}else p.every(g=>typeof g=="number")&&(f.type="number"),p.every(g=>typeof g=="string")&&(f.type="string"),p.every(g=>typeof g=="boolean")&&(f.type="string"),p.every(g=>g===null)&&(f.type="null"),f.enum=p;break}case"file":{let f=m,p={type:"string",format:"binary",contentEncoding:"binary"},{minimum:g,maximum:v,mime:b}=e._zod.bag;g!==void 0&&(p.minLength=g),v!==void 0&&(p.maxLength=v),b?b.length===1?(p.contentMediaType=b[0],Object.assign(f,p)):f.anyOf=b.map(w=>({...p,contentMediaType:w})):Object.assign(f,p);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let f=this.process(o.innerType,l);m.anyOf=[f,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,l),a.ref=o.innerType;break}case"success":{let f=m;f.type="boolean";break}case"default":{this.process(o.innerType,l),a.ref=o.innerType,m.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,l),a.ref=o.innerType,this.io==="input"&&(m._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,l),a.ref=o.innerType;let f;try{f=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}m.default=f;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let f=m,p=e._zod.pattern;if(!p)throw new Error("Pattern not found in template literal");f.type="string",f.pattern=p.source;break}case"pipe":{let f=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(f,l),a.ref=f;break}case"readonly":{this.process(o.innerType,l),a.ref=o.innerType,m.readOnly=!0;break}case"promise":{this.process(o.innerType,l),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,l),a.ref=o.innerType;break}case"lazy":{let f=e._zod.innerType;this.process(f,l),a.ref=f;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}default:}}}let u=this.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),this.io==="input"&&ye(e)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(e).schema}emit(e,r){let n={cycles:r?.cycles??"ref",reused:r?.reused??"inline",external:r?.external??void 0},o=this.seen.get(e);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let s=d=>{let l=this.target==="draft-2020-12"?"$defs":"definitions";if(n.external){let p=n.external.registry.get(d[0])?.id,g=n.external.uri??(b=>b);if(p)return{ref:g(p)};let v=d[1].defId??d[1].schema.id??`schema${this.counter++}`;return d[1].defId=v,{defId:v,ref:`${g("__shared")}#/${l}/${v}`}}if(d[1]===o)return{ref:"#"};let m=`#/${l}/`,f=d[1].schema.id??`__schema${this.counter++}`;return{defId:f,ref:m+f}},i=d=>{if(d[1].schema.$ref)return;let l=d[1],{ref:h,defId:m}=s(d);l.def={...l.schema},m&&(l.defId=m);let f=l.schema;for(let p in f)delete f[p];f.$ref=h};if(n.cycles==="throw")for(let d of this.seen.entries()){let l=d[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
|
|
42
42
|
|
|
43
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let l of this.seen.entries()){let d=l[1];if(e===l[0]){i(l);continue}if(n.external){let m=n.external.registry.get(l[0])?.id;if(e!==l[0]&&m){i(l);continue}}if(this.metadataRegistry.get(l[0])?.id){i(l);continue}if(d.cycle){i(l);continue}if(d.count>1&&n.reused==="ref"){i(l);continue}}let a=(l,d)=>{let h=this.seen.get(l),m=h.def??h.schema,f={...m};if(h.ref===null)return;let p=h.ref;if(h.ref=null,p){a(p,d);let g=this.seen.get(p).schema;g.$ref&&d.target==="draft-7"?(m.allOf=m.allOf??[],m.allOf.push(g)):(Object.assign(m,g),Object.assign(m,f))}h.isParent||this.override({zodSchema:l,jsonSchema:m,path:h.path??[]})};for(let l of[...this.seen.entries()].reverse())a(l[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let l=n.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(l)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let l of this.seen.entries()){let d=l[1];d.def&&d.defId&&(u[d.defId]=d.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function cu(t,e){if(t instanceof Qn){let n=new bs(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let s={},i={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;s[c]=n.emit(u,{...e,external:i})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:o}}return{schemas:s}}let r=new bs(e);return r.process(t),r.emit(t,e)}function ye(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return ye(o.element,r);case"object":{for(let s in o.shape)if(ye(o.shape[s],r))return!0;return!1}case"union":{for(let s of o.options)if(ye(s,r))return!0;return!1}case"intersection":return ye(o.left,r)||ye(o.right,r);case"tuple":{for(let s of o.items)if(ye(s,r))return!0;return!!(o.rest&&ye(o.rest,r))}case"record":return ye(o.keyType,r)||ye(o.valueType,r);case"map":return ye(o.keyType,r)||ye(o.valueType,r);case"set":return ye(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return ye(o.innerType,r);case"lazy":return ye(o.getter(),r);case"default":return ye(o.innerType,r);case"prefault":return ye(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return ye(o.in,r)||ye(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var Yb=y("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");te.init(t,e),t.def=e,t.parse=(r,n)=>za(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>vr(t,r,n),t.parseAsync=async(r,n)=>Ta(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>br(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Ke(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t))});var Xb=y("ZodMiniObject",(t,e)=>{fs.init(t,e),Yb.init(t,e),W.defineLazy(t,"shape",()=>e.shape)});function uu(t,e){let r={type:"object",get shape(){return W.assignProp(this,"shape",{...t}),this.shape},...W.normalizeParams(e)};return new Xb(r)}function Qe(t){return!!t._zod}function $r(t){let e=Object.values(t);if(e.length===0)return uu({});let r=e.every(Qe),n=e.every(o=>!Qe(o));if(r)return uu(t);if(n)return gf(t);throw new Error("Mixed Zod versions detected in object shape.")}function Yt(t,e){return Qe(t)?vr(t,e):t.safeParse(e)}async function xs(t,e){return Qe(t)?await br(t,e):await t.safeParseAsync(e)}function Xt(t){if(!t)return;let e;if(Qe(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function nn(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let n=Object.values(t);if(n.length>0&&n.every(o=>typeof o=="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse=="function")))return $r(t)}}if(Qe(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function ws(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Np(t){return t.description}function Cp(t){if(Qe(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function $s(t){if(Qe(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.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 ro={};uf(ro,{ZodISODate:()=>jp,ZodISODateTime:()=>Zp,ZodISODuration:()=>Ap,ZodISOTime:()=>Mp,date:()=>du,datetime:()=>lu,duration:()=>pu,time:()=>fu});var Zp=y("ZodISODateTime",(t,e)=>{bp.init(t,e),ue.init(t,e)});function lu(t){return Ep(Zp,t)}var jp=y("ZodISODate",(t,e)=>{xp.init(t,e),ue.init(t,e)});function du(t){return Tp(jp,t)}var Mp=y("ZodISOTime",(t,e)=>{wp.init(t,e),ue.init(t,e)});function fu(t){return Pp(Mp,t)}var Ap=y("ZodISODuration",(t,e)=>{$p.init(t,e),ue.init(t,e)});function pu(t){return Rp(Ap,t)}var Dp=(t,e)=>{as.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>ka(t,r)},flatten:{value:r=>$a(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},$I=y("ZodError",Dp),no=y("ZodError",Dp,{Parent:Error});var qp=Sa(no),Lp=Ea(no),Up=Pa(no),Fp=Ra(no);var he=y("ZodType",(t,e)=>(te.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Ke(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>qp(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Up(t,r,n),t.parseAsync=async(r,n)=>Lp(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Fp(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(Kx(r,n)),t.superRefine=r=>t.check(Jx(r)),t.overwrite=r=>t.check(xr(r)),t.optional=()=>me(t),t.nullable=()=>Hp(t),t.nullish=()=>me(Hp(t)),t.nonoptional=r=>Ux(t,r),t.array=()=>G(t),t.or=r=>ie([t,r]),t.and=r=>Ss(t,r),t.transform=r=>hu(t,Yp(r)),t.default=r=>Dx(t,r),t.prefault=r=>Lx(t,r),t.catch=r=>Vx(t,r),t.pipe=r=>hu(t,r),t.readonly=()=>Wx(t),t.describe=r=>{let n=t.clone();return Jt.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Jt.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Jt.get(t);let n=t.clone();return Jt.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Wp=y("_ZodString",(t,e)=>{Xn.init(t,e),he.init(t,e);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(Jc(...n)),t.includes=(...n)=>t.check(Qc(...n)),t.startsWith=(...n)=>t.check(eu(...n)),t.endsWith=(...n)=>t.check(tu(...n)),t.min=(...n)=>t.check(rn(...n)),t.max=(...n)=>t.check(ys(...n)),t.length=(...n)=>t.check(vs(...n)),t.nonempty=(...n)=>t.check(rn(1,...n)),t.lowercase=n=>t.check(Yc(n)),t.uppercase=n=>t.check(Xc(n)),t.trim=()=>t.check(nu()),t.normalize=(...n)=>t.check(ru(...n)),t.toLowerCase=()=>t.check(ou()),t.toUpperCase=()=>t.check(su())}),ax=y("ZodString",(t,e)=>{Xn.init(t,e),Wp.init(t,e),t.email=r=>t.check($c(cx,r)),t.url=r=>t.check(Tc(ux,r)),t.jwt=r=>t.check(Fc(kx,r)),t.emoji=r=>t.check(Pc(lx,r)),t.guid=r=>t.check(ms(Vp,r)),t.uuid=r=>t.check(kc(ks,r)),t.uuidv4=r=>t.check(Sc(ks,r)),t.uuidv6=r=>t.check(zc(ks,r)),t.uuidv7=r=>t.check(Ec(ks,r)),t.nanoid=r=>t.check(Rc(dx,r)),t.guid=r=>t.check(ms(Vp,r)),t.cuid=r=>t.check(Ic(fx,r)),t.cuid2=r=>t.check(Oc(px,r)),t.ulid=r=>t.check(Nc(mx,r)),t.base64=r=>t.check(qc(xx,r)),t.base64url=r=>t.check(Lc(wx,r)),t.xid=r=>t.check(Cc(hx,r)),t.ksuid=r=>t.check(Zc(gx,r)),t.ipv4=r=>t.check(jc(_x,r)),t.ipv6=r=>t.check(Mc(yx,r)),t.cidrv4=r=>t.check(Ac(vx,r)),t.cidrv6=r=>t.check(Dc(bx,r)),t.e164=r=>t.check(Uc($x,r)),t.datetime=r=>t.check(lu(r)),t.date=r=>t.check(du(r)),t.time=r=>t.check(fu(r)),t.duration=r=>t.check(pu(r))});function _(t){return wc(ax,t)}var ue=y("ZodStringFormat",(t,e)=>{se.init(t,e),Wp.init(t,e)}),cx=y("ZodEmail",(t,e)=>{Aa.init(t,e),ue.init(t,e)});var Vp=y("ZodGUID",(t,e)=>{ja.init(t,e),ue.init(t,e)});var ks=y("ZodUUID",(t,e)=>{Ma.init(t,e),ue.init(t,e)});var ux=y("ZodURL",(t,e)=>{Da.init(t,e),ue.init(t,e)});var lx=y("ZodEmoji",(t,e)=>{qa.init(t,e),ue.init(t,e)});var dx=y("ZodNanoID",(t,e)=>{La.init(t,e),ue.init(t,e)});var fx=y("ZodCUID",(t,e)=>{Ua.init(t,e),ue.init(t,e)});var px=y("ZodCUID2",(t,e)=>{Fa.init(t,e),ue.init(t,e)});var mx=y("ZodULID",(t,e)=>{Va.init(t,e),ue.init(t,e)});var hx=y("ZodXID",(t,e)=>{Ba.init(t,e),ue.init(t,e)});var gx=y("ZodKSUID",(t,e)=>{Ha.init(t,e),ue.init(t,e)});var _x=y("ZodIPv4",(t,e)=>{Wa.init(t,e),ue.init(t,e)});var yx=y("ZodIPv6",(t,e)=>{Ga.init(t,e),ue.init(t,e)});var vx=y("ZodCIDRv4",(t,e)=>{Ka.init(t,e),ue.init(t,e)});var bx=y("ZodCIDRv6",(t,e)=>{Ja.init(t,e),ue.init(t,e)});var xx=y("ZodBase64",(t,e)=>{Ya.init(t,e),ue.init(t,e)});var wx=y("ZodBase64URL",(t,e)=>{Xa.init(t,e),ue.init(t,e)});var $x=y("ZodE164",(t,e)=>{Qa.init(t,e),ue.init(t,e)});var kx=y("ZodJWT",(t,e)=>{ec.init(t,e),ue.init(t,e)});var Gp=y("ZodNumber",(t,e)=>{ds.init(t,e),he.init(t,e),t.gt=(n,o)=>t.check(gs(n,o)),t.gte=(n,o)=>t.check(to(n,o)),t.min=(n,o)=>t.check(to(n,o)),t.lt=(n,o)=>t.check(hs(n,o)),t.lte=(n,o)=>t.check(eo(n,o)),t.max=(n,o)=>t.check(eo(n,o)),t.int=n=>t.check(Bp(n)),t.safe=n=>t.check(Bp(n)),t.positive=n=>t.check(gs(0,n)),t.nonnegative=n=>t.check(to(0,n)),t.negative=n=>t.check(hs(0,n)),t.nonpositive=n=>t.check(eo(0,n)),t.multipleOf=(n,o)=>t.check(_s(n,o)),t.step=(n,o)=>t.check(_s(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 ee(t){return Vc(Gp,t)}var Sx=y("ZodNumberFormat",(t,e)=>{tc.init(t,e),Gp.init(t,e)});function Bp(t){return Bc(Sx,t)}var zx=y("ZodBoolean",(t,e)=>{rc.init(t,e),he.init(t,e)});function be(t){return Hc(zx,t)}var Ex=y("ZodNull",(t,e)=>{nc.init(t,e),he.init(t,e)});function gu(t){return Wc(Ex,t)}var Tx=y("ZodUnknown",(t,e)=>{oc.init(t,e),he.init(t,e)});function le(){return Gc(Tx)}var Px=y("ZodNever",(t,e)=>{sc.init(t,e),he.init(t,e)});function Rx(t){return Kc(Px,t)}var Ix=y("ZodArray",(t,e)=>{ic.init(t,e),he.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(rn(r,n)),t.nonempty=r=>t.check(rn(1,r)),t.max=(r,n)=>t.check(ys(r,n)),t.length=(r,n)=>t.check(vs(r,n)),t.unwrap=()=>t.element});function G(t,e){return Ip(Ix,t,e)}var Kp=y("ZodObject",(t,e)=>{fs.init(t,e),he.init(t,e),W.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>qe(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:le()}),t.loose=()=>t.clone({...t._zod.def,catchall:le()}),t.strict=()=>t.clone({...t._zod.def,catchall:Rx()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>W.extend(t,r),t.merge=r=>W.merge(t,r),t.pick=r=>W.pick(t,r),t.omit=r=>W.omit(t,r),t.partial=(...r)=>W.partial(Xp,t,r[0]),t.required=(...r)=>W.required(Qp,t,r[0])});function T(t,e){let r={type:"object",get shape(){return W.assignProp(this,"shape",{...t}),this.shape},...W.normalizeParams(e)};return new Kp(r)}function Ze(t,e){return new Kp({type:"object",get shape(){return W.assignProp(this,"shape",{...t}),this.shape},catchall:le(),...W.normalizeParams(e)})}var Jp=y("ZodUnion",(t,e)=>{ps.init(t,e),he.init(t,e),t.options=e.options});function ie(t,e){return new Jp({type:"union",options:t,...W.normalizeParams(e)})}var Ox=y("ZodDiscriminatedUnion",(t,e)=>{Jp.init(t,e),ac.init(t,e)});function _u(t,e,r){return new Ox({type:"union",options:e,discriminator:t,...W.normalizeParams(r)})}var Nx=y("ZodIntersection",(t,e)=>{cc.init(t,e),he.init(t,e)});function Ss(t,e){return new Nx({type:"intersection",left:t,right:e})}var Cx=y("ZodRecord",(t,e)=>{uc.init(t,e),he.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function de(t,e,r){return new Cx({type:"record",keyType:t,valueType:e,...W.normalizeParams(r)})}var mu=y("ZodEnum",(t,e)=>{lc.init(t,e),he.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new mu({...e,checks:[],...W.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new mu({...e,checks:[],...W.normalizeParams(o),entries:s})}});function qe(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new mu({type:"enum",entries:r,...W.normalizeParams(e)})}var Zx=y("ZodLiteral",(t,e)=>{dc.init(t,e),he.init(t,e),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 I(t,e){return new Zx({type:"literal",values:Array.isArray(t)?t:[t],...W.normalizeParams(e)})}var jx=y("ZodTransform",(t,e)=>{fc.init(t,e),he.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(W.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(W.issue(i))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Yp(t){return new jx({type:"transform",transform:t})}var Xp=y("ZodOptional",(t,e)=>{pc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function me(t){return new Xp({type:"optional",innerType:t})}var Mx=y("ZodNullable",(t,e)=>{mc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Hp(t){return new Mx({type:"nullable",innerType:t})}var Ax=y("ZodDefault",(t,e)=>{hc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Dx(t,e){return new Ax({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var qx=y("ZodPrefault",(t,e)=>{gc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Lx(t,e){return new qx({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Qp=y("ZodNonOptional",(t,e)=>{_c.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Ux(t,e){return new Qp({type:"nonoptional",innerType:t,...W.normalizeParams(e)})}var Fx=y("ZodCatch",(t,e)=>{yc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Vx(t,e){return new Fx({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Bx=y("ZodPipe",(t,e)=>{vc.init(t,e),he.init(t,e),t.in=e.in,t.out=e.out});function hu(t,e){return new Bx({type:"pipe",in:t,out:e})}var Hx=y("ZodReadonly",(t,e)=>{bc.init(t,e),he.init(t,e)});function Wx(t){return new Hx({type:"readonly",innerType:t})}var em=y("ZodCustom",(t,e)=>{xc.init(t,e),he.init(t,e)});function Gx(t){let e=new we({check:"custom"});return e._zod.check=t,e}function tm(t,e){return iu(em,t??(()=>!0),e)}function Kx(t,e={}){return au(em,t,e)}function Jx(t){let e=Gx(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(W.issue(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(W.issue(o))}},t(r.value,r)));return e}function yu(t,e){return hu(Yp(t),e)}Ge(Sp());var bu="2025-11-25";var rm=[bu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Qt="io.modelcontextprotocol/related-task",Es="2.0",$e=tm(t=>t!==null&&(typeof t=="object"||typeof t=="function")),nm=ie([_(),ee().int()]),om=_(),MI=Ze({ttl:ie([ee(),gu()]).optional(),pollInterval:ee().optional()}),Yx=T({ttl:ee().optional()}),Xx=T({taskId:_()}),xu=Ze({progressToken:nm.optional(),[Qt]:Xx.optional()}),Je=T({_meta:xu.optional()}),oo=Je.extend({task:Yx.optional()}),sm=t=>oo.safeParse(t).success,ke=T({method:_(),params:Je.loose().optional()}),et=T({_meta:xu.optional()}),tt=T({method:_(),params:et.loose().optional()}),Se=Ze({_meta:xu.optional()}),Ts=ie([_(),ee().int()]),im=T({jsonrpc:I(Es),id:Ts,...ke.shape}).strict(),wu=t=>im.safeParse(t).success,am=T({jsonrpc:I(Es),...tt.shape}).strict(),cm=t=>am.safeParse(t).success,$u=T({jsonrpc:I(Es),id:Ts,result:Se}).strict(),so=t=>$u.safeParse(t).success;var C;(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"})(C||(C={}));var ku=T({jsonrpc:I(Es),id:Ts.optional(),error:T({code:ee().int(),message:_(),data:le().optional()})}).strict();var um=t=>ku.safeParse(t).success;var lm=ie([im,am,$u,ku]),AI=ie([$u,ku]),Ps=Se.strict(),Qx=et.extend({requestId:Ts.optional(),reason:_().optional()}),Rs=tt.extend({method:I("notifications/cancelled"),params:Qx}),e0=T({src:_(),mimeType:_().optional(),sizes:G(_()).optional(),theme:qe(["light","dark"]).optional()}),io=T({icons:G(e0).optional()}),on=T({name:_(),title:_().optional()}),dm=on.extend({...on.shape,...io.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),t0=Ss(T({applyDefaults:be().optional()}),de(_(),le())),r0=yu(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Ss(T({form:t0.optional(),url:$e.optional()}),de(_(),le()).optional())),n0=Ze({list:$e.optional(),cancel:$e.optional(),requests:Ze({sampling:Ze({createMessage:$e.optional()}).optional(),elicitation:Ze({create:$e.optional()}).optional()}).optional()}),o0=Ze({list:$e.optional(),cancel:$e.optional(),requests:Ze({tools:Ze({call:$e.optional()}).optional()}).optional()}),s0=T({experimental:de(_(),$e).optional(),sampling:T({context:$e.optional(),tools:$e.optional()}).optional(),elicitation:r0.optional(),roots:T({listChanged:be().optional()}).optional(),tasks:n0.optional()}),i0=Je.extend({protocolVersion:_(),capabilities:s0,clientInfo:dm}),Su=ke.extend({method:I("initialize"),params:i0});var a0=T({experimental:de(_(),$e).optional(),logging:$e.optional(),completions:$e.optional(),prompts:T({listChanged:be().optional()}).optional(),resources:T({subscribe:be().optional(),listChanged:be().optional()}).optional(),tools:T({listChanged:be().optional()}).optional(),tasks:o0.optional()}),c0=Se.extend({protocolVersion:_(),capabilities:a0,serverInfo:dm,instructions:_().optional()}),zu=tt.extend({method:I("notifications/initialized"),params:et.optional()});var Is=ke.extend({method:I("ping"),params:Je.optional()}),u0=T({progress:ee(),total:me(ee()),message:me(_())}),l0=T({...et.shape,...u0.shape,progressToken:nm}),Os=tt.extend({method:I("notifications/progress"),params:l0}),d0=Je.extend({cursor:om.optional()}),ao=ke.extend({params:d0.optional()}),co=Se.extend({nextCursor:om.optional()}),f0=qe(["working","input_required","completed","failed","cancelled"]),uo=T({taskId:_(),status:f0,ttl:ie([ee(),gu()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:me(ee()),statusMessage:me(_())}),sn=Se.extend({task:uo}),p0=et.merge(uo),lo=tt.extend({method:I("notifications/tasks/status"),params:p0}),Ns=ke.extend({method:I("tasks/get"),params:Je.extend({taskId:_()})}),Cs=Se.merge(uo),Zs=ke.extend({method:I("tasks/result"),params:Je.extend({taskId:_()})}),DI=Se.loose(),js=ao.extend({method:I("tasks/list")}),Ms=co.extend({tasks:G(uo)}),As=ke.extend({method:I("tasks/cancel"),params:Je.extend({taskId:_()})}),fm=Se.merge(uo),pm=T({uri:_(),mimeType:me(_()),_meta:de(_(),le()).optional()}),mm=pm.extend({text:_()}),Eu=_().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),hm=pm.extend({blob:Eu}),fo=qe(["user","assistant"]),an=T({audience:G(fo).optional(),priority:ee().min(0).max(1).optional(),lastModified:ro.datetime({offset:!0}).optional()}),gm=T({...on.shape,...io.shape,uri:_(),description:me(_()),mimeType:me(_()),annotations:an.optional(),_meta:me(Ze({}))}),m0=T({...on.shape,...io.shape,uriTemplate:_(),description:me(_()),mimeType:me(_()),annotations:an.optional(),_meta:me(Ze({}))}),Ds=ao.extend({method:I("resources/list")}),h0=co.extend({resources:G(gm)}),qs=ao.extend({method:I("resources/templates/list")}),g0=co.extend({resourceTemplates:G(m0)}),Tu=Je.extend({uri:_()}),_0=Tu,Ls=ke.extend({method:I("resources/read"),params:_0}),y0=Se.extend({contents:G(ie([mm,hm]))}),v0=tt.extend({method:I("notifications/resources/list_changed"),params:et.optional()}),b0=Tu,x0=ke.extend({method:I("resources/subscribe"),params:b0}),w0=Tu,$0=ke.extend({method:I("resources/unsubscribe"),params:w0}),k0=et.extend({uri:_()}),S0=tt.extend({method:I("notifications/resources/updated"),params:k0}),z0=T({name:_(),description:me(_()),required:me(be())}),E0=T({...on.shape,...io.shape,description:me(_()),arguments:me(G(z0)),_meta:me(Ze({}))}),Us=ao.extend({method:I("prompts/list")}),T0=co.extend({prompts:G(E0)}),P0=Je.extend({name:_(),arguments:de(_(),_()).optional()}),Fs=ke.extend({method:I("prompts/get"),params:P0}),Pu=T({type:I("text"),text:_(),annotations:an.optional(),_meta:de(_(),le()).optional()}),Ru=T({type:I("image"),data:Eu,mimeType:_(),annotations:an.optional(),_meta:de(_(),le()).optional()}),Iu=T({type:I("audio"),data:Eu,mimeType:_(),annotations:an.optional(),_meta:de(_(),le()).optional()}),R0=T({type:I("tool_use"),name:_(),id:_(),input:de(_(),le()),_meta:de(_(),le()).optional()}),I0=T({type:I("resource"),resource:ie([mm,hm]),annotations:an.optional(),_meta:de(_(),le()).optional()}),O0=gm.extend({type:I("resource_link")}),Ou=ie([Pu,Ru,Iu,O0,I0]),N0=T({role:fo,content:Ou}),C0=Se.extend({description:_().optional(),messages:G(N0)}),Z0=tt.extend({method:I("notifications/prompts/list_changed"),params:et.optional()}),j0=T({title:_().optional(),readOnlyHint:be().optional(),destructiveHint:be().optional(),idempotentHint:be().optional(),openWorldHint:be().optional()}),M0=T({taskSupport:qe(["required","optional","forbidden"]).optional()}),_m=T({...on.shape,...io.shape,description:_().optional(),inputSchema:T({type:I("object"),properties:de(_(),$e).optional(),required:G(_()).optional()}).catchall(le()),outputSchema:T({type:I("object"),properties:de(_(),$e).optional(),required:G(_()).optional()}).catchall(le()).optional(),annotations:j0.optional(),execution:M0.optional(),_meta:de(_(),le()).optional()}),Vs=ao.extend({method:I("tools/list")}),A0=co.extend({tools:G(_m)}),Bs=Se.extend({content:G(Ou).default([]),structuredContent:de(_(),le()).optional(),isError:be().optional()}),qI=Bs.or(Se.extend({toolResult:le()})),D0=oo.extend({name:_(),arguments:de(_(),le()).optional()}),cn=ke.extend({method:I("tools/call"),params:D0}),q0=tt.extend({method:I("notifications/tools/list_changed"),params:et.optional()}),LI=T({autoRefresh:be().default(!0),debounceMs:ee().int().nonnegative().default(300)}),po=qe(["debug","info","notice","warning","error","critical","alert","emergency"]),L0=Je.extend({level:po}),Nu=ke.extend({method:I("logging/setLevel"),params:L0}),U0=et.extend({level:po,logger:_().optional(),data:le()}),F0=tt.extend({method:I("notifications/message"),params:U0}),V0=T({name:_().optional()}),B0=T({hints:G(V0).optional(),costPriority:ee().min(0).max(1).optional(),speedPriority:ee().min(0).max(1).optional(),intelligencePriority:ee().min(0).max(1).optional()}),H0=T({mode:qe(["auto","required","none"]).optional()}),W0=T({type:I("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:G(Ou).default([]),structuredContent:T({}).loose().optional(),isError:be().optional(),_meta:de(_(),le()).optional()}),G0=_u("type",[Pu,Ru,Iu]),zs=_u("type",[Pu,Ru,Iu,R0,W0]),K0=T({role:fo,content:ie([zs,G(zs)]),_meta:de(_(),le()).optional()}),J0=oo.extend({messages:G(K0),modelPreferences:B0.optional(),systemPrompt:_().optional(),includeContext:qe(["none","thisServer","allServers"]).optional(),temperature:ee().optional(),maxTokens:ee().int(),stopSequences:G(_()).optional(),metadata:$e.optional(),tools:G(_m).optional(),toolChoice:H0.optional()}),Y0=ke.extend({method:I("sampling/createMessage"),params:J0}),Cu=Se.extend({model:_(),stopReason:me(qe(["endTurn","stopSequence","maxTokens"]).or(_())),role:fo,content:G0}),Zu=Se.extend({model:_(),stopReason:me(qe(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:fo,content:ie([zs,G(zs)])}),X0=T({type:I("boolean"),title:_().optional(),description:_().optional(),default:be().optional()}),Q0=T({type:I("string"),title:_().optional(),description:_().optional(),minLength:ee().optional(),maxLength:ee().optional(),format:qe(["email","uri","date","date-time"]).optional(),default:_().optional()}),ew=T({type:qe(["number","integer"]),title:_().optional(),description:_().optional(),minimum:ee().optional(),maximum:ee().optional(),default:ee().optional()}),tw=T({type:I("string"),title:_().optional(),description:_().optional(),enum:G(_()),default:_().optional()}),rw=T({type:I("string"),title:_().optional(),description:_().optional(),oneOf:G(T({const:_(),title:_()})),default:_().optional()}),nw=T({type:I("string"),title:_().optional(),description:_().optional(),enum:G(_()),enumNames:G(_()).optional(),default:_().optional()}),ow=ie([tw,rw]),sw=T({type:I("array"),title:_().optional(),description:_().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:T({type:I("string"),enum:G(_())}),default:G(_()).optional()}),iw=T({type:I("array"),title:_().optional(),description:_().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:T({anyOf:G(T({const:_(),title:_()}))}),default:G(_()).optional()}),aw=ie([sw,iw]),cw=ie([nw,ow,aw]),uw=ie([cw,X0,Q0,ew]),lw=oo.extend({mode:I("form").optional(),message:_(),requestedSchema:T({type:I("object"),properties:de(_(),uw),required:G(_()).optional()})}),dw=oo.extend({mode:I("url"),message:_(),elicitationId:_(),url:_().url()}),fw=ie([lw,dw]),pw=ke.extend({method:I("elicitation/create"),params:fw}),mw=et.extend({elicitationId:_()}),hw=tt.extend({method:I("notifications/elicitation/complete"),params:mw}),Hs=Se.extend({action:qe(["accept","decline","cancel"]),content:yu(t=>t===null?void 0:t,de(_(),ie([_(),ee(),be(),G(_())])).optional())}),gw=T({type:I("ref/resource"),uri:_()});var _w=T({type:I("ref/prompt"),name:_()}),yw=Je.extend({ref:ie([_w,gw]),argument:T({name:_(),value:_()}),context:T({arguments:de(_(),_()).optional()}).optional()}),Ws=ke.extend({method:I("completion/complete"),params:yw});function ym(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function vm(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var vw=Se.extend({completion:Ze({values:G(_()).max(100),total:me(ee().int()),hasMore:me(be())})}),bw=T({uri:_().startsWith("file://"),name:_().optional(),_meta:de(_(),le()).optional()}),xw=ke.extend({method:I("roots/list"),params:Je.optional()}),ju=Se.extend({roots:G(bw)}),ww=tt.extend({method:I("notifications/roots/list_changed"),params:et.optional()}),UI=ie([Is,Su,Ws,Nu,Fs,Us,Ds,qs,Ls,x0,$0,cn,Vs,Ns,Zs,js,As]),FI=ie([Rs,Os,zu,ww,lo]),VI=ie([Ps,Cu,Zu,Hs,ju,Cs,Ms,sn]),BI=ie([Is,Y0,pw,xw,Ns,Zs,js,As]),HI=ie([Rs,Os,F0,S0,v0,q0,Z0,lo,hw]),WI=ie([Ps,c0,vw,C0,T0,h0,g0,y0,Bs,A0,Cs,Ms,sn]),R=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===C.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new vu(o.elicitations,r)}return new t(e,r,n)}},vu=class extends R{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(C.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function er(t){return t==="completed"||t==="failed"||t==="cancelled"}var xm=Symbol("Let zodToJsonSchema decide on which parser to use");var bm={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},wm=t=>typeof t=="string"?{...bm,name:t}:{...bm,...t};var $m=t=>{let e=wm(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function Mu(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function K(t,e,r,n,o){t[e]=r,Mu(t,e,n,o)}var Gs=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function fe(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Gs(e,t.currentPath):e.join("/")}}function km(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==$.ZodAny&&(r.items=A(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&K(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&K(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(K(r,"minItems",t.exactLength.value,t.exactLength.message,e),K(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Sm(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?K(r,"minimum",n.value,n.message,e):K(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),K(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?K(r,"maximum",n.value,n.message,e):K(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),K(r,"maximum",n.value,n.message,e));break;case"multipleOf":K(r,"multipleOf",n.value,n.message,e);break}return r}function zm(){return{type:"boolean"}}function Ks(t,e){return A(t.type._def,e)}var Em=(t,e)=>A(t.innerType._def,e);function Au(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Au(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return $w(t,e)}}var $w=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":K(r,"minimum",n.value,n.message,e);break;case"max":K(r,"maximum",n.value,n.message,e);break}return r};function Tm(t,e){return{...A(t.innerType._def,e),default:t.defaultValue()}}function Pm(t,e){return e.effectStrategy==="input"?A(t.schema._def,e):fe(e)}function Rm(t){return{type:"string",enum:Array.from(t.values)}}var kw=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Im(t,e){let r=[A(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),A(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(kw(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function Om(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Du,lt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Du===void 0&&(Du=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Du),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Js(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":K(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":K(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":dt(r,"email",n.message,e);break;case"format:idn-email":dt(r,"idn-email",n.message,e);break;case"pattern:zod":je(r,lt.email,n.message,e);break}break;case"url":dt(r,"uri",n.message,e);break;case"uuid":dt(r,"uuid",n.message,e);break;case"regex":je(r,n.regex,n.message,e);break;case"cuid":je(r,lt.cuid,n.message,e);break;case"cuid2":je(r,lt.cuid2,n.message,e);break;case"startsWith":je(r,RegExp(`^${qu(n.value,e)}`),n.message,e);break;case"endsWith":je(r,RegExp(`${qu(n.value,e)}$`),n.message,e);break;case"datetime":dt(r,"date-time",n.message,e);break;case"date":dt(r,"date",n.message,e);break;case"time":dt(r,"time",n.message,e);break;case"duration":dt(r,"duration",n.message,e);break;case"length":K(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),K(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{je(r,RegExp(qu(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&dt(r,"ipv4",n.message,e),n.version!=="v4"&&dt(r,"ipv6",n.message,e);break}case"base64url":je(r,lt.base64url,n.message,e);break;case"jwt":je(r,lt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&je(r,lt.ipv4Cidr,n.message,e),n.version!=="v4"&&je(r,lt.ipv6Cidr,n.message,e);break}case"emoji":je(r,lt.emoji(),n.message,e);break;case"ulid":{je(r,lt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{dt(r,"binary",n.message,e);break}case"contentEncoding:base64":{K(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{je(r,lt.base64,n.message,e);break}}break}case"nanoid":je(r,lt.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function qu(t,e){return e.patternStrategy==="escape"?zw(t):t}var Sw=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function zw(t){let e="";for(let r=0;r<t.length;r++)Sw.has(t[r])||(e+="\\"),e+=t[r];return e}function dt(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):K(t,"format",e,r,n)}function je(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Nm(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):K(t,"pattern",Nm(e,n),r,n)}function Nm(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(o+=n[c],a=!0):o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
|
|
43
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let d of this.seen.entries()){let l=d[1];if(e===d[0]){i(d);continue}if(n.external){let m=n.external.registry.get(d[0])?.id;if(e!==d[0]&&m){i(d);continue}}if(this.metadataRegistry.get(d[0])?.id){i(d);continue}if(l.cycle){i(d);continue}if(l.count>1&&n.reused==="ref"){i(d);continue}}let a=(d,l)=>{let h=this.seen.get(d),m=h.def??h.schema,f={...m};if(h.ref===null)return;let p=h.ref;if(h.ref=null,p){a(p,l);let g=this.seen.get(p).schema;g.$ref&&l.target==="draft-7"?(m.allOf=m.allOf??[],m.allOf.push(g)):(Object.assign(m,g),Object.assign(m,f))}h.isParent||this.override({zodSchema:d,jsonSchema:m,path:h.path??[]})};for(let d of[...this.seen.entries()].reverse())a(d[0],{target:this.target});let c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){let d=n.external.registry.get(e)?.id;if(!d)throw new Error("Schema is missing an `id` property");c.$id=n.external.uri(d)}Object.assign(c,o.def);let u=n.external?.defs??{};for(let d of this.seen.entries()){let l=d[1];l.def&&l.defId&&(u[l.defId]=l.def)}n.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?c.$defs=u:c.definitions=u);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}};function cu(t,e){if(t instanceof Qn){let n=new bs(e),o={};for(let a of t._idmap.entries()){let[c,u]=a;n.process(u)}let s={},i={registry:t,uri:e?.uri,defs:o};for(let a of t._idmap.entries()){let[c,u]=a;s[c]=n.emit(u,{...e,external:i})}if(Object.keys(o).length>0){let a=n.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:o}}return{schemas:s}}let r=new bs(e);return r.process(t),r.emit(t,e)}function ye(t,e){let r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);let o=t._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return ye(o.element,r);case"object":{for(let s in o.shape)if(ye(o.shape[s],r))return!0;return!1}case"union":{for(let s of o.options)if(ye(s,r))return!0;return!1}case"intersection":return ye(o.left,r)||ye(o.right,r);case"tuple":{for(let s of o.items)if(ye(s,r))return!0;return!!(o.rest&&ye(o.rest,r))}case"record":return ye(o.keyType,r)||ye(o.valueType,r);case"map":return ye(o.keyType,r)||ye(o.valueType,r);case"set":return ye(o.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return ye(o.innerType,r);case"lazy":return ye(o.getter(),r);case"default":return ye(o.innerType,r);case"prefault":return ye(o.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return ye(o.in,r)||ye(o.out,r);case"success":return!1;case"catch":return!1;default:}throw new Error(`Unknown schema type: ${o.type}`)}var ex=y("ZodMiniType",(t,e)=>{if(!t._zod)throw new Error("Uninitialized schema in ZodMiniType.");te.init(t,e),t.def=e,t.parse=(r,n)=>za(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>vr(t,r,n),t.parseAsync=async(r,n)=>Ta(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>br(t,r,n),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Je(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t))});var tx=y("ZodMiniObject",(t,e)=>{fs.init(t,e),ex.init(t,e),W.defineLazy(t,"shape",()=>e.shape)});function uu(t,e){let r={type:"object",get shape(){return W.assignProp(this,"shape",{...t}),this.shape},...W.normalizeParams(e)};return new tx(r)}function et(t){return!!t._zod}function $r(t){let e=Object.values(t);if(e.length===0)return uu({});let r=e.every(et),n=e.every(o=>!et(o));if(r)return uu(t);if(n)return yf(t);throw new Error("Mixed Zod versions detected in object shape.")}function Yt(t,e){return et(t)?vr(t,e):t.safeParse(e)}async function xs(t,e){return et(t)?await br(t,e):await t.safeParseAsync(e)}function Xt(t){if(!t)return;let e;if(et(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function nn(t){if(t){if(typeof t=="object"){let e=t,r=t;if(!e._def&&!r._zod){let n=Object.values(t);if(n.length>0&&n.every(o=>typeof o=="object"&&o!==null&&(o._def!==void 0||o._zod!==void 0||typeof o.parse=="function")))return $r(t)}}if(et(t)){let r=t._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return t}else if(t.shape!==void 0)return t}}function ws(t){if(t&&typeof t=="object"){if("message"in t&&typeof t.message=="string")return t.message;if("issues"in t&&Array.isArray(t.issues)&&t.issues.length>0){let e=t.issues[0];if(e&&typeof e=="object"&&"message"in e)return String(e.message)}try{return JSON.stringify(t)}catch{return String(t)}}return String(t)}function Zp(t){return t.description}function jp(t){if(et(t))return t._zod?.def?.type==="optional";let e=t;return typeof t.isOptional=="function"?t.isOptional():e._def?.typeName==="ZodOptional"}function $s(t){if(et(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.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 ro={};df(ro,{ZodISODate:()=>Ap,ZodISODateTime:()=>Mp,ZodISODuration:()=>qp,ZodISOTime:()=>Dp,date:()=>du,datetime:()=>lu,duration:()=>pu,time:()=>fu});var Mp=y("ZodISODateTime",(t,e)=>{wp.init(t,e),ue.init(t,e)});function lu(t){return Pp(Mp,t)}var Ap=y("ZodISODate",(t,e)=>{$p.init(t,e),ue.init(t,e)});function du(t){return Rp(Ap,t)}var Dp=y("ZodISOTime",(t,e)=>{kp.init(t,e),ue.init(t,e)});function fu(t){return Ip(Dp,t)}var qp=y("ZodISODuration",(t,e)=>{Sp.init(t,e),ue.init(t,e)});function pu(t){return Op(qp,t)}var Lp=(t,e)=>{as.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>ka(t,r)},flatten:{value:r=>$a(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}})},zI=y("ZodError",Lp),no=y("ZodError",Lp,{Parent:Error});var Up=Sa(no),Fp=Ea(no),Vp=Pa(no),Bp=Ra(no);var he=y("ZodType",(t,e)=>(te.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>Je(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>Up(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Vp(t,r,n),t.parseAsync=async(r,n)=>Fp(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Bp(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(Xx(r,n)),t.superRefine=r=>t.check(Qx(r)),t.overwrite=r=>t.check(xr(r)),t.optional=()=>me(t),t.nullable=()=>Gp(t),t.nullish=()=>me(Gp(t)),t.nonoptional=r=>Bx(t,r),t.array=()=>G(t),t.or=r=>ie([t,r]),t.and=r=>Ss(t,r),t.transform=r=>hu(t,Qp(r)),t.default=r=>Ux(t,r),t.prefault=r=>Vx(t,r),t.catch=r=>Wx(t,r),t.pipe=r=>hu(t,r),t.readonly=()=>Jx(t),t.describe=r=>{let n=t.clone();return Jt.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return Jt.get(t)?.description},configurable:!0}),t.meta=(...r)=>{if(r.length===0)return Jt.get(t);let n=t.clone();return Jt.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Kp=y("_ZodString",(t,e)=>{Xn.init(t,e),he.init(t,e);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(Jc(...n)),t.includes=(...n)=>t.check(Qc(...n)),t.startsWith=(...n)=>t.check(eu(...n)),t.endsWith=(...n)=>t.check(tu(...n)),t.min=(...n)=>t.check(rn(...n)),t.max=(...n)=>t.check(ys(...n)),t.length=(...n)=>t.check(vs(...n)),t.nonempty=(...n)=>t.check(rn(1,...n)),t.lowercase=n=>t.check(Yc(n)),t.uppercase=n=>t.check(Xc(n)),t.trim=()=>t.check(nu()),t.normalize=(...n)=>t.check(ru(...n)),t.toLowerCase=()=>t.check(ou()),t.toUpperCase=()=>t.check(su())}),lx=y("ZodString",(t,e)=>{Xn.init(t,e),Kp.init(t,e),t.email=r=>t.check($c(dx,r)),t.url=r=>t.check(Tc(fx,r)),t.jwt=r=>t.check(Fc(Ex,r)),t.emoji=r=>t.check(Pc(px,r)),t.guid=r=>t.check(ms(Hp,r)),t.uuid=r=>t.check(kc(ks,r)),t.uuidv4=r=>t.check(Sc(ks,r)),t.uuidv6=r=>t.check(zc(ks,r)),t.uuidv7=r=>t.check(Ec(ks,r)),t.nanoid=r=>t.check(Rc(mx,r)),t.guid=r=>t.check(ms(Hp,r)),t.cuid=r=>t.check(Ic(hx,r)),t.cuid2=r=>t.check(Oc(gx,r)),t.ulid=r=>t.check(Nc(_x,r)),t.base64=r=>t.check(qc(kx,r)),t.base64url=r=>t.check(Lc(Sx,r)),t.xid=r=>t.check(Cc(yx,r)),t.ksuid=r=>t.check(Zc(vx,r)),t.ipv4=r=>t.check(jc(bx,r)),t.ipv6=r=>t.check(Mc(xx,r)),t.cidrv4=r=>t.check(Ac(wx,r)),t.cidrv6=r=>t.check(Dc($x,r)),t.e164=r=>t.check(Uc(zx,r)),t.datetime=r=>t.check(lu(r)),t.date=r=>t.check(du(r)),t.time=r=>t.check(fu(r)),t.duration=r=>t.check(pu(r))});function _(t){return wc(lx,t)}var ue=y("ZodStringFormat",(t,e)=>{se.init(t,e),Kp.init(t,e)}),dx=y("ZodEmail",(t,e)=>{Aa.init(t,e),ue.init(t,e)});var Hp=y("ZodGUID",(t,e)=>{ja.init(t,e),ue.init(t,e)});var ks=y("ZodUUID",(t,e)=>{Ma.init(t,e),ue.init(t,e)});var fx=y("ZodURL",(t,e)=>{Da.init(t,e),ue.init(t,e)});var px=y("ZodEmoji",(t,e)=>{qa.init(t,e),ue.init(t,e)});var mx=y("ZodNanoID",(t,e)=>{La.init(t,e),ue.init(t,e)});var hx=y("ZodCUID",(t,e)=>{Ua.init(t,e),ue.init(t,e)});var gx=y("ZodCUID2",(t,e)=>{Fa.init(t,e),ue.init(t,e)});var _x=y("ZodULID",(t,e)=>{Va.init(t,e),ue.init(t,e)});var yx=y("ZodXID",(t,e)=>{Ba.init(t,e),ue.init(t,e)});var vx=y("ZodKSUID",(t,e)=>{Ha.init(t,e),ue.init(t,e)});var bx=y("ZodIPv4",(t,e)=>{Wa.init(t,e),ue.init(t,e)});var xx=y("ZodIPv6",(t,e)=>{Ga.init(t,e),ue.init(t,e)});var wx=y("ZodCIDRv4",(t,e)=>{Ka.init(t,e),ue.init(t,e)});var $x=y("ZodCIDRv6",(t,e)=>{Ja.init(t,e),ue.init(t,e)});var kx=y("ZodBase64",(t,e)=>{Ya.init(t,e),ue.init(t,e)});var Sx=y("ZodBase64URL",(t,e)=>{Xa.init(t,e),ue.init(t,e)});var zx=y("ZodE164",(t,e)=>{Qa.init(t,e),ue.init(t,e)});var Ex=y("ZodJWT",(t,e)=>{ec.init(t,e),ue.init(t,e)});var Jp=y("ZodNumber",(t,e)=>{ds.init(t,e),he.init(t,e),t.gt=(n,o)=>t.check(gs(n,o)),t.gte=(n,o)=>t.check(to(n,o)),t.min=(n,o)=>t.check(to(n,o)),t.lt=(n,o)=>t.check(hs(n,o)),t.lte=(n,o)=>t.check(eo(n,o)),t.max=(n,o)=>t.check(eo(n,o)),t.int=n=>t.check(Wp(n)),t.safe=n=>t.check(Wp(n)),t.positive=n=>t.check(gs(0,n)),t.nonnegative=n=>t.check(to(0,n)),t.negative=n=>t.check(hs(0,n)),t.nonpositive=n=>t.check(eo(0,n)),t.multipleOf=(n,o)=>t.check(_s(n,o)),t.step=(n,o)=>t.check(_s(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 ee(t){return Vc(Jp,t)}var Tx=y("ZodNumberFormat",(t,e)=>{tc.init(t,e),Jp.init(t,e)});function Wp(t){return Bc(Tx,t)}var Px=y("ZodBoolean",(t,e)=>{rc.init(t,e),he.init(t,e)});function be(t){return Hc(Px,t)}var Rx=y("ZodNull",(t,e)=>{nc.init(t,e),he.init(t,e)});function gu(t){return Wc(Rx,t)}var Ix=y("ZodUnknown",(t,e)=>{oc.init(t,e),he.init(t,e)});function le(){return Gc(Ix)}var Ox=y("ZodNever",(t,e)=>{sc.init(t,e),he.init(t,e)});function Nx(t){return Kc(Ox,t)}var Cx=y("ZodArray",(t,e)=>{ic.init(t,e),he.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(rn(r,n)),t.nonempty=r=>t.check(rn(1,r)),t.max=(r,n)=>t.check(ys(r,n)),t.length=(r,n)=>t.check(vs(r,n)),t.unwrap=()=>t.element});function G(t,e){return Np(Cx,t,e)}var Yp=y("ZodObject",(t,e)=>{fs.init(t,e),he.init(t,e),W.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Le(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:le()}),t.loose=()=>t.clone({...t._zod.def,catchall:le()}),t.strict=()=>t.clone({...t._zod.def,catchall:Nx()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>W.extend(t,r),t.merge=r=>W.merge(t,r),t.pick=r=>W.pick(t,r),t.omit=r=>W.omit(t,r),t.partial=(...r)=>W.partial(em,t,r[0]),t.required=(...r)=>W.required(tm,t,r[0])});function T(t,e){let r={type:"object",get shape(){return W.assignProp(this,"shape",{...t}),this.shape},...W.normalizeParams(e)};return new Yp(r)}function je(t,e){return new Yp({type:"object",get shape(){return W.assignProp(this,"shape",{...t}),this.shape},catchall:le(),...W.normalizeParams(e)})}var Xp=y("ZodUnion",(t,e)=>{ps.init(t,e),he.init(t,e),t.options=e.options});function ie(t,e){return new Xp({type:"union",options:t,...W.normalizeParams(e)})}var Zx=y("ZodDiscriminatedUnion",(t,e)=>{Xp.init(t,e),ac.init(t,e)});function _u(t,e,r){return new Zx({type:"union",options:e,discriminator:t,...W.normalizeParams(r)})}var jx=y("ZodIntersection",(t,e)=>{cc.init(t,e),he.init(t,e)});function Ss(t,e){return new jx({type:"intersection",left:t,right:e})}var Mx=y("ZodRecord",(t,e)=>{uc.init(t,e),he.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType});function de(t,e,r){return new Mx({type:"record",keyType:t,valueType:e,...W.normalizeParams(r)})}var mu=y("ZodEnum",(t,e)=>{lc.init(t,e),he.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new mu({...e,checks:[],...W.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new mu({...e,checks:[],...W.normalizeParams(o),entries:s})}});function Le(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new mu({type:"enum",entries:r,...W.normalizeParams(e)})}var Ax=y("ZodLiteral",(t,e)=>{dc.init(t,e),he.init(t,e),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 I(t,e){return new Ax({type:"literal",values:Array.isArray(t)?t:[t],...W.normalizeParams(e)})}var Dx=y("ZodTransform",(t,e)=>{fc.init(t,e),he.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(W.issue(s,r.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!0),r.issues.push(W.issue(i))}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)}});function Qp(t){return new Dx({type:"transform",transform:t})}var em=y("ZodOptional",(t,e)=>{pc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function me(t){return new em({type:"optional",innerType:t})}var qx=y("ZodNullable",(t,e)=>{mc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Gp(t){return new qx({type:"nullable",innerType:t})}var Lx=y("ZodDefault",(t,e)=>{hc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Ux(t,e){return new Lx({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var Fx=y("ZodPrefault",(t,e)=>{gc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Vx(t,e){return new Fx({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}var tm=y("ZodNonOptional",(t,e)=>{_c.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType});function Bx(t,e){return new tm({type:"nonoptional",innerType:t,...W.normalizeParams(e)})}var Hx=y("ZodCatch",(t,e)=>{yc.init(t,e),he.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Wx(t,e){return new Hx({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var Gx=y("ZodPipe",(t,e)=>{vc.init(t,e),he.init(t,e),t.in=e.in,t.out=e.out});function hu(t,e){return new Gx({type:"pipe",in:t,out:e})}var Kx=y("ZodReadonly",(t,e)=>{bc.init(t,e),he.init(t,e)});function Jx(t){return new Kx({type:"readonly",innerType:t})}var rm=y("ZodCustom",(t,e)=>{xc.init(t,e),he.init(t,e)});function Yx(t){let e=new $e({check:"custom"});return e._zod.check=t,e}function nm(t,e){return iu(rm,t??(()=>!0),e)}function Xx(t,e={}){return au(rm,t,e)}function Qx(t){let e=Yx(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(W.issue(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(W.issue(o))}},t(r.value,r)));return e}function yu(t,e){return hu(Qp(t),e)}Ke(Ep());var bu="2025-11-25";var om=[bu,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Qt="io.modelcontextprotocol/related-task",Es="2.0",ke=nm(t=>t!==null&&(typeof t=="object"||typeof t=="function")),sm=ie([_(),ee().int()]),im=_(),qI=je({ttl:ie([ee(),gu()]).optional(),pollInterval:ee().optional()}),e0=T({ttl:ee().optional()}),t0=T({taskId:_()}),xu=je({progressToken:sm.optional(),[Qt]:t0.optional()}),Ye=T({_meta:xu.optional()}),oo=Ye.extend({task:e0.optional()}),am=t=>oo.safeParse(t).success,Se=T({method:_(),params:Ye.loose().optional()}),tt=T({_meta:xu.optional()}),rt=T({method:_(),params:tt.loose().optional()}),ze=je({_meta:xu.optional()}),Ts=ie([_(),ee().int()]),cm=T({jsonrpc:I(Es),id:Ts,...Se.shape}).strict(),wu=t=>cm.safeParse(t).success,um=T({jsonrpc:I(Es),...rt.shape}).strict(),lm=t=>um.safeParse(t).success,$u=T({jsonrpc:I(Es),id:Ts,result:ze}).strict(),so=t=>$u.safeParse(t).success;var C;(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"})(C||(C={}));var ku=T({jsonrpc:I(Es),id:Ts.optional(),error:T({code:ee().int(),message:_(),data:le().optional()})}).strict();var dm=t=>ku.safeParse(t).success;var fm=ie([cm,um,$u,ku]),LI=ie([$u,ku]),Ps=ze.strict(),r0=tt.extend({requestId:Ts.optional(),reason:_().optional()}),Rs=rt.extend({method:I("notifications/cancelled"),params:r0}),n0=T({src:_(),mimeType:_().optional(),sizes:G(_()).optional(),theme:Le(["light","dark"]).optional()}),io=T({icons:G(n0).optional()}),on=T({name:_(),title:_().optional()}),pm=on.extend({...on.shape,...io.shape,version:_(),websiteUrl:_().optional(),description:_().optional()}),o0=Ss(T({applyDefaults:be().optional()}),de(_(),le())),s0=yu(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Ss(T({form:o0.optional(),url:ke.optional()}),de(_(),le()).optional())),i0=je({list:ke.optional(),cancel:ke.optional(),requests:je({sampling:je({createMessage:ke.optional()}).optional(),elicitation:je({create:ke.optional()}).optional()}).optional()}),a0=je({list:ke.optional(),cancel:ke.optional(),requests:je({tools:je({call:ke.optional()}).optional()}).optional()}),c0=T({experimental:de(_(),ke).optional(),sampling:T({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:s0.optional(),roots:T({listChanged:be().optional()}).optional(),tasks:i0.optional()}),u0=Ye.extend({protocolVersion:_(),capabilities:c0,clientInfo:pm}),Su=Se.extend({method:I("initialize"),params:u0});var l0=T({experimental:de(_(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:T({listChanged:be().optional()}).optional(),resources:T({subscribe:be().optional(),listChanged:be().optional()}).optional(),tools:T({listChanged:be().optional()}).optional(),tasks:a0.optional()}),d0=ze.extend({protocolVersion:_(),capabilities:l0,serverInfo:pm,instructions:_().optional()}),zu=rt.extend({method:I("notifications/initialized"),params:tt.optional()});var Is=Se.extend({method:I("ping"),params:Ye.optional()}),f0=T({progress:ee(),total:me(ee()),message:me(_())}),p0=T({...tt.shape,...f0.shape,progressToken:sm}),Os=rt.extend({method:I("notifications/progress"),params:p0}),m0=Ye.extend({cursor:im.optional()}),ao=Se.extend({params:m0.optional()}),co=ze.extend({nextCursor:im.optional()}),h0=Le(["working","input_required","completed","failed","cancelled"]),uo=T({taskId:_(),status:h0,ttl:ie([ee(),gu()]),createdAt:_(),lastUpdatedAt:_(),pollInterval:me(ee()),statusMessage:me(_())}),sn=ze.extend({task:uo}),g0=tt.merge(uo),lo=rt.extend({method:I("notifications/tasks/status"),params:g0}),Ns=Se.extend({method:I("tasks/get"),params:Ye.extend({taskId:_()})}),Cs=ze.merge(uo),Zs=Se.extend({method:I("tasks/result"),params:Ye.extend({taskId:_()})}),UI=ze.loose(),js=ao.extend({method:I("tasks/list")}),Ms=co.extend({tasks:G(uo)}),As=Se.extend({method:I("tasks/cancel"),params:Ye.extend({taskId:_()})}),mm=ze.merge(uo),hm=T({uri:_(),mimeType:me(_()),_meta:de(_(),le()).optional()}),gm=hm.extend({text:_()}),Eu=_().refine(t=>{try{return atob(t),!0}catch{return!1}},{message:"Invalid Base64 string"}),_m=hm.extend({blob:Eu}),fo=Le(["user","assistant"]),an=T({audience:G(fo).optional(),priority:ee().min(0).max(1).optional(),lastModified:ro.datetime({offset:!0}).optional()}),ym=T({...on.shape,...io.shape,uri:_(),description:me(_()),mimeType:me(_()),annotations:an.optional(),_meta:me(je({}))}),_0=T({...on.shape,...io.shape,uriTemplate:_(),description:me(_()),mimeType:me(_()),annotations:an.optional(),_meta:me(je({}))}),Ds=ao.extend({method:I("resources/list")}),y0=co.extend({resources:G(ym)}),qs=ao.extend({method:I("resources/templates/list")}),v0=co.extend({resourceTemplates:G(_0)}),Tu=Ye.extend({uri:_()}),b0=Tu,Ls=Se.extend({method:I("resources/read"),params:b0}),x0=ze.extend({contents:G(ie([gm,_m]))}),w0=rt.extend({method:I("notifications/resources/list_changed"),params:tt.optional()}),$0=Tu,k0=Se.extend({method:I("resources/subscribe"),params:$0}),S0=Tu,z0=Se.extend({method:I("resources/unsubscribe"),params:S0}),E0=tt.extend({uri:_()}),T0=rt.extend({method:I("notifications/resources/updated"),params:E0}),P0=T({name:_(),description:me(_()),required:me(be())}),R0=T({...on.shape,...io.shape,description:me(_()),arguments:me(G(P0)),_meta:me(je({}))}),Us=ao.extend({method:I("prompts/list")}),I0=co.extend({prompts:G(R0)}),O0=Ye.extend({name:_(),arguments:de(_(),_()).optional()}),Fs=Se.extend({method:I("prompts/get"),params:O0}),Pu=T({type:I("text"),text:_(),annotations:an.optional(),_meta:de(_(),le()).optional()}),Ru=T({type:I("image"),data:Eu,mimeType:_(),annotations:an.optional(),_meta:de(_(),le()).optional()}),Iu=T({type:I("audio"),data:Eu,mimeType:_(),annotations:an.optional(),_meta:de(_(),le()).optional()}),N0=T({type:I("tool_use"),name:_(),id:_(),input:de(_(),le()),_meta:de(_(),le()).optional()}),C0=T({type:I("resource"),resource:ie([gm,_m]),annotations:an.optional(),_meta:de(_(),le()).optional()}),Z0=ym.extend({type:I("resource_link")}),Ou=ie([Pu,Ru,Iu,Z0,C0]),j0=T({role:fo,content:Ou}),M0=ze.extend({description:_().optional(),messages:G(j0)}),A0=rt.extend({method:I("notifications/prompts/list_changed"),params:tt.optional()}),D0=T({title:_().optional(),readOnlyHint:be().optional(),destructiveHint:be().optional(),idempotentHint:be().optional(),openWorldHint:be().optional()}),q0=T({taskSupport:Le(["required","optional","forbidden"]).optional()}),vm=T({...on.shape,...io.shape,description:_().optional(),inputSchema:T({type:I("object"),properties:de(_(),ke).optional(),required:G(_()).optional()}).catchall(le()),outputSchema:T({type:I("object"),properties:de(_(),ke).optional(),required:G(_()).optional()}).catchall(le()).optional(),annotations:D0.optional(),execution:q0.optional(),_meta:de(_(),le()).optional()}),Vs=ao.extend({method:I("tools/list")}),L0=co.extend({tools:G(vm)}),Bs=ze.extend({content:G(Ou).default([]),structuredContent:de(_(),le()).optional(),isError:be().optional()}),FI=Bs.or(ze.extend({toolResult:le()})),U0=oo.extend({name:_(),arguments:de(_(),le()).optional()}),cn=Se.extend({method:I("tools/call"),params:U0}),F0=rt.extend({method:I("notifications/tools/list_changed"),params:tt.optional()}),VI=T({autoRefresh:be().default(!0),debounceMs:ee().int().nonnegative().default(300)}),po=Le(["debug","info","notice","warning","error","critical","alert","emergency"]),V0=Ye.extend({level:po}),Nu=Se.extend({method:I("logging/setLevel"),params:V0}),B0=tt.extend({level:po,logger:_().optional(),data:le()}),H0=rt.extend({method:I("notifications/message"),params:B0}),W0=T({name:_().optional()}),G0=T({hints:G(W0).optional(),costPriority:ee().min(0).max(1).optional(),speedPriority:ee().min(0).max(1).optional(),intelligencePriority:ee().min(0).max(1).optional()}),K0=T({mode:Le(["auto","required","none"]).optional()}),J0=T({type:I("tool_result"),toolUseId:_().describe("The unique identifier for the corresponding tool call."),content:G(Ou).default([]),structuredContent:T({}).loose().optional(),isError:be().optional(),_meta:de(_(),le()).optional()}),Y0=_u("type",[Pu,Ru,Iu]),zs=_u("type",[Pu,Ru,Iu,N0,J0]),X0=T({role:fo,content:ie([zs,G(zs)]),_meta:de(_(),le()).optional()}),Q0=oo.extend({messages:G(X0),modelPreferences:G0.optional(),systemPrompt:_().optional(),includeContext:Le(["none","thisServer","allServers"]).optional(),temperature:ee().optional(),maxTokens:ee().int(),stopSequences:G(_()).optional(),metadata:ke.optional(),tools:G(vm).optional(),toolChoice:K0.optional()}),ew=Se.extend({method:I("sampling/createMessage"),params:Q0}),Cu=ze.extend({model:_(),stopReason:me(Le(["endTurn","stopSequence","maxTokens"]).or(_())),role:fo,content:Y0}),Zu=ze.extend({model:_(),stopReason:me(Le(["endTurn","stopSequence","maxTokens","toolUse"]).or(_())),role:fo,content:ie([zs,G(zs)])}),tw=T({type:I("boolean"),title:_().optional(),description:_().optional(),default:be().optional()}),rw=T({type:I("string"),title:_().optional(),description:_().optional(),minLength:ee().optional(),maxLength:ee().optional(),format:Le(["email","uri","date","date-time"]).optional(),default:_().optional()}),nw=T({type:Le(["number","integer"]),title:_().optional(),description:_().optional(),minimum:ee().optional(),maximum:ee().optional(),default:ee().optional()}),ow=T({type:I("string"),title:_().optional(),description:_().optional(),enum:G(_()),default:_().optional()}),sw=T({type:I("string"),title:_().optional(),description:_().optional(),oneOf:G(T({const:_(),title:_()})),default:_().optional()}),iw=T({type:I("string"),title:_().optional(),description:_().optional(),enum:G(_()),enumNames:G(_()).optional(),default:_().optional()}),aw=ie([ow,sw]),cw=T({type:I("array"),title:_().optional(),description:_().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:T({type:I("string"),enum:G(_())}),default:G(_()).optional()}),uw=T({type:I("array"),title:_().optional(),description:_().optional(),minItems:ee().optional(),maxItems:ee().optional(),items:T({anyOf:G(T({const:_(),title:_()}))}),default:G(_()).optional()}),lw=ie([cw,uw]),dw=ie([iw,aw,lw]),fw=ie([dw,tw,rw,nw]),pw=oo.extend({mode:I("form").optional(),message:_(),requestedSchema:T({type:I("object"),properties:de(_(),fw),required:G(_()).optional()})}),mw=oo.extend({mode:I("url"),message:_(),elicitationId:_(),url:_().url()}),hw=ie([pw,mw]),gw=Se.extend({method:I("elicitation/create"),params:hw}),_w=tt.extend({elicitationId:_()}),yw=rt.extend({method:I("notifications/elicitation/complete"),params:_w}),Hs=ze.extend({action:Le(["accept","decline","cancel"]),content:yu(t=>t===null?void 0:t,de(_(),ie([_(),ee(),be(),G(_())])).optional())}),vw=T({type:I("ref/resource"),uri:_()});var bw=T({type:I("ref/prompt"),name:_()}),xw=Ye.extend({ref:ie([bw,vw]),argument:T({name:_(),value:_()}),context:T({arguments:de(_(),_()).optional()}).optional()}),Ws=Se.extend({method:I("completion/complete"),params:xw});function bm(t){if(t.params.ref.type!=="ref/prompt")throw new TypeError(`Expected CompleteRequestPrompt, but got ${t.params.ref.type}`)}function xm(t){if(t.params.ref.type!=="ref/resource")throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${t.params.ref.type}`)}var ww=ze.extend({completion:je({values:G(_()).max(100),total:me(ee().int()),hasMore:me(be())})}),$w=T({uri:_().startsWith("file://"),name:_().optional(),_meta:de(_(),le()).optional()}),kw=Se.extend({method:I("roots/list"),params:Ye.optional()}),ju=ze.extend({roots:G($w)}),Sw=rt.extend({method:I("notifications/roots/list_changed"),params:tt.optional()}),BI=ie([Is,Su,Ws,Nu,Fs,Us,Ds,qs,Ls,k0,z0,cn,Vs,Ns,Zs,js,As]),HI=ie([Rs,Os,zu,Sw,lo]),WI=ie([Ps,Cu,Zu,Hs,ju,Cs,Ms,sn]),GI=ie([Is,ew,gw,kw,Ns,Zs,js,As]),KI=ie([Rs,Os,H0,T0,w0,F0,A0,lo,yw]),JI=ie([Ps,d0,ww,M0,I0,y0,v0,x0,Bs,L0,Cs,Ms,sn]),R=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===C.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new vu(o.elicitations,r)}return new t(e,r,n)}},vu=class extends R{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(C.UrlElicitationRequired,r,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function er(t){return t==="completed"||t==="failed"||t==="cancelled"}var $m=Symbol("Let zodToJsonSchema decide on which parser to use");var wm={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},km=t=>typeof t=="string"?{...wm,name:t}:{...wm,...t};var Sm=t=>{let e=km(t),r=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function Mu(t,e,r,n){n?.errorMessages&&r&&(t.errorMessage={...t.errorMessage,[e]:r})}function K(t,e,r,n,o){t[e]=r,Mu(t,e,n,o)}var Gs=(t,e)=>{let r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];r++);return[(t.length-r).toString(),...e.slice(r)].join("/")};function fe(t){if(t.target!=="openAi")return{};let e=[...t.basePath,t.definitionPath,t.openAiAnyTypeName];return t.flags.hasReferencedOpenAiAnyType=!0,{$ref:t.$refStrategy==="relative"?Gs(e,t.currentPath):e.join("/")}}function zm(t,e){let r={type:"array"};return t.type?._def&&t.type?._def?.typeName!==$.ZodAny&&(r.items=A(t.type._def,{...e,currentPath:[...e.currentPath,"items"]})),t.minLength&&K(r,"minItems",t.minLength.value,t.minLength.message,e),t.maxLength&&K(r,"maxItems",t.maxLength.value,t.maxLength.message,e),t.exactLength&&(K(r,"minItems",t.exactLength.value,t.exactLength.message,e),K(r,"maxItems",t.exactLength.value,t.exactLength.message,e)),r}function Em(t,e){let r={type:"integer",format:"int64"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?K(r,"minimum",n.value,n.message,e):K(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),K(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?K(r,"maximum",n.value,n.message,e):K(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),K(r,"maximum",n.value,n.message,e));break;case"multipleOf":K(r,"multipleOf",n.value,n.message,e);break}return r}function Tm(){return{type:"boolean"}}function Ks(t,e){return A(t.type._def,e)}var Pm=(t,e)=>A(t.innerType._def,e);function Au(t,e,r){let n=r??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,s)=>Au(t,e,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return zw(t,e)}}var zw=(t,e)=>{let r={type:"integer",format:"unix-time"};if(e.target==="openApi3")return r;for(let n of t.checks)switch(n.kind){case"min":K(r,"minimum",n.value,n.message,e);break;case"max":K(r,"maximum",n.value,n.message,e);break}return r};function Rm(t,e){return{...A(t.innerType._def,e),default:t.defaultValue()}}function Im(t,e){return e.effectStrategy==="input"?A(t.schema._def,e):fe(e)}function Om(t){return{type:"string",enum:Array.from(t.values)}}var Ew=t=>"type"in t&&t.type==="string"?!1:"allOf"in t;function Nm(t,e){let r=[A(t.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),A(t.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,o=[];return r.forEach(s=>{if(Ew(s))o.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:a,...c}=s;i=c}else n=void 0;o.push(i)}}),o.length?{allOf:o,...n}:void 0}function Cm(t,e){let r=typeof t.value;return r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string"?{type:Array.isArray(t.value)?"array":"object"}:e.target==="openApi3"?{type:r==="bigint"?"integer":r,enum:[t.value]}:{type:r==="bigint"?"integer":r,const:t.value}}var Du,dt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Du===void 0&&(Du=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Du),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Js(t,e){let r={type:"string"};if(t.checks)for(let n of t.checks)switch(n.kind){case"min":K(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e);break;case"max":K(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":ft(r,"email",n.message,e);break;case"format:idn-email":ft(r,"idn-email",n.message,e);break;case"pattern:zod":Me(r,dt.email,n.message,e);break}break;case"url":ft(r,"uri",n.message,e);break;case"uuid":ft(r,"uuid",n.message,e);break;case"regex":Me(r,n.regex,n.message,e);break;case"cuid":Me(r,dt.cuid,n.message,e);break;case"cuid2":Me(r,dt.cuid2,n.message,e);break;case"startsWith":Me(r,RegExp(`^${qu(n.value,e)}`),n.message,e);break;case"endsWith":Me(r,RegExp(`${qu(n.value,e)}$`),n.message,e);break;case"datetime":ft(r,"date-time",n.message,e);break;case"date":ft(r,"date",n.message,e);break;case"time":ft(r,"time",n.message,e);break;case"duration":ft(r,"duration",n.message,e);break;case"length":K(r,"minLength",typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,n.message,e),K(r,"maxLength",typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value,n.message,e);break;case"includes":{Me(r,RegExp(qu(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&ft(r,"ipv4",n.message,e),n.version!=="v4"&&ft(r,"ipv6",n.message,e);break}case"base64url":Me(r,dt.base64url,n.message,e);break;case"jwt":Me(r,dt.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&Me(r,dt.ipv4Cidr,n.message,e),n.version!=="v4"&&Me(r,dt.ipv6Cidr,n.message,e);break}case"emoji":Me(r,dt.emoji(),n.message,e);break;case"ulid":{Me(r,dt.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{ft(r,"binary",n.message,e);break}case"contentEncoding:base64":{K(r,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{Me(r,dt.base64,n.message,e);break}}break}case"nanoid":Me(r,dt.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return r}function qu(t,e){return e.patternStrategy==="escape"?Pw(t):t}var Tw=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Pw(t){let e="";for(let r=0;r<t.length;r++)Tw.has(t[r])||(e+="\\"),e+=t[r];return e}function ft(t,e,r,n){t.format||t.anyOf?.some(o=>o.format)?(t.anyOf||(t.anyOf=[]),t.format&&(t.anyOf.push({format:t.format,...t.errorMessage&&n.errorMessages&&{errorMessage:{format:t.errorMessage.format}}}),delete t.format,t.errorMessage&&(delete t.errorMessage.format,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.anyOf.push({format:e,...r&&n.errorMessages&&{errorMessage:{format:r}}})):K(t,"format",e,r,n)}function Me(t,e,r,n){t.pattern||t.allOf?.some(o=>o.pattern)?(t.allOf||(t.allOf=[]),t.pattern&&(t.allOf.push({pattern:t.pattern,...t.errorMessage&&n.errorMessages&&{errorMessage:{pattern:t.errorMessage.pattern}}}),delete t.pattern,t.errorMessage&&(delete t.errorMessage.pattern,Object.keys(t.errorMessage).length===0&&delete t.errorMessage)),t.allOf.push({pattern:Zm(e,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):K(t,"pattern",Zm(e,n),r,n)}function Zm(t,e){if(!e.applyRegexFlags||!t.flags)return t.source;let r={i:t.flags.includes("i"),m:t.flags.includes("m"),s:t.flags.includes("s")},n=r.i?t.source.toLowerCase():t.source,o="",s=!1,i=!1,a=!1;for(let c=0;c<n.length;c++){if(s){o+=n[c],s=!1;continue}if(r.i){if(i){if(n[c].match(/[a-z]/)){a?(o+=n[c],o+=`${n[c-2]}-${n[c]}`.toUpperCase(),a=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(o+=n[c],a=!0):o+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){o+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(r.m){if(n[c]==="^"){o+=`(^|(?<=[\r
|
|
44
44
|
]))`;continue}else if(n[c]==="$"){o+=`($|(?=[\r
|
|
45
45
|
]))`;continue}}if(r.s&&n[c]==="."){o+=i?`${n[c]}\r
|
|
46
46
|
`:`[${n[c]}\r
|
|
47
|
-
]`;continue}o+=n[c],n[c]==="\\"?s=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}function Ys(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===$.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:A(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:A(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===$.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Js(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===$.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===$.ZodBranded&&t.keyType._def.type._def.typeName===$.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Ks(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function Cm(t,e){if(e.mapStrategy==="record")return Ys(t,e);let r=A(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),n=A(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Zm(t){let e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),o=Array.from(new Set(n.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function jm(t){return t.target==="openAi"?void 0:{not:fe({...t,currentPath:[...t.currentPath,"not"]})}}function Mm(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var mo={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Dm(t,e){if(e.target==="openApi3")return Am(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in mo&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=mo[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(s=>!n.includes(s))],[])};return Am(t,e)}var Am=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>A(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function qm(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:mo[t.innerType._def.typeName],nullable:!0}:{type:[mo[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=A(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=A(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Lm(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",Mu(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?K(r,"minimum",n.value,n.message,e):K(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),K(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?K(r,"maximum",n.value,n.message,e):K(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),K(r,"maximum",n.value,n.message,e));break;case"multipleOf":K(r,"multipleOf",n.value,n.message,e);break}return r}function Um(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],s=t.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=Tw(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let l=A(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});l!==void 0&&(n.properties[a]=l,u||o.push(a))}o.length&&(n.required=o);let i=Ew(t,e);return i!==void 0&&(n.additionalProperties=i),n}function Ew(t,e){if(t.catchall._def.typeName!=="ZodNever")return A(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Tw(t){try{return t.isOptional()}catch{return!0}}var Fm=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return A(t.innerType._def,e);let r=A(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:fe(e)},r]}:fe(e)};var Vm=(t,e)=>{if(e.pipeStrategy==="input")return A(t.in._def,e);if(e.pipeStrategy==="output")return A(t.out._def,e);let r=A(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=A(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function Bm(t,e){return A(t.type._def,e)}function Hm(t,e){let n={type:"array",uniqueItems:!0,items:A(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&K(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&K(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Wm(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>A(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:A(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>A(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Gm(t){return{not:fe(t)}}function Km(t){return fe(t)}var Jm=(t,e)=>A(t.innerType._def,e);var Ym=(t,e,r)=>{switch(e){case $.ZodString:return Js(t,r);case $.ZodNumber:return Lm(t,r);case $.ZodObject:return Um(t,r);case $.ZodBigInt:return Sm(t,r);case $.ZodBoolean:return zm();case $.ZodDate:return Au(t,r);case $.ZodUndefined:return Gm(r);case $.ZodNull:return Mm(r);case $.ZodArray:return km(t,r);case $.ZodUnion:case $.ZodDiscriminatedUnion:return Dm(t,r);case $.ZodIntersection:return Im(t,r);case $.ZodTuple:return Wm(t,r);case $.ZodRecord:return Ys(t,r);case $.ZodLiteral:return Om(t,r);case $.ZodEnum:return Rm(t);case $.ZodNativeEnum:return Zm(t);case $.ZodNullable:return qm(t,r);case $.ZodOptional:return Fm(t,r);case $.ZodMap:return Cm(t,r);case $.ZodSet:return Hm(t,r);case $.ZodLazy:return()=>t.getter()._def;case $.ZodPromise:return Bm(t,r);case $.ZodNaN:case $.ZodNever:return jm(r);case $.ZodEffects:return Pm(t,r);case $.ZodAny:return fe(r);case $.ZodUnknown:return Km(r);case $.ZodDefault:return Tm(t,r);case $.ZodBranded:return Ks(t,r);case $.ZodReadonly:return Jm(t,r);case $.ZodCatch:return Em(t,r);case $.ZodPipeline:return Vm(t,r);case $.ZodFunction:case $.ZodVoid:case $.ZodSymbol:return;default:return(n=>{})(e)}};function A(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==xm)return a}if(n&&!r){let a=Pw(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let s=Ym(t,t.typeName,e),i=typeof s=="function"?A(s(),e):s;if(i&&Rw(t,e,i),e.postProcess){let a=e.postProcess(i,t,e);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var Pw=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Gs(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},Rw=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var Lu=(t,e)=>{let r=$m(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,l])=>({...c,[u]:A(l._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??fe(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=A(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??fe(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(s.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function Iw(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function Uu(t,e){return Qe(t)?cu(t,{target:Iw(e?.target),io:e?.pipeStrategy??"input"}):Lu(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function Fu(t){let r=Xt(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=$s(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Vu(t,e){let r=Yt(t,e);if(!r.success)throw r.error;return r.data}var Ow=6e4,Xs=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(Rs,r=>{this._oncancel(r)}),this.setNotificationHandler(Os,r=>{this._onprogress(r)}),this.setRequestHandler(Is,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ns,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Zs,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else{let d=c,h=new R(d.error.code,d.error.message,d.error.data);l(h)}else{let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new R(C.InvalidParams,`Task not found: ${s}`);if(!er(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(er(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Qt]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(js,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new R(C.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(As,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(C.InvalidParams,`Task not found: ${r.params.taskId}`);if(er(o.status))throw new R(C.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 s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new R(C.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof R?o:new R(C.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,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,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),R.fromError(C.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=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),so(s)||um(s)?this._onresponse(s):wu(s)?this._onrequest(s,i):cm(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=R.fromError(C.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,s=e.params?._meta?.[Qt]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:C.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{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 i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=sm(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d)},sendRequest:async(l,d,h)=>{let m={...h,relatedRequestId:e.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let f=m.relatedTask?.taskId??s;return f&&c&&await c.updateTaskStatus(f,"input_required"),await this.request(l,d,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d)},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:C.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{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),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),so(e))n(e);else{let i=new R(e.error.code,e.error.message,e.error.data);n(i)}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 s=!1;if(so(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),so(e))o(e);else{let i=R.fromError(e.error.code,e.error.message,e.error.data);o(i)}}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(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}return}let s;try{let i=await this.request(e,sn,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(C.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},er(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new R(C.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(C.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=b=>{l(b)};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(b){d(b);return}n?.signal?.throwIfAborted();let h=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:h};n?.onprogress&&(this._progressHandlers.set(h,n.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:h}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Qt]:c}});let f=b=>{this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(b)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(E=>this._onerror(new Error(`Failed to send cancellation: ${E}`)));let w=b instanceof R?b:new R(C.RequestTimeout,String(b));l(w)};this._responseHandlers.set(h,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return l(b);try{let w=Yt(r,b.result);w.success?u(w.data):l(w.error)}catch(w){l(w)}}}),n?.signal?.addEventListener("abort",()=>{f(n?.signal?.reason)});let p=n?.timeout??Ow,g=()=>f(R.fromError(C.RequestTimeout,"Request timed out",{timeout:p}));this._setupTimeout(h,p,n?.maxTotalTimeout,g,n?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let b=w=>{let E=this._responseHandlers.get(h);E?E(w):this._onerror(new Error(`Response handler missing for side-channeled request ${h}`))};this._requestResolvers.set(h,b),this._enqueueTaskMessage(v,{type:"request",message:m,timestamp:Date.now()}).catch(w=>{this._cleanupTimeout(h),l(w)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(b=>{this._cleanupTimeout(h),l(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Cs,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},Ms,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},fm,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 a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Qt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,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 a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Qt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Qt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let n=Fu(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=Vu(e,o);return Promise.resolve(r(i,s))})}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=Fu(e);this._notificationHandlers.set(n,o=>{let s=Vu(e,o);return Promise.resolve(r(s))})}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"&&wu(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new R(C.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} 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,s)=>{if(r.aborted){s(new R(C.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(C.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 s=await n.getTask(o,r);if(!s)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=lo.parse({method:"notifications/tasks/status",params:a});await this.notification(c),er(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new R(C.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(er(a.status))throw new R(C.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=lo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),er(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function Xm(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Qm(t,e){let r={...t};for(let n in e){let o=n,s=e[o];if(s===void 0)continue;let i=r[o];Xm(i)&&Xm(s)?r[o]={...i,...s}:r[o]=s}return r}var B_=mr(Td(),1),H_=mr(V_(),1);function bT(){let t=new B_.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,H_.default)(t),t}var Ci=class{constructor(e){this._ajv=e??bT()}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 Zi=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 W_(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 G_(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 ji=class extends Xs{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(po.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Ci,this.setRequestHandler(Su,n=>this._oninitialize(n)),this.setNotificationHandler(zu,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Nu,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=po.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Zi(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Qm(this._capabilities,e)}setRequestHandler(e,r){let o=Xt(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let s;if(Qe(o)){let a=o;s=a._zod?.def?.value??a.value}else{let a=o;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=Yt(cn,c);if(!l.success){let f=l.error instanceof Error?l.error.message:String(l.error);throw new R(C.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:d}=l.data,h=await Promise.resolve(r(c,u));if(d.task){let f=Yt(sn,h);if(!f.success){let p=f.error instanceof Error?f.error.message:String(f.error);throw new R(C.InvalidParams,`Invalid task creation result: ${p}`)}return f.data}let m=Yt(Bs,h);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new R(C.InvalidParams,`Invalid tools/call result: ${f}`)}return m.data};return super.setRequestHandler(e,a)}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){G_(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&W_(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:rm.includes(r)?r:bu,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"},Ps)}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],s=o.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){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(a.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},Zu,r):this.request({method:"sampling/createMessage",params:e},Cu,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},Hs,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"},s=await this.request({method:"elicitation/create",params:o},Hs,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new R(C.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(C.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}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},ju,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 J_=Symbol.for("mcp.completable");function jd(t){return!!t&&typeof t=="object"&&J_ in t}function Y_(t){return t[J_]?.complete}var K_;(function(t){t.Completable="McpCompletable"})(K_||(K_={}));var xT=/^[A-Za-z0-9._-]{1,128}$/;function wT(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!xT.test(t)){let r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,s)=>s.indexOf(n)===o);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function $T(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Md(t){let e=wT(t);return $T(t,e.warnings),e.isValid}var Mi=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,n){let o={taskSupport:"required",...r.execution};if(o.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,o,r._meta,n)}};var Ai=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new ji(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Mi(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(ur(Vs)),this.server.assertCanSetRequestHandler(ur(cn)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Vs,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:(()=>{let o=nn(r.inputSchema);return o?Uu(o,{strictUnions:!0,pipeStrategy:"input"}):kT})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let o=nn(r.outputSchema);o&&(n.outputSchema=Uu(o,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(cn,async(e,r)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new R(C.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new R(C.InvalidParams,`Tool ${e.params.name} disabled`);let o=!!e.params.task,s=n.execution?.taskSupport,i="createTask"in n.handler;if((s==="required"||s==="optional")&&!i)throw new R(C.InternalError,`Tool ${e.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!o)throw new R(C.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!o&&i)return await this.handleAutomaticTaskPolling(n,e,r);let a=await this.validateToolInput(n,e.params.arguments,e.params.name),c=await this.executeToolHandler(n,a,r);return o||await this.validateToolOutput(n,c,e.params.name),c}catch(n){if(n instanceof R&&n.code===C.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,n){if(!e.inputSchema)return;let s=nn(e.inputSchema)??e.inputSchema,i=await xs(s,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=ws(a);throw new R(C.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return i.data}async validateToolOutput(e,r,n){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new R(C.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let o=nn(e.outputSchema),s=await xs(o,r.structuredContent);if(!s.success){let i="error"in s?s.error:"Unknown error",a=ws(i);throw new R(C.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(e,r,n){let o=e.handler;if("createTask"in o){if(!n.taskStore)throw new Error("No task store provided.");let i={...n,taskStore:n.taskStore};if(e.inputSchema){let a=o;return await Promise.resolve(a.createTask(r,i))}else{let a=o;return await Promise.resolve(a.createTask(i))}}if(e.inputSchema){let i=o;return await Promise.resolve(i(r,n))}else{let i=o;return await Promise.resolve(i(n))}}async handleAutomaticTaskPolling(e,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(e,r.params.arguments,r.params.name),s=e.handler,i={...n,taskStore:n.taskStore},a=o?await Promise.resolve(s.createTask(o,i)):await Promise.resolve(s.createTask(i)),c=a.task.taskId,u=a.task,l=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(h=>setTimeout(h,l));let d=await n.taskStore.getTask(c);if(!d)throw new R(C.InternalError,`Task ${c} not found during polling`);u=d}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(ur(Ws)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ws,async e=>{switch(e.params.ref.type){case"ref/prompt":return ym(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return vm(e),this.handleResourceCompletion(e,e.params.ref);default:throw new R(C.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new R(C.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new R(C.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Vo;let s=Xt(n.argsSchema)?.[e.params.argument.name];if(!jd(s))return Vo;let i=Y_(s);if(!i)return Vo;let a=await i(e.params.argument.value,e.params.context);return Q_(a)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Vo;throw new R(C.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=n.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return Vo;let s=await o(e.params.argument.value,e.params.context);return Q_(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(ur(Ds)),this.server.assertCanSetRequestHandler(ur(qs)),this.server.assertCanSetRequestHandler(ur(Ls)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ds,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([s,i])=>i.enabled).map(([s,i])=>({uri:s,name:i.name,...i.metadata})),o=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let i=await s.resourceTemplate.listCallback(r);for(let a of i.resources)o.push({...s.metadata,...a})}return{resources:[...n,...o]}}),this.server.setRequestHandler(qs,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Ls,async(e,r)=>{let n=new URL(e.params.uri),o=this._registeredResources[n.toString()];if(o){if(!o.enabled)throw new R(C.InvalidParams,`Resource ${n} disabled`);return o.readCallback(n,r)}for(let s of Object.values(this._registeredResourceTemplates)){let i=s.resourceTemplate.uriTemplate.match(n.toString());if(i)return s.readCallback(n,i,r)}throw new R(C.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(ur(Us)),this.server.assertCanSetRequestHandler(ur(Fs)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Us,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?zT(r.argsSchema):void 0}))})),this.server.setRequestHandler(Fs,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new R(C.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new R(C.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let o=nn(n.argsSchema),s=await xs(o,e.params.arguments);if(!s.success){let c="error"in s?s.error:"Unknown error",u=ws(c);throw new R(C.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${u}`)}let i=s.data,a=n.callback;return await Promise.resolve(a(i,r))}else{let o=n.callback;return await Promise.resolve(o(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...n){let o;typeof n[0]=="object"&&(o=n.shift());let s=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,o,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,o,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,n,o){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,r,n,o,s){let i={name:e,title:r,metadata:o,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,r,n,o,s){let i={resourceTemplate:n,title:r,metadata:o,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredResourceTemplates[e],u.name&&(this._registeredResourceTemplates[u.name]=i)),typeof u.title<"u"&&(i.title=u.title),typeof u.template<"u"&&(i.resourceTemplate=u.template),typeof u.metadata<"u"&&(i.metadata=u.metadata),typeof u.callback<"u"&&(i.readCallback=u.callback),typeof u.enabled<"u"&&(i.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!n.completeCallback(u))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,r,n,o,s){let i={title:r,description:n,argsSchema:o===void 0?void 0:$r(o),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=$r(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,o&&Object.values(o).some(c=>{let u=c instanceof He?c._def?.innerType:c;return jd(u)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,r,n,o,s,i,a,c,u){Md(e);let l={title:r,description:n,inputSchema:X_(o),outputSchema:X_(s),annotations:i,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>l.update({enabled:!1}),enable:()=>l.update({enabled:!0}),remove:()=>l.update({name:null}),update:d=>{typeof d.name<"u"&&d.name!==e&&(typeof d.name=="string"&&Md(d.name),delete this._registeredTools[e],d.name&&(this._registeredTools[d.name]=l)),typeof d.title<"u"&&(l.title=d.title),typeof d.description<"u"&&(l.description=d.description),typeof d.paramsSchema<"u"&&(l.inputSchema=$r(d.paramsSchema)),typeof d.outputSchema<"u"&&(l.outputSchema=$r(d.outputSchema)),typeof d.callback<"u"&&(l.handler=d.callback),typeof d.annotations<"u"&&(l.annotations=d.annotations),typeof d._meta<"u"&&(l._meta=d._meta),typeof d.enabled<"u"&&(l.enabled=d.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=l,this.setToolRequestHandlers(),this.sendToolListChanged(),l}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,o,s,i;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];Ad(c)?(o=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Ad(r[0])&&(i=r.shift())):typeof c=="object"&&c!==null&&(i=r.shift())}let a=r[0];return this._createRegisteredTool(e,void 0,n,o,s,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:s,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,o,s,i,a,c,{taskSupport:"forbidden"},u,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let o;r.length>1&&(o=r.shift());let s=r[0],i=this._createRegisteredPrompt(e,void 0,n,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:s,argsSchema:i}=r,a=this._createRegisteredPrompt(e,o,s,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var kT={type:"object",properties:{}};function ey(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function ST(t){return"_def"in t||"_zod"in t||ey(t)}function Ad(t){return typeof t!="object"||t===null||ST(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(ey)}function X_(t){if(t)return Ad(t)?$r(t):t}function zT(t){let e=Xt(t);return e?Object.entries(e).map(([r,n])=>{let o=Np(n),s=Cp(n);return{name:r,description:o,required:!s}}):[]}function ur(t){let r=Xt(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=$s(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function Q_(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var Vo={completion:{values:[],hasMore:!1}};import ry from"node:process";var Di=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
48
|
-
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),
|
|
49
|
-
`}var qi=class{constructor(e=
|
|
50
|
-
`).find(c=>c.trim().length>0)||e).replace(/^[#*\->\s]+/,"").trim();s=a.length>50?a.substring(0,47)+"...":a,s||(s="Agent"),ta=s}else ta=s;return new Promise((i,a)=>{let c=setTimeout(()=>{
|
|
47
|
+
]`;continue}o+=n[c],n[c]==="\\"?s=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),t.source}return o}function Ys(t,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&t.keyType?._def.typeName===$.ZodEnum)return{type:"object",required:t.keyType._def.values,properties:t.keyType._def.values.reduce((n,o)=>({...n,[o]:A(t.valueType._def,{...e,currentPath:[...e.currentPath,"properties",o]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let r={type:"object",additionalProperties:A(t.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return r;if(t.keyType?._def.typeName===$.ZodString&&t.keyType._def.checks?.length){let{type:n,...o}=Js(t.keyType._def,e);return{...r,propertyNames:o}}else{if(t.keyType?._def.typeName===$.ZodEnum)return{...r,propertyNames:{enum:t.keyType._def.values}};if(t.keyType?._def.typeName===$.ZodBranded&&t.keyType._def.type._def.typeName===$.ZodString&&t.keyType._def.type._def.checks?.length){let{type:n,...o}=Ks(t.keyType._def,e);return{...r,propertyNames:o}}}return r}function jm(t,e){if(e.mapStrategy==="record")return Ys(t,e);let r=A(t.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),n=A(t.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Mm(t){let e=t.values,n=Object.keys(t.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),o=Array.from(new Set(n.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function Am(t){return t.target==="openAi"?void 0:{not:fe({...t,currentPath:[...t.currentPath,"not"]})}}function Dm(t){return t.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var mo={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Lm(t,e){if(e.target==="openApi3")return qm(t,e);let r=t.options instanceof Map?Array.from(t.options.values()):t.options;if(r.every(n=>n._def.typeName in mo&&(!n._def.checks||!n._def.checks.length))){let n=r.reduce((o,s)=>{let i=mo[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=r.reduce((o,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];default:return o}},[]);if(n.length===r.length){let o=n.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(s=>!n.includes(s))],[])};return qm(t,e)}var qm=(t,e)=>{let r=(t.options instanceof Map?Array.from(t.options.values()):t.options).map((n,o)=>A(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Um(t,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(t.innerType._def.typeName)&&(!t.innerType._def.checks||!t.innerType._def.checks.length))return e.target==="openApi3"?{type:mo[t.innerType._def.typeName],nullable:!0}:{type:[mo[t.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=A(t.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let r=A(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Fm(t,e){let r={type:"number"};if(!t.checks)return r;for(let n of t.checks)switch(n.kind){case"int":r.type="integer",Mu(r,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?K(r,"minimum",n.value,n.message,e):K(r,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(r.exclusiveMinimum=!0),K(r,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?K(r,"maximum",n.value,n.message,e):K(r,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(r.exclusiveMaximum=!0),K(r,"maximum",n.value,n.message,e));break;case"multipleOf":K(r,"multipleOf",n.value,n.message,e);break}return r}function Vm(t,e){let r=e.target==="openAi",n={type:"object",properties:{}},o=[],s=t.shape();for(let a in s){let c=s[a];if(c===void 0||c._def===void 0)continue;let u=Iw(c);u&&r&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),u=!1);let d=A(c._def,{...e,currentPath:[...e.currentPath,"properties",a],propertyPath:[...e.currentPath,"properties",a]});d!==void 0&&(n.properties[a]=d,u||o.push(a))}o.length&&(n.required=o);let i=Rw(t,e);return i!==void 0&&(n.additionalProperties=i),n}function Rw(t,e){if(t.catchall._def.typeName!=="ZodNever")return A(t.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(t.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Iw(t){try{return t.isOptional()}catch{return!0}}var Bm=(t,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return A(t.innerType._def,e);let r=A(t.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return r?{anyOf:[{not:fe(e)},r]}:fe(e)};var Hm=(t,e)=>{if(e.pipeStrategy==="input")return A(t.in._def,e);if(e.pipeStrategy==="output")return A(t.out._def,e);let r=A(t.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=A(t.out._def,{...e,currentPath:[...e.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function Wm(t,e){return A(t.type._def,e)}function Gm(t,e){let n={type:"array",uniqueItems:!0,items:A(t.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return t.minSize&&K(n,"minItems",t.minSize.value,t.minSize.message,e),t.maxSize&&K(n,"maxItems",t.maxSize.value,t.maxSize.message,e),n}function Km(t,e){return t.rest?{type:"array",minItems:t.items.length,items:t.items.map((r,n)=>A(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:A(t.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:t.items.length,maxItems:t.items.length,items:t.items.map((r,n)=>A(r._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Jm(t){return{not:fe(t)}}function Ym(t){return fe(t)}var Xm=(t,e)=>A(t.innerType._def,e);var Qm=(t,e,r)=>{switch(e){case $.ZodString:return Js(t,r);case $.ZodNumber:return Fm(t,r);case $.ZodObject:return Vm(t,r);case $.ZodBigInt:return Em(t,r);case $.ZodBoolean:return Tm();case $.ZodDate:return Au(t,r);case $.ZodUndefined:return Jm(r);case $.ZodNull:return Dm(r);case $.ZodArray:return zm(t,r);case $.ZodUnion:case $.ZodDiscriminatedUnion:return Lm(t,r);case $.ZodIntersection:return Nm(t,r);case $.ZodTuple:return Km(t,r);case $.ZodRecord:return Ys(t,r);case $.ZodLiteral:return Cm(t,r);case $.ZodEnum:return Om(t);case $.ZodNativeEnum:return Mm(t);case $.ZodNullable:return Um(t,r);case $.ZodOptional:return Bm(t,r);case $.ZodMap:return jm(t,r);case $.ZodSet:return Gm(t,r);case $.ZodLazy:return()=>t.getter()._def;case $.ZodPromise:return Wm(t,r);case $.ZodNaN:case $.ZodNever:return Am(r);case $.ZodEffects:return Im(t,r);case $.ZodAny:return fe(r);case $.ZodUnknown:return Ym(r);case $.ZodDefault:return Rm(t,r);case $.ZodBranded:return Ks(t,r);case $.ZodReadonly:return Xm(t,r);case $.ZodCatch:return Pm(t,r);case $.ZodPipeline:return Hm(t,r);case $.ZodFunction:case $.ZodVoid:case $.ZodSymbol:return;default:return(n=>{})(e)}};function A(t,e,r=!1){let n=e.seen.get(t);if(e.override){let a=e.override?.(t,e,n,r);if(a!==$m)return a}if(n&&!r){let a=Ow(n,e);if(a!==void 0)return a}let o={def:t,path:e.currentPath,jsonSchema:void 0};e.seen.set(t,o);let s=Qm(t,t.typeName,e),i=typeof s=="function"?A(s(),e):s;if(i&&Nw(t,e,i),e.postProcess){let a=e.postProcess(i,t,e);return o.jsonSchema=i,a}return o.jsonSchema=i,i}var Ow=(t,e)=>{switch(e.$refStrategy){case"root":return{$ref:t.path.join("/")};case"relative":return{$ref:Gs(e.currentPath,t.path)};case"none":case"seen":return t.path.length<e.currentPath.length&&t.path.every((r,n)=>e.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},Nw=(t,e,r)=>(t.description&&(r.description=t.description,e.markdownDescription&&(r.markdownDescription=t.description)),r);var Lu=(t,e)=>{let r=Sm(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[u,d])=>({...c,[u]:A(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??fe(r)}),{}):void 0,o=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=A(t._def,o===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,o]},!1)??fe(r),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(s.title=i),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));let a=o===void 0?n?{...s,[r.definitionPath]:n}:s:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,o].join("/"),[r.definitionPath]:{...n,[o]:s}};return r.target==="jsonSchema7"?a.$schema="http://json-schema.org/draft-07/schema#":(r.target==="jsonSchema2019-09"||r.target==="openAi")&&(a.$schema="https://json-schema.org/draft/2019-09/schema#"),r.target==="openAi"&&("anyOf"in a||"oneOf"in a||"allOf"in a||"type"in a&&Array.isArray(a.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),a};function Cw(t){return!t||t==="jsonSchema7"||t==="draft-7"?"draft-7":t==="jsonSchema2019-09"||t==="draft-2020-12"?"draft-2020-12":"draft-7"}function Uu(t,e){return et(t)?cu(t,{target:Cw(e?.target),io:e?.pipeStrategy??"input"}):Lu(t,{strictUnions:e?.strictUnions??!0,pipeStrategy:e?.pipeStrategy??"input"})}function Fu(t){let r=Xt(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=$s(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function Vu(t,e){let r=Yt(t,e);if(!r.success)throw r.error;return r.data}var Zw=6e4,Xs=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(Rs,r=>{this._oncancel(r)}),this.setNotificationHandler(Os,r=>{this._onprogress(r)}),this.setRequestHandler(Is,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ns,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Zs,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,d=this._requestResolvers.get(u);if(d)if(this._requestResolvers.delete(u),a.type==="response")d(c);else{let l=c,h=new R(l.error.code,l.error.message,l.error.data);d(h)}else{let l=a.type==="response"?"Response":"Error";this._onerror(new Error(`${l} handler missing for request ${u}`))}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId})}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new R(C.InvalidParams,`Task not found: ${s}`);if(!er(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(er(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[Qt]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(js,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return{tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new R(C.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(As,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new R(C.InvalidParams,`Task not found: ${r.params.taskId}`);if(er(o.status))throw new R(C.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 s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new R(C.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return{_meta:{},...s}}catch(o){throw o instanceof R?o:new R(C.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,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,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),R.fromError(C.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=s=>{n?.(s),this._onerror(s)};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),so(s)||dm(s)?this._onresponse(s):wu(s)?this._onrequest(s,i):lm(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let r=R.fromError(C.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,s=e.params?._meta?.[Qt]?.taskId;if(n===void 0){let d={jsonrpc:"2.0",id:e.id,error:{code:C.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},o?.sessionId).catch(l=>this._onerror(new Error(`Failed to enqueue error response: ${l}`))):o?.send(d).catch(l=>this._onerror(new Error(`Failed to send an error response: ${l}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=am(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async d=>{let l={relatedRequestId:e.id};s&&(l.relatedTask={taskId:s}),await this.notification(d,l)},sendRequest:async(d,l,h)=>{let m={...h,relatedRequestId:e.id};s&&!m.relatedTask&&(m.relatedTask={taskId:s});let f=m.relatedTask?.taskId??s;return f&&c&&await c.updateTaskStatus(f,"input_required"),await this.request(d,l,m)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,u)).then(async d=>{if(i.signal.aborted)return;let l={result:d,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:l,timestamp:Date.now()},o?.sessionId):await o?.send(l)},async d=>{if(i.signal.aborted)return;let l={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(d.code)?d.code:C.InternalError,message:d.message??"Internal error",...d.data!==void 0&&{data:d.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},o?.sessionId):await o?.send(l)}).catch(d=>this._onerror(new Error(`Failed to send response: ${d}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n)}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),so(e))n(e);else{let i=new R(e.error.code,e.error.message,e.error.data);n(i)}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 s=!1;if(so(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=!0,this._taskProgressTokens.set(a.taskId,r))}}if(s||this._progressHandlers.delete(r),so(e))o(e);else{let i=R.fromError(e.error.code,e.error.message,e.error.data);o(i)}}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(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}return}let s;try{let i=await this.request(e,sn,n);if(i.task)s=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new R(C.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield{type:"taskStatus",task:a},er(a.status)){a.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield{type:"error",error:new R(C.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield{type:"error",error:new R(C.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof R?i:new R(C.InternalError,String(i))}}}request(e,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,d)=>{let l=b=>{d(b)};if(!this._transport){l(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(b){l(b);return}n?.signal?.throwIfAborted();let h=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:h};n?.onprogress&&(this._progressHandlers.set(h,n.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:h}}),a&&(m.params={...m.params,task:a}),c&&(m.params={...m.params,_meta:{...m.params?._meta||{},[Qt]:c}});let f=b=>{this._responseHandlers.delete(h),this._progressHandlers.delete(h),this._cleanupTimeout(h),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:h,reason:String(b)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(E=>this._onerror(new Error(`Failed to send cancellation: ${E}`)));let w=b instanceof R?b:new R(C.RequestTimeout,String(b));d(w)};this._responseHandlers.set(h,b=>{if(!n?.signal?.aborted){if(b instanceof Error)return d(b);try{let w=Yt(r,b.result);w.success?u(w.data):d(w.error)}catch(w){d(w)}}}),n?.signal?.addEventListener("abort",()=>{f(n?.signal?.reason)});let p=n?.timeout??Zw,g=()=>f(R.fromError(C.RequestTimeout,"Request timed out",{timeout:p}));this._setupTimeout(h,p,n?.maxTotalTimeout,g,n?.resetTimeoutOnProgress??!1);let v=c?.taskId;if(v){let b=w=>{let E=this._responseHandlers.get(h);E?E(w):this._onerror(new Error(`Response handler missing for side-channeled request ${h}`))};this._requestResolvers.set(h,b),this._enqueueTaskMessage(v,{type:"request",message:m,timestamp:Date.now()}).catch(w=>{this._cleanupTimeout(h),d(w)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(b=>{this._cleanupTimeout(h),d(b)})})}async getTask(e,r){return this.request({method:"tasks/get",params:e},Cs,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},Ms,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},mm,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 a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[Qt]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,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 a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[Qt]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c))});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[Qt]:r.relatedTask}}}),await this._transport.send(i,r)}setRequestHandler(e,r){let n=Fu(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=Vu(e,o);return Promise.resolve(r(i,s))})}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=Fu(e);this._notificationHandlers.set(n,o=>{let s=Vu(e,o);return Promise.resolve(r(s))})}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"&&wu(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new R(C.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} 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,s)=>{if(r.aborted){s(new R(C.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new R(C.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 s=await n.getTask(o,r);if(!s)throw new R(C.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=lo.parse({method:"notifications/tasks/status",params:a});await this.notification(c),er(a.status)&&this._cleanupTaskProgressHandler(o)}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new R(C.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(er(a.status))throw new R(C.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=lo.parse({method:"notifications/tasks/status",params:c});await this.notification(u),er(c.status)&&this._cleanupTaskProgressHandler(o)}},listTasks:o=>n.listTasks(o,r)}}};function eh(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function th(t,e){let r={...t};for(let n in e){let o=n,s=e[o];if(s===void 0)continue;let i=r[o];eh(i)&&eh(s)?r[o]={...i,...s}:r[o]=s}return r}var W_=mr(Td(),1),G_=mr(H_(),1);function $T(){let t=new W_.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,G_.default)(t),t}var Ci=class{constructor(e){this._ajv=e??$T()}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 Zi=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 K_(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 J_(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 ji=class extends Xs{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(po.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):!1},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Ci,this.setRequestHandler(Su,n=>this._oninitialize(n)),this.setNotificationHandler(zu,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Nu,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=po.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Zi(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=th(this._capabilities,e)}setRequestHandler(e,r){let o=Xt(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let s;if(et(o)){let a=o;s=a._zod?.def?.value??a.value}else{let a=o;s=a._def?.value??a.value}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let d=Yt(cn,c);if(!d.success){let f=d.error instanceof Error?d.error.message:String(d.error);throw new R(C.InvalidParams,`Invalid tools/call request: ${f}`)}let{params:l}=d.data,h=await Promise.resolve(r(c,u));if(l.task){let f=Yt(sn,h);if(!f.success){let p=f.error instanceof Error?f.error.message:String(f.error);throw new R(C.InvalidParams,`Invalid task creation result: ${p}`)}return f.data}let m=Yt(Bs,h);if(!m.success){let f=m.error instanceof Error?m.error.message:String(m.error);throw new R(C.InvalidParams,`Invalid tools/call result: ${f}`)}return m.data};return super.setRequestHandler(e,a)}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){J_(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&K_(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:om.includes(r)?r:bu,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"},Ps)}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],s=o.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){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(a.filter(l=>l.type==="tool_use").map(l=>l.id)),d=new Set(o.filter(l=>l.type==="tool_result").map(l=>l.toolUseId));if(u.size!==d.size||![...u].every(l=>d.has(l)))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},Zu,r):this.request({method:"sampling/createMessage",params:e},Cu,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},Hs,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"},s=await this.request({method:"elicitation/create",params:o},Hs,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new R(C.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof R?i:new R(C.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}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},ju,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 X_=Symbol.for("mcp.completable");function jd(t){return!!t&&typeof t=="object"&&X_ in t}function Q_(t){return t[X_]?.complete}var Y_;(function(t){t.Completable="McpCompletable"})(Y_||(Y_={}));var kT=/^[A-Za-z0-9._-]{1,128}$/;function ST(t){let e=[];if(t.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(t.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${t.length})`]};if(t.includes(" ")&&e.push("Tool name contains spaces, which may cause parsing issues"),t.includes(",")&&e.push("Tool name contains commas, which may cause parsing issues"),(t.startsWith("-")||t.endsWith("-"))&&e.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(t.startsWith(".")||t.endsWith("."))&&e.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!kT.test(t)){let r=t.split("").filter(n=>!/[A-Za-z0-9._-]/.test(n)).filter((n,o,s)=>s.indexOf(n)===o);return e.push(`Tool name contains invalid characters: ${r.map(n=>`"${n}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:e}}return{isValid:!0,warnings:e}}function zT(t,e){if(e.length>0){console.warn(`Tool name validation warning for "${t}":`);for(let r of e)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function Md(t){let e=ST(t);return zT(t,e.warnings),e.isValid}var Mi=class{constructor(e){this._mcpServer=e}registerToolTask(e,r,n){let o={taskSupport:"required",...r.execution};if(o.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,o,r._meta,n)}};var Ai=class{constructor(e,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new ji(e,r)}get experimental(){return this._experimental||(this._experimental={tasks:new Mi(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(ur(Vs)),this.server.assertCanSetRequestHandler(ur(cn)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Vs,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,r])=>{let n={name:e,title:r.title,description:r.description,inputSchema:(()=>{let o=nn(r.inputSchema);return o?Uu(o,{strictUnions:!0,pipeStrategy:"input"}):ET})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let o=nn(r.outputSchema);o&&(n.outputSchema=Uu(o,{strictUnions:!0,pipeStrategy:"output"}))}return n})})),this.server.setRequestHandler(cn,async(e,r)=>{try{let n=this._registeredTools[e.params.name];if(!n)throw new R(C.InvalidParams,`Tool ${e.params.name} not found`);if(!n.enabled)throw new R(C.InvalidParams,`Tool ${e.params.name} disabled`);let o=!!e.params.task,s=n.execution?.taskSupport,i="createTask"in n.handler;if((s==="required"||s==="optional")&&!i)throw new R(C.InternalError,`Tool ${e.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if(s==="required"&&!o)throw new R(C.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(s==="optional"&&!o&&i)return await this.handleAutomaticTaskPolling(n,e,r);let a=await this.validateToolInput(n,e.params.arguments,e.params.name),c=await this.executeToolHandler(n,a,r);return o||await this.validateToolOutput(n,c,e.params.name),c}catch(n){if(n instanceof R&&n.code===C.UrlElicitationRequired)throw n;return this.createToolError(n instanceof Error?n.message:String(n))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,r,n){if(!e.inputSchema)return;let s=nn(e.inputSchema)??e.inputSchema,i=await xs(s,r);if(!i.success){let a="error"in i?i.error:"Unknown error",c=ws(a);throw new R(C.InvalidParams,`Input validation error: Invalid arguments for tool ${n}: ${c}`)}return i.data}async validateToolOutput(e,r,n){if(!e.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new R(C.InvalidParams,`Output validation error: Tool ${n} has an output schema but no structured content was provided`);let o=nn(e.outputSchema),s=await xs(o,r.structuredContent);if(!s.success){let i="error"in s?s.error:"Unknown error",a=ws(i);throw new R(C.InvalidParams,`Output validation error: Invalid structured content for tool ${n}: ${a}`)}}async executeToolHandler(e,r,n){let o=e.handler;if("createTask"in o){if(!n.taskStore)throw new Error("No task store provided.");let i={...n,taskStore:n.taskStore};if(e.inputSchema){let a=o;return await Promise.resolve(a.createTask(r,i))}else{let a=o;return await Promise.resolve(a.createTask(i))}}if(e.inputSchema){let i=o;return await Promise.resolve(i(r,n))}else{let i=o;return await Promise.resolve(i(n))}}async handleAutomaticTaskPolling(e,r,n){if(!n.taskStore)throw new Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(e,r.params.arguments,r.params.name),s=e.handler,i={...n,taskStore:n.taskStore},a=o?await Promise.resolve(s.createTask(o,i)):await Promise.resolve(s.createTask(i)),c=a.task.taskId,u=a.task,d=u.pollInterval??5e3;for(;u.status!=="completed"&&u.status!=="failed"&&u.status!=="cancelled";){await new Promise(h=>setTimeout(h,d));let l=await n.taskStore.getTask(c);if(!l)throw new R(C.InternalError,`Task ${c} not found during polling`);u=l}return await n.taskStore.getTaskResult(c)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(ur(Ws)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Ws,async e=>{switch(e.params.ref.type){case"ref/prompt":return bm(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return xm(e),this.handleResourceCompletion(e,e.params.ref);default:throw new R(C.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,r){let n=this._registeredPrompts[r.name];if(!n)throw new R(C.InvalidParams,`Prompt ${r.name} not found`);if(!n.enabled)throw new R(C.InvalidParams,`Prompt ${r.name} disabled`);if(!n.argsSchema)return Vo;let s=Xt(n.argsSchema)?.[e.params.argument.name];if(!jd(s))return Vo;let i=Q_(s);if(!i)return Vo;let a=await i(e.params.argument.value,e.params.context);return ty(a)}async handleResourceCompletion(e,r){let n=Object.values(this._registeredResourceTemplates).find(i=>i.resourceTemplate.uriTemplate.toString()===r.uri);if(!n){if(this._registeredResources[r.uri])return Vo;throw new R(C.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=n.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return Vo;let s=await o(e.params.argument.value,e.params.context);return ty(s)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(ur(Ds)),this.server.assertCanSetRequestHandler(ur(qs)),this.server.assertCanSetRequestHandler(ur(Ls)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Ds,async(e,r)=>{let n=Object.entries(this._registeredResources).filter(([s,i])=>i.enabled).map(([s,i])=>({uri:s,name:i.name,...i.metadata})),o=[];for(let s of Object.values(this._registeredResourceTemplates)){if(!s.resourceTemplate.listCallback)continue;let i=await s.resourceTemplate.listCallback(r);for(let a of i.resources)o.push({...s.metadata,...a})}return{resources:[...n,...o]}}),this.server.setRequestHandler(qs,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,n])=>({name:r,uriTemplate:n.resourceTemplate.uriTemplate.toString(),...n.metadata}))})),this.server.setRequestHandler(Ls,async(e,r)=>{let n=new URL(e.params.uri),o=this._registeredResources[n.toString()];if(o){if(!o.enabled)throw new R(C.InvalidParams,`Resource ${n} disabled`);return o.readCallback(n,r)}for(let s of Object.values(this._registeredResourceTemplates)){let i=s.resourceTemplate.uriTemplate.match(n.toString());if(i)return s.readCallback(n,i,r)}throw new R(C.InvalidParams,`Resource ${n} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(ur(Us)),this.server.assertCanSetRequestHandler(ur(Fs)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Us,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,r])=>({name:e,title:r.title,description:r.description,arguments:r.argsSchema?PT(r.argsSchema):void 0}))})),this.server.setRequestHandler(Fs,async(e,r)=>{let n=this._registeredPrompts[e.params.name];if(!n)throw new R(C.InvalidParams,`Prompt ${e.params.name} not found`);if(!n.enabled)throw new R(C.InvalidParams,`Prompt ${e.params.name} disabled`);if(n.argsSchema){let o=nn(n.argsSchema),s=await xs(o,e.params.arguments);if(!s.success){let c="error"in s?s.error:"Unknown error",u=ws(c);throw new R(C.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${u}`)}let i=s.data,a=n.callback;return await Promise.resolve(a(i,r))}else{let o=n.callback;return await Promise.resolve(o(r))}}),this._promptHandlersInitialized=!0)}resource(e,r,...n){let o;typeof n[0]=="object"&&(o=n.shift());let s=n[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let i=this._createRegisteredResource(e,void 0,r,o,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,r,o,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,r,n,o){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(e,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,n.title,r,n,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,r,n,o,s){let i={name:e,title:r,metadata:o,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:a=>{typeof a.uri<"u"&&a.uri!==n&&(delete this._registeredResources[n],a.uri&&(this._registeredResources[a.uri]=i)),typeof a.name<"u"&&(i.name=a.name),typeof a.title<"u"&&(i.title=a.title),typeof a.metadata<"u"&&(i.metadata=a.metadata),typeof a.callback<"u"&&(i.readCallback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendResourceListChanged()}};return this._registeredResources[n]=i,i}_createRegisteredResourceTemplate(e,r,n,o,s){let i={resourceTemplate:n,title:r,metadata:o,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:u=>{typeof u.name<"u"&&u.name!==e&&(delete this._registeredResourceTemplates[e],u.name&&(this._registeredResourceTemplates[u.name]=i)),typeof u.title<"u"&&(i.title=u.title),typeof u.template<"u"&&(i.resourceTemplate=u.template),typeof u.metadata<"u"&&(i.metadata=u.metadata),typeof u.callback<"u"&&(i.readCallback=u.callback),typeof u.enabled<"u"&&(i.enabled=u.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=n.uriTemplate.variableNames;return Array.isArray(a)&&a.some(u=>!!n.completeCallback(u))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,r,n,o,s){let i={title:r,description:n,argsSchema:o===void 0?void 0:$r(o),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:a=>{typeof a.name<"u"&&a.name!==e&&(delete this._registeredPrompts[e],a.name&&(this._registeredPrompts[a.name]=i)),typeof a.title<"u"&&(i.title=a.title),typeof a.description<"u"&&(i.description=a.description),typeof a.argsSchema<"u"&&(i.argsSchema=$r(a.argsSchema)),typeof a.callback<"u"&&(i.callback=a.callback),typeof a.enabled<"u"&&(i.enabled=a.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,o&&Object.values(o).some(c=>{let u=c instanceof We?c._def?.innerType:c;return jd(u)})&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,r,n,o,s,i,a,c,u){Md(e);let d={title:r,description:n,inputSchema:ey(o),outputSchema:ey(s),annotations:i,execution:a,_meta:c,handler:u,enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:l=>{typeof l.name<"u"&&l.name!==e&&(typeof l.name=="string"&&Md(l.name),delete this._registeredTools[e],l.name&&(this._registeredTools[l.name]=d)),typeof l.title<"u"&&(d.title=l.title),typeof l.description<"u"&&(d.description=l.description),typeof l.paramsSchema<"u"&&(d.inputSchema=$r(l.paramsSchema)),typeof l.outputSchema<"u"&&(d.outputSchema=$r(l.outputSchema)),typeof l.callback<"u"&&(d.handler=l.callback),typeof l.annotations<"u"&&(d.annotations=l.annotations),typeof l._meta<"u"&&(d._meta=l._meta),typeof l.enabled<"u"&&(d.enabled=l.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}tool(e,...r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let n,o,s,i;if(typeof r[0]=="string"&&(n=r.shift()),r.length>1){let c=r[0];Ad(c)?(o=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!Ad(r[0])&&(i=r.shift())):typeof c=="object"&&c!==null&&(i=r.shift())}let a=r[0];return this._createRegisteredTool(e,void 0,n,o,s,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,r,n){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let{title:o,description:s,inputSchema:i,outputSchema:a,annotations:c,_meta:u}=r;return this._createRegisteredTool(e,o,s,i,a,c,{taskSupport:"forbidden"},u,n)}prompt(e,...r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let n;typeof r[0]=="string"&&(n=r.shift());let o;r.length>1&&(o=r.shift());let s=r[0],i=this._createRegisteredPrompt(e,void 0,n,o,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,r,n){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let{title:o,description:s,argsSchema:i}=r,a=this._createRegisteredPrompt(e,o,s,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,r){return this.server.sendLoggingMessage(e,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var ET={type:"object",properties:{}};function ry(t){return t!==null&&typeof t=="object"&&"parse"in t&&typeof t.parse=="function"&&"safeParse"in t&&typeof t.safeParse=="function"}function TT(t){return"_def"in t||"_zod"in t||ry(t)}function Ad(t){return typeof t!="object"||t===null||TT(t)?!1:Object.keys(t).length===0?!0:Object.values(t).some(ry)}function ey(t){if(t)return Ad(t)?$r(t):t}function PT(t){let e=Xt(t);return e?Object.entries(e).map(([r,n])=>{let o=Zp(n),s=jp(n);return{name:r,description:o,required:!s}}):[]}function ur(t){let r=Xt(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=$s(r);if(typeof n=="string")return n;throw new Error("Schema method literal must be a string")}function ty(t){return{completion:{values:t.slice(0,100),total:t.length,hasMore:t.length>100}}}var Vo={completion:{values:[],hasMore:!1}};import oy from"node:process";var Di=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
48
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),RT(r)}clear(){this._buffer=void 0}};function RT(t){return fm.parse(JSON.parse(t))}function ny(t){return JSON.stringify(t)+`
|
|
49
|
+
`}var qi=class{constructor(e=oy.stdin,r=oy.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new Di,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=ny(e);this._stdout.write(n)?r():this._stdout.once("drain",r)})}};var JP=mr(Qy(),1),YP=mr(Kd(),1),XP=mr(Xd(),1),uv=mr(Xi(),1),QP=mr(cv(),1);var ea=uv.default;import*as Pt from"os";import*as we from"fs";import*as vt from"path";import*as lv from"net";import*as dv from"http";import{createRequire as e1}from"module";import{exec as t1}from"child_process";var r1=e1(import.meta.url),n1=r1("../package.json"),fv=n1.version||"0.0.0",pv=process.env.MCP_FEEDBACK_DEBUG==="true",mv=vt.join(Pt.homedir(),".config","mcp-feedback-enhanced"),Dr=vt.join(mv,"servers"),cf=vt.join(mv,"hooks"),af=vt.join(cf,"feedback-tracking.json"),o1=5e3,s1=3e4,i1=1e3,a1=3,c1=2e3;function Z(t){pv&&console.error(`[MCP Feedback] ${t}`)}function u1(t,e){try{we.existsSync(cf)||we.mkdirSync(cf,{recursive:!0});let r={};if(we.existsSync(af))try{r=JSON.parse(we.readFileSync(af,"utf-8"))}catch{}r[t]={feedbackGiven:!0,userEnded:e,timestamp:Date.now()};let n=Date.now()-36e5;for(let o of Object.keys(r))r[o].timestamp<n&&delete r[o];we.writeFileSync(af,JSON.stringify(r,null,2)),Z(`Recorded feedback call: generation=${t}, userEnded=${e}`)}catch(r){Z(`Failed to record feedback call: ${r}`)}}var Pe=null,Bt=!1,qe=new Map,ta=null;function l1(t){return new Promise(e=>{let r=new lv.Socket,n=!1,o=()=>{n||(n=!0,r.destroy())};r.setTimeout(i1),r.on("connect",()=>{o(),e(!0)}),r.on("error",()=>{o(),e(!1)}),r.on("timeout",()=>{o(),e(!1)}),r.connect(t,"127.0.0.1")})}async function d1(){try{if(!we.existsSync(Dr))return Z("Servers directory not found"),[];let t=we.readdirSync(Dr),e=[];for(let r of t)if(r.endsWith(".json"))try{let n=JSON.parse(we.readFileSync(vt.join(Dr,r),"utf-8"));try{if(process.kill(n.pid,0),await l1(n.port))e.push({...n,workspaces:n.workspaces||[]});else{Z(`Skipping server with unresponsive port: pid=${n.pid}, port=${n.port}`);try{we.unlinkSync(vt.join(Dr,r)),Z(`Removed stale server file: ${r}`)}catch{}}}catch{Z(`Skipping dead server: pid=${n.pid}`)}}catch{}return e}catch(t){return Z(`Error reading servers: ${t}`),[]}}function f1(){try{if(!we.existsSync(Dr))return Z("Servers directory not found"),[];let t=we.readdirSync(Dr),e=[];for(let r of t)if(r.endsWith(".json"))try{let n=JSON.parse(we.readFileSync(vt.join(Dr,r),"utf-8"));try{process.kill(n.pid,0),e.push({...n,workspaces:n.workspaces||[]})}catch{Z(`Skipping dead server: pid=${n.pid}`)}}catch{}return e}catch(t){return Z(`Error reading servers: ${t}`),[]}}async function hv(t){let e=await d1();if(Z(`Looking for Extension for project: ${t}`),Z(`Found ${e.length} live Extension server(s) with valid ports`),e.length===0)return null;let r=process.env.CURSOR_TRACE_ID||"";if(Z(`My CURSOR_TRACE_ID: ${r||"(not set)"}`),r){let a=e.filter(c=>c.cursorTraceId===r);if(a.length===1)return Z(`\u2713 Strategy 0: Single CURSOR_TRACE_ID match: port=${a[0].port}, pid=${a[0].pid}`),a[0];if(a.length>1){Z(` Strategy 0: Multiple CURSOR_TRACE_ID matches (${a.length}), checking workspace...`);let c=t.replace(/\/+$/,""),u=a.find(d=>d.workspaces?.some(l=>{let h=l.replace(/\/+$/,"");return h===c||c.startsWith(h+"/")||h.startsWith(c+"/")}));if(u)return Z(`\u2713 Strategy 0: CURSOR_TRACE_ID + workspace match: port=${u.port}, pid=${u.pid}`),u;Z(" Strategy 0: No workspace match among trace ID matches, trying other strategies...")}}let n=e.filter(a=>a.workspaces?.includes(t));if(n.length===1)return Z(`\u2713 Exact workspace match (single): port=${n[0].port}`),n[0];if(n.length>1){let a=n.sort((c,u)=>u.timestamp-c.timestamp);return Z(`\u2713 Exact workspace match (multiple, taking most recent): port=${a[0].port}`),a[0]}for(let a of e)for(let c of a.workspaces||[])if(t.startsWith(c+vt.sep)||c.startsWith(t+vt.sep))return Z(`\u2713 Prefix workspace match: port=${a.port}, workspace=${c}`),a;let o=process.ppid,s=e.find(a=>a.parentPid===o);if(s)return Z(`\u2713 parentPid match: port=${s.port}`),s;if(e.length===1)return Z(`\u2713 Single server fallback: port=${e[0].port}`),e[0];let i=e.sort((a,c)=>c.timestamp-a.timestamp);return Z(`\u2713 Using most recent server: port=${i[0].port}`),Z(" Available servers:"),i.forEach(a=>{Z(` - pid=${a.pid}, port=${a.port}, traceId=${a.cursorTraceId}, workspaces=${a.workspaces?.join(", ")}`)}),i[0]}var ra=null,p1="";async function m1(t,e=a1){let r=null;for(let n=1;n<=e;n++)try{await h1(t);return}catch(o){if(r=o,Z(`Connection attempt ${n}/${e} failed: ${o.message}`),n<e){let s=c1*n;Z(`Retrying in ${s}ms...`),await new Promise(i=>setTimeout(i,s))}}throw r||new Error("Connection failed after retries")}async function h1(t){let e=await hv(t);if(!e)throw new Error(`No MCP Feedback Extension found for project: ${t}. Please ensure the extension is installed and a Cursor window is open with this project.`);let r=`ws://127.0.0.1:${e.port}/ws`;return Z(`Connecting to Extension at ${r} for project ${t}`),new Promise((n,o)=>{Pe=new ea(r),Pe.on("open",()=>{Z("Connected to Extension WebSocket Server"),Bt=!0,ra=e.port,p1=t,Pe?.send(JSON.stringify({type:"register",clientType:"mcp-server",pid:process.pid,parentPid:process.ppid})),n()}),Pe.on("message",s=>{try{let i=JSON.parse(s.toString());g1(i)}catch(i){Z(`Parse error: ${i}`)}}),Pe.on("close",()=>{Z("Disconnected from Extension");let s=Bt;if(Bt=!1,ra=null,Pe=null,s&&qe.size>0){Z(`Connection lost with ${qe.size} pending requests - rejecting all`);let i=new Error("Connection closed unexpectedly");for(let[a,c]of qe.entries())clearTimeout(c.timeout),c.reject(i);qe.clear()}}),Pe.on("error",s=>{Z(`WebSocket error: ${s.message}`),Bt||o(s)}),setTimeout(()=>{Bt||(Pe?.close(),Pe=null,Bt=!1,o(new Error(`Connection timeout to ${r}`)))},o1)})}async function gv(t){let e=await hv(t);if(!e)throw new Error(`No MCP Feedback Extension found for project: ${t}. Please open the project in Cursor with the MCP Feedback extension installed.`);Bt&&Pe?.readyState===ea.OPEN&&ra===e.port||(Pe&&(Z("Closing existing connection for reconnect"),Pe.close(),Pe=null,Bt=!1,ra=null),await m1(t))}function g1(t){switch(Z(`Received: ${t.type}`),t.type){case"connection_established":Z(`Connected to Extension v${t.version}`);break;case"feedback_result":let e=qe.get(t.session_id);e&&(clearTimeout(e.timeout),e.resolve({feedback:t.feedback,images:t.images||[]}),qe.delete(t.session_id));break;case"feedback_error":let r=qe.get(t.session_id);r&&(clearTimeout(r.timeout),r.reject(new Error(t.error)),qe.delete(t.session_id));break;case"pong":break;case"pending_comment_result":let n=qe.get(t.request_id);n&&(clearTimeout(n.timeout),n.resolve(t.comment||""),qe.delete(t.request_id));break}}async function _1(t,e,r,n){try{await gv(t)}catch(i){return Z(`Extension not available, falling back to browser: ${i.message}`),_v(t,e,r)}let o=`session_${Date.now()}_${Math.random().toString(36).substring(2,11)}`,s=n;if(!s||s==="Agent")if(ta)s=ta;else{let a=(e.split(`
|
|
50
|
+
`).find(c=>c.trim().length>0)||e).replace(/^[#*\->\s]+/,"").trim();s=a.length>50?a.substring(0,47)+"...":a,s||(s="Agent"),ta=s}else ta=s;return new Promise((i,a)=>{let c=setTimeout(()=>{qe.delete(o),a(new Error(`Feedback timeout after ${r} seconds`))},r*1e3);qe.set(o,{resolve:i,reject:a,timeout:c}),Pe?.send(JSON.stringify({type:"feedback_request",session_id:o,project_directory:t,summary:e,timeout:r,agent_name:s})),Z(`Feedback request sent: session=${o}, agent=${s||"default"}`)})}async function y1(t){try{await gv(t)}catch(r){return Z(`Extension not available for pending comment: ${r.message}`),""}let e=`req_${Date.now()}_${Math.random().toString(36).substring(2,9)}`;return new Promise(r=>{let n=setTimeout(()=>{qe.get(e)&&(qe.delete(e),Z(`Pending comment timeout: ${e}`),r(""))},1e3);qe.set(e,{resolve:o=>r(o),reject:()=>r(""),timeout:n}),Pe?.send(JSON.stringify({type:"get_pending_comment",request_id:e,project_directory:t}))})}function v1(t){let e=Pt.platform(),r;e==="darwin"?r=`open "${t}"`:e==="win32"?r=`start "" "${t}"`:r=`xdg-open "${t}"`,t1(r,n=>{n&&Z(`Failed to open browser: ${n.message}`)})}function b1(t,e){return`<!DOCTYPE html>
|
|
51
51
|
<html lang="en">
|
|
52
52
|
<head>
|
|
53
53
|
<meta charset="UTF-8">
|
|
@@ -235,7 +235,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
235
235
|
}
|
|
236
236
|
</script>
|
|
237
237
|
</body>
|
|
238
|
-
</html>`}async function
|
|
238
|
+
</html>`}async function _v(t,e,r){return new Promise((n,o)=>{let s=dv.createServer();s.listen(0,"127.0.0.1",()=>{let i=s.address();if(!i||typeof i=="string"){o(new Error("Failed to start HTTP server"));return}let a=i.port;Z(`Browser feedback server started on port ${a}`);let c=!1;s.on("request",(l,h)=>{if(l.method==="GET"&&l.url==="/")h.writeHead(200,{"Content-Type":"text/html"}),h.end(b1(e,a));else if(l.method==="POST"&&l.url==="/submit"){let m="";l.on("data",f=>m+=f),l.on("end",()=>{try{let f=JSON.parse(m);c=!0,clearTimeout(d),h.writeHead(200,{"Content-Type":"application/json"}),h.end(JSON.stringify({success:!0})),setTimeout(()=>{s.close(),n({feedback:f.feedback||"",images:[]})},1e3)}catch{h.writeHead(400),h.end("Invalid request")}})}else h.writeHead(404),h.end("Not found")});let u=`http://127.0.0.1:${a}`;Z(`Opening browser: ${u}`),v1(u);let d=setTimeout(()=>{c||(s.close(),o(new Error(`Browser feedback timeout after ${r} seconds`)))},r*1e3);s.on("close",()=>{clearTimeout(d)})}),s.on("error",i=>{o(new Error(`Failed to start browser feedback server: ${i.message}`))})})}var na=new Ai({name:"mcp-feedback-enhanced",version:fv});na.tool("interactive_feedback",`Interactive feedback collection tool for AI agents.
|
|
239
239
|
|
|
240
240
|
USAGE RULES (you MUST follow these):
|
|
241
241
|
1. During any process, task, or conversation, whether asking, replying, or completing phased tasks, you MUST call this tool to collect user feedback.
|
|
@@ -243,5 +243,9 @@ USAGE RULES (you MUST follow these):
|
|
|
243
243
|
3. Whenever user feedback is received and the feedback content is not empty, you MUST call this tool again after adjusting behavior based on the feedback.
|
|
244
244
|
4. Only when the user explicitly indicates "end" or "no more interaction needed" can you stop calling this tool.
|
|
245
245
|
5. You MUST summarize what you have done in the summary parameter, and provide the correct project_directory so the user knows the context.
|
|
246
|
-
6. NEVER end your turn without calling this tool first. If you are about to finish, call this tool to confirm with the user.`,{project_directory:rs().describe("The project directory path for context"),summary:rs().describe("Summary of AI work completed for user review"),timeout:
|
|
247
|
-
|
|
246
|
+
6. NEVER end your turn without calling this tool first. If you are about to finish, call this tool to confirm with the user.`,{project_directory:rs().describe("The project directory path for context"),summary:rs().describe("Summary of AI work completed for user review"),timeout:_f().optional().default(86400).describe("Timeout in seconds (default: 86400 = 24 hours)"),agent_name:rs().optional().describe('Unique identifier for this agent/chat session. You MUST provide this parameter with your current conversation/chat title or a short descriptive name of the task (e.g. "Chat 1", "Pre-credit Implementation", "Bug Fix #123"). If not provided, defaults to "Agent" and all messages will appear in the same tab. Providing a unique name allows multiple agents to have separate conversation tabs.')},async({project_directory:t,summary:e,timeout:r,agent_name:n})=>{Z(`interactive_feedback called: project=${t}, agent=${n||"default"}`);let o=r||86400,s;try{s=await _1(t,e,o,n)}catch(l){Z(`Panel feedback failed: ${l.message}, falling back to browser`);try{s=await _v(t,e,o)}catch(h){return Z(`Browser fallback also failed: ${h.message}`),{content:[{type:"text",text:`Error: Both panel and browser feedback failed. Panel: ${l.message}. Browser: ${h.message}`}],isError:!0}}}let a=["exit","done","stop","end","quit","\u9000\u51FA\u4E86","\u7ED3\u675F","\u9000\u51FA","\u5B8C\u6210\u4E86","\u5B8C\u4E86","bye"].some(l=>s.feedback.toLowerCase().includes(l.toLowerCase())),c=process.env.CURSOR_GENERATION_ID||`gen_${Date.now()}`;u1(c,a);let u=a?`
|
|
247
|
+
|
|
248
|
+
[System: User has indicated they want to end this session. You may stop calling interactive_feedback.]`:`
|
|
249
|
+
|
|
250
|
+
[System: Continue following the interactive_feedback USAGE RULES. Call this tool when appropriate.]`,d=[{type:"text",text:`User Feedback:
|
|
251
|
+
${s.feedback}${u}`}];if(s.images&&s.images.length>0){Z(`Processing ${s.images.length} image(s)`);for(let l of s.images)l&&l.data&&(d.push({type:"image",data:l.data,mimeType:"image/png"}),Z(`Added image: ${l.name||"unnamed"}`))}return{content:d}});na.tool("get_system_info","Get system environment information",{},async()=>{let t={platform:Pt.platform(),hostname:Pt.hostname(),user:Pt.userInfo().username,homeDir:Pt.homedir(),nodeVersion:process.version,pid:process.pid,parentPid:process.ppid,extensionConnected:Bt};return{content:[{type:"text",text:JSON.stringify(t,null,2)}]}});na.resource("pending","feedback://pending",async t=>{let e=process.cwd();Z(`Reading resource feedback://pending for project: ${e}`);try{let r=await y1(e);return{contents:[{uri:t.href,mimeType:"text/plain",text:r||"No pending comment."}]}}catch(r){return{contents:[{uri:t.href,mimeType:"text/plain",text:`Error fetching pending comment: ${r.message}`}],isError:!0}}});async function x1(){if(Z("MCP Feedback Server starting..."),Z(`PID: ${process.pid}, Parent PID: ${process.ppid}`),Z(`Version: ${fv}`),pv){console.error("[MCP Feedback] Environment:"),Object.keys(process.env).filter(r=>r.includes("CURSOR")||r.includes("VSCODE")||r.includes("MCP")).forEach(r=>console.error(` ${r}=${process.env[r]}`));let e=f1();console.error(`[MCP Feedback] Available servers: ${e.length}`),e.forEach(r=>{console.error(` - port=${r.port}, workspaces=${r.workspaces?.join(", ")}`)})}let t=new qi;await na.connect(t),Z("MCP Server running on stdio, will connect to Extension on first feedback request"),setInterval(()=>{Pe?.readyState===ea.OPEN&&Pe.send(JSON.stringify({type:"ping"}))},s1)}x1().catch(t=>{console.error("Fatal error:",t),process.exit(1)});
|